vendor: 8,707 bytes, lines 1-2
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-CU67Zn6k.js","assets/html-GMplVEZG.js","assets/javascript-wDzz0qaB.js","assets/css-DPfMkruS.js","assets/angular-ts-BwZT4LLn.js","assets/scss-OYdSNvt2.js","assets/apl-dKokRX4l.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-CbQHKStN.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-D4QpJJKB.js","assets/html-derivative-BFtXZ54Q.js","assets/sql-BLtJtn59.js","assets/bsl-BO_Y6i37.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/cobol-nwyudZeR.js","assets/coffee-Ch7k5sss.js","assets/cpp-CofmeUqb.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/c-BIGW1oBm.js","assets/crystal-tKQVLTB8.js","assets/shellscript-Yzrsuije.js","assets/edge-BkV0erSs.js","assets/elixir-CDX3lj18.js","assets/elm-DbKCFpqz.js","assets/erb-B12qg9BL.js","assets/ruby-Dw2BHqvy.js","assets/haml-B8DHNrY2.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-BOOCDP_w.js","assets/gdshader-DkwncUOv.js","assets/gdscript-C5YyOfLZ.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-Rg0-pVw9.js","assets/glimmer-ts-U6CK756n.js","assets/hack-CaT9iCJl.js","assets/handlebars-BL8al0AC.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-Bvhsp5Yf.js","assets/haxe-CzTSHFRz.js","assets/jinja-4LBKfQ-Z.js","assets/jison-wvAkD_A8.js","assets/julia-CxzCAyBv.js","assets/r-Dspwwk_N.js","assets/just-Cw27pwNe.js","assets/perl-C0TMdlhV.js","assets/latex-CWtU0Tv5.js","assets/tex-idrVyKtj.js","assets/liquid-DYVedYrR.js","assets/marko-CnJfTvn9.js","assets/less-B1dDrJ26.js","assets/mdc-BMNejdWA.js","assets/nextflow-Zz6hmt5N.js","assets/nextflow-groovy-BeH2EWoN.js","assets/nginx-BpAMiNFr.js","assets/nim-CVrawwO9.js","assets/php-Dhbhpdrm.js","assets/pug-CGlum2m_.js","assets/qml-3beO22l8.js","assets/razor-Uh8Bk_45.js","assets/csharp-COcwbKMJ.js","assets/rst-BrH8l1NY.js","assets/cmake-D1j8_8rp.js","assets/sas-cz2c8ADy.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-Brmx7dQM.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-BH5u7GGu.js","assets/surrealql-Bq5Q-fJD.js","assets/svelte-C_ipcX3V.js","assets/templ-P3uqSqPl.js","assets/go-CxLEBnE3.js","assets/ts-tags-zn1MmPIZ.js","assets/twig-DNn4PbVi.js","assets/vue-DN_0RTcg.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-CQOfvN7w.js","assets/stylus-BEDo0Tqx.js","assets/xsl-CtQFsRM5.js"])))=>i.map(i=>d[i]); 2function lq(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function xc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var h2={exports:{}},ng={};var zL;function yoe(){if(zL)return ng;zL=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,i){var o=null;if(i!==void 0&&(o=""+i),a.key!==void 0&&(o=""+a.key),"key"in a){i={};for(var l in a)l!=="key"&&(i[l]=a[l])}else i=a;return a=i.ref,{$$typeof:e,type:r,key:o,ref:a!==void 0?a:null,props:i}}return ng.Fragment=t,ng.jsx=n,ng.jsxs=n,ng}var HL;function voe(){return HL||(HL=1,h2.exports=yoe()),h2.exports}var s=voe(),p2={exports:{}},hs={};var qL;function woe(){if(qL)return hs;qL=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),p=Symbol.iterator;function m(z){return z===null||typeof z!="object"?null:(z=p&&z[p]||z["@@iterator"],typeof z=="function"?z:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,b={};function y(z,W,D){this.props=z,this.context=W,this.refs=b,this.updater=D||g}y.prototype.isReactComponent={},y.prototype.setState=function(z,W){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,W,"setState")},y.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function v(){}v.prototype=y.prototype;function w(z,W,D){this.props=z,this.context=W,this.refs=b,this.updater=D||g}var j=w.prototype=new v;j.constructor=w,x(j,y.prototype),j.isPureReactComponent=!0;var E=Array.isArray;function S(){}var _={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function C(z,W,D){var Z=D.ref;return{$$typeof:e,type:z,key:W,ref:Z!==void 0?Z:null,props:D}}function N(z,W){return C(z.type,W,z.props)}function A(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function T(z){var W={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(D){return W[D]})}var I=/\/+/g;function $(z,W){return typeof z=="object"&&z!==null&&z.key!=null?T(""+z.key):W.toString(36)}function O(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(S,S):(z.status="pending",z.then(function(W){z.status==="pending"&&(z.status="fulfilled",z.value=W)},function(W){z.status==="pending"&&(z.status="rejected",z.reason=W)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function U(z,W,D,Z,V){var L=typeof z;(L==="undefined"||L==="boolean")&&(z=null);var K=!1;if(z===null)K=!0;else switch(L){case"bigint":case"string":case"number":K=!0;break;case"object":switch(z.$$typeof){case e:case t:K=!0;break;case d:return K=z._init,U(K(z._payload),W,D,Z,V)}}if(K)return V=V(z),K=Z===""?"."+$(z,0):Z,E(V)?(D="",K!=null&&(D=K.replace(I,"$&/")+"/"),U(V,W,D,"",function(Y){return Y})):V!=null&&(A(V)&&(V=N(V,D+(V.key==null||z&&z.key===V.key?"":(""+V.key).replace(I,"$&/")+"/")+K)),W.push(V)),1;K=0;var te=Z===""?".":Z+":";if(E(z))for(var Q=0;Q<z.length;Q++)Z=z[Q],L=te+$(Z,Q),K+=U(Z,W,D,L,V);else if(Q=m(z),typeof Q=="function")for(z=Q.call(z),Q=0;!(Z=z.next()).done;)Z=Z.value,L=te+$(Z,Q++),K+=U(Z,W,D,L,V);else if(L==="object"){if(typeof z.then=="function")return U(O(z),W,D,Z,V);throw W=String(z),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return K}function F(z,W,D){if(z==null)return z;var Z=[],V=0;return U(z,Z,"","",function(L){return W.call(D,L,V++)}),Z}function H(z){if(z._status===-1){var W=z._result;W=W(),W.then(function(D){(z._status===0||z._status===-1)&&(z._status=1,z._result=D)},function(D){(z._status===0||z._status===-1)&&(z._status=2,z._result=D)}),z._status===-1&&(z._status=0,z._result=W)}if(z._status===1)return z._result.default;throw z._result}var G=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)}
vendor: 4,647 bytes, line 2
2,M={map:F,forEach:function(z,W,D){F(z,function(){W.apply(this,arguments)},D)},count:function(z){var W=0;return F(z,function(){W++}),W},toArray:function(z){return F(z,function(W){return W})||[]},only:function(z){if(!A(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return hs.Activity=h,hs.Children=M,hs.Component=y,hs.Fragment=n,hs.Profiler=a,hs.PureComponent=w,hs.StrictMode=r,hs.Suspense=c,hs.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=_,hs.__COMPILER_RUNTIME={__proto__:null,c:function(z){return _.H.useMemoCache(z)}},hs.cache=function(z){return function(){return z.apply(null,arguments)}},hs.cacheSignal=function(){return null},hs.cloneElement=function(z,W,D){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var Z=x({},z.props),V=z.key;if(W!=null)for(L in W.key!==void 0&&(V=""+W.key),W)!k.call(W,L)||L==="key"||L==="__self"||L==="__source"||L==="ref"&&W.ref===void 0||(Z[L]=W[L]);var L=arguments.length-2;if(L===1)Z.children=D;else if(1<L){for(var K=Array(L),te=0;te<L;te++)K[te]=arguments[te+2];Z.children=K}return C(z.type,V,Z)},hs.createContext=function(z){return z={$$typeof:o,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:i,_context:z},z},hs.createElement=function(z,W,D){var Z,V={},L=null;if(W!=null)for(Z in W.key!==void 0&&(L=""+W.key),W)k.call(W,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(V[Z]=W[Z]);var K=arguments.length-2;if(K===1)V.children=D;else if(1<K){for(var te=Array(K),Q=0;Q<K;Q++)te[Q]=arguments[Q+2];V.children=te}if(z&&z.defaultProps)for(Z in K=z.defaultProps,K)V[Z]===void 0&&(V[Z]=K[Z]);return C(z,L,V)},hs.createRef=function(){return{current:null}},hs.forwardRef=function(z){return{$$typeof:l,render:z}},hs.isValidElement=A,hs.lazy=function(z){return{$$typeof:d,_payload:{_status:-1,_result:z},_init:H}},hs.memo=function(z,W){return{$$typeof:u,type:z,compare:W===void 0?null:W}},hs.startTransition=function(z){var W=_.T,D={};_.T=D;try{var Z=z(),V=_.S;V!==null&&V(D,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(S,G)}catch(L){G(L)}finally{W!==null&&D.types!==null&&(W.types=D.types),_.T=W}},hs.unstable_useCacheRefresh=function(){return _.H.useCacheRefresh()},hs.use=function(z){return _.H.use(z)},hs.useActionState=function(z,W,D){return _.H.useActionState(z,W,D)},hs.useCallback=function(z,W){return _.H.useCallback(z,W)},hs.useContext=function(z){return _.H.useContext(z)},hs.useDebugValue=function(){},hs.useDeferredValue=function(z,W){return _.H.useDeferredValue(z,W)},hs.useEffect=function(z,W){return _.H.useEffect(z,W)},hs.useEffectEvent=function(z){return _.H.useEffectEvent(z)},hs.useId=function(){return _.H.useId()},hs.useImperativeHandle=function(z,W,D){return _.H.useImperativeHandle(z,W,D)},hs.useInsertionEffect=function(z,W){return _.H.useInsertionEffect(z,W)},hs.useLayoutEffect=function(z,W){return _.H.useLayoutEffect(z,W)},hs.useMemo=function(z,W){return _.H.useMemo(z,W)},hs.useOptimistic=function(z,W){return _.H.useOptimistic(z,W)},hs.useReducer=function(z,W,D){return _.H.useReducer(z,W,D)},hs.useRef=function(z){return _.H.useRef(z)},hs.useState=function(z){return _.H.useState(z)},hs.useSyncExternalStore=function(z,W,D){return _.H.useSyncExternalStore(z,W,D)},hs.useTransition=function(){return _.H.useTransition()},hs.version="19.2.4",hs}var WL;function cq(){return WL||(WL=1,p2.exports=woe()),p2.exports}var f=cq();const B=xc(f),joe=lq({__proto__:null,default:B},[f]);var m2={exports:{}},f2,VL;function _oe(){if(VL)return f2;VL=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return f2=e,f2}var g2,GL;function koe(){if(GL)return g2;GL=1;var e=_oe();function t(){}function n(){}return n.resetWarningCache=t,g2=function(){function r(o,l,c,u,d,h){if(h!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},g2}var YL;function Noe(){return YL||(YL=1,m2.exports=koe()()),m2.exports}var Eoe=Noe();const Qt=xc(Eoe);var x2,KL;function Soe(){if(KL)return x2;KL=1;var e=typeof Element<"u",t=typeof Map=="function",n=typeof Set=="function",r=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function a(i,o){if(i===o)return!0;
2if(i&&o&&typeof i=="object"&&typeof o=="object"){if(i.constructor!==o.constructor)return!1;var l,c,u;if(Array.isArray(i)){if(l=i.length,l!=o.length)return!1;for(c=l;c--!==0;)if(!a(i[c],o[c]))return!1;return!0}var d;if(t&&i instanceof Map&&o instanceof Map){if(i.size!==o.size)return!1;for(d=i.entries();!(c=d.next()).done;)if(!o.has(c.value[0]))return!1;for(d=i.entries();!(c=d.next()).done;)if(!a(c.value[1],o.get(c.value[0])))return!1;return!0}if(n&&i instanceof Set&&o instanceof Set){if(i.size!==o.size)return!1;for(d=i.entries();!(c=d.next()).done;)if(!o.has(c.value[0]))return!1;return!0}if(r&&ArrayBuffer.isView(i)&&ArrayBuffer.isView(o)){if(l=i.length,l!=o.length)return!1;for(c=l;c--!==0;)if(i[c]!==o[c])return!1;return!0}if(i.constructor===RegExp)return i.source===o.source&&i.flags===o.flags;if(i.valueOf!==Object.prototype.valueOf&&typeof i.valueOf=="function"&&typeof o.valueOf=="function")return i.valueOf()===o.valueOf();if(i.toString!==Object.prototype.toString&&typeof i.toString=="function"&&typeof o.toString=="function")return i.toString()===o.toString();if(u=Object.keys(i),l=u.length,l!==Object.keys(o).length)return!1;for(c=l;c--!==0;)if(!Object.prototype.hasOwnProperty.call(o,u[c]))return!1;if(e&&i instanceof Element)return!1;for(c=l;c--!==0;)if(!((u[c]==="_owner"||u[c]==="__v"||u[c]==="__o")&&i.$$typeof)&&!a(i[u[c]],o[u[c]]))return!1;return!0}return i!==i&&o!==o}return x2=function(o,l){try{return a(o,l)}catch(c){if((c.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw c}},x2}var Coe=Soe();const Toe=xc(Coe);var b2,XL;function Aoe(){if(XL)return b2;XL=1;var e=function(t,n,r,a,i,o,l,c){if(!t){var u;if(n===void 0)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[r,a,i,o,l,c],h=0;u=new Error(n.replace(/%s/g,function(){return d[h++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};return b2=e,b2}var Roe=Aoe();const JL=xc(Roe);var y2,QL;function Ioe(){return QL||(QL=1,y2=function(t,n,r,a){var i=r?r.call(a,t,n):void 0;if(i!==void 0)return!!i;if(t===n)return!0;if(typeof t!="object"||!t||typeof n!="object"||!n)return!1;var o=Object.keys(t),l=Object.keys(n);if(o.length!==l.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(n),u=0;u<o.length;u++){var d=o[u];if(!c(d))return!1;var h=t[d],p=n[d];if(i=r?r.call(a,h,p,d):void 0,i===!1||i===void 0&&h!==p)return!1}return!0}),y2}var Poe=Ioe();const Loe=xc(Poe);function nr(){return nr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nr.apply(this,arguments)}function M5(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,yC(e,t)}function yC(e,t){return yC=Object.setPrototypeOf||function(n,r){return n.__proto__=r,n},yC(e,t)}function ZL(e,t){if(e==null)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(a[n]=e[n]);return a}var ls={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},Ooe={rel:["amphtml","canonical","alternate"]},Moe={type:["application/ld+json"]},Doe={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},e6=Object.keys(ls).map(function(e){return ls[e]}),z1={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$oe=Object.keys(z1).reduce(function(e,t){return e[z1[t]]=t,e},{}),jm=function(e,t){for(var n=e.length-1;n>=0;n-=1){var r=e[n];if(Object.prototype.hasOwnProperty.call(r,t))return r[t]}return null},Foe=function(e){var t=jm(e,ls.TITLE),n=jm(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,function(){return t});var r=jm(e,"defaultTitle");return t||r||void 0},Boe=function(e){return jm(e,"onChangeClientState")||function(){}},v2=function(e,t){return t.filter(function(n){return n[e]!==void 0}).map(function(n){return n[e]}).reduce(function(n,r){return nr({},n,r)},{})},Uoe=function(e,t){return t.filter(function(n){return n[ls.BASE]!==void 0}).map(function(n){return n[ls.BASE]}).reverse().reduce(function(n,r){if(!n.length)for(var a=Object.keys(r),i=0;i<a.length;i+=1){var o=a[i].toLowerCase();if(e.indexOf(o)!==-1&&r[o])return n.concat(r)}return n},[])},rg=function(e,t,n){var r={};return n.filter(function(a){return!!Array.isArray(a[e])||(a[e]!==void 0&&console&&typeof console.warn=="function"&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof a[e]+'"'),!1)}).map(function(a){return a[e]}).reverse().reduce(function(a,i){var o={};i.filter(function(h){for(var p,m=Object.keys(h),g=0;g<m.length;g+=1){var x=m[g],b=x.toLowerCase();t.indexOf(b)===-1||p==="rel"&&h[p].toLowerCase()==="canonical"||b==="rel"&&h[b].toLowerCase()==="stylesheet"||(p=b),t.indexOf(x)===-1||x!=="innerHTML"&&x!=="cssText"&&x!=="itemprop"||(p=x)}if(!p||!h[p])return!1;var y=h[p].toLowerCase();return r[p]||(r[p]={}),o[p]||(o[p]={}),!r[p][y]&&(o[p][y]=!0,!0)}
2).reverse().forEach(function(h){return a.push(h)});for(var l=Object.keys(o),c=0;c<l.length;c+=1){var u=l[c],d=nr({},r[u],o[u]);r[u]=d}return a},[]).reverse()},zoe=function(e,t){if(Array.isArray(e)&&e.length){for(var n=0;n<e.length;n+=1)if(e[n][t])return!0}return!1},uq=function(e){return Array.isArray(e)?e.join(""):e},w2=function(e,t){return Array.isArray(e)?e.reduce(function(n,r){return(function(a,i){for(var o=Object.keys(a),l=0;l<o.length;l+=1)if(i[o[l]]&&i[o[l]].includes(a[o[l]]))return!0;return!1})(r,t)?n.priority.push(r):n.default.push(r),n},{priority:[],default:[]}):{default:e}},t6=function(e,t){var n;return nr({},e,((n={})[t]=void 0,n))},Hoe=[ls.NOSCRIPT,ls.SCRIPT,ls.STYLE],j2=function(e,t){return t===void 0&&(t=!0),t===!1?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},s6=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n]!==void 0?n+'="'+e[n]+'"':""+n;return t?t+" "+r:r},"")},n6=function(e,t){return t===void 0&&(t={}),Object.keys(e).reduce(function(n,r){return n[z1[r]||r]=e[r],n},t)},Vv=function(e,t){return t.map(function(n,r){var a,i=((a={key:r})["data-rh"]=!0,a);return Object.keys(n).forEach(function(o){var l=z1[o]||o;l==="innerHTML"||l==="cssText"?i.dangerouslySetInnerHTML={__html:n.innerHTML||n.cssText}:i[l]=n[o]}),B.createElement(e,i)})},Ii=function(e,t,n){switch(e){case ls.TITLE:return{toComponent:function(){return a=t.titleAttributes,(i={key:r=t.title})["data-rh"]=!0,o=n6(a,i),[B.createElement(ls.TITLE,o,r)];var r,a,i,o},toString:function(){return(function(r,a,i,o){var l=s6(i),c=uq(a);return l?"<"+r+' data-rh="true" '+l+">"+j2(c,o)+"</"+r+">":"<"+r+' data-rh="true">'+j2(c,o)+"</"+r+">"})(e,t.title,t.titleAttributes,n)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return n6(t)},toString:function(){return s6(t)}};default:return{toComponent:function(){return Vv(e,t)},toString:function(){return(function(r,a,i){return a.reduce(function(o,l){var c=Object.keys(l).filter(function(h){return!(h==="innerHTML"||h==="cssText")}).reduce(function(h,p){var m=l[p]===void 0?p:p+'="'+j2(l[p],i)+'"';return h?h+" "+m:m},""),u=l.innerHTML||l.cssText||"",d=Hoe.indexOf(r)===-1;return o+"<"+r+' data-rh="true" '+c+(d?"/>":">"+u+"</"+r+">")},"")})(e,t,n)}}}},vC=function(e){var t=e.baseTag,n=e.bodyAttributes,r=e.encode,a=e.htmlAttributes,i=e.noscriptTags,o=e.styleTags,l=e.title,c=l===void 0?"":l,u=e.titleAttributes,d=e.linkTags,h=e.metaTags,p=e.scriptTags,m={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var g=(function(x){var b=x.linkTags,y=x.scriptTags,v=x.encode,w=w2(x.metaTags,Doe),j=w2(b,Ooe),E=w2(y,Moe);return{priorityMethods:{toComponent:function(){return[].concat(Vv(ls.META,w.priority),Vv(ls.LINK,j.priority),Vv(ls.SCRIPT,E.priority))},toString:function(){return Ii(ls.META,w.priority,v)+" "+Ii(ls.LINK,j.priority,v)+" "+Ii(ls.SCRIPT,E.priority,v)}},metaTags:w.default,linkTags:j.default,scriptTags:E.default}})(e);m=g.priorityMethods,d=g.linkTags,h=g.metaTags,p=g.scriptTags}return{priority:m,base:Ii(ls.BASE,t,r),bodyAttributes:Ii("bodyAttributes",n,r),htmlAttributes:Ii("htmlAttributes",a,r),link:Ii(ls.LINK,d,r),meta:Ii(ls.META,h,r),noscript:Ii(ls.NOSCRIPT,i,r),script:Ii(ls.SCRIPT,p,r),style:Ii(ls.STYLE,o,r),title:Ii(ls.TITLE,{title:c,titleAttributes:u},r)}},ay=[],wC=function(e,t){var n=this;t===void 0&&(t=typeof document<"u"),this.instances=[],this.value={setHelmet:function(r){n.context.helmet=r},helmetInstances:{get:function(){return n.canUseDOM?ay:n.instances},add:function(r){(n.canUseDOM?ay:n.instances).push(r)},remove:function(r){var a=(n.canUseDOM?ay:n.instances).indexOf(r);(n.canUseDOM?ay:n.instances).splice(a,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=vC({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},dq=B.createContext({}),qoe=Qt.shape({setHelmet:Qt.func,helmetInstances:Qt.shape({get:Qt.func,add:Qt.func,remove:Qt.func})}),Woe=typeof document<"u",om=(function(e){function t(n){var r;return(r=e.call(this,n)||this).helmetData=new wC(r.props.context,t.canUseDOM),r}return M5(t,e),t.prototype.render=function(){return B.createElement(dq.Provider,{value:this.helmetData.value},this.props.children)},t})(f.Component);om.canUseDOM=Woe,om.propTypes={context:Qt.shape({helmet:Qt.shape()}),children:Qt.node.isRequired},om.defaultProps={context:{}},om.displayName="HelmetProvider";var hp=function(e,t){var n,r=document.head||document.querySelector(ls.HEAD),a=r.querySelectorAll(e+"[data-rh]"),i=[].slice.call(a),o=[];return t&&t.length&&t.forEach(function(l){var c=document.createElement(e);for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(u==="innerHTML"?c.innerHTML=l.innerHTML:u==="cssText"?c.styleSheet?c.styleSheet.cssText=l.cssText:c.appendChild(document.createTextNode(l.cssText)):c.setAttribute(u,l[u]===void 0?"":l[u]));c.setAttribute("data-rh","true"),i.some(function(d,h){return n=h,c.isEqualNode(d)})?i.splice(n,1):o.push(c)}
2),i.forEach(function(l){return l.parentNode.removeChild(l)}),o.forEach(function(l){return r.appendChild(l)}),{oldTags:i,newTags:o}},_2=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var r=n.getAttribute("data-rh"),a=r?r.split(","):[],i=[].concat(a),o=Object.keys(t),l=0;l<o.length;l+=1){var c=o[l],u=t[c]||"";n.getAttribute(c)!==u&&n.setAttribute(c,u),a.indexOf(c)===-1&&a.push(c);var d=i.indexOf(c);d!==-1&&i.splice(d,1)}for(var h=i.length-1;h>=0;h-=1)n.removeAttribute(i[h]);a.length===i.length?n.removeAttribute("data-rh"):n.getAttribute("data-rh")!==o.join(",")&&n.setAttribute("data-rh",o.join(","))}},r6=function(e,t){var n=e.baseTag,r=e.htmlAttributes,a=e.linkTags,i=e.metaTags,o=e.noscriptTags,l=e.onChangeClientState,c=e.scriptTags,u=e.styleTags,d=e.title,h=e.titleAttributes;_2(ls.BODY,e.bodyAttributes),_2(ls.HTML,r),(function(x,b){x!==void 0&&document.title!==x&&(document.title=uq(x)),_2(ls.TITLE,b)})(d,h);var p={baseTag:hp(ls.BASE,n),linkTags:hp(ls.LINK,a),metaTags:hp(ls.META,i),noscriptTags:hp(ls.NOSCRIPT,o),scriptTags:hp(ls.SCRIPT,c),styleTags:hp(ls.STYLE,u)},m={},g={};Object.keys(p).forEach(function(x){var b=p[x],y=b.newTags,v=b.oldTags;y.length&&(m[x]=y),v.length&&(g[x]=p[x].oldTags)}),t&&t(),l(e,m,g)},ag=null,H1=(function(e){function t(){for(var r,a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return(r=e.call.apply(e,[this].concat(i))||this).rendered=!1,r}M5(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(r){return!Loe(r,this.props)},n.componentDidUpdate=function(){this.emitChange()},n.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},n.emitChange=function(){var r,a,i=this.props.context,o=i.setHelmet,l=null,c=(r=i.helmetInstances.get().map(function(u){var d=nr({},u.props);return delete d.context,d}),{baseTag:Uoe(["href"],r),bodyAttributes:v2("bodyAttributes",r),defer:jm(r,"defer"),encode:jm(r,"encodeSpecialCharacters"),htmlAttributes:v2("htmlAttributes",r),linkTags:rg(ls.LINK,["rel","href"],r),metaTags:rg(ls.META,["name","charset","http-equiv","property","itemprop"],r),noscriptTags:rg(ls.NOSCRIPT,["innerHTML"],r),onChangeClientState:Boe(r),scriptTags:rg(ls.SCRIPT,["src","innerHTML"],r),styleTags:rg(ls.STYLE,["cssText"],r),title:Foe(r),titleAttributes:v2("titleAttributes",r),prioritizeSeoTags:zoe(r,"prioritizeSeoTags")});om.canUseDOM?(a=c,ag&&cancelAnimationFrame(ag),a.defer?ag=requestAnimationFrame(function(){r6(a,function(){ag=null})}):(r6(a),ag=null)):vC&&(l=vC(c)),o(l)},n.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},n.render=function(){return this.init(),null},t})(f.Component);H1.propTypes={context:qoe.isRequired},H1.displayName="HelmetDispatcher";var Voe=["children"],Goe=["children"],Gv=(function(e){function t(){return e.apply(this,arguments)||this}M5(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(r){return!Toe(t6(this.props,"helmetData"),t6(r,"helmetData"))},n.mapNestedChildrenToProps=function(r,a){if(!a)return null;switch(r.type){case ls.SCRIPT:case ls.NOSCRIPT:return{innerHTML:a};case ls.STYLE:return{cssText:a};default:throw new Error("<"+r.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(r){var a,i=r.child,o=r.arrayTypeChildren;return nr({},o,((a={})[i.type]=[].concat(o[i.type]||[],[nr({},r.newChildProps,this.mapNestedChildrenToProps(i,r.nestedChildren))]),a))},n.mapObjectTypeChildren=function(r){var a,i,o=r.child,l=r.newProps,c=r.newChildProps,u=r.nestedChildren;switch(o.type){case ls.TITLE:return nr({},l,((a={})[o.type]=u,a.titleAttributes=nr({},c),a));case ls.BODY:return nr({},l,{bodyAttributes:nr({},c)});case ls.HTML:return nr({},l,{htmlAttributes:nr({},c)});default:return nr({},l,((i={})[o.type]=nr({},c),i))}},n.mapArrayTypeChildrenToProps=function(r,a){var i=nr({},a);return Object.keys(r).forEach(function(o){var l;i=nr({},i,((l={})[o]=r[o],l))}),i}
2,n.warnOnInvalidChildren=function(r,a){return JL(e6.some(function(i){return r.type===i}),typeof r.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+e6.join(", ")+" are allowed. Helmet does not support rendering <"+r.type+"> elements. Refer to our API for more information."),JL(!a||typeof a=="string"||Array.isArray(a)&&!a.some(function(i){return typeof i!="string"}),"Helmet expects a string as a child of <"+r.type+">. Did you forget to wrap your children in braces? ( <"+r.type+">{``}</"+r.type+"> ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(r,a){var i=this,o={};return B.Children.forEach(r,function(l){if(l&&l.props){var c=l.props,u=c.children,d=ZL(c,Voe),h=Object.keys(d).reduce(function(m,g){return m[$oe[g]||g]=d[g],m},{}),p=l.type;switch(typeof p=="symbol"?p=p.toString():i.warnOnInvalidChildren(l,u),p){case ls.FRAGMENT:a=i.mapChildrenToProps(u,a);break;case ls.LINK:case ls.META:case ls.NOSCRIPT:case ls.SCRIPT:case ls.STYLE:o=i.flattenArrayTypeChildren({child:l,arrayTypeChildren:o,newChildProps:h,nestedChildren:u});break;default:a=i.mapObjectTypeChildren({child:l,newProps:a,newChildProps:h,nestedChildren:u})}}}),this.mapArrayTypeChildrenToProps(o,a)},n.render=function(){var r=this.props,a=r.children,i=ZL(r,Goe),o=nr({},i),l=i.helmetData;return a&&(o=this.mapChildrenToProps(a,o)),!l||l instanceof wC||(l=new wC(l.context,l.instances)),l?B.createElement(H1,nr({},o,{context:l.value,helmetData:void 0})):B.createElement(dq.Consumer,null,function(c){return B.createElement(H1,nr({},o,{context:c}))})},t})(f.Component);Gv.propTypes={base:Qt.object,bodyAttributes:Qt.object,children:Qt.oneOfType([Qt.arrayOf(Qt.node),Qt.node]),defaultTitle:Qt.string,defer:Qt.bool,encodeSpecialCharacters:Qt.bool,htmlAttributes:Qt.object,link:Qt.arrayOf(Qt.object),meta:Qt.arrayOf(Qt.object),noscript:Qt.arrayOf(Qt.object),onChangeClientState:Qt.func,script:Qt.arrayOf(Qt.object),style:Qt.arrayOf(Qt.object),title:Qt.string,titleAttributes:Qt.object,titleTemplate:Qt.string,prioritizeSeoTags:Qt.bool,helmetData:Qt.object},Gv.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},Gv.displayName="Helmet";var k2={exports:{}},na={};var a6;function Yoe(){if(a6)return na;a6=1;var e=cq();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)u+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function i(c,u,d){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:h==null?null:""+h,children:c,containerInfo:u,implementation:d}}var o=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return na.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,na.createPortal=function(c,u){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return i(c,u,null,d)},na.flushSync=function(c){var u=o.T,d=r.p;try{if(o.T=null,r.p=2,c)return c()}finally{o.T=u,r.p=d,r.d.f()}},na.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(c,u))},na.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},na.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,h=l(d,u.crossOrigin),p=typeof u.integrity=="string"?u.integrity:void 0,m=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?r.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:h,integrity:p,fetchPriority:m}):d==="script"&&r.d.X(c,{crossOrigin:h,integrity:p,fetchPriority:m,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},na.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=l(u.as,u.crossOrigin);r.d.M(c,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&r.d.M(c)},na.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,h=l(d,u.crossOrigin);r.d.L(c,d,{crossOrigin:h,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},na.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=l(u.as,u.crossOrigin);r.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else r.d.m(c)},na.requestFormReset=function(c){r.d.r(c)},na.unstable_batchedUpdates=function(c,u){return c(u)},na.useFormState=function(c,u,d){return o.H.useFormState(c,u,d)},na.useFormStatus=function(){return o.H.useHostTransitionStatus()},na.version="19.2.4",na}var i6;function Koe(){if(i6)return k2.exports;i6=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),k2.exports=Yoe(),k2.exports}var Mn=Koe();const Xoe=xc(Mn),hq=lq({__proto__:null,default:Xoe},[Mn]);function Un(){return Un=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Un.apply(null,arguments)}var hr;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(hr||(hr={}));const o6="popstate";function Joe(e){e===void 0&&(e={});function t(r,a){let{pathname:i,search:o,hash:l}=r.location;return nb("",{pathname:i,search:o,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}
vendor: 2,717 bytes, line 2
2function n(r,a){return typeof a=="string"?a:bh(a)}return Zoe(t,n,null,e)}function Cs(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function xh(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Qoe(){return Math.random().toString(36).substr(2,8)}function l6(e,t){return{usr:e.state,key:e.key,idx:t}}function nb(e,t,n,r){return n===void 0&&(n=null),Un({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Pu(t):t,{state:n,key:t&&t.key||r||Qoe()})}function bh(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Pu(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Zoe(e,t,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,l=hr.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Un({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function h(){l=hr.Pop;let b=d(),y=b==null?null:b-u;u=b,c&&c({action:l,location:x.location,delta:y})}function p(b,y){l=hr.Push;let v=nb(x.location,b,y);u=d()+1;let w=l6(v,u),j=x.createHref(v);try{o.pushState(w,"",j)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;a.location.assign(j)}i&&c&&c({action:l,location:x.location,delta:1})}function m(b,y){l=hr.Replace;let v=nb(x.location,b,y);u=d();let w=l6(v,u),j=x.createHref(v);o.replaceState(w,"",j),i&&c&&c({action:l,location:x.location,delta:0})}function g(b){let y=a.location.origin!=="null"?a.location.origin:a.location.href,v=typeof b=="string"?b:bh(b);return v=v.replace(/ $/,"%20"),Cs(y,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,y)}let x={get action(){return l},get location(){return e(a,o)},listen(b){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(o6,h),c=b,()=>{a.removeEventListener(o6,h),c=null}},createHref(b){return t(a,b)},createURL:g,encodeLocation(b){let y=g(b);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:p,replace:m,go(b){return o.go(b)}};return x}var tn;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(tn||(tn={}));const ele=new Set(["lazy","caseSensitive","path","id","index","children"]);function tle(e){return e.index===!0}function q1(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((a,i)=>{let o=[...n,String(i)],l=typeof a.id=="string"?a.id:o.join("-");if(Cs(a.index!==!0||!a.children,"Cannot specify children on an index route"),Cs(!r[l],'Found a route id collision on i
2d "'+l+`". Route id's must be globally unique within Data Router usages`),tle(a)){let c=Un({},a,t(a),{id:l});return r[l]=c,c}else{let c=Un({},a,t(a),{id:l,children:void 0});return r[l]=c,a.children&&(c.children=q1(a.children,t,o,r)),c}})}function eu(e,t,n){return n===void 0&&(n="/"),Yv(e,t,n,!1)}function Yv(e,t,n,r){let a=typeof t=="string"?Pu(t):t,i=hc(a.pathname||"/",n);if(i==null)return null;let o=pq(e);nle(o);let l=null,c=mle(i);for(let u=0;l==null&&u<o.length;++u)l=hle(o[u],c,r);return l}function sle(e,t){let{route:n,pathname:r,params:a}=e;return{id:n.id,pathname:r,params:a,data:t[n.id],handle:n.handle}}function pq(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let a=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(Cs(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=nc([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(Cs(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),pq(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:ule(u,i.index),routesMeta:d})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))a(i,o);else for(let c of mq(i.path))a(i,o,c)}),t}function mq(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let o=mq(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),a&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function nle(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:dle(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const rle=/^:[\w-]+$/,ale=3,ile=2,ole=1,lle=10,cle=-2,c6=e=>e==="*";function ule(e,t){let n=e.split("/"),r=n.length;return n.some(c6)&&(r+=cle),t&&(r+=ile),n.filter(a=>!c6(a)).reduce((a,i)=>a+(rle.test(i)?ale:i===""?ole:lle),r)}function dle(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function hle(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,a={},i="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,d=i==="/"?t:t.slice(i.length)||"/",h=W1({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),p=c.route;if(!h&&u&&n&&!r[r.length-1].route.index&&(h=W1({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;
vendor: 52,733 bytes, lines 2-3
2Object.assign(a,h.params),o.push({params:a,pathname:nc([i,h.pathname]),pathnameBase:ble(nc([i,h.pathnameBase])),route:p}),h.pathnameBase!=="/"&&(i=nc([i,h.pathnameBase]))}return o}function W1(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=ple(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce((u,d,h)=>{let{paramName:p,isOptional:m}=d;if(p==="*"){let x=l[h]||"";o=i.slice(0,i.length-x.length).replace(/(.)\/+$/,"$1")}const g=l[h];return m&&!g?u[p]=void 0:u[p]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function ple(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),xh(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function mle(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return xh(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function hc(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const fle=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,gle=e=>fle.test(e);function xle(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Pu(e):e,i;if(n)if(gle(n))i=n;else{if(n.includes("//")){let o=n;n=D5(n),xh(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=u6(n.substring(1),"/"):i=u6(n,t)}else i=t;return{pathname:i,search:yle(r),hash:vle(a)}}function u6(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function N2(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function fq(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function i_(e,t){let n=fq(e);return t?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function o_(e,t,n,r){r===void 0&&(r=!1);let a;typeof e=="string"?a=Pu(e):(a=Un({},e),Cs(!a.pathname||!a.pathname.includes("?"),N2("?","pathname","search",a)),Cs(!a.pathname||!a.pathname.includes("#"),N2("#","pathname","hash",a)),Cs(!a.search||!a.search.includes("#"),N2("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,l;if(o==null)l=n;else{let h=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),h-=1;a.pathname=p.join("/")}l=h>=0?t[h]:"/"}let c=xle(a,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const D5=e=>e.replace(/\/\/+/g,"/"),nc=e=>D5(e.join("/")),ble=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),yle=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,vle=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class V1{constructor(t,n,r,a){a===void 0&&(a=!1),this.status=t,this.statusText=n||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function yh(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const gq=["post","put","patch","delete"],wle=new Set(gq),jle=["get",...gq],_le=new Set(jle),kle=new Set([301,302,303,307,308]),Nle=new Set([307,308]),E2={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ele={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ig={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},$5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Sle=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),xq="remix-router-transitions";function Cle(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;Cs(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a;if(e.mapRouteProperties)a=e.mapRouteProperties;else if(e.detectErrorBoundary){let ne=e.detectErrorBoundary;a=ge=>({hasErrorBoundary:ne(ge)})}else a=Sle;let i={},o=q1(e.routes,a,void 0,i),l,c=e.basename||"/",u=e.dataStrategy||Ile,d=e.patchRoutesOnNavigation,h=Un({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),p=null,m=new Set,g=null,x=null,b=null,y=e.hydrationData!=null,v=eu(o,e.history.location,c),w=!1,j=null;if(v==null&&!d){let ne=Ja(404,{pathname:e.history.location.pathname}),{matches:ge,route:xe}=w6(o);v=ge,j={[xe.id]:ne}}v&&!e.hydrationData&&ye(v,o,e.history.location.pathname).active&&(v=null);let E;if(v)if(v.some(ne=>ne.route.lazy))E=!1;else if(!v.some(ne=>ne.route.loader))E=!0;else if(h.v7_partialHydration){let ne=e.hydrationData?e.hydrationData.loaderData:null,ge=e.hydrationData?e.hydrationData.errors:null;if(ge){let xe=v.findIndex(pe=>ge[pe.route.id]!==void 0);E=v.slice(0,xe+1).every(pe=>!_C(pe.route,ne,ge))}else E=v.every(xe=>!_C(xe.route,ne,ge))}else E=e.hydrationData!=null;else if(E=!1,v=[],h.v7_partialHydration){let ne=ye(null,o,e.history.location.pathname);ne.active&&ne.matches&&(w=!0,v=ne.matches)}let S,_={historyAction:e.history.action,location:e.history.location,matches:v,initialized:E,navigation:E2,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||j,fetchers:new Map,blockers:new Map},k=hr.Pop,C=!1,N,A=!1,T=new Map,I=null,$=!1,O=!1,U=[],F=new Set,H=new Map,G=0,M=-1,z=new Map,W=new Set,D=new Map,Z=new Map,V=new Set,L=new Map,K=new Map,te;function Q(){if(p=e.history.listen(ne=>{let{action:ge,location:xe,delta:pe}=ne;if(te){te(),te=void 0;return}xh(K.size===0||pe!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Ne=Qe({currentLocation:_.location,nextLocation:xe,historyAction:ge});if(Ne&&pe!=null){let Ue=new Promise(dt=>{te=dt});e.history.go(pe*-1),$e(Ne,{state:"blocked",location:xe,proceed(){$e(Ne,{state:"proceeding",proceed:void 0,reset:void 0,location:xe}),Ue.then(()=>e.history.go(pe))},reset(){let dt=new Map(_.blockers);dt.set(Ne,ig),P({blockers:dt})}});return}return me(ge,xe)}),n){Vle(t,T);let ne=()=>Gle(t,T);t.addEventListener("pagehide",ne),I=()=>t.removeEventListener("pagehide",ne)}return _.initialized||me(hr.Pop,_.location,{initialHydration:!0}),S}function Y(){p&&p(),I&&I(),m.clear(),N&&N.abort(),_.fetchers.forEach((ne,ge)=>ut(ge)),_.blockers.forEach((ne,ge)=>Jt(ge))}function J(ne){return m.add(ne),()=>m.delete(ne)}function P(ne,ge){ge===void 0&&(ge={}),_=Un({},_,ne);let xe=[],pe=[];h.v7_fetcherPersist&&_.fetchers.forEach((Ne,Ue)=>{Ne.state==="idle"&&(V.has(Ue)?pe.push(Ue):xe.push(Ue))}),V.forEach(Ne=>{!_.fetchers.has(Ne)&&!H.has(Ne)&&pe.push(Ne)}),[...m].forEach(Ne=>Ne(_,{deletedFetchers:pe,viewTransitionOpts:ge.viewTransitionOpts,flushSync:ge.flushSync===!0})),h.v7_fetcherPersist?(xe.forEach(Ne=>_.fetchers.delete(Ne)),pe.forEach(Ne=>ut(Ne))):pe.forEach(Ne=>V.delete(Ne))}function ee(ne,ge,xe){var pe,Ne;let{flushSync:Ue}=xe===void 0?{}:xe,dt=_.actionData!=null&&_.navigation.formMethod!=null&&uo(_.navigation.formMethod)&&_.navigation.state==="loading"&&((pe=ne.state)==null?void 0:pe._isRedirect)!==!0,Xe;ge.actionData?Object.keys(ge.actionData).length>0?Xe=ge.actionData:Xe=null:dt?Xe=_.actionData:Xe=null;let xt=ge.loaderData?y6(_.loaderData,ge.loaderData,ge.matches||[],ge.errors):_.loaderData,et=_.blockers;et.size>0&&(et=new Map(et),et.forEach((zt,us)=>et.set(us,ig)));let st=C===!0||_.navigation.formMethod!=null&&uo(_.navigation.formMethod)&&((Ne=ne.state)==null?void 0:Ne._isRedirect)!==!0;l&&(o=l,l=void 0),$||k===hr.Pop||(k===hr.Push?e.history.push(ne,ne.state):k===hr.Replace&&e.history.replace(ne,ne.state));let _t;if(k===hr.Pop){let zt=T.get(_.location.pathname);zt&&zt.has(ne.pathname)?_t={currentLocation:_.location,nextLocation:ne}:T.has(ne.pathname)&&(_t={currentLocation:ne,nextLocation:_.location})}else if(A){let zt=T.get(_.location.pathname);zt?zt.add(ne.pathname):(zt=new Set([ne.pathname]),T.set(_.location.pathname,zt)),_t={currentLocation:_.location,nextLocation:ne}}P(Un({},ge,{actionData:Xe,loaderData:xt,historyAction:k,location:ne,initialized:!0,navigation:E2,revalidation:"idle",restoreScrollPosition:qe(ne,ge.matches||_.matches),preventScrollReset:st,blockers:et}),{viewTransitionOpts:_t,flushSync:Ue===!0}),k=hr.Pop,C=!1,A=!1,$=!1,O=!1,U=[]}async function X(ne,ge){if(typeof ne=="number"){e.history.go(ne);return}let xe=jC(_.location,_.matches,c,h.v7_prependBasename,ne,h.v7_relativeSplatPath,ge?.fromRouteId,ge?.relative),{path:pe,submission:Ne,error:Ue}=d6(h.v7_normalizeFormMethod,!1,xe,ge),dt=_.location,Xe=nb(_.location,pe,ge&&ge.state);Xe=Un({},Xe,e.history.encodeLocation(Xe));let xt=ge&&ge.replace!=null?ge.replace:void 0,et=hr.Push;xt===!0?et=hr.Replace:xt===!1||Ne!=null&&uo(Ne.formMethod)&&Ne.formAction===_.location.pathname+_.location.search&&(et=hr.Replace);let st=ge&&"preventScrollReset"in ge?ge.preventScrollReset===!0:void 0,_t=(ge&&ge.flushSync)===!0,zt=Qe({currentLocation:dt,nextLocation:Xe,historyAction:et});if(zt){$e(zt,{state:"blocked",location:Xe,proceed(){$e(zt,{state:"proceeding",proceed:void 0,reset:void 0,location:Xe}),X(ne,ge)},reset(){let us=new Map(_.blockers);us.set(zt,ig),P({blockers:us})}});return}return await me(et,Xe,{submission:Ne,pendingError:Ue,preventScrollReset:st,replace:ge&&ge.replace,enableViewTransition:ge&&ge.viewTransition,flushSync:_t})}function ae(){if(be(),P({revalidation:"loading"}),_.navigation.state!=="submitting"){if(_.navigation.state==="idle"){me(_.historyAction,_.location,{startUninterruptedRevalidation:!0});return}me(k||_.historyAction,_.navigation.location,{overrideNavigation:_.navigation,enableViewTransition:A===!0})}}async function me(ne,ge,xe){N&&N.abort(),N=null,k=ne,$=(xe&&xe.startUninterruptedRevalidation)===!0,De(_.location,_.matches),C=(xe&&xe.preventScrollReset)===!0,A=(xe&&xe.enableViewTransition)===!0;let pe=l||o,Ne=xe&&xe.overrideNavigation,Ue=xe!=null&&xe.initialHydration&&_.matches&&_.matches.length>0&&!w?_.matches:eu(pe,ge,c),dt=(xe&&xe.flushSync)===!0;if(Ue&&_.initialized&&!O&&$le(_.location,ge)&&!(xe&&xe.submission&&uo(xe.submission.formMethod))){ee(ge,{matches:Ue},{flushSync:dt});return}let Xe=ye(Ue,pe,ge.pathname);if(Xe.active&&Xe.matches&&(Ue=Xe.matches),!Ue){let{error:ms,notFoundMatches:We,route:Dt}=ct(ge.pathname);ee(ge,{matches:We,loaderData:{},errors:{[Dt.id]:ms}},{flushSync:dt});return}N=new AbortController;let xt=pp(e.history,ge,N.signal,xe&&xe.submission),et;if(xe&&xe.pendingError)et=[Ld(Ue).route.id,{type:tn.error,error:xe.pendingError}];else if(xe&&xe.submission&&uo(xe.submission.formMethod)){let ms=await q(xt,ge,xe.submission,Ue,Xe.active,{replace:xe.replace,flushSync:dt});if(ms.shortCircuited)return;if(ms.pendingActionResult){let[We,Dt]=ms.pendingActionResult;if(hi(Dt)&&yh(Dt.error)&&Dt.error.status===404){N=null,ee(ge,{matches:ms.matches,loaderData:{},errors:{[We]:Dt.error}});return}}Ue=ms.matches||Ue,et=ms.pendingActionResult,Ne=S2(ge,xe.submission),dt=!1,Xe.active=!1,xt=pp(e.history,xt.url,xt.signal)}let{shortCircuited:st,matches:_t,loaderData:zt,errors:us}=await he(xt,ge,Ue,Xe.active,Ne,xe&&xe.submission,xe&&xe.fetcherSubmission,xe&&xe.replace,xe&&xe.initialHydration===!0,dt,et);st||(N=null,ee(ge,Un({matches:_t||Ue},v6(et),{loaderData:zt,errors:us})))}async function q(ne,ge,xe,pe,Ne,Ue){Ue===void 0&&(Ue={}),be();let dt=qle(ge,xe);if(P({navigation:dt},{flushSync:Ue.flushSync===!0}),Ne){let et=await Ze(pe,ge.pathname,ne.signal);if(et.type==="aborted")return{shortCircuited:!0};if(et.type==="error"){let st=Ld(et.partialMatches).route.id;return{matches:et.partialMatches,pendingActionResult:[st,{type:tn.error,error:et.error}]}}else if(et.matches)pe=et.matches;else{let{notFoundMatches:st,error:_t,route:zt}=ct(ge.pathname);return{matches:st,pendingActionResult:[zt.id,{type:tn.error,error:_t}]}}}let Xe,xt=Yg(pe,ge);if(!xt.route.action&&!xt.route.lazy)Xe={type:tn.error,error:Ja(405,{method:ne.method,pathname:ge.pathname,routeId:xt.route.id})};else if(Xe=(await Ie("action",_,ne,[xt],pe,null))[xt.route.id],ne.signal.aborted)return{shortCircuited:!0};if(Bd(Xe)){let et;return Ue&&Ue.replace!=null?et=Ue.replace:et=g6(Xe.response.headers.get("Location"),new URL(ne.url),c,e.history)===_.location.pathname+_.location.search,await Je(ne,Xe,!0,{submission:xe,replace:et}),{shortCircuited:!0}}if(iu(Xe))throw Ja(400,{type:"defer-action"});if(hi(Xe)){let et=Ld(pe,xt.route.id);return(Ue&&Ue.replace)!==!0&&(k=hr.Push),{matches:pe,pendingActionResult:[et.route.id,Xe]}}return{matches:pe,pendingActionResult:[xt.route.id,Xe]}}async function he(ne,ge,xe,pe,Ne,Ue,dt,Xe,xt,et,st){let _t=Ne||S2(ge,Ue),zt=Ue||dt||_6(_t),us=!$&&(!h.v7_partialHydration||!xt);if(pe){if(us){let Lt=se(st);P(Un({navigation:_t},Lt!==void 0?{actionData:Lt}:{}),{flushSync:et})}let fs=await Ze(xe,ge.pathname,ne.signal);if(fs.type==="aborted")return{shortCircuited:!0};if(fs.type==="error"){let Lt=Ld(fs.partialMatches).route.id;return{matches:fs.partialMatches,loaderData:{},errors:{[Lt]:fs.error}}}else if(fs.matches)xe=fs.matches;else{let{error:Lt,notFoundMatches:yr,route:ta}=ct(ge.pathname);return{matches:yr,loaderData:{},errors:{[ta.id]:Lt}}}}let ms=l||o,[We,Dt]=p6(e.history,_,xe,zt,ge,h.v7_partialHydration&&xt===!0,h.v7_skipActionErrorRevalidation,O,U,F,V,D,W,ms,c,st);if(ve(fs=>!(xe&&xe.some(Lt=>Lt.route.id===fs))||We&&We.some(Lt=>Lt.route.id===fs)),M=++G,We.length===0&&Dt.length===0){let fs=wt();return ee(ge,Un({matches:xe,loaderData:{},errors:st&&hi(st[1])?{[st[0]]:st[1].error}:null},v6(st),fs?{fetchers:new Map(_.fetchers)}:{}),{flushSync:et}),{shortCircuited:!0}}if(us){let fs={};if(!pe){fs.navigation=_t;let Lt=se(st);Lt!==void 0&&(fs.actionData=Lt)}Dt.length>0&&(fs.fetchers=le(Dt)),P(fs,{flushSync:et})}Dt.forEach(fs=>{tt(fs.key),fs.controller&&H.set(fs.key,fs.controller)});let Ds=()=>Dt.forEach(fs=>tt(fs.key));N&&N.signal.addEventListener("abort",Ds);let{loaderResults:Ys,fetcherResults:Ks}=await ue(_,xe,We,Dt,ne);if(ne.signal.aborted)return{shortCircuited:!0};N&&N.signal.removeEventListener("abort",Ds),Dt.forEach(fs=>H.delete(fs.key));let is=iy(Ys);if(is)return await Je(ne,is.result,!0,{replace:Xe}),{shortCircuited:!0};if(is=iy(Ks),is)return W.add(is.key),await Je(ne,is.result,!0,{replace:Xe}),{shortCircuited:!0};let{loaderData:es,errors:Fs}=b6(_,xe,Ys,st,Dt,Ks,L);L.forEach((fs,Lt)=>{fs.subscribe(yr=>{(yr||fs.done)&&L.delete(Lt)})}),h.v7_partialHydration&&xt&&_.errors&&(Fs=Un({},_.errors,Fs));let fn=wt(),Gn=St(M),Xs=fn||Gn||Dt.length>0;return Un({matches:xe,loaderData:es,errors:Fs},Xs?{fetchers:new Map(_.fetchers)}:{})}function se(ne){if(ne&&!hi(ne[1]))return{[ne[0]]:ne[1].data};if(_.actionData)return Object.keys(_.actionData).length===0?null:_.actionData}function le(ne){return ne.forEach(ge=>{let xe=_.fetchers.get(ge.key),pe=og(void 0,xe?xe.data:void 0);_.fetchers.set(ge.key,pe)}),new Map(_.fetchers)}function ke(ne,ge,xe,pe){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");tt(ne);let Ne=(pe&&pe.flushSync)===!0,Ue=l||o,dt=jC(_.location,_.matches,c,h.v7_prependBasename,xe,h.v7_relativeSplatPath,ge,pe?.relative),Xe=eu(Ue,dt,c),xt=ye(Xe,Ue,dt);if(xt.active&&xt.matches&&(Xe=xt.matches),!Xe){Ge(ne,ge,Ja(404,{pathname:dt}),{flushSync:Ne});return}let{path:et,submission:st,error:_t}=d6(h.v7_normalizeFormMethod,!0,dt,pe);if(_t){Ge(ne,ge,_t,{flushSync:Ne});return}let zt=Yg(Xe,et),us=(pe&&pe.preventScrollReset)===!0;if(st&&uo(st.formMethod)){oe(ne,ge,et,zt,Xe,xt.active,Ne,us,st);return}D.set(ne,{routeId:ge,path:et}),Oe(ne,ge,et,zt,Xe,xt.active,Ne,us,st)}async function oe(ne,ge,xe,pe,Ne,Ue,dt,Xe,xt){be(),D.delete(ne);function et(Js){if(!Js.route.action&&!Js.route.lazy){let vr=Ja(405,{method:xt.formMethod,pathname:xe,routeId:ge});return Ge(ne,ge,vr,{flushSync:dt}),!0}return!1}if(!Ue&&et(pe))return;let st=_.fetchers.get(ne);Re(ne,Wle(xt,st),{flushSync:dt});let _t=new AbortController,zt=pp(e.history,xe,_t.signal,xt);if(Ue){let Js=await Ze(Ne,new URL(zt.url).pathname,zt.signal,ne);if(Js.type==="aborted")return;if(Js.type==="error"){Ge(ne,ge,Js.error,{flushSync:dt});return}else if(Js.matches){if(Ne=Js.matches,pe=Yg(Ne,xe),et(pe))return}else{Ge(ne,ge,Ja(404,{pathname:xe}),{flushSync:dt});return}}H.set(ne,_t);let us=G,We=(await Ie("action",_,zt,[pe],Ne,ne))[pe.route.id];if(zt.signal.aborted){H.get(ne)===_t&&H.delete(ne);return}if(h.v7_fetcherPersist&&V.has(ne)){if(Bd(We)||hi(We)){Re(ne,Fc(void 0));return}}else{if(Bd(We))if(H.delete(ne),M>us){Re(ne,Fc(void 0));return}else return W.add(ne),Re(ne,og(xt)),Je(zt,We,!1,{fetcherSubmission:xt,preventScrollReset:Xe});if(hi(We)){Ge(ne,ge,We.error);return}}if(iu(We))throw Ja(400,{type:"defer-action"});let Dt=_.navigation.location||_.location,Ds=pp(e.history,Dt,_t.signal),Ys=l||o,Ks=_.navigation.state!=="idle"?eu(Ys,_.navigation.location,c):_.matches;Cs(Ks,"Didn't find any matches after fetcher action");let is=++G;z.set(ne,is);let es=og(xt,We.data);_.fetchers.set(ne,es);let[Fs,fn]=p6(e.history,_,Ks,xt,Dt,!1,h.v7_skipActionErrorRevalidation,O,U,F,V,D,W,Ys,c,[pe.route.id,We]);fn.filter(Js=>Js.key!==ne).forEach(Js=>{let vr=Js.key,er=_.fetchers.get(vr),Ha=og(void 0,er?er.data:void 0);_.fetchers.set(vr,Ha),tt(vr),Js.controller&&H.set(vr,Js.controller)}),P({fetchers:new Map(_.fetchers)});let Gn=()=>fn.forEach(Js=>tt(Js.key));_t.signal.addEventListener("abort",Gn);let{loaderResults:Xs,fetcherResults:fs}=await ue(_,Ks,Fs,fn,Ds);if(_t.signal.aborted)return;_t.signal.removeEventListener("abort",Gn),z.delete(ne),H.delete(ne),fn.forEach(Js=>H.delete(Js.key));let Lt=iy(Xs);if(Lt)return Je(Ds,Lt.result,!1,{preventScrollReset:Xe});if(Lt=iy(fs),Lt)return W.add(Lt.key),Je(Ds,Lt.result,!1,{preventScrollReset:Xe});let{loaderData:yr,errors:ta}=b6(_,Ks,Xs,void 0,fn,fs,L);if(_.fetchers.has(ne)){let Js=Fc(We.data);_.fetchers.set(ne,Js)}St(is),_.navigation.state==="loading"&&is>M?(Cs(k,"Expected pending action"),N&&N.abort(),ee(_.navigation.location,{matches:Ks,loaderData:yr,errors:ta,fetchers:new Map(_.fetchers)})):(P({errors:ta,loaderData:y6(_.loaderData,yr,Ks,ta),fetchers:new Map(_.fetchers)}),O=!1)}async function Oe(ne,ge,xe,pe,Ne,Ue,dt,Xe,xt){let et=_.fetchers.get(ne);Re(ne,og(xt,et?et.data:void 0),{flushSync:dt});let st=new AbortController,_t=pp(e.history,xe,st.signal);if(Ue){let We=await Ze(Ne,new URL(_t.url).pathname,_t.signal,ne);if(We.type==="aborted")return;if(We.type==="error"){Ge(ne,ge,We.error,{flushSync:dt});return}else if(We.matches)Ne=We.matches,pe=Yg(Ne,xe);else{Ge(ne,ge,Ja(404,{pathname:xe}),{flushSync:dt});return}}H.set(ne,st);let zt=G,ms=(await Ie("loader",_,_t,[pe],Ne,ne))[pe.route.id];if(iu(ms)&&(ms=await F5(ms,_t.signal,!0)||ms),H.get(ne)===st&&H.delete(ne),!_t.signal.aborted){if(V.has(ne)){Re(ne,Fc(void 0));return}if(Bd(ms))if(M>zt){Re(ne,Fc(void 0));return}else{W.add(ne),await Je(_t,ms,!1,{preventScrollReset:Xe});return}if(hi(ms)){Ge(ne,ge,ms.error);return}Cs(!iu(ms),"Unhandled fetcher deferred data"),Re(ne,Fc(ms.data))}}async function Je(ne,ge,xe,pe){let{submission:Ne,fetcherSubmission:Ue,preventScrollReset:dt,replace:Xe}=pe===void 0?{}:pe;ge.response.headers.has("X-Remix-Revalidate")&&(O=!0);let xt=ge.response.headers.get("Location");Cs(xt,"Expected a Location header on the redirect Response"),xt=g6(xt,new URL(ne.url),c,e.history);let et=nb(_.location,xt,{_isRedirect:!0});if(n){let We=!1;if(ge.response.headers.has("X-Remix-Reload-Document"))We=!0;else if($5.test(xt)){const Dt=e.history.createURL(xt);We=Dt.origin!==t.location.origin||hc(Dt.pathname,c)==null}if(We){Xe?t.location.replace(xt):t.location.assign(xt);return}}N=null;let st=Xe===!0||ge.response.headers.has("X-Remix-Replace")?hr.Replace:hr.Push,{formMethod:_t,formAction:zt,formEncType:us}=_.navigation;!Ne&&!Ue&&_t&&zt&&us&&(Ne=_6(_.navigation));let ms=Ne||Ue;if(Nle.has(ge.response.status)&&ms&&uo(ms.formMethod))await me(st,et,{submission:Un({},ms,{formAction:xt}),preventScrollReset:dt||C,enableViewTransition:xe?A:void 0});else{let We=S2(et,Ne);await me(st,et,{overrideNavigation:We,fetcherSubmission:Ue,preventScrollReset:dt||C,enableViewTransition:xe?A:void 0})}}async function Ie(ne,ge,xe,pe,Ne,Ue){let dt,Xe={};try{dt=await Ple(u,ne,ge,xe,pe,Ne,Ue,i,a)}catch(xt){return pe.forEach(et=>{Xe[et.route.id]={type:tn.error,error:xt}}),Xe}for(let[xt,et]of Object.entries(dt))if(Fle(et)){let st=et.result;Xe[xt]={type:tn.redirect,response:Mle(st,xe,xt,Ne,c,h.v7_relativeSplatPath)}}else Xe[xt]=await Ole(et);return Xe}async function ue(ne,ge,xe,pe,Ne){let Ue=ne.matches,dt=Ie("loader",ne,Ne,xe,ge,null),Xe=Promise.all(pe.map(async st=>{if(st.matches&&st.match&&st.controller){let zt=(await Ie("loader",ne,pp(e.history,st.path,st.controller.signal),[st.match],st.matches,st.key))[st.match.route.id];return{[st.key]:zt}}else return Promise.resolve({[st.key]:{type:tn.error,error:Ja(404,{pathname:st.path})}})})),xt=await dt,et=(await Xe).reduce((st,_t)=>Object.assign(st,_t),{});return await Promise.all([zle(ge,xt,Ne.signal,Ue,ne.loaderData),Hle(ge,et,pe)]),{loaderResults:xt,fetcherResults:et}}function be(){O=!0,U.push(...ve()),D.forEach((ne,ge)=>{H.has(ge)&&F.add(ge),tt(ge)})}function Re(ne,ge,xe){xe===void 0&&(xe={}),_.fetchers.set(ne,ge),P({fetchers:new Map(_.fetchers)},{flushSync:(xe&&xe.flushSync)===!0})}function Ge(ne,ge,xe,pe){pe===void 0&&(pe={});let Ne=Ld(_.matches,ge);ut(ne),P({errors:{[Ne.route.id]:xe},fetchers:new Map(_.fetchers)},{flushSync:(pe&&pe.flushSync)===!0})}function it(ne){return Z.set(ne,(Z.get(ne)||0)+1),V.has(ne)&&V.delete(ne),_.fetchers.get(ne)||Ele}function ut(ne){let ge=_.fetchers.get(ne);H.has(ne)&&!(ge&&ge.state==="loading"&&z.has(ne))&&tt(ne),D.delete(ne),z.delete(ne),W.delete(ne),h.v7_fetcherPersist&&V.delete(ne),F.delete(ne),_.fetchers.delete(ne)}function $t(ne){let ge=(Z.get(ne)||0)-1;ge<=0?(Z.delete(ne),V.add(ne),h.v7_fetcherPersist||ut(ne)):Z.set(ne,ge),P({fetchers:new Map(_.fetchers)})}function tt(ne){let ge=H.get(ne);ge&&(ge.abort(),H.delete(ne))}function He(ne){for(let ge of ne){let xe=it(ge),pe=Fc(xe.data);_.fetchers.set(ge,pe)}}function wt(){let ne=[],ge=!1;for(let xe of W){let pe=_.fetchers.get(xe);Cs(pe,"Expected fetcher: "+xe),pe.state==="loading"&&(W.delete(xe),ne.push(xe),ge=!0)}return He(ne),ge}function St(ne){let ge=[];for(let[xe,pe]of z)if(pe<ne){let Ne=_.fetchers.get(xe);Cs(Ne,"Expected fetcher: "+xe),Ne.state==="loading"&&(tt(xe),z.delete(xe),ge.push(xe))}return He(ge),ge.length>0}function Zt(ne,ge){let xe=_.blockers.get(ne)||ig;return K.get(ne)!==ge&&K.set(ne,ge),xe}function Jt(ne){_.blockers.delete(ne),K.delete(ne)}function $e(ne,ge){let xe=_.blockers.get(ne)||ig;Cs(xe.state==="unblocked"&&ge.state==="blocked"||xe.state==="blocked"&&ge.state==="blocked"||xe.state==="blocked"&&ge.state==="proceeding"||xe.state==="blocked"&&ge.state==="unblocked"||xe.state==="proceeding"&&ge.state==="unblocked","Invalid blocker state transition: "+xe.state+" -> "+ge.state);let pe=new Map(_.blockers);pe.set(ne,ge),P({blockers:pe})}function Qe(ne){let{currentLocation:ge,nextLocation:xe,historyAction:pe}=ne;if(K.size===0)return;K.size>1&&xh(!1,"A router only supports one blocker at a time");let Ne=Array.from(K.entries()),[Ue,dt]=Ne[Ne.length-1],Xe=_.blockers.get(Ue);if(!(Xe&&Xe.state==="proceeding")&&dt({currentLocation:ge,nextLocation:xe,historyAction:pe}))return Ue}function ct(ne){let ge=Ja(404,{pathname:ne}),xe=l||o,{matches:pe,route:Ne}=w6(xe);return ve(),{notFoundMatches:pe,route:Ne,error:ge}}function ve(ne){let ge=[];return L.forEach((xe,pe)=>{(!ne||ne(pe))&&(xe.cancel(),ge.push(pe),L.delete(pe))}),ge}function Ye(ne,ge,xe){if(g=ne,b=ge,x=xe||null,!y&&_.navigation===E2){y=!0;let pe=qe(_.location,_.matches);pe!=null&&P({restoreScrollPosition:pe})}return()=>{g=null,b=null,x=null}}function rt(ne,ge){return x&&x(ne,ge.map(pe=>sle(pe,_.loaderData)))||ne.key}function De(ne,ge){if(g&&b){let xe=rt(ne,ge);g[xe]=b()}}function qe(ne,ge){if(g){let xe=rt(ne,ge),pe=g[xe];if(typeof pe=="number")return pe}return null}function ye(ne,ge,xe){if(d)if(ne){if(Object.keys(ne[0].params).length>0)return{active:!0,matches:Yv(ge,xe,c,!0)}}else return{active:!0,matches:Yv(ge,xe,c,!0)||[]};return{active:!1,matches:null}}async function Ze(ne,ge,xe,pe){if(!d)return{type:"success",matches:ne};let Ne=ne;for(;;){let Ue=l==null,dt=l||o,Xe=i;try{await d({signal:xe,path:ge,matches:Ne,fetcherKey:pe,patch:(st,_t)=>{xe.aborted||f6(st,_t,dt,Xe,a)}})}catch(st){return{type:"error",error:st,partialMatches:Ne}}finally{Ue&&!xe.aborted&&(o=[...o])}if(xe.aborted)return{type:"aborted"};let xt=eu(dt,ge,c);if(xt)return{type:"success",matches:xt};let et=Yv(dt,ge,c,!0);if(!et||Ne.length===et.length&&Ne.every((st,_t)=>st.route.id===et[_t].route.id))return{type:"success",matches:null};Ne=et}}function jt(ne){i={},l=q1(ne,a,void 0,i)}function Nt(ne,ge){let xe=l==null;f6(ne,ge,l||o,i,a),xe&&(o=[...o],P({}))}return S={get basename(){return c},get future(){return h},get state(){return _},get routes(){return o},get window(){return t},initialize:Q,subscribe:J,enableScrollRestoration:Ye,navigate:X,fetch:ke,revalidate:ae,createHref:ne=>e.history.createHref(ne),encodeLocation:ne=>e.history.encodeLocation(ne),getFetcher:it,deleteFetcher:$t,dispose:Y,getBlocker:Zt,deleteBlocker:Jt,patchRoutes:Nt,_internalFetchControllers:H,_internalActiveDeferreds:L,_internalSetRoutes:jt},S}function Tle(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function jC(e,t,n,r,a,i,o,l){let c,u;if(o){c=[];for(let h of t)if(c.push(h),h.route.id===o){u=h;break}}else c=t,u=t[t.length-1];let d=o_(a||".",i_(c,i),hc(e.pathname,n)||e.pathname,l==="path");if(a==null&&(d.search=e.search,d.hash=e.hash),(a==null||a===""||a===".")&&u){let h=B5(d.search);if(u.route.index&&!h)d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index";else if(!u.route.index&&h){let p=new URLSearchParams(d.search),m=p.getAll("index");p.delete("index"),m.filter(x=>x).forEach(x=>p.append("index",x));let g=p.toString();d.search=g?"?"+g:""}}return r&&n!=="/"&&(d.pathname=d.pathname==="/"?n:nc([n,d.pathname])),bh(d)}function d6(e,t,n,r){if(!r||!Tle(r))return{path:n};if(r.formMethod&&!Ule(r.formMethod))return{path:n,error:Ja(405,{method:r.formMethod})};let a=()=>({path:n,error:Ja(400,{type:"invalid-body"})}),i=r.formMethod||"get",o=e?i.toUpperCase():i.toLowerCase(),l=vq(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!uo(o))return a();let p=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((m,g)=>{let[x,b]=g;return""+m+x+"="+b+` 3`},""):String(r.body);return{path:n,submission:{formMethod:o,formAction:l,formEncType:r.formEncType,formData:void 0,json:void 0,text:p}}}else if(r.formEncType==="application/json"){if(!uo(o))return a();try{let p=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:o,formAction:l,formEncType:r.formEncType,formData:void 0,json:p,text:void 0}}}catch{return a()}}}Cs(typeof FormData=="function","FormData is not available in this environment");let c,u;if(r.formData)c=kC(r.formData),u=r.formData;else if(r.body instanceof FormData)c=kC(r.body),u=r.body;else if(r.body instanceof URLSearchParams)c=r.body,u=x6(c);else if(r.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(r.body),u=x6(c)}catch{return a()}let d={formMethod:o,formAction:l,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(uo(d.formMethod))return{path:n,submission:d};let h=Pu(n);return t&&h.search&&B5(h.search)&&c.append("index",""),h.search="?"+c,{path:bh(h),submission:d}}function h6(e,t,n){n===void 0&&(n=!1);let r=e.findIndex(a=>a.route.id===t);return r>=0?e.slice(0,n?r+1:r):e}function p6(e,t,n,r,a,i,o,l,c,u,d,h,p,m,g,x){let b=x?hi(x[1])?x[1].error:x[1].data:void 0,y=e.createURL(t.location),v=e.createURL(a),w=n;i&&t.errors?w=h6(n,Object.keys(t.errors)[0],!0):x&&hi(x[1])&&(w=h6(n,x[0]));let j=x?x[1].statusCode:void 0,E=o&&j&&j>=400,S=w.filter((k,C)=>{let{route:N}=k;if(N.lazy)return!0;if(N.loader==null)return!1;if(i)return _C(N,t.loaderData,t.errors);if(Ale(t.loaderData,t.matches[C],k)||c.some(I=>I===k.route.id))return!0;let A=t.matches[C],T=k;return m6(k,Un({currentUrl:y,currentParams:A.params,nextUrl:v,nextParams:T.params},r,{actionResult:b,actionStatus:j,defaultShouldRevalidate:E?!1:l||y.pathname+y.search===v.pathname+v.search||y.search!==v.search||bq(A,T)}))}),_=[];return h.forEach((k,C)=>{if(i||!n.some($=>$.route.id===k.routeId)||d.has(C))return;let N=eu(m,k.path,g);if(!N){_.push({key:C,routeId:k.routeId,path:k.path,matches:null,match:null,controller:null});return}let A=t.fetchers.get(C),T=Yg(N,k.path),I=!1;p.has(C)?I=!1:u.has(C)?(u.delete(C),I=!0):A&&A.state!=="idle"&&A.data===void 0?I=l:I=m6(T,Un({currentUrl:y,currentParams:t.matches[t.matches.length-1].params,nextUrl:v,nextParams:n[n.length-1].params},r,{actionResult:b,actionStatus:j,defaultShouldRevalidate:E?!1:l})),I&&_.push({key:C,routeId:k.routeId,path:k.path,matches:N,match:T,controller:new AbortController})}),[S,_]}function _C(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let r=t!=null&&t[e.id]!==void 0,a=n!=null&&n[e.id]!==void 0;return!r&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!r&&!a}function Ale(e,t,n){let r=!t||n.route.id!==t.route.id,a=e[n.route.id]===void 0;return r||a}function bq(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function m6(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function f6(e,t,n,r,a){var i;let o;if(e){let u=r[e];Cs(u,"No route found to patch children into: routeId = "+e),u.children||(u.children=[]),o=u.children}else o=n;let l=t.filter(u=>!o.some(d=>yq(u,d))),c=q1(l,a,[e||"_","patch",String(((i=o)==null?void 0:i.length)||"0")],r);o.push(...c)}function yq(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,r)=>{var a;return(a=t.children)==null?void 0:a.some(i=>yq(n,i))}):!1}async function Rle(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let a=n[e.id];Cs(a,"No route found in manifest");let i={};for(let o in r){let c=a[o]!==void 0&&o!=="hasErrorBoundary";xh(!c,'Route "'+a.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!c&&!ele.has(o)&&(i[o]=r[o])}Object.assign(a,i),Object.assign(a,Un({},t(a),{lazy:void 0}))}async function Ile(e){let{matches:t}=e,n=t.filter(a=>a.shouldLoad);return(await Promise.all(n.map(a=>a.resolve()))).reduce((a,i,o)=>Object.assign(a,{[n[o].route.id]:i}),{})}async function Ple(e,t,n,r,a,i,o,l,c,u){let d=i.map(m=>m.route.lazy?Rle(m.route,c,l):void 0),h=i.map((m,g)=>{let x=d[g],b=a.some(v=>v.route.id===m.route.id);return Un({},m,{shouldLoad:b,resolve:async v=>(v&&r.method==="GET"&&(m.route.lazy||m.route.loader)&&(b=!0),b?Lle(t,r,m,x,v,u):Promise.resolve({type:tn.data,result:void 0}))})}),p=await e({matches:h,request:r,params:i[0].params,fetcherKey:o,context:u});try{await Promise.all(d)}catch{}return p}async function Lle(e,t,n,r,a,i){let o,l,c=u=>{let d,h=new Promise((g,x)=>d=x);l=()=>d(),t.signal.addEventListener("abort",l);let p=g=>typeof u!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):u({request:t,params:n.params,context:i},...g!==void 0?[g]:[]),m=(async()=>{try{return{type:"data",result:await(a?a(x=>p(x)):p())}}catch(g){return{type:"error",result:g}}})();return Promise.race([m,h])};try{let u=n.route[e];if(r)if(u){let d,[h]=await Promise.all([c(u).catch(p=>{d=p}),r]);if(d!==void 0)throw d;o=h}else if(await r,u=n.route[e],u)o=await c(u);else if(e==="action"){let d=new URL(t.url),h=d.pathname+d.search;throw Ja(405,{method:t.method,pathname:h,routeId:n.route.id})}else return{type:tn.data,result:void 0};else if(u)o=await c(u);else{let d=new URL(t.url),h=d.pathname+d.search;throw Ja(404,{pathname:h})}Cs(o.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(u){return{type:tn.error,result:u}}finally{l&&t.signal.removeEventListener("abort",l)}return o}async function Ole(e){let{result:t,type:n}=e;if(wq(t)){let h;try{let p=t.headers.get("Content-Type");p&&/\bapplication\/json\b/.test(p)?t.body==null?h=null:h=await t.json():h=await t.text()}catch(p){return{type:tn.error,error:p}}return n===tn.error?{type:tn.error,error:new V1(t.status,t.statusText,h),statusCode:t.status,headers:t.headers}:{type:tn.data,data:h,statusCode:t.status,headers:t.headers}}if(n===tn.error){if(j6(t)){var r,a;if(t.data instanceof Error){var i,o;return{type:tn.error,error:t.data,statusCode:(i=t.init)==null?void 0:i.status,headers:(o=t.init)!=null&&o.headers?new Headers(t.init.headers):void 0}}return{type:tn.error,error:new V1(((r=t.init)==null?void 0:r.status)||500,void 0,t.data),statusCode:yh(t)?t.status:void 0,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}}return{type:tn.error,error:t,statusCode:yh(t)?t.status:void 0}}if(Ble(t)){var l,c;return{type:tn.deferred,deferredData:t,statusCode:(l=t.init)==null?void 0:l.status,headers:((c=t.init)==null?void 0:c.headers)&&new Headers(t.init.headers)}}if(j6(t)){var u,d;return{type:tn.data,data:t.data,statusCode:(u=t.init)==null?void 0:u.status,headers:(d=t.init)!=null&&d.headers?new Headers(t.init.headers):void 0}}return{type:tn.data,data:t}}function Mle(e,t,n,r,a,i){let o=e.headers.get("Location");if(Cs(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!$5.test(o)){let l=r.slice(0,r.findIndex(c=>c.route.id===n)+1);o=jC(new URL(t.url),l,a,!0,o,i),e.headers.set("Location",o)}return e}function g6(e,t,n,r){let a=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if($5.test(e)){let i=e,o=i.startsWith("//")?new URL(t.protocol+i):new URL(i);if(a.includes(o.protocol))throw new Error("Invalid redirect location");let l=hc(o.pathname,n)!=null;if(o.origin===t.origin&&l)return D5(o.pathname)+o.search+o.hash}try{let i=r.createURL(e);if(a.includes(i.protocol))throw new Error("Invalid redirect location")}catch{}return e}function pp(e,t,n,r){let a=e.createURL(vq(t)).toString(),i={signal:n};if(r&&uo(r.formMethod)){let{formMethod:o,formEncType:l}=r;i.method=o.toUpperCase(),l==="application/json"?(i.headers=new Headers({"Content-Type":l}),i.body=JSON.stringify(r.json)):l==="text/plain"?i.body=r.text:l==="application/x-www-form-urlencoded"&&r.formData?i.body=kC(r.formData):i.body=r.formData}return new Request(a,i)}function kC(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function x6(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Dle(e,t,n,r,a){let i={},o=null,l,c=!1,u={},d=n&&hi(n[1])?n[1].error:void 0;return e.forEach(h=>{if(!(h.route.id in t))return;let p=h.route.id,m=t[p];if(Cs(!Bd(m),"Cannot handle redirect results in processLoaderData"),hi(m)){let g=m.error;d!==void 0&&(g=d,d=void 0),o=o||{};{let x=Ld(e,p);o[x.route.id]==null&&(o[x.route.id]=g)}i[p]=void 0,c||(c=!0,l=yh(m.error)?m.error.status:500),m.headers&&(u[p]=m.headers)}else iu(m)?(r.set(p,m.deferredData),i[p]=m.deferredData.data,m.statusCode!=null&&m.statusCode!==200&&!c&&(l=m.statusCode),m.headers&&(u[p]=m.headers)):(i[p]=m.data,m.statusCode&&m.statusCode!==200&&!c&&(l=m.statusCode),m.headers&&(u[p]=m.headers))}),d!==void 0&&n&&(o={[n[0]]:d},i[n[0]]=void 0),{loaderData:i,errors:o,statusCode:l||200,loaderHeaders:u}}function b6(e,t,n,r,a,i,o){let{loaderData:l,errors:c}=Dle(t,n,r,o);return a.forEach(u=>{let{key:d,match:h,controller:p}=u,m=i[d];if(Cs(m,"Did not find corresponding fetcher result"),!(p&&p.signal.aborted))if(hi(m)){let g=Ld(e.matches,h?.route.id);c&&c[g.route.id]||(c=Un({},c,{[g.route.id]:m.error})),e.fetchers.delete(d)}else if(Bd(m))Cs(!1,"Unhandled fetcher revalidation redirect");else if(iu(m))Cs(!1,"Unhandled fetcher deferred data");else{let g=Fc(m.data);e.fetchers.set(d,g)}}),{loaderData:l,errors:c}}function y6(e,t,n,r){let a=Un({},t);for(let i of n){let o=i.route.id;if(t.hasOwnProperty(o)?t[o]!==void 0&&(a[o]=t[o]):e[o]!==void 0&&i.route.loader&&(a[o]=e[o]),r&&r.hasOwnProperty(o))break}return a}function v6(e){return e?hi(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Ld(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function w6(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Ja(e,t){let{pathname:n,routeId:r,method:a,type:i,message:o}=t===void 0?{}:t,l="Unknown Server Error",c="Unknown @remix-run/router error";return e===400?(l="Bad Request",a&&n&&r?c="You made a "+a+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":i==="defer-action"?c="defer() is not supported in actions":i==="invalid-body"&&(c="Unable to encode submission body")):e===403?(l="Forbidden",c='Route "'+r+'" does not match URL "'+n+'"'):e===404?(l="Not Found",c='No route matches URL "'+n+'"'):e===405&&(l="Method Not Allowed",a&&n&&r?c="You made a "+a.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":a&&(c='Invalid request method "'+a.toUpperCase()+'"')),new V1(e||500,l,new Error(c),!0)}function iy(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,a]=t[n];if(Bd(a))return{key:r,result:a}}}function vq(e){let t=typeof e=="string"?Pu(e):e;return bh(Un({},t,{hash:""}))}function $le(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Fle(e){return wq(e.result)&&kle.has(e.result.status)}function iu(e){return e.type===tn.deferred}function hi(e){return e.type===tn.error}function Bd(e){return(e&&e.type)===tn.redirect}function j6(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Ble(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function wq(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Ule(e){return _le.has(e.toLowerCase())}function uo(e){return wle.has(e.toLowerCase())}async function zle(e,t,n,r,a){let i=Object.entries(t);for(let o=0;o<i.length;o++){let[l,c]=i[o],u=e.find(p=>p?.route.id===l);if(!u)continue;let d=r.find(p=>p.route.id===u.route.id),h=d!=null&&!bq(d,u)&&(a&&a[u.route.id])!==void 0;iu(c)&&h&&await F5(c,n,!1).then(p=>{p&&(t[l]=p)})}}async function Hle(e,t,n){for(let r=0;r<n.length;r++){let{key:a,routeId:i,controller:o}=n[r],l=t[a];e.find(u=>u?.route.id===i)&&iu(l)&&(Cs(o,"Expected an AbortController for revalidating fetcher deferred result"),await F5(l,o.signal,!0).then(u=>{u&&(t[a]=u)}))}}async function F5(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:tn.data,data:e.deferredData.unwrappedData}}catch(a){return{type:tn.error,error:a}}return{type:tn.data,data:e.deferredData.data}}}function B5(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Yg(e,t){let n=typeof t=="string"?Pu(t).search:t.search;if(e[e.length-1].route.index&&B5(n||""))return e[e.length-1];let r=fq(e);return r[r.length-1]}function _6(e){let{formMethod:t,formAction:n,formEncType:r,text:a,formData:i,json:o}=e;if(!(!t||!n||!r)){if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:a};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function S2(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function qle(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function og(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Wle(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Fc(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Vle(e,t){try{let n=e.sessionStorage.getItem(xq);if(n){let r=JSON.parse(n);for(let[a,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(a,new Set(i||[]))}}catch{}}function Gle(e,t){if(t.size>0){let n={};for(let[r,a]of t)n[r]=[...a];try{e.sessionStorage.setItem(xq,JSON.stringify(n))}catch(r){xh(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}function G1(){return G1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},G1.apply(null,arguments)}const o0=f.createContext(null),U5=f.createContext(null),bc=f.createContext(null),z5=f.createContext(null),fl=f.createContext({outlet:null,matches:[],isDataRoute:!1}),jq=f.createContext(null);function Yle(e,t){let{relative:n}=t===void 0?{}:t;Nf()||Cs(!1);let{basename:r,navigator:a}=f.useContext(bc),{hash:i,pathname:o,search:l}=c_(e,{relative:n}),c=o;return r!=="/"&&(c=o==="/"?r:nc([r,o])),a.createHref({pathname:c,search:l,hash:i})}function Nf(){return f.useContext(z5)!=null}function an(){return Nf()||Cs(!1),f.useContext(z5).location}function _q(e){f.useContext(bc).static||f.useLayoutEffect(e)}function Ps(){let{isDataRoute:e}=f.useContext(fl);return e?ice():Kle()}function Kle(){Nf()||Cs(!1);let e=f.useContext(o0),{basename:t,future:n,navigator:r}=f.useContext(bc),{matches:a}=f.useContext(fl),{pathname:i}=an(),o=JSON.stringify(i_(a,n.v7_relativeSplatPath)),l=f.useRef(!1);return _q(()=>{l.current=!0}),f.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let h=o_(u,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:nc([t,h.pathname])),(d.replace?r.replace:r.push)(h,d.state,d)},[t,r,o,i,e])}const kq=f.createContext(null);function l_(){return f.useContext(kq)}function Xle(e){let t=f.useContext(fl).outlet;return t&&f.createElement(kq.Provider,{value:e},t)}function Ef(){let{matches:e}=f.useContext(fl),t=e[e.length-1];return t?t.params:{}}function c_(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=f.useContext(bc),{matches:a}=f.useContext(fl),{pathname:i}=an(),o=JSON.stringify(i_(a,r.v7_relativeSplatPath));return f.useMemo(()=>o_(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function Jle(e,t,n,r){Nf()||Cs(!1);let{navigator:a}=f.useContext(bc),{matches:i}=f.useContext(fl),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=an(),d;d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let x=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(x.length).join("/")}let m=eu(e,{pathname:p});return sce(m&&m.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:nc([c,a.encodeLocation?a.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?c:nc([c,a.encodeLocation?a.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),i,n,r)}function Qle(){let e=Sq(),t=yh(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:a},n):null,null)}const Zle=f.createElement(Qle,null);class ece extends f.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?f.createElement(fl.Provider,{value:this.props.routeContext},f.createElement(jq.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function tce(e){let{routeContext:t,match:n,children:r}=e,a=f.useContext(o0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),f.createElement(fl.Provider,{value:t},r)}function sce(e,t,n,r){var a;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(a=n)==null?void 0:a.errors;if(l!=null){let d=o.findIndex(h=>h.route.id&&l?.[h.route.id]!==void 0);d>=0||Cs(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<o.length;d++){let h=o[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=d),h.route.id){let{loaderData:p,errors:m}=n,g=h.route.loader&&p[h.route.id]===void 0&&(!m||m[h.route.id]===void 0);if(h.route.lazy||g){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,h,p)=>{let m,g=!1,x=null,b=null;n&&(m=l&&h.route.id?l[h.route.id]:void 0,x=h.route.errorElement||Zle,c&&(u<0&&p===0?(oce("route-fallback"),g=!0,b=null):u===p&&(g=!0,b=h.route.hydrateFallbackElement||null)));let y=t.concat(o.slice(0,p+1)),v=()=>{let w;return m?w=x:g?w=b:h.route.Component?w=f.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=d,f.createElement(tce,{match:h,routeContext:{outlet:d,matches:y,isDataRoute:n!=null},children:w})};return n&&(h.route.ErrorBoundary||h.route.errorElement||p===0)?f.createElement(ece,{location:n.location,revalidation:n.revalidation,component:x,error:m,children:v(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):v()},null)}var Nq=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(Nq||{}),Y1=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(Y1||{});function nce(e){let t=f.useContext(o0);return t||Cs(!1),t}function rce(e){let t=f.useContext(U5);return t||Cs(!1),t}function ace(e){let t=f.useContext(fl);return t||Cs(!1),t}function Eq(e){let t=ace(),n=t.matches[t.matches.length-1];return n.route.id||Cs(!1),n.route.id}function Sq(){var e;let t=f.useContext(jq),n=rce(Y1.UseRouteError),r=Eq(Y1.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function ice(){let{router:e}=nce(Nq.UseNavigateStable),t=Eq(Y1.UseNavigateStable),n=f.useRef(!1);return _q(()=>{n.current=!0}),f.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,G1({fromRouteId:t},i)))},[e,t])}const k6={};function oce(e,t,n){k6[e]||(k6[e]=!0)}function lce(e,t){e?.v7_startTransition,e?.v7_relativeSplatPath===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function Pn(e){let{to:t,replace:n,state:r,relative:a}=e;Nf()||Cs(!1);let{future:i,static:o}=f.useContext(bc),{matches:l}=f.useContext(fl),{pathname:c}=an(),u=Ps(),d=o_(t,i_(l,i.v7_relativeSplatPath),c,a==="path"),h=JSON.stringify(d);return f.useEffect(()=>u(JSON.parse(h),{replace:n,state:r,relative:a}),[u,h,a,n,r]),null}function vh(e){return Xle(e.context)}function cce(e){let{basename:t="/",children:n=null,location:r,navigationType:a=hr.Pop,navigator:i,static:o=!1,future:l}=e;Nf()&&Cs(!1);let c=t.replace(/^\/*/,"/"),u=f.useMemo(()=>({basename:c,navigator:i,static:o,future:G1({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof r=="string"&&(r=Pu(r));let{pathname:d="/",search:h="",hash:p="",state:m=null,key:g="default"}=r,x=f.useMemo(()=>{let b=hc(d,c);return b==null?null:{location:{pathname:b,search:h,hash:p,state:m,key:g},navigationType:a}},[c,d,h,p,m,g,a]);return x==null?null:f.createElement(bc.Provider,{value:u},f.createElement(z5.Provider,{children:n,value:x}))}new Promise(()=>{});function uce(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:f.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:f.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:f.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function $m(){return $m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$m.apply(null,arguments)}function Cq(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function dce(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function hce(e,t){return e.button===0&&(!t||t==="_self")&&!dce(e)}function NC(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function pce(e,t){let n=NC(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}const mce=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],fce=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],gce="6";try{window.__reactRouterVersion=gce}catch{}function xce(e,t){return Cle({basename:t?.basename,future:$m({}
3,t?.future,{v7_prependBasename:!0}),history:Joe({window:t?.window}),hydrationData:t?.hydrationData||bce(),routes:e,mapRouteProperties:uce,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function bce(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=$m({},t,{errors:yce(t.errors)})),t}function yce(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,a]of t)if(a&&a.__type==="RouteErrorResponse")n[r]=new V1(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let i=window[a.__subType];if(typeof i=="function")try{let o=new i(a.message);o.stack="",n[r]=o}catch{}}if(n[r]==null){let i=new Error(a.message);i.stack="",n[r]=i}}else n[r]=a;return n}const Tq=f.createContext({isTransitioning:!1}),vce=f.createContext(new Map),wce="startTransition",N6=joe[wce],jce="flushSync",E6=hq[jce];function _ce(e){N6?N6(e):e()}function lg(e){E6?E6(e):e()}let kce=class{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}};function Nce(e){let{fallbackElement:t,router:n,future:r}=e,[a,i]=f.useState(n.state),[o,l]=f.useState(),[c,u]=f.useState({isTransitioning:!1}),[d,h]=f.useState(),[p,m]=f.useState(),[g,x]=f.useState(),b=f.useRef(new Map),{v7_startTransition:y}=r||{},v=f.useCallback(k=>{y?_ce(k):k()},[y]),w=f.useCallback((k,C)=>{let{deletedFetchers:N,flushSync:A,viewTransitionOpts:T}=C;k.fetchers.forEach(($,O)=>{$.data!==void 0&&b.current.set(O,$.data)}),N.forEach($=>b.current.delete($));let I=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!T||I){A?lg(()=>i(k)):v(()=>i(k));return}if(A){lg(()=>{p&&(d&&d.resolve(),p.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:T.currentLocation,nextLocation:T.nextLocation})});let $=n.window.document.startViewTransition(()=>{lg(()=>i(k))});$.finished.finally(()=>{lg(()=>{h(void 0),m(void 0),l(void 0),u({isTransitioning:!1})})}),lg(()=>m($));return}p?(d&&d.resolve(),p.skipTransition(),x({state:k,currentLocation:T.currentLocation,nextLocation:T.nextLocation})):(l(k),u({isTransitioning:!0,flushSync:!1,currentLocation:T.currentLocation,nextLocation:T.nextLocation}))},[n.window,p,d,b,v]);f.useLayoutEffect(()=>n.subscribe(w),[n,w]),f.useEffect(()=>{c.isTransitioning&&!c.flushSync&&h(new kce)},[c]),f.useEffect(()=>{if(d&&o&&n.window){let k=o,C=d.promise,N=n.window.document.startViewTransition(async()=>{v(()=>i(k)),await C});N.finished.finally(()=>{h(void 0),m(void 0),l(void 0),u({isTransitioning:!1})}),m(N)}},[v,o,d,n.window]),f.useEffect(()=>{d&&o&&a.location.key===o.location.key&&d.resolve()},[d,p,a.location,o]),f.useEffect(()=>{!c.isTransitioning&&g&&(l(g.state),u({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),x(void 0))},[c.isTransitioning,g]),f.useEffect(()=>{},[]);let j=f.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:k=>n.navigate(k),push:(k,C,N)=>n.navigate(k,{state:C,preventScrollReset:N?.preventScrollReset}),replace:(k,C,N)=>n.navigate(k,{replace:!0,state:C,preventScrollReset:N?.preventScrollReset})}),[n]),E=n.basename||"/",S=f.useMemo(()=>({router:n,navigator:j,static:!1,basename:E}),[n,j,E]),_=f.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return f.useEffect(()=>lce(r,n.future),[r,n.future]),f.createElement(f.Fragment,null,f.createElement(o0.Provider,{value:S},f.createElement(U5.Provider,{value:a},f.createElement(vce.Provider,{value:b.current},f.createElement(Tq.Provider,{value:c},f.createElement(cce,{basename:E,location:a.location,navigationType:a.historyAction,navigator:j,future:_},a.initialized||n.future.v7_partialHydration?f.createElement(Ece,{routes:n.routes,future:n.future,state:a}):t))))),null)}const Ece=f.memo(Sce);function Sce(e){let{routes:t,future:n,state:r}=e;return Jle(t,void 0,r,n)}const Cce=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Tce=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Le=f.forwardRef(function(t,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:h}=t,p=Cq(t,mce),{basename:m}=f.useContext(bc),g,x=!1;if(typeof u=="string"&&Tce.test(u)&&(g=u,Cce))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),E=hc(j.pathname,m);j.origin===w.origin&&E!=null?u=E+j.search+j.hash:x=!0}catch{}let b=Yle(u,{relative:a}),y=Rce(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:a,viewTransition:h});function v(w){r&&r(w),w.defaultPrevented||y(w)}return f.createElement("a",$m({},p,{href:g||b,onClick:x||i?r:v,ref:n,target:c}))}),Ll=f.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:a=!1,className:i="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,h=Cq(t,fce),p=c_(c,{relative:h.relative}),m=an(),g=f.useContext(U5),{navigator:x,basename:b}=f.useContext(bc),y=g!=null&&Ice(p)&&u===!0,v=x.encodeLocation?x.encodeLocation(p).pathname:p.pathname,w=m.pathname,j=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;a||(w=w.toLowerCase(),j=j?j.toLowerCase():null,v=v.toLowerCase()),j&&b&&(j=hc(j,b)||j);const E=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let S=w===v||!o&&w.startsWith(v)&&w.charAt(E)==="/",_=j!=null&&(j===v||!o&&j.startsWith(v)&&j.charAt(v.length)==="/"),k={isActive:S,isPending:_,isTransitioning:y},C=S?r:void 0,N;typeof i=="function"?N=i(k):N=[i,S?"active":null,_?"pending":null,y?"transitioning":null].filter(
3Boolean).join(" ");let A=typeof l=="function"?l(k):l;return f.createElement(Le,$m({},h,{"aria-current":C,className:N,ref:n,style:A,to:c,viewTransition:u}),typeof d=="function"?d(k):d)});var EC;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(EC||(EC={}));var S6;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(S6||(S6={}));function Ace(e){let t=f.useContext(o0);return t||Cs(!1),t}function Rce(e,t){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=Ps(),u=an(),d=c_(e,{relative:o});return f.useCallback(h=>{if(hce(h,n)){h.preventDefault();let p=r!==void 0?r:bh(u)===bh(d);c(e,{replace:p,state:a,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,d,r,a,n,e,i,o,l])}function gl(e){let t=f.useRef(NC(e)),n=f.useRef(!1),r=an(),a=f.useMemo(()=>pce(r.search,n.current?null:t.current),[r.search]),i=Ps(),o=f.useCallback((l,c)=>{const u=NC(typeof l=="function"?l(a):l);n.current=!0,i("?"+u,c)},[i,a]);return[a,o]}function Ice(e,t){t===void 0&&(t={});let n=f.useContext(Tq);n==null&&Cs(!1);let{basename:r}=Ace(EC.useViewTransitionState),a=c_(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=hc(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=hc(n.nextLocation.pathname,r)||n.nextLocation.pathname;return W1(a.pathname,o)!=null||W1(a.pathname,i)!=null}const Pce="modulepreload",Lce=function(e){return"/"+e},C6={}
3,re=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let c=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=o?.nonce||o?.getAttribute("nonce");a=c(n.map(u=>{if(u=Lce(u),u in C6)return;C6[u]=!0;const d=u.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${h}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":Pce,d||(p.as="script"),p.crossOrigin="",p.href=u,l&&p.setAttribute("nonce",l),document.head.appendChild(p),d)return new Promise((m,g)=>{p.addEventListener("load",m),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return a.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},th={...hq},{version:Aq,render:Oce,hydrate:Mce}=th,Rq=Number((Aq||"").split(".")[0])>17,Iq=Number((Aq||"").split(".")[0])>18;function Dce(e,t,n={}){const{useLegacyRender:r}=n;if(r||!Rq)Oce(e,t);else if(Iq)re(()=>import("./client-VFZH9Hz7.js").then(a=>a.c),[]).then(({default:{createRoot:a}})=>{const i=a(t);B.startTransition(()=>{i.render(e)})});else{th.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint=!0;const{createRoot:a}=th;if(!a)throw new Error("createRoot not found");const i=a(t);th.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint=!1,B.startTransition(()=>{i.render(e)})}}function $ce(e,t,n={}){const{useLegacyRender:r}=n;if(r||!Rq)Mce(e,t);else if(Iq)re(()=>import("./client-VFZH9Hz7.js").then(a=>a.c),[]).then(({default:{hydrateRoot:a}})=>{B.startTransition(()=>{a(t,e)})});else{th.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint=!0;const{hydrateRoot:a}=th;if(!a)throw new Error("hydrateRoot not found");B.startTransition(()=>{a(t,e),th.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint=!1})}}function Fce(e){return document.readyState==="loading"?new Promise(t=>{document.addEventListener("DOMContentLoaded",()=>t(e))}):Promise.resolve(e)}function Bce(e){try{return JSON.parse(e||"{}")}catch(t){return console.error("[SSG] On state deserialization -",t,e),{}}}function T6(e,t){return!e||!t?e||t||"":(e[e.length-1]==="/"&&(e=e.substring(0,e.length-1)),t[0]!=="/"&&(t=`/${t}`),e+t)}function Uce(e,t){if(e===t)return"/";const n=zce(t);return e.startsWith(n)?e.slice(n.length-1):e}function zce(e){return e[e.length-1]!=="/"?`${e}/`:e}function A6(e){return e[0]!=="/"?`/${e}`:e}function Pq(e,t,n=[]){return e.map((r,a)=>{const i=[...n,String(a)],o=typeof r.id=="string"?r.id:i.join("-");if(r.id=o,Hce(r))return{...r,...t(r),id:o};{const l={...r,...t(r),id:o,children:void 0};return r.children&&(l.children=Pq(r.children,t,i)),l}})}function Hce(e){return e.index===!0}function l0(e){return s.jsx(Gv,{...e})}function qce(e,t,n={}){const{transformState:r,rootContainer:a="#root",ssrWhenDev:i,getStyleCollector:o=null}=n,l=typeof window<"u",c=e.basename??"/",{v7_startTransition:u=!0,...d}=e.future??{};async function h(m=!1,g){const x=e.customCreateRouter??xce,b=m?x(Pq(e.routes,p),{basename:c,future:d}):void 0,y=[],v=m?()=>{}:S=>y.push(S),w=()=>Promise.all(y.map(S=>S())),j={isClient:l,routes:e.routes,router:b,routerOptions:e,onSSRAppRendered:v,triggerOnSSRAppRendered:w,initialState:{},transformState:r,routePath:g,base:c,getStyleCollector:o,routerType:"remix"};m&&(await Fce(),j.initialState=r?.(window.__INITIAL_STATE__||{})||Bce(window.__INITIAL_STATE__)),await t?.(j);const E=j.initialState;return{...j,initialState:E}}return l&&(async()=>{const m=typeof a=="string"?document.querySelector(a):a;if(!m){typeof $jsdom>"u"&&console.warn("[vite-react-ssg] Root container not found.");return}const g=eu(e.routes,window.location,c)?.filter(w=>w.route.lazy);g&&g?.length>0&&await Promise.all(g.map(async w=>{const j=await w.route.lazy();Object.assign(w.route,{...j,lazy:void 0})}));const x=await h(!0);window.__VITE_REACT_SSG_CONTEXT__=x;const{router:b}=x,y=s.jsx(om,{children:s.jsx(Nce,{router:b,future:{v7_startTransition:u}})});document.querySelector("[data-server-rendered=true]")!==null?$ce(y,m,n):Dce(y,m,n)})(),h;function p(m){if(!(document.querySelector("[data-server-rendered=true]")!==null))return m;const x=async({request:b})=>{{if(!window.__VITE_REACT_SSG_STATIC_LOADER_MANIFEST__){const S=T6(c,`static-loader-data-manifest-${window.__VITE_REACT_SSG_HASH__}.json`);window.__VITE_REACT_SSG_STATIC_LOADER_MANIFEST__=await(await fetch(A6(S))).json()}const{url:y}=b;let{pathname:v}=new URL(y);c!=="/"&&(v=Uce(v,c));const j=window.__VITE_REACT_SSG_STATIC_LOADER_MANIFEST__?.[v];
3if(!j)return null;if(window.__VITE_REACT_SSG_STATIC_LOADER_DATA__||(window.__VITE_REACT_SSG_STATIC_LOADER_DATA__={}),!window.__VITE_REACT_SSG_STATIC_LOADER_DATA__[v]){const S=T6(c,j);window.__VITE_REACT_SSG_STATIC_LOADER_DATA__[v]=await(await fetch(A6(S))).json()}return window.__VITE_REACT_SSG_STATIC_LOADER_DATA__[v]?.[m.id]??null}};return m.loader=x,m}}function Wce(e={}){const{nonce:t,locale:n,onScriptLoadSuccess:r,onScriptLoadError:a}=e,[i,o]=f.useState(!1),l=f.useRef(r);l.current=r;const c=f.useRef(a);return c.current=a,f.useEffect(()=>{const u=document.createElement("script");return u.src="https://accounts.google.com/gsi/client",n&&(u.src+=`?hl=${n}`),u.async=!0,u.defer=!0,u.nonce=t,u.onload=()=>{var d;o(!0),(d=l.current)===null||d===void 0||d.call(l)},u.onerror=()=>{var d;o(!1),(d=c.current)===null||d===void 0||d.call(c)},document.body.appendChild(u),()=>{document.body.removeChild(u)}},[t]),i}const Vce=f.createContext(null);function Gce({clientId:e,nonce:t,locale:n,onScriptLoadSuccess:r,onScriptLoadError:a,children:i}){const o=Wce({nonce:t,onScriptLoadSuccess:r,onScriptLoadError:a,locale:n}),l=f.useMemo(()=>({locale:n,clientId:e,scriptLoadedSuccessfully:o}),[e,o]);return B.createElement(Vce.Provider,{value:l},i)}const Yce=f.createContext();function Kce({children:e}){const t="light";f.useEffect(()=>{document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light");const r=document.querySelector('meta[name="theme-color"]');r&&r.setAttribute("content","#FAF9F5")},[]);const n=f.useCallback(()=>{},[]);return s.jsx(Yce.Provider,{value:{theme:t,toggleTheme:n},children:e})}var Ae="u">typeof window?window:void 0,xa="u">typeof globalThis?globalThis:Ae,Cr=xa?.navigator,Ke=xa?.document,In=xa?.location,H5=xa?.fetch,SC=xa!=null&&xa.XMLHttpRequest&&"withCredentials"in new xa.XMLHttpRequest?xa.XMLHttpRequest:void 0,R6=xa?.AbortController,Xce=xa?.CompressionStream,Qa=Cr?.userAgent;function Lq(){return!(!Ae||Ae.navigator.onLine===!1)}var cg=typeof globalThis<"u"?globalThis:Ae;cg&&typeof self>"u"&&(cg.self=cg),cg&&typeof File>"u"&&(cg.File=function(){});var Bt=Ae??{},ln={DEBUG:!1,LIB_VERSION:"0.7.2",LIB_NAME:"browser-common"};function I6(e,t,n,r,a,i,o){try{var l=e[i](o),c=l.value}catch(u){return void n(u)}l.done?t(c):Promise.resolve(c).then(r,a)}function un(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(c){I6(i,r,a,o,l,"next",c)}function l(c){I6(i,r,a,o,l,"throw",c)}o(void 0)}))}}function ze(){return ze=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ze.apply(null,arguments)}function Oq(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Jce=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],P6=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return Jce.concat(t).some((r=>{var a=r.toLowerCase();return n.indexOf(a)!==-1}))};function ns(e,t){return e.indexOf(t)!==-1}var u_=function(e){return e.trim()},CC=function(e){return e.replace(/^\$/,"")};function Mq(e){var t,n=[];
3return(t=JSON.stringify(e,(function(r,a){if(typeof a=="bigint")return a.toString();if(typeof a!="function"&&typeof a!="symbol"){if(a instanceof Error)return{name:a.name,message:a.message,stack:a.stack};if(a&&typeof a=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(a))return"[Circular]";n.push(a)}return a}})))!==null&&t!==void 0?t:"null"}var qo=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),TC=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),Qce=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],Zce=["token"],Dq=Object.prototype,$q=Dq.hasOwnProperty,d_=Dq.toString,Xt=Array.isArray||function(e){return d_.call(e)==="[object Array]"},ha=e=>typeof e=="function",ys=e=>e===Object(e)&&!Xt(e),gi=e=>{if(ys(e)){for(var t in e)if($q.call(e,t))return!1;return!0}return!1},Be=e=>e===void 0,ks=e=>d_.call(e)=="[object String]",fx=e=>ks(e)&&e.trim().length===0,Hn=e=>e===null,cs=e=>Be(e)||Hn(e),qn=e=>d_.call(e)=="[object Number]"&&e==e,Ol=e=>qn(e)&&e>0,Pa=e=>d_.call(e)==="[object Boolean]",eue=e=>e instanceof FormData,tue=e=>ns(Qce,e),sue=e=>ns(Zce,e);function Fq(e){return e===null||typeof e!="object"}function K1(e,t){return{}.toString.call(e)==="[object "+t+"]"}function q5(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Bq(e,Error)}}function W5(e){return"u">typeof Event&&Bq(e,Event)}function Bq(e,t){try{return e instanceof t}catch{return!1}}var nue=[!0,"true",1,"1","yes"],C2=e=>ns(nue,e),rue=[!1,"false",0,"0","no"];function Zo(e,t,n,r,a){return t>n&&(r.warn("min cannot be greater than max."),t=n),qn(e)?e>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+a),Zo(a??n,t,n,r))}let aue=class{constructor(t){this.C={},this.I=t.I,this.R=Zo(t.bucketSize,0,100,t.A),this.O=Zo(t.refillRate,0,this.R,t.A),this.N=Zo(t.refillInterval,0,864e5,t.A)}F(t,n){var r=Math.floor((n-t.lastAccess)/this.N);r>0&&(t.tokens=Math.min(t.tokens+r*this.O,this.R),t.lastAccess=t.lastAccess+r*this.N)}consumeRateLimit(t){var n,r=Date.now(),a=String(t),i=this.C[a];return i?this.F(i,r):this.C[a]=i={tokens:this.R,lastAccess:r},i.tokens===0||(i.tokens--,i.tokens===0&&((n=this.I)==null||n.call(this,t)),i.tokens===0)}stop(){this.C={}}};var ki="Mobile",X1="iOS",Ql="Android",Fm="Tablet",Uq=Ql+" "+Fm,zq="iPad",Hq="Apple",qq=Hq+" Watch",gx="Safari",Bm="BlackBerry",Wq="Samsung",Vq=Wq+"Browser",Gq=Wq+" Internet",sh="Chrome",iue=sh+" OS",Yq=sh+" "+X1,V5="Internet Explorer",Kq=V5+" "+ki,G5="Opera",oue=G5+" Mini",Y5="Edge",Xq="Microsoft "+Y5,_m="Firefox",Jq=_m+" "+X1,rb="Nintendo",ab="PlayStation",km="Xbox",Qq=Ql+" "+ki,Zq=ki+" "+gx,Kg="Windows",AC=Kg+" Phone",L6="Nokia",RC="Ouya",eW="Generic",lue=eW+" "+ki.toLowerCase(),tW=eW+" "+Fm.toLowerCase(),IC="Konqueror",sW="Oculus Browser",J1="Vivaldi",nW="Yandex",Q1="Whale",PC="DuckDuckGo",rW="Pale Moon",Z1="Waterfox",xx="Brave",ew="Claude",tw="Codex",sw="ChatGPT",aW="Google Search App",An="(\\d+(\\.\\d+)?)",T2=new RegExp("Version/"+An),A2=new RegExp("("+ew+"|"+tw+"|"+sw+")\\/"+An),cue=new RegExp(km,"i"),uue=new RegExp(ab+" \\w+","i"),due=new RegExp(rb+" \\w+","i"),K5=new RegExp(Bm+"|PlayBook|BB10","i"),hue={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},iW=function(e,t,n,r){t=t||"";var a=(function(i){return i!=null&&i.brave?xx:null})(n);return a||(r!=null&&r.detectGoogleSearchApp&&ns(e,"GSA/")?aW:ns(e," OPR/")&&ns(e,"Mini")?oue:ns(e," OPR/")?G5:K5.test(e)?Bm:ns(e,"IE"+ki)||ns(e,"WPDesktop")?Kq:ns(e,"OculusBrowser")?sW:ns(e,Vq)?Gq:ns(e,Y5)||ns(e,"Edg/")?Xq:ns(e,J1+"/")?J1:ns(e,"YaBrowser/")?nW:ns(e,Q1+"/")?Q1:ns(e,PC+"/")||ns(e,"Ddg/")?PC:ns(e,ew+"/")?ew:ns(e,tw+"/")?tw:ns(e,sw+"/")?sw:ns(e,"FBIOS")?"Facebook "+ki:ns(e,"UCWEB")||ns(e,"UCBrowser")?"UC Browser":ns(e,"CriOS")?Yq:ns(e,"CrMo")||ns(e,sh)?sh:ns(e,Ql)&&ns(e,gx)?Qq:ns(e,"FxiOS")?Jq:ns(e.toLowerCase(),IC.toLowerCase())?IC:ns(e,xx+"/")?xx:((i,o)=>o&&ns(o,Hq)||(function(l){return ns(l,gx)&&!ns(l,sh)&&!ns(l,Ql)})(i))(e,t)?ns(e,ki)?Zq:gx:ns(e,"PaleMoon/")?rW:ns(e,Z1+"/")?Z1:ns(e,_m)?_m:ns(e,"MSIE")||ns(e,"Trident/")?V5:ns(e,"Gecko")?_m:"")},pue={[Kq]:[new RegExp("rv:"+An)],[Xq]:[new RegExp(Y5+"?\\/"+An)],[sh]:[new RegExp("("+sh+"|CrMo)\\/"+An)],[Yq]:[new RegExp("CriOS\\/"+An)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+An)],[gx]:[T2],[Zq]:[T2],[G5]:[new RegExp("(Opera|OPR)\\/"+An)],[_m]:[new RegExp(_m+"\\/"+An)],[Jq]:[new RegExp("FxiOS\\/"+An)],[IC]:[new RegExp("Konqueror[:/]?"+An,"i")],[Bm]:[new RegExp(Bm+" "+An),T2],[Qq]:[new RegExp("android\\s"+An,"i")],[Gq]:[new RegExp(Vq+"\\/"+An)],[sW]:[new RegExp("OculusBrowser\\/"+An)],[J1]:[new RegExp(J1+"\\/"+An)],[nW]:[new RegExp("YaBrowser\\/"+An)],[Q1]:[new RegExp(Q1+"\\/"+An)],[xx]:[new RegExp(xx+"\\/"+An)],[ew]:[A2],[tw]:[A2],[sw]:[A2],[PC]:[new RegExp("(DuckDuckGo|Ddg)\\/"+An)],[rW]:[new RegExp("PaleMoon\\/"+An)],[Z1]:[new RegExp(Z1+"\\/"+An)],[aW]:[new RegExp("GSA\\/"+An)],[V5]:[new RegExp("(rv:|MSIE )"+An)],Mozilla:[new RegExp("rv:"+An)]},mue=function(e,t,n,r){var a=iW(e,t,n,r),i=pue[a];if(Be(i))return null;for(var o=0;i.length>o;o++){var l=e.match(i[o]);if(l)return parseFloat(l[l.length-2])}return null},O6=[[new RegExp(km+"; "+km+" (.*?)[);]","i"),e=>[km,e&&e[1]||""]],[new RegExp(rb,"i"),[rb,""]],[new RegExp(ab,"i"),[ab,""]],[K5,[Bm,""]],[new RegExp(Kg,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[AC,""];if(new RegExp(ki).test(t)&&!/IEMobile\b/.test(t))return[Kg+" "+ki,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=hue[n[1]]||"";return/arm/i.test(t)&&(r="RT"),[Kg,r]}return[Kg,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[X1,[e[3],e[4],e[5]||"0"].join(".")]:[X1,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Be(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ql+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ql+")","i"),e=>e&&e[2]?[Ql,[e[2],e[3],e[4]||"0"].join(".")]:[Ql,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[iue,""]],[/Linux|debian/i,["Linux",""]]],oW=function(e){for(var t=0;O6.length>t;t++){var n=O6[t],r=n[1],a=n[0].exec(e),i=a&&(ha(r)?r(a,e):r);if(i)return i}return["",""]},M6=function(e){return due.test(e)?rb:uue.test(e)?ab:cue.test(e)?km:new RegExp(RC,"i").test(e)?RC:new RegExp("("+AC+"|WPDesktop)","i").test(e)?AC:/iPad/.test(e)?zq:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?qq:K5.test(e)?Bm:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(L6,"i").test(e)?L6:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(ki).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Ql:Uq:new RegExp("(pda|"+ki+")","i").test(e)?lue:new RegExp(Fm,"i").test(e)&&!new RegExp(Fm+" pc","i").test(e)?tW:""},fue=20,lW=1e3,gue=1e4,xue="[Circular]",LC="[Truncated]",h_="[Unserializable]",bue="[Function]";function Nm(e){for(var t="",n=0;e.length>n;n++){var r=e.charCodeAt(n);if(55296>r||r>56319)t+=56320>r||r>57343?e[n]:"�";else{var a=e.charCodeAt(n+1);56320>a||a>57343?t+="�":(t+=e[n]+e[n+1],n++)}}return t}var oy,D6,R2,yue=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function $6(e,t){return typeof(n=e)=="string"&&yue.test(n)?e:t();var n}function cW(e,t){var n=new Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function yu(e){return e&&e.split("#")[0]}function X5(e,t){var n=setTimeout(e,t);return n?.unref&&n?.unref(),n}function F6(e,t,n){return uW.apply(this,arguments)}
3function uW(){return(uW=un((function*(e,t,n){var r;try{return yield Promise.race([e,new Promise(((a,i)=>{r=X5((()=>{try{n?.(),a()}catch(o){i(o)}}),t)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}function vue(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return R2&&n.length===D6||(D6=n.length,R2=n.reduce(((r,a)=>{oy||(oy={});var i=oy[a];if(i)r[i[0]]=i[1];else for(var o=e(a),l=o.length-1;l>=0;l--){var c=o[l],u=c?.filename,d=t[a];if(u&&d){r[u]=d,oy[a]=[u,d];break}}return r}),{})),R2}}class wue{constructor(t,n,r){r===void 0&&(r=[]),this.coercers=t,this.stackParser=n,this.modifiers=r}buildFromUnknown(t,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},a=this.buildCoercingContext(r,n,0).apply(t),i=this.buildParsingContext(n),o=this.parseStacktrace(a,i);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(t){var n=this;return un((function*(){for(var r of t)r.stacktrace&&r.stacktrace.frames&&Xt(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var r,a;return t.cause!=null&&(r=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(a=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),ze({},t,{cause:r,stack:a})}applyChunkIds(t,n){return t.map((r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r)))}applyCoercers(t,n){for(var r of this.coercers)if(r.match(t))return r.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return un((function*(){var r=t;for(var a of n.modifiers)r=yield a(r);return r}))()}convertToExceptionList(t,n){var r,a,i,o={type:t.type,value:t.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(a=n.handled)===null||a===void 0||a,synthetic:(i=t.synthetic)!==null&&i!==void 0&&i}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var l=[o];return t.cause!=null&&l.push(...this.convertToExceptionList(t.cause,ze({},n,{handled:!0}))),l}buildParsingContext(t){var n;return{chunkIdMap:vue(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,r){r===void 0&&(r=0);var a=(i,o)=>{if(4>=o){var l=this.buildCoercingContext(t,n,o);return this.applyCoercers(i,l)}};return ze({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:t,apply:i=>a(i,r),next:i=>a(i,r+1)})}}var Um="?";function OC(e,t,n,r,a){var i={platform:e,filename:t,function:n==="<anonymous>"?Um:n,in_app:!!t&&!t.startsWith("webkit-masked-url://")&&t!=="<anonymous>"};return Be(r)||(i.lineno=r),Be(a)||(i.colno=a),i}var dW=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:Um,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},jue=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,_ue=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,kue=/\((\S*)(?::(\d+))(?::(\d+))\)/,Nue=(e,t)=>{var n=jue.exec(e);if(n)return OC(t,n[1],Um,+n[2],+n[3]);var r=_ue.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){var a=kue.exec(r[2]);a&&(r[2]=a[1],r[3]=a[2],r[4]=a[3])}var i=dW(r[1]||Um,r[2]);return OC(t,i[1],i[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Eue=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Sue=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Cue=(e,t)=>{var n=Eue.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=Sue.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var a=n[3],i=n[1]||Um,o=dW(i,a);return OC(t,a=o[1],i=o[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},B6=/\(error: (.*)\)/;class Tue{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=ks(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return K1(t,"DOMException")}isDOMError(t){return K1(t,"DOMError")}}class Aue{match(t){return q5(t)}coerce(t,n){var r,a=this.getStack(t),i=a===void 0;return{type:this.getType(t),value:this.getMessage(t,n),stack:a??((r=n.syntheticException)==null?void 0:r.stack),cause:t.cause?n.next(t.cause):void 0,synthetic:i}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var r=t.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(t){return t.stacktrace||t.stack||void 0}}class Rue{match(t){return!!K1(t,"ErrorEvent")&&(t.error!=null||this.Vi(t))}coerce(t,n){var r;if(t.error!=null)return n.apply(t.error);var a=n.apply(t.message);return ze({},a,{stack:(r=this.Zi(t))!==null&&r!==void 0?r:a.stack,synthetic:!0})}Vi(t){return ks(t.message)&&t.message.length>0}Zi(t){var n,r,a=t,i=(n=a.lineno)!==null&&n!==void 0?n:0,o=(r=a.colno)!==null&&r!==void 0?r:0;if(ks(a.filename)&&a.filename.length!==0&&i!==0)return`Error 4 at `+a.filename+":"+i+":"+o}}var Iue=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Pue{match(t){return typeof t=="string"}coerce(t,n){var r,a=this.getInfos(t),i=a[0],o=a[1];return{type:i??"Error",value:o??t,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var n="Error",r=t,a=t.match(Iue);return a&&(n=a[1],r=a[2]),[n,r]}}var Lue=["fatal","error","warning","log","info","debug"];function hW(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var a=n.slice(0,r).join(", ");
4if(t>=a.length)return r===n.length?a:a.length>t?a.slice(0,t)+"...":a}return""}class Oue{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var r,a,i=this.getErrorPropertyFromObject(t);return i?n.apply(i):{type:this.getType(t),value:this.getValue(t),stack:(r=this.getStack(t))!==null&&r!==void 0?r:(a=n.syntheticException)==null?void 0:a.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(W5(t))return t.constructor.name;var n="name"in t?t.name:void 0;return ks(n)&&!fx(n)?n:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var r=this.getObjectClassName(t);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+hW(t)}isSeverityLevel(t){return ks(t)&&!fx(t)&&Lue.indexOf(t)>=0}getStack(t){try{return ks(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:ks(t.stack)&&t.stack.length>0?t.stack:void 0}catch{return}}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var r=t[n];if(q5(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class Mue{match(t){return W5(t)}coerce(t,n){var r,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+hW(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Due{match(t){return Fq(t)}coerce(t,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class $ue{match(t){return K1(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!W5(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var r,a=this.getUnhandledRejectionReason(t);return Fq(a)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(a),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(a)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var nw="$message",rw="$timestamp",Fue=new Set([nw,rw]),I2={enabled:!0,max_bytes:32768};function aw(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:I2.enabled,max_bytes:Uue(e.max_bytes,I2.max_bytes)}:ze({},I2)}let Bue=class{constructor(t){this.Fn=[],this.Dn=0,this.mn=aw(t)}setConfig(t){this.mn=aw(t),this.$n()}add(t){var n=(function(a){var i;try{i=Mq(a)}catch{return}try{var o=JSON.parse(i);if(!ys(o))return;var l=o,c=l[nw],u=l[rw];return!ks(c)||c.trim().length===0||!ks(u)&&!qn(u)?void 0:{step:l,json:i}}catch{return}})(t);if(n){var r=(function(a){if("u">typeof TextEncoder)return new TextEncoder().encode(a).length;for(var i=encodeURIComponent(a),o=0,l=0;i.length>l;l++)i[l]==="%"?(o+=1,l+=2):o+=1;return o})(n.json);r>this.mn.max_bytes||(this.Fn.push({step:n.step,bytes:r}),this.Dn+=r,this.$n())}}getAttachable(){return this.Fn.map((t=>t.step))}clear(){this.Fn=[],this.Dn=0}size(){return this.Fn.length}$n(){for(;this.Dn>this.mn.max_bytes&&this.Fn.length>0;){var t=this.Fn.shift();t&&(this.Dn-=t.bytes)}}};function Uue(e,t){if(!qn(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var U6=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function z6(e){return typeof e=="string"||e}function H6(e){return typeof e=="string"?e:void 0}var ug,zue=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],pW="NativeGzipValidationError",MC=e=>e.length>=2&&e[0]===31&&e[1]===139,q6=(e,t)=>e===TC.GZipJS||t===TC.GZipJS||t==="gzip",W6=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",ly=e=>
4{throw cW(pW,"Native gzip produced invalid output: "+e)},Hue=(function(){var e=un((function*(t,n){18>t.size&&ly("too-short");var r=new Uint8Array(yield t.slice(0,10).arrayBuffer());MC(r)&&r[2]===8||ly("invalid-header");var a=new DataView(yield t.slice(t.size-8).arrayBuffer());a.getUint32(0,!0)!==(o=>{for(var l=(()=>{if(ug)return ug;ug=[];for(var d=0;256>d;d++){for(var h=d,p=0;8>p;p++)h=1&h?3988292384^h>>>1:h>>>1;ug[d]=h>>>0}return ug})(),c=4294967295,u=0;o.length>u;u++)c=l[255&(c^o[u])]^c>>>8;return(4294967295^c)>>>0})(n)&&ly("invalid-crc");var i=n.length>>>0;a.getUint32(4,!0)!==i&&ly("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function DC(){return DC=un((function*(e,t,n){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(e),a=new globalThis.CompressionStream("gzip"),i=a.writable.getWriter(),o=i.write(r).then((()=>i.close())).catch((function(){var u=un((function*(d){try{yield i.abort(d)}catch{}throw d}));return function(d){return u.apply(this,arguments)}})()),l=new Response(a.readable).blob(),c=(yield Promise.all([l,o]))[0];return yield Hue(c,r),c}catch(u){if(n!=null&&n.rethrow)throw u;return t&&console.error("Failed to gzip compress data",u),null}})),DC.apply(this,arguments)}var V6=9223372036854776e3,que="9223372036854775808",Wue={}.propertyIsEnumerable;function iw(e,t){try{return mW(e,t,{ancestors:new WeakSet,remainingNodes:gue},0)}catch{return[]}}function J5(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:LC};if(n.remainingNodes--,Pa(e))return{boolValue:e};if(typeof e=="bigint")return(function(c,u){var d=c.toString(),h=BigInt(que);return c>=h||-h>c?(u?.debug("Attribute "+d+" is outside the int64 range; encoding it as a string"),{stringValue:d}):{intValue:d}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};var a=BigInt(e).toString();return e>=V6||-V6>e?(t?.debug("Attribute "+a+" is outside the int64 range; encoding it as a string"),{stringValue:a}):{intValue:a}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:Nm(e)};if(typeof e=="function")return{stringValue:bue};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(n.ancestors.has(e))return{stringValue:xue};if(r>=fue)return{stringValue:LC};if(e instanceof Date){var i=e.getTime(),o=Number.isFinite(i)?e.toISOString():String(e);return{stringValue:typeof o=="string"?Nm(o):String(o)}}n.ancestors.add(e);try{try{var l=e.toJSON;if(typeof l=="function")return J5(l.call(e),t,n,r+1)}catch{}return Xt(e)?{arrayValue:{values:Vue(e,t,n,r+1)}}:{kvlistValue:{values:mW(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:Nm(String(e))}}function Vue(e,t,n,r){for(var a=[],i=Math.min(e.length,lW),o=0;i>o&&n.remainingNodes>0;o++)try{var l=o in e?e[o]:void 0;if(cs(l))continue;a.push(J5(l,t,n,r))}catch{a.push({stringValue:h_})}return e.length>o&&a.push({stringValue:LC}),a}function mW(e,t,n,r){var a=[];for(var i in e)if(Wue.call(e,i)){if(!i){t?.debug("Dropping an attribute with an empty key");continue}if(a.length>=lW||0>=n.remainingNodes){t?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=e[i];if(Hn(o)||Be(o))continue;a.push({key:Nm(i),value:J5(o,t,n,r)})}catch{a.push({key:Nm(i),value:{stringValue:h_}})}}return a}function fW(e,t,n){return ze({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}var G6={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"},gW={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Gue=gW.info;function Yue(e){try{return Nm(String(e))}catch{return h_}}function Kue(e,t,n,r){var a,i=gW[e.level||"info"]||Gue,o=i.text,l=i.number,c=((a=qn(r)?r:void 0)===void 0&&(a=Date.now()),String(a)+"000000"),u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.windowId&&(u["window.id"]=t.windowId),cs(t.sessionStartTimestamp)||(u.sessionStartTimestamp=String(t.sessionStartTimestamp)),cs(t.lastActivityTimestamp)||(u.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(u["url.full"]=t.currentUrl),t.screenName&&(u["screen.name"]=t.screenName),t.appState&&(u["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(u.feature_flags=t.activeFeatureFlags);var d=ze({},u),h=e.attributes;if(h){var p=[];try{p=Object.keys(h)}catch{p=[]}for(var m of p){var g=void 0;try{g=h[m]}catch{g=h_}Object.defineProperty(d,m,{value:g,enumerable:!0,writable:!0,configurable:!0})}}var x={timeUnixNano:c,observedTimeUnixNano:c,severityNumber:l,severityText:o,body:{stringValue:Yue(e.body)},attributes:iw(d,n)};return e.trace_id&&(x.traceId=e.trace_id),e.span_id&&(x.spanId=e.span_id),Be(e.trace_flags)||(x.flags=e.trace_flags),x}function xW(e,t,n){return fW(e,t,n)}function bW(e,t,n,r){return{resourceLogs:[{resource:{attributes:iw(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}
4let Xue=class{constructor(t,n,r,a,i,o,l){var c;o===void 0&&(o=()=>Promise.resolve()),this._instance=t,this.mn=n,this.A=r,this.Nn=a,this.qn=i,this.jn=o,this.Bn=l,this.Hn=null,this.zn=0,this.Un=0,this.Wn=0,this.Vn=0,this.Gn=0,this.Zn=!1,this.Qn=n.maxBufferSize,this.Jn=Math.max((c=n.maxQueueSize)!==null&&c!==void 0?c:n.maxBufferSize,n.maxBufferSize),this.Kn=n.flushIntervalMs,this.Yn=n.maxBatchRecordsPerPost,this.Xn=n.rateCapWindowMs,this.ts=n.maxLogsPerInterval}clearQueue(){this.Un++,this._instance.setPersistedProperty(qo.LogsQueue,[])}reset(){this.es(),this.Vn=0,this.Gn=0,this.Zn=!1,this.Wn=0,this.Yn=this.mn.maxBatchRecordsPerPost}onReconnect(){this.Wn=0,this.rs()}captureLog(t,n){var r;if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var a=this.ns(t);if(a!==null)if(a.body){if(this.ss()){var i={record:Kue(a,(r=n?.context)!==null&&r!==void 0?r:this.Nn(),this.A,n?.occurredAtMs)};this.qn((()=>this.os(i)))}}else this.A.info("Log was rejected in beforeSend function")}}ns(t){var n=this.mn.beforeSend;if(!n)return t;var r=Xt(n)?n:[n],a=t;for(var i of r)try{var o=i(a);if(!o)return this.A.info("Log was rejected in beforeSend function"),null;a=o}catch(l){return this.A.error("Error in beforeSend function for log:",l),null}return a}ss(){if(this.ts===void 0)return!0;var t=Date.now(),n=t-this.Vn;return this.Xn>n&&n>=0||(this.Vn=t,this.Gn=0,this.Zn=!1),this.ts>this.Gn?(this.Gn++,!0):(this.Zn||(this.A.warn("captureLog dropping logs: exceeded "+this.ts+" logs per "+this.Xn+"ms"),this.Zn=!0),!1)}flush(){var t=this;return un((function*(){if(!t._instance.isDisabled)return t.Hn||(t.Hn=t.ls().finally((()=>{t.Hn=null}))),t.Hn}))()}ls(){var t=this;return un((function*(){var n;t.es();var r=(n=t._instance.getPersistedProperty(qo.LogsQueue))!==null&&n!==void 0?n:[];if(r.length!==0)for(var a=r.length,i=0;r.length>0&&a>i;){var o,l,c=t.Un;t.zn=0;var u=Math.min(r.length,t.Yn),d=r.slice(0,u),h=bW(d.map((m=>m.record)),t.us(),(o=t.Bn)!==null&&o!==void 0?o:t._instance.getLibraryId(),t._instance.getLibraryVersion()),p=yield t._instance.hs(h);if(t.Un!==c)return;if(p.kind==="too-large"&&d.length>1)t.Yn=Math.max(1,Math.floor(d.length/2)),t.A.warn("Received 413 when sending logs batch of size "+d.length+", reducing batch size to "+t.Yn);else if(p.kind==="retry-later"||(p.kind==="too-large"?t.A.warn("Dropping a single log record after 413 with batch size 1 â the record is larger than the server cap and cannot be split further."):p.kind==="ok"&&t.mn.maxBatchRecordsPerPost>t.Yn&&(t.Yn=Math.min(t.mn.maxBatchRecordsPerPost,t.Yn+1)),yield t.ds(d.length),r=(l=t._instance.getPersistedProperty(qo.LogsQueue))!==null&&l!==void 0?l:[],i+=d.length,p.kind==="fatal"))throw p.error}}))()}ds(t){var n=this;return un((function*(){var r,a=Math.max(0,t-n.zn),i=(r=n._instance.getPersistedProperty(qo.LogsQueue))!==null&&r!==void 0?r:[];n._instance.setPersistedProperty(qo.LogsQueue,i.slice(a)),yield n.jn()}))()}us(){return xW(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}os(t){var n;if(!this._instance.optedOut){var r=(n=this._instance.getPersistedProperty(qo.LogsQueue))!==null&&n!==void 0?n:[];this.Jn>r.length||(r.shift(),this.zn++,this.A.info("Logs queue is full, dropping oldest record.")),r.push(t),this._instance.setPersistedProperty(qo.LogsQueue,r),this.Qn>r.length?this.vs():this.rs()}}vs(t){t===void 0&&(t=this.Kn),this.cs||(this.cs=X5((()=>{this.cs=void 0,this.rs()}),t))}fs(){var t=Math.min(Math.max(0,this.Wn-1),6);return this.Kn*Math.pow(2,t)}ps(){var t=this._instance.getPersistedProperty(qo.LogsQueue);return!!t&&t.length>0}shutdown(t){var n=this;return un((function*(){n.es();var r=n.flush().catch((()=>{}));t!==void 0?yield F6(r,t):yield r}))()}flushWithTimeout(t){var n=this;return un((function*(){var r=n.flush();yield F6(r,t,(()=>{r.catch((()=>{}))}))}))()}rs(){this.flush().then((()=>{this.Wn=0}),(t=>{this.Wn++,this.A.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.ps()&&this.vs(this.fs())}))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};var P2=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Y6(e){return String(e)+"000000"}function K6(e,t,n,r){var a="";return r&&(a=Object.keys(r).sort().map((i=>JSON.stringify(i)+":"+JSON.stringify(r[i]))).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+a}let Jue=class{constructor(t,n,r){this._instance=t,this.mn=n,this.A=r,this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set,this.ws=0}count(t,n,r){n===void 0&&(n=1),this.ks({name:t,type:"count",value:n,unit:r?.unit,attributes:r?.attributes})}
4gauge(t,n,r){this.ks({name:t,type:"gauge",value:n,unit:r?.unit,attributes:r?.attributes})}histogram(t,n,r){this.ks({name:t,type:"histogram",value:n,unit:r?.unit,attributes:r?.attributes})}flush(){var t=this,n=this.Hn,r=(function(){var i=un((function*(){n&&(yield n.catch((()=>{}))),yield t.Ss()}));return function(){return i.apply(this,arguments)}})(),a=r().finally((()=>{this.Hn===a&&(this.Hn=null)}));return this.Hn=a,a}drainWindow(){if(this.gs.size===0)return null;var t=this.gs;return this.gs=new Map,this.ys=!1,this.bs=new Map,this._s=new Set,this.xs(t)}reset(){this.ws++,this.es(),this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set}ks(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var n=this.ns(t);if(n!==null)if(n.name&&typeof n.name=="string")if(typeof n.value=="number"&&Number.isFinite(n.value))if(n.type==="count"&&0>n.value)this.A.warn("Dropping count '"+n.name+"': counters are monotonic, value must be >= 0");else{var r,a;try{r=n.attributes?ze({},n.attributes):void 0,a=K6(n.type,n.name,n.unit,r)}catch(l){return void this.A.warn("Dropping metric '"+n.name+"': attributes could not be serialized",l)}var i=this.gs.get(a);if(!i){if(!this.Cs())return;i={name:n.name,type:n.type,unit:n.unit,attributes:r,windowStartMs:Date.now()},this.gs.set(a,i)}var o=this.bs.get(n.name);o===void 0?this.bs.set(n.name,n.type):o===n.type||this._s.has(n.name)||(this._s.add(n.name),this.A.warn("Metric name '"+n.name+"' is already used as a "+o+"; recording it as a "+n.type+" too will blend both series in charts. Use a distinct name.")),this.Ts(i,n.value),this.vs()}else this.A.warn("Dropping metric '"+n.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}Cs(){return this.mn.maxSeriesPerFlush>this.gs.size||(this.ys||(this.ys=!0,this.A.warn("Metric series cap reached ("+this.mn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ts(t,n){var r;switch(t.type){case"count":t.total=((r=t.total)!==null&&r!==void 0?r:0)+n;break;case"gauge":t.last=n;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:n,max:n,bucketCounts:new Array(P2.length+1).fill(0)});var a=t.hist;a.count+=1,a.sum+=n,a.min=Math.min(a.min,n),a.max=Math.max(a.max,n),a.bucketCounts[(function(i,o){for(var l=0;o.length>l;l++)if(o[l]>=i)return l;return o.length})(n,P2)]+=1}}ns(t){var n=this.mn.beforeSend;if(!n)return t;var r=Xt(n)?n:[n],a=t;for(var i of r)try{var o=i(a);if(!o)return this.A.info("Metric was rejected in beforeSend function"),null;a=o}catch(l){return this.A.error("Error in beforeSend function for metric:",l),null}return a}vs(){this.cs||(this.cs=X5((()=>{this.cs=void 0,this.flush().catch((t=>{this.A.error("Metrics flush failed:",t)}))}),this.mn.flushIntervalMs))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}Ss(){var t=this;return un((function*(){if(t.gs.size!==0){var n=t.gs;t.gs=new Map,t.ys=!1,t.bs=new Map,t._s=new Set;var r=t.ws,a=yield t._instance.Ms(t.xs(n));if(r===t.ws)switch(a.kind){case"ok":return;case"retry-later":return t.Is(n),void t.vs();case"too-large":return void t.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.A.error("Failed to send metrics batch:",a.error)}}}))()}xs(t){return n=this.Es(t),r=(function(o,l,c){return fW(o,l,c)})(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),a=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:iw(r)},scopeMetrics:[{scope:{name:a,version:i},metrics:n}]}]};var n,r,a,i}Es(t){var n=Y6(Date.now()),r=new Map;for(var a of t.values()){var i,o=K6(a.type,a.name,a.unit,void 0),l=r.get(o);l||(l=ze({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},r.set(o,l));var c=iw((i=a.attributes)!==null&&i!==void 0?i:{},this.A),u=Y6(a.windowStartMs);if(a.type==="count"){var d,h={attributes:c,startTimeUnixNano:u,timeUnixNano:n,asDouble:(d=a.total)!==null&&d!==void 0?d:0};l.sum.dataPoints.push(h)}else if(a.type==="gauge"){var p,m={attributes:c,timeUnixNano:n,asDouble:(p=a.last)!==null&&p!==void 0?p:0};l.gauge.dataPoints.push(m)}else a.hist&&l.histogram.dataPoints.push({attributes:c,startTimeUnixNano:u,timeUnixNano:n,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:P2})}return Array.from(r.values())}Is(t){var n,r;for(var a of t){var i=a[0],o=a[1],l=this.gs.get(i);if(l)switch(l.windowStartMs=Math.min(l.windowStartMs,o.windowStartMs),l.type){case"count":l.total=((n=l.total)!==null&&n!==void 0?n:0)+((r=o.total)!==null&&r!==void 0?r:0);break;case"gauge":break;case"histogram":if(o.hist)if(l.hist){l.hist.count+=o.hist.count,l.hist.sum+=o.hist.sum,l.hist.min=Math.min(l.hist.min,o.hist.min),l.hist.max=Math.max(l.hist.max,o.hist.max);for(var c=0;l.hist.bucketCounts.length>c;c++)l.hist.bucketCounts[c]+=o.hist.bucketCounts[c]}else l.hist=o.hist}else this.Cs()&&this.gs.set(i,o)}}};var yW=function(e,t){var n=(t===void 0?{}:t).debugEnabled,r={q(a){if(Ae&&(ln.DEBUG||Ae.POSTHOG_DEBUG||n)&&!Be(Ae.console)&&Ae.console){for(var i=("__rrweb_original__"in Ae.console[a])?Ae.console[a].__rrweb_original__:Ae.console[a],o=arguments.length,l=new Array(o>1?o-1:0),c=1;o>c;c++)l[c-1]=arguments[c];i(e,...l)}},debug(){for(var a=arguments.length,i=new Array(a),o=0;a>o;o++)i[o]=arguments[o];r.q("debug",...i)},info(){for(var a=arguments.length,i=new Array(a),o=0;a>o;o++)i[o]=arguments[o];r.q("log",...i)},warn(){for(var a=arguments.length,i=new Array(a),o=0;a>o;o++)i[o]=arguments[o];r.q("warn",...i)},error(){for(var a=arguments.length,i=new Array(a),o=0;a>o;o++)i[o]=arguments[o];r.q("error",...i)},critical(){for(var a=arguments.length,i=new Array(a),o=0;a>o;o++)i[o]=arguments[o];console.error(e,...i)},uninitializedWarning(a){r.error("You must initialize PostHog before calling "+a)},createLogger:(a,i)=>yW(e+" "+a,i)};return r},lt=yW("[PostHog.js]"),Sn=lt.createLogger,Que=Sn("[ExternalScriptsLoader]"),ow=e=>{var t=Ke?.querySelectorAll("script");
4if(t){for(var n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute("src")===e)return t[n]}},wd=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return Que.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=ow(t);if(r){if(r.__posthog_loading_callback_fired)return n();var a=r.__posthog_loading_error;return a?n(a):(r.addEventListener("load",(o=>{r.__posthog_loading_callback_fired=!0,n(void 0,o)})),void r.addEventListener("error",(o=>{r.__posthog_loading_error=o,n(o)})))}var i=()=>{if(!Ke)return n("document not found");if(ow(t))return wd(e,t,n);var o=Ke.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=t,o.onload=u=>{o.__posthog_loading_callback_fired=!0,n(void 0,u)},o.onerror=u=>{o.__posthog_loading_error=u,n(u)},e.config.prepare_external_dependency_script&&(o=e.config.prepare_external_dependency_script(o)),!o)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Ke.head.appendChild(o);else{var l,c=Ke.querySelectorAll("body > script");c.length>0?(l=c[0].parentNode)==null||l.insertBefore(o,c[0]):Ke.body.appendChild(o)}};Ke!=null&&Ke.body?i():Ke?.addEventListener("DOMContentLoaded",i)},L2={},X6=(e,t)=>{var n="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var r=3e5;n=n+"&t="+Math.floor(Date.now()/r)*r}return e.requestRouter.endpointFor("assets",n)};Bt.__PosthogExtensions__=Bt.__PosthogExtensions__||{},Bt.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var r=e.config.strict_script_versioning;if(r){var a=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js"),i=L2[a];if(r==="fallback"&&i){if(ow(i))return void wd(e,i,n);delete L2[a]}wd(e,a,r==="fallback"?(l,c)=>{if(l)if(typeof l=="string")n(l);else{var u,d=X6(e,t);L2[a]=d;var h=ow(a);h==null||(u=h.parentNode)==null||u.removeChild(h),wd(e,d,n)}else n(void 0,c)}:n)}else wd(e,X6(e,t),n)}else{var o=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");wd(e,o,n)}},Bt.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);wd(e,r,n)};ln.DEBUG=!1,ln.LIB_VERSION="1.427.2",ln.LIB_NAME="web";var vW="$people_distinct_id",Ir="distinct_id",ib="$device_id",O2="$device_model",lm="__alias",Nl="$fbc",Za="$fbc_persistence",Xg="__timers",$C="$autocapture_disabled_server_side",FC="$heatmaps_enabled_server_side",BC="$exception_capture_enabled_server_side",UC="$error_tracking_suppression_rules",zC="$error_tracking_capture_extension_exceptions",HC="$web_vitals_enabled_server_side",Q5="$dead_clicks_enabled_server_side",Z5="$product_tours_enabled_server_side",qC="$logs_capture_enabled_server_side",WC="$web_vitals_allowed_metrics",Ud="$session_recording_remote_config",wW="$replay_sample_rate",jW="$replay_override_sampling",_W="$replay_override_linked_flag",kW="$replay_override_url_trigger",NW="$replay_override_event_trigger",cm="$sesid",e4="$session_is_sampled",Yr="$enabled_feature_flags",$i="$active_feature_flags",Kv="$early_access_features",ou="$feature_flag_details",ho="$feature_flag_payloads",lu="$feature_flag_request_id",Em="$minimal_flag_called_events",Bo="$override_feature_flags",jd="$override_feature_flag_payloads",di="$stored_person_properties",Yo="$stored_group_properties",EW="$groups",VC="$surveys",lw="$surveys_loaded_at",GC="$surveys_activated",Xv="$surveys_activated_session",Jv="$surveys_activated_timestamps",Jg="ph_product_tours",Gl="$flag_call_reported",Qg="$flag_call_reported_session_id",Sm="$feature_flag_errors",Zl="$feature_flag_evaluated_at",bs="$user_state",YC="$client_session_props",KC="$capture_rate_limit",XC="$initial_campaign_params",JC="$initial_referrer_info",um="$initial_person_info",cw="$epp",mp="$posthog_cookieless",SW="$cookieless_mode",CW="$sdk_debug_extensions_init_method",TW="$sdk_debug_extensions_init_time_ms",QC="$sdk_debug_recording_script_not_loaded",t4="PostHog loadExternalDependency extension not found.",Bc="on_reject",Yl="always",Kn="anonymous",Xr="identified",ZC="identified_only",zm="visibilitychange",uw="beforeunload",dm="$pageview",M2="$pageleave",eT="$identify",J6="$groupidentify";function cy(e,t){Xt(e)&&e.forEach(t)}function Vs(e,t){if(!cs(e))if(Xt(e))e.forEach(t);else if(eue(e))e.forEach(((r,a)=>t(r,a)));else for(var n in e)$q.call(e,n)&&t(e[n],n)}var cn=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var a of n)for(var i in a)a[i]!==void 0&&(e[i]=a[i]);return e};function Qv(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Q6=function(e){try{return e()}catch{return}},Zue=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,n)}catch(a){lt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),lt.critical(a)}}},s4=function(e){var t={};return Vs(e,(function(n,r){(ks(n)&&n.length>0||qn(n))&&(t[r]=n)})),t},ede=["herokuapp.com","vercel.app","netlify.app"];function tde(e){var t=e?.hostname;if(!ks(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of ede)if(n===r)return!1;return!0}function nn(e,t,n,r){var a=r??{},i=a.capture,o=a.passive;e?.addEventListener(t,n,{capture:i!==void 0&&i,passive:o===void 0||o})}
4function tT(e){return e.name==="ph_toolbar_internal"}var sT=e=>{if(Ke){try{for(var t=e+"=",n=Ke.cookie.split(";").filter((i=>i.length)),r=0;n.length>r;r++){for(var a=n[r];a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return qn(e)&&isFinite(e)&&Math.floor(e)===e});let sde=class nT{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(a)||0>t||0>n||0>r||0>a||t>0xffffffffffff||n>4095||r>1073741823||a>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=t/Math.pow(2,40),i[1]=t/Math.pow(2,32),i[2]=t/Math.pow(2,24),i[3]=t/Math.pow(2,16),i[4]=t/256,i[5]=t,i[6]=112|n>>>8,i[7]=n,i[8]=128|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=a>>>24,i[13]=a>>>16,i[14]=a>>>8,i[15]=a,new nT(i)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new nT(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}},nde=class{generate(){var t=this.generateOrAbort();if(!Be(t))return t;this.Kr=0;var n=this.generateOrAbort();if(Be(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.Kr)this.Kr=t,this.Xr();else{if(this.Kr>=t+1e4)return;this.ti++,this.ti>4398046511103&&(this.Kr++,this.Xr())}return sde.fromFieldsV7(this.Kr,Math.trunc(this.ti/Math.pow(2,30)),this.ti&Math.pow(2,30)-1,this.ei.nextUint32())}Xr(){this.ti=1024*this.ei.nextUint32()+(1023&this.ei.nextUint32())}constructor(){this.Kr=0,this.ti=0,this.ei=new rde}};var Z6,AW=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};Ae&&!Be(Ae.crypto)&&crypto.getRandomValues&&(AW=e=>crypto.getRandomValues(e));class rde{nextUint32(){return this.De.length>this.ri||(AW(this.De),this.ri=0),this.De[this.ri++]}constructor(){this.De=new Uint32Array(8),this.ri=1/0}}var po=()=>ade().toString(),ade=()=>(Z6||(Z6=new nde)).generate(),dg="",ide=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,fp=null,Rn={ii(){if(!Hn(fp))return fp;if(fp=!1,Ke)try{var e="__ph_cookie_support_"+po();Rn.ni(e,"xyz"),fp=sT(e)==='"xyz"',Rn.oi(e)}catch{fp=!1}return fp},si(e){lt.error("cookieStore error: "+e)},ai:sT,ui(e){var t;try{t=JSON.parse(Rn.ai(e))||{}}catch{}return t},ni(e,t,n,r,a){if(!Ke)return!1;try{var i="",o="",l=(function(d,h){if(h){var p=(function(g,x){if(x===void 0&&(x=Ke),dg)return dg;if(!x||["localhost","127.0.0.1"].includes(g))return"";for(var b=g.split("."),y=Math.min(b.length,8),v="dmn_chk_"+po();!dg&&y--;){var w=b.slice(y).join("."),j=v+"=1;domain=."+w+";path=/";x.cookie=j+";max-age=3",x.cookie.includes(v)&&(x.cookie=j+";max-age=0",dg=w)}return dg})(d);if(!p){var m=(g=>{var x=g.match(ide);return x?x[0]:""})(d);m!==p&<.info("Warning: cookie subdomain discovery mismatch",m,p),p=m}return p?"; domain=."+p:""}return""})(Ke.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+864e5*n),i="; expires="+c.toUTCString()}a&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+i+"; SameSite=Lax; path=/"+l+o;return u.length>3686.4&<.warn("cookieStore warning: large cookie, len="+u.length),Ke.cookie=u,!0}catch{return!1}},oi(e,t){if(Ke!=null&&Ke.cookie)try{Rn.ni(e,"",-1,t)}catch{return}}},D2=null,As={ii(){if(!Hn(D2))return D2;var e=!0;if(Be(Ae))e=!1;else try{var t="__mplssupport__";As.ni(t,"xyz"),As.ai(t)!=='"xyz"'&&(e=!1),As.oi(t)}catch{e=!1}return e||lt.error("localStorage unsupported; falling back to cookie store"),D2=e,e},si(e){lt.error("localStorage error: "+e)},ai(e){try{return Ae?.localStorage.getItem(e)}catch(t){As.si(t)}return null},ui(e){try{return JSON.parse(As.ai(e))||{}}catch{}return null},ni(e,t){try{return Ae?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){As.si(n)}return!1},oi(e){try{Ae?.localStorage.removeItem(e)}catch(t){As.si(t)}}},$2=[di,$i,Yr,ou,ho,lu,Zl,Sm,Gl],_d=[ib,Ir,cm,e4,cw,um,Za,bs],dw=e=>e+"_cpm",ode=["__proto__","constructor","prototype"],F2=e=>{if(!ys(e))return{};var t={};return Object.keys(e).forEach((n=>{ode.indexOf(n)===-1&&(t[n]=e[n])})),t},B2=function(e,t){t===void 0&&(t=[]);var n={};return[..._d,...t].forEach((r=>{var a=e[r];Be(a)||Hn(a)||a===""||(n[r]=a)})),n},RW=e=>{for(var t=5381,n=2166136261,r=0;e.length>r;r++){var a=e.charCodeAt(r);
4t=33*t^a,n=Math.imul(n^a,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(n>>>0).toString(36)},eO=(e,t)=>({p:t,f:RW(JSON.stringify(e))}),tO=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var n=Rn.ui(dw(e)),r=n?.f===RW(t)&&Xt(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},U2=(e,t)=>t+"|"+(Rn.ai(dw(e))||""),gp={},rT={ii:()=>!0,si(e){lt.error("memoryStorage error: "+e)},ai:e=>e in gp?gp[e]:null,ui:e=>e in gp?gp[e]:null,ni:(e,t)=>(gp[e]=t,!0),oi(e){delete gp[e]}},Ku=null,sn={ii(){if(!Hn(Ku))return Ku;if(Ku=!0,Be(Ae))Ku=!1;else try{var e="__support__";sn.ni(e,"xyz"),sn.ai(e)!=='"xyz"'&&(Ku=!1),sn.oi(e)}catch{Ku=!1}return Ku},si(e){lt.error("sessionStorage error: ",e)},ai(e){try{return Ae?.sessionStorage.getItem(e)}catch(t){sn.si(t)}return null},ui(e){try{return JSON.parse(sn.ai(e))||null}catch{}return null},ni(e,t){try{return Ae?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){sn.si(n)}return!1},oi(e){try{Ae?.sessionStorage.removeItem(e)}catch(t){sn.si(t)}}};let lde=class{constructor(t){this._instance=t}get mn(){return this._instance.config}get consent(){return this.Vs()?0:this.Gs}isOptedOut(){return this.mn.cookieless_mode===Yl||this.isRejected()||this.consent===-1&&this.mn.cookieless_mode===Bc}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.mn.opt_out_capturing_by_default}optInOut(t){this.Zs.ni(this.Qs,t?1:0,this.mn.cookie_expiration,this.mn.cross_subdomain_cookie,this.mn.secure_cookie)}reset(){this.Zs.oi(this.Qs,this.mn.cross_subdomain_cookie)}get Qs(){var t=this._instance.config,n=t.token,r=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(r?r+n:"__ph_opt_in_out_"+n)}get Gs(){var t=this.Zs.ai(this.Qs);return C2(t)?1:ns(rue,t)?0:-1}get Zs(){var t=this.mn.opt_out_capturing_persistence_type,n=t==="localStorage"?As:Rn,r=n.ii()?n:rT;if(!this.Js||this.Js!==r){this.Js=r;var a=t==="localStorage"?Rn:As;a.ai(this.Qs)&&(this.Js.ai(this.Qs)||this.optInOut(C2(a.ai(this.Qs))),a.oi(this.Qs,this.mn.cross_subdomain_cookie))}return this.Js}Vs(){return!!this.mn.respect_dnt&&[Cr?.doNotTrack,Cr?.msDoNotTrack,Bt.doNotTrack,Cr?.globalPrivacyControl].some((t=>C2(t)))}};function IW(e,t){var n,r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!ha(r))return t;try{var a=r(t);return ks(a)&&a?a:t}catch(i){return lt.error("Error in get_current_url, falling back to window.location.href",i),t}}var PW="__POSTHOG_TOOLBAR__",cde=1,ude=3,dde=11;function sO(e){return e instanceof Element&&(e.id===PW||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function vu(e){return!!e&&e.nodeType===cde}function _i(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function LW(e){return!!e&&e.nodeType===ude}function OW(e){return!!e&&e.nodeType===dde&&vu(e.host)}var MW=1e3;function n4(e){return e?u_(e).split(/\s+/):[]}function nO(e,t){var n=(function(r){var a,i=Ae==null||(a=Ae.location)==null?void 0:a.href;return Be(i)?void 0:IW(r,i)})(t);return!!(n&&e&&e.some((r=>n.match(r))))}function hw(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return n4(t)}function DW(e){return cs(e)?null:u_(e).split(/(\s+)/).filter((t=>bx(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ob(e){var t="";return oT(e)&&!zW(e)&&e.childNodes&&e.childNodes.length&&Vs(e.childNodes,(function(n){var r;LW(n)&&n.textContent&&(t+=(r=DW(n.textContent))!==null&&r!==void 0?r:"")})),u_(t)}function aT(e){var t;return Be(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var r4=["a","button","form","input","select","textarea","label"];function iT(e,t){if(Be(t))return!0;var n,r=function(i){if(t.some((o=>(function(l,c){var u=l.matches||l.matchesSelector||l.msMatchesSelector||l.mozMatchesSelector||l.webkitMatchesSelector||l.oMatchesSelector;try{return!!u&&u.call(l,c)}catch{return!1}})(i,o))))return{v:!0}};for(var a of e)if(n=r(a))return n.v;return!1}function $W(e){var t=e.parentNode;return!(!t||!vu(t))&&t}var hde=[".ph-no-autocapture","[data-ph-no-autocapture]"],FW=["next","previous","prev",">","<"],pde=[...FW,"+","-","â","â"],rO=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,aO=[".ph-no-rageclick",".ph-no-capture"],mde=["","text","search","email","password","url","tel","number"];function BW(e,t){if(!Ae||a4(e))return!1;var n,r,a,i,o;
4if(Pa(t)?(n=!!t&&aO,r=void 0,a=!1):(n=(i=t?.css_selector_ignorelist)!==null&&i!==void 0?i:aO,r=t?.content_ignorelist,a=(o=t?.ignore_text_selection)!==null&&o!==void 0&&o),n===!1||a&&(function(c){return!(!c||!vu(c))&&(!!_i(c,"textarea")||(_i(c,"input")?ns(mde,(c.getAttribute("type")||"").toLowerCase()):(function(u){if(u.isContentEditable)return!0;var d=u.getAttribute==null?void 0:u.getAttribute("contenteditable");return d==="true"||d===""})(c)))})(e))return!1;var l=UW(e,!1).targetElementList;return!(function(c,u){if(c===!1||Be(c))return!1;var d;if(c===!0)d=FW;else{if(!Xt(c))return!1;if(c.length>10)return lt.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;d=c.map((h=>h.toLowerCase()))}return u.some((h=>{var p=h.safeText,m=h.ariaLabel;return d.some((g=>rO(p,g)||rO(m,g)))}))})(r,l.map((c=>{var u;return{safeText:ob(c).toLowerCase(),ariaLabel:((u=c.getAttribute("aria-label"))==null?void 0:u.toLowerCase().trim())||""}})))&&!iT(l,n)}var a4=e=>!e||_i(e,"html")||!vu(e),UW=(e,t)=>{if(!Ae||a4(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],a=e;a.parentNode&&!_i(a,"body");)if(OW(a.parentNode))r.push(a.parentNode.host),a=a.parentNode.host;else{var i=$W(a);if(!i)break;if(t||r4.indexOf(i.tagName.toLowerCase())>-1)n=!0;else try{var o=Ae.getComputedStyle(i);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(i),a=i}return{parentIsUsefulElement:n,targetElementList:r}};function oT(e){for(var t=new Set,n=0,r=e;r.parentNode&&!_i(r,"body");r=r.parentNode){if(n++>=MW||t.has(r))return!1;t.add(r);var a=hw(r);if(ns(a,"ph-sensitive")||ns(a,"ph-no-capture"))return!1}if(ns(hw(e),"ph-include"))return!0;var i=e.type||"";if(ks(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var o=e.name||e.id||"";return!ks(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function zW(e){return!!(_i(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||_i(e,"select")||_i(e,"textarea")||e.getAttribute("contenteditable")==="true")}var iO=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),oO=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,fde=[16,15,14,13],gde=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),lO=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),cO=/[0-9A-Za-z_]/;function xde(e){for(var t=0,n=!1,r=e.length-1;r>=0;r--){var a=e.charCodeAt(r)-48;n&&(a*=2)>9&&(a-=9),t+=a,n=!n}return t%10==0}function bx(e,t){if(t===void 0&&(t=!0),cs(e))return!1;if(ks(e)){e=u_(e);var n=t?iO.test((e||"").replace(/[- ]/g,"")):(function(a){var i;for(oO.lastIndex=0;i=oO.exec(a);){var o=i[2];if(o)for(var l=o.replace(/[- ]/g,""),c=0;l.length>c;c++)for(var u of fde){var d=c+u;if(l.length>=d){var h=l.slice(c,d);if(iO.test(h)&&xde(h))return!0}}}return!1})(e);if(n)return!1;var r=t?gde.test(e):(function(a){var i;for(lO.lastIndex=0;i=lO.exec(a);){var o=i[1],l=i[3];if(!(o&&l&&cO.test(o)&&cO.test(l)))return!0}return!1})(e);if(r)return!1}return!0}function uO(e){var t=ob(e);return bx(t=(t+" "+HW(e)).trim())?t:""}function HW(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Vs(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var a=ob(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+HW(n)).trim())}catch(i){lt.error("[AutoCapture]",i)}})),t}function dO(e){return e.replace(/"|\\"/g,'\\"')}function bde(e){var t=e.attr__class;if(t)return Xt(t)?t:n4(t)}var uy=Sn("[Dead Clicks]"),yde=()=>!0,vde=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Q5)),r=e.instance.config.capture_dead_clicks;return Pa(r)?r:!!ys(r)||n};let hO=class{get lazyLoadedDeadClicksAutocapture(){return this.Ks}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[Q5]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Ys((()=>{this.Xs()})):this.stop()}Ys(t){var n,r;(n=Bt.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(r=Bt.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?uy.error("failed to load script",a):t()}))}Xs(){var t;if(Ke){if(!this.Ks&&(t=Bt.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=ys(this.instance.config.capture_dead_clicks)?ze({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Ks=Bt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Ks.start(Ke),uy.info("starting...")}}else uy.error("`document` not found. Cannot start.")}stop(){this.Ks&&(this.Ks.stop(),this.Ks=void 0,uy.info("stopping..."))}};var dy=Sn("[SegmentIntegration]");function pO(e,t,n){n===void 0&&(n=!0);var r=e.config.segment;if(!r)return t();(function(a,i,o){var l=a.config.segment;if(!l)return i();var c=d=>{var h=()=>d.anonymousId()||po();a.config.get_device_id=h,o&&d.id()&&(a.register({distinct_id:d.id(),$device_id:h()}),a.persistence.set_property(bs,Xr)),i(o?void 0:d.anonymousId()||void 0)},u=l.user();"then"in u&&ha(u.then)?u.then(c):c(u)})(e,(a=>{r.register(((i,o)=>{typeof Promise<"u"&&Promise.resolve||dy.warn("This browser does not have Promise support, and can not use the segment integration");var l=(c,u)=>{if(!u)return c;var d=!!o&&c.event.anonymousId===o&&!c.event.userId;d||c.event.userId||c.event.anonymousId===i.get_distinct_id()||(dy.info("No userId set, resetting PostHog"),i.reset()),d||(o=void 0),c.event.userId&&c.event.userId!==i.get_distinct_id()&&(dy.info("UserId set, identifying with PostHog"),i.identify(c.event.userId)
4);var h=i.calculateEventProperties(u,c.event.properties);return c.event.properties=Object.assign({},h,c.event.properties),c};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(c){return l(c,c.event.event)},page(c){return l(c,dm)},identify(c){return l(c,eT)},screen(c){return l(c,"$screen")}}})(e,a)).then((()=>{t()}),(i=>{dy.error("Failed to register the Segment integration",i),t()}))}),n)}var qW="posthog-js";function WW(e,t){var n=t===void 0?{}:t,r=n.organization,a=n.projectId,i=n.prefix,o=n.severityAllowList,l=o===void 0?["error"]:o,c=n.sendExceptionsToPostHog,u=c===void 0||c;return d=>{var h,p,m,g,x;if(l!=="*"&&!l.includes(d.level)||!e.__loaded)return d;d.tags||(d.tags={});var b=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());d.tags["PostHog Person URL"]=b,e.sessionRecordingStarted()&&(d.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var y,v=((h=d.exception)==null?void 0:h.values)||[],w=v.map((E=>ze({},E,{stacktrace:E.stacktrace?ze({},E.stacktrace,{type:"raw",frames:(E.stacktrace.frames||[]).map((S=>ze({},S,{platform:"web:javascript"})))}):void 0}))),j={$exception_message:((p=v[0])==null?void 0:p.value)||d.message,$exception_type:(m=v[0])==null?void 0:m.type,$exception_level:d.level,$exception_list:w,$sentry_event_id:d.event_id,$sentry_exception:d.exception,$sentry_exception_message:((g=v[0])==null?void 0:g.value)||d.message,$sentry_exception_type:(x=v[0])==null?void 0:x.type,$sentry_tags:d.tags};return r&&a&&(j.$sentry_url=(i||"https://sentry.io/organizations/")+r+"/issues/?project="+a+"&query="+d.event_id),u&&((y=e.exceptions)==null||y.sendExceptionEvent(j)),d}}let wde=class{constructor(t,n,r,a,i,o){this.name=qW,this.setupOnce=function(l){l(WW(t,{organization:n,projectId:r,prefix:a,severityAllowList:i,sendExceptionsToPostHog:o==null||o}))}}};class mO{constructor(t){this.eo=(n,r,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength||a.crossTabAdoption)&&(lt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:a}),this.io=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ro()}ro(){var t;this.no=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.eo)}destroy(){var t;(t=this.no)==null||t.call(this),this.no=void 0}doPageView(t,n){var r,a=this.so(t,n);return this.io={pathname:(r=Ae?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.so(t,(n=this.io)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.io)==null?void 0:t.pageViewId}}so(t,n){var r=this.io;if(!r)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:r.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var o=i.maxScrollHeight,l=i.lastScrollY,c=i.maxScrollY,u=i.maxContentHeight,d=i.lastContentY,h=i.maxContentY;if(!(Be(o)||Be(l)||Be(c)||Be(u)||Be(d)||Be(h))){o=Math.ceil(o),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d),h=Math.ceil(h);var p=o>1?Zo(l/o,0,1,lt):1,m=o>1?Zo(c/o,0,1,lt):1,g=u>1?Zo(d/u,0,1,lt):1,x=u>1?Zo(h/u,0,1,lt):1;a=cn(a,{$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:m,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:x})}}return r.pathname&&(a.$prev_pageview_pathname=r.pathname),r.timestamp&&(a.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),a}}var hg=["flags","surveys"],jde={[vW]:{exposure:"hidden"},[lm]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Xg]:{exposure:"hidden"},[Za]:{exposure:"hidden"},[$C]:{exposure:"event"},[FC]:{exposure:"hidden"},[qC]:{exposure:"hidden"},[BC]:{exposure:"event"},[UC]:{exposure:"hidden"},[zC]:{exposure:"event"},[HC]:{exposure:"event"},[Q5]:{exposure:"event"},[Z5]:{exposure:"hidden"},[WC]:{exposure:"event"},[Ud]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[cm]:{exposure:"hidden"},[e4]:{exposure:"event"},[wW]:{exposure:"event",shouldSkipFromEventProperties:e=>Hn(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Yr]:{exposure:"hidden",storageGroup:"flags"},[$i]:{exposure:"hidden",storageGroup:"flags"},[Kv]:{exposure:"hidden"},[ou]:{exposure:"hidden",storageGroup:"flags"}
4,[ho]:{exposure:"hidden",storageGroup:"flags"},[lu]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Em]:{exposure:"hidden",storageGroup:"flags"},[Bo]:{exposure:"hidden"},[jd]:{exposure:"hidden"},[di]:{exposure:"hidden"},[Yo]:{exposure:"hidden"},[VC]:{exposure:"hidden",storageGroup:"surveys"},[lw]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[GC]:{exposure:"event"},[Xv]:{exposure:"hidden"},[Jv]:{exposure:"hidden"},[Jg]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Gl]:{exposure:"hidden"},[Qg]:{exposure:"hidden"},[EW]:{exposure:"event"},[Sm]:{exposure:"hidden"},[Zl]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[bs]:{exposure:"hidden"},[YC]:{exposure:"hidden"},[KC]:{exposure:"hidden"},[XC]:{exposure:"hidden"},[JC]:{exposure:"hidden"},[um]:{exposure:"hidden"},[cw]:{exposure:"hidden"},[jW]:{exposure:"event"},[_W]:{exposure:"event"},[kW]:{exposure:"event"},[NW]:{exposure:"event"},[CW]:{exposure:"event"},[TW]:{exposure:"event"},[QC]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"}
4,$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},_de=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Pr=e=>{var t=jde[e];if(t)return t;for(var n of _de){var r=n[1];if(e.indexOf(n[0])===0)return r}},hm=(e,t)=>{try{return JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t)}catch{return Mq(e)}},Hm=e=>{var t=Ke?.createElement("a");return Be(t)?null:(t.href=e,t)},qm=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;r.length>a;a++){var i=r[a].split("=");if(i[0]===t){n=i;break}}if(!Xt(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{lt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},lb=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),a=r[1],i=(r[0]||"").split("?"),o=i[1],l=i[0],c=(o||"").split("&"),u=[],d=0;c.length>d;d++){var h=c[d].split("=");Xt(h)&&(t.includes(h[0])?u.push(h[0]+"="+n):u.push(c[d]))}var p=l;return o!=null&&(p+="?"+u.join("&")),a!=null&&(p+="#"+a),p},pw=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},VW=(e,t)=>e>=t&&Lq(),GW=(e,t,n,r)=>{if(e===0){if(Lq()){var a=t+1;return a===n&&r(),a}return t}return 0},hy="https?://(.*)",Wm=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],kde=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Wm],cb="<masked>",Nde=["li_fat_id"];function YW(e,t,n){if(!Ke)return{};var r,a=t?[...Wm,...n||[]]:[],i=KW(lb(Ke.URL,a,cb),e),o=(r={},Vs(Nde,(function(l){var c=sT(l);r[l]=c||null})),r);return cn(o,i)}function KW(e,t){var n=kde.concat(t||[]),r={};return Vs(n,(function(a){var i=qm(e,a);r[a]=i||null})),r}function XW(e){var t=(function(i){return i?i.search(hy+"google.([^/?]*)")===0?"google":i.search(hy+"bing.com")===0?"bing":i.search(hy+"yahoo.com")===0?"yahoo":i.search(hy+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!Hn(t)){r.$search_engine=t;var a=Ke?qm(Ke.referrer,n):"";a.length&&(r.ph_keyword=a)}return r}function fO(){return navigator.language||navigator.userLanguage}var mw="$direct";function JW(){return Ke?.referrer||mw}function QW(e,t,n){n===void 0&&(n=!1);var r=e?[...Wm,...t||[]]:[],a=n?yu(In?.href):In?.href,i=a?.substring(0,1e3);return{r:JW().substring(0,1e3),u:i?lb(i,r,cb):void 0}}function ZW(e,t){var n;t===void 0&&(t=!1);var r=e.r,a=e.u,i=t?yu(a):a,o={$referrer:r,$referring_domain:r==null?void 0:r==mw?mw:(n=Hm(r))==null?void 0:n.host};
4if(i){o.$current_url=i;var l=Hm(i);o.$host=l?.host,o.$pathname=l?.pathname;var c=KW(i);cn(o,c)}if(r){var u=XW(r);cn(o,u)}return o}function eV(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Ede(){try{return new Date().getTimezoneOffset()}catch{return}}var Sde={flags:Zl,surveys:lw},Cde=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],py=e=>e+"_cookie_identity_change_pending",my=e=>{var t="",n=0;for(var r of e){var a=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(n+a>1e3)break;t+=r,n+=a}return t},ur="main",Ml=[Yr,$i,ou,ho,lu,Zl,Em,di],z2=e=>Ml.indexOf(e)!==-1,Sc=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},xp=e=>{if(!e)return{};var t=JSON.parse(e);return ys(t)?t:{}},gO=(e,t)=>{Vs(e,((n,r)=>{var a=Pr(r);a&&a.exposure!=="event"||{}.hasOwnProperty.call(t,r)||delete e[r]}))};let H2=class{constructor(t,n,r){if(r===void 0&&(r=!0),this.oo={},this.ao=!1,this.lo=!1,this.uo=!1,this.ho=!1,this.do=!1,this.vo=new Map,this.co=!1,this.fo=!1,this.po=!1,this.mo=!1,this.yo=new Set,this.mn=t,this.bo=r,this.props={},this._o=void 0,this.wo=(i=>{var o="";return i.token&&(o=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+o+"_posthog"})(t),this.Zs=this.ko(t),this.uo=this.So(t),this.load(),this.xo(),t.debug&<.info("Persistence loaded",t.persistence,ze({},this.props)),this.update_config(t,t,n),this.save(),Ae){var a=()=>this.flush();nn(Ae,"beforeunload",a,{capture:!1}),nn(Ae,"pagehide",a,{capture:!1}),this.Co=i=>{if(this.ao&&(!i.storageArea||i.storageArea===Ae?.localStorage)&&i.key)if(i.key!==this.wo){if(this.uo){var o=hg.find((l=>i.key===this.To(l)));o&&this.Mo(i.key,o)}}else this.Mo(i.key,ur)},nn(Ae,"storage",this.Co)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((n=>{var r=n[0],a=n[1],i=this.vo.get(r);if(z2(r)&&i!==!0)if(a!==!0){var o=new Set(i||[]);a.forEach((l=>o.add(l))),o.size&&this.Io(r,o)}else this.Io(r,!0)}))}onCrossTabFeatureFlagChange(t){return this.yo.add(t),()=>this.yo.delete(t)}destroy(){this.Co&&Ae&&(Ae.removeEventListener("storage",this.Co),this.Co=void 0),this.yo.clear()}Mo(t,n,r){if(r===void 0&&(r=!0),this.Eo)return!1;var a,i;try{if(i=As.ai(t),Hn(i)){var o=this.Ro(n);return o.storageValue=null,n!==ur&&(o.persisted=!1),!1}a=xp(i)}catch{return!1}var l=n===ur?a:As.ui(this.wo);if(l&&this.Po(l))return!1;var c=this.Ao(a,n,r);return n===ur&&this.uo&&!Sc(this.Fo().main,a)||this.Oo(a,n,!0,i),c}Po(t){var n=this.props[Ir],r=t[Ir];return!Be(n)&&!Be(r)&&n!==r}Oo(t,n,r,a){var i=this.Ro(n);i.storageValue=a,n!==ur&&(i.persisted=r);try{i.fingerprint=this.Lo(t,n)}catch{i.fingerprint=void 0}}Ao(t,n,r){var a=!1;return Ml.forEach((i=>{var o,l=(o=Pr(i))==null?void 0:o.storageGroup;if(!(n===ur&&this.uo&&l||n!==ur&&l!==n)){var c=i in t,u=this.Do(i,c?t[i]:void 0),d=this.vo.has(i)?i in this.props:c;d===i in this.props&&Sc(u,this.props[i])||(d?this.$o(i,u,!1):this.No(i,!1),a=!0)}})),a&&r&&this.yo.forEach((i=>i())),a}qo(){if(!this.ao)return!1;try{this.po=!1;var t,n=As.ai(this.wo),r=this.Ro(ur),a=!1,i=!1;if(n!==r.storageValue)if(Hn(n))r.storageValue=null;else{if(t=xp(n),this.po=!this.fo&&this.Po(t),this.po)return!1;i=this.Ao(t,ur,!1),!this.uo||Sc(this.Fo().main,t)?this.Oo(t,ur,!0,n):r.storageValue=n,a=!0}return this.uo&&hg.forEach((o=>{var l=As.ai(this.To(o)),c=this.Ro(o),u=t||{},d=a&&Ml.some((p=>{var m;return((m=Pr(p))==null?void 0:m.storageGroup)===o&&p in u}));if(l!==c.storageValue||d){if(Hn(l))return c.storageValue=null,c.persisted=!1,void(d&&(i=this.Ao(u,o,!1)||i));var h=xp(l);i=this.Ao(h,o,!1)||i,this.Oo(h,o,!0,l)}})),i}catch{return!1}}Io(t,n){this.vo.set(t,n);var r=Pr(t);r!=null&&r.volatile||(this.Ro((this.uo?r?.storageGroup:void 0)||ur).fingerprint=void 0,this.jo(t))}Bo(){Ml.forEach((t=>this.vo.set(t,!0)))}xo(){if(this.ao)try{var t=As.ai(this.wo),n=xp(t);this.Ro(ur).storageValue=t,Ml.forEach((r=>{var a,i=this.uo?(a=Pr(r))==null?void 0:a.storageGroup:void 0,o=i?As.ai(this.To(i)):null;if(i){var l=this.Ro(i);l.storageValue=o,l.persisted=!Hn(o)}var c=i&&!Hn(o)?xp(o):n;r in this.props?this.Ho(r,c[r],this.props[r]):r in c&&this.Io(r,!0)}))}catch{}}Do(t,n){var r=this.vo.get(t);if(!r)return n;if(r===!0)return this.props[t];if(t===$i){var a=new Set(Xt(n)?n:[]),i=new Set(Xt(this.props[t])?this.props[t]:[]);return r.forEach((c=>i.has(c)?a.add(c):a.delete(c))),Array.from(a)}var o=ys(n)?ze({},n):{},l=ys(this.props[t])?this.props[t]:{};return r.forEach((c=>{c in l?o[c]=l[c]:delete o[c]})),o}Ho(t,n,r){if(z2(t)){var a=this.vo.get(t);if(a!==!0){var i=n;
4if(this.ao)try{var o,l=this.uo?(o=Pr(t))==null?void 0:o.storageGroup:void 0,c=l?this.To(l):this.wo;i=xp(As.ai(c))[t]}catch{}var u=new Set(a||[]);if(t===$i){if(!Be(n)&&!Xt(n)||!Be(i)&&!Xt(i)||!Xt(r))return void this.Io(t,!0);var d=new Set(n||[]),h=new Set(i||[]),p=new Set(r);new Set([...d,...p]).forEach((x=>{d.has(x)!==p.has(x)&&u.add(x)})),u.forEach((x=>{h.has(x)===p.has(x)&&u.delete(x)}))}else{if(!ys(r))return void(Sc(i,r)?this.vo.delete(t):this.Io(t,!0));if(!Be(n)&&!ys(n)||Be(n)&&gi(r)&&Be(i))return void this.Io(t,!0);var m=ys(n)?n:{},g=ys(i)?i:{};new Set([...Object.keys(m),...Object.keys(r)]).forEach((x=>{x in m==x in r&&Sc(m[x],r[x])||u.add(x)})),u.forEach((x=>{x in g==x in r&&Sc(g[x],r[x])&&u.delete(x)}))}u.size?this.Io(t,u):this.vo.delete(t)}}}zo(){var t,n=(t=this.mn)==null?void 0:t.persistence_save_debounce_ms;return qn(n)&&n>0?n:0}Uo(t){if(this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie")if(t)try{var n=B2(t,this.mn.cookie_persisted_properties||[]),r=eO(n,this.mn.cookie_persisted_properties||[]),a=JSON.stringify(n)+"|"+JSON.stringify(r),i=Rn.ai(this.wo)||void 0;i&&U2(this.wo,i)===a&&(this.Wo=a,this.Vo=i)}catch{}else try{var o=Rn.ai(this.wo)||void 0;this.Wo=o?U2(this.wo,o):void 0,this.Vo=o}catch{}}syncCookieProperties(){return this.Go(this.mn)}Go(t,n){if(n===void 0&&(n=!1),this.Eo&&!n||this.do||!t.cookieWinsOnConflict||t.persistence.toLowerCase()!=="localstorage+cookie")return!1;var r;try{r=Rn.ai(this.wo)||void 0}catch{}if(!r||r===this.Vo)return!1;var a,i=U2(this.wo,r);try{a=F2(JSON.parse(r))}catch{return!1}if((Rn.ai(this.wo)||void 0)!==r)return!1;this.Wo=i,this.Vo=r;var o=tO(this.wo,r),l=[..._d,...o.properties],c={};if(Object.keys(a).forEach((b=>{var y=a[b];(Be(y)||Hn(y)||y===""||b===bs&&y!==Kn&&y!==Xr)&&(c[b]=!0,delete a[b])})),gi(a))return!1;var u=Ir in a||a[bs]===Kn||a[bs]===Xr,d=this.props,h=d[Ir],p=d[bs],m=cn({},d);[..._d,...t.cookie_persisted_properties||[]].forEach((b=>{if(l.indexOf(b)!==-1&&!(b in a)&&!c[b]&&(u||b!==Ir&&b!==bs)){var y=m[b];!o.isValid&&_d.indexOf(b)!==-1&&(y===!1||y===0)||delete m[b]}})),this.props=cn(m,a),Ml.forEach((b=>{var y=b in this.props;b in d===y&&Sc(d[b],this.props[b])||(y?this.Ho(b,d[b],this.props[b]):this.Io(b,!0))})),!u||bs in a||bs in this.props||this.$o(bs,Kn);var g=this.props[Ir],x=this.props[bs];return!u||g===h&&x===p||(this.fo=!0,this.ho=!0,sn.ni(py(this.wo),!0),this.No(di),this.No($i),this.No(Yr),this.No(ou),this.No(ho),this.No(lu),this.No(Zl),this.No(Sm),this.No(Gl),x===Kn&&(p===Xr||a[bs]===Kn||!Be(h)&&g!==h)&&(gO(this.props,a),this.No(Yo)),x===Xr?this.props.$user_id=g:delete this.props.$user_id,this.No(lm)),!0}
4consumeCookieIdentityChange(){var t=py(this.wo),n=this.ho||!!sn.ai(t);return this.ho=!1,n&&sn.oi(t),n}Zo(t){return t===void 0&&(t=!1),!(this.do||this.Eo&&!t||!this.mn.cookieWinsOnConflict||this.mn.persistence.toLowerCase()!=="localstorage+cookie"||(this.do=!0,0))}Qo(){this.do&&(Be(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0),delete this.oo[ur],this.Ko(!0))}Yo(t){if(t===void 0&&(t=!0),this.do)try{t?this.Qo():Be(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0)}finally{this.do=!1}}isDisabled(){return!!this.Eo}ko(t){Cde.indexOf(t.persistence.toLowerCase())===-1&&(lt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,r=(function(l,c){l===void 0&&(l=[]),c===void 0&&(c=!1);var u=[..._d,...l];return ze({},As,{ui(d){try{var h,p={};try{h=Rn.ai(d)||void 0,p=h?F2(JSON.parse(h)):{}}catch{}var m,g=JSON.parse(As.ai(d)||"{}");if(c){var x=tO(d,h),b=[..._d,...x.properties],y={};Object.keys(p).forEach((S=>{var _=p[S];Hn(_)||_===""||S===bs&&_!==Kn&&_!==Xr||(y[S]=_)}));var v=Ir in y||y[bs]===Kn||y[bs]===Xr;if(Object.keys(y).length>0){var w,j=g[Ir],E=(w=g[bs])!==null&&w!==void 0?w:Kn;u.forEach((S=>{if(b.indexOf(S)!==-1&&!(S in p)&&(v||S!==Ir&&S!==bs)){var _=g[S];!x.isValid&&_d.indexOf(S)!==-1&&(_===!1||_===0)||delete g[S]}})),!v||bs in p||bs in g||(g[bs]=Kn),!v||(Ir in y?y[Ir]:g[Ir])===j&&(bs in y?y[bs]:g[bs])===E||($2.forEach((S=>delete g[S])),y[bs]===Xr&&Ir in y?g.$user_id=y[Ir]:delete g.$user_id,y[bs]!==Xr&&(delete g[EW],delete g[Yo]),delete g.__alias)}m=cn(g,y)}else m=cn(p,g);return As.ni(d,m),m}catch{}return null},ni(d,h,p,m,g,x){var b=As.ni(d,h,void 0,void 0,x);try{var y=B2(h,l);if(Object.keys(y).length){if(c){var v=dw(d),w=eO(y,l);if(Rn.ni(v,w,p,m,g,x),Rn.ai(v)!==JSON.stringify(w)){Rn.oi(v,m);var j=B2(h);return Rn.ni(d,j,p,m,g,x),b}}Rn.ni(d,y,p,m,g,x)}}catch(E){As.si(E)}return b},oi(d,h){try{Ae?.localStorage.removeItem(d),Rn.oi(d,h),Rn.oi(dw(d),h)}catch(p){As.si(p)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),a=!1,i=!1,o=t.persistence.toLowerCase();return o==="localstorage"&&As.ii()?(n=As,i=!0):o==="localstorage+cookie"&&r.ii()?(n=r,i=!0,a=!0):o==="sessionstorage"&&sn.ii()?n=sn:o==="memory"?n=rT:o==="cookie"&&Rn.ii()?(n=Rn,a=!0):r.ii()?(n=r,i=!0,a=!0):Rn.ii()?(n=Rn,a=!0):n=rT,this.ao=i,this.lo=a,n}To(t){return this.wo+"__"+t}So(t){return this.ao&&!!t.split_storage}properties(){var t={};return Vs(this.props,((n,r)=>{var a=Pr(r);if(!a||a.exposure==="event"){if(a!=null&&a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n))return;t[r]=n}})),t}load(t){if(t===void 0&&(t=!1),!this.Eo||t){var n=this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie",r=n?As.ui(this.wo):null,a={};if(n)try{Vs(a=F2(Rn.ui(this.wo)),((g,x)=>{(Be(g)||Hn(g)||g==="")&&delete a[x]}))}catch{}var i=this.Zs.ui(this.wo);if(i&&(this.props=cn({},i)),this.uo&&this.Xo(),n&&i){var o,l,c=r?.[Ir],u=(o=r?.[bs])!==null&&o!==void 0?o:Kn,d=i[Ir],h=(l=i[bs])!==null&&l!==void 0?l:Kn;if(d!==c||h!==u){this.ho=!0,sn.ni(py(this.wo),!0);var p=cn({},this.props);$2.forEach((g=>delete p[g])),h===Kn&&(u===Xr||a[bs]===Kn||!Be(c)&&d!==c)&&(gO(p,a),delete p[Yo]),this.props=p;var m=new Set;$2.forEach((g=>{var x,b=(x=Pr(g))==null?void 0:x.storageGroup;b&&m.add(b)})),m.forEach((g=>{var x={};Vs(this.props,((b,y)=>{var v;((v=Pr(y))==null?void 0:v.storageGroup)===g&&(x[y]=b)})),gi(x)?(As.oi(this.To(g)),this.oo[g]={}):As.ni(this.To(g),x)&&(this.oo[g]={persisted:!0,fingerprint:this.Lo(x,g)})}))}}sn.ai(py(this.wo))&&(this.ho=!0)}}Xo(){for(var t of hg){var n=As.ui(this.To(t));if(n&&!gi(n)){var r=this.Ro(t);r.persisted=!0,this.ta(t)||(r.fingerprint=this.Lo(n,t)),this.ea(t,n)||cn(this.props,n)}}}ta(t){return Object.keys(this.props).some((n=>{var r;return((r=Pr(n))==null?void 0:r.storageGroup)===t}))}ea(t,n){var r=Sde[t];if(!r)return!1;var a=n[r],i=this.props[r];return qn(a)&&qn(i)&&i>a}refreshKey(t){var n;if(!(this.Eo||t===Za&&this.mo)){var r=this.uo?(n=Pr(t))==null?void 0:n.storageGroup:void 0,a=r?As.ui(this.To(r)):this.Zs.ui(this.wo);if(a&&t in a)this.$o(t,a[t],!1);else{if(r){var i=this.Zs.ui(this.wo);if(i&&t in i)return void this.$o(t,i[t],!1)}this.No(t,!1)}}}save(){if(!this.Eo){var t=this.zo();t>0?Be(this.Jo)&&(this.Jo=setTimeout((()=>{this.Jo=void 0,this.Ko()}),t)):this.Ko()}}flush(){Be(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0,this.Ko())}Ko(t){if(t===void 0&&(t=!1),!(this.Eo||this.do&&!t)){t||(this.syncCookieProperties(),this.mo||this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie"||this.refreshKey(Za));var n=!t&&!this.co;n||(this.po=!1);var r=!!n&&this.qo();if(this.po)this.mn.debug&<.warn("skipping persistence write because storage belongs to a different distinct ID");
4else{if(this.uo)return this.ia(),void(r&&this.yo.forEach((i=>i())));var a=this.ra(this.Zs,this.wo,this.props,ur);a==="written"&&this.Uo(this.props),a!=="failed"&&(this.vo.clear(),this.fo=!1,this.mo=!1),r&&this.yo.forEach((i=>i()))}}}ia(){var t=this,n=this.Fo(),r=n.main,a=n.groups,i=this.ra(this.Zs,this.wo,r,ur);i==="written"&&this.Uo(r),i!=="failed"&&(this.fo=!1,this.mo=!1,Ml.forEach((c=>{var u;(u=Pr(c))!=null&&u.storageGroup||this.vo.delete(c)})));var o=function(c){var u,d=a[c];if(gi(d)&&((u=t.oo[c])==null||!u.persisted))return Ml.forEach((p=>{var m;((m=Pr(p))==null?void 0:m.storageGroup)===c&&t.vo.delete(p)})),1;var h=t.ra(As,t.To(c),d,c);h!=="failed"&&Ml.forEach((p=>{var m=Pr(p);m?.storageGroup!==c||h!=="written"&&m.volatile||t.vo.delete(p)}))};for(var l of hg)o(l)}Fo(){var t={},n={flags:{},surveys:{}};return Vs(this.props,((r,a)=>{var i,o=(i=Pr(a))==null?void 0:i.storageGroup;o?n[o][a]=r:t[a]=r})),{main:t,groups:n}}Lo(t,n){if(n===ur)return JSON.stringify(t)+"|"+this.na+"|"+this.sa+"|"+this.oa;var r={};return Vs(t,((a,i)=>{var o;r[i]=(o=Pr(i))!=null&&o.volatile?"__volatile__":a})),JSON.stringify(r)}ra(t,n,r,a){var i,o=this.Ro(a);if(a!==ur&&!o.dirty&&!Be(o.fingerprint))return"skipped";try{if((i=this.Lo(r,a))===o.fingerprint)return o.dirty=!1,"skipped"}catch{i=void 0}return t.ni(n,r,this.na,this.sa,this.oa,this.mn.debug)?(o.dirty=!1,a!==ur&&(o.persisted=!0),Be(i)||(o.fingerprint=i),this.ao&&(o.storageValue=As.ai(n)),"written"):(this.mn.debug&<.warn('failed to persist storage entry "'+n+'"; will retry on next save'),"failed")}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,r=n!==void 0&&n;if(this.Bo(),Be(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0),this.Zs.oi(this.wo,!1),this.Zs.oi(this.wo,!0),!r&&this.bo)for(var a of hg)As.oi(this.To(a));r?delete this.oo[ur]:this.oo={},this.Wo=void 0,this.Vo=void 0}clear(){this.remove(),this.props={}}register_once(t,n,r){if(ys(t)){this.syncCookieProperties(),Be(n)&&(n="None"),this.na=Be(r)?this.aa:r;var a=!1;if(Vs(t,((i,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.$o(o,i),a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(ys(t)){this.syncCookieProperties(),this.na=Be(n)?this.aa:n;var r=!1;if(Vs(t,((a,i)=>{t.hasOwnProperty(i)&&(this.props[i]!==a||ys(a)||Xt(a))&&(this.$o(i,a),r=!0)})),r)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var n=typeof t=="string"?[t]:t,r=!1;for(var a of n)a in this.props&&(this.No(a),r=!0);r&&this.save()}update_campaign_params(){var t=Ke?.URL;if(t!==this._o){var n=YW(this.mn.custom_campaign_params,this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties),r=!gi(s4(n));return r&&this.register(n),this._o=t,r?n:void 0}}update_search_keyword(){var t;this.register((t=Ke?.referrer)?XW(t):{})}update_referrer_info(){var t;this.register_once({$referrer:JW(),$referring_domain:Ke!=null&&Ke.referrer&&((t=Hm(Ke.referrer))==null?void 0:t.host)||mw},void 0)}set_initial_person_info(){if(!this.props[XC]&&!this.props[JC]){var t=QW(this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties,this.mn.disable_capture_url_hashes);this.register_once({[um]:this.lo?{r:my(t.r),u:t.u?my(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};Vs([JC,XC],(a=>{var i=this.props[a];i&&Vs(i,(function(o,l){t["$initial_"+CC(l)]=o}))}));var n=this.props[um];if(n){var r=(function(a,i){i===void 0&&(i=!1);var o=ZW(a,i),l={};return Vs(o,(function(c,u){l["$initial_"+CC(u)]=c})),l})(n,this.mn.disable_capture_url_hashes);cn(t,r)}return t}safe_merge(t){return Vs(this.props,(function(n,r){r in t||(t[r]=n)})),t}update_config(t,n,r){var a=t.persistence!==n.persistence,i=!((x,b)=>{if(x.length!==b.length)return!1;var y=[...x].sort(),v=[...b].sort();return y.every(((w,j)=>w===v[j]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),o=a||i,l=t.cookieWinsOnConflict!==n.cookieWinsOnConflict,c=t.disable_persistence||!!r,u=!!this.Eo&&!c;c||this.Go(n,u),this.mn=t,!c&&(a||i||l)&&(this.Wo=void 0,this.Vo=void 0,this.Go(ze({},t,{cookie_persisted_properties:n.cookie_persisted_properties}),u));var d=o||l?this.ko(t):this.Zs;this.la();var h=this.So(t),p=o||h!==this.uo,m=!c&&(p||t.cross_subdomain_cookie!==this.sa||t.secure_cookie!==this.oa)&&this.Zo(u);this.co=p;try{if(this.aa=this.na=t.cookie_expiration,this.set_disabled(c),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),p){var g=this.props;this.clear(),this.Zs=d,this.uo=h,this.props=g,this.save()}else l&&(this.Zs=d,c||(delete this.oo[ur],this.Ko()))}finally{this.co=!1,m&&this.Yo()}}la(){var t=this.props[um];if(this.lo&&ys(t)&&typeof t.r=="string"){var n=my(t.r),r=typeof t.u=="string"?my(t.u):t.u;n===t.r&&r===t.u||this.$o(um,ze({},t,{r:n,u:r}))}}set_disabled(t){this.Eo=t,this.Eo?this.remove():this.save()}set_cross_subdomain(t){t!==this.sa&&(this.sa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.oa&&(this.oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var r=this.props[Xg]||{};r[t]=n,this.$o(Xg,r),this.save()}remove_event_timer(t){var n=this.props[Xg]||{},r=n[t];return Be(r)||(delete n[t],this.$o(Xg,n),this.save()),r}get_property(t){return this.props[t]}set_property(t,n){this.$o(t,n),this.save()}$o(t,n,r){var a;r===void 0&&(r=!0);var i=this.props[t];this.props[t]=n,r&&(t!==Ir&&t!==bs||i===n||(this.fo=!0),t!==Za||Sc(i,n)||(this.mo=!0),this.Ho(t,i,n),(a=Pr(t))!=null&&a.volatile||this.jo(t))}No(t,n){n===void 0&&(n=!0),delete this.props[t],n&&(z2(t)&&this.Io(t,!0),t===Za&&(this.mo=!0),this.jo(t))}jo(t){var n,r=(n=Pr(t))==null?void 0:n.storageGroup;r&&(this.Ro(r).dirty=!0)}Ro(t){return this.oo[t]||(this.oo[t]={})}};var pi={GZipJS:"gzip-js",Base64:"base64"},pg={Activation:"events",Cancellation:"cancelEvents"},q2={Popover:"popover",API:"api",Widget:"widget"},Kl={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"}
4,W2={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},lT={Popover:"popover",Inline:"inline"};function fy(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&ha(n.then)&&n.then(void 0,(()=>{}))}}}}var Tde={SHOWN:"product tour shown"},xO={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},bO=Sn("[RateLimiter]");let Ade=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((a=>{bO.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void bO.warn('could not rate limit - continuing. Error: "'+a?.message+'"',{text:r})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,r,a;t===void 0&&(t=!1);var i=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,l=new Date().getTime(),c=(n=(r=this.instance.persistence)==null?void 0:r.get_property(KC))!==null&&n!==void 0?n:{tokens:i,last:l};c.tokens+=(l-c.last)/1e3*o,c.last=l,c.tokens>i&&(c.tokens=i);var u=1>c.tokens;if(u||t||(c.tokens=Math.max(0,c.tokens-1)),u&&!t){var d=(qn(c.dropped)?c.dropped:0)+1;c.dropped=d,!this.lastEventRateLimited&&this.ua(d)&&(c.dropped=0)}return this.lastEventRateLimited=u,(a=this.instance.persistence)==null||a.set_property(KC,c),{isRateLimited:u,remainingTokens:c.tokens}}ha(t){var n=this.instance.config.property_denylist;return!Xt(n)||!n.includes(t)}da(){var t;if(this.ha("$current_url")&&this.ha("$pathname")&&In!=null&&In.pathname)return""+((t=In.origin)!==null&&t!==void 0?t:"")+In.pathname}ua(t){var n,r,a=this.captureEventsBurstLimit,i=this.captureEventsPerSecond,o=this.da(),l=this.ha("$session_id")?(n=(r=this.instance).get_session_id)==null?void 0:n.call(r):void 0,c=[t+" event(s) dropped since the last warning",o?"triggered on "+o:void 0,l?"session "+l:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+c+". Config is set to "+i+" events per second and "+a+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}};var Cc=Sn("[RemoteConfig]");class tV{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Bt._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}va(t){var n,r;(n=Bt.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Bt.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}ca(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Cc.info("Using preloaded remote config",this.remoteConfig),void this.fa(this.remoteConfig);if(this._instance.pa())return void Cc.warn("Remote config is disabled. Falling back to local config.");this.va((t=>{if(!t)return Cc.info("No config found after loading remote JS config. Falling back to JSON."),void this.ca((n=>{this.fa(n.json,n)}));this.fa(t)}))}catch(t){Cc.error("Error loading remote config",t),this.fa()}}fa(t,n){!t&&n&&(n.statusCode===0?n.error||Cc.warn("Failed to fetch remote config from PostHog."):Cc.error("Failed to fetch remote config from PostHog."));try{this._instance.fa(t?{ok:!0,config:t}:{ok:!1})}catch(a){Cc.error("Error applying remote config",a)}if(t?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded()}catch(a){Cc.error("Error loading feature flags",a)}}}var Ji=Uint8Array,ei=Uint16Array,Vm=Uint32Array,i4=new Ji([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),o4=new Ji([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yO=new Ji([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sV=function(e,t){for(var n=new ei(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var a=new Vm(n[30]);for(r=1;30>r;++r)for(var i=n[r];n[r+1]>i;++i)a[i]=i-n[r]<<5|r;return[n,a]},nV=sV(i4,2),cT=nV[1];nV[0][28]=258,cT[258]=28;for(var vO=sV(o4,0)[1],rV=new ei(32768),Ln=0;32768>Ln;++Ln){var bp=(43690&Ln)>>>1|(21845&Ln)<<1;rV[Ln]=((65280&(bp=(61680&(bp=(52428&bp)>>>2|(13107&bp)<<2))>>>4|(3855&bp)<<4))>>>8|(255&bp)<<8)>>>1}var yx=function(e,t,n){for(var r=e.length,a=0,i=new ei(t);r>a;++a)++i[e[a]-1];var o,l=new ei(t);for(a=0;t>a;++a)l[a]=l[a-1]+i[a-1]<<1;for(o=new ei(r),a=0;r>a;++a)o[a]=rV[l[e[a]-1]++]>>>15-e[a];return o},wh=new Ji(288);for(Ln=0;144>Ln;++Ln)wh[Ln]=8;for(Ln=144;256>Ln;++Ln)wh[Ln]=9;for(Ln=256;280>Ln;++Ln)wh[Ln]=7;for(Ln=280;288>Ln;++Ln)wh[Ln]=8;var fw=new Ji(32);for(Ln=0;32>Ln;++Ln)fw[Ln]=5;var Rde=yx(wh,9),Ide=yx(fw,5),aV=function(e){return(e/8>>0)+(7&e&&1)},iV=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof ei?ei:e instanceof Vm?Vm:Ji)(n-t);return r.set(e.subarray(t,n)),r},El=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},mg=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},V2=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var a=n.length,i=n.slice();if(!a)return[new Ji(0),0];if(a==1){var o=new Ji(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(E,S){return E.f-S.f})),n.push({s:-1,f:25001});var l=n[0],c=n[1],u=0,d=1,h=2;for(n[0]={s:-1,f:l.f+c.f,l,r:c};d!=a-1;)l=n[n[h].f>n[u].f?u++:h++],c=n[u!=d&&n[h].f>n[u].f?u++:h++],n[d++]={s:-1,f:l.f+c.f,l,r:c};var p=i[0].s;for(r=1;a>r;++r)i[r].s>p&&(p=i[r].s);var m=new ei(p+1),g=uT(n[d-1],m,0);if(g>t){r=0;var x=0,b=g-t,y=1<<b;for(i.sort((function(E,S){return m[S.s]-m[E.s]||E.f-S.f}));a>r;++r){var v=i[r].s;if(t>=m[v])break;x+=y-(1<<g-m[v]),m[v]=t}for(x>>>=b;x>0;){var w=i[r].s;t>m[w]?x-=1<<t-m[w]++-1:++r}for(;r>=0&&x;--r){var j=i[r].s;m[j]==t&&(--m[j],++x)}g=t}return[new Ji(m),g]},uT=function(e,t,n){return e.s==-1?Math.max(uT(e.l,t,n+1),uT(e.r,t,n+1)):t[e.s]=n},wO=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ei(++t),r=0,a=e[0],i=1,o=function(c){n[r++]=c},l=1;t>=l;++l)if(e[l]==a&&l!=t)++i;else{if(!a&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(a),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(a);i=1,a=e[l]}return[n.subarray(0,r),t]},fg=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n}
4,dT=function(e,t,n){var r=n.length,a=aV(t+2);e[a]=255&r,e[a+1]=r>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var i=0;r>i;++i)e[a+i+4]=n[i];return 8*(a+4+r)},jO=function(e,t,n,r,a,i,o,l,c,u,d){El(t,d++,n),++a[256];for(var h=V2(a,15),p=h[0],m=h[1],g=V2(i,15),x=g[0],b=g[1],y=wO(p),v=y[0],w=y[1],j=wO(x),E=j[0],S=j[1],_=new ei(19),k=0;v.length>k;++k)_[31&v[k]]++;for(k=0;E.length>k;++k)_[31&E[k]]++;for(var C=V2(_,7),N=C[0],A=C[1],T=19;T>4&&!N[yO[T-1]];--T);var I,$,O,U,F=u+5<<3,H=fg(a,wh)+fg(i,fw)+o,G=fg(a,p)+fg(i,x)+o+14+3*T+fg(_,N)+(2*_[16]+3*_[17]+7*_[18]);if(H>=F&&G>=F)return dT(t,d,e.subarray(c,c+u));if(El(t,d,1+(H>G)),d+=2,H>G){I=yx(p,m),$=p,O=yx(x,b),U=x;var M=yx(N,A);for(El(t,d,w-257),El(t,d+5,S-1),El(t,d+10,T-4),d+=14,k=0;T>k;++k)El(t,d+3*k,N[yO[k]]);d+=3*T;for(var z=[v,E],W=0;2>W;++W){var D=z[W];for(k=0;D.length>k;++k)El(t,d,M[Z=31&D[k]]),d+=N[Z],Z>15&&(El(t,d,D[k]>>>5&127),d+=D[k]>>>12)}}else I=Rde,$=wh,O=Ide,U=fw;for(k=0;l>k;++k)if(r[k]>255){var Z;mg(t,d,I[257+(Z=r[k]>>>18&31)]),d+=$[Z+257],Z>7&&(El(t,d,r[k]>>>23&31),d+=i4[Z]);var V=31&r[k];mg(t,d,O[V]),d+=U[V],V>3&&(mg(t,d,r[k]>>>5&8191),d+=o4[V])}else mg(t,d,I[r[k]]),d+=$[r[k]];return mg(t,d,I[256]),d+$[256]},Pde=new Vm([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Lde=(function(){for(var e=new Vm(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),G2=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Ode(e,t){t===void 0&&(t={});var n=(function(){var h=4294967295;return{p(p){for(var m=h,g=0;p.length>g;++g)m=Lde[255&m^p[g]]^m>>>8;h=m},d(){return 4294967295^h}}})(),r=e.length;n.p(e);var a,i,o,l,c,u=(l=10+((a=t).filename&&a.filename.length+1||0),c=8,(function(h,p,m,g,x,b){var y=h.length,v=new Ji(g+y+5*(1+Math.floor(y/7e3))+x),w=v.subarray(g,v.length-x),j=0;if(!p||8>y)for(var E=0;y>=E;E+=65535){var S=E+65535;y>S?j=dT(w,j,h.subarray(E,S)):(w[E]=!0,j=dT(w,j,h.subarray(E,y)))}else{for(var _=Pde[p-1],k=_>>>13,C=8191&_,N=(1<<m)-1,A=new ei(32768),T=new ei(N+1),I=Math.ceil(m/3),$=2*I,O=function(Oe){return(h[Oe]^h[Oe+1]<<I^h[Oe+2]<<$)&N},U=new Vm(25e3),F=new ei(288),H=new ei(32),G=0,M=0,z=(E=0,0),W=0,D=0;y>E;++E){var Z=O(E),V=32767&E,L=T[Z];if(A[V]=L,T[Z]=V,E>=W){var K=y-E;if((G>7e3||z>24576)&&K>423){j=jO(h,w,0,U,F,H,M,z,D,E-D,j),z=G=M=0,D=E;for(var te=0;286>te;++te)F[te]=0;for(te=0;30>te;++te)H[te]=0}var Q=2,Y=0,J=C,P=V-L&32767;if(K>2&&Z==O(E-P))for(var ee=Math.min(k,K)-1,X=Math.min(32767,E),ae=Math.min(258,K);X>=P&&--J&&V!=L;){if(h[E+Q]==h[E+Q-P]){for(var me=0;ae>me&&h[E+me]==h[E+me-P];++me);if(me>Q){if(Q=me,Y=P,me>ee)break;var q=Math.min(P,me-2),he=0;for(te=0;q>te;++te){var se=E-P+te+32768&32767,le=se-A[se]+32768&32767;le>he&&(he=le,L=se)}}}P+=(V=L)-(L=A[V])+32768&32767}if(Y){U[z++]=268435456|cT[Q]<<18|vO[Y];var ke=31&cT[Q],oe=31&vO[Y];M+=i4[ke]+o4[oe],++F[257+ke],++H[oe],W=E+Q,++G}else U[z++]=h[E],++F[h[E]]}}j=jO(h,w,!0,U,F,H,M,z,D,E-D,j)}return iV(v,0,g+aV(j)+x)})(i=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+o.mem,l,c)),d=u.length;return(function(h,p){var m=p.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>p.level?4:p.level==9?2:0,h[9]=3,p.mtime!=0&&G2(h,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),m){h[3]=8;for(var g=0;m.length>=g;++g)h[g+10]=m.charCodeAt(g)}})(u,t),G2(u,d-8,n.d()),G2(u,d-4,r),u}var Mde=!!SC||!!H5,oV="text/plain",Zv=!1,lV=(e,t)=>{var n=e.split("#"),r=n[1],a=n[0].split("?"),i=a[0],o=a[1];if(!o)return e;var l=o.split("&").filter((c=>c.split("=")[0]!==t)).join("&");return i+(l?"?"+l:"")+(r?"#"+r:"")},c0=function(e,t,n){var r;n===void 0&&(n=!0);var a=e.split("?"),i=a[0],o=a[1],l=ze({},t),c=(r=o?.split("&").map((d=>{var h,p=d.split("="),m=p[0],g=n&&(h=l[m])!==null&&h!==void 0?h:p[1];return delete l[m],m+"="+g})))!==null&&r!==void 0?r:[],u=(function(d,h){var p,m;h===void 0&&(h="&");var g=[];return Vs(d,(function(x,b){Be(x)||Be(b)||b==="undefined"||(p=encodeURIComponent((y=>y instanceof File)(x)?x.name:x.toString()),m=encodeURIComponent(b),g[g.length]=m+"="+p)})),g.join(h)})(l);return u&&c.push(u),c.length>0?i+"?"+c.join("&"):i},Y2=e=>{if(e.ga)return e.ga;var t=e.data,n=e.compression;if(t){if(n===pi.GZipJS){var r=Ode((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var d=new Ji(l.length+(l.length>>>1)),h=0,p=function(b){d[h++]=b},m=0;u>m;++m){if(h+5>d.length){var g=new Ji(h+8+(u-m<<1));g.set(d),d=g}var x=l.charCodeAt(m);128>x?p(x):2048>x?(p(192|x>>>6),p(128|63&x)):x>55295&&57344>x?(p(240|(x=65536+(1047552&x)|1023&l.charCodeAt(++m))>>>18),p(128|x>>>12&63),p(128|x>>>6&63),p(128|63&x)):(p(224|x>>>12),p(128|x>>>6&63),p(128|63&x))}return iV(d,0,h)})(hm(t)),{mtime:0});return{contentType:oV,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===pi.Base64){var a=(function(l){return l&&btoa(encodeURIComponent(l).replace(/%([0-9A-F]{2})/g,((c,u)=>String.fromCharCode(parseInt(u,16)))))})(hm(t)),i=(l=>"data="+encodeURIComponent(typeof l=="string"?l:hm(l)))(a);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}var o=hm(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},cV=e=>{var t,n,r=()=>e.transport==="sendBeacon"?{url:c0(e.url,{compression:pi.Base64}),encodedBody:Y2(ze({},e,{compression:pi.Base64,ga:void 0}))}:{url:lV(e.url,"compression"),encodedBody:Y2(ze({},e,{compression:void 0,ga:void 0}))};try{t=Y2(e)}catch(a){if(q6(e.compression,qm(e.url,"compression")))return lt.error("Failed to gzip request body, sending uncompressed payload",a),r();throw a}return t&&q6(e.compression,qm(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?MC(new Uint8Array(n)):ArrayBuffer.isView(n)&&MC(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Zv=!0,r()):{url:e.url,encodedBody:t}},uV=e=>{try{return cV(e)}catch(t){return lt.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},Dde=(function(){var e=un((function*(t){var n=hm(t.data),r=yield(function(i,o,l){return DC.apply(this,arguments)})(n,ln.DEBUG,{rethrow:!0});if(!r)return t;var a=yield r.arrayBuffer();return ze({},t,{ga:{contentType:oV,body:a,estimatedSize:a.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),$de=/Failed to fetch|NetworkError|Load failed/i,dV=e=>e?.name==="TypeError"&&$de.test(e?.message||""),hV=e=>{var t=uV(e);if(t){var n=t.url,r=t.encodedBody,a=r??{},i=a.contentType,o=a.body,l=a.estimatedSize,c=new Headers;Vs(e.headers,(function(g,x){c.append(x,g)})),i&&c.append("Content-Type",i);var u=null,d=!1;if(R6){var h=new R6;u={signal:h.signal,timeout:setTimeout((()=>{var g;d=!0,h.abort(cW("AbortError","PostHog request timed out"+((g=e.timeout)?" after "+g+"ms":"")))}),e.timeout)}}var p=g=>{d&&g?.name==="AbortError"||dV(g)?lt.warn(g):lt.error(g),e.callback==null||e.callback({statusCode:0,error:g})};try{var m;H5(n,ze({method:e?.method||"GET",headers:c,keepalive:e.method==="POST"&&!e.ma&&52428.8>(l||0),body:o,signal:(m=u)==null?void 0:m.signal},e.fetchOptions)).then((g=>g.text().then((x=>{var b={statusCode:g.status,text:x};if(g.status===200)try{b.json=JSON.parse(x)}catch(y){lt.error(y)}e.callback==null||e.callback(b)})))).catch(p).finally((()=>u?clearTimeout(u.timeout):null))}catch(g){u&&clearTimeout(u.timeout),p(g)}}},hT=e=>{try{var t,n=cV(e),r=n.url,a=n.encodedBody,i=a??{},o=i.body,l=i.estimatedSize;if(!o)return;var c=o instanceof Blob?o:new Blob([o],{type:i.contentType});if(Cr.sendBeacon(r,c))return;var u=Xt(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(Xt(u)&&u.length>1&&(l??0)>16384){var d=Math.ceil(u.length/2),h=p=>Xt(e.data)?p:ze({},e.data,{batch:p});return hT(ze({},e,{data:h(u.slice(0,d))})),void hT(ze({},e,{data:h(u.slice(d))}))}lt.warn("Beacon of ~"+(l??0)+" bytes was rejected by the browser, falling back to fetch"),hV(ze({},e,{ma:!0}))}catch(p){lt.warn("Beacon send failed",p)}},_O=(e,t,n,r)=>{var a=r==="query"?t==="POST"?"sent_at":"_":void 0;
4return c0(n===pi.GZipJS?lV(e,"compression"):e,ze({},a?{[a]:Date.now().toString()}:{},n===pi.GZipJS?{}:{compression:n}))},e1=[];H5&&e1.push({transport:"fetch",method:hV}),SC&&e1.push({transport:"XHR",method(e){var t=uV(e);if(t){var n=new SC,r=t.encodedBody;n.open(e.method||"GET",t.url,!0);var a=r??{},i=a.contentType,o=a.body;Vs(e.headers,(function(l,c){n.setRequestHeader(c,l)})),i&&n.setRequestHeader("Content-Type",i),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var l={statusCode:n.status,text:n.responseText};if(n.status===200)try{l.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(l)}},n.send(o)}}}),Cr!=null&&Cr.sendBeacon&&e1.push({transport:"sendBeacon",method:hT});var pT=3e3;class Fde{constructor(t,n){this.ya=!0,this.ba=[],this._a=Zo(n?.flush_interval_ms||pT,250,5e3,lt.createLogger("flush interval"),pT),this.wa=t}enqueue(t){this.ba.push(t),this.ka||this.Sa()}unload(){this.xa();var t=this.ba.length>0?this.Ca():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.Ta(ze({},r,{transport:"sendBeacon"}))}))}enable(){this.ya=!1,this.Sa()}Sa(){var t=this;this.ya||(this.ka=setTimeout((()=>{if(this.xa(),this.ba.length>0){var n=this.Ca(),r=function(){var i=n[a],o=new Date().getTime();i.data&&Xt(i.data)&&Vs(i.data,(l=>{l.offset=Math.abs(l.timestamp-o),delete l.timestamp})),t.Ta(i)};for(var a in n)r()}}),this._a))}Ta(t){try{this.wa(t)}catch(n){lt.error(n)}}xa(){clearTimeout(this.ka),this.ka=void 0}Ca(){var t={};return Vs(this.ba,(n=>{var r,a=n,i=(a?a.batchKey:null)||a.url;Be(t[i])&&(t[i]=ze({},a,{data:[]})),(r=t[i].data)==null||r.push(a.data)})),this.ba=[],t}}var Bde=["retriesPerformedSoFar"];class Ude{constructor(t){this.Ma=!1,this.Ia=3e3,this.ba=[],this._instance=t,this.ba=[],this.Ea=!0,!Be(Ae)&&"onLine"in Ae.navigator&&(this.Ea=Ae.
4navigator.onLine,this.Ra=()=>{this.Ea=!0,this.Pa()},this.Aa=()=>{this.Ea=!1},nn(Ae,"online",this.Ra),nn(Ae,"offline",this.Aa))}get length(){return this.ba.length}retriableRequest(t){var n=t.retriesPerformedSoFar,r=Oq(t,Bde);Ol(n)&&(r.url=c0(r.url,{retry_count:n})),this._instance._send_request(ze({},r,{callback:a=>{if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.os(ze({retriesPerformedSoFar:n},r));a.statusCode===0&<.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}r.callback==null||r.callback(a)}}))}os(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(o){var l=3e3*Math.pow(2,o),c=l/2,u=Math.min(18e5,l),d=Math.random()-.5;return Math.ceil(u+d*(u-c))})(n),a=Date.now()+r;this.ba.push({retryAt:a,requestOptions:t});var i="Enqueued failed request for retry in "+r;navigator.onLine||(i+=" (Browser is offline)"),lt.warn(i),this.Ma||(this.Ma=!0,this.Fa())}Fa(){if(this.Oa&&clearTimeout(this.Oa),this.ba.length===0)return this.Ma=!1,void(this.Oa=void 0);this.Oa=setTimeout((()=>{this.Ea&&this.ba.length>0&&this.Pa(),this.Fa()}),this.Ia)}Pa(){var t=Date.now(),n=[],r=this.ba.filter((i=>t>i.retryAt||(n.push(i),!1)));if(this.ba=n,r.length>0)for(var a of r)this.retriableRequest(a.requestOptions)}unload(){for(var t of(this.Oa&&(clearTimeout(this.Oa),this.Oa=void 0),this.Ma=!1,Be(Ae)||(this.Ra&&(Ae.removeEventListener("online",this.Ra),this.Ra=void 0),this.Aa&&(Ae.removeEventListener("offline",this.Aa),this.Aa=void 0)),this.ba)){var n=t.requestOptions;try{this._instance._send_request(ze({},n,{transport:"sendBeacon"}))}catch(r){lt.error(r)}}this.ba=[]}}class zde{constructor(t){this.La=()=>{var n,r,a,i;this.Da||(this.Da={});var o=this.scrollElement(),l=this.scrollY(),c=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=l+(o?.clientHeight||0),d=o?.scrollHeight||0;this.Da.lastScrollY=Math.ceil(l),this.Da.maxScrollY=Math.max(l,(n=this.Da.maxScrollY)!==null&&n!==void 0?n:0),this.Da.maxScrollHeight=Math.max(c,(r=this.Da.maxScrollHeight)!==null&&r!==void 0?r:0),this.Da.lastContentY=u,this.Da.maxContentY=Math.max(u,(a=this.Da.maxContentY)!==null&&a!==void 0?a:0),this.Da.maxContentHeight=Math.max(d,(i=this.Da.maxContentHeight)!==null&&i!==void 0?i:0)},this._instance=t}get $a(){return this._instance.config.scroll_root_selector}getContext(){return this.Da}resetContext(){var t=this.Da;return setTimeout(this.La,0),t}startMeasuringScrollPosition(){nn(Ae,"scroll",this.La,{capture:!0}),nn(Ae,"scrollend",this.La,{capture:!0}),nn(Ae,"resize",this.La)}scrollElement(){var t;if(!this.$a)return Ae==null||(t=Ae.document)==null?void 0:t.documentElement;var n=Xt(this.$a)?this.$a:[this.$a];for(var r of n){var a,i=Ae==null||(a=Ae.document)==null?void 0:a.querySelector(r);if(i)return i}}Na(t){var n,r,a=t==="y"?"scrollTop":"scrollLeft";if(this.$a){var i=this.scrollElement();return i&&i[a]||0}return Ae?t==="y"?Ae.scrollY||Ae.pageYOffset||((n=Ae.document)==null||(n=n.documentElement)==null?void 0:n.scrollTop)||0:Ae.scrollX||Ae.pageXOffset||((r=Ae.document)==null||(r=r.documentElement)==null?void 0:r.scrollLeft)||0:0}scrollY(){return this.Na("y")}scrollX(){return this.Na("x")}}var Hde=e=>QW(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes);class kO{constructor(t,n,r,a){this.Te=i=>{var o=this.qa();if(!o||o.sessionId!==i){var l={sessionId:i,props:this.ja(this._instance)};this.Ba.register({[YC]:l})}},this._instance=t,this.Ha=n,this.Ba=r,this.ja=a||Hde,this.Ha.onSessionId(this.Te)}qa(){return this.Ba.props[YC]}getSetOnceProps(){var t,n=(t=this.qa())==null?void 0:t.props;return n?"r"in n?ZW(n,this._instance.config.disable_capture_url_hashes):{$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 Vs(s4(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+CC(r)]=n})),t}}class gw{on(t,n){return this.za[t]||(this.za[t]=[]),this.za[t].push(n),()=>{this.za[t]=this.za[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.za[t]||[])r(n);for(var a of this.za["*"]||[])a(t,n)}constructor(){this.za={}}}var yp=Sn("[SessionId]"),NO=864e5;class EO{on(t,n){return this.Ua.on(t,n)}constructor(t,n,r){var a;if(this.Wa=null,this.Va=null,this.Ga=[],this.Za=void 0,this.Qa=!1,this.Ua=new gw,this.Ja=(c,u)=>!(!Ol(c)||!Ol(u))&&Math.abs(c-u)>
4this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Yl)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.mn=t.config,this.Ba=t.persistence,this.Ie=void 0,this.Bt=void 0,this._sessionStartTimestamp=null,this.Ka=void 0,this._sessionActivityTimestamp=null,this.Ya=n||po,this.Xa=r||po;var i=this.mn.persistence_name||this.mn.token;if(this._sessionTimeoutMs=1e3*Zo(this.mn.session_idle_timeout_seconds||1800,60,36e3,yp.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.tl(),this.el="ph_"+i+"_window_id",this.il="ph_"+i+"_primary_window_exists",this.rl()){var o=sn.ui(this.el),l=sn.ui(this.il);o&&!l?this.Ie=o:sn.oi(this.el),sn.ni(this.il,!0)}(a=this.mn.bootstrap)!=null&&a.sessionID&&this.setBootstrapSessionId(this.mn.bootstrap.sessionID),this.nl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Be(this.Ga)&&(this.Ga=[]),this.Ga.push(t),this.Bt&&t(this.Bt,this.Ie),()=>{this.Ga=this.Ga.filter((n=>n!==t))}}rl(){return this.mn.persistence!=="memory"&&!this.Ba.Eo&&sn.ii()}sl(t){t!==this.Ie&&(this.Ie=t,this.rl()&&sn.ni(this.el,t))}ol(){return this.Ie?this.Ie:this.rl()?sn.ui(this.el):null}al(t){var n=this.Wa;return!Hn(n)&&!Hn(t)&&5e3>Math.abs(t-n)}ll(t,n,r){var a=n!==this._sessionActivityTimestamp,i=!(t!==this.Bt||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Bt=t,i&&!a||i&&this.al(n)||(this.Wa=n,this.Ba.register({[cm]:[n,t,r]}))}ul(){var t,n=(t=this.mn)==null?void 0:t.persistence_save_debounce_ms;return Ol(n)&&n>0}hl(){this.ul()?this.Ba.refreshKey(cm):(this.Ba.flush(),this.Ba.load())}dl(){var t;if(!Hn(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Wa){this.hl();var n=this.vl();n[1]===this.Bt&&n[2]===this._sessionStartTimestamp&&(this.Wa=this._sessionActivityTimestamp,this.Ba.register({[cm]:[this._sessionActivityTimestamp,(t=this.Bt)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.Ba.flush())}}cl(){var t=this.vl()[0],n=Ol(t)?t:0,r=Ol(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}fl(t){return this.hl(),this.Ja(t,this.cl())}vl(){var t=this.Ba.props[cm];return Xt(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Wa=null,this.Ka=void 0,clearTimeout(this.pl),this.pl=void 0,this.ll(null,null,null)}setBootstrapSessionId(t,n){n===void 0&&(n=!1);var r=(function(a,i){i===void 0&&(i=new Date().getTime());try{var o=(l=>{var c=l.replace(/-/g,"");if(c.length!==32)throw new Error("Not a valid UUID");if(c[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(c.substring(0,12),16)})(a);return o>i+6e4?void yp.error("Bootstrap sessionID cannot be in the future"):o}catch(l){return void yp.error("Invalid sessionID in bootstrap",l)}})(t);return!Be(r)&&(n?this.Ka={sessionId:t,sessionStartTimestamp:r}:this.ll(t,new Date().getTime(),r),!0)}destroy(){this.Qa=!0,this.dl(),clearTimeout(this.pl),this.pl=void 0,this.Za&&Ae&&(Ae.removeEventListener(uw,this.Za,{capture:!1}),this.Za=void 0),this.Ga=[]}nl(){this.Za=()=>{this.dl(),this.rl()&&sn.oi(this.il)},nn(Ae,uw,this.Za,{capture:!1})}checkAndGetSessionAndWindowId(t,n,r){if(t===void 0&&(t=!1),n===void 0&&(n=null),r===void 0&&(r=!1),this.mn.cookieless_mode===Yl)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var a=n||new Date().getTime(),i=this.Bt;if(r)this.Va=a;else if(Hn(this.Va)||this.Va>a||a-this.Va>=1e3){var o,l;(o=(l=this.Ba).syncCookieProperties)==null||o.call(l),this.Va=a}var c=this.vl(),u=c[1],d=c[2],h=!Be(i)&&u!==i,p=this.cl(),m=this.ol(),g=this.Ka,x=!!g&&(g.sessionStartTimestamp>a+6e4||a-g.sessionStartTimestamp>NO),b=g?x:Ol(d)&&Math.abs(a-d)>NO,y=!1,v=h,w=!u||!!g,j=u,E=!w&&!t&&this.Ja(a,p);if(E){(E=this.fl(a))||yp.info("cross-tab refresh kept the session alive",{sessionId:u});var S=this.vl();u=S[1],d=S[2]}if(w||E||b){v=!1;var _=g&&!x;u=_?g.sessionId:this.Ya(),m=this.Xa(),yp.info("new session ID assigned",{sessionId:u,windowId:m,bootstrapped:!!_,changeReason:{noSessionId:w,activityTimeout:E,sessionPastMaximumLength:b}}),d=_?g.sessionStartTimestamp:a,this.Ka=void 0,y=!0}else m||(m=this.Xa(),y=!0),(v=v||u!==j)&&(yp.info("adopted cross-tab session id",{sessionId:u,windowId:m}),y=!0);var k=Ol(p)&&t&&!b?p:a,C=Ol(d)?d:new Date().getTime();this.sl(m),this.ll(u,k,C),t||this.tl();var N={noSessionId:w,activityTimeout:E,sessionPastMaximumLength:b,crossTabAdoption:v};return y&&this.Ga.forEach((A=>A(u,m,N))),{sessionId:u,windowId:m,sessionStartTimestamp:C,changeReason:y?N:void 0,lastActivityTimestamp:p}}tl(){this.Qa||(clearTimeout(this.pl),this.pl=setTimeout((()=>
4{if(!this.Qa)if(this.fl(new Date().getTime())){var t=this.Bt;this.resetSessionId(),this.Ua.emit("forcedIdleReset",{idleSessionId:t})}else this.tl()}),1.1*this.sessionTimeoutMs))}}var pV=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&P6(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((a=>P6(a?.brand,t))))return!0}catch{}return!!e.webdriver};function mV(){return(mV=un((function*(){var e=Cr?.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t?.model;return ks(n)&&n.length>0?n:void 0}catch(r){return void lt.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}function fV(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var xw=(e,t)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},gy=e=>e.toLowerCase(),gV={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=>xw(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!xw(n,r))))),icontains:(e,t)=>t.map(gy).some((n=>e.map(gy).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(gy).every((n=>e.map(gy).every((r=>!n.includes(r))))),gt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((a=>r>parseFloat(a)))})),lt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((a=>r<parseFloat(a)))}))};function xV(e,t){return!e||Object.entries(e).every((n=>{var r=n[1],a=t?.[n[0]];if(a==null)return!1;var i=gV[r.operator];return!!i&&i(r.values,[String(a)])}))}function K2(e,t,n){return hm({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var mT="custom",SO="i.posthog.com",qde=/^\/static\//,Wde=["/s/","/e/","/i/"];class Vde{constructor(t){this.gl={},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("."+SO,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.gl[this.apiHost]||(this.gl[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":mT),this.gl[this.apiHost]}ml(t){if(qde.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}yl(t){var n=Hm(t);return n?n.protocol+"//"+n.host+n.pathname:void 0}bl(t,n,r){if(t==="ui")return r;var a=r,i=this.instance.config.rewriteRequestPath;if(i){var o,l=((o=Hm(r))==null?void 0:o.href)||r;a=i(new URL(l)).toString()}if(i&&t==="api"&&Wde.some((p=>n.indexOf(p)===0))){var c=this.yl(a);if(c){var u,d=this.apiHost,h=this._l;((u=h)==null?void 0:u.apiHost)===d&&h.rewriteRequestPath===i||(h={apiHost:d,rewriteRequestPath:i,urls:new Set},this._l=h),h.urls.add(c)}}return a}isIngestionEndpoint(t){var n=this._l,r=this.yl(t);return n?.apiHost===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&n.urls.has(r)}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.bl(t,n,this.uiHost+n);if(t==="flags")return this.bl(t,n,this.flagsApiHost+n);if(t==="assets"){var r=this.ml(n);if(r)return this.bl(t,n,""+r+n)}if(this.region===mT)return this.bl(t,n,this.apiHost+n);var a=SO+n;switch(t){case"assets":return this.bl(t,n,"https://"+this.region+"-assets."+a);case"api":return this.bl(t,n,"https://"+this.region+"."+a)}}}var Ws=Sn("[Surveys]"),bV="seenSurvey_",yV=e=>{try{var t=(n=>((r,a)=>""+bV+(function(i){return i.current_iteration&&i.current_iteration>0?i.id+"_"+i.current_iteration:i.id})(a))(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){Ws.error("Failed to persist survey seen state",n)}},Gde=[q2.Popover,q2.Widget,q2.API],Yde={ignoreConditions:!1,ignoreDelay:!1,displayType:lT.Po
4pover},Kde=Sn("[PostHog ExternalIntegrations]"),Xde={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Jde{constructor(t){this._instance=t}Ys(t,n){var r;(r=Bt.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(a=>{if(a)return Kde.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var i,o,l,c=r[0],u=r[1];!u||(i=Bt.__PosthogExtensions__)!=null&&(i=i.integrations)!=null&&i[c]||t.Ys(Xde[c],(()=>{var d;(d=Bt.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[c])==null||d.start(t._instance)})),!u&&(o=Bt.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[c]&&((l=Bt.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[c])==null||l.stop())};for(var r of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;n()}}}class Qde{constructor(t,n){this.A=t,this.Ns=n,this.wl=new Map,this.Os=!1}add(t){var n=this;return un((function*(){if(n.Os)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.wl.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.wl.set(t.name,t);try{var r=t.setup(n.Ns);r&&(yield r)}catch(i){var a=n.wl.get(t.name)===t;a&&n.wl.delete(t.name),n.A.error('Failed to set up browser extension "'+t.name+'"',i),a&&n.kl(t)}}))()}getExtension(t){return this.wl.get(t)}dispose(){if(!this.Os){this.Os=!0;var t=Array.from(this.wl.values()).reverse();for(var n of(this.wl.clear(),t))this.kl(n)}}kl(t){try{var n=t.dispose==null?void 0:t.dispose();n&&ha(n.then)&&n.then(void 0,(r=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',r)}))}catch(r){this.A.error('Failed to dispose browser extension "'+t.name+'"',r)}}}class Zde{constructor(t){this._instance=t}initialize(){}get(t){var n=this._instance.persistence;if(typeof t=="string")return n?.get_property(t);var r={};for(var a of t){var i=n?.get_property(a);Be(i)||(r[a]=i)}return r}set(t,n){var r;(r=this._instance.persistence)==null||r.register(typeof t=="string"?{[t]:n}:t)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var CO="extensionsRemoteConfig";class ehe{constructor(t){this.Os=!1,this.instance=t,this.A=lt,this.Sl=t.xl,this.kv=new Zde(t),this.onEvent=n=>fy(this.instance.on("eventCaptured",(r=>{try{n({event:r.event,properties:r.properties})}catch(a){this.A.error("Browser extension event listener failed",a)}}))),this.onRemoteConfig=n=>{if(this.Os)return fy((()=>{}));var r=i=>{try{n(i)}catch(o){this.A.error("Browser extension remote config listener failed",o)}},a=this.instance.Cl.on(CO,r);return this.Sl&&r(this.Sl),fy(a)},this.Tl=new Qde(lt.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property(ib))!==null&&t!==void 0?t:this.distinctId}get deviceId(){var t=this.instance.get_property(ib);return typeof t=="string"?t:void 0}get library(){return{name:ln.LIB_NAME,version:ln.LIB_VERSION}}get initialPersonProperties(){var t,n;return(t=(n=this.instance.persistence)==null?void 0:n.get_initial_props())!==null&&t!==void 0?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,n,r,a,i=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=i?.sessionId)!==null&&n!==void 0?n:"",windowId:(r=i?.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(a=i?.sessionStartTimestamp)!==null&&a!==void 0?a:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Tl.add(t)}getExtension(t){return this.Tl.getExtension(t)}capture(t,n,r){var a=this;return un((function*(){r?a.instance.capture(t,n,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):a.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return fy(this.instance.Ml(t))}handleRemoteConfig(t){this.Os||(this.Sl=t,this.instance.Cl.emit(CO,t))}sendRequest(t,n){var r=this;return un((function*(){var a;n===void 0&&(n={});var i=r.instance.requestRouter.endpointFor((a=n.target)!==null&&a!==void 0?a:"api",t),o={method:n.method,url:n.query?c0(i,n.query):i,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:n.target==="flags"&&n.compression==="best-available"?TC.Base64:void 0,timestampMode:n.sentAt};return n.transport==="sendBeacon"?(r.instance._send_request(o),{statusCode:202}):new Promise((l=>{o.callback=l,r.instance._send_request(o)}))}))()}dispose(){this.Os||(this.Os=!0,this.Tl.dispose())}}var vx={},X2=0,wx=()=>{}
4,TO='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',gg="Surveys module not available",AO="sanitize_properties is deprecated. Use before_send instead",vV="Invalid value for property_denylist config: ",the=/^[A-Za-z0-9_-]{1,400}$/,J2=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,she=["token","distinct_id",SW],Yp="posthog",wV=!Mde&&Qa?.indexOf("MSIE")===-1&&Qa?.indexOf("Mozilla")===-1,nhe=e=>{var t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},Q2=e=>{var t;return ze({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:tde(Ke?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:wx,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,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:In&&ks(In?.search)&&In.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_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(Ae==null||(t=Ae.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_feature_flags_dedup_per_session:!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){lt.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ZC,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:pT},error_tracking:{},_onCapture:wx},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:pde,ignore_text_selection:!0}
4:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:nhe(n),external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(e))},rhe=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],RO=e=>{var t={};for(var n of rhe){var r=n[0],a=n[1];Be(e[r])||(t[a]=e[r])}var i=cn({},t,e),o=e.__preview_external_dependency_versioned_paths;return Be(o)||(Be(e.strict_script_versioning)&&(i.strict_script_versioning=!!o),ks(o)&&Be(e.asset_host)&&(i.asset_host=o)),Xt(e.property_blacklist)&&(Be(e.property_denylist)?i.property_denylist=e.property_blacklist:Xt(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:lt.error(vV+e.property_denylist)),i};class ahe{constructor(){this.__forceAllowLocalhost=!1}get Il(){return this.__forceAllowLocalhost}set Il(t){lt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class mi{El(t){if(t){var n=this.wl.indexOf(t);n!==-1&&this.wl.splice(n,1)}}Rl(t,n){return this.El(t),this.wl.push(n),n.initialize==null||n.initialize(),n}Pl(){return this.config.cookieless_mode===Yl||this.config.cookieless_mode===Bc&&this.consent.isRejected()}Al(){if(!(this.Fl||this.config.reuseAnonymousId||this.config.segment||this.Pl())){var t,n,r,a=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";(a||this.config.disable_persistence)&&(this.Ol||(a?(t="persistence is set to '"+this.config.persistence+"'",n=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",r="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",n="on every page load",r="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.Fl=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+n+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+r)))}}Ll(){if(!this.Pl()&&this.get_distinct_id()===mp){var t=this.persistence;if(t){this.Dl()||t.load(!0);var n=this.get_distinct_id();if(!n||n===mp){var r=this.config.get_device_id(po());this.register({distinct_id:r,$device_id:r}),t.set_property(bs,Kn)}this.$l()}}}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(){var t;this.webPerformance=new ahe,this.Nl=!1,this.version=ln.LIB_VERSION,this.ql=new Set,this.jl="",this.Cl=new gw,this.wl=[],this.Bl=[],this.Ol=!1,this.Fl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Q2(),this.SentryIntegration=wde,this.sentryIntegration=r=>(function(a,i){var o=WW(a,i);return{name:qW,processEvent:l=>o(l)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Hl=!1,this.zl=null,this.Ul=null,this.Wl=null,this.scrollManager=new zde(this),this.pageViewManager=new mO(this),this.rateLimiter=new Ade(this),this.requestRouter=new Vde(this),this.consent=new lde(this),this.externalIntegrations=new Jde(this);var n=(t=mi.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,a,i)=>{var o=ks(r)?{[r]:a}:r;this.setPersonProperties(o),i?.({})},set_once:(r,a,i)=>{var o=ks(r)?{[r]:a}:r;this.setPersonProperties(void 0,o),i?.({})}},this.on("eventCaptured",(r=>lt.info('send "'+r?.event+'"',r)))}init(t,n,r){if(r&&r!==Yp){var a,i=(a=vx[r])!==null&&a!==void 0?a:new mi;return i._init(t,n,r),vx[r]=i,vx[Yp][r]=i,i}return this._init(t,n,r)}_init(t,n,r){var a,i,o;n===void 0&&(n={});var l,c=ks(t)?t.trim():"";if(!c)return lt.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 c!==((l=this.config)==null?void 0:l.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+c+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Q2(n.defaults),n.debug=this.Vl(n.debug),this.Gl=n,this.Zl=[],n.person_profiles?this.Ul=n.person_profiles:n.process_person&&(this.Ul=n.process_person);var u=Q2(n.defaults),d=RO(n),h=cn({},u,d,{name:r,token:c});ys(u.rageclick)&&ys(d.rageclick)&&(h.rageclick=cn({},u.rageclick,d.rageclick)),ys(u.session_recording)&&ys(d.session_recording)&&(h.session_recording=cn({},u.session_recording,d.session_recording)),this.set_config(h),this.config.on_xhr_error&<.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:pi.GZipJS;var p=this.Dl();if(this.persistence=new H2(this.config,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new H2(ze({},this.config,{persistence:"sessionStorage"}),p,!1),this.jl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!p&&sn.ii()){var m=sn.ui(this.jl);Xt(m)&&m.forEach((k=>{ks(k)&&this.ql.add(k)}))}else sn.oi(this.jl);var g=ze({},this.persistence.props),x=ze({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ql=new Fde((k=>this.Jl(k)),this.config.request_queue_config),this.Kl=new Ude(this),this.__request_queue=[];var b=this.Pl();b||(this.sessionManager=new EO(this),this.sessionPropsManager=new kO(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((k,C,N)=>{(N!=null&&N.activityTimeout||N!=null&&N.sessionPastMaximumLength||N!=null&&N.crossTabAdoption)&&this.Yl()}))),this.Xl(),this.config.__preview_deferred_init_extensions?(lt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.tu(b)}),0)):(lt.info("Initializing extensions synchronously"),this.tu(b)),ln.DEBUG=ln.DEBUG||this.config.debug,ln.DEBUG&<.info("Starting in debug mode",{this:this,config:n,thisC:ze({},this.config),p:g,s:x}),!this.config.identity_distinct_id||(a=n.bootstrap)!=null&&a.distinctID||(n.bootstrap=ze({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var y=(i=n.bootstrap)==null?void 0:i.distinctID;if(this.Ol=!!y&&!fx(y),((o=n.bootstrap)==null?void 0:o.distinctID)!==void 0){var v=n.bootstrap.distinctID,w=this.get_distinct_id(),j=this.persistence.get_property(bs);if(n.bootstrap.isIdentifiedID&&w!=null&&w!==v&&j===Kn)this.identify(v);else if(n.bootstrap.isIdentifiedID&&w!=null&&w!==v&&j===Xr)lt.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var E=this.config.get_device_id(po()),S=n.bootstrap.isIdentifiedID?E:v;this.persistence.set_property(bs,n.bootstrap.isIdentifiedID?Xr:Kn),this.register({distinct_id:v,$device_id:S})}}if(b)this.register_once({distinct_id:mp,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(po());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(bs,Kn)}return nn(Ae,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?pO(this,(()=>this.eu())):this.eu(),ha(this.config._onCapture)&&this.config._onCapture!==wx&&(lt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&<.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.config.disableDeviceModel||(function(){return m
4V.apply(this,arguments)})().then((k=>{k&&this.register({[O2]:k})})).catch(wx),this}iu(t){var n=t;return ks(n.name)&&ha(n.setup)}ru(t,n){this.iu(t)?n.push((()=>{this.nu().add(t).catch((()=>t.dispose==null?void 0:t.dispose())).catch((r=>{lt.error('Failed to dispose browser extension "'+t.name+'"',r)}))})):this.wl.push(t)}Xl(){var t,n,r,a,i,o,l=(t=(n=this.config.__extensionClasses)==null?void 0:n.featureFlags)!==null&&t!==void 0?t:(r=mi.__defaultExtensionClasses)==null?void 0:r.featureFlags;l&&(this.featureFlags&&this.featureFlags instanceof l||((a=this.su)==null||a.call(this),this.su=void 0,this.featureFlags=new l(this)),ha(this.featureFlags.onReloading)&&ha(this.featureFlags.setup)?this.su||(this.su=this.featureFlags.onReloading((()=>{this.Cl.emit("featureFlagsReloading",!0)})),this.nu().add(this.featureFlags)):(i=(o=this.featureFlags).initialize)==null||i.call(o))}tu(t){var n,r,a,i,o,l,c,u=performance.now(),d=ze({},mi.__defaultExtensionClasses,this.config.__extensionClasses),h=[];d.exceptions&&this.wl.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new d.exceptions(this)),d.historyAutocapture&&this.wl.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.wl.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.wl.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!t&&this.wl.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this.ru(this.autocapture=new d.autocapture(this),h),d.surveys&&this.ru(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new d.surveys(this),h),d.logs&&this.ru(this.logs=(a=this.logs)!==null&&a!==void 0?a:new d.logs(this),h),d.metrics&&this.wl.push(this.metrics=(i=this.metrics)!==null&&i!==void 0?i:new d.metrics(this)),d.conversations&&this.wl.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new d.conversations(this)),d.productTours&&this.wl.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.wl.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.wl.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.wl.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.wl.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,vde)),d.toolbar&&this.wl.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new d.toolbar(this)),d.experiments&&this.wl.push(this.experiments=(c=this.experiments)!==null&&c!==void 0?c:new d.experiments(this)),this.wl.forEach((p=>{p.initialize&&h.push((()=>{p.initialize==null||p.initialize()}))})),h.push((()=>{if(this.ou){var p=this.ou;this.ou=void 0,this.wl.forEach((m=>m.onRemoteConfig==null?void 0:m.onRemoteConfig(p)))}})),this.au(h,u)}au(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.au(t,n)}),0);var r=t.shift();if(r)try{r()}catch(i){lt.error("Error initializing extension:",i)}}var a=Math.round(performance.now()-n);this.register_for_session({[CW]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[TW]:a}),this.config.__preview_deferred_init_extensions&<.info("PostHog extensions initialized ("+a+"ms)")}fa(t){var n;if(!Ke||!Ke.body)return lt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.fa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ou=t),this.xl=t,this.compression=void 0,t.ok){var r,a=t.config;a.supportedCompression&&!this.config.disable_compression&&(this.compression=ns(a.supportedCompression,pi.GZipJS)?pi.GZipJS:ns(a.supportedCompression,pi.Base64)?pi.Base64:void 0),(r=a.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=a.analytics.endpoint)}this.set_config({person_profiles:this.Ul?this.Ul:ZC}),(n=this.lu)==null||n.handleRemoteConfig(t),this.wl.forEach((i=>i.onRemoteConfig==null?void 0:i.onRemoteConfig(t)))}eu(){try{this.config.loaded(this)}catch(r){lt.critical("`loaded` function failed",r)}if(this.uu(),this.config.internal_or_test_user_hostname&&In!=null&&In.hostname){var t=In.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Pl())&&this.hu()}),1),this.du=new tV(this),this.du.load()}uu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Ql)==null||t.enable())}_dom_loaded(){this.is_capturing()&&cy(this.__request_queue,(t=>this.Jl(t))),this.__request_queue=[],this.uu()}_handle_unload(){var t,n,r,a,i;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.vu()&&this.capture(M2),(r=this.logs)==null||r.flushLogs("sendBeacon"),(a=this.Ql)==null||a.unload(),(i=this.Kl)==null||i.unload()):this.vu()&&this.capture(M2,null,{transport:"sendBeacon"})}_send_request(t){var n;this.__loaded?wV?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=ze({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?(n=this.compression)!==null&&n!==void 0?n:t.compressionFallback:t.compression,(Be(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,
4(r=>{var a,i,o,l=ze({},r);l.timeout=l.timeout||6e4;var c,u,d,h,p,m=(a=l.transport)!==null&&a!==void 0?a:"fetch";m==="sendBeacon"&&Be(l.compression)&&l.data&&(l.compression=pi.Base64),l.method==="POST"&&l.data&&(l.timestampMode==="capture-body"?l.data={api_key:(u=(p=(h=(Xt(c=l.data)?c:[c]).map((y=>ze({},y,y.timestamp instanceof Date&&!isNaN(y.timestamp.getTime())?{timestamp:y.timestamp.toISOString()}:{}))))[0])==null||(d=p.properties)==null?void 0:d.token)!==null&&u!==void 0?u:p?.token,batch:h,sent_at:new Date().toISOString()}:l.timestampMode==="body"&&(l.data=(function(y,v){return v===void 0&&(v=new Date().toISOString()),Xt(y)?y.map((w=>ze({},w,{sent_at:v}))):ze({},y,{sent_at:v})})(l.data))),l.url=_O(l.url,l.method,l.compression,l.timestampMode);var g=e1.filter((y=>!l.disableTransport||!y.transport||!l.disableTransport.includes(y.transport))),x=(i=(o=(function(y,v){for(var w=0;y.length>w;w++)if(y[w].transport===m)return y[w]})(g))==null?void 0:o.method)!==null&&i!==void 0?i:g[0].method;if(!x)throw new Error("No available transport method");var b=y=>{try{x(y)}catch(v){dV(v)?lt.warn(v):lt.error(v),l.callback==null||l.callback({statusCode:0,error:v})}};m!=="sendBeacon"&&l.data&&l.compression===pi.GZipJS&&Xce&&typeof Promise<"u"&&!Zv?Dde(l).then((y=>{b(y)})).catch((y=>{if(W6(y))return Zv=!0,void b(ze({},l,{compression:void 0,url:_O(r.url,r.method,void 0,r.timestampMode)}));(v=>{if(!v||typeof v!="object")return!1;var w="name"in v?String(v.name):"";return W6(v)||w===pW})(y)&&(Zv=!0),b(l)})):x(l)})(ze({},t,{callback:r=>{var a,i;this.rateLimiter.checkForLimiting(r),400>r.statusCode||(a=(i=this.config).on_request_error)==null||a.call(i,r),t.callback==null||t.callback(r)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}Jl(t){this.Kl?this.Kl.retriableRequest(t):this._send_request(t)}_execute_array(t){X2++;try{var n,r=[],a=[],i=[];cy(t,(l=>{if(l)if(Xt(n=l[0]))i.push(l);else if(ha(l))try{l.call(this)}catch(c){lt.error("Error executing queued PostHog call",l,c)}else Xt(l)&&n==="alias"?r.push(l):Xt(l)&&n.indexOf("capture")!==-1&&ha(this[n])?i.push(l):a.push(l)}));var o=function(l,c){cy(l,(function(u){try{if(Xt(u[0])){var d=c;Vs(u,(function(h){d=d[h[0]].apply(d,h.slice(1))}))}else c[u[0]].apply(c,u.slice(1))}catch(h){lt.error("Error executing queued PostHog call",u,h)}}))};o(r,this),o(a,this),o(i,this)}finally{X2--}}push(t){if(X2>0&&Xt(t)&&ks(t[0])){var n=mi.prototype[t[0]];ha(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}cu(){var t,n=(t=this.persistence)==null?void 0:t.get_property(Za);return ks(n)&&J2.test(n)?{value:n,delivered:!1}:ys(n)&&ks(n.value)&&J2.test(n.value)?{value:n.value,delivered:n.delivered===!0}:void 0}fu(t,n,r,a){if(this.persistence){this.persistence.refreshKey(Za);var i=this.cu();if(!a){if(r)return ks(n)&&J2.test(n)?(n!==i?.value&&this.persistence.register({[Za]:{value:n,delivered:!1}}),{value:n,pending:n!==i?.value||!i.delivered}):void this.persistence.unregister(Za);if(ks(t)&&the.test(t)){if(i?.value.split(".")[3]===t)return{value:i.value,pending:!i.delivered};var o="fb.1."+Date.now()+"."+t;return this.persistence.register({[Za]:{value:o,delivered:!1}}),{value:o,pending:!0}}return i?{value:i.value,pending:!i.delivered}:void 0}this.persistence.unregister(Za)}}pu(t){if(this.persistence){this.persistence.refreshKey(Za);var n=this.cu();n?.value!==t||n.delivered||this.persistence.register({[Za]:{value:t,delivered:!0}})}}capture(t,n,r){var a,i,o,l,c,u,d,h,p,m;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ql){if(this.is_capturing())if(!Be(t)&&ks(t)){this.Ll();var g=!this.config.opt_out_useragent_filter&&this._is_bot();if(!g||this.config.__preview_capture_bot_pageviews){var x=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(x==null||!x.isRateLimited){var b;n!=null&&n.$current_url&&!ks(n?.$current_url)&&(lt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||r!=null&&r.gu||lt.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(b=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 y=new Date,v=r?.timestamp||y,w=$6(r?.uuid,po),j={uuid:w,event:t,properties:this.calculateEventProperties(t,n||{},v,w)};t===dm&&this.config.__preview_capture_bot_pageviews&&g&&(j.event="$bot_pageview",j.properties.$browser_type="bot"),x&&(j.properties.$lib_rate_limit_remaining_tokens=x.remainingTokens);var E=t==="$feature_flag_called"&&j.properties.$feature_flag_has_experiment===!1&&this.get_property(Em)===!0;r?.$set&&!E&&(j.$set=r?.$set);
4var S=ys(n?.$set)?n.$set:void 0,_=!(r==null||!r.$set)&&Nl in r.$set,k=_||!!S&&Nl in S,C=_?r==null||(a=r.$set)==null?void 0:a[Nl]:S?.[Nl],N=Xt(n?.$unset)?n.$unset:[],A=r?.$unset||[],T=N.indexOf(Nl)!==-1||A.indexOf(Nl)!==-1,I=this.fu((i=b)==null?void 0:i.fbclid,C,k,T);I&&j.properties.$process_person_profile===!0&&I.pending&&!k&&!E&&(j.$set=ze({[Nl]:I.value},j.$set));var $=r?.$unset;$&&(j.$unset=$);var O,U,F,H=E?void 0:this.mu(r?.$set_once,t!==J6,t===eT);if(H&&(j.$set_once=H),r!=null&&r._noTruncate||(d=this.config.properties_string_max_length,h=j,p=te=>ks(te)?te.slice(0,d):te,m=new Set,j=(function te(Q,Y){if(Q!==Object(Q))return p?p(Q):Q;if(!m.has(Q)){var J;if(m.add(Q),Xt(Q))J=[],cy(Q,(ee=>{J.push(te(ee))}));else{var P={};Vs(Q,((ee,X)=>{m.has(ee)||(P[X]=te(ee))})),J=P}return J}})(h)),j.timestamp=v,Be(r?.timestamp)||(j.properties.$event_time_override_provided=!0,j.properties.$event_time_override_system_time=y),E&&(j.properties=(function(te,Q){Q===void 0&&(Q=[]);var Y={},J=P=>{te[P]!==void 0&&(Y[P]=te[P])};return zue.forEach(J),Q.forEach(J),Y})(j.properties,she)),t===Kl.DISMISSED||t===Kl.SENT){var G=n?.[W2.SURVEY_ID],M=n?.[W2.SURVEY_ITERATION];yV({id:G,current_iteration:M}),j.$set=ze({},j.$set,{[(O={id:G,current_iteration:M},U=t===Kl.SENT?"responded":"dismissed",F="$survey_"+U+"/"+O.id,O.current_iteration&&O.current_iteration>0&&(F="$survey_"+U+"/"+O.id+"/"+O.current_iteration),F)]:!0})}else t===Kl.SHOWN&&(j.$set=ze({},j.$set,{[W2.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===Tde.SHOWN){var z=n?.[xO.TOUR_TYPE];z&&(j.$set=ze({},j.$set,{[xO.TOUR_LAST_SEEN_DATE+"/"+z]:new Date().toISOString()}))}var W=ze({},j.properties.$set,j.$set);if(gi(W)||this.setPersonPropertiesForFlags(W),!cs(this.config.before_send)){var D=this.ns(j);if(!D)return;(j=D).uuid=$6(j.uuid,po)}var Z=(o=(l=j.$set)==null?void 0:l[Nl])!==null&&o!==void 0?o:ys((c=j.properties)==null?void 0:c.$set)?j.properties.$set[Nl]:void 0,V=I!=null&&I.pending&&Z===I.value?I.value:void 0;this.Cl.emit("eventCaptured",j);var L=(u=r?._url)!==null&&u!==void 0?u:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),K=ze({method:"POST",url:L,data:j,compression:"best-available",timestampMode:r?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(L)?"body":"capture-body",batchKey:r?._batchKey},r!=null&&r.transport?{transport:r.transport}:{},V?{fireCallbackOnDrop:!0,callback:te=>{te.statusCode>=200&&300>te.statusCode&&this.pu(V)}}:{});return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly||V?this.Jl(K):this.Ql.enqueue(K),j}lt.critical("This capture call is ignored due to client rate limiting.")}}else lt.error("No event name provided to posthog.capture")}else lt.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}getExtension(t){var n;return(n=this.lu)==null?void 0:n.getExtension(t)}nu(){var t;return(t=this.lu)!==null&&t!==void 0?t:this.lu=new ehe(this)}Ml(t){this.Bl.push(t);var n=!0;return()=>{if(n){n=!1;var r=this.Bl.indexOf(t);r!==-1&&this.Bl.splice(r,1)}}}yu(t){var n,r,a;return t===void 0&&(t=!0),!((n=this.persistence)==null||!n.consumeCookieIdentityChange())&&(this.Wl=null,this.persistence.get_property(bs)===Kn&&((a=this.sessionPersistence)==null||a.clear(),this.ql.clear(),this.bu()),(r=this.featureFlags)==null||r.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,n,r,a,i){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.yu();var o=i?void 0:this.persistence.remove_event_timer(t),l=ze({},n);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Pl()&&(l[SW]=!0),t==="$snapshot"){var c=ze({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=c.distinct_id,(!ks(l.distinct_id)&&!qn(l.distinct_id)||fx(l.distinct_id))&<.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=(function(_,k,C,N){var A,T,I,$;if(N===void 0&&(N=!1),!Qa)return{};var O,U=_?[...Wm,...k||[]]:[],F=oW(Qa),H=F[0],G=F[1],M=(O="u">typeof navigator?navigator:void 0)!=null&&O.brave?{brave:!0}:{},z={};Be(C)||(z.detectGoogleSearchApp=C);var W={}
4,D=(A=navigator)==null||(A=A.userAgentData)==null?void 0:A.platform,Z=(T=navigator)==null?void 0:T.maxTouchPoints,V=Ae==null||(I=Ae.screen)==null?void 0:I.width,L=Ae==null||($=Ae.screen)==null?void 0:$.height,K=Ae?.devicePixelRatio;Be(D)||(W.userAgentDataPlatform=D),Be(Z)||(W.maxTouchPoints=Z),Be(V)||(W.screenWidth=V),Be(L)||(W.screenHeight=L),Be(K)||(W.devicePixelRatio=K);var te,Q,Y,J,P,ee,X,ae,me=cn(s4({$os:H,$os_version:G,$browser:iW(Qa,navigator.vendor,M,z),$device:M6(Qa),$device_type:(Q=Qa,Y=W,ae=M6(Q),ae===zq||ae===Uq||ae==="Kobo"||ae==="Kindle Fire"||ae===tW?Fm:ae===rb||ae===km||ae===ab||ae===RC?"Console":ae===qq?"Wearable":ae?ki:Y?.userAgentDataPlatform==="Android"&&((J=Y?.maxTouchPoints)!==null&&J!==void 0?J:0)>0?600>Math.min((P=Y?.screenWidth)!==null&&P!==void 0?P:0,(ee=Y?.screenHeight)!==null&&ee!==void 0?ee:0)/((X=Y?.devicePixelRatio)!==null&&X!==void 0?X:1)?ki:Fm:"Desktop"),$timezone:eV(),$timezone_offset:Ede()}),{$current_url:lb(N?yu(In?.href):In?.href,U,cb),$host:In?.host,$pathname:In?.pathname,$raw_user_agent:Qa.length>1e3?Qa.substring(0,997)+"...":Qa,$browser_version:mue(Qa,navigator.vendor,M,z),$browser_language:fO(),$browser_language_prefix:(te=fO(),typeof te=="string"?te.split("-")[0]:void 0),$screen_height:Ae?.screen.height,$screen_width:Ae?.screen.width,$viewport_height:Ae?.innerHe
4ight,$viewport_width:Ae?.innerWidth,$lib:ln.LIB_NAME,$lib_version:ln.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return ln.SDK_DIST_CHANNEL&&(me.$sdk_dist_channel=ln.SDK_DIST_CHANNEL),me})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var h=this.sessionManager.checkAndGetSessionAndWindowId(i,r.getTime(),!0),p=h.windowId;l.$session_id=h.sessionId,l.$window_id=p}this.sessionPropsManager&&cn(l,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&cn(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(m=this.Kl)==null?void 0:m.length}catch(_){l.$sdk_debug_error_capturing_properties=String(_)}if(this.requestRouter.region===mT&&(l.$lib_custom_api_host=this.config.api_host),u=t!==dm||i?t!==M2||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,a),l=cn(l,u),t===dm&&Ke&&(l.title=Ke.title),!Be(o)){var g=r.getTime()-o;l.$duration=parseFloat((g/1e3).toFixed(3))}Qa&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var x=this.persistence.properties(),b=this.sessionPersistence.properties(),y=l.$groups,v=x.$groups;ys(y)&&!gi(y)&&(l.$groups=ze({},ys(v)?v:{},y)),Vs(["$referrer","$referring_domain"],(_=>{_ in x&&delete b[_]}));var w={};if(this.Bl.length>0)for(var j of this.Bl.slice())try{cn(w,j())}catch(_){lt.error("Failed to produce browser extension event properties",_)}(l=cn({},d,x,b,ze({},w,l))).$is_identified=this._isIdentified(),Xt(this.config.property_denylist)?Vs(this.config.property_denylist,(function(_){delete l[_]})):lt.error(vV+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var E=this.config.sanitize_properties;E&&(lt.error(AO),l=E(l,t));var S=this._u();return l.$process_person_profile=S,S&&!i&&this.wu("_calculate_event_properties"),l}mu(t,n,r){var a;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this._u()||this.Nl&&!r)return t;var i=this.persistence.get_initial_props(),o=(a=this.sessionPropsManager)==null?void 0:a.getSetOnceProps(),l=cn({},i,o||{},t||{}),c=this.config.sanitize_properties;return c&&(lt.error(AO),l=c(l,"$set_once")),n&&(this.Nl=!0),gi(l)?void 0:l}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,r;(n=this.persistence)==null||n.syncCookieProperties(),this.yu(),(r=this.sessionPersistence)==null||r.register(t),Object.keys(t).forEach((a=>this.ql.add(a))),this.bu()}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t),this.ql.delete(t),this.bu()}ku(t,n){this.register({[t]:n})}Yl(){this.ql.forEach((t=>{var n;(n=this.sessionPersistence)==null||n.unregister(t)})),this.ql.clear(),this.bu()}bu(){var t;if(this.jl)if(this.config.persistence==="memory"||(t=this.sessionPersistence)!=null&&t.Eo||!sn.ii())sn.oi(this.jl);else{var n=[];this.ql.forEach((r=>n.push(r))),n.length>0?sn.ni(this.jl,n):sn.oi(this.jl)}}getFeatureFlag(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var r,a;return(r=(a=this.featureFlags)==null?void 0:a.isFeatureEnabled(t,n))!==null&&r!==void 0?r:n?.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,r){var a;(a=this.featureFlags)==null||a.updateFlags(t,n,r)}updateEarlyAccessFeatureEnrollment(t,n,r){var a;(a=this.featureFlags)==null||a.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){var a;return n===void 0&&(n=!1),(a=this.featureFlags)==null?void 0:a.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.Cl.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:gg}),()=>{})}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?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:gg})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:gg})}renderSurvey(t,n){var r;(r=this.surveys)==null||r.renderSurvey(t,n)}displaySurvey(t,n){var r;n===void 0&&(n=Yde),(r=this.surveys)==null||r.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:gg}}canRenderSurveyAsync(t,n){var r,a;return n===void 0&&(n=!1),(r=(a=this.surveys)==null?void 0:a.canRenderSurveyAsync(t,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:gg})}Su(t){return!t||fx(t)?(lt.critical("Unique user id has not been set in posthog.identify"),!1):t===mp?(lt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(lt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
4ot a hardcoded string.'),!1)}identify(t,n,r){if(!this.__loaded||!this.persistence)return lt.uninitializedWarning("posthog.identify");if(qn(t)&&(t=t.toString(),lt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Su(t)&&this.wu("posthog.identify")){this.Ll();var a=this.get_distinct_id(),i=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==a,o=this.yu(!1),l=this.persistence.Zo(),c=!1;try{var u=this.get_distinct_id();this.register({$user_id:t}),this.get_property(ib)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property(lm)&&(this.unregister(lm),this.register({distinct_id:t}));var d=(this.persistence.get_property(bs)||Kn)===Kn,h=t!==u,p=!h&&d;if(h&&d){var m,g=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:u};this.persistence.set_property(bs,Xr),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Qo(),this.capture(eT,g,{$set:n||{},$set_once:r||{}}),this.Wl=K2(t,n,r),(m=this.featureFlags)==null||m.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:u)}else if(p){this.persistence.set_property(bs,Xr);var x=n||{},b=r||{};this.setPersonPropertiesForFlags({$set:x,$set_once:b},!1),this.config.cookieWinsOnConflict&&this.persistence.Qo(),this.capture("$set",{$set:x,$set_once:b}),this.Wl=K2(t,n,r)}else(n||r)&&this.setPersonProperties(n,r);h||i||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Gl)):p&&(n||r)&&this.reloadFeatureFlags(),c=!0}finally{l&&this.persistence.Yo(c)}}}setPersonProperties(t,n){if((t||n)&&this.wu("posthog.setPersonProperties")){var r=K2(this.get_distinct_id(),t,n);this.Wl!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Wl=r):lt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,r=(Xt(t)?t:[t]).filter((a=>ks(a)&&a.length>0));r.length!==0&&this.wu("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Wl=null)}group(t,n,r){var a;if(t&&n){(a=this.persistence)==null||a.syncCookieProperties(),this.yu();var i=this.getGroups(),o=i[t]!==n;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ze({},i,{[t]:n})}),(o||r)&&this._u()){var l={$group_type:t,$group_key:n};r&&(l.$group_set=r),this.capture(J6,l)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else lt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),this.wu("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n=Pa(t)?t:t?.resetDeviceID,r=Pa(t)||t==null?void 0:t.bootstrap;this.xu(n,!1,r)}xu(t,n,r){var a,i,o;if(n===void 0&&(n=!1),lt.info("reset"),!this.__loaded)return lt.uninitializedWarning("posthog.reset");var l=r?.sessionID;this.config.bootstrap=r||((a=this.Gl)==null?void 0:a.bootstrap)||{},(i=this.featureFlags)==null||i.updateConfig==null||i.updateConfig(this.config,this.pa());var c=this.get_property(ib),u=this.get_property(O2),d=this.get_property(Ud),h=this.is_capturing();this.consent.reset(),n||!h||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var p=(o=this.persistence)==null||o.Zo==null?void 0:o.Zo(),m=!1;try{var g,x,b,y,v,w,j,E,S,_,k,C,N;if((g=this.persistence)==null||g.clear(),(x=this.sessionPersistence)==null||x.clear(),this.ql.clear(),this.bu(),Be(d)||(_=this.persistence)==null||_.register({[Ud]:d}),(b=this.surveys)==null||b.reset(),(y=this.featureFlags)==null||y.reset(),(v=this.conversations)==null||v.reset(),(w=this.logs)==null||w.reset(),(j=this.metrics)==null||j.reset(),(E=this.persistence)==null||E.set_property(bs,Kn),(S=this.sessionManager)==null||S.resetSessionId(),this.Wl=null,this.config.cookieless_mode===Yl)this.register_once({distinct_id:mp,$device_id:null},"");else{var A=this.config.get_device_id(po());this.register_once({distinct_id:A,$device_id:t?A:c},""),t||Be(u)||this.register({[O2]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),r&&(r.distinctID===void 0||this.Pl()||((N=this.persistence)==null||N.set_property(bs,r.isIdentifiedID?Xr:Kn),this.register({distinct_id:r.distinctID})),(k=this.featureFlags)==null||k.initialize(),!(Be(l)||(C=this.sessionManager)!=null&&C.setBootstrapSessionId(l,!0))
4)){var T=ze({},r);delete T.sessionID,this.config.bootstrap=T}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var I;p&&((I=this.persistence)==null||I.Yo==null||I.Yo(m))}this.reloadFeatureFlags()}shutdown(t){var n=this;return un((function*(){var r,a,i,o,l,c,u;if(n.__loaded){n.nu().dispose(),(r=n.sessionRecording)==null||r.dispose(),(a=n.logs)==null||a.flushLogs("sendBeacon"),(i=n.metrics)==null||i.flush("sendBeacon"),(o=n.Ql)==null||o.unload(),(l=n.Kl)==null||l.unload();try{var d;(d=n.featureFlags)==null||d.destroy()}catch(h){lt.error("Error while destroying feature flags",h)}(c=n.persistence)==null||c.destroy(),(u=n.sessionPersistence)==null||u.destroy()}else lt.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var r;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(r=this.conversations)==null||r.Cu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)==null||t.Tu()}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 n=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.sessionStartTimestamp,a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&r){var i,o=(i=t.timestampLookBack)!==null&&i!==void 0?i:10;if(!r)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return a}alias(t,n){return t===this.get_property(vW)?(lt.critical("Attempting to create alias for existing People user - aborting."),-2):this.wu("posthog.alias")?(Be(n)&&(n=this.get_distinct_id()),t!==n?(this.ku(lm,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(lt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=ze({},this.config);if(ys(t)){var r,a,i,o,l,c,u,d,h,p,m,g;cn(this.config,RO(t));var x=this.Dl();(r=this.persistence)==null||r.update_config(this.config,n,x),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new H2(ze({},this.config,{persistence:"sessionStorage"}),x,!1);var b,y=this.Vl(this.config.debug);Pa(y)&&(this.config.debug=y),Pa(this.config.debug)&&(this.config.debug?(ln.DEBUG=!0,As.ii()&&As.ni("ph_debug",!0),lt.info("set_config",{config:t,oldConfig:n,newConfig:ze({},this.config)})):(ln.DEBUG=!1,As.ii()&&As.oi("ph_debug"))),(a=this.featureFlags)==null||a.updateConfig==null||a.updateConfig(this.config,this.pa()),(i=this.exceptionObserver)==null||i.onConfigChange(),(o=this.exceptions)==null||o.onConfigChange(),(l=this.sessionRecording)==null||l.startIfEnabledOrStop(),(c=this.tracingHeaders)==null||c.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(d=this.heatmaps)==null||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((b=this.historyAutocapture)==null||b.startIfEnabledOrStop()),(h=this.exceptionObserver)==null||h.startIfEnabledOrStop(),(p=this.deadClicksAutocapture)==null||p.startIfEnabledOrStop(),(m=this.surveys)==null||m.loadIfEnabled(),this.$l(),(g=this.externalIntegrations)==null||g.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&pO(this,wx,!1)}}_overrideSDKInfo(t,n){ln.LIB_NAME=t,ln.LIB_VERSION=n}startSessionRecording(t){var n,r,a,i,o,l=t===!0,c={sampling:l||!(t==null||!t.sampling),linked_flag:l||!(t==null||!t.linked_flag),url_trigger:l||!(t==null||!t.url_trigger),event_trigger:l||!(t==null||!t.event_trigger)};Object.values(c).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),c.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),c.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),c.url_trigger&&((i=this.sessionRecording)==null||i.overrideTrigger("url")),c.event_trigger&&((o=this.sessionRecording)==null||o.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){try{if(!this.exceptions)return;var r=new Error("PostHog syntheticException"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(ze({},a,n))}catch{return}}addExceptionStep(t,n){var r;(r=this.exceptions)==null||r.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:mi.Mu}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&n!==void 0&&n}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:Yp;return n!==Yp&&(n=Yp+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(bs))===Xr||((n=this.sessionPersistence)==null?void 0:n.get_property(bs))===Xr}_u(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===ZC&&!this._isIdentified()&&gi(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[lm])&&((n=this.persistence)==null||(n=n.props)==null||!n[cw]))}vu(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this._u()||this.wu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.wu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}wu(t){return this.config.person_profiles==="never"?(lt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Al(),this.ku(cw,!0),!0)}Dl(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Bc)}$l(){var t,n,r,a,i,o=this.Dl();return this.is_capturing()||(r=this.logs)==null||r.Iu(),((t=this.persistence)==null?void 0:t.Eo)!==o&&((a=this.persistence)==null||a.set_disabled(o)),((n=this.sessionPersistence)==null?void 0:n.Eo)!==o&&((i=this.sessionPersistence)==null||i.set_disabled(o)),o&&(this.ql.clear(),this.bu()),o}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==Yl){if(this.Pl()){var r,a,i,o,l,c;(r=this.sessionRecording)==null||r.dispose({discardBufferedEvents:!0}),this.xu(!0,!0),(a=this.sessionManager)==null||a.destroy(),(i=this.pageViewM
4anager)==null||i.destroy(),this.sessionManager=new EO(this),this.pageViewManager=new mO(this),this.persistence&&(this.sessionPropsManager=new kO(this,this.sessionManager,this.persistence));var u,d=(o=(l=this.config.__extensionClasses)==null?void 0:l.sessionRecording)!==null&&o!==void 0?o:(c=mi.__defaultExtensionClasses)==null?void 0:c.sessionRecording;d&&(this.sessionRecording=this.Rl(this.sessionRecording,new d(this)),this.xl&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.xl)))}var h,p;this.consent.optInOut(!0),this.$l(),this.uu(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Bc&&((h=this.surveys)==null||h.loadIfEnabled()),(Be(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((p=t?.captureEventName)!==null&&p!==void 0?p:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hu()}else lt.warn(TO)}opt_out_capturing(){if(this.config.cookieless_mode!==Yl){var t,n,r=this.config.cookieless_mode===Bc?this.sessionRecording:void 0;r?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===Bc&&this.consent.isOptedIn()&&this.xu(!0,!0),this.consent.optInOut(!1),this.$l(),this.config.cookieless_mode===Bc&&(this.register({distinct_id:mp,$device_id:null}),this.El(r),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.hu(),this.uu())}else lt.warn(TO)}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===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Yl||(this.config.cookieless_mode===Bc?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.$l()}_is_bot(){return Cr?pV(Cr,this.config.custom_blocked_useragents):void 0}hu(){Ke&&(Ke.visibilityState==="visible"?this.Hl||(this.Hl=!0,this.capture(dm,{title:Ke.title},{send_instantly:!0}),this.zl&&(Ke.removeEventListener(zm,this.zl),this.zl=null)):this.zl||(this.zl=this.hu.bind(this),nn(Ke,zm,this.zl)))}debug(t){t===!1?(Ae?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Ae?.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}))}pa(){var t=this.Gl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(lt.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):(function(n,r,a,i,o){var l=r in n&&!cs(n[r]),c=a in n&&!cs(n[a]);return l?n[r]:!!c&&(o&&o.warn("Config field '"+a+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,lt)}ns(t){var n;if(cs(this.config.before_send))return t;var r=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(sue),a=Xt(this.config.before_send)?this.config.before_send:[this.config.before_send],i=t;for(var o of a)try{if(i=o(i),cs(i)){var l="Event '"+t.event+"' was rejected in beforeSend function";return tue(t.event)?lt.warn(l+". This can cause unexpected behavior."):lt.info(l),null}i.properties&&!gi(i.properties)||lt.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(u){return lt.error("Error in beforeSend function for event '"+t.event+"':",u),null}for(var c of r)if(i.properties&&cs(i.properties[c]))return lt.warn("Event '"+t.event+"' had its '"+c+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return i}getPageViewId(){var t;
4return(t=this.pageViewManager.io)==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)})}Vl(t){var n=Pa(t)&&!t,r=As.ii()&&As.ai("ph_debug")==="true";return!n&&(!!r||t)}}mi.__defaultExtensionClasses={},mi.Mu=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=Zue(e.prototype[t[n]])})(mi,["identify"]);class jV{constructor(t){this.disabled=t===!1;var n=ys(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,r){if(this.disabled)return!1;var a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<this.thresholdPx&&this.timeoutMs>r-a.timestamp){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var Z2="$copy_autocapture",xy=Sn("[AutoCapture]");function eN(e,t){return t.length>e?t.slice(0,e)+"...":t}function ihe(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!vu(t));return t}function ohe(e,t){var n,r,a=t.e,i=t.maskAllElementAttributes,o=t.maskAllText,l=t.elementAttributeIgnoreList,c=t.elementsChainAsString,u=t.disableCaptureUrlHashes;if(!vu(e))return{props:{}};for(var d=[e],h=new Set([e]),p=e;p.parentNode&&!_i(p,"body")&&MW>d.length;)if(OW(p.parentNode)){var m=p.parentNode.host;if(h.has(m))break;h.add(m),d.push(m),p=m}else{if(!vu(p.parentNode)||h.has(p.parentNode))break;h.add(p.parentNode),d.push(p.parentNode),p=p.parentNode}var g,x,b=[],y={},v=!1,w=!1;if(Vs(d,(k=>{var C=oT(k);if(_i(k,"a")){var N=k.getAttribute("href");v=!!(C&&N&&bx(N))&&(u?yu(N):N)}ns(hw(k),"ph-no-capture")&&(w=!0),b.push((function(T,I,$,O,U){U===void 0&&(U=!1);var F=T.tagName.toLowerCase(),H={tag_name:F};r4.indexOf(F)>-1&&!$&&(H.$el_text=F.toLowerCase()==="a"||F.toLowerCase()==="button"?eN(1024,uO(T)):eN(1024,ob(T)));var G=hw(T);G.length>0&&(H.classes=G.filter((function(D){return D!==""}))),Vs(T.attributes,(function(D){var Z;if((!zW(T)||["name","id","class","aria-label"].indexOf(D.name)!==-1)&&(O==null||!O.includes(D.name))&&!I&&bx(D.value)&&(!ks(Z=D.name)||Z.substring(0,10)!=="_ngcontent"&&Z.substring(0,7)!=="_nghost")){var V=D.value;D.name==="class"&&(V=n4(V).join(" ")),H["attr__"+D.name]=eN(1024,D.name==="href"&&U?yu(V):V)}}));for(var M=1,z=1,W=T;W=ihe(W);)M++,W.tagName===T.tagName&&z++;return H.nth_child=M,H.nth_of_type=z,H})(k,i,o,l,u));var A=(function(T){if(!oT(T))return{};var I={};return Vs(T.attributes,(function($){if($.name&&$.name.indexOf("data-ph-capture-attribute")===0){var O=$.name.replace("data-ph-capture-attribute-",""),U=$.value;O&&U&&bx(U)&&(I[O]=U)}})),I})(k);Vs(A,((T,I)=>{({}).hasOwnProperty.call(y,I)||(y[I]=T)}))})),w)return{props:{},explicitNoCapture:w};if(o||(b[0].$el_text=_i(e,"a")||_i(e,"button")?uO(e):ob(e)),v){var j,E;b[0].attr__href=v;var S=(j=Hm(v))==null?void 0:j.host,_=Ae==null||(E=Ae.location)==null?void 0:E.host;S&&_&&S!==_&&(g=v)}return{props:cn({$event_type:a.type,$ce_version:1},c?{}:{$elements:b},{$elements_chain:(x=b,Xt(x)?(function(k){return k.map((C=>{var N,A,T="";if(C.tag_name&&(T+=C.tag_name),C.attr_class)for(var I of(C.attr_class.sort(),C.attr_class))T+="."+I.replace(/"/g,"");var $=ze({},C.text?{text:C.text}:{},{"nth-child":(N=C.nth_child)!==null&&N!==void 0?N:0,"nth-of-type":(A=C.nth_of_type)!==null&&A!==void 0?A:0},C.href?{href:C.href}:{},C.attr_id?{attr_id:C.attr_id}:{},C.attributes),O={};return Qv($).sort(((U,F)=>{return(G=F[0])>(H=U[0])?-1:H>G?1:0;var H,G})).forEach((U=>{var F=U[1];return O[dO(U[0].toString())]=dO(F.toString())})),(T+=":")+Qv(O).map((U=>U[0]+'="'+U[1]+'"')).join("")})).join(";")})((function(k){return k.map((C=>{var N,A,T={text:(N=C.$el_text)==null?void 0:N.slice(0,400),tag_name:C.tag_name,href:(A=C.attr__href)==null?void 0:A.slice(0,2048),attr_class:bde(C),attr_id:C.attr__id,nth_child:C.nth_child,nth_of_type:C.nth_of_type,attributes:{}};return Qv(C).filter((I=>
4I[0].indexOf("attr__")===0)).forEach((I=>T.attributes[I[0]]=I[1])),T}))})(x)):"")},(n=b[0])!=null&&n.$el_text?{$el_text:(r=b[0])==null?void 0:r.$el_text}:{},g&&a.type==="click"?{$external_click_url:g}:{},y)}}class lhe{constructor(t){this.name="autocapture",this.Rs=!1,this.Ps=null,this.As=!1,this.Fs=!1,this.mn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Os=!1,this.Ls=t,this.Ls.refresh(this.mn),this.rageclicks=new jV(this.mn.rageclick),this.Ds=null}setup(t){this.$s(),this.Ns=t;var n=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Os?n.dispose():(this.qs=n,this.startIfEnabled())}dispose(){var t;this.Os||(this.Os=!0,this.Ns=void 0,(t=this.qs)==null||t.dispose(),this.qs=void 0,this.js())}Bs(){return this.Ls.refresh(this.mn),this.mn}$s(){var t,n;return this.Bs(),this.mn.url_allowlist=(t=this.mn.url_allowlist)==null?void 0:t.map((r=>new RegExp(r))),this.mn.url_ignorelist=(n=this.mn.url_ignorelist)==null?void 0:n.map((r=>new RegExp(r))),this.mn}Hs(){if(this.isBrowserSupported()){if(Ae&&Ke){var t=this.zs=r=>{r=r||Ae?.event;try{this.Us(r)}catch(a){xy.error("Failed to capture event",a)}};if(nn(Ke,"submit",t,{capture:!0}),nn(Ke,"change",t,{capture:!0}),nn(Ke,"click",t,{capture:!0}),this.Bs().capture_copied_text){var n=this.Ws=r=>{r=r||Ae?.event;try{this.Us(r,Z2)}catch(a){xy.error("Failed to capture clipboard event",a)}};nn(Ke,"copy",n,{capture:!0}),nn(Ke,"cut",n,{capture:!0}),nn(Ke,"paste",n,{capture:!0})}}}else xy.info("Disabling Automatic Event Collection because this browser is not supported")}js(){this.zs&&(Ke?.removeEventListener("submit",this.zs,!0),Ke?.removeEventListener("change",this.zs,!0),Ke?.removeEventListener("click",this.zs,!0),this.zs=void 0),this.Ws&&(Ke?.removeEventListener("copy",this.Ws,!0),Ke?.removeEventListener("cut",this.Ws,!0),Ke?.removeEventListener("paste",this.Ws,!0),this.Ws=void 0),this.Rs=!1}startIfEnabled(){!this.Os&&this.Ns&&this.isEnabled&&!this.Rs&&(this.Hs(),this.Rs=!0)}onRemoteConfig(t){if(!this.Os)if(this.As=!0,t.ok){var n=t.config;
4n.elementsChainAsString&&(this.Fs=n.elementsChainAsString);var r,a=n.autocapture_opt_out;Pa(a)&&((r=this.Ns)==null||r.kv.set($C,a),this.Ps=a),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Ds=t}getElementSelectors(t){var n,r=[];return(n=this.Ds)==null||n.forEach((a=>{var i=Ke?.querySelectorAll(a);i?.forEach((o=>{t===o&&r.push(a)}))})),r}get isEnabled(){var t,n;if(this.Os)return!1;var r=(t=this.Ns)==null?void 0:t.kv.get($C),a=this.Ps,i=this.Bs(),o=i.remoteRequestsDisabled&&!this.As;if(Hn(a)&&!Pa(r)&&!o)return!1;var l=(n=this.Ps)!==null&&n!==void 0?n:!!r;return!!i.enabled&&!l}Us(t,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var r=aT(t);LW(r)&&(r=r.parentNode||null);var a,i=this.$s();n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&i.rageclick&&(a=this.rageclicks)!=null&&a.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&BW(r,i.rageclick)&&this.Us(t,"$rageclick");var o=n===Z2,l=o?ze({},i,{dom_event_allowlist:void 0}):i;if(r&&(function(y,v,w,j,E,S){var _;if(!Ae||a4(y)||w!=null&&w.url_allowlist&&!nO(w.url_allowlist,S)||w!=null&&w.url_ignorelist&&nO(w.url_ignorelist,S))return!1;if(w!=null&&w.dom_event_allowlist){var k=w.dom_event_allowlist;if(k&&!k.some(($=>v.type===$)))return!1}var C=UW(y,j),N=C.parentIsUsefulElement,A=C.targetElementList;if(!(function($,O){var U=O?.element_allowlist;if(Be(U))return!0;var F,H=function(M){if(U.some((z=>M.tagName.toLowerCase()===z)))return{v:!0}};for(var G of $)if(F=H(G))return F.v;return!1})(A,w)||!iT(A,w?.css_selector_allowlist)||iT(A,(_=w?.css_selector_ignorelist)!==null&&_!==void 0?_:hde))return!1;try{var T=Ae.getComputedStyle(y);if(T&&T.getPropertyValue("cursor")==="pointer"&&v.type==="click")return!0}catch{}var I=y.tagName.toLowerCase();switch(I){case"html":return!1;case"form":return(E||["submit"]).indexOf(v.type)>=0;case"input":case"select":case"textarea":return(E||["change","click"]).indexOf(v.type)>=0;default:return N?(E||["click"]).indexOf(v.type)>=0:(E||["click"]).indexOf(v.type)>=0&&(r4.indexOf(I)>-1||y.getAttribute("contenteditable")==="true")}})(r,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:i.getCurrentUrl}})){var c,u=ohe(r,{e:t,maskAllElementAttributes:i.maskAllElementAttributes,maskAllText:i.maskAllText,elementAttributeIgnoreList:i.element_attribute_ignorelist,elementsChainAsString:this.Fs,disableCaptureUrlHashes:i.disableCaptureUrlHashes}),d=u.props;if(u.explicitNoCapture)return!1;var h=this.getElementSelectors(r);if(h&&h.length>0&&(d.$element_selectors=h),n===Z2){var p=t.type||"clipboard";if(p!=="paste"){var m,g,x=Ae==null||(m=Ae.getSelection())==null?void 0:m.toString(),b=DW(x);if(!b)return!1;d.$selected_content=b,d.$clipboard_text_length=(g=x?.length)!==null&&g!==void 0?g:0}d.$copy_type=p}return(c=this.Ns)==null||c.capture(n,d).catch((y=>xy.error("Failed to capture event",y))),!0}}}isBrowserSupported(){return ha(Ke?.querySelectorAll)}}class che{constructor(t){this._instance=t}refresh(t){var n=this._instance.config,r=ys(n.autocapture)?n.autocapture:void 0;t.enabled=!!n.autocapture,t.rageclick=n.rageclick,t.maskAllElementAttributes=n.mask_all_element_attributes,t.maskAllText=n.mask_all_text,t.disableCaptureUrlHashes=n.disable_capture_url_hashes,t.getCurrentUrl=n.get_current_url,t.remoteRequestsDisabled=this._instance.pa(),t.url_allowlist=r?.url_allowlist,t.url_ignorelist=r?.url_ignorelist,t.dom_event_allowlist=r?.dom_event_allowlist,t.element_allowlist=r?.element_allowlist,t.css_selector_allowlist=r?.css_selector_allowlist,t.css_selector_ignorelist=r?.css_selector_ignorelist,t.element_attribute_ignorelist=r?.element_attribute_ignorelist,t.capture_copied_text=r?.capture_copied_text}}var xg=Sn("[ExceptionAutocapture]"),IO=()=>{},PO=e=>{var t;if(ha(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function _V(e,t,n){try{if(!(t in e))return IO;var r={next:e[t]},a=n((function(){for(var i=arguments.length,o=new Array(i),l=0;i>l;l++)o[l]=arguments[l];return r.next.apply(this,o)}));return ha(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),e[t]=a,()=>{if(e[t]!==a)for(var i=e[t],o=PO(i);o;){if(o.next===a)return void(o.next=r.next);o=PO(i=o.next)}else e[t]=r.next}}catch{return IO}}var uhe=Sn("[TracingHeaders]"),Xu=Sn("[Web Vitals]"),LO=9e5,OO=["CLS","FCP","INP","LCP"],dhe=["INP","LCP"],hhe=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],by="disabled",MO="lazy_loading",bg="awaiting_config",yy="missing_config";Sn("[SessionRecording]"),Sn("[SessionRecording]");var fT="[SessionRecording]",Sl=Sn(fT),phe=Sn("[Heatmaps]");function tN(e){return ys(e)&&"clientX"in e&&"clientY"in e&&qn(e.clientX)&&qn(e.clientY)}var vy=Sn("[Product Tours]"),sN=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Z5))},mhe=["$set_once","$set"],Mo=Sn("[SiteApps]"),DO="Error while initializing PostHog app with config id ",kV=(e,t)=>e!=null&&e.then?e.then(t):t(e),vp="SDK is not enabled or survey functionality is not yet loaded",$O="Disabled. Not loading surveys.";class fhe{constructor(t,n){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Eu=!1,this.Ru=[],this.Pu=null,this.Au=null,this.Os=!1,this.Fu=new Set,this.onRemoteConfig=r=>{if(!this.Os&&!this.mn.disableSurveys){if(!r.ok)return Ws.warn("Remote config unavailable. Not loading surveys.");var a=r.config.surveys;if(cs(a))return Ws.warn("Flags not loaded yet. Not loading surveys.");this.Ou=Pa(a)?a:a.length>0,Ws.info("flags response received, isSurveysEnabled: "+this.Ou),this.loadIfEnabled()}},this.Ls=t,this.Lu=n}setup(t){if(!this.Os)return this.Du=t,kV(t.kv.initialize(),(()=>{if(this.Du===t&&!this.Os){this.Du=void 0,this.Ns=t;var n=t.onRemoteConfig(this.onRemoteConfig);this.Os?n.dispose():(this.qs=n,this.loadIfEnabled())}}))}dispose(){var t,n,r;this.Os||(this.Os=!0,this.Du=void 0,this.Ns=void 0,(t=this.qs)==null||t.dis
4pose(),this.qs=void 0,(n=this._surveyEventReceiver)==null||n.dispose(),this._surveyEventReceiver=null,(r=this._surveyManager)==null||r.dispose==null||r.dispose(),this._surveyManager=null,this.Ru=[],this.Pu=null,this.Fu.forEach((a=>clearTimeout(a))),this.Fu.clear())}get mn(){return this.Ls.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var n=[],r=0;r<localStorage.length;r++){var a=localStorage.key(r);(a!=null&&a.startsWith(bV)||a!=null&&a.startsWith("inProgressSurvey_"))&&n.push(a)}n.forEach((i=>localStorage.removeItem(i)))}catch{}}loadIfEnabled(){if(!this.Os&&this.Ns){var t=this.mn;if(!this._surveyManager)if(this.Eu)Ws.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Ws.info($O);else if(t.cookielessMode&&this.Ls.isOptedOut())Ws.info("Not loading surveys in cookieless mode without consent.");else{var n=this.Ls.getExtensions();if(n){if(!Be(this.Ou)||t.advancedEnableSurveys){var r=this.Ou||t.advancedEnableSurveys;this.Eu=!0;try{var a=n.generateSurveys;if(a)return this.$u(a,r),void(this.Eu=!1);var i=n.loadExternalDependency;if(!i)return this.Nu(t4),void(this.Eu=!1);i((o=>{try{if(this.Os)return;var l=this.Ls.getExtensions();o||l==null||!l.generateSurveys?this.Nu("Could not load surveys script",o):this.$u(l.generateSurveys,r)}finally{this.Eu=!1}}))}catch(o){throw this.Eu=!1,this.Nu("Error initializing surveys",o),o}}}else Ws.error("PostHog Extensions not found.")}}}$u(t,n){this.Os||(this._surveyManager=t(n),this._surveyEventReceiver=this.Ls.createEventReceiver(),Ws.info("Surveys loaded successfully"),this.qu({isLoaded:!0}))}Nu(t,n){Ws.error(t,n),this.qu({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ru.push(t),this._surveyManager&&this.qu({isLoaded:!0}),()=>{this.Ru=this.Ru.filter((n=>n!==t))}}getSurveys(t,n){var r;n===void 0&&(n=!1);var a=(r=this.Ns)!==null&&r!==void 0?r:this.Lu;if(a&&!this.Os){if(this.mn.disableSurveys)return Ws.info($O),t([]);var i=a.kv.get(VC);if(i&&!n)return t(i,{isLoaded:!0}),void(this.ju()&&this.getSurveys((()=>{}),!0));if(this.Pu)this.Pu.then((c=>{this.Os||t(c.surveys,c.context)})).catch((c=>Ws.error("Error in survey callback",c)));else{var o=this.Bu("/api/surveys/",{method:"GET",query:{token:a.projectToken},sentAt:"query",timeoutMs:this.mn.requestTimeoutMs}).then((c=>{try{return this.Hu(a,c)}catch(u){return Ws.error("Error processing surveys response",u),this.Hu(a,{statusCode:0,error:u})}}),(c=>this.Hu(a,{statusCode:0,error:c})));this.Pu=o;var l=()=>{this.Pu===o&&(this.Pu=null)};o.then((c=>{l(),this.Os||t(c.surveys,c.context)}),l).catch((c=>Ws.error("Error in survey callback",c)))}}}Bu(t,n){var r=this.Ns;return r?r.sendRequest(t,n):new Promise((a=>a({statusCode:0,error:new Error(vp)})))}Hu(t,n){if(this.Os)return{surveys:[],context:{isLoaded:!1,error:vp}};var r=n.statusCode;if(r!==200||!n.json){var a="Surveys API could not be loaded, status: "+r;return r!==0?Ws.error(a):n.error||Ws.warn(a),this.Au=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Au=null;var i,o=n.json.surveys||[],l=o.filter((c=>(function(u){return!(!u.start_date||u.end_date)})(c)&&(fV(c)||(function(u){var d;return!((d=u.conditions)==null||(d=d.actions)==null||(d=d.values)==null||!d.length)})(c))));return l.length>0&&((i=this._surveyEventReceiver)==null||i.register(l)),t.kv.set({[VC]:o,[lw]:Date.now()}),{surveys:o,context:{isLoaded:!0}}}ju(){return this.zu()&&!this.Pu&&!this.Uu()}zu(){var t,n,r=(t=(n=this.Ns)!==null&&n!==void 0?n:this.Lu)==null?void 0:t.kv.get(lw);return qn(r)&&Date.now()-r>3e5}Uu(){return qn(this.Au)&&3e5>Date.now()-this.Au}markSurveyAsSeen(t,n){var r,a={id:t,current_iteration:(r=n?.iteration)!==null&&r!==void 0?r:null};yV(a);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}qu(t){for(var n of this.Ru)try{if(!t.isLoaded)return n([],t);this.getSurveys(n)}catch(r){Ws.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,n){if(n===void 0&&(n=!1),!cs(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,n);Ws.warn("init was not called")}Wu(t){var n=null;
4return this.getSurveys((r=>{var a;n=(a=r.find((i=>i.id===t)))!==null&&a!==void 0?a:null})),n}Vu(t){if(cs(this._surveyManager))return{eligible:!1,reason:vp};var n=typeof t=="string"?this.Wu(t):t;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Gu(t){if(cs(this._surveyManager))return{eligible:!1,reason:vp};var n=typeof t=="string"?this.Wu(t):t;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(cs(this._surveyManager))return Ws.warn("init was not called"),{visible:!1,disabledReason:vp};var n=this.Gu(t);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(t,n){return cs(this._surveyManager)?(Ws.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:vp})):new Promise((r=>{this.getSurveys((a=>{var i,o=(i=a.find((c=>c.id===t)))!==null&&i!==void 0?i:null;if(o){var l=this.Gu(o);r({visible:l.eligible,disabledReason:l.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),n)}))}renderSurvey(t,n,r){var a;if(cs(this._surveyManager))Ws.warn("init was not called");else{var i=typeof t=="string"?this.Wu(t):t;if(i!=null&&i.id)if(Gde.includes(i.type)){var o=Ke?.querySelector(n);if(o)if((a=i.appearance)!=null&&a.surveyPopupDelaySeconds){Ws.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds");var l=setTimeout((()=>{var c,u;this.Fu.delete(l),this.Os||(Ws.info("Rendering survey "+i.id+" with delay of "+((c=i.appearance)==null?void 0:c.surveyPopupDelaySeconds)+" seconds"),(u=this._surveyManager)==null||u.render
4Survey(i,o,r),Ws.info("Survey "+i.id+" rendered"))}),1e3*i.appearance.surveyPopupDelaySeconds);this.Fu.add(l)}else this._surveyManager.renderSurvey(i,o,r);else Ws.warn("Survey element not found")}else Ws.warn("Surveys of type "+i.type+" cannot be rendered in the app");else Ws.warn("Survey not found")}}displaySurvey(t,n){var r;if(cs(this._surveyManager))Ws.warn("init was not called");else{var a=this.Wu(t);if(a){var i=a;if((r=a.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(i=ze({},a,{appearance:ze({},a.appearance,{surveyPopupDelaySeconds:0})})),n.displayType!==lT.Popover&&n.initialResponses&&Ws.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){var o=this.Vu(a);if(!o.eligible)return void Ws.warn("Survey is not eligible to be displayed: ",o.reason)}n.displayType!==lT.Inline?this._surveyManager.handlePopoverSurvey(i,n):this.renderSurvey(i,n.selector,n.properties)}else Ws.warn("Survey not found")}}cancelPendingSurvey(t){cs(this._surveyManager)?Ws.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}function wp(e,t,n){if(cs(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 ghe{constructor(t){this.Zu=new Set,this.Qu=new Set,this.Ju=new gw,this.Ku=(n,r)=>this.Yu(n,r)&&this.Xu(n,r)&&this.th(n,r)&&this.eh(n,r),this.Yu=(n,r)=>r==null||!r.event||n?.event===r?.event,this._instance=t}init(){var t,n;Be((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ih=(n=this._instance)==null?void 0:n._addCaptureHook(((r,a)=>{this.on(r,a)})))}dispose(){var t;(t=this.ih)==null||t.call(this),this.ih=void 0,this.Ju=new gw}register(t){var n,r;if(!Be((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((i=>{var o;this.Zu.add(i),(o=i.steps)==null||o.forEach((l=>{this.Qu.add(l?.event||"")}))})),(r=this._instance)!=null&&r.autocapture)){var a=new Set;this.Zu.forEach((i=>{var o;(o=i.steps)==null||o.forEach((l=>{l!=null&&l.selector&&a.add(l.selector)}))})),this._instance.autocapture.setElementSelectors(a)}}replace(t){this.Zu.clear(),this.Qu.clear(),this.register(t)}on(t,n){n!=null&&t.length!=0&&(this.Qu.has(t)||this.Qu.has(n.event))&&this.Zu.forEach((r=>{this.rh(n,r)&&this.Ju.emit("actionCaptured",r.name)}))}nh(t){this.onAction("actionCaptured",(n=>t(n)))}rh(t,n){if(n?.steps==null)return!1;for(var r of n.steps)if(this.Ku(t,r))return!0;return!1}onAction(t,n){return this.Ju.on(t,n)}Xu(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"||!wp(a,n.url,n.url_matching||"contains"))return!1}return!0}th(t,n){return!!this.sh(t,n)&&!!this.oh(t,n)&&!!this.ah(t,n)}sh(t,n){var r;if(n==null||!n.href)return!0;var a=this.lh(t);if(a.length>0)return a.some((l=>wp(l.href,n.href,n.href_matching||"exact")));var i,o=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!o&&wp((i=o.match(/(?::|")href="(.*?)"/))?i[1]:"",n.href,n.href_matching||"exact")}oh(t,n){var r;if(n==null||!n.text)return!0;var a=this.lh(t);if(a.length>0)return a.some((u=>wp(u.text,n.text,n.text_matching||"exact")||wp(u.$el_text,n.text,n.text_matching||"exact")));var i,o,l,c=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!c&&(i=(function(u){for(var d,h=[],p=/(?::|")text="(.*?)"/g;!cs(d=p.exec(u));)h.includes(d[1])||h.push(d[1]);return h})(c),o=n.text,l=n.text_matching||"exact",i.some((u=>wp(u,o,l))))}ah(t,n){var r,a;if(n==null||!n.selector)return!0;var i=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(i!=null&&i.includes(n.selector))return!0;var o=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";if(n.selector_regex&&o)try{return new RegExp(n.selector_regex).test(o)}catch{return!1}return!1}lh(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t?.properties.$elements}eh(t,n){return n==null||!n.properties||n.properties.length===0||xV(n.properties.reduce(((r,a)=>{var i=Xt(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return r[a.key]={values:i,operator:a.operator||"exact"},r}),{}),t?.properties)}}class xhe{constructor(t){var n;this.uh=[],this._instance=t,this.hh=new Map,this.dh=new Map,this.fh=new Map,this.ph=(n=this._instance)==null||n.onSessionId==null?void 0:n.onSessionId((r=>this.gh(r)))}mh(t){return!1}yh(){return null}bh(t){}_h(){}wh(t,n){return!!t&&xV(t.propertyFilters,n?.properties)}kh(t,n){var r=new Map;return t.forEach((a=>{var i;(i=a.conditions)==null||(i=i[n])==null||(i=i.values)==null||i.forEac
4h((o=>{if(o!=null&&o.name){var l=r.get(o.name)||[];l.push(a.id),r.set(o.name,l)}}))})),r}Sh(t,n,r){var a=(r===pg.Activation?this.hh:this.dh).get(t),i=[];return this.xh((o=>{i=o.filter((l=>a?.includes(l.id)))})),i.filter((o=>{var l,c=(l=o.conditions)==null||(l=l[r])==null||(l=l.values)==null?void 0:l.find((u=>u.name===t));return this.wh(c,n)}))}register(t){this.Ch(t,!1)}replace(t){this.Ch(t,!0)}Ch(t,n){var r;Be((r=this._instance)==null?void 0:r._addCaptureHook)||(this.Th(t,n),this.Mh(t,n))}Mh(t,n){var r=t.filter((o=>{var l;return(l=o.conditions)==null||(l=l.actions)==null||(l=l.values)==null?void 0:l.length}));if(n&&this.fh.clear(),r.length!==0){this.Ih||(this.Ih=new ghe(this._instance),this.Ih.init(),this.Ih.nh((o=>this.onAction(o))));var a=[];r.forEach((o=>{var l;(l=o.conditions)==null||(l=l.actions)==null||l.values.forEach((c=>{if(a.push(c),c.name){var u,d=(u=this.fh.get(c.name))!==null&&u!==void 0?u:[];d.includes(o.id)||d.push(o.id),this.fh.set(c.name,d)}}))})),n?this.Ih.replace(a):this.Ih.register(a)}else{var i;n&&((i=this.Ih)==null||i.replace([]))}}Eh(t,n){n.forEach(((r,a)=>{var i,o=(i=t.get(a))!==null&&i!==void 0?i:[];r.forEach((l=>{o.includes(l)||o.push(l)})),t.set(a,o)}))}Th(t,n){var r,a,i=t.filter((u=>{var d,h;return((d=u.conditions)==null?void 0:d.events)&&((h=u.conditions)==null||(h=h.events)==null||(h=h.values)==null?void 0:h.length)>0})),o=t.filter((u=>{var d,h;return((d=u.conditions)==null?void 0:d.cancelEvents)&&((h=u.conditions)==null||(h=h.cancelEvents)==null||(h=h.values)==null?void 0:h.length)>0})),l=this.kh(t,pg.Activation),c=this.kh(t,pg.Cancellation);n?(this.hh=l,this.dh=c):(this.Eh(this.hh,l),this.Eh(this.dh,c)),(i.length!==0||o.length!==0)&&((r=this.ih)!==null&&r!==void 0||(this.ih=(a=this._instance)==null?void 0:a._addCaptureHook(((u,d)=>{this.onEvent(u,d)}))))}onEvent(t,n){var r,a,i=this.Rh(),o=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(a=n.properties)==null?void 0:a.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){var l=this.Ph(t,o);if(l==="consume")return i.info("event consumed activated item, removing it",{event:t,itemId:o}),void this.Ah([o]);if(l==="persist")return i.info("shown item promoted to persisted activation",{event:t,itemId:o}),this.Fh(o),void this.Oh([o])}if(this.dh.has(t)){var c=this.Sh(t,n,pg.Cancellation);c.length>0&&(i.info("cancel event matched, cancelling items",{event:t,itemsToCancel:c.map((d=>d.id))}),this.Ah(c.map((d=>d.id))),c.forEach((d=>this.Lh(d.id))))}if(this.hh.has(t)){i.info("event name matched",{event:t,eventPayload:n,items:this.hh.get(t)});var u=this.Sh(t,n,pg.Activation);this.Dh(u.map((d=>d.id)))}}onAction(t){this.fh.has(t)&&this.Dh(this.fh.get(t)||[])}Dh(t){var n;if(t.length!==0){var r=!((n=this._instance)==null||n.get_session_id==null||!n.get_session_id()),a=[];for(var i of t)r&&this.mh(i)?this.Fh(i)&&this.$h(i):a.push(i);a.length>0&&(this.uh=[...new Set([...this.uh,...a])]),this.Rh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Fh(t){this.uh=this.uh.filter((r=>r!==t));var n=this.Nh();return!n.includes(t)&&(this.qh([...n,t]),this.jh(),!0)}Ah(t){var n=new Set(t);this.uh=this.uh.filter((i=>!n.has(i)));var r=this.Bh(),a=r.filter((i=>!n.has(i)));a.length!==r.length&&(this.qh(a),a.length===0&&this.Hh()),this.Oh(t)}zh(){var t,n=this.yh();if(!n)return{};var r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n];return r&&typeof r=="object"?r:{}}$h(t){if(this.yh()){var n=this.zh();this.bh(ze({},n,{[t]:Date.now()}))}}Oh(t){if(this.yh()){var n=this.zh(),r={},a=!1;for(var i of Object.entries(n)){var o=i[0],l=i[1];t.includes(o)?a=!0:r[o]=l}a&&(gi(r)?this._h():this.bh(r))}}Uh(){this.yh()&&this._h()}getActivationTimestamp(t){if(this.Nh().includes(t)){var n=this.zh()[t];return qn(n)?n:void 0}}Bh(){var t,n=this.Wh();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}Nh(){var t,n,r=this.Bh();if(r.length===0)return[];var a=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Vh()],i=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return i&&a===i?r:[]}jh(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.Gh(n)}Hh(){this.Zh()}gh(t){var n,r=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Vh()];if(r&&r!==t){var a=this.Bh(),i=this.zh();a.length>0&&(this.qh([]),a.filter((o=>
4qn(i[o]))).forEach((o=>this.Lh(o)))),this.Hh(),this.Uh()}}getActivatedIds(){return[...new Set([...this.Nh(),...this.uh])].filter((t=>!this.Qh(t)))}dispose(){var t,n,r;(t=this.ph)==null||t.call(this),this.ph=void 0,(n=this.ih)==null||n.call(this),this.ih=void 0,(r=this.Ih)==null||r.dispose(),this.Ih=void 0}reset(){this.uh=[],this.Bh().length>0&&this.qh([]),this.Hh(),this.Uh()}getEventToItemsMap(){return this.hh}Jh(){return this.Ih}}class bhe extends xhe{constructor(t){super(t)}Wh(){return GC}Vh(){return Xv}yh(){return Jv}bh(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Jv]:t})}_h(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Jv)}mh(t){var n,r;this.xh((i=>{r=i.find((o=>o.id===t))}));var a=(n=r)==null||(n=n.appearance)==null?void 0:n.surveyPopupDelaySeconds;return qn(a)&&a>0}Kh(){return Kl.SHOWN}xh(t){var n;(n=this._instance)==null||n.getSurveys(t)}Lh(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}Rh(){return Ws}qh(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[GC]:t})}Gh(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Xv]:t})}Zh(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Xv)}Qh(){return!1}Ph(t,n){var r;this.xh((i=>{r=i.find((o=>o.id===n))}));var a=!r||(function(i){var o;return fV(i)&&!((o=i.conditions)==null||(o=o.events)==null||!o.repeatedActivation)||i.schedule==="always"})(r);return a?t===Kl.SHOWN?"consume":"ignore":t===Kl.SHOWN?"persist":t===Kl.DISMISSED||t===Kl.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class yhe{constructor(t){this._instance=t}initialize(){}get(t){if(typeof t=="string")return this._instance.get_property(t);var n={};for(var r of t){var a=this._instance.get_property(r);Be(a)||(n[r]=a)}return n}set(t,n){this._instance.register(typeof t=="string"?{[t]:n}:t)}remove(t){typeof t!="string"?t.forEach((n=>this._instance.unregister(n))):this._instance.unregister(t)}}class vhe{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=Bt?.__PosthogExtensions__;if(t){var n=t.generateSurveys,r=t.loadExternalDependency;return{generateSurveys:n?a=>n(this._instance,a):void 0,loadExternalDependency:r?a=>r(this._instance,"surveys",a):void 0}}}createEventReceiver(){return new bhe(this._instance)}}var whe=Ae!=null&&Ae.location?pw(Ae.location.hash,"__posthog")||pw(location.hash,"state"):null,FO="_postHogToolbarParams",BO=Sn("[Toolbar]"),UO=Sn("[FeatureFlags]");class jhe{constructor(t,n){n===void 0&&(n=!1),this.Yh=!1,this.update(t,n)}update(t,n){this.Xh=((r,a)=>{var i,o,l,c,u;return{bootstrap:{featureFlags:(i=r.bootstrap)==null?void 0:i.featureFlags,featureFlagPayloads:(o=r.bootstrap)==null?void 0:o.featureFlagPayloads},remoteRequestsDisabled:a,featureFlagsDisabled:!!r.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!r.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!r.advanced_feature_flags_dedup_per_session,cacheTtlMs:r.feature_flag_cache_ttl_ms,refreshIntervalMs:(l=r.remote_config_refresh_interval_ms)!==null&&l!==void 0?l:3e5,requestTimeoutMs:r.feature_flag_request_timeout_ms,compression:r.disable_compression?void 0:"best-available",evaluationContexts:(c=(u=r.evaluation_contexts)!==null&&u!==void 0?u:r.evaluation_environments)!==null&&c!==void 0?c:[],flagKeys:Xt(r.flag_keys)?r.flag_keys:void 0}})(t,n),!t.evaluation_environments||t.evaluation_contexts||this.Yh||(UO.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yh=!0),Be(t.flag_keys)||Xt(t.flag_keys)||UO.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Xh}}var zO=Sn("[FeatureFlags]"),Ju=Sn("[FeatureFlags]",{debugEnabled:!0}),nN=`" failed. Feature flags didn't load in time.`,HO="connection_error",qO=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},WO=e=>{var t={};for(var n of Qv(e||{})){var r=n[1];r&&(t[n[0]]=r)}return t},VO=e=>q5(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),so=Sn("[Error tracking]"),gT="webkit-masked-url:",_he=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",gT],khe=["__firefox__","__gCrWeb"],GO="Refusing to render web experiment since the viewer is a likely bot",Nhe={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>xw(t,e),not_regex:(e,t)=>!xw(t,e),exact:(e,t)=>
4t===e,is_not:(e,t)=>t!==e};class ca{get mn(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((a=>{ca.td("retrieved web experiments from the server"),n.ed=new Map,a.forEach((i=>{if(i.feature_flag_key){var o;n.ed&&(ca.td("setting flag key ",i.feature_flag_key," to web experiment ",i),(o=n.ed)==null||o.set(i.feature_flag_key,i));var l=n._instance.getFeatureFlag(i.feature_flag_key);ks(l)&&i.variants[l]&&n.rd(i.name,l,i.variants[l].transforms)}else if(i.variants)for(var c in i.variants){var u=i.variants[c];ca.nd(u,n._instance)&&n.rd(i.name,c,u.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())ca.td(GO);else if(!this.mn.disable_web_experiments){if(cs(this.ed))return this.ed=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ca.td("applying feature flags",t),t.forEach((n=>{var r;if(this.ed&&(r=this.ed)!=null&&r.has(n)){var a,i=this._instance.getFeatureFlag(n),o=(a=this.ed)==null?void 0:a.get(n);i&&o!=null&&o.variants[i]&&this.rd(o.name,i,o.variants[i].transforms)}}))}}previewWebExperiment(){var t=ca.getWindowLocation();if(t!=null&&t.search){var n=qm(t?.search,"__experiment_id"),r=qm(t?.search,"__experiment_variant");n&&r&&(ca.td("previewing web experiments "+n+" && "+r),this.getWebExperiments((a=>{this.sd(parseInt(n),r,a)}),!1,!0))}}loadIfEnabled(){this.mn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.mn.disable_web_experiments&&!r)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.mn.token),method:"GET",timestampMode:"query",callback:i=>t(i.statusCode===200&&i.json&&i.json.experiments||[])})}sd(t,n,r){var a=r.filter((i=>i.id===t));a&&a.length>0&&(ca.td("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.rd(a[0].name,n,a[0].variants[n].transforms))}static nd(t,n){return!cs(t.conditions)&&ca.od(t,n)&&ca.ad(t)}static od(t,n){var r;if(cs(t.conditions)||cs((r=t.conditions)==null?void 0:r.url))return!0;var a=ca.getWindowLocation();if(a){var i,o,l,c=IW(n,a.href);return(i=t.conditions)==null||!i.url||Nhe[(o=(l=t.conditions)==null?void 0:l.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,c)}return!1}
4static getWindowLocation(){return Ae?.location}static ad(t){var n;if(cs(t.conditions)||cs((n=t.conditions)==null?void 0:n.utm))return!0;var r=YW();if(r.utm_source){var a,i,o,l,c,u,d,h,p=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((i=t.conditions)==null||(i=i.utm)==null?void 0:i.utm_campaign)==r.utm_campaign,m=(o=t.conditions)==null||(o=o.utm)==null||!o.utm_source||((l=t.conditions)==null||(l=l.utm)==null?void 0:l.utm_source)==r.utm_source,g=(c=t.conditions)==null||(c=c.utm)==null||!c.utm_medium||((u=t.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,x=(d=t.conditions)==null||(d=d.utm)==null||!d.utm_term||((h=t.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==r.utm_term;return p&&g&&x&&m}return!1}static td(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;n>a;a++)r[a-1]=arguments[a];lt.info("[WebExperiments] "+t,r)}rd(t,n,r){this._is_bot()?ca.td(GO):n!=="control"?r.forEach((a=>{if(a.selector){var i;ca.td("applying transform of variant "+n+" for experiment "+t+" ",a);var o=(i=document)==null?void 0:i.querySelectorAll(a.selector);o?.forEach((l=>{var c=l;a.html&&(c.innerHTML=a.html),a.css&&c.setAttribute("style",a.css)}))}})):ca.td("Control variants leave the page unmodified.")}_is_bot(){return Cr&&this._instance?pV(Cr,this.mn.custom_blocked_useragents):void 0}}var Pi=Sn("[Conversations]"),Qu="Conversations not available yet.";function YO(e,t){var n,r,a,i,o,l,c,u=(n=e?.flushIntervalMs)!==null&&n!==void 0?n:3e3,d=(r=e?.maxBufferSize)!==null&&r!==void 0?r:100,h=t!=null&&t.consoleCapture?void 0:(a=e?.maxLogsPerInterval)!==null&&a!==void 0?a:1e3,p=Be(h)?Math.max(d,2048):Math.max(d,h),m=ze({},(function(){var g="",x="";try{var b=Cr?.userAgent;if(b){var y=oW(b);g=y[0],x=y[1]}}catch{}return(function(v,w){var j=(function(E){if(E)return{}.hasOwnProperty.call(G6,E)?G6[E]:E})(v);return ze({},j?{"os.name":j}:{},w?{"os.version":w}:{})})(g,x)})(),e?.resourceAttributes);return{serviceName:(i=(o=m?.["service.name"])!==null&&o!==void 0?o:e?.serviceName)!==null&&i!==void 0?i:t?.serviceNameDefault,serviceVersion:(l=m?.["service.version"])!==null&&l!==void 0?l:e?.serviceVersion,environment:(c=m?.["deployment.environment"])!==null&&c!==void 0?c:e?.environment,resourceAttributes:m,beforeSend:e?.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Ehe=["debug","log","warn","error","info"],KO="console",NV="__posthogHandledLogsRequestError",rN=(e,t)=>{var n=e instanceof Error?e:new Error(t);return n[NV]=!0,n},XO=e=>!!e&&typeof e=="object"&&e[NV]===!0,p_={featureFlags:class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=zO,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.We=()=>{var t=this.wd();this._d=0,t&&this.reloadFeatureFlags()},this.kd=()=>{var t,n=this.Sd;Be(n)||this.mn.remoteRequestsDisabled||!Ke||Ke.visibilityState==="hidden"||Date.now()-((t=this.xd)!==null&&t!==void 0?t:0)<n||(this.reloadFeatureFlags(),this.Cd())},this.Ve=()=>{Ke?.visibilityState==="visible"&&this.kd()},"get"in e?this.Ls=e:(this._instance=e,this.Td=new jhe(e.config,e.pa()),this.Ls=this.Td)}updateConfig(e,t){var n;(n=this.Td)==null||n.update(e,t),this.Ns&&this.Md()}setup(e){return this.Du=e,this.A=e.logger.createLogger("[FeatureFlags]"),kV(e.kv.initialize(),(()=>{this.Du===e&&(this.Du=void 0,this.Ns=e,this.Id(e))}))}Id(e){var t;if(this.Ns===e)return Ae&&nn(Ae,"online",this.We),this.Md(),this.Ed=e.registerDynamicEventProperties((()=>this.Rd()?this.ud:this.hd)),this.Pd=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.onCrossTabFeatureFlagChange((()=>{this.Ad(),this.Fd(),this.Od()})),this.Fd(),this.initialize()}Md(){var e=this.mn.refreshIntervalMs,t=!this.mn.remoteRequestsDisabled&&Ke&&!Be(e)&&e>0?e:void 0;t!==this.Sd&&(this.Ld(),Be(t)||(this.Sd=t,this.Cd(),Ke!=null&&Ke.addEventListener&&nn(Ke,zm,this.Ve)))}Cd(){Be(this.Sd)||(Be(this.Dd)||clearInterval(this.Dd),this.xd=Date.now(),this.Dd=setInterval(this.kd,this.Sd))}
4Ld(){Be(this.Dd)||(clearInterval(this.Dd),this.Dd=void 0,Ke==null||Ke.removeEventListener==null||Ke.removeEventListener(zm,this.Ve)),this.Sd=void 0,this.xd=void 0}destroy(){this.$d()}dispose(){this.$d()}$d(){var e,t;this.Ld(),this.pd++,this.md=!1,this.Du=void 0,this.Ns&&(this.Nd(),(e=this.Ed)==null||e.dispose(),this.Ed=void 0,(t=this.Pd)==null||t.call(this),this.Pd=void 0,this.dd=[],Ae?.removeEventListener("online",this.We),this.Ns=void 0)}get mn(){return this.Ls.get()}qd(e){var t;return this.jd&&e in this.jd?this.jd[e]:(t=this.Ns)==null?void 0:t.kv.get(e)}Ad(){return!!this.jd&&(this.jd=void 0,!0)}Bd(){var e;return!Be((e=this.Ns)==null?void 0:e.kv.get(Yr))&&this.Ad()}ni(e){this.Hd((()=>{var t;return(t=this.Ns)==null?void 0:t.kv.set(e)}))}zd(e,t,n){var r;if((r=this._instance)!=null&&r.persistence&&e[Yr]){var a=this.qd(Yr)||{},i=e[Yr]||{},o=t.flags||t.featureFlags,l=t.flags?Object.entries(t.flags).filter((y=>{var v=y[1];return!(v!=null&&v.failed)})).map((y=>y[0])):[],c=!!t.errorsWhileComputingFlags&&!!t.flags,u=c?l:n&&!Xt(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(a),...Object.keys(i)])),d=this.qd(ho)||{},h=e[ho]||{},p=c||n?u:Array.from(new Set([...Object.keys(d),...Object.keys(h)])),m=!c&&!n,g=!!m||u,x={[$i]:g,[Yr]:g,[ho]:!!m||p};for(var b of(e[ou]&&(x[ou]=g),[lu,Zl,Em]))Be(e[b])||(x[b]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(x)}}oi(e){this.Hd((()=>{var t;return(t=this.Ns)==null?void 0:t.kv.remove(e)}))}Hd(e){try{e()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Fd(){var e={};for(var t of[$i,ho,lu,Bo]){var n=this.qd(t);Be(n)||(e[t]=n)}this.ud=e;var r=ze({},e),a=this.qd(Yr);if(a)for(var i of Object.entries(a))r["$feature/"+i[0]]=i[1];this.hd=r}Rd(){var e=this.mn.cacheTtlMs;if(!e||0>=e)return!1;var t=this.qd(Zl);return typeof t!="number"||Date.now()-t>e}Ud(){return!!this.Rd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Wd(){var e=this.mn.evaluationContexts;return e!=null&&e.length?e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),n})):[]}Vd(){var e=this.mn.flagKeys;if(!Be(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),n}))}initialize(){var e,t,n=this.mn,r=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var a,i,o=(a=(i=n.bootstrap)==null?void 0:i.featureFlagPayloads)!==null&&a!==void 0?a:{},l=Object.keys(r).filter((u=>!Be(r[u]))).reduce(((u,d)=>(u[d]=r[d],u)),{}),c=Object.keys(o).filter((u=>l[u])).reduce(((u,d)=>(u[d]=o[d],u)),{});return this.Gd({featureFlags:l,featureFlagPayloads:c},void 0,{persist:!1})}}updateFlags(e,t,n){var r,a,i=n!=null&&n.merge&&(r=this.qd(Yr))!==null&&r!==void 0?r:{},o=n!=null&&n.merge&&(a=this.qd(ho))!==null&&a!==void 0?a:{},l=ze({},i,e),c=ze({},o,t),u={};for(var d of Object.entries(l)){var h=d[0],p=d[1];u[h]={key:h,enabled:z6(p),variant:H6(p),reason:void 0,metadata:Be(c?.[h])?void 0:{id:0,version:void 0,description:void 0,payload:c[h]}}}this.Gd({flags:u})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.qd(ou),t=this.qd(Bo),n=this.qd(jd);if(!n&&!t)return e||{};var r=cn({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var i of a){var o,l,c=r[i],u=t?.[i],d=Be(u)?(o=c?.enabled)!==null&&o!==void 0&&o:!!u,h=Be(u)?c?.variant:typeof u=="string"?u:void 0,p=n?.[i],m=ze({},c,{enabled:d,variant:d?h??c?.variant:void 0});d!==c?.enabled&&(m.original_enabled=c?.enabled),h!==c?.variant&&(m.original_variant=c?.variant),p&&(m.metadata=ze({},c?.metadata,{payload:p,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),r[i]=m}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ld=!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var r=e[n];return{key:n,enabled:z6(r),variant:H6(r),payload:U6(t[n])}}))}
4getFlagVariants(){var e=this.qd(Yr),t=this.qd(Bo);if(!t)return e||{};for(var n=cn({},e||{}),r=Object.keys(t),a=0;r.length>a;a++)n[r[a]]=t[r[a]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ld=!0),n}getFlagPayloads(){var e=this.qd(ho),t=this.qd(jd);if(!t)return e||{};for(var n=cn({},e||{}),r=Object.keys(t),a=0;r.length>a;a++)n[r[a]]=t[r[a]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ld=!0),n}reloadFeatureFlags(){this.gd||this.mn.featureFlagsDisabled||this.wd()||(this.fd&&(this.md=!0),this.Zd||(this.dd.slice().forEach((e=>{try{e()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}})),this.Zd=setTimeout((()=>{this.Qd()}),5)))}Nd(){clearTimeout(this.Zd),this.Zd=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter((t=>t!==e))}}ensureFlagsLoaded(){this.vd||this.fd||this.Zd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.gd=e}resetFlagCallReported(){this.oi(Gl)}Qd(e){this.Nd();var t=this.Ns;if(t&&!this.mn.remoteRequestsDisabled&&!this.wd())if(this.fd)this.md=!0;else{var n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ze({},t.initialPersonProperties,this.qd(di)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.qd(Yo),timezone:eV()};Be(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.mn.featureFlagsDisabled)&&(n.disable_flags=!0);var r=this.Wd();r.length&&(n.evaluation_contexts=r);var a=this.Vd();Be(a)||(n.flag_keys=a);var i=this.mn.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(i?"&only_evaluate_survey_feature_flags=true":""),l=this.pd;this.fd=!0;var c=()=>{this.md&&(this.md=!1,this.Qd())},u=d=>{this.fd=!1,l===this.pd&&(this.ni({[Sm]:[HO]}),this.A.error("Feature flag request failed",d),this.Bd()&&this.Od(!0)),c()};try{t.sendRequest(o,{target:"flags",method:"POST",body:n,compression:this.mn.compression,sentAt:"body",timeoutMs:this.mn.requestTimeoutMs}).then((d=>{var h,p,m=(h=d.json)!==null&&h!==void 0?h:{},g=d.statusCode!==200;if(this.fd=!1,l===this.pd){if(this.Jd(d.statusCode),g||this.md||(this.$anon_distinct_id=void 0),!n.disable_flags||this.md){this.yd=!g;var x=[];d.error?x.push(d.error instanceof Error&&d.error.name==="AbortError"?"timeout":d.error instanceof Error?HO:"unknown_error"):d.statusCode!==200&&x.push("api_error_"+d.statusCode),m.errorsWhileComputingFlags&&x.push("errors_while_computing_flags");var b=!((p=m.quotaLimited)==null||!p.includes("feature_flags"));b&&x.push("quota_limited"),this.ni({[Sm]:x}),b?this.A.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."):n.disable_flags||this.Gd(m,g,{partialResponse:i}),c()}}else c()})).catch(u)}catch(d){u(d)}}}wd(){return VW(this._d,3)}Jd(e){this._d=GW(e,this._d,3,(()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Ud()){var r=this.getFeatureFlagResult(e,t);return(n=r?.variant)!==null&&n!==void 0?n:r?.enabled}}else this.A.warn('getFeatureFlag for key "'+e+nN)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Ud()){var n,r=this.getFlagVariants(),a=e in r,i=r[e],o=this.getFlagPayloads()[e],l=String(i),c=this.qd(lu)||void 0,u=this.qd(Zl)||void 0,d=this.qd(Gl)||{};if(this.mn.deduplicateCallsPerSession){var h,p=(h=this.Ns)==null?void 0:h.session.sessionId,m=this.qd(Qg);p&&p!==m&&(d={},n=p)}if(t.send_event||!("send_event"in t))if(e in d&&d[e].includes(l))n&&this.ni({[Gl]:d,[Qg]:n});else{var g,x,b,y,v,w,j,E,S,_,k,C;Xt(d[e])?d[e].push(l):d[e]=[l],this.ni(ze({[Gl]:d},n?{[Qg]:n}:{}));var N=this.getFeatureFlagDetails(e),A=[...(g=this.qd(Sm))!==null&&g!==void 0?g:[]];Be(i)&&A.push("flag_missing");var T={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:o??null,$feature_flag_request_id:c,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:(x=(b=this.mn.bootstrap)==null||(b=b.featureFlags)==null?void 0:b[e])!==null&&x!==void 0?x:null,$feature_flag_bootstrapped_payload:(y=(v=this.mn.bootstrap)==null||(v=v.featureFlagPayloads)==null?void 0:v[e])!==null&&y!==void 0?y:null,$used_bootstrap_value:!this.yd};Be(N==null||(w=N.metadata)==null?void 0:w.has_experiment)||(T.$feature_flag_has_experiment=N.metadata.has_experiment),Be(N==null||(j=N.metadata)==null?void 0:j.version)||(T.$feature_flag_version=N.metadata.version);var I,$=(E=N==null||(S=N.reason)==null?void 0:S.description)!==null&&E!==void 0?E:N==null||(_=N.reason)==null?void 0:_.code;$&&(T.$feature_flag_reason=$),N!=null&&(k=N.metadata)!=null&&k.id&&(T.$feature_flag_id=N.metadata.id),Be(N?.original_variant)&&Be(N?.original_enabled)||(T.$feature_flag_original_response=Be(N.original_variant)?N.original_enabled:N.original_variant),N!=null&&(C=N.metadata)!=null&&C.original_payload&&(T.$feature_flag_original_payload=N==null||(I=N.metadata)==null?void 0:I.original_payload),A.length&&(T.$feature_flag_error=A.join(",")),this.Kd(T)}else n&&this.ni({[Gl]:d,[Qg]:n});if(a)return{key:e,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:U6(o)}}}else this.A.warn('getFeatureFlagResult for key "'+e+nN)}Kd(e){try{var t;(t=this.Ns)==null||t.capture("$feature_flag_called",e).catch((n=>{this.A.error("Failed to capture feature flag call",n)}))}catch(n){this.A.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.Yd(e,t)}Yd(e,t){var n=this;return un((function*(){var r=n.Ns;if(r){var a={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},i=n.Wd();i.length&&(a.evaluation_contexts=i);var o,l=n.Vd();Be(l)||(a.flag_keys=l);try{var c,u=(c=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:a,compression:n.mn.compression,sentAt:"body",timeoutMs:n.mn.requestTimeoutMs})).json)==null?void 0:c.featureFlagPayloads;o=u?.[e]||void 0}catch(d){return void n.A.error("Remote config feature flag request failed",d)}try{t(o)}catch(d){n.A.error("Remote config feature flag callback failed",d)}}}))()}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.yd)return t.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+nN),t.defaultValue;var n=this.getFeatureFlag(e,t);return Be(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}
4receivedFeatureFlags(e,t,n){this.Gd(e,t,n)}Gd(e,t,n){if(this.Ns){this.vd=!0;var r=(function(i,o,l,c,u,d){o===void 0&&(o={}),l===void 0&&(l={}),c===void 0&&(c={}),d===void 0&&(d=zO);var h=((N,A)=>{var T=N.flags;return T?ze({},N,{featureFlags:Object.fromEntries(Object.keys(T).map((I=>{var $;return[I,($=T[I].variant)!==null&&$!==void 0?$:T[I].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(T).filter((I=>T[I].enabled)).filter((I=>{var $;return!Be(($=T[I].metadata)==null?void 0:$.payload)})).map((I=>{var $;return[I,($=T[I].metadata)==null?void 0:$.payload]})))}):(N.featureFlags&&A.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),N)})(i,d),p=h.flags,m=h.featureFlags,g=h.featureFlagPayloads;if(m){var x=i.requestId,b=i.evaluatedAt;if(Xt(m)){d.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var y={};if(m)for(var v=0;m.length>v;v++)y[m[v]]=!0;return{[$i]:m,[Yr]:y,[Em]:!1}}var w=m,j=g,E=p;if(u!=null&&u.partialResponse){var S=Object.keys(w),_=j||{};w=ze({},o,w),j=ze({},l,_),S.forEach((N=>{var A;N in _||(A=j)==null||delete A[N]})),E=ze({},c,E)}else if(i.errorsWhileComputingFlags)if(p){var k=new Set(Object.keys(p).filter((N=>{var A;return!((A=p[N])!=null&&A.failed)})));w=ze({},o,Object.fromEntries(Object.entries(w).filter((N=>k.has(N[0])))));var C=Object.fromEntries(Object.entries(j||{}).filter((N=>k.has(N[0]))));j=ze({},l,C),k.forEach((N=>{var A;N in C||(A=j)==null||delete A[N]})),E=ze({},c,Object.fromEntries(Object.entries(E||{}).filter((N=>k.has(N[0])))))}else w=ze({},o,w),j=ze({},l,j),E=ze({},c,E);return ze({[$i]:Object.keys(WO(w)),[Yr]:w||{},[ho]:j||{},[ou]:E||{},[Em]:i.minimalFlagCalledEvents===!0},x?{[lu]:x}:{},b?{[Zl]:b}:{})}})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.A);if(r)if(n?.persist===!1){var a=!Be(this.Ns.kv.get(Yr));this.jd=r,a||this.ni(r)}else this.Ad(),this.zd(r,e,!(n==null||!n.partialResponse)),this.ni(r);else t&&this.Bd();t||(this.bd=!1),this.Od(t)}}override(e,t){t===void 0&&(t=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Xd(e)}Xd(e){if(this.Ns){if(e===!1)return this.oi([Bo,jd]),this.Od(),void Ju.info("All overrides cleared");if(Xt(e))return this.ni({[Bo]:qO(e)}),this.Od(),void Ju.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;this.ld=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);var r={},a=n.flags,i=n.payloads;return a&&(r[Bo]=Xt(a)?qO(a):a),i&&(r[jd]=i),Object.keys(r).length&&this.ni(r),a===!1&&i===!1?this.oi([Bo,jd]):a===!1?this.oi(Bo):i===!1&&this.oi(jd),this.Od(),a===!1?Ju.info("Flag overrides cleared"):a&&Ju.info("Flag overrides set",{flags:a}),void(i===!1?Ju.info("Payload overrides cleared"):i&&Ju.info("Payload overrides set",{payloads:i}))}if(e&&typeof e=="object")return this.ni({[Bo]:e}),this.Od(),void Ju.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.vd){var t=this.tv(),n=t.flags,r=t.flagVariants;try{e(n,r)}catch(a){this.A.error("Error while running feature flags callback",a)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,a=(this.qd(Kv)||[]).find((u=>u.flagKey===e)),i={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:i};a&&(o.$early_access_feature_name=a.name),n&&(o.$feature_enrollment_stage=n);var l=ze({},this.getFlagVariants(),{[e]:t});(r=this._instance)==null||(r=r.persistence)==null||r.markCrossTabFeatureFlagChanges({[$i]:[e],[Yr]:[e],[di]:Object.keys(i)}),this.ni({[$i]:Object.keys(WO(l)),[Yr]:l,[di]:ze({},this.qd(di)||{},i)}),this.Od();try{var c;(c=this.Ns)==null||c.capture("$feature_enrollment_update",o).catch((u=>{this.A.error("Failed to capture early access feature enrollment",u)}))}catch(u){this.A.error("Failed to capture early access feature enrollment",u)}}
4getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.qd(Kv);!r||t?this.ev(e,n):e(r)}ev(e,t){var n=this;return un((function*(){var r=n.Ns;if(r){var a,i=t?"&"+t.map((l=>"stage="+l)).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+i,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;n.ni({[Kv]:a=o.json.earlyAccessFeatures})}catch(l){return void n.A.error("Early access feature request failed",l)}try{e(a)}catch(l){n.A.error("Early access feature callback failed",l)}}}))()}tv(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,r)=>(n[r]=t[r],n)),{})}}Od(e){this.Fd();var t=this.tv(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((a=>{try{a(n,r,{errorsLoading:e})}catch(i){this.A.error("Error while running feature flags callback",i)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.iv(e,t)}iv(e,t){t===void 0&&(t=!0);var n=this.qd(di)||{},r=e?.$set||(e!=null&&e.$set_once?{}:e),a=e?.$set_once,i={};if(a)for(var o in a)({}).hasOwnProperty.call(a,o)&&(o in n||(i[o]=a[o]));this.ni({[di]:ze({},n,i,r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=ze({},this.qd(di)||{});e.forEach((r=>{delete n[r]})),this.ni({[di]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this.oi(di),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.qd(Yo)||{},r=ze({},n);for(var a of Object.keys(e))r[a]=ze({},n[a],e[a]);this.ni({[Yo]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.qd(Yo)||{};this.ni({[Yo]:ze({},t,{[e]:{}})})}else this.oi(Yo)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.jd=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Nd(),this.ld=!1,this._d=0}}},She={sessionRecording:class{get mn(){return this._instance.config}get Ba(){return this._instance.persistence}get started(){var e;return!((e=this.rv)==null||!e.isStarted)}get status(){var e,t;return this.nv===bg||this.nv===yy?this.nv:(e=(t=this.rv)==null?void 0:t.status)!==null&&e!==void 0?e:this.nv}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.nv=by,this.sv=void 0,this.ov=!1,this.je=(()=>{var t;if(Ke==null||!Ke.visibilityState||Ke.visibilityState==="visible")return!0;var n=Ae==null||(t=Ae.performance)==null||t.getEntriesByType==null?void 0:t.getEntriesByType("visibility-state");return!(n!=null&&n.length)||n.some((r=>r.name==="visible"))})(),this.Ve=()=>{var t;Ke?.visibilityState==="visible"&&(this.je=!0,(t=this.rv)==null||t.setDocumentWasEverVisible==null||t.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Sl.error("started without valid sessionManager"),new Error(fT+" started without valid sessionManager. This is a bug.");if(this.mn.cookieless_mode===Yl)throw new Error(fT+' cannot be used with cookieless_mode="always"');Ke!=null&&Ke.addEventListener&&nn(Ke,"visibilitychange",this.Ve)}initialize(){this.startIfEnabledOrStop()}dispose(e){var t=(e===void 0?{}:e).discardBufferedEvents,n=t!==void 0&&t;this.ov=!0,Ke==null||Ke.removeEventListener==null||Ke.removeEventListener("visibilitychange",this.Ve),n?this.av(!0):this.stopRecording()}get lv(){var e,t=!((e=this._instance.get_property(Ud))==null||!e.enabled),n=!this.mn.disable_session_recording,r=this.mn.disable_session_recording||this._instance.consent.isOptedOut();return Ae&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!(this.ov||this.lv&&(t=this.rv)!=null&&t.isStarted)){var n=!Be(Object.assign)&&!Be(Array.from);this.lv&&n?(this.uv(e),Sl.info("starting")):(this.nv=by,this.stopRecording())}}uv(e){var t,n;if(this.lv)if(this.nv!==bg&&this.nv!==yy&&(this.nv=MO),Bt!=null&&(t=Bt.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Bt.__PosthogExtensions__)!=null&&n.initSessionRecording)this.hv(e);else{var r,a=this._instance.sessionManager;(r=Bt.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.dv,(i=>{if(!this.ov&&this.lv&&this._instance.sessionManager===a)return i?(this._instance.register_for_session({[QC]:!0}),Sl.error("could not load recorder",i)):void this.hv(e);this.nv=by}))}}stopRecording(){var e,t;(e=this.sv)==null||e.call(this),this.sv=void 0,(t=this.rv)==null||t.stop()}av(e){var t,n;e===void 0&&(e=!1),(t=this.sv)==null||t.call(this),this.sv=void 0,(n=this.rv)==null||n.discard({discardProducerEvents:e})}vv(){var e,t;(e=this.Ba)==null||e.unregister(e4),(t=this.Ba)==null||t.unregister(wW)}fv(e,t){if(cs(e))return null;var n,r=qn(e)?e:parseFloat(e);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(Sl.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}pv(e){if(this.Ba){var t,n,r=this.Ba,a=()=>{var i,o=e.sessionRecording===!1?void 0:e.sessionRecording,l=this.fv((i=this.mn.session_recording)==null?void 0:i.sampleRate,"session_recording.sampleRate"),c=this.fv(o?.sampleRate,"remote config sampleRate"),u=l??c;cs(u)&&this.vv();var d=o?.minimumDurationMilliseconds;r.register({[Ud]:ze({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:ze({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:Be(d)?null:d,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};a(),(t=this.sv)==null||t.call(this),this.sv=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(a)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.pv(t),void this.av()):(this.pv(t),void this.startIfEnabledOrStop()):(this.nv===bg&&(this.nv=yy,Sl.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.rv)!=null&&n.log?this.rv.log(e,t):Sl.warn("log called before recorder was ready")}get dv(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Ud);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}gv(){var e,t=this._instance.get_property(Ud);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return Sl.warn("persisted remote config for session recording is invali
4d and will be ignored",n),!1}return!cs(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}hv(e){var t,n,r;if(!this.ov&&this.lv&&this._instance.sessionManager){if((t=Bt.__PosthogExtensions__)==null||!t.initSessionRecording)return Sl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[QC]:!0});var a;if(this.rv||(this.rv=(a=Bt.__PosthogExtensions__)==null?void 0:a.initSessionRecording(this._instance,this.je),this.rv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.gv())return this.nv===yy||this.nv===bg?void 0:(this.nv=bg,Sl.info("persisted remote config is stale, requesting fresh config before starting"),void new tV(this._instance).load());this.nv=MO,(n=(r=this.rv).setDocumentWasEverVisible)==null||n.call(r,this.je),this.rv.start(e)}else this.nv=by}onRRwebEmit(e){var t;(t=this.rv)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.rv||(t=this.Ba)==null||t.register({[_W]:!0}),(e=this.rv)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.rv||(t=this.Ba)==null||t.register({[jW]:!0}),(e=this.rv)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.rv||(n=this.Ba)==null||n.register({[e==="url"?kW:NW]:!0}),(t=this.rv)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.rv)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.rv)==null||!n.tryAddCustomEvent(e,t))}}},Che={autocapture:class extends lhe{constructor(e){super(new che(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.mv=this.yv()}initialize(){this.startIfEnabled()}get isEnabled(){var e=this.bv();return!!(e.path||e.search||this._v(e))}startIfEnabled(){this.isEnabled&&(lt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.mv=this.yv(),this.startIfEnabled()}stop(){this.wv&&this.wv(),this.wv=void 0,this.Sv&&this.Sv(),this.Sv=void 0,lt.info("History API monitoring stopped")}monitorHistoryChanges(){Ae&&Ae.history&&(this.xv("pushState"),this.xv("replaceState"),this.Cv(),this._v()&&this.Tv())}xv(e){var t;if(Ae&&((t=Ae.history[e])==null||!t.__posthog_wrapped__)){var n=this;_V(Ae.history,e,(r=>function(a,i,o){r.call(this,a,i,o),n.Mv(e)}))}}yv(){var e=Ae?.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}bv(){var e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:ys(e)?e:{}}_v(e){return e===void 0&&(e=this.bv()),!!e.hash&&!this._instance.config.disable_capture_url_hashes}Iv(e){var t=this.bv(),n=this.mv;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this._v(t)&&e.hash!==n.hash))}Mv(e){try{var t=this.yv();if(!t)return;this.Iv(t)&&this._instance.capture(dm,{navigation_type:e}),this.mv=t}catch(n){lt.error("Error capturing "+e+" pageview",n)}}Cv(){if(!this.wv){var e=()=>{this.Mv("popstate")};nn(Ae,"popstate",e),this.wv=()=>{Ae&&Ae.removeEventListener("popstate",e)}}}Tv(){if(!this.Sv){var e=()=>{this.Mv("hashchange")};nn(Ae,"hashchange",e),this.Sv=()=>{Ae&&Ae.removeEventListener("hashchange",e)}}}},heatmaps:class{get mn(){return this.instance.config}constructor(e){var t;this.Ev=!1,this.Rs=!1,this.Rv=null,this.instance=e,this.Ev=!((t=this.instance.persistence)==null||!t.props[FC]),this.rageclicks=new jV(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return ys(this.mn.capture_heatmaps)&&this.mn.capture_heatmaps.flush_interval_milliseconds&&(e=this.mn.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return cs(this.mn.capture_heatmaps)?cs(this.mn.enable_heatmaps)?this.Ev:this.mn.enable_heatmaps:this.mn.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;phe.info("starting..."),this.Pv(),this.Ve()}else{var e;clearInterval((e=this.Rv)!==null&&e!==void 0?e:void 0),this.Av(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[FC]:n}),this.Ev=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.De;return this.De=void 0,e}Fv(e){tN(e.originalEvent)&&this.Xi(e.originalEvent,"deadclick")}Ve(){this.Rv&&clearInterval(this.Rv),this.Rv=Ke?.visibilityState==="visible"?setInterval(this.Pa.bind(this),this.flushIntervalMilliseconds):null}Pv(){Ae&&Ke&&(this.Ov=this.Pa.bind(this),nn(Ae,uw,this.Ov),this.Lv=e=>
4this.Xi(e||Ae?.event),nn(Ke,"click",this.Lv,{capture:!0}),this.Dv=e=>this.$v(e||Ae?.event),nn(Ke,"mousemove",this.Dv,{capture:!0}),this.Nv=new hO(this.instance,yde,this.Fv.bind(this)),this.Nv.startIfEnabledOrStop(),this.qv=this.Ve.bind(this),nn(Ke,zm,this.qv),this.Rs=!0)}Av(){var e;Ae&&Ke&&(this.Ov&&Ae.removeEventListener(uw,this.Ov),this.Lv&&Ke.removeEventListener("click",this.Lv,{capture:!0}),this.Dv&&Ke.removeEventListener("mousemove",this.Dv,{capture:!0}),this.qv&&Ke.removeEventListener(zm,this.qv),clearTimeout(this.jv),(e=this.Nv)==null||e.stop(),this.Rs=!1)}Bv(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),i=(function(o,l,c){for(var u=o;u&&vu(u)&&!_i(u,"body");){if(u===c)return!1;var d=void 0;try{var h,p,m;d=(h=(p=(m=u.ownerDocument)==null?void 0:m.defaultView)!==null&&p!==void 0?p:Ae)==null?void 0:h.getComputedStyle(u).position}catch{return!1}if(ns(l,d))return!0;u=$W(u)}return!1})(aT(e),["fixed","sticky"],a);return{x:e.clientX+(i?0:r),y:e.clientY+(i?0:n),target_fixed:i,type:t}}Xi(e,t){var n;if(t===void 0&&(t="click"),!sO(e.target)&&tN(e)){var r=this.Bv(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&BW(aT(e),this.instance.config.rageclick)&&this.ks(ze({},r,{type:"rageclick"})),this.ks(r)}}$v(e){!sO(e.target)&&tN(e)&&(clearTimeout(this.jv),this.jv=setTimeout((()=>{this.ks(this.Bv(e,"mousemove"))}),500))}ks(e){if(Ae){var t=this.mn.disable_capture_url_hashes?yu(Ae.location.href):Ae.location.href,n=this.mn.custom_personal_data_properties,r=this.mn.mask_personal_data_properties?[...Wm,...n||[]]:[],a=lb(t,r,cb);this.De=this.De||{},this.De[a]||(this.De[a]=[]),this.De[a].push(e)}}Pa(){this.De&&!gi(this.De)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:hO,webVitalsAutocapture:class{constructor(e){var t;this.Ev=!1,this.Rs=!1,this.De={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hv=()=>{clearTimeout(this.zv),this.zv=void 0,this.De.metrics.length!==0&&(this._instance.capture("$web_vitals",ze({$current_url:this.De.url},this.De.metrics.reduce(((n,r)=>ze({},n,{["$web_vitals_"+r.name+"_event"]:ze({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{}))),this.De={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uv=n=>{var r;if(this.De=this.De||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},cs(n?.name)||cs(n?.value))Xu.error("Invalid metric received",n);else{var a=typeof n.navigationURL=="string"?n.navigationURL:void 0,i=this.Wv(a);if(!Be(i)){var o=qn(n.navigationId)||typeof n.navigationId=="string"?"navigation:"+n.navigationId:"url:"+i;if(!this.Vv||this.Vv>n.value){this.De.navigationKey!==o&&(this.Hv(),this.zv=setTimeout(this.Hv,this.flushToCaptureTimeoutMs)),Be(this.De.navigationKey)&&(this.De.navigationKey=o,this.De.url=i),this.De.firstMetricTimestamp=Be(this.De.firstMetricTimestamp)?Date.now():this.De.firstMetricTimestamp;var l=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),c=ze({},n,a?{navigationURL:i}:{},{$current_url:i,timestamp:Date.now()});if(delete c.entries,ys(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){var u={};for(var d of hhe){var h=d==="url"&&typeof n.attribution[d]=="string"?this.Wv(n.attribution[d]):n.attribution[d];Be(h)||(u[d]=h)}c.attribution=u}else delete c.attribution;Be(l)||(c.$session_id=l.sessionId,c.$window_id=l.windowId),this.De.metrics.push(c),this.De.metrics.length===this.allowedMetrics.length&&this.Hv()}else Xu.error("Ignoring metric with value >= "+this.Vv,n)}}},this.Gv=()=>{if(!this.Rs){var n,r,a,i,o=!1,l=Bt.__PosthogExtensions__,c=l?.postHogWebVitalsCallbacksByFlavor,u=c?.[this.Zv]||(this.Zv==="web-vitals"&&Be(c)?l?.postHogWebVitalsCallbacks:void 0);if(!Be(u)){var d=u.withoutAttribution,h=this.attributionMetrics;o=!Be(d),n=h.indexOf("LCP")>-1?u.onLCP:d?.onLCP||u.onLCP,r=h.indexOf("CLS")>-1?u.onCLS:d?.onCLS||u.onCLS,a=h.indexOf("FCP")>-1?u.onFCP:d?.onFCP||u.onFCP,i=h.indexOf("INP")>-1?u.onINP:d?.onINP||u.onINP}if(n&&r&&a&&i){var p={reportSoftNavs:this.useSoftNavs},m=o&&this.attributionMetrics.indexOf("INP")>-1?ze({},p,{includeProcessedEventEntries:!1}):p;this.allowedMetrics.indexOf("LCP")>-1&&n(this.Uv.bind(this),p),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Uv.bind(this),p),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Uv.bind(this),p),this.allowedMetrics.indexOf("INP")>-1&&i(this.Uv.bind(this),m),this.Rs=!0}else Xu.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Ev=!((t=this._instance.persistence)==null||!t.props[HC]),this.startIfEnabled()}get Qv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=ys(this.Qv)?(e=this.Qv)==null?void 0:e.web_vitals_allowed_metrics:void 0;return cs(n)?((t=this._instance.persistence)==null?void 0:t.props[WC])||OO:n}get flushToCaptureTimeoutMs(){return(ys(this.Qv)?this.Qv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var e=ys(this.Qv)?this.Qv.web_vitals_attribution:void 0;return Pa(e)?e?OO:[]:Xt(e)?e:dhe}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var e=ys(this.Qv)?this.Qv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Vv(){var e=ys(this.Qv)&&qn(this.Qv.__web_vitals_max_value)?this.Qv.__web_vitals_max_value:LO;return e>0&&6e4>=e?LO:e}get isEnabled(){var e=In?.protocol;if(e!=="http:"&&e!=="https:")return Xu.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ys(this.Qv)?this.Qv.web_vitals:Pa(this.Qv)?this.Qv:void 0;return Pa(t)?t:this.Ev}startIfEnabled(){this.isEnabled&&!this.Rs&&(Xu.info("enabled, starting..."),this.Ys(this.Gv))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=ys(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=ys(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[HC]:n}),this._instance.persistence.register({[WC]:r})),this.Ev=n,this.startIfEnabled()}}}get Zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ys(e){var t=Bt.__PosthogExtensions__,n=this.Zv,r=t?.postHogWebVitalsCallbacksByFlavor;r!=null&&r[n]||n==="web-vitals"&&Be(r)&&t!=null&&t.postHogWebVitalsCallbacks?e():t==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,n,(a=>{a?Xu.error("failed to load script",a):e()}))}Wv(e){var t=e||Ae?.location.href;if(t){var n=this._instance.config.disable_capture_url_hashes?yu(t):t,r=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...Wm,...r||[]]:[];return lb(n,a,cb)}Xu.error("Could not determine current URL")}}},The={exceptionObserver:class{constructor(e){var t;this.Gv=()=>{var n;if(Ae&&this.isEnabled&&(n=Bt.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var r=Bt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Bt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=Bt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Jv&&this.mn.capture_unhandled_errors&&(this.Jv=r(this.captureException.bind(this))),!this.Kv&&this.mn.capture_unhandled_rejections&&(this.Kv=a(this.captureException.bind(this))),!this.Yv&&this.mn.capture_console_errors&&(this.Yv=i(this.captureException.bind(this)))}catch(o){xg.error("failed to start",o),this.Xv()}}},this._instance=e,this.tc=!((t=this._instance.persistence)==null||!t.props[BC]),this.wt=new aue(ze({},(function(n){var r,a,i,o;return n===void 0&&(n={}),{refillRate:(r=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(i=(o=n.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:n.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10}})(this._instance.config.error_tracking),{refillInterval:1e4,A:xg})),this.mn=this.ec(),this.startIfEnabledOrStop()}ec(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ys(e)?t=ze({},t,e):(Be(e)?this.tc:e)&&(t=ze({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.mn.capture_console_errors||this.mn.capture_unhandled_errors||this.mn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(xg.info("enabled"),this.Xv(),this.Ys(this.Gv)):this.Xv()}Ys(e){var t,n;(t=Bt.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Bt.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return xg.error("failed to load script",r);e()}))}Xv(){var e,t,n;(e=this.Jv)==null||e.call(this),this.Jv=void 0,(t=this.Kv)==null||t.call(this),this.Kv=void 0,(n=this.Yv)==null||n.call(this),this.Yv=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.tc=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[BC]:this.tc}),this.mn=this.ec(),this.startIfEnabledOrStop())}}onConfigChange(){this.mn=this.ec()}captureException(e){try{var t,n,r,a=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(a))return void xg.info("Skipping exception capture because of client rate limiting.",{exception:a});(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,n;this.ic=[],this.rc=new wue([new Tue,new $ue,new Rue,new Aue,new Mue,new Oue,new Pue,new Due],(function(r){for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;a>o;o++)i[o-1]=arguments[o];return function(l,c){c===void 0&&(c=0);for(var u=[],d=l.split(` 5`),h=c;d.length>h;h++){var p=d[h];if(1024>=p.length){var m=B6.test(p)?p.replace(B6,"$1"):p;if(!m.match(/\S*Error: /)){for(var g of i){var x=g(m,r);if(x){u.push(x);break}}if(u.length>=50)break}}}return(function(b){if(!b.length)return[];var y=Array.from(b);return y.reverse(),y.slice(0,50).map((v=>{return ze({},v,{filename:v.filename||(w=y,w[w.length-1]||{}).filename,function:v.function||Um});var w}))})(u)}})("web:javascript",Nue,Cue)),this._instance=e,this.ic=(t=(n=this._instance.persistence)==null?void 0:n.get_property(UC))!==null&&t!==void 0?t:[],this.nc=aw(this.sc()),this.oc=new Bue(this.nc)}onConfigChange(){this.nc=aw(this.sc()),this.oc.setConfig(this.nc)}onRemoteConfig(e){var t,n,r;if(e.ok){var a=e.config;if("errorTracking"in a){var i=(t=(n=a.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],o=(r=a.errorTracking)==null?void 0:r.captureExtensionExceptions;this.ic=i,this._instance.persistence&&this._instance.persistence.register({[UC]:this.ic,[zC]:o})}}}get ac(){var e,t=!!this._instance.get_property(zC),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.rc.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.nc.enabled)try{if(!ks(e)||e.trim().length===0)return void so.warn("Ignoring exception step because message must be a non-empty string");var n=(function(i){if(!i)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(i).reduce(((l,c)=>Fue.has(c)?(o.push(c),l):(l[c]=i[c],l)),{}),droppedKeys:o}})(this.lc(t)),r=n.sanitizedProperties,a=n.droppedKeys;a.length>0&&so.warn("Ignoring reserved exception step fields",{droppedKeys:a}),this.oc.add(ze({[nw]:e,[rw]:new Date().toISOString()},r))}catch(i){so.error("Failed to add exception step. Ignoring breadcrumb.",i)}}sendExceptionEvent(e){try{var t=e.$exception_list;
5if(this.uc(t)){if(this.hc(t))return this.dc("Exception dropped: matched a suppression rule"),void so.info("Skipping exception capture because a suppression rule matched");if(!this.ac&&this.vc(t))return this.dc("Exception dropped: thrown by a browser extension"),void so.info("Skipping exception capture because it was thrown by an extension");if(!this.ac&&this.cc(t))return this.dc("Exception dropped: thrown by an injected browser script"),void so.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.fc(t))return this.dc("Exception dropped: thrown by the PostHog SDK"),void so.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.nc.enabled&&cs(e.$exception_steps)?this.gc(e):e,r=typeof(i=globalThis._posthogReleaseId)=="string"&&i.length>0?i:void 0;r&&(n.$release_id=r);try{var a=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",gu:!0});return a&&this.oc.clear(),a}catch(o){return VO(o)||so.error("Failed to capture exception event. Dropping this exception.",o),void this.oc.clear()}}catch(o){return void(VO(o)||so.error("Failed to process exception event. Ignoring this exception.",o))}var i}gc(e){try{var t=this.oc.getAttachable();return t.length===0?e:ze({},e,{$exception_steps:t})}catch(n){return so.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}dc(e){this.nc.enabled&&this.oc.add({[nw]:e,[rw]:new Date().toISOString()})}lc(e){return ys(e)?ze({},e):{}}sc(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}hc(e){if(e.length===0)return!1;try{var t=e.reduce(((n,r)=>{var a=r.type,i=r.value;return ks(a)&&a.length>0&&n.$exception_types.push(a),ks(i)&&i.length>0&&n.$exception_values.push(i),n}),{$exception_types:[],$exception_values:[]});return this.ic.some((n=>{var r=n.values.map((a=>{var i=gV[a.operator],o=t[a.key];if(!i||!o)return!1;var l=Xt(a.value)?a.value:[a.value];return l.length>0&&i(l,o)}));return n.type==="OR"?r.some(Boolean):r.every(Boolean)}))}catch(n){return so.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}vc(e){var t=e.flatMap((r=>{var a,i;return(a=(i=r.stacktrace)==null?void 0:i.frames)!==null&&a!==void 0?a:[]})),n=t.filter((r=>{var a=r.filename;return!!a&&_he.some((i=>a.startsWith(i)))}));return n.length!==0&&(!n.every((r=>{var a=r.filename;return!!a&&a.startsWith(gT)}))||e.some((r=>{var a=r.value;return ks(a)&&a.includes("isolatedAPI.contexts.topHostname")}))&&!t.some((r=>{var a=r.filename;return r.in_app&&!(a!=null&&a.startsWith(gT))})))}cc(e){return e.some((t=>{var n=t.value;return ks(n)&&khe.some((r=>n.includes(r)))}))}fc(e){if(e.length>0){var t,n,r,a,i=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],o=i[i.length-1];return(r=o==null||(a=o.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}uc(e){return!cs(e)&&Xt(e)}}},Ahe=ze({productTours:class{get Ba(){return this._instance.persistence}constructor(e){this.mc=null,this.yc=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,r;if(this.Ba&&this.Ba.register({[Z5]:!!t.productTours}),!sN(this._instance))return!this.mc&&cs((n=this.Ba)==null?void 0:n.props[Jg])||vy.info("product tours disabled; stopping and clearing cached tours"),(r=this.mc)==null||r.stop(),this.mc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.mc&&sN(this._instance)&&this.Ys((()=>this.bc()))}Ys(e){var t,n;(t=Bt.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Bt.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?vy.error("Could not load product tours script",r):e()}))}bc(){var e;!this.mc&&(e=Bt.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.mc=Bt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Xt(this.yc)||t){var n=this.Ba;if(n){var r=n.props[Jg];if(Xt(r)&&!t)return this.yc=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:a=>{if(sN(this._instance)){var i=a.statusCode;if(i!==200||!a.json){var o="Product Tours API could not be loaded, status: "+i;return i===0?a.error||vy.warn(o):vy.error(o),void e([],{isLoaded:!1,error:o})}var l=Xt(a.json.product_tours)?a.json.product_tours:[];this.yc=l,n&&n.register({[Jg]:l}),e(l,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.yc,{isLoaded:!0})}getActiveProductTours(e){cs(this.mc)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.mc.getActiveProductTours(e)}showProductTour(e){var t;(t=this.mc)==null||t.showTourById(e)}previewTour(e){this.mc?this.mc.previewTour(e):this.Ys((()=>{var t;this.bc(),(t=this.mc)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.mc)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.mc)==null||e.nextStep()}previousStep(){var e;(e=this.mc)==null||e.previousStep()}clearCache(){var e;this.yc=null,(e=this.Ba)==null||e.unregister(Jg)}resetTour(e){var t;(t=this.mc)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.mc)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.mc)==null||t.cancelPendingTour(e)}}},p_),Rhe={siteApps:class{constructor(e){this._c=0,this._instance=e,this.wc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}kc(e,t){if(t){var n=this.globalsForEvent(t);this.wc.push(n),this.wc.length>1e3&&(this.wc=this.wc.slice(10))}}get siteAppLoaders(){var e;return(e=Bt._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.kc.bind(this));this.Sc=()=>{e(),this.wc=[],this.Sc=void 0}}}globalsForEvent(e){var t,n,r,a,i,o,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var h of Object.entries(d)){var p=h[0];c[p]={id:u[p],type:p,properties:h[1]}}var m=e.$set_once,g=e.$set;return{event:ze({},Oq(e,mhe),{properties:ze({},e.properties,g?{$set:ze({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},g)}:{},m?{$set_once:ze({},(r=(a=e.properties)==null?void 0:a.$set_once)!==null&&r!==void 0?r:{},m)}:{}),elements_chain:(i=(o=e.properties)==null?void 0:o.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}xc(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Mo.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Mo.error("prepare_external_dependency_script returned null"),null):e}Cc(){var e,t,n,r,a,i,o,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var c=Ke?.defaultView,u=c==null||(e=c.Node)==null?void 0:e.prototype;if(!c||!u)return()=>{};if(this._c++,this.Tc)return this.Mc();var d=[],h=this,p=new WeakSet,m=(b,y,v)=>{if(b!=null&&b[y]){var w=b[y];b[y]=v(w),d.push((()=>{b[y]=w}))}},g=b=>{if(p.has(b))return b;var y=h.xc(b);return y&&p.add(y),y},x=b=>b.map((y=>typeof y=="string"?y:g(y))).filter((y=>!Hn(y)));return m(u,"appendChild",(b=>function(y){var v=g(y);return v?b.call(this,v):y})),m(u,"insertBefore",(b=>function(y,v){var w=g(y);return w?b.call(this,w,v):y})),m(u,"replaceChild",(b=>function(y,v){var w=g(y);return w?b.call(this,w,v):v})),[(t=c.Element)==null?void 0:t.prototype,(n=c.Document)==null?void 0:n.prototype,(r=c.DocumentFragment)==null?void 0:r.prototype].forEach((b=>{m(b,"append",(y=>function(){for(var v=arguments.length,w=new Array(v),j=0;v>j;j++)w[j]=arguments[j];return y.apply(this,x(w))}
5)),m(b,"prepend",(y=>function(){for(var v=arguments.length,w=new Array(v),j=0;v>j;j++)w[j]=arguments[j];return y.apply(this,x(w))}))})),[(a=c.Element)==null?void 0:a.prototype,(i=c.CharacterData)==null?void 0:i.prototype,(o=c.DocumentType)==null?void 0:o.prototype].forEach((b=>{m(b,"before",(y=>function(){for(var v=arguments.length,w=new Array(v),j=0;v>j;j++)w[j]=arguments[j];return y.apply(this,x(w))})),m(b,"after",(y=>function(){for(var v=arguments.length,w=new Array(v),j=0;v>j;j++)w[j]=arguments[j];return y.apply(this,x(w))})),m(b,"replaceWith",(y=>function(){for(var v=arguments.length,w=new Array(v),j=0;v>j;j++)w[j]=arguments[j];var E=x(w);return w.length&&!E.length?void 0:y.apply(this,E)}))})),m((l=c.Element)==null?void 0:l.prototype,"insertAdjacentElement",(b=>function(y,v){var w=g(v);return w?b.call(this,y,w):null})),this.Tc=()=>{d.forEach((b=>b())),this.Tc=void 0},this.Mc()}Mc(){var e=!1;return()=>{var t;e||(e=!0,this._c--,this._c===0&&((t=this.Tc)==null||t.call(this)))}}Ic(e,t){t===void 0&&(t=!0);var n=this.Cc();try{var r=e(n);return t&&n(),r}catch(a){throw n(),a}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var o;!t.errored&&this.wc.length&&(Mo.info("Processing "+this.wc.length+" events for site app with id "+e.id),this.wc.forEach((l=>this.Ic((()=>t.processEvent==null?void 0:t.processEvent(l))))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((o=this.Sc)==null||o.call(this))},r=!1,a=o=>{t.errored=!o,t.loaded=!0,Mo.info("Site app with id "+e.id+" "+(o?"loaded":"errored")),r&&n()};try{var i=this.Ic((o=>e.init({posthog:this._instance,callback(l){o(),a(l)}})),!1).processEvent;i&&(t.processEvent=i),r=!0}catch(o){Mo.error(DO+e.id,o),a(!1)}if(r&&t.loaded)try{n()}catch(o){Mo.error("Error while processing buffered events PostHog app with config id "+e.id,o),t.errored=!0}}Ec(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}Rc(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),r=function(i){try{t.Ic((()=>i.processEvent==null?void 0:i.processEvent(n)))}catch(o){Mo.error("Error while processing event "+e.event+" for site app "+i.id,o)}};for(var a of Object.values(this.apps))r(a)}}onRemoteConfig(e){var t,n,r,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Ec(),void this._instance.on("eventCaptured",(c=>this.Rc(c)))):void Mo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Sc)==null||n.call(this),e.ok){var i=e.config;if((r=i.siteApps)!=null&&r.length)if(this.isEnabled){var o=function(){var c,u=l.id,d=l.url;Bt["__$$ph_site_app_"+u]=a._instance,(c=Bt.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(a._instance,d,(h=>{if(h)return Mo.error(DO+u,h)}))};for(var l of i.siteApps)o()}else Mo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Ihe={tracingHeaders:class{constructor(e){this.Pc=void 0,this.Ac=void 0,this.Fc=void 0,this.Gv=()=>{var t,n,r=this.Oc();r?(Be(this.Pc)&&(this.Pc=(t=Bt.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Be(this.Ac)&&(this.Ac=(n=Bt.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Xv()},this._instance=e}initialize(){this.startIfEnabledOrStop()}Ys(e){var t,n;(t=Bt.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Bt.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return uhe.error("failed to load script",r);e()}))}Lc(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Oc(){var e=this.Lc();return Xt(e)?(Xt(this.Fc)?this.Fc.splice(0,this.Fc.length,...e):this.Fc=[...e],e.length>0?this.Fc:void 0):(Xt(this.Fc)&&this.Fc.splice(0),this.Fc=e||void 0,this.Fc)}Xv(){var e,t;(e=this.Pc)==null||e.call(this),(t=this.Ac)==null||t.call(this),this.Pc=void 0,this.Ac=void 0}startIfEnabledOrStop(){this.Oc()?this.Ys(this.Gv):this.Xv()}}},Phe=ze({surveys:class extends fhe{constructor(e){var t;super(new vhe(e),{get projectToken(){return t.config.token},kv:new yhe(t=e)}),this._instance=e}Bu(e,t){var n=t.query?c0(e,t.query):e;return new Promise((r=>{var a;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((a=t.target)!==null&&a!==void 0?a:"api",n),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:r})}))}}},p_),Lhe={toolbar:class{constructor(e){this.instance=e}Dc(e){Bt.ph_toolbar_state=e}$c(){var e;return(e=Bt.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),tT(this.instance.config)||!Ae||!Ke)return!1;e=e??Ae.location,n=n??Ae.history;try{if(!t){try{Ae.localStorage.setItem("test","test"),Ae.localStorage.removeItem("test")}catch{return!1}t=Ae?.localStorage}var r,a=whe||pw(e.hash,"__posthog")||pw(e.hash,"state"),i=a?Q6((()=>JSON.parse(atob(decodeURIComponent(a)))))||Q6((()=>JSON.parse(decodeURIComponent(a)))):null;return i&&i.action==="ph_authorize"?((r=i).source="url",r&&Object.keys(r).length>0&&(i.desiredHash?e.hash=i.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(FO)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Nc(e){var t=Bt.ph_load_toolbar||Bt.ph_load_editor;!cs(t)&&ha(t)?t(e,this.instance):BO.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ke==null||!Ke.getElementById(PW));if(!Ae||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=ze({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(Ae.localStorage.setItem(FO,JSON.stringify(ze({},r,{source:void 0}))),this.$c()===2)this.Nc(r);else if(this.$c()===0){var a;this.Dc(1),(a=Bt.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(i=>{if(i)return BO.error("[Toolbar] Failed to load",i),void this.Dc(0);this.Dc(2),this.Nc(r)})),nn(Ae,"turbolinks:load",(()=>{this.Dc(0),this.loadToolbar(r)}))}return!0}qc(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},Ohe=ze({experiments:ca},p_),Mhe={conversations:class{constructor(e){this.jc=void 0,this._conversationsManager=null,this.Bc=!1,this.zt=null,this.Hc=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this.zc=e.ok,e.ok)){var t=e.config.conversations;cs(t)||(Pa(t)?this.jc=t:(this.jc=t.enabled,this.zt=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.jc=void 0,this.zt=null,this.zc=void 0,this.Hc=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Bc||this._instance.config.disable_conversations||tT(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Bt?.__PosthogExtensions__;if(e&&!Be(this.jc)&&this.jc)if(this.zt&&this.zt.token){this.Bc=!0;try{var t=e.initConversations;if(t)return this.Uc(t),void(this.Bc=!1);var n=e.loadExternalDependency;if(!n)return void this.Wc(t4);n(this._instance,"conversations",(r=>{r||!e.initConversations?this.Wc("Could not load conversations script",r):this.Uc(e.initConversations),this.Bc=!1}))}catch(r){this.Wc("Error initializing conversations",r),this.Bc=!1}}else Pi.error("Conversations enabled but missing token in remote config.")}}Uc(e){if(this.zt)try{this._conversationsManager=e(this.zt,this._instance),this.Hc=!1,Pi.info("Conversations loaded successfully")}catch(t){this.Wc("Error completing conversations initialization",t)}else Pi.error("Cannot complete initialization: remote config is null")}Wc(e,t){Pi.error(e,t),this._conversationsManager=null,this.Bc=!1,this.Hc=!0}show(){this._conversationsManager?this._conversationsManager.show():Pi.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.jc===!0&&!Hn(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":tT(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.zc===!1?"remote_config_failed":Be(this.jc)?this.zc?"disabled_in_project":"remote_config_pending":this.jc?cs(this.zt)||!this.zt.token?"missing_token":Bt!=null&&Bt.__PosthogExtensions__?this.Bc?"initializing":this.Hc?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var r=this;return un((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(Pi.warn(Qu),null)}))()}getMessages(e,t){var n=this;return un((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Pi.warn(Qu),null)}))()}markAsRead(e){var t=this;return un((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Pi.warn(Qu),null)}))()}getTickets(e){var t=this;return un((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Pi.warn(Qu),null)}))()}requestRestoreLink(e){var t=this;return un((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Pi.warn(Qu),null)}))()}restoreFromToken(e){var t=this;return un((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Pi.warn(Qu),null)}))()}restoreFromUrlToken(){var e=this;return un((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Pi.warn(Qu),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Cu(){var e;(e=this._conversationsManager)==null||e.setIdentity()}Tu(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},Dhe={logs:class{constructor(e){var t,n=this;this.name="logs",this.Vc=!1,this.Gc=!1,this.Zc=!1,this.A=Sn("[logs]"),this.Qc=ze({},this.A,{error(){for(var r=arguments.length,a=new Array(r),i=0;r>i;i++)a[i]=arguments[i];a.some(XO)||n.A.error(...a)}}),this.ba=[],this.Jc=[],this._d=0,this.Os=!1,this.Kc=[],this.Yc=[],this.Xc=!1,this.tf=!1,this.ef=()=>{var r,a;this.Os||(this._d=0,(r=this.if)==null||r.onReconnect(),(a=this.rf)==null||a.onReconnect())},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Vc=!0),Ae&&nn(Ae,"online",this.ef)}nf(e,t,n,r){var a,i=YO((a=this._instance)==null||(a=a.config)==null?void 0:a.logs,n);return[new Xue(this.sf(e,t),i,this.Qc,(()=>this.af()),(o=>o()),void 0,r),i]}lf(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.if||this.uf!==t){var n;(n=this.if)==null||n.reset(),this.uf=t;var r=this.nf((()=>this.ba),(a=>{this.ba=a}));this.if=r[0],this.hf=r[1]}return this.if}df(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.rf||this.vf!==t){var n;(n=this.rf)==null||n.reset(),this.vf=t;var r=this.nf((()=>this.Jc),(a=>{this.Jc=a}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},KO);this.rf=r[0],this.cf=r[1]}return this.rf}setup(e){var t;if(!this.Os){this.Ns=e,(t=this._instance)!=null&&(t=t.config)!=null&&(t=t.logs)!=null&&t.captureConsoleLogs&&(this.Vc=!0),(this.Vc||this.ff()&&this.pf())&&this.gf();var n=!1,r=e.onRemoteConfig((a=>{var i;n=a.ok&&((i=a.config.logs)==null?void 0:i.captureConsoleLogs)===!0,this.onRemoteConfig(a)}));this.Os?r.dispose():(this.qs=r,n||this.loadIfEnabled())}}dispose(){var e,t,n,r;this.Os||(this.Os=!0,this.mf(),(e=this.qs)==null||e.dispose(),this.qs=void 0,this.Ns=void 0,this.Zc=!1,Ae?.removeEventListener("online",this.ef),(t=this.yf)==null||t.call(this),this.yf=void 0,(n=this.if)==null||n.reset(),(r=this.rf)==null||r.reset())}onRemoteConfig(e){var t,n;if(!this.Os){var r=e.ok?(t=e.config.logs)==null?void 0:t.captureConsoleLogs:void 0;cs(r)?this.bf():((n=this._instance)==null||(n=n.persistence)==null||n.register({[qC]:!!r}),r?(this.Vc=!0,this.Gc||this.gf(),this.loadIfEnabled()):this.bf())}}reset(){var e,t,n,r;this.mf(),(e=this.if)==null||e.clearQueue(),this.ba=[],(t=this.if)==null||t.reset(),(n=this.rf)==null||n.clearQueue(),this.Jc=[],(r=this.rf)==null||r.reset(),this._d=0}captureLog(e){this.Os||this.lf().captureLog(e)}captureConsoleLog(e){this.Os||this.df().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.Os||this.df().captureLog(e,{context:t,occurredAtMs:n})}pf(){var e;return!((e=this._instance)==null||(e=e.persistence)==null||(e=e.props)==null||!e[qC])}ff(){var e,t;return(e=this._instance)==null||e.pa==null||!e.pa()||!((t=Bt._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null||!t.config)}Iu(){var e;this.mf(),(e=this.rf)==null||e.clearQueue(),this.Jc=[]}bf(){this.Vc||this.mf()}gf(){var e,t=this;if(!this.Xc&&Bt!=null&&Bt.console){var n=YO((e=this._instance)==null||(e=e.config)==null?void 0:e.logs).maxBufferSize,r=function(i){var o;try{o=(l=>{for(;(c=l)!=null&&c.__rrweb_original__;){var c;l=l.__rrweb_original__}return l})(Bt.console[i])}catch{return 0}if(!o)return 0;t.Yc.push(_V(Bt.console,i,(l=>{var c=function(){for(var u=arguments.length,d=new Array(u),h=0;u>h;h++)d[h]=arguments[h];try{t._f(i,d,n)}catch{}return l.apply(Bt.console,d)};return c.__rrweb_original__=o,c})))};for(var a of Ehe)r(a);this.Xc=!0,this.wf=setTimeout((()=>{this.mf()}),3e4)}}_f(e,t,n){var r;if(this.Xc&&!this.tf&&t.length!==0)if((r=this._instance)!=null&&r.is_capturing()){if(n>this.Kc.length){this.tf=!0;try{this.Kc.push({level:e,args:t,occurredAtMs:Date.now(),context:this.af()})}finally{this.tf=!1}}}else this.mf()}mf(){if(this.Kc=[],this.Xc){for(var e of(this.Xc=!1,this.wf&&(clearTimeout(this.wf),this.wf=void 0),this.Yc))e();
5this.Yc=[]}}kf(){var e=this.Kc;return this.mf(),e}get logger(){return this.Sf||(this.Sf={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Sf}flushLogs(e){e?this.xf(e):(this.if&&this.if.flush().catch((t=>this.Cf(t))),this.rf&&this.rf.flush().catch((t=>this.Cf(t))))}Cf(e){XO(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(!this.Os&&this.Vc&&!this.Gc&&!this.Zc){var e=Bt?.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.mf();var t=e.loadExternalDependency;if(!t)return this.A.error(t4),void this.mf();this.Zc=!0;try{t(this._instance,"logs",(n=>{if(this.Zc=!1,!this.Os&&this.Vc){var r=e.logs;if(n||r==null||!r.initializeLogs)this.A.error("Could not load logs script",n),this.mf();else{var a,i,o=this.kf();this.yf=r.initializeLogs((a=this.Ns)!==null&&a!==void 0?a:this._instance),this.Gc=!0,o.length>0&&(r.replayConsoleBuffer==null||r.replayConsoleBuffer((i=this.Ns)!==null&&i!==void 0?i:this._instance,o))}}}))}catch(n){throw this.Zc=!1,n}}}sf(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===qo.LogsQueue?e():void 0,setPersistedProperty(r,a){var i;r===qo.LogsQueue&&t((i=a)!==null&&i!==void 0?i:[])},hs:r=>this.hs(r),getLibraryId:()=>ln.LIB_NAME,getLibraryVersion:()=>ln.LIB_VERSION}}hs(e){return new Promise((t=>{if(VW(this._d,3))t({kind:"fatal",error:rN(void 0,"logs endpoint is unreachable, dropping batch")});else{var n=!1,r=i=>{n||(n=!0,clearTimeout(a),t(i))},a=setTimeout((()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:rN(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Tf(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:i=>{var o=i.statusCode;if(this.Mf(o),o>=200&&300>o)r({kind:"ok"});else if(o===413)r({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)r({kind:"fatal",error:new Error("logs request failed with status "+o)});else{var l;o===0?(i.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:rN(i.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:(l=i.error)!==null&&l!==void 0?l:new Error("logs request failed with status "+o)})}}})}}))}Mf(e){(e!==0||this._instance.__loaded)&&(this._d=GW(e,this._d,3,(()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}xf(e){this.ba.length>0&&this.If(e,this.ba,this.hf,ln.LIB_NAME,(t=>{this.ba=t})),this.Jc.length>0&&this.If(e,this.Jc,this.cf,KO,(t=>{this.Jc=t}))}If(e,t,n,r,a){if(t.length!==0){var i=t.map((l=>l.record));a([]);var o=bW(i,xW(n,ln.LIB_NAME,ln.LIB_VERSION),r,ln.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Tf(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}Tf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}af(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.windowId,a=n.sessionStartTimestamp,i=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=r,cs(a)||(t.sessionStartTimestamp=a),cs(i)||(t.lastActivityTimestamp=i)}if(Bt!=null&&(e=Bt.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?yu(Bt.location.href):Bt.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},$he={metrics:class{constructor(e){this.A=Sn("[metrics]"),this._instance=e}initialize(){}lf(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.if&&this.uf===n||((t=this.if)==null||t.reset(),this.uf=n,this.if=new Jue(this.sf(),(function(r){var a,i,o,l,c,u=r?.resourceAttributes;return{serviceName:(a=u?.["service.name"])!==null&&a!==void 0?a:r?.serviceName,serviceVersion:(i=u?.["service.version"])!==null&&i!==void 0?i:r?.serviceVersion,environment:(o=u?.["deployment.environment"])!==null&&o!==void 0?o:r?.environment,resourceAttributes:u,beforeSend:r?.beforeSend,flushIntervalMs:(l=r?.flushIntervalMs)!==null&&l!==void 0?l:1e4,maxSeriesPerFlush:(c=r?.maxSeriesPerFlush)!==null&&c!==void 0?c:1e3}})(n),this.A)),this.if}count(e,t,n){t===void 0&&(t=1),this.lf().count(e,t,n)}
5gauge(e,t,n){this.lf().gauge(e,t,n)}histogram(e,t,n){this.lf().histogram(e,t,n)}flush(e){if(!this.if)return Promise.resolve();if(e){var t=this.if.drainWindow();return t&&this.Ms(t,e),Promise.resolve()}return this.if.flush().catch((n=>this.A.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.if)==null||e.reset()}sf(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ms:n=>t.Ms(n),getLibraryId:()=>ln.LIB_NAME,getLibraryVersion:()=>ln.LIB_VERSION}}Ms(e,t){return new Promise((n=>{var r=!1,a=o=>{r||(r=!0,clearTimeout(i),n(o))},i=setTimeout((()=>a({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(ze({method:"POST",url:this.Ef(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(o){var l=o.statusCode;if(l>=200&&300>l)a({kind:"ok"});else if(l===413)a({kind:"too-large"});else if(l!==0&&l!==408&&l!==429&&500>l)a({kind:"fatal",error:new Error("metrics request failed with status "+l)});else{var c;a({kind:"retry-later",error:(c=o.error)!==null&&c!==void 0?c:new Error("metrics request failed with status "+l)})}}}))}))}Ef(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Fhe=ze({},p_,She,Che,The,Ahe,Rhe,Phe,Ihe,Lhe,Ohe,Mhe,Dhe,$he);mi.__defaultExtensionClasses=ze({},Fhe);var EV=(function(){ln.SDK_DIST_CHANNEL="npm";var e=vx[Yp]=new mi;return(function(){function t(){t.done||(t.done=!0,wV=!1,Vs(vx,(function(n){n._dom_loaded()})))}Ke!=null&&Ke.addEventListener?Ke.readyState==="complete"?t():nn(Ke,"DOMContentLoaded",t,{capture:!1}):Ae&<.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const xT="phc_BPLamS5BxdWjWikvWTfSu4UzLHrjEFCLnrU3PLiYqFpt",SV=typeof window<"u"&&window.location.hostname==="greatexperts.ai";SV&&xT&&EV.init(xT,{api_host:"https://us.i.posthog.com",defaults:"2026-05-30",session_recording:{maskAllInputs:!0,maskTextSelector:"[data-ph-mask]"}});const bT=SV&&xT?EV:null;function m_(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function Bhe(e,t,n,r){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(d){try{u(r.next(d))}catch(h){o(h)}}function c(d){try{u(r.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):a(d.value).then(l,c)}u((r=r.apply(e,t||[])).next())})}const Uhe=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class l4 extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class zhe extends l4{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class JO extends l4{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class QO extends l4{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var yT;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(yT||(yT={}));class Hhe{constructor(t,{headers:n={},customFetch:r,region:a=yT.Any}={}){this.url=t,this.headers=n,this.region=a,this.fetch=Uhe(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return Bhe(this,arguments,void 0,function*(n,r={}){var a;let i,o;try{const{headers:l,method:c,body:u,signal:d,timeout:h}=r;let p={},{region:m}=r;m||(m=this.region);const g=new URL(`${this.url}/${n}`);m&&m!=="any"&&(p["x-region"]=m,g.searchParams.set("forceFunctionRegion",m));let x;u&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",x=u):typeof u=="string"?(p["Content-Type"]="text/plain",x=u):typeof FormData<"u"&&u instanceof FormData?x=u:(p["Content-Type"]="application/json",x=JSON.stringify(u)):u&&typeof u!="string"&&!(typeof Blob<"u"&&u instanceof Blob)&&!(u instanceof ArrayBuffer)&&!(typeof FormData<"u"&&u instanceof FormData)?x=JSON.stringify(u):x=u;let b=d;h&&(o=new AbortController,i=setTimeout(()=>
5o.abort(),h),d?(b=o.signal,d.addEventListener("abort",()=>o.abort())):b=o.signal);const y=yield this.fetch(g.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),l),body:x,signal:b}).catch(E=>{throw new zhe(E)}),v=y.headers.get("x-relay-error");if(v&&v==="true")throw new JO(y);if(!y.ok)throw new QO(y);let w=((a=y.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),j;return w==="application/json"?j=yield y.json():w==="application/octet-stream"||w==="application/pdf"?j=yield y.blob():w==="text/event-stream"?j=y:w==="multipart/form-data"?j=yield y.formData():j=yield y.text(),{data:j,error:null,response:y}}catch(l){return{data:null,error:l,response:l instanceof QO||l instanceof JO?l.context:void 0}}finally{i&&clearTimeout(i)}})}}const CV=3,ZO=e=>Math.min(1e3*2**e,3e4),qhe=[520,503],TV=["GET","HEAD","OPTIONS"];var Whe=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function eM(e,t){return new Promise(n=>{if(t?.aborted){n();return}const r=setTimeout(()=>{t?.removeEventListener("abort",a),n()},e);function a(){clearTimeout(r),n()}t?.addEventListener("abort",a)})}function Vhe(e,t,n,r){return!(!r||n>=CV||!TV.includes(e)||!qhe.includes(t))}var Ghe=class{constructor(e){var t,n,r,a,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,this.shouldStripNulls=(r=e.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(a=e.urlLengthLimit)!==null&&a!==void 0?a:8e3,this.retryEnabled=(i=e.retry)!==null&&i!==void 0?i:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const r=this.fetch;let i=(async()=>{let o=0;for(;;){const u=new Headers(n.headers);o>0&&u.set("X-Retry-Count",String(o));let d;try{d=await r(n.url.toString(),{method:n.method,headers:u,body:JSON.stringify(n.body,(h,p)=>typeof p=="bigint"?p.toString():p),signal:n.signal})}catch(h){if(h?.name==="AbortError"||h?.code==="ABORT_ERR"||!TV.includes(n.method))throw h;if(n.retryEnabled&&o<CV){const p=ZO(o);o++,await eM(p,n.signal);continue}throw h}if(Vhe(n.method,d.status,o,n.retryEnabled)){var l,c;const h=(l=(c=d.headers)===null||c===void 0?void 0:c.get("Retry-After"))!==null&&l!==void 0?l:null,p=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:ZO(o);await d.text(),o++,await eM(p,n.signal);continue}return await n.processResponse(d)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var l;let c="",u="",d="";const h=o?.cause;if(h){var p,m,g,x;const v=(p=h?.message)!==null&&p!==void 0?p:"",w=(m=h?.code)!==null&&m!==void 0?m:"";c=`${(g=o?.name)!==null&&g!==void 0?g:"FetchError"}: ${o?.message}`,c+=` 6 7Caused by: ${(x=h?.name)!==null&&x!==void 0?x:"Error"}: ${v}`,w&&(c+=` (${w})`),h?.stack&&(c+=` 8${h.stack}`)}else{var b;c=(b=o?.stack)!==null&&b!==void 0?b:""}const y=this.url.toString().length;return o?.name==="AbortError"||o?.code==="ABORT_ERR"?(d="",u="Request was aborted (timeout or manual cancellation)",y>this.urlLengthLimit&&(u+=`. Note: Your request URL is ${y} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(h?.name==="HeadersOverflowError"||h?.code==="UND_ERR_HEADERS_OVERFLOW")&&(d="",u="HTTP headers exceeded server limits (typically 16KB)",y>this.urlLengthLimit&&(u+=`. Your request URL is ${y} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(l=o?.name)!==null&&l!==void 0?l:"FetchError"}: ${o?.message}`,details:c,hint:u,code:d},data:null,count:null,status:0,statusText:""}}
8)),i.then(e,t)}async processResponse(e){var t=this;let n=null,r=null,a=null,i=e.status,o=e.statusText;if(e.ok){var l,c;if(t.method!=="HEAD"){var u;const p=await e.text();p===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((u=t.headers.get("Accept"))===null||u===void 0)&&u.includes("application/vnd.pgrst.plan+text"))?r=p:r=JSON.parse(p))}const d=(l=t.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),h=(c=e.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");d&&h&&h.length>1&&(a=parseInt(h[1])),t.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,a=null,i=406,o="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const d=await e.text();try{n=JSON.parse(d),Array.isArray(n)&&e.status===404&&(r=[],n=null,i=200,o="OK")}catch{e.status===404&&d===""?(i=204,o="No Content"):n={message:d}}if(n&&t.shouldThrowOnError)throw new Whe(n)}return{success:n===null,error:n,data:r,count:a,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Yhe=class extends Ghe{select(e){let t=!1;const n=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:a=r}={}){const i=a?`${a}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const a=typeof r>"u"?"offset":`${r}.offset`,i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(a,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:a=!1,format:i="text"}={}){var o;const l=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,a?"wal":null].filter(Boolean).join("|"),c=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${c}"; options=${l};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const tM=new RegExp("[,()]");var Kp=class extends Yhe{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&tM.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&tM.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:r}={}){let a="";r==="plain"?a="pl":r==="phrase"?a="ph":r==="websearch"&&(a="w");const i=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${a}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,n])=>
8n!==void 0).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},Khe=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:a=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=a,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:r}=t??{},a=n?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join(""),{url:l,headers:c}=this.cloneRequestState();return l.searchParams.set("select",o),r&&c.append("Prefer",`count=${r}`),new Kp({method:a,url:l,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const a="POST",{url:i,headers:o}=this.cloneRequestState();if(t&&o.append("Prefer",`count=${t}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const l=e.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(l.length>0){const c=[...new Set(l)].map(u=>`"${u}"`);i.searchParams.set("columns",c.join(","))}}return new Kp({method:a,url:i,headers:o,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:a=!0}={}){var i;const o="POST",{url:l,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&l.searchParams.set("on_conflict",t),r&&c.append("Prefer",`count=${r}`),a||c.append("Prefer","missing=default"),Array.isArray(e)){const u=e.reduce((d,h)=>d.concat(Object.keys(h)),[]);if(u.length>0){const d=[...new Set(u)].map(h=>`"${h}"`);l.searchParams.set("columns",d.join(","))}}return new Kp({method:o,url:l,headers:c,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var n;const r="PATCH",{url:a,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Kp({method:r,url:a,headers:i,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const n="DELETE",{url:r,headers:a}=this.cloneRequestState();return e&&a.append("Prefer",`count=${e}`),new Kp({method:n,url:r,headers:a,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function ub(e){"@babel/helpers - typeof";return ub=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ub(e)}function Xhe(e,t){if(ub(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ub(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jhe(e){var t=Xhe(e,"string");return ub(t)=="symbol"?t:t+""}function Qhe(e,t,n){return(t=Jhe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function wy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sM(Object(n),!0).forEach(function(r){Qhe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Zhe=class AV{constructor(t,{headers:n={},schema:r,fetch:a,timeout:i,urlLengthLimit:o=8e3,retry:l}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.urlLengthLimit=o;const c=a??globalThis.fetch;i!==void 0&&i>0?this.fetch=(u,d)=>{const h=new AbortController,p=setTimeout(()=>h.abort(),i),m=d?.signal;if(m){if(m.aborted)return clearTimeout(p),c(u,d);const g=()=>{clearTimeout(p),h.abort()};return m.addEventListener("abort",g,{once:!0}),c(u,wy(wy({},d),{},{signal:h.signal})).finally(()=>{clearTimeout(p),m.removeEventListener("abort",g)})}return c(u,wy(wy({},d),{},{signal:h.signal})).finally(()=>clearTimeout(p))}:this.fetch=c,this.retry=l}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Khe(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new AV(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,n={},{head:r=!1,get:a=!1,count:i}={}){var o;let l;const c=new URL(`${this.url}/rpc/${t}`);let u;const d=m=>m!==null&&typeof m=="object"&&(!Array.isArray(m)||m.some(d)),h=r&&Object.values(n).some(d);h?(l="POST",u=n):r||a?(l=r?"HEAD":"GET",Object.entries(n).filter(([m,g])=>g!==void 0).map(([m,g])=>[m,Array.isArray(g)?`{${g.join(",")}}`:`${g}
8`]).forEach(([m,g])=>{c.searchParams.append(m,g)})):(l="POST",u=n);const p=new Headers(this.headers);return h?p.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&p.set("Prefer",`count=${i}`),new Kp({method:l,url:c,headers:p,schema:this.schemaName,body:u,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class epe{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const n=globalThis;if(typeof globalThis<"u"&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};const r=typeof global<"u"?global:void 0;if(r&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};if(typeof globalThis<"u"&&typeof n.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&n.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const a=globalThis.process;if(a){const i=a.versions;if(i&&i.node){const o=i.node,l=parseInt(o.replace(/^v/,"").split(".")[0]);return l>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${l} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${l} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: 9import ws from "ws" 10new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=` 11 12Suggested solution: ${t.workaround}`),new Error(n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const tpe="2.105.4",spe=`realtime-js/${tpe}`,npe="1.0.0",RV="2.0.0",rpe=RV,ape=1e4,ipe=100,tu={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},IV={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},vT={connecting:"connecting",closing:"closing",closed:"closed"};class ope{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const a=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,a)}_encodeJsonUserBroadcastPush(t){var n,r;const a=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(a)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,n,r){var a,i;const o=t.topic,l=(a=t.ref)!==null&&a!==void 0?a:"",c=(i=t.join_ref)!==null&&i!==void 0?i:"",u=t.payload.event,d=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},h=Object.keys(d).length===0?"":JSON.stringify(d);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`ref length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`userEvent length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const p=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+o.length+u.length+h.length,m=new ArrayBuffer(this.HEADER_LENGTH+p);let g=new DataView(m),x=0;g.setUint8(x++,this.KINDS.userBroadcastPush),g.setUint8(x++,c.length),g.setUint8(x++,l.length),g.setUint8(x++,o.length),g.setUint8(x++,u.length),g.setUint8(x++,h.length),g.setUint8(x++,n),Array.from(c,y=>
12g.setUint8(x++,y.charCodeAt(0))),Array.from(l,y=>g.setUint8(x++,y.charCodeAt(0))),Array.from(o,y=>g.setUint8(x++,y.charCodeAt(0))),Array.from(u,y=>g.setUint8(x++,y.charCodeAt(0))),Array.from(h,y=>g.setUint8(x++,y.charCodeAt(0)));var b=new Uint8Array(m.byteLength+r.byteLength);return b.set(new Uint8Array(m),0),b.set(new Uint8Array(r),m.byteLength),b.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[a,i,o,l,c]=r;return n({join_ref:a,ref:i,topic:o,event:l,payload:c})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),a=new TextDecoder;if(r===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,a)}_decodeUserBroadcast(t,n,r){const a=n.getUint8(1),i=n.getUint8(2),o=n.getUint8(3),l=n.getUint8(4);let c=this.HEADER_LENGTH+4;const u=r.decode(t.slice(c,c+a));c=c+a;const d=r.decode(t.slice(c,c+i));c=c+i;const h=r.decode(t.slice(c,c+o));c=c+o;const p=t.slice(c,t.byteLength),m=l===this.JSON_ENCODING?JSON.parse(r.decode(p)):p,g={type:this.BROADCAST_EVENT,event:d,payload:m};return o>0&&(g.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:g}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t?.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>n.includes(r)))}}var wn;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(wn||(wn={}));const nM=(e,t,n={})=>{var r;const a=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((i,o)=>(i[o]=lpe(o,e,t,a),i),{}):{}},lpe=(e,t,n,r)=>{const a=t.find(l=>
vendor: 5,526 bytes, line 12
12l.name===e),i=a?.type,o=n[e];return i&&!r.includes(i)?PV(i,o):wT(o)},PV=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return hpe(t,n)}switch(e){case wn.bool:return cpe(t);case wn.float4:case wn.float8:case wn.int2:case wn.int4:case wn.int8:case wn.numeric:case wn.oid:return upe(t);case wn.json:case wn.jsonb:return dpe(t);case wn.timestamp:return ppe(t);case wn.abstime:case wn.date:case wn.daterange:case wn.int4range:case wn.int8range:case wn.money:case wn.reltime:case wn.text:case wn.time:case wn.timestamptz:case wn.timetz:case wn.tsrange:case wn.tstzrange:return wT(t);default:return wT(t)}},wT=e=>e,cpe=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},upe=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},dpe=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},hpe=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let i;const o=e.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>PV(t,l))}return e},ppe=e=>typeof e=="string"?e.replace(" ","T"):e,LV=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var jx=e=>typeof e=="function"?e:function(){return e},mpe=typeof self<"u"?self:null,Xp=typeof window<"u"?window:null,Go=mpe||Xp||globalThis,fpe="2.0.0",gpe=1e4,xpe=1e3,Ko={connecting:0,open:1,closing:2,closed:3},Ga={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},$l={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},jT={longpoll:"longpoll",websocket:"websocket"},bpe={complete:4},_T="base64url.bearer.phx.",jy=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,this.ref=void 0}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}destroy(){this.cancelRefEvent(),this.cancelTimeout()}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})}},OV=class{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,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))}},ype=class{constructor(e,t,n){this.state=Ga.closed,this.topic=e,this.params=jx(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new jy(this,$l.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new OV(()=>{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=Ga.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=Ga.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Ga.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=Ga.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new jy(this,$l.leave,jx({}),this.timeout).send(),this.state=Ga.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on($l.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}
vendor: 5,265 bytes, line 12
12teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ga.closed,this.bindings=[]}onClose(e){this.on($l.close,e)}onError(e){return this.on($l.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 jy(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=Ga.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger($l.close,"leave")},n=new jy(this,$l.leave,jx({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}filterBindings(e,t,n){return!0}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=Ga.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 i=this.bindings.filter(o=>o.event===e&&this.filterBindings(o,t,n));for(let o=0;o<i.length;o++)i[o].callback(a,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Ga.closed}isErrored(){return this.state===Ga.errored}isJoined(){return this.state===Ga.joined}isJoining(){return this.state===Ga.joining}isLeaving(){return this.state===Ga.leaving}},bw=class{static request(e,t,n,r,a,i,o){if(Go.XDomainRequest){let l=new Go.XDomainRequest;return this.xdomainRequest(l,e,t,r,a,i,o)}else if(Go.XMLHttpRequest){let l=new Go.XMLHttpRequest;return this.xhrRequest(l,e,t,n,r,a,i,o)}else{if(Go.fetch&&Go.AbortController)return this.fetchRequest(e,t,n,r,a,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,n,r,a,i,o){let l={method:e,headers:n,body:r},c=null;return a&&(c=new AbortController,setTimeout(()=>c.abort(),a),l.signal=c.signal),Go.fetch(t,l).then(u=>u.text()).then(u=>this.parseJSON(u)).then(u=>o&&o(u)).catch(u=>{u.name==="AbortError"&&i?i():o&&o(null)}),c}static xdomainRequest(e,t,n,r,a,i,o){return e.timeout=a,e.open(t,n),e.onload=()=>{let l=this.parseJSON(e.responseText);o&&o(l)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,a,i,o,l){e.open(t,n,!0),e.timeout=i;for(let[c,u]of Object.entries(r))e.setRequestHeader(c,u);return e.onerror=()=>l&&l(null),e.onreadystatechange=()=>{if(e.readyState===bpe.complete&&l){let c=this.parseJSON(e.responseText);l(c)}},o&&(e.ontimeout=o),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,i=e[r];typeof i=="object"?n.push(this.serialize(i,a)):n.push(encodeURIComponent(a)+"="+encodeURIComponent(i))}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)}`}},vpe=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)},jp=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(_T)&&(this.authToken=atob(t[1].slice(_T.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=Ko.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+jT.websocket),"$1/"+jT.longpoll)}endpointURL(){return bw.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=Ko.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Ko.open||this.readyState===Ko.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(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Ko.open,this.onopen({}),this.poll();break;
12case 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=vpe(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(` 13`),()=>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=Ko.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 i,o=()=>{this.reqs.delete(i),r()};i=bw.request(e,this.endpointURL(),t,n,this.timeout,o,l=>{this.reqs.delete(i),this.isActive()&&a(l)}),this.reqs.add(i)}},wpe=class Zg{constructor(t,n={}){let r=n.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,a=>{let{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Zg.syncState(this.state,a,i,o),this.pendingDiffs.forEach(c=>{this.state=Zg.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],l()}),this.channel.on(r.diff,a=>{let{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=Zg.syncDiff(this.state,a,i,o),l())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return Zg.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,n,r,a){let i=this.clone(t),o={},l={};return this.map(i,(c,u)=>{n[c]||(l[c]=u)}),this.map(n,(c,u)=>{let d=i[c];if(d){let h=u.metas.map(x=>x.phx_ref),p=d.metas.map(x=>x.phx_ref),m=u.metas.filter(x=>p.indexOf(x.phx_ref)<0),g=d.metas.filter(x=>h.indexOf(x.phx_ref)<0);m.length>0&&(o[c]=u,o[c].metas=m),g.length>0&&(l[c]=this.clone(d),l[c].metas=g)}else o[c]=u}),this.syncDiff(i,{joins:o,leaves:l},r,a)}static syncDiff(t,n,r,a){let{joins:i,leaves:o}=this.clone(n);return r||(r=function(){}),a||(a=function(){}),this.map(i,(l,c)=>{let u=t[l];if(t[l]=this.clone(c),u){let d=t[l].metas.map(p=>p.phx_ref),h=u.metas.filter(p=>d.indexOf(p.phx_ref)<0);t[l].metas.unshift(...h)}r(l,u,c)}),this.map(o,(l,c)=>{let u=t[l];if(!u)return;let d=c.metas.map(h=>h.phx_ref);u.metas=u.metas.filter(h=>d.indexOf(h.phx_ref)<0),a(l,u,c),u.metas.length===0&&delete t[l]}),t}static list(t,n){return n||(n=function(r,a){return a}),this.map(t,(r,a)=>n(r,a))}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static clone(t){return JSON.parse(JSON.stringify(t))}},_y={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,i,o]=JSON.parse(e);return t({join_ref:n,ref:r,topic:a,event:i,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:a,payload:i}=e,o=this.META_LENGTH+t.length+n.length+a.length+r.length,l=new ArrayBuffer(this.HEADER_LENGTH+o),c=new DataView(l),u=0;c.setUint8(u++,this.KINDS.push),c.setUint8(u++,t.length),c.setUint8(u++,n.length),c.setUint8(u++,a.length),c.setUint8(u++,r.length),Array.from(t,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(n,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(a,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(r,h=>c.setUint8(u++,h.charCodeAt(0)));var d=new Uint8Array(l.byteLength+i.byteLength);return d.set(new Uint8Array(l),0),d.set(new Uint8Array(i),l.byteLength),d.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)}}
vendor: 8,463 bytes, line 13
13,decodePush(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),i=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,l=n.decode(e.slice(o,o+r));o=o+r;let c=n.decode(e.slice(o,o+a));o=o+a;let u=n.decode(e.slice(o,o+i));o=o+i;let d=e.slice(o,e.byteLength);return{join_ref:l,ref:null,topic:c,event:u,payload:d}},decodeReply(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),i=t.getUint8(3),o=t.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(e.slice(l,l+r));l=l+r;let u=n.decode(e.slice(l,l+a));l=l+a;let d=n.decode(e.slice(l,l+i));l=l+i;let h=n.decode(e.slice(l,l+o));l=l+o;let p=e.slice(l,e.byteLength),m={status:h,response:p};return{join_ref:c,ref:u,topic:d,event:$l.reply,payload:m}},decodeBroadcast(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),i=this.HEADER_LENGTH+2,o=n.decode(e.slice(i,i+r));i=i+r;let l=n.decode(e.slice(i,i+a));i=i+a;let c=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:o,event:l,payload:c}}},jpe=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||gpe,this.transport=t.transport||Go.WebSocket||jp,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let n=null;try{n=Go&&Go.sessionStorage}catch{}this.sessionStore=t.sessionStorage||n,this.establishedConnections=0,this.defaultEncoder=_y.encode.bind(_y),this.defaultDecoder=_y.decode.bind(_y),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==jp?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;Xp&&Xp.addEventListener&&(Xp.addEventListener("pagehide",a=>{this.conn&&(this.disconnect(),r=this.connectClock)}),Xp.addEventListener("pageshow",a=>{r===this.connectClock&&(r=null,this.connect())}),Xp.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=a=>t.rejoinAfterMs?t.rejoinAfterMs(a):[1e3,2e3,5e3][a-1]||1e4,this.reconnectAfterMs=a=>t.reconnectAfterMs?t.reconnectAfterMs(a):[10,50,100,150,200,250,500,1e3,2e3][a-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(a,i,o)=>{console.log(`${a}: ${i}`,o)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=jx(t.params||{}),this.endPoint=`${e}/${jT.websocket}`,this.vsn=t.vsn||fpe,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new OV(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return jp}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=bw.appendParams(bw.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=jx(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==jp?this.connectWithFallback(jp,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}onHeartbeat(e){this.heartbeatCallback=e}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}transportName(e){return e===jp?"LongPoll":e.name}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${_T}${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,i,o=this.transportName(e),l=c=>{this.log("transport",`falling back to ${o}...`,c),this.off([a,i]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return l("memorized");this.fallbackTimer=setTimeout(l,t),i=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){let c=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${c}`,"true"),this.log("transport",`established ${c} 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",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),xpe,"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();const r=this.conn;this.waitForBufferDone(r,()=>{t?r.close(t,n||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){if(n===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){if(n===5||e.readyState===Ko.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,n=this.establishedConnections;this.triggerStateCallbacks("error",e,t,n),(t===this.transport||n>0)&&this.triggerChanError(e)}
vendor: 4,111 bytes, line 13
13triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger($l.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case Ko.connecting:return"connecting";case Ko.open:return"open";case Ko.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 ype(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:i}=e;this.log("push",`${t} ${n} (${i}, ${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(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}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:i,join_ref:o}=t;if(i&&i===this.pendingHeartbeatRef){const l=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(a.status==="ok"?"ok":"error",l)}catch(c){this.log("error","error in heartbeat callback",c)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${a.status||""} ${n} ${r} ${i&&"("+i+")"||""}`.trim(),a);for(let l=0;l<this.channels.length;l++){const c=this.channels[l];c.isMember(n,r,a,o)&&c.trigger(r,a,i,o)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([n,r])=>{try{r(...t)}catch(a){this.log("error",`error in ${e} callback`,a)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}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())}};class _x{constructor(t,n){const r=kpe(n);this.presence=new wpe(t.getChannel(),r),this.presence.onJoin((a,i,o)=>{const l=_x.onJoinPayload(a,i,o);t.getChannel().trigger("presence",l)}),this.presence.onLeave((a,i,o)=>{const l=_x.onLeavePayload(a,i,o);t.getChannel().trigger("presence",l)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return _x.transformState(this.presence.state)}static transformState(t){return t=_pe(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const a=t[r];return n[r]=t1(a),n},{})}static onJoinPayload(t,n,r){const a=rM(n),i=t1(r);return{event:"join",key:t,currentPresences:a,newPresences:i}}static onLeavePayload(t,n,r){const a=rM(n),i=t1(r);return{event:"leave",key:t,currentPresences:a,leftPresences:i}}}function t1(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function _pe(e){return JSON.parse(JSON.stringify(e))}function kpe(e){return e?.events&&{events:e.events}}function rM(e){return e?.metas?t1(e):[]}var aM;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(aM||(aM={}));class Npe{get state(){return this.presenceAdapter.state}constructor(t,n){this.channel=t,this.presenceAdapter=new _x(this.channel.channelAdapter,n)}}function Epe(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);
13if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const n=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${n}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class Spe{constructor(t,n,r){const a=Cpe(r);this.channel=t.getSocket().channel(n,a),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,n){return this.channel.on(t,n)}off(t,n){this.channel.off(t,n)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,n,r){let a;try{a=this.channel.push(t,n,r)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>ipe){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return a}updateJoinPayload(t){const n=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},n),t)}canPush(){return this.socket.isConnected()&&this.state===tu.joined}isJoined(){return this.state===tu.joined}isJoining(){return this.state===tu.joining}isClosed(){return this.state===tu.closed}isLeaving(){return this.state===tu.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function Cpe(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var iM;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(iM||(iM={}));var pm;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(pm||(pm={}));var Fl;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Fl||(Fl={}));class kx{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,n={config:{}},r){var a,i;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.channelAdapter=new Spe(this.socket.socketAdapter,t,this.params),this.presence=new Npe(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=LV(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(a=this.params.config)===null||a===void 0?void 0:a.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,n=this.timeout){var r,a,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:l,private:c}}=this.params,u=(a=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(m=>m.filter))!==null&&a!==void 0?a:[],d=!!this.bindings[pm.PRESENCE]&&this.bindings[pm.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},p={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:d}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(m=>{t?.(Fl.CHANNEL_ERROR,Epe(m))}),this._onClose(()=>t?.(Fl.CLOSED)),this.updateJoinPayload(Object.assign({config:p},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(n).receive("ok",async({postgres_changes:m})=>
13{if(this.socket._isManualToken()||this.socket.setAuth(),m===void 0){t?.(Fl.SUBSCRIBED);return}this._updatePostgresBindings(m,t)}).receive("error",m=>{this.state=tu.errored;const g=Object.values(m).join(", ")||"error";t?.(Fl.CHANNEL_ERROR,new Error(g,{cause:m}))}).receive("timeout",()=>{t?.(Fl.TIMED_OUT)})}return this}_updatePostgresBindings(t,n){var r;const a=this.bindings.postgres_changes,i=(r=a?.length)!==null&&r!==void 0?r:0,o=[];for(let l=0;l<i;l++){const c=a[l],{filter:{event:u,schema:d,table:h,filter:p}}=c,m=t&&t[l];if(m&&m.event===u&&kx.isFilterValueEqual(m.schema,d)&&kx.isFilterValueEqual(m.table,h)&&kx.isFilterValueEqual(m.filter,p))o.push(Object.assign(Object.assign({},c),{id:m.id}));else{this.unsubscribe(),this.state=tu.errored,n?.(Fl.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=tu.errored&&n&&n(Fl.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){const a=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=t===pm.PRESENCE||t===pm.POSTGRES_CHANGES;if(a&&i)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,n,r)}async httpSend(t,n,r={}){var a;if(n==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},l=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(a=r.timeout)!==null&&a!==void 0?a:this.timeout);if(l.status===202)return{success:!0};let c=l.statusText;try{const u=await l.json();c=u.error||u.message||c}catch{}return Promise.reject(new Error(c))}async send(t,n={}){var r,a;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated
13in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=t,l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((a=u.body)===null||a===void 0?void 0:a.cancel()),u.ok?"ok":"error"}catch(u){return u instanceof Error&&u.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,c;const u=this.channelAdapter.push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),u.receive("ok",()=>i("ok")),u.receive("error",()=>i("error")),u.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(n=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>n("ok")).receive("timeout",()=>n("timed out")).receive("error",()=>n("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,n,r){const a=new AbortController,i=setTimeout(()=>a.abort(),r),o=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:a.signal}));return clearTimeout(i),o}_on(t,n,r){const a=t.toLocaleLowerCase(),i=this.channelAdapter.on(t,r),o={type:a,filter:n,callback:r,ref:i};return this.bindings[a]?this.bindings[a].push(o):this.bindings[a]=[o],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,n,r)=>{var a,i,o,l,c,u,d;const h=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,r))return!1;const p=(a=this.bindings[h])===null||a===void 0?void 0:a.find(m=>m.ref===t.ref);if(!p)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in p){const m=p.id,g=(i=p.filter)===null||i===void 0?void 0:i.event;return m&&((o=n.ids)===null||o===void 0?void 0:o.includes(m))&&(g==="*"||g?.toLocaleLowerCase()===((l=n.data)===null||l===void 0?void 0:l.type.toLocaleLowerCase()))}else{const m=(u=(c=p?.filter)===null||c===void 0?void 0:c.event)===null||u===void 0?void 0:u.toLocaleLowerCase();return m==="*"||m===((d=n?.event)===null||d===void 0?void 0:d.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===h})}_notThisChannelEvent(t,n){const{close:r,error:a,leave:i,join:o}=IV;return n&&[r,a,i,o].includes(t)&&n!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,n,r)=>{if(typeof n=="object"&&"ids"in n){const a=n.data,{schema:i,table:o,commit_timestamp:l,type:c,errors:u}=a;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:l,eventType:c,new:{},old:{},errors:u}),this._getPayloadRecords(a))}return n})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const n in t.bindings)for(const r of t.bindings[n])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=nM(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=nM(t.columns,t.old_record)),n}}class Tpe{constructor(t,n){this.socket=new jpe(t,n)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,r,a=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),a),this.socket.disconnect(()=>{t(),i("ok")},n,r)})}push(t){this.socket.push(t)}log(t,n,r){this.socket.log(t,n,r)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==vT.connecting}isDisconnecting(){return this.socket.connectionState()==vT.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const oM={HEARTBEAT_INTERVAL:25e3},Ape=[1e3,2e3,5e3,1e4],Rpe=1e4;function Ipe(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var n;return(n=Array.from(e.keys())[t])!==null&&n!==void 0?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function Ppe(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Ipe()}const Lpe=` 14 addEventListener("message", (e) => { 15 if (e.data.event === "start") { 16 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 17 } 18 });`;class Ope{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,n){var r;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={}
18,this.ref=0,this.serializer=new ope,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((r=n?.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey;const a=this._initializeOptions(n);this.socketAdapter=new Tpe(t,a),this.httpEndpoint=LV(t),this.fetch=this._resolveFetch(n?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const n=t.message;throw n.includes("Node.js")?new Error(`${n} 19 20To use Realtime in Node.js, you need to provide a WebSocket implementation: 21 22Option 1: Use Node.js 22+ which has native WebSocket support 23Option 2: Install and provide the "ws" package: 24 25 npm install ws 26 27 import ws from "ws" 28 const client = new RealtimeClient(url, { 29 ...options, 30 transport: ws 31 })`):new Error(`WebSocket not available: ${n}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,n){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,n)}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return n==="ok"&&t.teardown(),n}async removeAllChannels(){const t=this.channels.map(async r=>{const a=await r.unsubscribe();return r.teardown(),a}),n=await Promise.all(t);return await this.disconnect(),n}log(t,n,r){this.socketAdapter.log(t,n,r)}connectionState(){return this.socketAdapter.connectionState()||vT.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,n={config:{}}){const r=`realtime:${t}`,a=this.getChannels().find(i=>i.topic===r);if(a)return a;{const i=new kx(`realtime:${t}`,n,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}
31this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let n,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(a){this.log("error","Error fetching access token from callback",a),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(a=>{const i={access_token:n,version:spe};n&&a.updateJoinPayload(i),a.joinedOnce&&a.channelAdapter.isJoined()&&a.channelAdapter.push(IV.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(n=>{this.log("error","error waiting for auth on connect",n)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(n,r)=>{n=="sent"&&this._setAuthSafely(),t&&t(n,r)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([Lpe],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_initializeOptions(t){var n,r,a,i,o,l,c,u,d,h,p,m;this.worker=(n=t?.worker)!==null&&n!==void 0?n:!1,this.accessToken=(r=t?.accessToken)!==null&&r!==void 0?r:null;const g={};g.timeout=(a=t?.timeout)!==null&&a!==void 0?a:ape,g.heartbeatIntervalMs=(i=t?.heartbeatIntervalMs)!==null&&i!==void 0?i:oM.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=t?.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((l=t?.heartbeatIntervalMs)!==null&&l!==void 0?l:oM.HEARTBEAT_INTERVAL),g.transport=(c=t?.transport)!==null&&c!==void 0?c:epe.getWebSocketConstructor(),g.params=t?.params,g.logger=t?.logger,g.heartbeatCallback=this._wrapHeartbeatCallback(t?.heartbeatCallback),g.sessionStorage=(u=t?.sessionStorage)!==null&&u!==void 0?u:Ppe(),g.reconnectAfterMs=(d=t?.reconnectAfterMs)!==null&&d!==void 0?d:(v=>Ape[v-1]||Rpe);let x,b;const y=(h=t?.vsn)!==null&&h!==void 0?h:rpe;switch(y){case npe:x=(v,w)=>w(JSON.stringify(v)),b=(v,w)=>w(JSON.parse(v));break;case RV:x=this.serializer.encode.bind(this.serializer),b=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${g.vsn}`)}if(g.vsn=y,g.encode=(p=t?.encode)!==null&&p!==void 0?p:x,g.decode=(m=t?.decode)!==null&&m!==void 0?m:b,g.beforeReconnect=this._reconnectAuth.bind(this),(t?.logLevel||t?.log_level)&&(this.logLevel=t.logLevel||t.log_level,g.params=Object.assign(Object.assign({},g.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t?.workerUrl,g.autoSendHeartbeat=!this.worker}return g}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}
vendor: 4,874 bytes, line 31
31var db=class extends Error{constructor(e,t){super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&t.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Mpe(e,t,n){const r=new URL(t,e);if(n)for(const[a,i]of Object.entries(n))i!==void 0&&r.searchParams.set(a,i);return r.toString()}async function Dpe(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function $pe(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:a,body:i,headers:o}){const l=Mpe(e.baseUrl,r,a),c=await Dpe(e.auth),u=await t(l,{method:n,headers:{...i?{"Content-Type":"application/json"}:{},...c,...o},body:i?JSON.stringify(i):void 0}),d=await u.text(),h=(u.headers.get("content-type")||"").includes("application/json"),p=h&&d?JSON.parse(d):d;if(!u.ok){const m=h?p:void 0,g=m?.error;throw new db(g?.message??`Request failed with status ${u.status}`,{status:u.status,icebergType:g?.type,icebergCode:g?.code,details:m})}return{status:u.status,headers:u.headers,data:p}}}}function ky(e){return e.join("�")}var Fpe=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:ky(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ky(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ky(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ky(e.namespace)}`}),!0}catch(t){if(t instanceof db&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof db&&n.status===409)return;throw n}}};function _p(e){return e.join("�")}var Bpe=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${_p(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${_p(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${_p(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${_p(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${_p(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${_p(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof db&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof db&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},Upe=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=$pe({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new Fpe(this.client,t),this.tableOps=new Bpe(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}
31async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function hb(e){"@babel/helpers - typeof";return hb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hb(e)}function zpe(e,t){if(hb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hpe(e){var t=zpe(e,"string");return hb(t)=="symbol"?t:t+""}function qpe(e,t,n){return(t=Hpe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function os(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lM(Object(n),!0).forEach(function(r){qpe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var f_=class extends Error{constructor(e,t="storage",n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function g_(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var kT=class extends f_{constructor(e,t,n,r="storage"){super(e,r,t,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=n}toJSON(){return os({},super.toJSON())}},MV=class extends f_{constructor(e,t,n="storage"){super(e,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function yw(e,t,n){const r=os({},e),a=t.toLowerCase();for(const i of Object.keys(r))i.toLowerCase()===a&&delete r[i];return r[a]=n,r}function Wpe(e){const t={};for(const[n,r]of Object.entries(e))t[n.toLowerCase()]=r;return t}const Vpe=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Gpe=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},NT=e=>{if(Array.isArray(e))return e.map(n=>NT(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const a=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[a]=NT(r)}),t},Ype=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),cM=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const n=t.error;if(typeof n.message=="string")return n.message}}return JSON.stringify(e)},Kpe=async(e,t,n,r)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const a=e;let i=parseInt(String(a.status),10);Number.isFinite(i)||(i=500),a.json().then(o=>{const l=o?.statusCode||o?.code||i+"";t(new kT(cM(o),i,l,r))}).catch(()=>{const o=i+"";t(new kT(a.statusText||`HTTP ${i} error`,i,o,r))})}else t(new MV(cM(e),e,r))},Xpe=(e,t,n,r)=>{const a={method:e,headers:t?.headers||{}};if(e==="GET"||e==="HEAD"||!r)return os(os({},a),n);if(Gpe(r)){var i;const o=t?.headers||{};let l;for(const[c,u]of Object.entries(o))c.toLowerCase()==="content-type"&&(l=u);a.headers=yw(o,"Content-Type",(i=l)!==null&&i!==void 0?i:"application/json"),a.body=JSON.stringify(r)}else a.body=r;return t?.duplex&&(a.duplex=t.duplex),os(os({},a),n)};async function yg(e,t,n,r,a,i,o){return new Promise((l,c)=>{e(n,Xpe(t,r,a,i)).then(u=>{if(!u.ok)throw u;if(r?.noResolveJson)return u;if(o==="vectors"){const d=u.headers.get("content-type");if(u.headers.get("content-length")==="0"||u.status===204)return{};if(!d||!d.includes("application/json"))return{}}return u.json()}).then(u=>l(u)).catch(u=>Kpe(u,c,r,o))})}function DV(e="storage"){return{get:async(t,n,r,a)=>yg(t,"GET",n,r,a,void 0,e),post:async(t,n,r,a,i)=>yg(t,"POST",n,a,i,r,e),put:async(t,n,r,a,i)=>yg(t,"PUT",n,a,i,r,e),head:async(t,n,r,a)=>yg(t,"HEAD",n,os(os({},r),{},{noResolveJson:!0}),a,void 0,e),remove:async(t,n,r,a,i)=>yg(t,"DELETE",n,a,i,r,e)}}const Jpe=DV("storage"),{get:pb,post:lo,put:ET,head:Qpe,remove:c4}=Jpe,ji=DV("vectors");var Sf=class{constructor(e,t={},n,r="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=Wpe(t),this.fetch=Vpe(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=yw(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(g_(n))return{data:null,error:n};throw n}}}
31,Zpe=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(g_(t))return{data:null,error:t};throw t}}};let $V;$V=Symbol.toStringTag;var eme=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[$V]="BlobDownloadBuilder",this.promise=null}asStream(){return new Zpe(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(g_(t))return{data:null,error:t};throw t}}};const tme={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},uM={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var sme=class extends Sf{constructor(e,t={},n,r){super(e,t,r,"storage"),this.bucketId=n}async uploadOrUpdate(e,t,n,r){var a=this;return a.handleOperation(async()=>{let i;const o=os(os({},uM),r);let l=os(os({},a.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;if(typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",a.encodeMetadata(c)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),c&&!i.has("metadata")&&i.append("metadata",a.encodeMetadata(c))):(i=n,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=a.toBase64(a.encodeMetadata(c))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),r?.headers)for(const[p,m]of Object.entries(r.headers))l=yw(l,p,m);const u=a._removeEmptyFolders(t),d=a._getFinalPath(u),h=await(e=="PUT"?ET:lo)(a.fetch,`${a.url}/object/${d}`,i,os({headers:l},o?.duplex?{duplex:o.duplex}:{}));return{path:u,id:h.Id,fullPath:h.Key}})}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var a=this;const i=a._removeEmptyFolders(e),o=a._getFinalPath(i),l=new URL(a.url+`/object/upload/sign/${o}`);return l.searchParams.set("token",t),a.handleOperation(async()=>{let c;const u=os(os({},uM),r);let d=os(os({},a.headers),{"x-upsert":String(u.upsert)});const h=u.metadata;if(typeof Blob<"u"&&n instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),h&&c.append("metadata",a.encodeMetadata(h)),c.append("",n)):typeof FormData<"u"&&n instanceof FormData?(c=n,c.has("cacheControl")||c.append("cacheControl",u.cacheControl),h&&!c.has("metadata")&&c.append("metadata",a.encodeMetadata(h))):(c=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,h&&(d["x-metadata"]=a.toBase64(a.encodeMetadata(h))),(typeof ReadableStream<"u"&&c instanceof ReadableStream||c&&typeof c=="object"&&"pipe"in c&&typeof c.pipe=="function")&&!u.duplex&&(u.duplex="half")),r?.headers)for(const[p,m]of Object.entries(r.headers))d=yw(d,p,m);return{path:i,fullPath:(await ET(a.fetch,l.toString(),c,os({headers:d},u?.duplex?{duplex:u.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const a=os({},n.headers);t?.upsert&&(a["x-upsert"]="true");const i=await lo(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:a}),o=new URL(n.url+i.url),l=o.searchParams.get("token");if(!l)throw new f_("No token returned by API");return{signedUrl:o.toString(),path:e,token:l}})}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;return r.handleOperation(async()=>await lo(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,de
31stinationBucket:n?.destinationBucket},{headers:r.headers}))}async copy(e,t,n){var r=this;return r.handleOperation(async()=>({path:(await lo(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(e,t,n){var r=this;return r.handleOperation(async()=>{let a=r._getFinalPath(e);const i=typeof n?.transform=="object"&&n.transform!==null&&Object.keys(n.transform).length>0;let o=await lo(r.fetch,`${r.url}/object/sign/${a}`,os({expiresIn:t},i?{transform:n.transform}:{}),{headers:r.headers});const l=new URLSearchParams;n?.download&&l.set("download",n.download===!0?"":n.download),n?.cacheNonce!=null&&l.set("cacheNonce",String(n.cacheNonce));const c=l.toString();return{signedUrl:encodeURI(`${r.url}${o.signedURL}${c?`&${c}`:""}`)}})}async createSignedUrls(e,t,n){var r=this;return r.handleOperation(async()=>{const a=await lo(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),i=new URLSearchParams;n?.download&&i.set("download",n.download===!0?"":n.download),n?.cacheNonce!=null&&i.set("cacheNonce",String(n.cacheNonce));const o=i.toString();return a.map(l=>os(os({},l),{},{signedUrl:l.signedURL?encodeURI(`${r.url}${l.signedURL}${o?`&${o}`:""}`):null}))})}download(e,t,n){const r=typeof t?.transform=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",a=new URLSearchParams;t?.transform&&this.applyTransformOptsToQuery(a,t.transform),t?.cacheNonce!=null&&a.set("cacheNonce",String(t.cacheNonce));const i=a.toString(),o=this._getFinalPath(e),l=()=>pb(this.fetch,`${this.url}/${r}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},n);return new eme(l,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);return t.handleOperation(async()=>NT(await pb(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await Qpe(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(a){if(t.shouldThrowOnError)throw a;if(g_(a)){var r;const i=a instanceof kT?a.status:a instanceof MV?(r=a.originalError)===null||r===void 0?void 0:r.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:a}}throw a}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=new URLSearchParams;t?.download&&r.set("download",t.download===!0?"":t.download),t?.transform&&this.applyTransformOptsToQuery(r,t.transform),t?.cacheNonce!=null&&r.set("cacheNonce",String(t.cacheNonce));const a=r.toString(),i=typeof t?.transform=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}`)+(a?`?${a}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await c4(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,n){var r=this;return r.handleOperation(async()=>{const a=os(os(os({},tme),t),{},{prefix:e||""});return await lo(r.fetch,`${r.url}/object/list/${r.bucketId}`,a,{headers:r.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{const r=os({},e);return await lo(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const nme="2.105.4",u0={"X-Client-Info":`storage-js/${nme}`};var rme=class extends Sf{constructor(e,t={},n,r){const a=new URL(e);r?.useNewHostname&&/supabase\.(co|in|red)$/.test(a.hostname)&&!a.hostname.includes("storage.supabase.")&&(a.hostname=a.hostname.replace("supabase.","storage.supabase."));const i=a.href.replace(/\/$/,""),o=os(os({},u0),t);super(i,o,n,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=t.listBucketOptionsToQueryString(e);return await pb(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await pb(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await lo(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await ET(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await lo(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await c4(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},ame=class extends Sf{constructor(e,t={},n){const r=e.replace(/\/$/,""),a=os(os({},u0),t);super(r,a,n,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await lo(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=new URLSearchParams;e?.limit!==void 0&&n.set("limit",e.limit.toString()),e?.offset!==void 0&&n.set("offset",e.offset.toString()),e?.sortColumn&&n.set("sortColumn",e.sortColumn),e?.sortOrder&&n.set("sortOrder",e.sortOrder),e?.search&&n.set("search",e.search);const r=n.toString(),a=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return await pb(t.fetch,a,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await c4(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Ype(e))throw new f_("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new Upe({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}
31),r=this.shouldThrowOnError;return new Proxy(n,{get(a,i){const o=a[i];return typeof o!="function"?o:async(...l)=>{try{return{data:await o.apply(a,l),error:null}}catch(c){if(r)throw c;return{data:null,error:c}}}}})}},ime=class extends Sf{constructor(e,t={},n){const r=e.replace(/\/$/,""),a=os(os({},u0),{},{"Content-Type":"application/json"},t);super(r,a,n,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await ji.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await ji.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await ji.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await ji.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},ome=class extends Sf{constructor(e,t={},n){const r=e.replace(/\/$/,""),a=os(os({},u0),{},{"Content-Type":"application/json"},t);super(r,a,n,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await ji.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await ji.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await ji.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await ji.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await ji.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},lme=class extends Sf{constructor(e,t={},n){const r=e.replace(/\/$/,""),a=os(os({},u0),{},{"Content-Type":"application/json"},t);super(r,a,n,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await ji.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await ji.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await ji.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await ji.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},cme=class extends lme{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new ume(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},ume=class extends ime{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,os(os({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,os(os({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new dme(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},dme=class extends ome{constructor(e,t,n,r,a){super(e,t,a),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,os(os({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,os(os({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,os(os({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,os(os({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,os(os({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},hme=class extends rme{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new sme(this.url,this.headers,e,this.fetch)}get vectors(){return new cme(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new ame(this.url+"/iceberg",this.headers,this.fetch)}};const FV="2.105.4",Jp=30*1e3,ST=3,aN=ST*Jp,pme="http://localhost:9999",mme="supabase.auth.token",fme={"X-Client-Info":`gotrue-js/${FV}`},CT="X-Supabase-Api-Version",BV={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},gme=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,xme=600*1e3;
31class mb extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function Ct(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class bme extends mb{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function yme(e){return Ct(e)&&e.name==="AuthApiError"}class vo extends mb{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class yc extends mb{constructor(t,n,r,a){super(t,r,a),this.name=n,this.status=r}}class Lr extends yc{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Ny(e){return Ct(e)&&e.name==="AuthSessionMissingError"}class kp extends yc{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Ey extends yc{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Sy extends yc{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function vme(e){return Ct(e)&&e.name==="AuthImplicitGrantRedirectError"}class dM extends yc{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class wme extends yc{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class TT extends yc{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function iN(e){return Ct(e)&&e.name==="AuthRetryableFetchError"}class hM extends yc{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class AT extends yc{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const vw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),pM=` 32\r=`.split(""),jme=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<pM.length;t+=1)e[pM[t].charCodeAt(0)]=-2;for(let t=0;t<vw.length;t+=1)e[vw[t].charCodeAt(0)]=t;return e})();function mM(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(vw[r]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(vw[r]),t.queuedBits-=6}}function UV(e,t,n){const r=jme[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function fM(e){const t=[],n=o=>{t.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},i=o=>{Nme(o,r,n)};for(let o=0;o<e.length;o+=1)UV(e.charCodeAt(o),a,i);return t.join("")}function _me(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function kme(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const a=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|a)+65536,n+=1}_me(r,t)}}function Nme(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let r=1;r<6;r+=1)if((e>>7-r&1)===0){t.utf8seq=r;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function Cm(e){const t=[],n={queue:0,queuedBits:0},r=a=>{t.push(a)};for(let a=0;a<e.length;a+=1)UV(e.charCodeAt(a),n,r);return new Uint8Array(t)}function Eme(e){const t=[];return kme(e,n=>t.push(n)),new Uint8Array(t)}function zd(e){const t=[],n={queue:0,queuedBits:0},r=a=>{t.push(a)};return e.forEach(a=>mM(a,n,r)),mM(null,n,r),t.join("")}function Sme(e){return Math.round(Date.now()/1e3)+e}function Cme(){return Symbol("auth-callback")}const Gr=()=>typeof window<"u"&&typeof document<"u",Zu={tested:!1,writable:!1},zV=()=>
32{if(!Gr())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Zu.tested)return Zu.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Zu.tested=!0,Zu.writable=!0}catch{Zu.tested=!0,Zu.writable=!1}return Zu.writable};function Tme(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((a,i)=>{t[i]=a})}catch{}return n.searchParams.forEach((r,a)=>{t[a]=r}),t}const HV=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Ame=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Qp=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},ed=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return null}},Wr=async(e,t)=>{await e.removeItem(t)};class x_{constructor(){this.promise=new x_.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}x_.promiseConstructor=Promise;function Cy(e){const t=e.split(".");if(t.length!==3)throw new AT("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!gme.test(t[r]))throw new AT("JWT not in base64url format");return{header:JSON.parse(fM(t[0])),payload:JSON.parse(fM(t[1])),signature:Cm(t[2]),raw:{header:t[0],payload:t[1]}}}async function Rme(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function Ime(e,t){return new Promise((r,a)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){r(o);return}}catch(o){if(!t(i,o)){a(o);return}}})()})}function Pme(e){return("0"+e.toString(16)).substr(-2)}function Lme(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let a="";for(let i=0;i<56;i++)a+=n.charAt(Math.floor(Math.random()*r));return a}return crypto.getRandomValues(t),Array.from(t,Pme).join("")}async function Ome(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),a=new Uint8Array(r);return Array.from(a).map(i=>String.fromCharCode(i)).join("")}async function Mme(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await Ome(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Np(e,t,n=!1){const r=Lme();let a=r;n&&(a+="/recovery"),await Qp(e,`${t}-code-verifier`,a);const i=await Mme(r);return[i,r===i?"plain":"s256"]}const Dme=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function $me(e){const t=e.headers.get(CT);if(!t||!t.match(Dme))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Fme(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function Bme(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Ume=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Cl(e){if(!Ume.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function io(e){if(!e.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function oN(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function zme(e,t){return new Proxy(e,{get:(n,r,a)=>{if(r==="__isInsecureUserWarningProxy")return!0;
32if(typeof r=="symbol"){const i=r.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,a)}return!t.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(n,r,a)}})}function gM(e){return JSON.parse(JSON.stringify(e))}const kd=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error}return JSON.stringify(e)},Hme=[502,503,504,520,521,522,523,524,530];async function xM(e){var t;if(!Ame(e))throw new TT(kd(e),0);if(Hme.includes(e.status))throw new TT(kd(e),e.status);let n;try{n=await e.json()}catch(i){throw new vo(kd(i),i)}let r;const a=$me(e);if(a&&a.getTime()>=BV["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new hM(kd(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new Lr}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new hM(kd(n),e.status,n.weak_password.reasons);throw new bme(kd(n),e.status||500,r)}const qme=(e,t,n,r)=>{const a={method:e,headers:t?.headers||{}};return e==="GET"?a:(a.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),a.body=JSON.stringify(r),Object.assign(Object.assign({},a),n))};async function Wt(e,t,n,r){var a;const i=Object.assign({},r?.headers);i[CT]||(i[CT]=BV["2024-01-01"].name),r?.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(a=r?.query)!==null&&a!==void 0?a:{};r?.redirectTo&&(o.redirect_to=r.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await Wme(e,t,n+l,{headers:i,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(c):{data:Object.assign({},c),error:null}}async function Wme(e,t,n,r,a,i){const o=qme(t,r,a,i);let l;try{l=await e(n,Object.assign({},o))}catch(c){throw console.error(c),new TT(kd(c),0)}if(l.ok||await xM(l),r?.noResolveJson)return l;try{return await l.json()}catch(c){await xM(c)}}function Mi(e){var t;let n=null;Yme(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=Sme(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function bM(e){const t=Mi(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(t.data.weak_password=e.weak_password),t}function su(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Vme(e){return{data:e,error:null}}function Gme(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:a,verification_type:i}=e,o=m_(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:n,hashed_token:r,redirect_to:a,verification_type:i},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function yM(e){return e}function Yme(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const lN=["global","local","others"];class Kme{constructor({url:t="",headers:n={},fetch:r,experimental:a}){this.url=t,this.headers=n,this.fetch=HV(r),this.experimental=a??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}
vendor: 4,697 bytes, line 32
32async signOut(t,n=lN[0]){if(lN.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${lN.join(", ")}`);try{return await Wt(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Ct(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await Wt(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:su})}catch(r){if(Ct(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=m_(t,["options"]),a=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(a.new_email=r?.newEmail,delete a.newEmail),await Wt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:Gme,redirectTo:n?.redirectTo})}catch(n){if(Ct(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Wt(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:su})}catch(n){if(Ct(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,a,i,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Wt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t?.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(a=t?.perPage)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:""},xform:yM});if(d.error)throw d.error;const h=await d.json(),p=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return m.length>0&&(m.forEach(g=>{const x=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(g.split(";")[1].split("=")[1]);u[`${b}Page`]=x}),u.total=parseInt(p)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(Ct(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){Cl(t);try{return await Wt(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:su})}catch(n){if(Ct(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){Cl(t);try{return await Wt(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:su})}catch(r){if(Ct(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){Cl(t);try{return await Wt(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:su})}catch(r){if(Ct(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){Cl(t.userId);try{const{data:n,error:r}=await Wt(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:n,error:r}}catch(n){if(Ct(n))return{data:null,error:n};throw n}}async _deleteFactor(t){Cl(t.userId),Cl(t.id);try{return{data:await Wt(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(Ct(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,a,i,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Wt(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t?.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(a=t?.perPage)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:""},xform:yM});if(d.error)throw d.error;const h=await d.json(),p=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return m.length>0&&(m.forEach(g=>{const x=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(g.split(";")[1].split("=")[1]);u[`${b}Page`]=x}),u.total=parseInt(p)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(Ct(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(t){try{return await Wt(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ct(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Wt(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ct(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Wt(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Ct(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await Wt(this.fetch,"DELET
32E",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Ct(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Wt(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ct(n))return{data:null,error:n};throw n}}async _listCustomProviders(t){try{const n={};return t?.type&&(n.type=t.type),await Wt(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:r=>{var a;return{data:{providers:(a=r?.providers)!==null&&a!==void 0?a:[]},error:null}}})}catch(n){if(Ct(n))return{data:{providers:[]},error:n};throw n}}async _createCustomProvider(t){try{return await Wt(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ct(n))return{data:null,error:n};throw n}}async _getCustomProvider(t){try{return await Wt(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ct(n))return{data:null,error:n};throw n}}async _updateCustomProvider(t,n){try{return await Wt(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Ct(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(t){try{return await Wt(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Ct(n))return{data:null,error:n};throw n}}async _adminListPasskeys(t){io(this.experimental),Cl(t.userId);try{return await Wt(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ct(n))return{data:null,error:n};throw n}}async _adminDeletePasskey(t){io(this.experimental),Cl(t.userId),Cl(t.passkeyId);try{return await Wt(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Ct(n))return{data:null,error:n};throw n}}}function vM(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const Do={debug:!!(globalThis&&zV()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class qV extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class wM extends qV{}async function Xme(e,t,n){Do.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;let a;t>0&&(a=setTimeout(()=>{r.abort(),Do.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async i=>{if(i){clearTimeout(a),Do.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await n()}finally{Do.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw Do.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new wM(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Do.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),clearTimeout(a),await n()}})}catch(i){if(t>0&&clearTimeout(a),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&t>0){if(r.signal.aborted)return Do.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@
32supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async o=>{if(o){Do.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,o.name);try{return await n()}finally{Do.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await n()}));throw Do.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new wM(`Lock "${e}" was released because another request stole it`)}throw i}}function Jme(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function WV(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Qme(e){return parseInt(e,16)}function Zme(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function efe(e){var t;const{chainId:n,domain:r,expirationTime:a,issuedAt:i=new Date,nonce:o,notBefore:l,requestId:c,resources:u,scheme:d,uri:h,version:p}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(p!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${p}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(` 33`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const m=WV(e.address),g=d?`${d}://${r}`:r,x=e.statement?`${e.statement} 34`:"",b=`${g} wants you to sign in with your Ethereum account: 35${m} 36 37${x}`;let y=`URI: ${h} 38Version: ${p} 39Chain ID: ${n}${o?` 40Nonce: ${o}`:""} 41Issued At: ${i.toISOString()}`;if(a&&(y+=` 42Expiration Time: ${a.toISOString()}`),l&&(y+=` 43Not Before: ${l.toISOString()}`),c&&(y+=` 44Request ID: ${c}`),u){let v=` 45Resources:`;for(const w of u){if(!w||typeof w!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${w}`);v+=` 46- ${w}`}y+=v}return`${b} 47${y}`}class pr extends Error{constructor({message:t,code:n,cause:r,name:a}){var i;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=a??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=n}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class ww extends pr{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function tfe({error:e,options:t}){var n,r,a;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new pr({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new pr({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new pr({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((a=i.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new pr({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new pr({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new pr({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new pr({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new pr({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const o=window.location.hostname;if(VV(o)){if(i.rp.id!==o)return new pr({message:`The RP ID "${i.rp.id}
47" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new pr({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new pr({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new pr({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new pr({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function sfe({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new pr({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new pr({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(VV(r)){if(n.rpId!==r)return new pr({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new pr({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new pr({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new pr({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class nfe{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const RT=new nfe;function jM(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,a=m_(e,["challenge","user","excludeCredentials"]),i=Cm(t).buffer,o=Object.assign(Object.assign({},n),{id:Cm(n.id).buffer}),l=Object.assign(Object.assign({},a),{challenge:i,user:o});if(r&&r.length>0){l.excludeCredentials=new Array(r.length);for(let c=0;c<r.length;c++){const u=r[c];l.excludeCredentials[c]=Object.assign(Object.assign({},u),{id:Cm(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return l}function _M(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,r=m_(e,["challenge","allowCredentials"]),a=Cm(t).buffer,i=Object.assign(Object.assign({},r),{challenge:a});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const l=n[o];i.allowCredentials[o]=Object.assign(Object.assign({},l),{id:Cm(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return i}function kM(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:zd(new Uint8Array(e.response.attestationObject)),clientDataJSON:zd(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function NM(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),a=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:zd(new Uint8Array(a.authenticatorData)),clientDataJSON:zd(new Uint8Array(a.clientDataJSON)),signature:zd(new Uint8Array(a.signature)),userHandle:a.userHandle?zd(new Uint8Array(a.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function VV(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function jw(){var e,t;return!!(Gr()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.get)=="function")}async function GV(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new ww("Browser returned unexpected credential type",t)}:{data:null,error:new ww("Empty credential response",t)}}
47catch(t){return{data:null,error:tfe({error:t,options:e})}}}async function YV(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new ww("Browser returned unexpected credential type",t)}:{data:null,error:new ww("Empty credential response",t)}}catch(t){return{data:null,error:sfe({error:t,options:e})}}}const rfe={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},afe={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function _w(...e){const t=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),n=a=>a instanceof ArrayBuffer||ArrayBuffer.isView(a),r={};for(const a of e)if(a)for(const i in a){const o=a[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(n(o))r[i]=o;else if(t(o)){const l=r[i];t(l)?r[i]=_w(l,o):r[i]=_w(o)}else r[i]=o}return r}function ife(e,t){return _w(rfe,e,t||{})}function ofe(e,t){return _w(afe,e,t||{})}class lfe{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:r,signal:a},i){var o;try{const{data:l,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!l)return{data:null,error:c};const u=a??RT.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:d}=l.webauthn.credential_options.publicKey;if(!d.name){const h=r;if(h)d.name=`${d.id}:${h}`;else{const m=(await this.client.getUser()).data.user,g=((o=m?.user_metadata)===null||o===void 0?void 0:o.name)||m?.email||m?.id||"User";d.name=`${d.id}:${g}`}}d.displayName||(d.displayName=d.name)}switch(l.webauthn.type){case"create":{const d=ife(l.webauthn.credential_options.publicKey,i?.create),{data:h,error:p}=await GV({publicKey:d,signal:u});return h?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:p}}case"request":{const d=ofe(l.webauthn.credential_options.publicKey,i?.request),{data:h,error:p}=await YV(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:d,signal:u}));return h?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:p}}}}catch(l){return Ct(l)?{data:null,error:l}:{data:null,error:new vo("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:a}={}},i){if(!n)return{data:null,error:new mb("rpId is required for WebAuthn authentication")};try{if(!jw())return{data:null,error:new vo("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:a},{request:i});if(!o)return{data:null,error:l};const{webauthn:c}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:c.type,rpId:n,rpOrigins:r,credential_response:c.credential_response}})}catch(o){return Ct(o)?{data:null,error:o}:{data:null,error:new vo("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:a}={}},i){if(!n)return{data:null,error:new mb("rpId is required for WebAuthn registration")};try{if(!jw())return{data:null,error:new vo("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this._enroll({friendlyName:t});if(!o)return await this.client.mfa.listFactors().then(d=>{var h;return(h=d.data)===null||h===void 0?void 0:h.all.find(p=>p.factor_type==="webauthn"&&p.friendly_name===t&&p.status!=="unverified")}).then(d=>d?this.client.mfa.unenroll({factorId:d?.id}):void 0),{data:null,error:l};const{data:c,error:u}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:a},{create:i});return c?this._verify({factorId:o.id,challengeId:c.challengeId,webauthn:{rpId:n,rpOrigins:r,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:u}}catch(o){return Ct(o)?{data:null,error:o}:{data:null,error:new vo("Unexpected error in register",o)}}}}Jme();const cfe={url:pme,storageKey:mme,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:fme,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function EM(e,t,n){return await n()}const Ep={};class fb{get jwks(){var t,n;return(n=(t=Ep[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){Ep[this.storageKey]=Object.assign(Object.assign({},Ep[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=Ep[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Ep[this.storageKey]=Object.assign(Object.assign({},Ep[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,a,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const o=Object.assign(Object.assign({},cfe),t);if(this.storageKey=o.storageKey,this.instanceID=(n=fb.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,fb.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Gr()){const l=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(l),this.logDebugMessages&&console.trace(l)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.experimental=(r=o.experimental)!==null&&r!==void 0?r:{},this.admin=new Kme({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=HV(o.fetch),this.lock=o.lock||EM,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&Gr()&&(!((a=globalThis?.navigator)===null||a===void 0)&&a.locks)?this.lock=Xme:this.lock=EM,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new lfe(this)}
47,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(o.storage?this.storage=o.storage:zV()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=vM(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=vM(this.memoryStorage)),Gr()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(l){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",l)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async l=>{this._debug("received broadcast notification from other tab or client",l);try{await this._notifyAllSubscribers(l.data.event,l.data.session,!1)}catch(c){this._debug("#broadcastChannel","error",c)}})}o.skipAutoInitialize||this.initialize().catch(l=>{this._debug("#initialize()","error",l)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${FV}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let n={},r="none";if(Gr()&&(n=Tme(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),Gr()&&this.detectSessionInUrl&&r!=="none"){const{data:a,error:i}=await this._getSessionFromURL(n,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),vme(i)){const c=(t=i.details)===null||t===void 0?void 0:t.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:l}=a;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Ct(n)?this._returnResult({error:n}):this._returnResult({error:new vo("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,a;try{const i=await Wt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=t?.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(a=t?.options)===null||a===void 0?void 0:a.captchaToken}},xform:Mi}),{data:o,error:l}=i;if(l||!o)return this._returnResult({data:{user:null,session:null},error:l});const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(Ct(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var n,r,a;try{let i;if("email"in t){const{email:d,password:h,options:p}=t;let m=null,g=null;this.flowType==="pkce"&&([m,g]=await Np(this.storage,this.storageKey)),i=await Wt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:p?.emailRedirectTo,body:{email:d,password:h,data:(n=p?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:p?.captchaToken},code_challenge:m,code_challenge_method:g},xform:Mi})}else if("phone"in t){const{phone:d,password:h,options:p}=t;i=await Wt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:h,data:(r=p?.data)!==null&&r!==void 0?r:{},channel:(a=p?.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:p?.captchaToken}},xform:Mi})}else throw new Ey("You must provide either an email or phone number and a password");const{data:o,error:l}=i;if(l||!o)return await Wr(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l});const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(await Wr(this.storage,`${this.storageKey}-code-verifier`),Ct(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let n;if("email"in t){const{email:i,password:o,options:l}=t;n=await Wt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:l?.captchaToken}},xform:bM})}else if("phone"in t){const{phone:i,password:o,options:l}=t;n=await Wt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:l?.captchaToken}},xform:bM})}else throw new Ey("You must provide either an email or phone number and a password");const{data:r,error:a}=n;
47if(a)return this._returnResult({data:{user:null,session:null},error:a});if(!r||!r.session||!r.user){const i=new kp;return this._returnResult({data:{user:null,session:null},error:i})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:a})}catch(n){if(Ct(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,a,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(a=t.options)===null||a===void 0?void 0:a.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,a,i,o,l,c,u,d,h,p;let m,g;if("message"in t)m=t.message,g=t.signature;else{const{chain:x,wallet:b,statement:y,options:v}=t;let w;if(Gr())if(typeof b=="object")w=b;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")w=C.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof b!="object"||!v?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=b}const j=new URL((n=v?.url)!==null&&n!==void 0?n:window.location.href),E=await w.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!E||E.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const S=WV(E[0]);let _=(r=v?.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!_){const C=await w.request({method:"eth_chainId"});_=Qme(C)}const k={domain:j.host,address:S,statement:y,uri:j.href,version:"1",chainId:_,nonce:(a=v?.signInWithEthereum)===null||a===void 0?void 0:a.nonce,issuedAt:(o=(i=v?.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(l=v?.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=v?.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=v?.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=v?.signInWithEthereum)===null||d===void 0?void 0:d.resources};m=efe(k),g=await w.request({method:"personal_sign",params:[Zme(m),S]})}try{const{data:x,error:b}=await Wt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:m,signature:g},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(p=t.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:Mi});if(b)throw b;if(!x||!x.session||!x.user){const y=new kp;return this._returnResult({data:{user:null,session:null},error:y})}return x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),this._returnResult({data:Object.assign({},x),error:b})}catch(x){if(Ct(x))return this._returnResult({data:{user:null,session:null},error:x});throw x}}async signInWithSolana(t){var n,r,a,i,o,l,c,u,d,h,p,m;let g,x;if("message"in t)g=t.message,x=t.signature;else{const{chain:b,wallet:y,statement:v,options:w}=t;let j;if(Gr())if(typeof y=="object")j=y;else{const S=window;if("solana"in S&&typeof S.solana=="object"&&("signIn"in S.solana&&typeof S.solana.signIn=="function"||"signMessage"in S.solana&&typeof S.solana.signMessage=="function"))j=S.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof y!="object"||!w?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=y}const E=new URL((n=w?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in j&&j.signIn){const S=await j.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w?.signInWithSolana),{version:"1",domain:E.host,uri:E.href}),v?{statement:v}:null));let _;if(Array.isArray(S)&&S[0]&&typeof S[0]=="object")_=S[0];else if(S&&typeof S=="object"&&"signedMessage"in S&&"signature"in S)_=S;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in _&&"signature"in _&&(typeof _.signedMessage=="string"||_.signedMessage instanceof Uint8Array)&&_.signature instanceof Uint8Array)g=typeof _.signedMessage=="string"?_.signedMessage:new TextDecoder().decode(_.signedMessage),x=_.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in j)||typeof j.signMessage!="function"||!("publicKey"in j)||typeof j!="object"||!j.publicKey||!("toBase58"in j.publicKey)||typeof j.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${E.host} wants you to sign in with your Solana account:`,j.publicKey.toBase58(),...v?["",v,""]:[""],"Version: 1",`URI: ${E.href}`,`Issued At: ${(a=(r=w?.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((i=w?.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((o=w?.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((l=w?.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((c=w?.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((u=w?.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((h=(d=w?.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",...w.sign
47InWithSolana.resources.map(_=>`- ${_}`)]:[]].join(` 48`);const S=await j.signMessage(new TextEncoder().encode(g),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");x=S}}try{const{data:b,error:y}=await Wt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:zd(x)},!((p=t.options)===null||p===void 0)&&p.captchaToken?{gotrue_meta_security:{captcha_token:(m=t.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:Mi});if(y)throw y;if(!b||!b.session||!b.user){const v=new kp;return this._returnResult({data:{user:null,session:null},error:v})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:y})}catch(b){if(Ct(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async _exchangeCodeForSession(t){const n=await ed(this.storage,`${this.storageKey}-code-verifier`),[r,a]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new wme;const{data:i,error:o}=await Wt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:Mi});if(await Wr(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const l=new kp;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(a==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:a??null}),error:o})}catch(i){if(await Wr(this.storage,`${this.storageKey}-code-verifier`),Ct(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:n,provider:r,token:a,access_token:i,nonce:o}=t,l=await Wt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:a,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:Mi}),{data:c,error:u}=l;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user){const d=new kp;return this._returnResult({data:{user:null,session:null},error:d})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:u})}catch(n){if(Ct(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,a,i,o;try{if("email"in t){const{email:l,options:c}=t;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await Np(this.storage,this.storageKey));const{error:h}=await Wt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(n=c?.data)!==null&&n!==void 0?n:{},create_user:(r=c?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:c?.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in t){const{phone:l,options:c}=t,{data:u,error:d}=await Wt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(a=c?.data)!==null&&a!==void 0?a:{},create_user:(i=c?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c?.captchaToken},channel:(o=c?.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:u?.message_id},error:d})}throw new Ey("You must provide either an email or phone number.")}catch(l){if(await Wr(this.storage,`${this.storageKey}-code-verifier`),Ct(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(t){var n,r;try{let a,i;"options"in t&&(a=(n=t.options)===null||n===void 0?void 0:n.redirectTo,i=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:l}=await Wt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:a,xform:Mi});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,u=o.user;return c?.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(a){if(Ct(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithSSO(t){var n,r,a,i,o;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await Np(this.storage,this.storageKey));const u=await Wt(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}
48),!((a=t?.options)===null||a===void 0)&&a.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:l,code_challenge_method:c}),headers:this.headers,xform:Vme});return!((i=u.data)===null||i===void 0)&&i.url&&Gr()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(await Wr(this.storage,`${this.storageKey}-code-verifier`),Ct(l))return this._returnResult({data:null,error:l});throw l}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new Lr;const{error:a}=await Wt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:a})})}catch(t){if(Ct(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:a,options:i}=t,{error:o}=await Wt(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:a,gotrue_meta_security:{captcha_token:i?.captchaToken}},redirectTo:i?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in t){const{phone:r,type:a,options:i}=t,{data:o,error:l}=await Wt(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:a,gotrue_meta_security:{captcha_token:i?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o?.message_id},error:l})}throw new Ey("You must provide either an email or phone number and a type")}catch(n){if(Ct(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),a=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await a}catch{}})()),a}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await ed(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<aN:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const o=await ed(this.userStorage,this.storageKey+"-user");o?.user?t.user=o.user:t.user=oN()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=zme(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:a,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:a},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await Wt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:su}):await this._useSession(async n=>{var r,a,i;const{data:o,error:l}=n;if(l)throw l;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Lr}:await Wt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(a=o.session)===null||a===void 0?void 0:a.access_token)!==null&&i!==void 0?i:void 0,xform:su})})}catch(n){if(Ct(n))return Ny(n)&&(await this._removeSession(),await Wr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:a,error:i}=r;if(i)throw i;if(!a.session)throw new Lr;const o=a.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await Np(this.storage,this.storageKey));const{data:u,error:d}=await Wt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:su});if(d)throw d;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(r){if(await Wr(this.storage,`${this.storageKey}-code-verifier`),Ct(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Lr;const n=Date.now()/1e3;let r=n,a=!0,i=null;const{payload:o}=Cy(t.access_token);if(o.exp&&(r=o.exp,a=r<=n),a){const{data:l,error:c}=await this._callRefreshToken(t.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l)return{data:{user:null,session:null},error:null};i=l}else{const{data:l,error:c}=await this._getUser(t.access_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});i={access_token:t.access_token,refresh_token:t.refresh_token,user:l.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(n){if(Ct(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:o,error:l}=n;if(l)throw l;t=(r=o.session)!==null&&r!==void 0?r:void 0}if(!t?.refresh_token)throw new Lr;const{data:a,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):a?this._returnResult({data:{user:a.user,session:a},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(Ct(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){var r;try{if(!Gr())throw new Sy("No browser detected.");
48if(t.error||t.error_description||t.error_code)throw new Sy(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new dM("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Sy("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new dM("No code detected.");const{data:w,error:j}=await this._exchangeCodeForSession(t.code);if(j)throw j;const E=new URL(window.location.href);return E.searchParams.delete("code"),window.history.replaceState(window.history.state,"",E.toString()),{data:{session:w.session,redirectType:(r=w.redirectType)!==null&&r!==void 0?r:null},error:null}}const{provider_token:a,provider_refresh_token:i,access_token:o,refresh_token:l,expires_in:c,expires_at:u,token_type:d}=t;if(!o||!c||!l||!d)throw new Sy("No session defined in URL");const h=Math.round(Date.now()/1e3),p=parseInt(c);let m=h+p;u&&(m=parseInt(u));const g=m-h;g*1e3<=Jp&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${g}s, should have been closer to ${p}s`);const x=m-p;h-x>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",x,m,h):h-x<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",x,m,h);const{data:b,error:y}=await this._getUser(o);if(y)throw y;const v={provider_token:a,provider_refresh_token:i,access_token:o,expires_in:p,expires_at:m,refresh_token:l,token_type:d,user:b.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:v,redirectType:t.type},error:null})}catch(a){if(Ct(a))return this._returnResult({data:{session:null,redirectType:null},error:a});throw a}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await ed(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:a,error:i}=n;if(i&&!Ny(i))return this._returnResult({error:i});const o=(r=a.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:l}=await this.admin.signOut(o,t);if(l&&!(yme(l)&&(l.status===404||l.status===401||l.status===403)||Ny(l)))return this._returnResult({error:l})}return t!=="others"&&(await this._removeSession(),await Wr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=Cme(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,a;try{const{data:{session:i},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((a=this.stateChangeEmitters.get(t))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),Ny(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,n={}){let r=null,a=null;this.flowType==="pkce"&&([r,a]=await Np(this.storage,this.storageKey,!0));try{return await Wt(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:a,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(await Wr(this.storage,`${this.storageKey}-code-verifier`),Ct(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,error:a}=await this._useSession(async i=>{var o,l,c,u,d;const{data:h,error:p}=i;if(p)throw p;const m=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=t.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=t.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await Wt(this.fetch,"GET",m,{headers:this.headers,jwt:(d=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(a)throw a;return Gr()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r?.url),this._returnResult({data:{provider:t.provider,url:r?.url},error:null})}catch(r){if(Ct(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:a,data:{session:i}}=n;
48if(a)throw a;const{options:o,provider:l,token:c,access_token:u,nonce:d}=t,h=await Wt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i?.access_token)!==null&&r!==void 0?r:void 0,body:{provider:l,id_token:c,access_token:u,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:Mi}),{data:p,error:m}=h;return m?this._returnResult({data:{user:null,session:null},error:m}):!p||!p.session||!p.user?this._returnResult({data:{user:null,session:null},error:new kp}):(p.session&&(await this._saveSession(p.session),await this._notifyAllSubscribers("USER_UPDATED",p.session)),this._returnResult({data:p,error:m}))}catch(a){if(await Wr(this.storage,`${this.storageKey}-code-verifier`),Ct(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,a;const{data:i,error:o}=n;if(o)throw o;return await Wt(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(a=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&a!==void 0?a:void 0})})}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await Ime(async a=>(a>0&&await Rme(200*Math.pow(2,a-1)),this._debug(n,"refreshing attempt",a),await Wt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Mi})),(a,i)=>{const o=200*Math.pow(2,a);return i&&iN(i)&&Date.now()+o-r<Jp})}catch(r){if(this._debug(n,"error",r),Ct(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",r),Gr()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const a=await ed(this.storage,this.storageKey);if(a&&this.userStorage){let o=await ed(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:a.user},await Qp(this.userStorage,this.storageKey+"-user",o)),a.user=(t=o?.user)!==null&&t!==void 0?t:oN()}else if(a&&!a.user&&!a.user){const o=await ed(this.storage,this.storageKey+"-user");o&&o?.user?(a.user=o.user,await Wr(this.storage,this.storageKey+"-user"),await Qp(this.storage,this.storageKey,a)):a.user=oN()}if(this._debug(r,"session from storage",a),!this._isValidSession(a)){this._debug(r,"session is not valid"),a!==null&&await this._removeSession();return}const i=((n=a.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<aN;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${aN}
48s`),i){if(this.autoRefreshToken&&a.refresh_token){const{error:o}=await this._callRefreshToken(a.refresh_token);o&&(console.error(o),iN(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(a.user&&a.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(a.access_token);!l&&o?.user?(a.user=o.user,await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",a)}catch(a){this._debug(r,"error",a),console.error(a);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new Lr;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const a=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(a,"begin");try{this.refreshingDeferred=new x_;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new Lr;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const l={data:i.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(i){if(this._debug(a,"error",i),Ct(i)){const o={data:null,error:i};return iN(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(a,"end")}}async _notifyAllSubscribers(t,n,r=!0){const a=`#_notifyAllSubscribers(${t})`;this._debug(a,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,n)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(a,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Wr(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await Qp(this.userStorage,this.storageKey+"-user",{user:n.user});const a=Object.assign({},n);delete a.user;const i=gM(a);await Qp(this.storage,this.storageKey,i)}else{const a=gM(n);await Qp(this.storage,this.storageKey,a)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Wr(this.storage,this.storageKey),await Wr(this.storage,this.storageKey+"-code-verifier"),await Wr(this.storage,this.storageKey+"-user"),this.userStorage&&await Wr(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Gr()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",t)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Jp);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const a=Math.floor((r.expires_at*1e3-t)/Jp);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${Jp}ms, refresh threshold is ${ST} ticks`),a<=ST&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof qV)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Gr()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>
48{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n,r){const a=[`provider=${encodeURIComponent(n)}`];if(r?.redirectTo&&a.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r?.scopes&&a.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await Np(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});a.push(l.toString())}if(r?.queryParams){const i=new URLSearchParams(r.queryParams);a.push(i.toString())}return r?.skipBrowserRedirect&&a.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${a.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:a,error:i}=n;return i?this._returnResult({data:null,error:i}):await Wt(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=a?.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,a;const{data:i,error:o}=n;if(o)return this._returnResult({data:null,error:o});const l=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:c,error:u}=await Wt(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(r=i?.session)===null||r===void 0?void 0:r.access_token});return u?this._returnResult({data:null,error:u}):(t.factorType==="totp"&&c.type==="totp"&&(!((a=c?.totp)===null||a===void 0)&&a.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:a,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?kM(t.webauthn.credential_response):NM(t.webauthn.credential_response)})}:{code:t.code}),{data:l,error:c}=await Wt(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=a?.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:c}))})}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:a,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=await Wt(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=a?.session)===null||r===void 0?void 0:r.access_token});if(o.error)return o;const{data:l}=o;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:jM(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:_M(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const a={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=n?.factors)!==null&&t!==void 0?t:[])a.all.push(i),i.status==="verified"&&a[i.factor_type].push(i);return{data:a,error:null}}async _getAuthenticatorAssuranceLevel(t){var n,r,a,i;if(t)try{const{payload:m}=Cy(t);let g=null;m.aal&&(g=m.aal);let x=g;const{data:{user:b},error:y}=await this.getUser(t);if(y)return this._returnResult({data:null,error:y});((r=(n=b?.factors)===null||n===void 0?void 0:n.filter(j=>j.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(x="aal2");const w=m.amr||[];return{data:{currentLevel:g,nextLevel:x,currentAuthenticationMethods:w},error:null}}catch(m){if(Ct(m))return this._returnResult({data:null,error:m});throw m}const{data:{session:o},error:l}
48=await this.getSession();if(l)return this._returnResult({data:null,error:l});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:c}=Cy(o.access_token);let u=null;c.aal&&(u=c.aal);let d=u;((i=(a=o.user.factors)===null||a===void 0?void 0:a.filter(m=>m.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(d="aal2");const p=c.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:p},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:r},error:a}=n;return a?this._returnResult({data:null,error:a}):r?await Wt(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Lr})})}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:a},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!a)return this._returnResult({data:null,error:new Lr});const o=await Wt(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&Gr()&&!n?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(r){if(Ct(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:a},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!a)return this._returnResult({data:null,error:new Lr});const o=await Wt(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&Gr()&&!n?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(r){if(Ct(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await Wt(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new Lr})})}catch(t){if(Ct(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:a}=n;return a?this._returnResult({data:null,error:a}):r?(await Wt(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Lr})})}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let r=n.keys.find(l=>l.kid===t);if(r)return r;const a=Date.now();if(r=this.jwks.keys.find(l=>l.kid===t),r&&this.jwks_cached_at+xme>a)return r;const{data:i,error:o}=await Wt(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=a,r=i.keys.find(l=>l.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:m,error:g}
48=await this.getSession();if(g||!m.session)return this._returnResult({data:null,error:g});r=m.session.access_token}const{header:a,payload:i,signature:o,raw:{header:l,payload:c}}=Cy(r);n?.allowExpired||Fme(i.exp);const u=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!u){const{error:m}=await this.getUser(r);if(m)throw m;return{data:{claims:i,header:a,signature:o},error:null}}const d=Bme(a.alg),h=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,o,Eme(`${l}.${c}`)))throw new AT("Invalid JWT signature");return{data:{claims:i,header:a,signature:o},error:null}}catch(r){if(Ct(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(t){var n,r,a;io(this.experimental);try{if(!jw())return this._returnResult({data:null,error:new vo("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(n=t?.options)===null||n===void 0?void 0:n.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const l=_M(i.options),c=(a=(r=t?.options)===null||r===void 0?void 0:r.signal)!==null&&a!==void 0?a:RT.createNewAbortSignal(),{data:u,error:d}=await YV({publicKey:l,signal:c});if(d||!u)return this._returnResult({data:null,error:d??new vo("WebAuthn ceremony failed",null)});const h=NM(u);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(Ct(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var n,r;io(this.experimental);try{if(!jw())return this._returnResult({data:null,error:new vo("Browser does not support WebAuthn",null)});const{data:a,error:i}=await this._startPasskeyRegistration();if(i||!a)return this._returnResult({data:null,error:i});const o=jM(a.options),l=(r=(n=t?.options)===null||n===void 0?void 0:n.signal)!==null&&r!==void 0?r:RT.createNewAbortSignal(),{data:c,error:u}=await GV({publicKey:o,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new vo("WebAuthn ceremony failed",null)});const d=kM(c);return this._verifyPasskeyRegistration({challengeId:a.challenge_id,credential:d})}catch(a){if(Ct(a))return this._returnResult({data:null,error:a});throw a}}async _startPasskeyRegistration(){io(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Lr});const{data:a,error:i}=await Wt(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:n.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:a,error:null})})}catch(t){if(Ct(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){io(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!r)return this._returnResult({data:null,error:new Lr});const{data:i,error:o}=await Wt(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyAuthentication(t){var n;io(this.experimental);try{const{data:r,error:a}=await Wt(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(n=t?.options)===null||n===void 0?void 0:n.captchaToken}}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:r,error:null})}catch(r){if(Ct(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(t){io(this.experimental);try{const{data:n,error:r}=await Wt(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:Mi});return r?this._returnResult({data:null,error:r}):(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:n,error:null}))}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}}async _listPasskeys(){io(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Lr});const{data:a,error:i}=await Wt(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:a,error:null})})}catch(t){if(Ct(t))return this._returnResult({data:null,error:t});throw t}}
48async _updatePasskey(t){io(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!r)return this._returnResult({data:null,error:new Lr});const{data:i,error:o}=await Wt(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:t.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}}async _deletePasskey(t){io(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!r)return this._returnResult({data:null,error:new Lr});const{error:i}=await Wt(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(n){if(Ct(n))return this._returnResult({data:null,error:n});throw n}}}fb.nextInstanceID={};const ufe=fb,dfe="2.105.4";let ex="";typeof Deno<"u"?ex="deno":typeof document<"u"?ex="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ex="react-native":ex="node";const hfe={"X-Client-Info":`supabase-js-${ex}/${dfe}`},pfe={headers:hfe},mfe={schema:"public"},ffe={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},gfe={};function gb(e){"@babel/helpers - typeof";return gb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gb(e)}function xfe(e,t){if(gb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bfe(e){var t=xfe(e,"string");return gb(t)=="symbol"?t:t+""}function yfe(e,t,n){return(t=bfe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?SM(Object(n),!0).forEach(function(r){yfe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const vfe=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),wfe=()=>Headers,jfe=(e,t,n)=>{const r=vfe(n),a=wfe();return async(i,o)=>{var l;const c=(l=await t())!==null&&l!==void 0?l:e;let u=new a(o?.headers);return u.has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),r(i,Xn(Xn({},o),{},{headers:u}))}};function _fe(e){return e.endsWith("/")?e:e+"/"}function kfe(e,t){var n,r;const{db:a,auth:i,realtime:o,global:l}=e,{db:c,auth:u,realtime:d,global:h}=t,p={db:Xn(Xn({},c),a),auth:Xn(Xn({},u),i),realtime:Xn(Xn({},d),o),storage:{},global:Xn(Xn(Xn({},h),l),{},{headers:Xn(Xn({},(n=h?.headers)!==null&&n!==void 0?n:{}),(r=l?.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?p.accessToken=e.accessToken:delete p.accessToken,p}function Nfe(e){const t=e?.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(_fe(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Efe=class extends ufe{constructor(e){super(e)}},Sfe=class{constructor(e,t,n){var r,a;this.supabaseUrl=e,this.supabaseKey=t;const i=Nfe(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,l={db:mfe,realtime:gfe,auth:Xn(Xn({},ffe),{},{storageKey:o}),global:pfe},c=kfe(n??{},l);if(this.storageKey=(r=c.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(a=c.global.headers)!==null&&a!==void 0?a:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient((u=c.auth)!==null&&u!==void 0?u:{},this.headers,c.global.fetch)}this.fetch=jfe(t,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Xn({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new Zhe(ne
48w URL("rest/v1",i).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new hme(this.storageUrl.href,this.headers,this.fetch,n?.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new Hhe(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:a,storageKey:i,flowType:o,lock:l,debug:c,throwOnError:u,experimental:d,lockAcquireTimeout:h,skipAutoInitialize:p},m,g){const x={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Efe({url:this.authUrl.href,headers:Xn(Xn({},x),m),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:a,flowType:o,lock:l,debug:c,throwOnError:u,experimental:d,fetch:g,lockAcquireTimeout:h,skipAutoInitialize:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(b=>b.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new Ope(this.realtimeUrl.href,Xn(Xn({},e),{},{params:Xn(Xn({},{apikey:this.supabaseKey}),e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t?.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Cfe=(e,t,n)=>new Sfe(e,t,n);function Tfe(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}Tfe()&&console.warn("â ï¸ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const Afe="https://mlqdoeokttnrcylciaet.supabase.co",Rfe="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im1scWRvZW9rdHRucmN5bGNpYWV0Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzg1ODc4MzgsImV4cCI6MjA5NDE2MzgzOH0.WnyRYBvaEkXzkyldotUr1qgHnMPEaJkitJV_vcaQGU0",Rt=Cfe(Afe,Rfe);function KV(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ife}=Object.prototype,{getPrototypeOf:Gm}=Object,{iterator:d0,toStringTag:XV}=Symbol,kw=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),xb=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),kw(n,t))return!0;n=Gm(n)}return!1},Pfe=(e,t)=>e!=null&&xb(e,t)?e[t]:void 0,u4=(e=>t=>{const n=Ife.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ao=e=>(e=e.toLowerCase(),t=>u4(t)===e),b_=e=>t=>typeof t===e,{isArray:jh}=Array,Ym=b_("undefined");function Cf(e){return e!==null&&!Ym(e)&&e.constructor!==null&&!Ym(e.constructor)&&ti(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const JV=Ao("ArrayBuffer");function Lfe(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&JV(e.buffer),t}const Ofe=b_("string"),ti=b_("function"),QV=b_("number"),Tf=e=>e!==null&&typeof e=="object",Mfe=e=>e===!0||e===!1,s1=e=>{if(!Tf(e))return!1;const t=Gm(e);return(t===null||t===Object.prototype||Gm(t)===null)&&!xb(e,XV)&&!xb(e,d0)},Dfe=e=>{if(!Tf(e)||Cf(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},$fe=Ao("Date"),Ffe=Ao("File"),Bfe=e=>!!(e&&typeof e.uri<"u"),Ufe=e=>e&&typeof e.getParts<"u",zfe=Ao("Blob"),Hfe=Ao("FileList"),qfe=e=>Tf(e)&&ti(e.pipe);function Wfe(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const CM=Wfe(),TM=typeof CM.FormData<"u"?CM.FormData:void 0,Vfe=e=>{if(!e)return!1;if(TM&&e instanceof TM)return!0;const t=Gm(e);if(!t||t===Object.prototype||!ti(e.append))return!1;const n=u4(e);return n==="formdata"||n==="object"&&ti(e.toString)&&e.toString()==="[object FormData]"},Gfe=Ao("URLSearchParams"),[Yfe,Kfe,Xfe,Jfe]=["ReadableStream","Request","Response","Headers"].map(Ao),Qfe=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function h0(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,a;
vendor: 8,811 bytes, lines 48-50
48if(typeof e!="object"&&(e=[e]),jh(e))for(r=0,a=e.length;r<a;r++)t.call(null,e[r],r,e);else{if(Cf(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let l;for(r=0;r<o;r++)l=i[r],t.call(null,e[l],l,e)}}function ZV(e,t){if(Cf(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,a;for(;r-- >0;)if(a=n[r],t===a.toLowerCase())return a;return null}const Hd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,eG=e=>!Ym(e)&&e!==Hd;function IT(...e){const{caseless:t,skipUndefined:n}=eG(this)&&this||{},r={},a=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const l=t&&typeof o=="string"&&ZV(r,o)||o,c=kw(r,l)?r[l]:void 0;s1(c)&&s1(i)?r[l]=IT(c,i):s1(i)?r[l]=IT({},i):jh(i)?r[l]=i.slice():(!n||!Ym(i))&&(r[l]=i)};for(let i=0,o=e.length;i<o;i++){const l=e[i];if(!l||Cf(l)||(h0(l,a),typeof l!="object"||jh(l)))continue;const c=Object.getOwnPropertySymbols(l);for(let u=0;u<c.length;u++){const d=c[u];uge.call(l,d)&&a(l[d],d)}}return r}const Zfe=(e,t,n,{allOwnKeys:r}={})=>(h0(t,(a,i)=>{n&&ti(a)?Object.defineProperty(e,i,{__proto__:null,value:KV(a,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),ege=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),tge=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},sge=(e,t,n,r)=>{let a,i,o;const l={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),i=a.length;i-- >0;)o=a[i],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&Gm(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},nge=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},rge=e=>{if(!e)return null;if(jh(e))return e;let t=e.length;if(!QV(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},age=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Gm(Uint8Array)),ige=(e,t)=>{const r=(e&&e[d0]).call(e);let a;for(;(a=r.next())&&!a.done;){const i=a.value;t.call(e,i[0],i[1])}},oge=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},lge=Ao("HTMLFormElement"),cge=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,a){return r.toUpperCase()+a}),{propertyIsEnumerable:uge}=Object.prototype,dge=Ao("RegExp"),tG=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};h0(n,(a,i)=>{let o;(o=t(a,i,e))!==!1&&(r[i]=o||a)}),Object.defineProperties(e,r)},hge=e=>{tG(e,(t,n)=>{if(ti(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(ti(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},pge=(e,t)=>{const n={},r=a=>{a.forEach(i=>{n[i]=!0})};return jh(e)?r(e):r(String(e).split(t)),n},mge=()=>{},fge=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function gge(e){return!!(e&&ti(e.append)&&e[XV]==="FormData"&&e[d0])}const xge=e=>{const t=new WeakSet,n=r=>{if(Tf(r)){if(t.has(r))return;if(Cf(r))return r;if(!("toJSON"in r)){t.add(r);const a=jh(r)?[]:{};return h0(r,(i,o)=>{const l=n(i);!Ym(l)&&(a[o]=l)}),t.delete(r),a}}return r};return n(e)},bge=Ao("AsyncFunction"),yge=e=>e&&(Tf(e)||ti(e))&&ti(e.then)&&ti(e.catch),sG=((e,t)=>e?setImmediate:t?((n,r)=>(Hd.addEventListener("message",({source:a,data:i})=>{a===Hd&&i===n&&r.length&&r.shift()()},!1),a=>{r.push(a),Hd.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ti(Hd.postMessage)),vge=typeof queueMicrotask<"u"?queueMicrotask.bind(Hd):typeof process<"u"&&process.nextTick||sG,nG=e=>e!=null&&ti(e[d0]),wge=e=>e!=null&&xb(e,d0)&&nG(e),je={isArray:jh,isArrayBuffer:JV,isBuffer:Cf,isFormData:Vfe,isArrayBufferView:Lfe,isString:Ofe,isNumber:QV,isBoolean:Mfe,isObject:Tf,isPlainObject:s1,isEmptyObject:Dfe,isReadableStream:Yfe,isRequest:Kfe,isResponse:Xfe,isHeaders:Jfe,isUndefined:Ym,isDate:$fe,isFile:Ffe,isReactNativeBlob:Bfe,isReactNative:Ufe,isBlob:zfe,isRegExp:dge,isFunction:ti,isStream:qfe,isURLSearchParams:Gfe,isTypedArray:age,isFileList:Hfe,forEach:h0,merge:IT,extend:Zfe,trim:Qfe,stripBOM:ege,inherits:tge,toFlatObject:sge,kindOf:u4,kindOfTest:Ao,endsWith:nge,toArray:rge,forEachEntry:ige,matchAll:oge,isHTMLForm:lge,hasOwnProperty:kw,hasOwnProp:kw,hasOwnInPrototypeChain:xb,getSafeProp:Pfe,reduceDescriptors:tG,freezeMethods:hge,toObjectSet:pge,toCamelCase:cge,noop:mge,toFiniteNumber:fge,findKey:ZV,global:Hd,isContextDefined:eG,isSpecCompliantForm:gge,toJSONObject:xge,isAsyncFn:bge,isThenable:yge,setImmediate:sG,asap:vge,isIterable:nG,isSafeIterable:wge},jge=je.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),_ge=e=>{const t={};let n,r,a;return e&&e.split(` 49`).forEach(function(o){a=o.indexOf(":"),n=o.substring(0,a).trim().toLowerCase(),r=o.substring(a+1).trim(),!(!n||t[n]&&jge[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function kge(e){let t=0,n=e.length;for(;t<n;){const r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}for(;n>t;){const r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const Nge=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Ege=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function d4(e,t){return je.isArray(e)?e.map(n=>d4(n,t)):kge(String(e).replace(t,""))}const Sge=e=>d4(e,Nge),Cge=e=>d4(e,Ege);function rG(e){const t=Object.create(null);return je.forEach(e.toJSON(),(n,r)=>{t[r]=Cge(n)}),t}const AM=Symbol("internals");function vg(e){return e&&String(e).trim().toLowerCase()}function n1(e){return e===!1||e==null?e:je.isArray(e)?e.map(n1):Sge(String(e))}function Tge(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Age=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function cN(e,t,n,r,a){if(je.isFunction(r))return r.call(this,t,n);if(a&&(t=n),!!je.isString(t)){if(je.isString(r))return t.indexOf(r)!==-1;if(je.isRegExp(r))return r.test(t)}}function Rge(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Ige(e,t){const n=je.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(a,i,o){return this[r].call(this,t,a,i,o)},configurable:!0})})}let va=class{constructor(t){t&&this.set(t)}set(t,n,r){const a=this;function i(l,c,u){const d=vg(c);if(!d)return;const h=je.findKey(a,d);(!h||a[h]===void 0||u===!0||u===void 0&&a[h]!==!1)&&(a[h||c]=n1(l))}const o=(l,c)=>je.forEach(l,(u,d)=>i(u,d,c));if(je.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(je.isString(t)&&(t=t.trim())&&!Age(t))o(_ge(t),n);else if(je.isObject(t)&&je.isSafeIterable(t)){let l=Object.create(null),c,u;for(const d of t){if(!je.isArray(d))throw new TypeError("Object iterator must return a key-value pair");u=d[0],je.hasOwnProp(l,u)?(c=l[u],l[u]=je.isArray(c)?[...c,d[1]]:[c,d[1]]):l[u]=d[1]}o(l,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=vg(t),t){const r=je.findKey(this,t);if(r){const a=this[r];if(!n)return a;if(n===!0)return Tge(a);if(je.isFunction(n))return n.call(this,a,r);if(je.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=vg(t),t){const r=je.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||cN(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let a=!1;function i(o){if(o=vg(o),o){const l=je.findKey(r,o);l&&(!n||cN(r,r[l],l,n))&&(delete r[l],a=!0)}}return je.isArray(t)?t.forEach(i):i(t),a}clear(t){const n=Object.keys(this);let r=n.length,a=!1;for(;r--;){const i=n[r];(!t||cN(this,this[i],i,t,!0))&&(delete this[i],a=!0)}return a}normalize(t){const n=this,r={};return je.forEach(this,(a,i)=>{const o=je.findKey(r,i);if(o){n[o]=n1(a),delete n[i];return}const l=t?Rge(i):String(i).trim();l!==i&&delete n[i],n[l]=n1(a),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return je.forEach(this,(r,a)=>{r!=null&&r!==!1&&(n[a]=t&&je.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` 50`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);
vendor: 4,535 bytes, line 50
50return n.forEach(a=>r.set(a)),r}static accessor(t){const r=(this[AM]=this[AM]={accessors:{}}).accessors,a=this.prototype;function i(o){const l=vg(o);r[l]||(Ige(a,o),r[l]=!0)}return je.isArray(t)?t.forEach(i):i(t),this}};va.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);je.reduceDescriptors(va.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});je.freezeMethods(va);const Pge="[REDACTED ****]";function Lge(e){if(je.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(je.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Oge(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),r=[],a=i=>{if(i===null||typeof i!="object"||je.isBuffer(i))return i;if(r.indexOf(i)!==-1)return;i instanceof va&&(i=i.toJSON()),r.push(i);let o;if(je.isArray(i))o=[],i.forEach((l,c)=>{const u=a(l);je.isUndefined(u)||(o[c]=u)});else{if(!je.isPlainObject(i)&&Lge(i))return r.pop(),i;o=Object.create(null);for(const[l,c]of Object.entries(i)){const u=n.has(l.toLowerCase())?Pge:a(c);je.isUndefined(u)||(o[l]=u)}}return r.pop(),o};return a(e)}let Tt=class aG extends Error{static from(t,n,r,a,i,o){const l=new aG(t.message,n||t.code,r,a,i);return Object.defineProperty(l,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),l.name=t.name,t.status!=null&&l.status==null&&(l.status=t.status),o&&Object.assign(l,o),l}constructor(t,n,r,a,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),a&&(this.request=a),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,n=t&&je.hasOwnProp(t,"redact")?t.redact:void 0,r=je.isArray(n)&&n.length>0?Oge(t,n):je.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};Tt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Tt.ERR_BAD_OPTION="ERR_BAD_OPTION";Tt.ECONNABORTED="ECONNABORTED";Tt.ETIMEDOUT="ETIMEDOUT";Tt.ECONNREFUSED="ECONNREFUSED";Tt.ERR_NETWORK="ERR_NETWORK";Tt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Tt.ERR_DEPRECATED="ERR_DEPRECATED";Tt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Tt.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Tt.ERR_CANCELED="ERR_CANCELED";Tt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Tt.ERR_INVALID_URL="ERR_INVALID_URL";Tt.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Mge=null,iG=100;function PT(e){return je.isPlainObject(e)||je.isArray(e)}function oG(e){return je.endsWith(e,"[]")?e.slice(0,-2):e}function uN(e,t,n){return e?e.concat(t).map(function(a,i){return a=oG(a),!n&&i?"["+a+"]":a}).join(n?".":""):t}function Dge(e){return je.isArray(e)&&!e.some(PT)}const $ge=je.toFlatObject(je,{},null,function(t){return/^is[A-Z]/.test(t)});function y_(e,t,n){if(!je.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=je.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,w){return!je.isUndefined(w[v])});const r=n.metaTokens,a=n.visitor||g,i=n.dots,o=n.indexes,l=n.Blob||typeof Blob<"u"&&Blob,c=n.maxDepth===void 0?iG:n.maxDepth,u=l&&je.isSpecCompliantForm(t),d=[];if(!je.isFunction(a))throw new TypeError("visitor must be a function");function h(y){if(y===null)return"";if(je.isDate(y))return y.toISOString();if(je.isBoolean(y))return y.toString();if(!u&&je.isBlob(y))throw new Tt("Blob is not supported. Use a Buffer instead.");if(je.isArrayBuffer(y)||je.isTypedArray(y)){if(u&&typeof l=="function")return new l([y]);if(typeof Buffer<"u")return Buffer.from(y);throw new Tt("Blob is not supported. Use a Buffer instead.",Tt.ERR_NOT_SUPPORT)}return y}function p(y){if(y>c)throw new Tt("Object is too deeply nested ("+y+" levels). Max depth: "+c,Tt.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(y,v){if(c===1/0)return JSON.stringify(y);const w=[];return JSON.stringify(y,function(E,S){if(!je.isObject(S))return S;for(;w.length&&w[w.length-1]!==this;)w.pop();return w.push(S),p(v+w.length-1),S})}function g(y,v,w){let j=y;if(je.isReactNative(t)&&je.isReactNativeBlob(y))return t.append(uN(w,v,i),h(y)),!1;if(y&&!w&&typeof y=="object"){if(je.endsWith(v,"{}"))v=r?v:v.slice(0,-2),y=m(y,1);else if(je.isArray(y)&&Dge(y)||(je.isFileList(y)||je.endsWith(v,"[]"))&&(j=je.toArray(y)))return v=oG(v),j.forEac
vendor: 4,222 bytes, line 50
50h(function(S,_){!(je.isUndefined(S)||S===null)&&t.append(o===!0?uN([v],_,i):o===null?v:v+"[]",h(S))}),!1}return PT(y)?!0:(t.append(uN(w,v,i),h(y)),!1)}const x=Object.assign($ge,{defaultVisitor:g,convertValue:h,isVisitable:PT});function b(y,v,w=0){if(!je.isUndefined(y)){if(p(w),d.indexOf(y)!==-1)throw new Error("Circular reference detected in "+v.join("."));d.push(y),je.forEach(y,function(E,S){(!(je.isUndefined(E)||E===null)&&a.call(t,E,je.isString(S)?S.trim():S,v,x))===!0&&b(E,v?v.concat(S):[S],w+1)}),d.pop()}}if(!je.isObject(e))throw new TypeError("data must be an object");return b(e),t}function RM(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function h4(e,t){this._pairs=[],e&&y_(e,this,t)}const lG=h4.prototype;lG.append=function(t,n){this._pairs.push([t,n])};lG.toString=function(t){const n=t?r=>t.call(this,r,RM):RM;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function Fge(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function cG(e,t,n){if(!t)return e;e=e||"";const r=je.isFunction(n)?{serialize:n}:n,a=je.getSafeProp(r,"encode")||Fge,i=je.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=je.isURLSearchParams(t)?t.toString():new h4(t,r).toString(a),o){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class IM{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){je.forEach(this.handlers,function(r){r!==null&&t(r)})}}const p4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Bge=typeof URLSearchParams<"u"?URLSearchParams:h4,Uge=typeof FormData<"u"?FormData:null,zge=typeof Blob<"u"?Blob:null,Hge={isBrowser:!0,classes:{URLSearchParams:Bge,FormData:Uge,Blob:zge},protocols:["http","https","file","blob","url","data"]},m4=typeof window<"u"&&typeof document<"u",LT=typeof navigator=="object"&&navigator||void 0,qge=m4&&(!LT||["ReactNative","NativeScript","NS"].indexOf(LT.product)<0),Wge=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Vge=m4&&window.location.href||"http://localhost",Gge=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:m4,hasStandardBrowserEnv:qge,hasStandardBrowserWebWorkerEnv:Wge,navigator:LT,origin:Vge},Symbol.toStringTag,{value:"Module"})),Jr={...Gge,...Hge};function Yge(e,t){return y_(e,new Jr.classes.URLSearchParams,{visitor:function(n,r,a,i){return Jr.isNode&&je.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const PM=iG;function uG(e){if(e>PM)throw new Tt("FormData field is too deeply nested ("+e+" levels). Max depth: "+PM,Tt.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Kge(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)uG(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function Xge(e){const t={},n=Object.keys(e);let r;const a=n.length;let i;for(r=0;r<a;r++)i=n[r],t[i]=e[i];return t}function dG(e){function t(n,r,a,i){uG(i);let o=n[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),c=i>=n.length;return o=!o&&je.isArray(a)?a.length:o,c?(je.hasOwnProp(a,o)?a[o]=je.isArray(a[o])?a[o].concat(r):[a[o],r]:a[o]=r,!l):((!je.hasOwnProp(a,o)||!je.isObject(a[o]))&&(a[o]=[]),t(n,r,a[o],i)&&je.isArray(a[o])&&(a[o]=Xge(a[o])),!l)}if(je.isFormData(e)&&je.isFunction(e.entries)){const n={};return je.forEachEntry(e,(r,a)=>{t(Kge(r),a,n,0)}),n}return null}const Sp=(e,t)=>e!=null&&je.hasOwnProp(e,t)?e[t]:void 0;function Jge(e,t,n){if(je.isString(e))try{return(t||JSON.parse)(e),je.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const p0={transitional:p4,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,i=je.isObject(t);
vendor: 5,269 bytes, line 50
50if(i&&je.isHTMLForm(t)&&(t=new FormData(t)),je.isFormData(t))return a?JSON.stringify(dG(t)):t;if(je.isArrayBuffer(t)||je.isBuffer(t)||je.isStream(t)||je.isFile(t)||je.isBlob(t)||je.isReadableStream(t))return t;if(je.isArrayBufferView(t))return t.buffer;if(je.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){const c=Sp(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Yge(t,c).toString();if((l=je.isFileList(t))||r.indexOf("multipart/form-data")>-1){const u=Sp(this,"env"),d=u&&u.FormData;return y_(l?{"files[]":t}:t,d&&new d,c)}}return i||a?(n.setContentType("application/json",!1),Jge(t)):t}],transformResponse:[function(t){const n=Sp(this,"transitional")||p0.transitional,r=n&&n.forcedJSONParsing,a=Sp(this,"responseType"),i=a==="json";if(je.isResponse(t)||je.isReadableStream(t))return t;if(t&&je.isString(t)&&(r&&!a||i)){const l=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,Sp(this,"parseReviver"))}catch(c){if(l)throw c.name==="SyntaxError"?Tt.from(c,Tt.ERR_BAD_RESPONSE,this,null,Sp(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Jr.classes.FormData,Blob:Jr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};je.forEach(["delete","get","head","post","put","patch","query"],e=>{p0.headers[e]={}});function dN(e,t){const n=this||p0,r=t||n,a=va.from(r.headers);let i=r.data;return je.forEach(e,function(l){i=l.call(n,i,a.normalize(),t?t.status:void 0)}),a.normalize(),i}function hG(e){return!!(e&&e.__CANCEL__)}let m0=class extends Tt{constructor(t,n,r){super(t??"canceled",Tt.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function pG(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Tt("Request failed with status code "+n.status,n.status>=400&&n.status<500?Tt.ERR_BAD_REQUEST:Tt.ERR_BAD_RESPONSE,n.config,n.request,n))}function Qge(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Zge(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[i];o||(o=u),n[a]=c,r[a]=u;let h=i,p=0;for(;h!==a;)p+=n[h++],h=h%e;if(a=(a+1)%e,a===i&&(i=(i+1)%e),u-o<t)return;const m=d&&u-d;return m?Math.round(p*1e3/m):void 0}}function exe(e,t){let n=0,r=1e3/t,a,i;const o=(u,d=Date.now())=>{n=d,a=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const d=Date.now(),h=d-n;h>=r?o(u,d):(a=u,i||(i=setTimeout(()=>{i=null,o(a)},r-h)))},()=>a&&o(a)]}const Nw=(e,t,n=3)=>{let r=0;const a=Zge(50,250);return exe(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,l=i.lengthComputable?i.total:void 0,c=l!=null?Math.min(o,l):o,u=Math.max(0,c-r),d=a(u);r=Math.max(r,c);const h={loaded:c,total:l,progress:l?c/l:void 0,bytes:u,rate:d||void 0,estimated:d&&l?(l-c)/d:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(h)},n)},LM=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},OM=e=>(...t)=>je.asap(()=>e(...t)),txe=Jr.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Jr.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Jr.origin),Jr.navigator&&/(msie|trident)/i.test(Jr.navigator.userAgent)):()=>!0,sxe=Jr.hasStandardBrowserEnv?{write(e,t,n,r,a,i,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];je.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),je.isString(r)&&l.push(`path=${r}`),je.isString(a)&&l.push(`domain=${a}`),i===!0&&l.push("secure"),je.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),a=r.indexOf("=");if(a!==-1&&r.slice(0,a)===e)try{return decodeURIComponent(r.slice(a+1))}catch{return r.slice(a+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function nxe(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function rxe(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const axe=/^https?:(?!\/\/)/i,ixe=/[\t\n\r]/g;function oxe(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function lxe(e){return oxe(e).replace(ixe,"")}function MM(e,t){if(typeof e=="string"&&axe.test(lxe(e)))throw new Tt('Invalid URL: missing "//" after protocol',Tt.ERR_INVALID_URL,t)}function mG(e,t,n,r){MM(t,r);let a=!nxe(t);return e&&(a||n===!1)?(MM(e,r),rxe(e,t)):t}const DM=e=>e instanceof va?{...e}:e;function _h(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(d,h,p,m){return je.isPlainObject(d)&&je.isPlainObject(h)?je.merge.call({caseless:m},d,h):je.isPlainObject(h)?je.merge({},h):je.isArray(h)?h.slice():h}function a(d,h,p,m){if(je.isUndefined(h)){if(!je.isUndefined(d))return r(void 0,d,p,m)}else return r(d,h,p,m)}function i(d,h){if(!je.isUndefined(h))return r(void 0,h)}
vendor: 1,434 bytes, line 50
50function o(d,h){if(je.isUndefined(h)){if(!je.isUndefined(d))return r(void 0,d)}else return r(void 0,h)}function l(d){const h=je.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!je.isUndefined(h))if(je.isPlainObject(h)){if(je.hasOwnProp(h,d))return h[d]}else return;const p=je.hasOwnProp(e,"transitional")?e.transitional:void 0;if(je.isPlainObject(p)&&je.hasOwnProp(p,d))return p[d]}function c(d,h,p){if(je.hasOwnProp(t,p))return r(d,h);if(je.hasOwnProp(e,p))return r(void 0,d)}const u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(d,h,p)=>a(DM(d),DM(h),p,!0)};return je.forEach(Object.keys({...e,...t}),function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;const p=je.hasOwnProp(u,h)?u[h]:a,m=je.hasOwnProp(e,h)?e[h]:void 0,g=je.hasOwnProp(t,h)?t[h]:void 0,x=p(m,g,h);je.isUndefined(x)&&p!==c||(n[h]=x)}),je.hasOwnProp(t,"validateStatus")&&je.isUndefined(t.validateStatus)&&l("validateStatusUndefinedResolves")===!1&&(je.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.val
vendor: 16,175 bytes, lines 50-56
50idateStatus),n}const cxe=["content-type","content-length"];function uxe(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([r,a])=>{cxe.includes(r.toLowerCase())&&e.set(r,a)})}const dxe=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function fG(e){const t=_h({},e),n=p=>je.hasOwnProp(t,p)?t[p]:void 0,r=n("data");let a=n("withXSRFToken");const i=n("xsrfHeaderName"),o=n("xsrfCookieName");let l=n("headers");const c=n("auth"),u=n("baseURL"),d=n("allowAbsoluteUrls"),h=n("url");if(t.headers=l=va.from(l),t.url=cG(mG(u,h,d,t),n("params"),n("paramsSerializer")),c){const p=je.getSafeProp(c,"username")||"",m=je.getSafeProp(c,"password")||"";try{l.set("Authorization","Basic "+btoa(p+":"+(m?dxe(m):"")))}catch(g){throw Tt.from(g,Tt.ERR_BAD_OPTION_VALUE,e)}}if(je.isFormData(r)&&(Jr.hasStandardBrowserEnv||Jr.hasStandardBrowserWebWorkerEnv||je.isReactNative(r)?l.setContentType(void 0):je.isFunction(r.getHeaders)&&uxe(l,r.getHeaders(),n("formDataHeaderPolicy"))),Jr.hasStandardBrowserEnv&&(je.isFunction(a)&&(a=a(t)),a===!0||a==null&&txe(t.url))){const m=i&&o&&sxe.read(o);m&&l.set(i,m)}return t}const hxe=typeof XMLHttpRequest<"u",pxe=hxe&&function(e){return new Promise(function(n,r){const a=fG(e);let i=a.data;const o=va.from(a.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=a,d,h,p,m,g;function x(){m&&m(),g&&g(),a.cancelToken&&a.cancelToken.unsubscribe(d),a.signal&&a.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(a.method.toUpperCase(),a.url,!0),b.timeout=a.timeout;function y(){if(!b)return;const w=va.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),E={data:!l||l==="text"||l==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:w,config:e,request:b};pG(function(_){n(_),x()},function(_){r(_),x()},E),b=null}"onloadend"in b?b.onloadend=y:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.startsWith("file:"))||setTimeout(y)},b.onabort=function(){b&&(r(new Tt("Request aborted",Tt.ECONNABORTED,e,b)),x(),b=null)},b.onerror=function(j){const E=j&&j.message?j.message:"Network Error",S=new Tt(E,Tt.ERR_NETWORK,e,b);S.event=j||null,r(S),x(),b=null},b.ontimeout=function(){let j=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const E=a.transitional||p4;a.timeoutErrorMessage&&(j=a.timeoutErrorMessage),r(new Tt(j,E.clarifyTimeoutError?Tt.ETIMEDOUT:Tt.ECONNABORTED,e,b)),x(),b=null},i===void 0&&o.setContentType(null),"setRequestHeader"in b&&je.forEach(rG(o),function(j,E){b.setRequestHeader(E,j)}),je.isUndefined(a.withCredentials)||(b.withCredentials=!!a.withCredentials),l&&l!=="json"&&(b.responseType=a.responseType),u&&([p,g]=Nw(u,!0),b.addEventListener("progress",p)),c&&b.upload&&([h,m]=Nw(c),b.upload.addEventListener("progress",h),b.upload.addEventListener("loadend",m)),(a.cancelToken||a.signal)&&(d=w=>{b&&(r(!w||w.type?new m0(null,e,b):w),b.abort(),x(),b=null)},a.cancelToken&&a.cancelToken.subscribe(d),a.signal&&(a.signal.aborted?d():a.signal.addEventListener("abort",d)));const v=Qge(a.url);if(v&&!Jr.protocols.includes(v)){r(new Tt("Unsupported protocol "+v+":",Tt.ERR_BAD_REQUEST,e)),x();return}b.send(i||null)})},mxe=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const a=function(c){if(!r){r=!0,o();const u=c instanceof Error?c:this.reason;n.abort(u instanceof Tt?u:new m0(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,a(new Tt(`timeout of ${t}ms exceeded`,Tt.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(a):c.removeEventListener("abort",a)}),e=null)};e.forEach(c=>c.addEventListener("abort",a,{once:!0}));const{signal:l}=n;return l.unsubscribe=()=>je.asap(o),l},fxe=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,a;for(;r<n;)a=r+t,yield e.slice(r,a),r=a},gxe=async function*(e,t){for await(const n of xxe(e))yield*fxe(n,t)},xxe=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},$M=(e,t,n,r)=>{const a=gxe(e,t);let i=0,o,l=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await a.next();if(u){l(),c.close();return}let h=d.byteLength;if(n){let p=i+=h;n(p)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),a.return()}},{highWaterMark:2})},Ew=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,bxe=(e,t,n)=>t+2<n&&Ew(e.charCodeAt(t+1))&&Ew(e.charCodeAt(t+2));function yxe(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let o=r.length;const l=r.length;for(let m=0;m<l;m++)if(r.charCodeAt(m)===37&&m+2<l){const g=r.charCodeAt(m+1),x=r.charCodeAt(m+2);Ew(g)&&Ew(x)&&(o-=2,m+=2)}let c=0,u=l-1;const d=m=>m>=2&&r.charCodeAt(m-2)===37&&r.charCodeAt(m-1)===51&&(r.charCodeAt(m)===68||r.charCodeAt(m)===100);u>=0&&(r.charCodeAt(u)===61?(c++,u--):d(u)&&(c++,u-=3)),c===1&&u>=0&&(r.charCodeAt(u)===61||d(u))&&c++;const p=Math.floor(o/4)*3-(c||0);return p>0?p:0}let i=0;for(let o=0,l=r.length;o<l;o++){const c=r.charCodeAt(o);if(c===37&&bxe(r,o,l))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<l){const u=r.charCodeAt(o+1);u>=56320&&u<=57343?(i+=4,o++):i+=3}else i+=3}return i}const f4="1.18.1",FM=64*1024,{isFunction:Ty}=je,vxe=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),BM=e=>{if(!je.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},UM=(e,...t)=>{try{return!!e(...t)}catch{return!1}},wxe=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},jxe=e=>{const t=je.global!==void 0&&je.global!==null?je.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=je.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:a,Request:i,Response:o}=e,l=a?Ty(a):typeof fetch=="function",c=Ty(i),u=Ty(o);if(!l)return!1;const d=l&&Ty(n),h=l&&(typeof r=="function"?(y=>v=>y.encode(v))(new r):async y=>new Uint8Array(await new i(y).arrayBuffer())),p=c&&d&&UM(()=>{let y=!1;const v=new i(Jr.origin,{body:new n,method:"POST",get duplex(){return y=!0,"half"}}),w=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),y&&!w}),m=u&&d&&UM(()=>je.isReadableStream(new o("").body)),g={stream:m&&(y=>y.body)};l&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!g[y]&&(g[y]=(v,w)=>{let j=v&&v[y];if(j)return j.call(v);throw new Tt(`Response type '${y}' is not supported`,Tt.ERR_NOT_SUPPORT,w)})});const x=async y=>{if(y==null)return 0;if(je.isBlob(y))return y.size;if(je.isSpecCompliantForm(y))return(await new i(Jr.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(je.isArrayBufferView(y)||je.isArrayBuffer(y))return y.byteLength;if(je.isURLSearchParams(y)&&(y=y+""),je.isString(y))return(await h(y)).byteLength},b=async(y,v)=>{const w=je.toFiniteNumber(y.getContentLength());return w??x(v)};return async y=>{let{url:v,method:w,data:j,signal:E,cancelToken:S,timeout:_,onDownloadProgress:k,onUploadProgress:C,responseType:N,headers:A,withCredentials:T="same-origin",fetchOptions:I,maxContentLength:$,maxBodyLength:O}=fG(y);const U=je.isNumber($)&&$>-1,F=je.isNumber(O)&&O>-1,H=L=>je.hasOwnProp(y,L)?y[L]:void 0;let G=a||fetch;N=N?(N+"").toLowerCase():"text";let M=mxe([E,S&&S.toAbortSignal()],_),z=null;const W=M&&M.unsubscribe&&(()=>{M.unsubscribe()});let D,Z=null;const V=()=>new Tt("Request body larger than maxBodyLength limit",Tt.ERR_BAD_REQUEST,y,z);try{let L;const K=H("auth");if(K){const me=je.getSafeProp(K,"username")||"",q=je.getSafeProp(K,"password")||"";L={username:me,password:q}}if(wxe(v)){const me=new URL(v,Jr.origin);if(!L&&(me.username||me.password)){const q=BM(me.username),he=BM(me.password);L={username:q,password:he}}(me.username||me.password)&&(me.username="",me.password="",v=me.href)}if(L&&(A.delete("authorization"),A.set("Authorization","Basic "+btoa(vxe((L.username||"")+":"+(L.password||""))))),U&&typeof v=="string"&&v.startsWith("data:")&&yxe(v)>$)throw new Tt("maxContentLength size of "+$+" exceeded",Tt.ERR_BAD_RESPONSE,y,z);if(F&&w!=="get"&&w!=="head"){const me=await x(j);if(typeof me=="number"&&isFinite(me)&&(D=me,me>O))throw V()}const te=F&&(je.isReadableStream(j)||je.isStream(j)),Q=(me,q,he)=>$M(me,FM,se=>{if(F&&se>O)throw Z=V();q&&q(se)},he);if(p&&w!=="get"&&w!=="head"&&(C||te)){if(D=D??await b(A,j),D!==0||te){let me=new i(v,{method:"POST",body:j,duplex:"half"}),q;if(je.isFormData(j)&&(q=me.headers.get("content-type"))&&A.setContentType(q),me.body){const[he,se]=C&&LM(D,Nw(OM(C)))||[];j=Q(me.body,he,se)}}}else if(te&&!c&&d&&w!=="get"&&w!=="head")j=Q(j);else if(te&&c&&!p&&w!=="get"&&w!=="head")throw new Tt("Stream request bodies are not supported by the current fetch implementation",Tt.ERR_NOT_SUPPORT,y,z);je.isString(T)||(T=T?"include":"omit");const Y=c&&"credentials"in i.prototype;if(je.isFormData(j)){const me=A.getContentType();me&&/^multipart\/form-data/i.test(me)&&!/boundary=/i.test(me)&&A.delete("content-type")}A.set("User-Agent","axios/"+f4,!1);const J={...I,signal:M,method:w.toUpperCase(),headers:rG(A.normalize()),body:j,duplex:"half",credentials:Y?T:void 0};z=c&&new i(v,J);let P=await(c?G(z,I):G(v,J));const ee=va.from(P.headers);if(U){const me=je.toFiniteNumber(ee.getContentLength());if(me!=null&&me>$)throw new Tt("maxContentLength size of "+$+" exceeded",Tt.ERR_BAD_RESPONSE,y,z)}const X=m&&(N==="stream"||N==="response");if(m&&P.body&&(k||U||X&&W)){const me={};["status","statusText","headers"].forEach(oe=>{me[oe]=P[oe]});const q=je.toFiniteNumber(ee.getContentLength()),[he,se]=k&&LM(q,Nw(OM(k),!0))||[];let le=0;const ke=oe=>{if(U&&(le=oe,le>$))throw new Tt("maxContentLength size of "+$+" exceeded",Tt.ERR_BAD_RESPONSE,y,z);he&&he(oe)};P=new o($M(P.body,FM,ke,()=>{se&&se(),W&&W()}),me)}N=N||"text";let ae=await g[je.findKey(g,N)||"text"](P,y);if(U&&!m&&!X){let me;if(ae!=null&&(typeof ae.byteLength=="number"?me=ae.byteLength:typeof ae.size=="number"?me=ae.size:typeof ae=="string"&&(me=typeof r=="function"?new r().encode(ae).byteLength:ae.length)),typeof me=="number"&&me>$)throw new Tt("maxContentLength size of "+$+" exceeded",Tt.ERR_BAD_RESPONSE,y,z)}return!X&&W&&W(),await new Promise((me,q)=>{pG(me,q,{data:ae,headers:va.from(P.headers),status:P.status,statusText:P.statusText,config:y,request:z})})}catch(L){if(W&&W(),M&&M.aborted&&M.reason instanceof Tt){const K=M.reason;throw K.config=y,z&&(K.request=z),L!==K&&Object.defineProperty(K,"cause",{__proto__:null,value:L,writable:!0,enumerable:!1,configurable:!0}),K}if(Z)throw z&&!Z.request&&(Z.request=z),Z;if(L instanceof Tt)throw z&&!L.request&&(L.request=z),L;if(L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)){const K=new Tt("Network Error",Tt.ERR_NETWORK,y,z,L&&L.response);throw Object.defineProperty(K,"cause",{__proto__:null,value:L.cause||L,writable:!0,enumerable:!1,configurable:!0}),K}throw Tt.from(L,L&&L.code,y,z,L&&L.response)}}},_xe=new Map,gG=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:a}=t,i=[r,a,n];let o=i.length,l=o,c,u,d=_xe;for(;l--;)c=i[l],u=d.get(c),u===void 0&&d.set(c,u=l?new Map:jxe(t)),d=u;return u};gG();const g4={http:Mge,xhr:pxe,fetch:{get:gG}};je.forEach(g4,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const zM=e=>`- ${e}`,kxe=e=>je.isFunction(e)||e===null||e===!1;function Nxe(e,t){e=je.isArray(e)?e:[e];const{length:n}=e;let r,a;const i={};for(let o=0;o<n;o++){r=e[o];let l;if(a=r,!kxe(r)&&(a=g4[(l=String(r)).toLowerCase()],a===void 0))throw new Tt(`Unknown adapter '${l}'`);if(a&&(je.isFunction(a)||(a=a.get(t))))break;i[l||"#"+o]=a}if(!a){const o=Object.entries(i).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since : 51`+o.map(zM).join(` 52`):" "+zM(o[0]):"as no adapter specified";throw new Tt("There is no suitable adapter to dispatch the request "+l,Tt.ERR_NOT_SUPPORT)}return a}const xG={getAdapter:Nxe,adapters:g4};function hN(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new m0(null,e)}function HM(e){return hN(e),e.headers=va.from(e.headers),e.data=dN.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),xG.getAdapter(e.adapter||p0.adapter,e)(e).then(function(r){hN(e),e.response=r;try{r.data=dN.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=va.from(r.headers),r},function(r){if(!hG(r)&&(hN(e),r&&r.response)){e.response=r.response;try{r.response.data=dN.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=va.from(r.response.headers)}return Promise.reject(r)})}const v_={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{v_[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const qM={};v_.transitional=function(t,n,r){function a(i,o){return"[Axios v"+f4+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,l)=>{if(t===!1)throw new Tt(a(o," has been removed"+(n?" in "+n:"")),Tt.ERR_DEPRECATED);return n&&!qM[o]&&(qM[o]=!0,console.warn(a(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};v_.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Exe(e,t,n){if(typeof e!="object"||e===null)throw new Tt("options must be an object",Tt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const i=r[a],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const l=e[i],c=l===void 0||o(l,i,e);if(c!==!0)throw new Tt("option "+i+" must be "+c,Tt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Tt("Unknown option "+i,Tt.ERR_BAD_OPTION)}}const r1={assertOptions:Exe,validators:v_},ra=r1.validators;let nh=class{constructor(t){this.defaults=t||{},this.interceptors={request:new IM,response:new IM}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const i=(()=>{if(!a.stack)return"";const o=a.stack.indexOf(` 53`);return o===-1?"":a.stack.slice(o+1)})();try{if(!r.stack)r.stack=i;else if(i){const o=i.indexOf(` 54`),l=o===-1?-1:i.indexOf(` 55`,o+1),c=l===-1?"":i.slice(l+1);String(r.stack).endsWith(c)||(r.stack+=` 56`+i)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=_h(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:i}=n;r!==void 0&&r1.assertOptions(r,{silentJSONParsing:ra.transitional(ra.boolean),forcedJSONParsing:ra.transitional(ra.boolean),clarifyTimeoutError:ra.transitional(ra.boolean),legacyInterceptorReqResOrdering:ra.transitional(ra.boolean),advertiseZstdAcceptEncoding:ra.transitional(ra.boolean),validateStatusUndefinedResolves:ra.transitional(ra.boolean)},!1),a!=null&&(je.isFunction(a)?n.paramsSerializer={serialize:a}:r1.assertOptions(a,{encode:ra.function,serialize:ra.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),r1.assertOptions(n,{baseUrl:ra.spelling("baseURL"),withXsrfToken:ra.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&je.merge(i.common,i[n.method]);i&&je.forEach(["delete","get","head","post","put","patch","query","common"],g=>{delete i[g]}),n.headers=va.concat(o,i);const l=[];let c=!0;this.interceptors.request.forEach(function(x){if(typeof x.runWhen=="function"&&x.runWhen(n)===!1)return;c=c&&x.synchronous;const b=n.transitional||p4;b&&b.legacyInterceptorReqResOrdering?l.unshift(x.fulfilled,x.rejected):l.push(x.fulfilled,x.rejected)});const u=[];this.interceptors.response.forEach(function(x){u.push(x.fulfilled,x.rejected)});let d,h=0,p;if(!c){const g=[HM.bind(this),void 0];
vendor: 2,159 bytes, line 56
56for(g.unshift(...l),g.push(...u),p=g.length,d=Promise.resolve(n);h<p;)d=d.then(g[h++],g[h++]);return d}p=l.length;let m=n;for(;h<p;){const g=l[h++],x=l[h++];try{m=g(m)}catch(b){x.call(this,b);break}}try{d=HM.call(this,m)}catch(g){return Promise.reject(g)}for(h=0,p=u.length;h<p;)d=d.then(u[h++],u[h++]);return d}getUri(t){t=_h(this.defaults,t);const n=mG(t.baseURL,t.url,t.allowAbsoluteUrls,t);return cG(n,t.params,t.paramsSerializer)}};je.forEach(["delete","get","head","options"],function(t){nh.prototype[t]=function(n,r){return this.request(_h(r||{},{method:t,url:n,data:r&&je.hasOwnProp(r,"data")?r.data:void 0}))}});je.forEach(["post","put","patch","query"],function(t){function n(r){return function(i,o,l){return this.request(_h(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}nh.prototype[t]=n(),t!=="query"&&(nh.prototype[t+"Form"]=n(!0))});let Sxe=class bG{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(a=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](a);r._listeners=null}),this.promise.then=a=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(a);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new m0(i,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new bG(function(a){t=a}),cancel:t}}};function Cxe(e){return function(n){return e.apply(null,n)}}function Txe(e){return je.isObject(e)&&e.isAxiosError===!0}const OT={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,Parti
56alContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(OT).forEach(([e,t])=>{OT[t]=e});function yG(e){const t=new nh(e),n=KV(nh.prototype.request,t);return je.extend(n,nh.prototype,t,{allOwnKeys:!0}),je.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return yG(_h(e,a))},n}const lr=yG(p0);lr.Axios=nh;lr.CanceledError=m0;lr.CancelToken=Sxe;lr.isCancel=hG;lr.VERSION=f4;lr.toFormData=y_;lr.AxiosError=Tt;lr.Cancel=lr.CanceledError;lr.all=function(t){return Promise.all(t)};lr.spread=Cxe;lr.isAxiosError=Txe;lr.mergeConfig=_h;lr.AxiosHeaders=va;lr.formToJSON=e=>dG(je.isHTMLForm(e)?new FormData(e):e);lr.getAdapter=xG.getAdapter;lr.HttpStatusCode=OT;lr.default=lr;const{Axios:upt,AxiosError:dpt,CanceledError:hpt,isCancel:ppt,CancelToken:mpt,VERSION:fpt,all:gpt,Cancel:xpt,isAxiosError:bpt,spread:ypt,toFormData:vpt,AxiosHeaders:wpt,HttpStatusCode:jpt,formToJSON:_pt,getAdapter:kpt,mergeConfig:Npt,create:Ept}=lr;typeof window<"u"&&new URLSearchParams(window.location.search).get("profile_source");const Hr="https://gsexperts-backend.up.railway.app/api",Axe="https://gsexperts-backend.up.railway.app",Rxe=new Set("x,facebook,instagram".split(",").map(e=>e.trim().toLowerCase()).filter(Boolean)),Nx="true".toLowerCase()==="true",MT="production".toLowerCase(),wu="".toLowerCase()==="true"&&MT!=="production"&&MT==="staging",Ixe="".toLowerCase()==="true"&&MT!=="production",WM="".trim();async function w_(){const{data:e,error:t}=await Rt.auth.getSession();if(t)throw t;return e.session?.access_token||null}async function Pxe(){const e=await w_();if(e)return e;const t=new Error("Authentication required.");throw t.status=401,t.code="AUTH_REQUIRED",t.response={status:401,data:{detail:{code:"AUTH_REQUIRED",message:"You must be signed in."}}},t}async function f0(e={}){const t=await w_();return t?{...e,Authorization:`Bearer ${t}`}:e}const Se=lr.create({baseURL:Hr,headers:{"Content-Type":"application/json"}});Se.interceptors.request.use(async e=>{try{const t=await w_();t&&(e.headers.Authorization=`Bearer ${t}`)}catch{}return e});Se.interceptors.response.use(e=>e,async e=>{if(e.response?.status===401){const n=["/","/login","/signup","/experts","/explore","/privacy","/data-deletion","/creators","/pricing","/forbusiness","/enterprise","/unsubscribe"].some(i=>window.location.pathname===i||window.location.pathname.startsWith(i+"/")),r=e.response?.data?.detail?.code;if(!n||["TOKEN_INVALID","ANONYMOUS_SESSION_EXPIRED"].includes(r)){let i=!0;if(r==="ANONYMOUS_SESSION_EXPIRED")try{const{data:{session:o}}=await Rt.auth.getSession();i=!o||o.user?.is_anonymous===!0}catch{i=!1}if(i)try{await Rt.auth.signOut()}catch{}}!n&&r!=="ANONYMOUS_SESSION_EXPIRED"&&(window.location.href="/login")}return Promise.reject(e)});const x4="gx_saas_oauth_handoff",vG=1,Lxe=1800*1e3,VM="https://greatexperts.local";function Lu(e,t="/dashboard"){if(typeof e!="string"||!e.startsWith("/"))return t;try{const n=new URL(e,VM);return n.origin!==VM?t:`${n.pathname}${n.search}${n.hash}`}catch{return t}}function Oxe(e=window.location){return Lu(`${e.pathname}${e.search}${e.hash}`)}function Mxe(e,t){window.sessionStorage.setItem(x4,JSON.stringify({version:vG,createdAt:Date.now(),returnPath:Lu(e.returnPath),anonymousAccessToken:e.anonymousAccessToken||null,expertId:e.expertId||null,conversationId:e.conversationId||null,attachmentIds:Array.isArray(e.attachmentIds)?e.attachmentIds.filter(
56Boolean):[],consentAccepted:!!e.consentAccepted}))}function Dxe(e,t=Date.now()){let n;try{const i=(e||window.sessionStorage).getItem(x4);if(!i)return null;n=JSON.parse(i)}catch{return null}const r=t-Number(n?.createdAt);return n?.version!==vG||!Number.isFinite(r)||r<0||r>Lxe?null:{returnPath:Lu(n.returnPath),anonymousAccessToken:typeof n.anonymousAccessToken=="string"?n.anonymousAccessToken:null,expertId:typeof n.expertId=="string"?n.expertId:null,conversationId:typeof n.conversationId=="string"?n.conversationId:null,attachmentIds:Array.isArray(n.attachmentIds)?n.attachmentIds.filter(a=>typeof a=="string"):[],consentAccepted:n.consentAccepted===!0}}function pN(e){try{(e||window.sessionStorage).removeItem(x4)}catch{}}const b4="gx_anonymous_connector_handoff";function y4(e){if(e)try{sessionStorage.setItem(b4,e)}catch{}}function wG(){try{return sessionStorage.getItem(b4)||""}catch{return""}}function jG(){try{sessionStorage.removeItem(b4)}catch{}}const v4="gx_anonymous_knowledge_handoff",$xe="wizard_draft_expert_id";function w4(e){if(e)try{sessionStorage.setItem(v4,e)}catch{}}function _G(){try{return sessionStorage.getItem(v4)||""}catch{return""}}function kG(){try{sessionStorage.removeItem(v4)}catch{}}function NG(e){if(e)try{sessionStorage.setItem($xe,e)}catch{}}async function j4(){const{data:e,error:t}=await Rt.rpc("get_my_session");if(t)throw new Error(t.message);if(!e){const n=new Error("Not signed in");throw n.response={status:401,data:{detail:{code:"TOKEN_INVALID",message:"Invalid token."}}},n}return e}async function Fxe(e,t,n,r={}){const{data:{session:a}}=await Rt.auth.getSession(),i=a?.user?.is_anonymous?a.access_token:null;i&&(y4(i),w4(i));const{post_signup_redirect:o,...l}=r||{},c=new URL("/auth/callback",window.location.origin),u=Lu(o,"");u&&c.searchParams.set("next",u);const{data:d,error:h}=await Rt.auth.signUp({email:t,password:n,options:{data:{full_name:e,...l},emailRedirectTo:c.toString()}});if(h){const g=(h.message||"").toLowerCase(),x=new Error(h.message);throw g.includes("already")||g.includes("exists")?x.response={status:409,data:{detail:{code:"EMAIL_EXISTS",message:"An account with this email already exists."}}}:x.response={status:400,data:{detail:{code:"SIGNUP_FAILED",message:h.message}}},x}const p=d?.session?.access_token;if(!p){const g=new Error("Email confirmation required");throw g.response={status:400,data:{detail:{code:"EMAIL_CONFIRMATION_REQUIRED",message:"Almost there. Check your inbox for a confirmation link, then log in."}}},g}const m=await j4();return{status:"success",data:{user:m.user,access_token:p,balance:m.balance,anonymous_access_token:i}}}async function Bxe(e,t){const{data:{session:n}}=await Rt.auth.getSession(),r=n?.user?.is_anonymous?n.access_token:null;r&&(y4(r),w4(r));const{data:a,error:i}=await Rt.auth.signInWithPassword({email:e,password:t});if(i||!a?.session?.access_token){const c=new Error(i?.message||"Invalid credentials");throw c.response={status:401,data:{detail:{code:"INVALID_CREDENTIALS",message:"Invalid email or password."}}},c}const o=a.session.access_token,l=await j4();return{status:"success",data:{user:l.user,access_token:o,balance:l.balance,anonymous_access_token:r}}}async function EG(){const{data:{session:e}}=await Rt.auth.getSession();if(e?.access_token)return{session:e,isAnonymous:!!e.user?.is_anonymous};const{data:t,error:n}=await Rt.auth.signInAnonymously();if(n||!t?.session){const r=new Error(n?.message||"Could not start an anonymous chat session.");throw r.response={status:503,data:{detail:{code:"ANONYMOUS_SESSION_FAILED",message:r.message}}},r}return{session:t.session,isAnonymous:!0}}async function Uxe(){return await Rt.auth.signOut(),EG()}async function zxe(e){const{data:t}=await Se.get(`/auth/anonymous/status/${e}`);return t}async function Hxe({email:e,purpose:t,expertId:n,conversationId:r=null,consentAccepted:a}){const{data:i}=await Se.post("/auth/email/capture",{email:e,purpose:t,expert_id:n,conversation_id:r,consent_accepted:a});return i}async function qxe({email:e,purpose:t="login",expertId:n=null,conversationId:r=null,attachmentIds:a=[]}){const{data:i}=await Se.post("/auth/email/start",{email:e,purpose:t,expert_id:n,conversation_id:r,attachment_ids:a});return i}async function Wxe({challengeId:e,email:t,code:n}){const{data:r}=await Se.post("/auth/email/verify",{challenge_id:e,email:t,code:n}),a=r?.data;if(!a?.access_token||!a?.refresh_token)throw new Error("Email verification did not return a session.");const{error:i}=await Rt.auth.setSession({access_token:a.access_token,refresh_token:a.refresh_token});if(i)throw i;return r}async function SG(e,t,n,r=[]){if(!e||!t)return null;const{data:a}=await Se.post("/auth/anonymous/transfer",{anonymous_access_token:e,expert_id:t,conversation_id:n,attachment_ids:r});return a?.data||null}async function Vxe(e,t){const{error:n}=await Rt.auth.updateUser({password:t});if(n)throw n;const{data:r}=await Se.post("/auth/complete-account",{full_name:e});return r}async function CG(e){const{data:{session:t}}=await Rt.auth.getSession();t?.user?.is_anonymous&&t.access_token&&(y4(t.access_token),w4(t.access_token));const{error:n}=await Rt.auth.signInWithOAuth({provider:e,options:{redirectTo:`${window.location.origin}/auth/callback`}});if(n)throw new Error(n.message)}async function Gxe({preserveSaasConversation:e=!1,returnPath:t=null,expertId:n=null,conversationId:r=null,attachmentIds:a=[],consentAccepted:i=!1}={}){if(e){const{data:{session:o}}=await Rt.auth.getSession(),l=o?.user?.is_anonymous?o.access_token:null;try{Mxe({returnPath:t||Oxe(),anonymousAccessToken:l,expertId:n,conversationId:r,attachmentIds:a,consentAccepted:i})}catch{throw new Error("Google sign-in cannot preserve this conversation because browser storage is unavailable.")}}return CG("google")}async function Yxe(){return CG("x")}async function Kxe(){return await Rt.auth.signOut(),{status:"success"}}async function tx(){const e=await j4();return{status:"success",data:{user:e.user,balance:e.balance}}}async function Xxe(e){const{error:t}=await Rt.auth.resetPasswordForEmail(e,{redirectTo:`${window.location.origin}/reset-password`});if(t)throw new Error(t.message);return{status:"success",message:"If an account exists with this email, you will receive a password reset link."}}async function Jxe(e){const{error:t}=await Rt.auth.updateUser({password:e});if(t)throw new Error(t.message);return{status:"success",message:"Your password has been reset successfully."}}async function Qxe(e,t){const{data:{session:n}}=await Rt.auth.getSession();if(!n?.user?.email){const i=new Error("Not signed in");throw i.response={status:401,data:{detail:{code:"AUTH_REQUIRED",message:"You must be signed in."}}},i}const{error:r}=await Rt.auth.signInWithPassword({email:n.user.email,password:e});if(r){const i=new Error("Current password is incorrect");throw i.response={status:400,data:{detail:{code:"INVALID_CURRENT_PASSWORD",message:"Your current password is incorrect."}}},i}const{error:a}=await Rt.auth.updateUser({password:t});if(a)throw new Error(a.message);return{status:"success",message:"Your password has been changed successfully."}}function Hh({src:e,size:t}){return s.jsx("img",{src:e,width:t,height:t,alt:"","aria-hidden":"true",draggable:"false",style:{objectFit:"contain",display:"block"}})}function g0({size:e=19,color:t}){return t?s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",children:s.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}):s.jsx(Hh,{src:"/connector-icons/x.webp",size:e})}function j_({size:e=22}){return s.jsx(Hh,{src:"/connector-icons/youtube.webp",size:e})}function _4({size:e=20}){return s.jsx(Hh,{src:"/connector-icons/tiktok.webp",size:e})}function k4({size:e=19}){return s.jsx(Hh,{src:"/connector-icons/linkedin.png",size:e})}function __({size:e=20}){return s.jsx(Hh,{src:"/connector-icons/instagram.png",size:e})}function N4({size:e=20}){return s.jsx(Hh,{src:"/connector-icons/facebook.png",size:e})}function k_({size:e=20}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[s.jsx("circle",{cx:"12",cy:"12",r:"12",fill:"#25D366"}),s.jsx("path",{fill:"#fff",d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.
56198 0-.52.075-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.876 1.213 3.074.149.198 2.095 3.2 5.076 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.29.173-1.414-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.981.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.894 9.888-9.894 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.895 6.994c-.003 5.45-4.445 9.895-9.887 9.895m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.88 11.88 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413Z"})]})}function E4({size:e=20}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[s.jsx("circle",{cx:"12",cy:"12",r:"12",fill:"#1ED760"}),s.jsx("path",{d:"M5.1 8.9c4.5-1.35 10.1-.95 13.9 1.25",fill:"none",stroke:"#191414",strokeWidth:"2",strokeLinecap:"round"}),s.jsx("path",{d:"M6.1 12.15c3.8-1.08 8.4-.72 11.65 1.12",fill:"none",stroke:"#191414",strokeWidth:"1.75",strokeLinecap:"round"}),s.jsx("path",{d:"M7.05 15.15c3.05-.8 6.7-.5 9.3.92",fill:"none",stroke:"#191414",strokeWidth:"1.55",strokeLinecap:"round"})]})}function TG({size:e=20}){return s.jsx(Hh,{src:"/connector-icons/github.svg",size:e})}function N_({size:e=20,color:t="currentColor"}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",children:s.jsx("path",{d:"M19.655 14.262c.281 0 .557.023.828.064 0 .005-.005.01-.005.014-.105.267-.234.534-.381.786l-1.219 2.106c-1.112 1.936-3.177 3.127-5.411 3.127h-2.432c-2.23 0-4.294-1.191-5.412-3.127l-1.218-2.106a6.251 6.251 0 0 1 0-6.252l1.218-2.106C6.736 4.832 8.8 3.641 11.035 3.641h2.432c2.23 0 4.294 1.191 5.411 3.127l1.219 2.106c.147.252.271.519.381.786 0 .004.005.009.005.014-.267.041-.543.064-.828.064-1.816 0-2.501-.607-3.291-1.306-.764-.676-1.711-1.517-3.44-1.517h-1.029c-1.251 0-2.387.455-3.2 1.278-.796.805-1.233 1.904-1.233 3.099v1.411c0 1.196.437 2.295 1.233 3.099.813.823 1.949 1.278 3.2 1.278h1.034c1.729 0 2.676-.841 3.439-1.517.791-.703 1.471-1.306 3.287-1.301Zm.005-3.237c.399 0 .794-.036 1.179-.11-.002-.004-.002-.01-.002-.014-.073-.414-.193-.823-.349-1.218.731-.12 1.407-.396 1.986-.819 0-.004-.005-.013-.005-.018-.331-1.085-.832-2.101-1.489-3.03-.649-.915-1.435-1.719-2.331-2.395-1.867-1.398-4.088-2.138-6.428-2.138-1.448 0-2.855.28-4.175.841-1.273.543-2.423 1.315-3.407 2.299S2.878 6.552 2.341 7.83c-.557 1.324-.842 2.726-.842 4.175 0 1.448.281 2.855.842 4.174.542 1.274 1.314 2.423 2.298 3.407s2.129 1.761 3.407 2.299c1.324.556 2.727.841 4.175.841 2.34 0 4.561-.74 6.428-2.137a10.815 10.815 0 0 0 2.331-2.396c.652-.929 1.158-1.949 1.489-3.03 0-.004.005-.014.005-.018-.579-.423-1.255-.699-1.986-.819.161-.395.276-.804.349-1.218.005-.009.005-.014.005-.023.869.166 1.692.506 2.404 1.035.685.505.552 1.075.446 1.416C22.184 20.437 17.619 24 12.221 24c-6.625 0-12-5.375-12-12s5.37-12 12-12c5.398 0 9.963 3.563 11.471 8.464.106.341.239.915-.446 1.421-.717.529-1.535.873-2.404 1.034.128.716.128 1.45 0 2.166-.387-.074-.782-.11-1.182-.11-4.184 0-3.968 2.823-6.736 2.823h-1.029c-1.899 0-3.15-1.357-3.15-3.095v-1.411c0-1.738 1.251-3.094 3.15-3.094h1.034c2.768 0 2.552 2.823 6.731 2.827Z"})})}function Zxe({size:e=20}){return s.jsx(N_,{size:e,color:"#006BFF"})}function DT({size:e=20}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round","aria-hidden":"true",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9.2"}),s.jsx("ellipse",{cx:"12",cy:"12",rx:"4.4",ry:"9.2"}),s.jsx("path",{d:"M3.2 8.4Q12 12.2 20.8 8.4"}),s.jsx("path",{d:"M3.2 15.6Q12 11.8 20.8 15.6"})]})}const nu=[{key:"x",name:"X",subtitle:"Public posts and profile",provider:"x",Icon:g0,accounts:["x"]},{key:"youtube",name:"YouTube",subtitle:"Public videos and spoken transcripts",provider:"google",signInVia:"Google",Icon:j_,accounts:["youtube"]}
56,{key:"tiktok",name:"TikTok",subtitle:"Public videos and spoken transcripts",provider:null,signInVia:"TikTok",Icon:_4,accounts:["tiktok"]},{key:"linkedin",name:"LinkedIn",subtitle:"Professional profile posts",provider:"linkedin_oidc",Icon:k4,accounts:["linkedin"]},{key:"instagram",name:"Instagram",subtitle:"Public posts, Reels, captions, and spoken transcripts",provider:null,signInVia:"Instagram",Icon:__,accounts:["instagram"]},{key:"facebook",name:"Facebook Page",subtitle:"Public Page posts, videos, and available transcripts",provider:null,signInVia:"Facebook",Icon:N4,accounts:["facebook"]}],ebe="https://www.googleapis.com/auth/youtube.readonly";function tbe(e,t){return{redirectTo:`${t}/auth/callback`,...e==="youtube"?{scopes:ebe,queryParams:{prompt:"consent select_account",include_granted_scopes:"true"}}:{},...e==="linkedin"?{scopes:"r_profile_basicinfo"}:{}}}const S4="wizard_platform_handles",sbe={instagram:"instagram.com/",facebook:"facebook.com/",youtube:"youtube.com/@",x:"x.com/",tiktok:"tiktok.com/@",linkedin:"linkedin.com/in/",whatsapp:"wa.me/",spotify:"open.spotify.com/user/"},nbe={instagram:30,facebook:50,youtube:30,x:15,tiktok:24,linkedin:100,whatsapp:16,spotify:100},Sw=500,GM={instagram:e=>`https://www.instagram.com/${e}`,facebook:e=>`https://www.facebook.com/${e}`,youtube:e=>`https://www.youtube.com/@${e}`,x:e=>`https://x.com/${e}`,tiktok:e=>`https://www.tiktok.com/@${e}`,linkedin:e=>`https://www.linkedin.com/in/${e}`,whatsapp:e=>`https://wa.me/${e.replace(/\D/g,"")}`,spotify:e=>`https://open.spotify.com/user/${e}`},rbe={instagram:"Instagram",facebook:"Facebook",youtube:"YouTube",x:"X",tiktok:"TikTok",linkedin:"LinkedIn",whatsapp:"WhatsApp",spotify:"Spotify"},abe={instagram:new Set(["instagram.com","www.instagram.com"]),facebook:new Set(["facebook.com","www.facebook.com","m.facebook.com","fb.com","www.fb.com"]),youtube:new Set(["youtube.com","www.youtube.com","m.youtube.com"]),x:new Set(["x.com","www.x.com","twitter.com","www.twitter.com","mobile.twitter.com"]),tiktok:new Set(["tiktok.com","www.tiktok.com","m.tiktok.com"]),linkedin:new Set(["linkedin.com","www.linkedin.com"]),whatsapp:new Set(["wa.me","www.wa.me","whatsapp.com","www.whatsapp.com"]),spotify:new Set(["open.spotify.com","spotify.com","www.spotify.com"])},mN={instagram:new Set(["about","accounts","direct","explore","p","reel","reels","stories"]),facebook:new Set(["groups","marketplace","permalink.php","photo.php","photos","posts","reel","reels","share","story.php","videos","watch"]),x:new Set(["compose","explore","home","i","intent","messages","search","settings","share"])};function ibe(e){try{return decodeURIComponent(e)}catch{return e}}function rh(e){const t=String(e||"").trim();return/^[a-z][a-z\d+.-]*:\/\//i.test(t)||/^www\./i.test(t)||/^[^/\s]+\.[^/\s]+\/.+/.test(t)}function AG(e){const t=String(e||"").trim();if(!rh(t))return null;try{const n=new URL(t.includes("://")?t:`https://${t}`);return n.protocol!=="http:"&&n.protocol!=="https:"?null:n}catch{return null}}function RG(e){return e.pathname.split("/").filter(Boolean).map(ibe)}function E_(e,t){const n=AG(t),r=n?.hostname.toLowerCase().replace(/\.$/,"").replace(/^[a-z]{2}\.linkedin\.com$/,"linkedin.com");if(!n||!abe[e]?.has(r))return"";const a=RG(n),i=a[0]||"";if(e==="instagram")return!i||mN.instagram.has(i.toLowerCase())?"":`https://www.instagram.com/${i.replace(/^@/,"")}`;if(e==="facebook"){if(i.toLowerCase()==="profile.php"){const o=n.searchParams.get("id")?.trim();return o?`https://www.facebook.com/profile.php?id=${encodeURIComponent(o)}`:""}return!i||mN.facebook.has(i.toLowerCase())?"":i.toLowerCase()==="pages"&&a[1]?`https://www.facebook.com/${a.slice(0,3).map(encodeURIComponent).join("/")}`:`https://www.facebook.com/${i}`}if(e==="youtube")return i.startsWith("@")&&i.length>1?`https://www.youtube.com/@${i.slice(1)}`:["channel","c","user"].includes(i.toLowerCase())&&a[1]?`https://www.youtube.com/${i.toLowerCase()}/${a[1]}`:"";if(e==="x")return!i||mN.x.has(i.toLowerCase())?"":`https://x.com/${i.replace(/^@/,"")}`;if(e==="tiktok")return!i.startsWith("@")||i.length<2?"":`https://www.tiktok.com/@${i.slice(1)}`;if(e==="linkedin")return!a[1]||!["in","company"].includes(i.toLowerCase())?"":`https://www.linkedin.com/${i.toLowerCase()}/${a[1]}`;if(e==="whatsapp"){const o=i.replace(/\D/g,"");return o?`https://wa.me/${o}`:""}return e==="spotify"?!["user","artist","show"].includes(i.toLowerCase())||!a[1]?"":`https://open.spotify.com/${i.toLowerCase()}/${a[1]}`:""}function obe(e,t){const n=E_(e,t);if(!n)return Km(t);const r=AG(n),a=r?RG(r):[];return e==="facebook"&&a[0]?.toLowerCase()==="profile.php"?r.searchParams.get("id")?.trim()||"":e==="facebook"&&a[0]?.toLowerCase()==="pages"?a[1]||"":e==="youtube"&&a[0]?.startsWith("@")?a[0].slice(1):e==="linkedin"&&a[0]?.toLowerCase()==="company"?n:e==="youtube"||e==="linkedin"||e==="spotify"?(a[1]||"").replace(/^@/,""):e==="whatsapp"?(a[0]||"").replace(/\D/g,""):(a[0]||"").replace(/^@/,"")}function ru(e,t){const n=String(e||"").trim().replace(/\s/g,"");if(!n)return"";if(rh(n)){const r=E_(t,n);return r?obe(t,r):n}return Km(n)}function Km(e){let t=String(e||"").trim();if(!t)return"";if(/^[a-z][a-z\d+.-]*:\/\//i.test(t)||/^www\./i.test(t)||/^[^/\s]+\.[^/\s]+\/.+/.test(t))try{const r=t.includes("://")?t:`https://${t}`,a=new URL(r);if(a.hostname.includes(".")){const i=a.pathname.split("/").filter(
56Boolean),o=a.pathname.replace(/\/+$/,"").toLowerCase().endsWith("/profile.php")?a.searchParams.get("id")||"":i[i.length-1]||"";try{t=decodeURIComponent(o).replace(/^@/,"")}catch{t=o.replace(/^@/,"")}}}catch{}return t.replace(/^@/,"").replace(/^\/+|\/+$/g,"").split(/[/?#\s]/)[0]}function lbe(e,t){const n=Km(e).toLowerCase(),r=Km(t).toLowerCase();return!!(n&&r&&n===r)}function cbe(e,t,n){const r=Km(t),a=Km(n);return`The ${e} you signed in with is @${a}, not @${r}. That means this isn't @${r}'s account. Sign in with @${r}, or change the username to @${a}.`}const ube={instagram:{label:"Instagram",pattern:/^[A-Za-z0-9._]+$/,allowed:"Use only letters, numbers, periods, or underscores for Instagram."},facebook:{label:"Facebook",minLength:5,pattern:/^[A-Za-z0-9.]+$/,allowed:"Use only letters, numbers, or periods for Facebook."},youtube:{label:"YouTube",pattern:/^[\p{L}\p{N}._\-·]+$/u,allowed:"Use letters, numbers, periods, underscores, hyphens, or middle dots for YouTube.",noEdgeSeparator:!0},x:{label:"X",pattern:/^[A-Za-z0-9_]+$/,allowed:"Use only letters, numbers, or underscores for X."},tiktok:{label:"TikTok",pattern:/^[\p{L}\p{N}._]+$/u,allowed:"Use only letters, numbers, periods, or underscores for TikTok.",noTrailingPeriod:!0},linkedin:{label:"LinkedIn",minLength:3,pattern:/^[A-Za-z0-9._~-]+$/,allowed:"Use only letters, numbers, periods, underscores, hyphens, or tildes for LinkedIn."},whatsapp:{label:"WhatsApp",pattern:/^\+?[1-9]\d{6,14}$/,allowed:"Use a WhatsApp phone number with its country code."},spotify:{label:"Spotify",pattern:/^[A-Za-z0-9._~-]+$/,allowed:"Use only letters, numbers, periods, underscores, hyphens, or tildes for Spotify."}};function IG(e,t=""){if(!e)return t==="whatsapp"?"Add a WhatsApp phone number.":"Add a username or link first.";if(rh(e))return String(e).length>Sw?`Use ${Sw} characters or fewer.`:E_(t,e)?"":`Add a valid ${rbe[t]||"platform"} link.`;const n=ube[t],r=nbe[t]||40;return e.length>r?`Use ${r} characters or fewer.`:n?.minLength&&e.length<n.minLength?`${n.label} usernames need at least ${n.minLength} characters.`:n&&!n.pattern.test(e)?n.allowed:n?.noEdgeSeparator&&/^[._·-]|[._·-]$/.test(e)?"YouTube handles cannot start or end with a separator.":n?.noTrailingPeriod&&e.endsWith(".")?"TikTok usernames cannot end with a period.":n||/^[\p{L}\p{N}._-]+$/u.test(e)?"":"Use letters, numbers, dots, underscores or hyphens."}function C4(e,t){const n=String(t||"").trim().replace(/\s/g,"");if(rh(n))return E_(e,n);const r=ru(n,e);return!r||!GM[e]?"":e==="youtube"&&/^UC[A-Za-z0-9_-]+$/.test(r)?`https://www.youtube.com/channel/${r}`:e==="facebook"&&/^\d+$/.test(r)?`https://www.facebook.com/profile.php?id=${r}`:GM[e](r)}function dbe(){try{const e=JSON.parse(sessionStorage.getItem(S4)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function fN(e){try{sessionStorage.setItem(S4,JSON.stringify(e||{}))}catch{}}const PG={x:"x"};PG.twitter="x";function LG(e){const t=nu.find(n=>n.key===e);if(!t)throw new Error(`Unknown connector: ${e}`);return t}function hbe(e){const t=e.identity_data||{},n=t.user_name||t.preferred_username||t.nickname||t.slug||null,r=n||t.name||t.full_name||t.email||"Connected account";let a=null;return(e.provider==="x"||e.provider==="twitter")&&(a=t.profile||(n?`https://x.com/${n}`:null)),{handle:n?`@${n.replace(/^@/,"")}`:r,url:a}}async function pbe(e){const[t,n]=await Promise.all([Rt.auth.getUserIdentities(),Se.get("/experts/connectors/accounts")]);if(t.error)throw new Error(t.error.message);if((n.data?.data||[]).some(o=>o.platform==="linkedin"))return;const a=(t.data?.identities||[]).find(o=>o.provider===e);if(!a)return;const{error:i}=await Rt.auth.unlinkIdentity(a);if(i)throw new Error(i.message)}async function mbe(e){const{provider:t,name:n}=LG(e);if(e==="instagram"){const h=(await Se.post("/experts/connectors/instagram/authorize")).data?.data?.authorization_url;if(!h)throw new Error("Instagram did not return a connection URL.");window.location.assign(h);return}if(e==="facebook"){const h=(await Se.post("/experts/connectors/facebook/authorize")).data?.data?.authorization_url;if(!h)throw new Error("Facebook did not return a connection URL.");window.location.assign(h);return}if(e==="tiktok"){const h=(await Se.post("/experts/connectors/tiktok/authorize")).data?.data?.authorization_url;if(!h)throw new Error("TikTok did not return a connection URL.");window.location.assign(h);return}if(!t)throw new Error(`${n} connections aren't available yet.`);e==="linkedin"&&await pbe(t);
56const r=`/experts/new?connected=${e}`;try{sessionStorage.setItem("postAuthRedirect",r)}catch{}const a=tbe(e,window.location.origin),{data:i,error:o}=await Rt.auth.getUserIdentities();if(o)throw new Error(o.message);if((i?.identities||[]).some(d=>d.provider===t)){const{error:d}=await Rt.auth.signInWithOAuth({provider:t,options:a});if(d)throw new Error(d.message);return}const{error:c}=await Rt.auth.linkIdentity({provider:t,options:a});if(!c)return;if(c.code==="identity_already_exists"||/already linked|already exists/i.test(c.message||"")){const{data:d,error:h}=await Rt.auth.getUserIdentities();if(h)throw new Error(h.message);if(!(d?.identities||[]).some(g=>g.provider===t))throw new Error(`That ${n} account is already connected to another creator.`);const{error:m}=await Rt.auth.signInWithOAuth({provider:t,options:a});if(m)throw new Error(m.message);return}throw new Error(c.message)}async function OG(e){const{data:t}=await Rt.auth.getSession(),n=t?.session?.provider_token;if(!n)throw new Error(`The ${e} connection expired. Please connect again.`);return n}async function fbe(e){return(await Se.get("/experts/connector-accounts/facebook/pages",{params:{selection_id:e}})).data?.data||{selection_id:e,pages:[]}}async function gbe(e,t){return(await Se.post("/experts/connector-accounts/facebook",{page_id:e,selection_id:t})).data?.data||null}async function xbe(){const e=await OG("Google");return(await Se.post("/experts/connector-accounts/youtube",{provider_token:e})).data?.data||null}async function bbe(){const e=await OG("LinkedIn");return(await Se.post("/experts/connector-accounts/linkedin",{provider_token:e})).data?.data||null}async function ybe(e,t){return(await Se.post(`/experts/connector-accounts/${e}/public`,{handle:String(t||"").trim().replace(/\s/g,"")})).data?.data||null}function vbe(e){return e?.verification?e.verification==="oauth":!!(e?.provider&&e.provider!=="public_handle")}function wbe(e){const t={youtube:"YouTube channel",linkedin:"LinkedIn profile",instagram:"Instagram account",facebook:"Facebook Page",tiktok:"TikTok account",x:"X account"}[e.platform],n=["instagram","tiktok","x"].includes(e.platform)&&e.handle?`@${e.handle.replace(/^@/,"")}`:e.platform==="youtube"?e.handle||e.display_name:e.display_name||e.handle;return{id:e.external_id,handle:n||t,name:e.display_name,url:e.profile_url,verified:vbe(e),verification:e.verification||null,provider:e.provider||null}}async function Nd(){const[e,t]=await Promise.all([Rt.auth.getUserIdentities(),Se.get("/experts/connectors/accounts")]);if(e.error)throw new Error(e.error.message);const n={};for(const r of e.data?.identities||[]){const a=PG[r.provider];a&&(n[a]={...hbe(r),verified:!0})}for(const r of t.data?.data||[]){if(!["youtube","linkedin","instagram","facebook","tiktok","x"].includes(r.platform))continue;const a=wbe(r);if(r.platform==="x"&&n.x?.verified){r.handle&&!lbe(r.handle,n.x.handle)&&(n.x={...a,verified:!1,oauthHandle:n.x.handle});continue}n[r.platform]?.verified&&!a.verified||(n[r.platform]=a)}return n}async function MG(e){return e?(await Se.post("/experts/connector-accounts/claim-anonymous",{anonymous_access_token:e})).data?.data||[]:[]}const jbe={instagram:{instagram_username:null},youtube:{youtube_channel:null}};async function _be(e,t){return(await Se.post(`/experts/${e}/connectors/x`,{handle:(t||"").replace(/^@/,"")})).data}async function kbe(e){return(await Se.post(`/experts/${e}/connectors/youtube`,{})).data}async function Nbe(e){return(await Se.post(`/experts/${e}/connectors/linkedin`,{})).data}async function Ebe(e){return(await Se.post(`/experts/${e}/connectors/tiktok`,{})).data}async function Sbe(e){return(await Se.post(`/experts/${e}/connectors/instagram`,{})).data}async function Cbe(e){return(await Se.post(`/experts/${e}/connectors/facebook`,{})).data}async function DG(e){const{provider:t}=LG(e);["youtube","linkedin","instagram","facebook","tiktok"].includes(e)&&await Se.delete(`/experts/connector-accounts/${e}`);const n=jbe[e];if(n){const{error:l}=await Rt.auth.updateUser({data:n});if(l)throw new Error(l.message)}if(!t)return;const{data:r,error:a}=await Rt.auth.getUserIdentities();if(a)throw new Error(a.message);const i=(r?.identities||[]).find(l=>l.provider===t);if(!i)return;const{error:o}=await Rt.auth.unlinkIdentity(i);if(o)throw new Error(o.message)}
56async function Tbe(e){return(await Se.post(`/experts/${e}/connectors/profile-media`)).data?.data}async function Abe(e){return(await Se.post(`/experts/connector-accounts/${e}/refetch`)).data.data}async function Rbe(e){return(await Se.get(`/experts/connector-accounts/${e}/refetch`)).data.data}async function $G(e){return(await Se.post("/experts/anonymous-knowledge/claim",{anonymous_access_token:e})).data}async function Cw(e,t,n=null){const r=new FormData;return t.forEach(i=>r.append("files",i)),n&&r.append("title",n),(await Se.post(`/experts/${e}/documents/upload-batch`,r,{headers:{"Content-Type":"multipart/form-data"}})).data}async function S_(e,t,n=null,r=null){return(await Se.post(`/experts/${e}/documents/url`,{url:t,title:n,position:r})).data}async function YM(e,t){const n=e?`/experts/${e}/enhance-knowledge`:"/experts/enhance-knowledge";return(await Se.post(n,{text:t})).data}async function Xm(e,t){return(await Se.get(`/experts/${e}/documents/job/${t}/status`)).data}async function mu(e){return(await Se.get(`/experts/${e}/documents`)).data}async function FG(e,t){return(await Se.delete(`/experts/${e}/documents/${t}`)).data}async function BG(e){return(await Se.post(`/experts/${e}/build-index`)).data}async function $T(e){const t=await BG(e),n=Number(t?.data?.chunk_count||0);if(Number(t?.data?.embedded_count||0)<n)throw new Error("Some knowledge could not be prepared for answers. Please try again.");return t}async function UG(e,t,n=null){return(await Se.put(`/experts/${e}/style`,{style:t,custom_prompt:n})).data}async function Ibe(e){return(await Se.post(`/experts/${e}/generate-quiz`)).data}async function Pbe(e){return(await Se.post(`/experts/${e}/quiz-audio`,null,{timeout:12e4})).data}async function Lbe(e){return(await Se.post(`/experts/${e}/recommend-style`)).data}async function Obe(e){return(await Se.post(`/experts/${e}/assign-categories`)).data}function C_({className:e="grid min-h-dvh place-items-center bg-cream px-6",label:t="Loading your Great Experts workspace"}){return s.jsx("section",{className:e,role:"status","aria-live":"polite","aria-label":t,children:s.jsx("div",{className:"ge-auth-entry-loader","aria-hidden":"true"})})}const zG=f.createContext(null),Mbe=900,gN={user:null,balance:null,isAuthenticated:!1,isAnonymous:!1,isLoading:!1};async function Dbe(){const e=wG();if(e)try{await MG(e),jG()}catch{}}async function $be(){const e=_G();if(e)try{const t=await $G(e);NG(t.data?.expert?.id),kG()}catch{}}async function xN(){await Promise.all([Dbe(),$be()])}function HG(){try{for(let e=0;e<localStorage.length;e+=1){const t=localStorage.key(e);if(t?.startsWith("sb-")&&t.endsWith("-auth-token")&&localStorage.getItem(t))return!0}}catch{}return!1}function qG(e){return e==="/dashboard"||e==="/experts"||e.startsWith("/lab")||e.startsWith("/myaccount")||e.startsWith("/profile")||e.startsWith("/feedback")||e.startsWith("/checkout")||e.startsWith("/internal")||/^\/experts\/[^/]+\/edit$/.test(e)||/^\/experts\/[^/]+\/chat\/[^/]+$/.test(e)}function WG(){return HG()||window.location.pathname==="/auth/callback"||qG(window.location.pathname)}function Fbe(){return typeof window>"u"||document.getElementById("root")?.firstElementChild?gN:{...gN,isLoading:WG()}}function Bbe(e,t){switch(t.type){case"AUTH_SUCCESS":return{...e,user:t.payload.user,balance:t.payload.balance??e.balance,isAuthenticated:!0,isAnonymous:!1,isLoading:!1};case"AUTH_BOOT":return{...e,isLoading:!0};case"AUTH_FAILURE":return{...e,user:null,balance:null,isAuthenticated:!1,isAnonymous:!1,isLoading:!1};case"ANONYMOUS_READY":return{...e,user:null,balance:null,isAuthenticated:!1,isAnonymous:!0,isLoading:!1};case"LOGOUT":return{...e,user:null,balance:null,isAuthenticated:!1,isAnonymous:!1,isLoading:!1};case"UPDATE_USER":return{...e,user:{...e.user,...t.payload}};case"SET_BALANCE":return{...e,balance:t.payload};default:return e}}function Ube({children:e}){const[t,n]=f.useReducer(Bbe,void 0,Fbe),[r,a]=f.useState(!1),[i]=f.useState(HG);f.useEffect(()=>{!t.isLoading&&WG()&&n({type:"AUTH_BOOT"})},[]);const o=f.useRef(!1);f.useEffect(()=>{o.current=!!t.user},[t.user]);const l=t.user?.id;f.useEffect(()=>{l?bT?.identify(String(l)):bT?.reset()},[l]),f.useEffect(()=>{let k=!1,C=0,N=null;const A=I=>{C+=1;const $=C;if(!I?.access_token){n({type:"AUTH_FAILURE"});return}if(I.user?.is_anonymous){n({type:"ANONYMOUS_READY"});return}setTimeout(async()=>{let O=null;for(let U=0;U<3;U+=1)try{const F=await tx();if(await xN(),k||$!==C)return;n({type:"AUTH_SUCCESS",payload:{user:F.data.user,balance:F.data.balance}});return}catch(F){if(O=F,k||$!==C||U<2&&(await new Promise(H=>{setTimeout(H,600*(U+1))}),k||$!==C))return}if(O?.response?.data?.detail?.code==="TOKEN_INVALID"){try{await Rt.auth.signOut()}catch{}n({type:"AUTH_FAILURE"});return}o.current||n({type:"AUTH_FAILURE"})},0)},{data:{subscription:T}}=Rt.auth.onAuthStateChange((I,$)=>{if(I==="INITIAL_SESSION"&&!$?.access_token&&qG(window.location.pathname)){N=setTimeout(async()=>{try{const{data:{session:O}}=await Rt.auth.getSession();k||A(O)}catch{k||n({type:"AUTH_FAILURE"})}},600);return}if(I==="SIGNED_OUT"){C+=1,n({type:"LOGOUT"});return}(I==="INITIAL_SESSION"||I==="SIGNED_IN")&&A($)});return()=>{k=!0,C+=1,N&&clearTimeout(N),T?.unsubscribe()}},[]);
56const c=async(k,C)=>{const N=await Bxe(k,C);return await xN(),n({type:"AUTH_SUCCESS",payload:{user:N.data.user,balance:N.data.balance}}),N},u=f.useCallback(async()=>{const k=await EG();return k.isAnonymous&&n({type:"ANONYMOUS_READY"}),k},[]),d=f.useCallback(async()=>{const k=await Uxe();return n({type:"ANONYMOUS_READY"}),k},[]),h=f.useCallback(k=>zxe(k),[]),p=f.useCallback(k=>Hxe(k),[]),m=f.useCallback(k=>qxe(k),[]),g=f.useCallback(async k=>{const C=await Wxe(k),N=await tx();return n({type:"AUTH_SUCCESS",payload:{user:N.data.user,balance:N.data.balance}}),C},[]),x=f.useCallback((...k)=>SG(...k),[]),b=f.useCallback(async(k,C)=>{await Vxe(k,C);const N=await tx();return n({type:"AUTH_SUCCESS",payload:{user:N.data.user,balance:N.data.balance}}),N},[]),y=async(k,C,N,A={})=>{const T=await Fxe(k,C,N,A);return await xN(),n({type:"AUTH_SUCCESS",payload:{user:T.data.user,balance:T.data.balance}}),window.dataLayer?.push({event:"sign_up"}),T},v=async k=>{await Gxe(k)},w=async()=>{await Yxe()},j=f.useCallback(async()=>{a(!0),await Promise.allSettled([Kxe(),new Promise(k=>{setTimeout(k,Mbe)})]),n({type:"LOGOUT"}),a(!1)},[]),E=k=>{n({type:"UPDATE_USER",payload:k})},S=f.useCallback(async()=>{try{const k=await tx();return n({type:"SET_BALANCE",payload:k.data.balance}),k.data.balance}catch{return null}},[]),_=f.useCallback(k=>{k&&typeof k.answers=="number"&&n({type:"SET_BALANCE",payload:k})},[]);return s.jsxs(zG.Provider,{value:{...t,hasStoredSession:i,login:c,signup:y,ensureAnonymousSession:u,resetAnonymousSession:d,getAnonymousStatus:h,captureSaasEmail:p,startEmailCode:m,verifyEmailCode:g,transferAnonymousConversation:x,completeAccount:b,googleLogin:v,xLogin:w,logout:j,isLoggingOut:r,updateUser:E,refreshBalance:S,updateBalance:_},children:[e,r?s.jsx("div",{className:"fixed inset-0 z-[2147483647]",children:s.jsx(C_,{})}):null]})}const VG=f.createContext(null),zbe={experts:[],isLoading:!1,hasLoaded:!1,error:null};function Hbe(e,t){switch(t.type){case"SET_LOADING":return{...e,isLoading:!0,error:null};case"SET_EXPERTS":return{...e,experts:t.payload,isLoading:!1,hasLoaded:!0,error:null};case"ADD_EXPERT":return{...e,experts:[t.payload,...e.experts]};case"UPDATE_EXPERT":return{...e,experts:e.experts.map(n=>n.id===t.payload.id?t.payload:n)};case"DELETE_EXPERT":return{...e,experts:e.experts.filter(n=>n.id!==t.payload)};case"SET_ERROR":return{...e,isLoading:!1,error:t.payload};default:return e}}function qbe({children:e}){const[t,n]=f.useReducer(Hbe,zbe);return s.jsx(VG.Provider,{value:{...t,dispatch:n},children:e})}const Zs=f.createContext(null),Wbe={sidebarOpen:!1,searchQuery:"",toasts:[]};function Vbe(e,t){switch(t.type){case"TOGGLE_SIDEBAR":return{...e,sidebarOpen:!e.sidebarOpen};case"SET_SIDEBAR":return{...e,sidebarOpen:t.payload};case"SET_SEARCH":return{...e,searchQuery:t.payload};case"ADD_TOAST":return{...e,toasts:[...e.toasts.slice(-2),t.payload]};case"REMOVE_TOAST":return{...e,toasts:e.toasts.filter(n=>n.id!==t.payload)};default:return e}}function Gbe({children:e}){const[t,n]=f.useReducer(Vbe,Wbe),r=f.useCallback((i,o="info")=>{const l=Date.now().toString();n({type:"ADD_TOAST",payload:{id:l,message:i,type:o}}),setTimeout(()=>{n({type:"REMOVE_TOAST",payload:l})},4e3)},[]),a=f.useCallback(i=>{n({type:"REMOVE_TOAST",payload:i})},[]);return s.jsx(Zs.Provider,{value:{...t,dispatch:n,addToast:r,removeToast:a},children:e})}function Ut(){const e=f.useContext(zG);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const Ybe=300*1e3,sx=new Map;function GG(e){return String(e||"")}function nx(e){const t=e?.data?.starters;return Array.isArray(t)?{...e,data:{...e.data,starters:[...t]}}:e}async function Tw(e={}){const{search:t="",status:n="active",sort:r="updated_at",order:a="desc"}=e,{data:i,count:o,error:l}=await Rt.rpc("get_my_experts",{p_search:t,p_status:n,p_sort:r,p_order:a},{count:"exact"});if(l)throw new Error(l.message);return{status:"success",data:{experts:i||[],total:o||0}}}async function cu(e){return(await Se.get(`/experts/${e}`)).data}async function Kbe(e){return(await Se.post("/experts",e)).data}
56async function a1(e,t){return(await Se.put(`/experts/${e}`,t)).data}async function T_(e){return(await Se.delete(`/experts/${e}`)).data}async function KM(e=10){const{data:t,error:n}=await Rt.rpc("get_my_recent_chats",{p_limit:e});if(n)throw new Error(n.message);return{status:"success",data:{experts:t||[]}}}async function Xbe(e={}){let t=Rt.from("public_experts_ranked").select("*",{count:"exact"});if(e.search){const o=e.search.replace(/[%,]/g,"");t=t.or(`name.ilike.%${o}%,description.ilike.%${o}%`)}e.category&&(t=t.or(`primary_category.eq.${e.category},secondary_category.eq.${e.category}`));const n=e.sort||"recommended";switch(n==="recommended"&&(t=t.order("feed_tier",{ascending:!0}).order("feed_within",{ascending:!0}).order("created_at",{ascending:!1})),n){case"popularity":t=t.order("answer_count",{ascending:!1}).order("created_at",{ascending:!1});break;case"highly_rated":t=t.order("thumbs_up",{ascending:!1}).order("created_at",{ascending:!1});break;case"newly_added":case"created_at":t=t.order("created_at",{ascending:!1});break;case"updated_at":t=t.order("updated_at",{ascending:!1});break;case"name":t=t.order("name",{ascending:!0});break;default:t=t.order("recommended_score",{ascending:!1}).order("created_at",{ascending:!1})}const{data:r,count:a,error:i}=await t;if(i)throw i;return{status:"success",data:{experts:r||[],total:a||0}}}async function FT(e){return(await Se.get(`/experts/${e}/public`)).data}async function YG(e,t){return(await Se.patch(`/experts/${e}/visibility`,{is_public:t})).data}async function Jbe(e,{reaction:t,message_id:n=null}){return(await Se.post(`/experts/${e}/react`,{reaction:t,message_id:n})).data}async function T4(e,t){const n=new FormData;return n.append("file",t),(await Se.post(`/experts/${e}/avatar`,n,{headers:{"Content-Type":"multipart/form-data"}})).data}async function Qbe(e,{previous:t=""}={}){return(await Se.post(`/experts/${e}/generate-greeting`,{previous:t})).data}async function KG(e,{name:t="",bio:n="",handles:r={}}={}){return(await Se.post(`/experts/${e}/generate-description`,{name:t,bio:n,handles:r})).data}async function Zbe(e,t){return(await Se.post(`/experts/${e}/generate-persona-field`,t)).data}async function kh(e,{force:t=!1}={}){const n=GG(e),r=n?sx.get(n):null,a=r?.payload&&Date.now()-r.timestamp<Ybe;if(!t&&a)return nx(r.payload);if(!t&&r?.promise)return r.promise.then(nx);const i=Se.post(`/experts/${e}/conversation-starters`).then(o=>(n&&sx.set(n,{payload:nx(o.data),timestamp:Date.now(),promise:null}),o.data)).catch(o=>{throw n&&sx.delete(n),o});return n&&sx.set(n,{payload:r?.payload||null,timestamp:r?.timestamp||0,promise:i}),i.then(nx)}async function e0e(e,t){const n=await Se.put(`/experts/${e}/conversation-starters`,{starters:t}),r=GG(e);return r&&sx.set(r,{payload:nx(n.data),timestamp:Date.now(),promise:null}),n.data}async function t0e(e){return(await Se.get(`/experts/${e}/money`)).data}async function s0e(e,t){return(await Se.patch(`/experts/${e}/money`,t)).data}async function XG(e){return(await Se.get(`/experts/${e}/embed`)).data}async function x0(e,t,n=null){return(await Se.put(`/experts/${e}/embed`,{domain:t,config:n})).data}async function JG(e,t){return(await Se.patch(`/experts/${e}/embed`,{config:t})).data}async function n0e(e){return(await Se.delete(`/experts/${e}/embed`)).data}const Ay=10,QG=f.createContext();function Tc(e,t){return`gs_recent_${t}_${e}`}function XM(e){try{return JSON.parse(localStorage.getItem(e)||"[]")}catch{return[]}}function r0e({children:e}){const{user:t}=Ut(),n=t?.id,[r,a]=f.useState([]);f.useEffect(()=>{if(n){const u=XM(Tc(n,"experts"));a(u),u.length===0?KM(Ay).then(d=>{const h=(d.data?.experts||[]).map(p=>({id:p.id,slug:p.slug,name:p.name,avatar_url:p.avatar_url,lastChatAt:p.last_chat_at}));h.length>0&&(localStorage.setItem(Tc(n,"experts"),JSON.stringify(h)),a(h))}).catch(()=>{}):KM(Ay).then(d=>{const h=new Map((d.data?.experts||[]).map(g=>[g.id,g]));if(h.size===0)return;const p=u.filter(g=>h.has(g.id)).map(g=>({...g,slug:h.get(g.id)?.slug??g.slug}));(p.length!==u.length||p.some((g,x)=>g.slug!==u[x]?.slug))&&(localStorage.setItem(Tc(n,"experts"),JSON.stringify(p)),a(p))}).catch(()=>{})}else a([])},[n]),f.useEffect(()=>{if(!n)return;const u=d=>{d.key===Tc(n,"experts")&&a(XM(d.key))};return window.addEventListener("storage",u),()=>window.removeEventListener("storage",u)},[n]);const i=f.useCallback(({id:u,slug:d,name:h,avatar_url:p})=>{n&&a(m=>{const g=m.filter(b=>b.id!==u),x=[{id:u,slug:d,name:h,avatar_url:p,lastChatAt:new Date().toISOString()},...g].slice(0,Ay);return localStorage.setItem(Tc(n,"experts"),JSON.stringify(x)),window.dispatchEvent(new CustomEvent("gs:refresh-experts",{detail:{expertId:u,timestamp:Date.now()}})),x})},[n]),o=f.useCallback(({id:u,slug:d,name:h,avatar_url:p})=>{n&&a(m=>{const g=m.find(b=>b.id===u);if(g){const b=d&&g.slug!==d,y=p&&g.avatar_url!==p;if(b||y){const v=m.map(w=>w.id===u?{...w,slug:d??w.slug,avatar_url:p??w.avatar_url}:w);return localStorage.setItem(Tc(n,"experts"),JSON.stringify(v)),v}return m}const x=[...m,{id:u,slug:d,name:h,avatar_url:p,lastChatAt:new Date().toISOString()}].slice(0,Ay);return localStorage.setItem(Tc(n,"experts"),JSON.stringify(x)),x})},[n]),l=f.useCallback(u=>{n&&a(d=>{const h=d.filter(p=>p.id!==u);return localStorage.setItem(Tc(n,"experts"),JSON.stringify(h)),h})},[n]),c=f.useCallback(()=>{window.dispatchEvent(new CustomEvent("gs:refresh-expert-conversations",{detail:{timestamp:Date.now()}}))},[]);return s.jsx(QG.Provider,{value:{recentExperts:r,addRecentExpert:i,ensureRecentExpert:o,removeRecentExpert:l,refreshRecentExperts:c},children:e})}function A4(){const e=f.useContext(QG);if(!e)throw new Error("useRecentChats must be used within RecentChatsProvider");return e}const ZG=(...e)=>
vendor: 8,769 bytes, line 56
56e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const a0e=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const i0e=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const JM=e=>{const t=i0e(e);return t.charAt(0).toUpperCase()+t.slice(1)};var o0e={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const l0e=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const c0e=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:o,...l},c)=>f.createElement("svg",{ref:c,...o0e,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ZG("lucide",a),...!i&&!l0e(l)&&{"aria-hidden":"true"},...l},[...o.map(([u,d])=>f.createElement(u,d)),...Array.isArray(i)?i:[i]]));const we=(e,t)=>{const n=f.forwardRef(({className:r,...a},i)=>f.createElement(c0e,{ref:i,iconNode:t,className:ZG(`lucide-${a0e(JM(e))}`,`lucide-${e}`,r),...a}));return n.displayName=JM(e),n};const u0e=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],d0e=we("activity",u0e);const h0e=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],p0e=we("app-window",h0e);const m0e=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],R4=we("arrow-down-right",m0e);const f0e=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],g0e=we("arrow-down",f0e);const x0e=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ja=we("arrow-left",x0e);const b0e=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],xn=we("arrow-right",b0e);const y0e=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Af=we("arrow-up-right",y0e);const v0e=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],rl=we("arrow-up",v0e);const w0e=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],eY=we("at-sign",w0e);const j0e=[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]],bb=we("audio-lines",j0e);const _0e=[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]],k0e=we("award",_0e);const N0e=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],BT=we("badge-check",N0e);const E0e=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]],S0e=we("badge-dollar-sign",E0e);const C0e=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],T0e=we("bell",C0e);const A0e=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Ou=we("book-open",A0e);const R0e=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]],tY=we("book-open-text",R0e);const I0e=[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M15 10H9",key:"o6yqo3"}],["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],P0e=we("bookmark-plus",I0e);const L0e=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],qh=we("bot",L0e);const O0e=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],I4=we("briefcase",O0e);const M0e=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],D0e=we("calendar-clock",M0e);const $0e=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]],F0e=we("calendar-check",$0e);const B0e=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],Ex=we("calendar-days",B0e);const U0e=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]],z0e=we("calendar-x-2",U0e);const H0e=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],q0e=we("calendar",H0e);const W0e=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Nh=we("camera",W0e);const V0e=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],yb=we("chart-column",V0e);const G0e=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],Y0e=we("chart-line",G0e);const K0e=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],X0e=we("chart-no-axes-column",K0e);const J0e=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],UT=we("check-check",J0e);const Q0e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ft=we("check",Q0e);const Z0e=[["path",{d:"M17 21a1 1 0 0 0 1-1v-5.35c0-.457.316-.844.727-1.041a4 4 0 0 0-2.134-7.589 5 5 0 0 0-9.186 0 4 4 0 0 0-2.134 7.588c.411.198.727.585.727 1.041V20a1 1 0 0 0 1 1Z",key:"1qvrer"}],["path",{d:"M6 17h12",key:"1jwigz"}]],eye=we("chef-hat",Z0e);const tye=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Is=we("chevron-down",tye);const sye=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Wh=we("chevron-left",sye);const nye=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],hn=we("chevron-right",nye);const rye=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],aye=we("chevron-up",rye);const iye=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],oye=we("chevrons-down",iye);const lye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Co=we("circle-alert",lye);const cye=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Aw=we("circle-check-big",cye);const uye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],pc=we("circle-check",uye);
56const dye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],hye=we("circle-dot",dye);const pye=[["path",{d:"M15.6 2.7a10 10 0 1 0 5.7 5.7",key:"1e0p6d"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M13.4 10.6 19 5",key:"1kr7tw"}]],QM=we("circle-gauge",pye);const mye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],fye=we("circle-minus",mye);const gye=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],sY=we("circle-play",gye);const xye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],bye=we("circle-question-mark",xye);const yye=[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],vye=we("circle-user-round",yye);const wye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],zT=we("circle-x",wye);const jye=[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]],nY=we("clapperboard",jye);const _ye=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ah=we("clock-3",_ye);const kye=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Rf=we("clock",kye);const Nye=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],rY=we("code-xml",Nye);const Eye=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aY=we("compass",Eye);const Sye=[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M17.915 22a6 6 0 0 0-12 0",key:"suqz9p"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]],Cye=we("contact-round",Sye);const Tye=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ju=we("copy",Tye);const Aye=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Rw=we("credit-card",Aye);const Rye=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Iye=we("dollar-sign",Rye);const Pye=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Eh=we("download",Pye);const Lye=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],iY=we("earth",Lye);const Oye=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Iw=we("ellipsis",Oye);const Mye=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],Dye=we("expand",Mye);const $ye=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Ro=we("external-link",$ye);const Fye=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],vb=we("eye-off",Fye);const Bye=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Sh=we("eye",Bye);const Uye=[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]],oY=we("facebook",Uye);const zye=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],Hye=we("file-braces",zye);const qye=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],Wye=we("file-headphone",qye);const Vye=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],Gye=we("file-image",Vye);const Yye=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],Kye=we("file-play",Yye);const Xye=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],Jye=we("file-question-mark",Xye);const Qye=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],lY=we("file-spreadsheet",Qye);const Zye=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],si=we("file-text",Zye);const eve=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]],tve=we("film",eve);const sve=[["path",{d:"M12 22v-6",key:"6o8u61"}
56],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3-3-3 3",key:"e37ymu"}],["path",{d:"m15 5-3 3-3-3",key:"19d6lf"}]],nve=we("fold-vertical",sve);const rve=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],cY=we("folder",rve);const ave=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],uY=we("gift",ave);const ive=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],ove=we("github",ive);const lve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],vc=we("globe",lve);const cve=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],uve=we("graduation-cap",cve);const dve=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],_u=we("grip-vertical",dve);const hve=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],pve=we("hand",hve);const mve=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],fve=we("handshake",mve);const gve=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],xve=we("heart",gve);const bve=[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]],yve=we("hourglass",bve);const vve=[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]],ZM=we("id-card",vve);const wve=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],rc=we("image-plus",wve);const jve=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],b0=we("image",jve);const _ve=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],A_=we("inbox",_ve);const kve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],al=we("info",kve);const Nve=[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]],Eve=we("instagram",Nve);const Sve=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],Cve=we("key-round",Sve);const Tve=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],P4=we("languages",Tve);const Ave=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],Rve=we("laptop",Ave);const Ive=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Pve=we("layers",Ive);const Lve=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],dY=we("layout-dashboard",Lve);const Ove=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],hY=we("layout-grid",Ove);const Mve=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],R_=we("layout-template",Mve);
56const Dve=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],$a=we("link-2",Dve);const $ve=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],wb=we("link",$ve);const Fve=[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]],pY=we("linkedin",Fve);const Bve=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],If=we("list-checks",Bve);const Uve=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],mY=we("list",Uve);const zve=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],vt=we("loader-circle",zve);const Hve=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Zi=we("lock",Hve);const qve=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],fY=we("log-in",qve);const Wve=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],L4=we("log-out",Wve);const Vve=[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]],Gve=we("mail-check",Vve);const Yve=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],qr=we("mail",Yve);const Kve=[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9",key:"1j9vog"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m17 17 4 4",key:"1b3523"}],["path",{d:"m21 17-4 4",key:"uinynz"}]],eD=we("mail-x",Kve);const Xve=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],gY=we("map-pin",Xve);const Jve=[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"m21 3-6.75 6.75",key:"pv0uzu"}],["circle",{cx:"10",cy:"14",r:"6",key:"1qwbdc"}]],Qve=we("mars",Jve);const Zve=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],O4=we("maximize-2",Zve);const e1e=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],HT=we("maximize",e1e);const t1e=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],xY=we("megaphone",t1e);const s1e=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],xl=we("menu",s1e);const n1e=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],ni=we("message-circle",n1e);const r1e=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"m10 8-3 3 3 3",key:"fp6dz7"}],["path",{d:"M17 14v-1a2 2 0 0 0-2-2H7",key:"1tkjnz"}]],a1e=we("message-square-reply",r1e);const i1e=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],M4=we("message-square-text",i1e);const o1e=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],ea=we("message-square",o1e);const l1e=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],bY=we("messages-square",l1e);
56const c1e=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]],yY=we("mic-off",c1e);const u1e=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],Qr=we("mic",u1e);const d1e=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],vY=we("minimize-2",d1e);const h1e=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],qT=we("minimize",h1e);const p1e=[["path",{d:"M5 12h14",key:"1ays0h"}]],D4=we("minus",p1e);const m1e=[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]],wY=we("mouse-pointer-2",m1e);const f1e=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],jY=we("mouse-pointer-click",f1e);const g1e=[["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-4 0v-9a2 2 0 0 1 2-2h2",key:"39pd36"}],["rect",{width:"8",height:"4",x:"10",y:"6",rx:"1",key:"aywv1n"}]],_Y=we("newspaper",g1e);const x1e=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],jb=we("package",x1e);const b1e=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],tD=we("paintbrush",b1e);const y1e=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],Pf=we("palette",y1e);const v1e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Pw=we("panel-left",v1e);const w1e=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],WT=we("paperclip",w1e);const j1e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],_1e=we("panels-top-left",j1e);const k1e=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Lf=we("pause",k1e);const N1e=[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]],E1e=we("pen-tool",N1e);const S1e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],y0=we("pen",S1e);const C1e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Mu=we("pencil",C1e);const T1e=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],A1e=we("percent",T1e);const R1e=[["path",{d:"M13 2a9 9 0 0 1 9 9",key:"1itnx2"}],["path",{d:"M13 6a5 5 0 0 1 5 5",key:"11nki7"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2
560 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],kY=we("phone-call",R1e);const I1e=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],Ts=we("phone",I1e);const P1e=[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]],VT=we("pipette",P1e);const L1e=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Tr=we("play",L1e);const O1e=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Es=we("plus",O1e);const M1e=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],D1e=we("quote",M1e);const $1e=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],_b=we("refresh-cw",$1e);const F1e=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]],B1e=we("reply",F1e);const U1e=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Du=we("rotate-ccw",U1e);const z1e=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],H1e=we("rotate-cw",z1e);const q1e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Fa=we("search",q1e);const W1e=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],$u=we("send",W1e);const V1e=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],NY=we("settings-2",V1e);const G1e=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],EY=we("settings",G1e);const Y1e=[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]],K1e=we("shapes",Y1e);const X1e=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Of=we("share-2",X1e);const J1e=[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]],Q1e=we("share",J1e);const Z1e=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Vh=we("shield-check",Z1e);const ewe=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7
56a2 2 0 0 0-1.6.8z",key:"o988cm"}]],Mf=we("shopping-bag",ewe);const twe=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],swe=we("sliders-horizontal",twe);const nwe=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],rwe=we("smartphone",nwe);const awe=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Ms=we("sparkles",awe);const iwe=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]],I_=we("sparkle",iwe);const owe=[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]],lwe=we("square-arrow-out-up-right",owe);const cwe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],uwe=we("square-check",cwe);const dwe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]],hwe=we("square-chevron-down",dwe);const pwe=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],mwe=we("square-pen",pwe);const fwe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ku=we("square",fwe);const gwe=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],kb=we("star",gwe);const xwe=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],bwe=we("tag",xwe);const ywe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],SY=we("target",ywe);const vwe=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],$4=we("text-align-start",vwe);const wwe=[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]],CY=we("text-cursor-input",wwe);const jwe=[["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}],["path",{d:"M17 14V2",key:"8ymqnk"}]],wc=we("thumbs-down",jwe);const _we=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}],["path",{d:"M7 10v12",key:"1qc93n"}]],eo=we("thumbs-up",_we);const kwe=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Nwe=we("timer",kwe);const Ewe=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Qs=we("trash-2",Ewe);const Swe=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Cwe=we("trending-up",Swe);const Twe=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],xr=we("triangle-alert",Twe);const Awe=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Rwe=we("trophy",Awe);const Iwe=[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]],Pwe=we("twitter",Iwe);const Lwe=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],GT=we("type",Lwe);const Owe=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Mwe=we("undo-2",Owe);const Dwe=[["path",{d:"M12 22v-6",key:"6o8u61"}
56],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]],$we=we("unfold-vertical",Dwe);const Fwe=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Lw=we("upload",Fwe);const Bwe=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Uwe=we("user-check",Bwe);const zwe=[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]],TY=we("user-round-check",zwe);const Hwe=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Ci=we("user-round",Hwe);const qwe=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],F4=we("user",qwe);const Wwe=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],Vwe=we("users-round",Wwe);const Gwe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],B4=we("users",Gwe);const Ywe=[["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M9 19h6",key:"456am0"}],["circle",{cx:"12",cy:"9",r:"6",key:"1nw4tq"}]],Kwe=we("venus",Ywe);const Xwe=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],Ac=we("video",Xwe);const Jwe=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],uu=we("volume-2",Jwe);const Qwe=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],U4=we("volume-x",Qwe);const Zwe=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],eje=we("wand-sparkles",Zwe);const tje=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],AY=we("workflow",tje);const sje=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],nje=we("wrench",sje);const rje=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],as=we("x",rje);const aje=[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]],z4=we("youtube",aje);const ije=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],oje=we("zap",ije);function il({text:e,fullPage:t=!1}){const n=s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx(vt,{className:"w-6 h-6 text-indigo animate-spin"}),e&&s.jsx("p",{className:"text-sm text-ink-muted",children:e})]});return t?s.jsx("div",{className:"min-h-[60dvh] flex items-center justify-center",children:n}):s.jsx("div",{className:"flex items-center justify-center py-16",children:n})}const RY="https://greatexperts.ai",bN={width:1200,height:630,type:"image/jpeg"},lje=new Set(["dr","mr","mrs","ms","mx","prof","professor","sir","dame","rev"]),cje=e=>
56{const t=String(e).trim().split(/\s+/).filter(Boolean);return t.find(n=>!lje.has(n.replace(/\.$/,"").toLowerCase()))||t[0]||""},sD=e=>`Ask anything. Chat or call ${cje(e)}âs AI, anytime, in any language.`,nD={expert:()=>"Ask anything, anytime, in any language.",creator:()=>"Ready to answer you anytime, in any language."},or={main:{title:"Great Experts | A link in bio that answers, and sells",description:"It answers at 2am, recommends what fits, and captures the lead.",image:"/og/main.jpg"},create:{title:"Great Experts | Set it up once, it keeps working",description:"Nothing new to write. It learns from what you already published.",image:"/og/create.jpg"},business:{title:"Great Experts for business | An AI Expert on your website",description:"It answers your customers, recommends the right product, and captures every lead. Paste one snippet and itâs live in seconds.",image:"/og/saas.jpg"},enterprise:{title:"Great Experts for enterprise | AI that knows your company",description:"We interview your people, build a Company Brain, and let AI take the repetitive work off their plate.",image:"/og/saas.jpg"},pricing:{title:"Great Experts pricing | Pick your plan",description:"0% commission, always. You keep 100% of what you earn.",image:"/og/pricing.jpg"},expert:{title:e=>`${e} | Ask my AI Expert`,description:nD.expert,image:e=>`/og/experts/${encodeURIComponent(e)}.jpg`,card:{headline:e=>e,sub:sD}},creator:{title:e=>`${e} | Everything in one page`,description:nD.creator,image:e=>`/og/creators/${encodeURIComponent(e)}.jpg`,card:{headline:e=>e,sub:sD}}},yN=RY;function vs({title:e,description:t,path:n,ogImage:r,noIndex:a=!1}){const i=e||or.main.title,o=t||or.main.description,l=n?`${yN}${n}`:yN,c=r||or.main.image,u=c.startsWith("http")?c:`${yN}${c}`;return s.jsxs(l0,{children:[s.jsx("title",{children:i}),s.jsx("meta",{name:"description",content:o}),s.jsx("link",{rel:"canonical",href:l}),s.jsx("meta",{property:"og:title",content:i}),s.jsx("meta",{property:"og:description",content:o}),s.jsx("meta",{property:"og:url",content:l}),s.jsx("meta",{property:"og:image",content:u}),s.jsx("meta",{property:"og:image:secure_url",content:u}),s.jsx("meta",{property:"og:image:type",content:bN.type}),s.jsx("meta",{property:"og:image:width",content:bN.width}),s.jsx("meta",{property:"og:image:height",content:bN.height}),s.jsx("meta",{name:"twitter:title",content:i}),s.jsx("meta",{name:"twitter:description",content:o}),s.jsx("meta",{name:"twitter:image",content:u}),a&&s.jsx("meta",{name:"robots",content:"noindex,nofollow"})]})}const uje=6e4,dje=5e3,hje=6e3,pje=3e3,Sx=new Map,mje=5e3;function fje(e){const t=Sx.get(e);if(t)return clearTimeout(t.releaseTimer),t.releaseTimer=null,t.refs+=1,t;const n={refs:1,releaseTimer:null,status:"reconnecting",channel:null,signal:new Set,typing:new Set,statusSubs:new Set},r=a=>{n.status=a,n.statusSubs.forEach(i=>i(a))};Sx.set(e,n);try{n.channel=Rt.channel(e,{config:{private:!0}}),n.channel.on("broadcast",{event:"live_chat"},({payload:a})=>{n.signal.forEach(i=>i(a||{}))}).on("broadcast",{event:"typing"},({payload:a})=>{n.typing.forEach(i=>i(a||{}))}).subscribe(a=>r(a==="SUBSCRIBED"?"connected":"polling"))}catch{queueMicrotask(()=>r("polling"))}return n}function gje(e,t){t.refs-=1,!(t.refs>0||Sx.get(e)!==t)&&(t.releaseTimer=setTimeout(()=>{t.refs>0||Sx.get(e)!==t||(Sx.delete(e),t.channel&&Rt.removeChannel(t.channel))},mje))}function Ow(e,{onSignal:t,onReconcile:n,onSendTyping:r,enabled:a=!0,typingSide:i=null}={}){const[o,l]=f.useState("reconnecting"),[c,u]=f.useState(!1),d=f.useRef(t),h=f.useRef(n),p=f.useRef(r),m=f.useRef(null),g=f.useRef({value:!1,at:0});f.useEffect(()=>{d.current=t,h.current=n,p.current=r},[t,n,r]),f.useEffect(()=>{if(!e||!a)return;let b=!1,y=null,v=null;const w=fje(e);m.current=w;const j=()=>
56{if(clearTimeout(y),document.hidden)return;const C=w.status==="connected",N=C?uje:dje,A=C?Math.random()*1e4:0;y=setTimeout(async()=>{try{await h.current?.()}catch{}b||j()},N+A)},E=C=>{b||(l(C),h.current?.(),j())},S=C=>d.current?.(C),_=C=>{if(!i||C.from===i)return;clearTimeout(v);const N=C.typing===!0;u(N),N&&(v=setTimeout(()=>u(!1),hje))},k=()=>{if(document.hidden){clearTimeout(y);return}h.current?.(),j()};return w.statusSubs.add(E),w.signal.add(S),w.typing.add(_),queueMicrotask(()=>{b||l(w.status)}),document.addEventListener("visibilitychange",k),j(),()=>{b=!0,clearTimeout(y),clearTimeout(v),u(!1),w.statusSubs.delete(E),w.signal.delete(S),w.typing.delete(_),document.removeEventListener("visibilitychange",k),m.current=null,g.current.value&&Promise.resolve(p.current?.(!1)).catch(()=>{}),g.current={value:!1,at:0},gje(e,w)}},[e,a,i]);const x=f.useCallback(b=>{if(!i||!m.current||!p.current)return;const y=Date.now(),v=g.current;b&&v.value&&y-v.at<pje||!b&&!v.value||(g.current={value:b,at:y},Promise.resolve(p.current(b)).catch(()=>{}))},[i]);return{status:o,peerTyping:c,sendTyping:x}}const Wn=e=>e.data.data,xje=(e,t="profile")=>Se.get(`/live-chat/public/experts/${e}`,{params:{surface:t}}).then(Wn),bje=(e,t,n={})=>Se.post(`/live-chat/conversations/${e}/request`,{expert_id:t,share_transcript:!!n.shareTranscript,page_url:n.pageUrl||null,surface:n.surface==="embed"?"embed":"profile",contact_email:n.contactEmail||null,contact_phone:n.contactPhone||null}).then(Wn),yje=(e,t)=>Se.post(`/live-chat/conversations/${e}/cancel`,{expert_id:t}).then(Wn),vje=(e,t)=>Se.post(`/live-chat/conversations/${e}/resume`,{expert_id:t}).then(Wn),wje=(e,t,n,r)=>Se.post(`/live-chat/conversations/${e}/messages`,{expert_id:t,client_message_id:n,text:r}).then(Wn),jje=(e,t,n=0)=>Se.get(`/live-chat/conversations/${e}/messages`,{params:{expert_id:t,after_revision:n}}).then(Wn),_je=(e,t,n)=>Se.post(`/live-chat/conversations/${e}/read`,{expert_id:t,revision:n}).then(Wn),kje=(e,t,n,r)=>Se.post(`/live-chat/conversations/${e}/rating`,{expert_id:t,attempt_id:n,rating:r}).then(Wn),P_=()=>Se.get("/live-chat/settings").then(Wn),H4=e=>Se.put("/live-chat/settings",e).then(Wn),YT=(e={})=>Se.get("/live-chat/inbox",{params:e}).then(Wn),Nje=(e,t=0)=>Se.get(`/live-chat/attempts/${e}/messages`,{params:{after_revision:t}}).then(Wn),Eje=e=>Se.post(`/live-chat/attempts/${e}/accept`).then(Wn),Sje=e=>Se.post(`/live-chat/attempts/${e}/decline`).then(Wn),Cje=e=>Se.post(`/live-chat/attempts/${e}/resolve`).then(Wn),Tje=(e,t,n)=>Se.post(`/live-chat/attempts/${e}/messages`,{client_message_id:t,text:n}).then(Wn),Aje=e=>Se.get(`/live-chat/attempts/${e}/context`).then(Wn),Rje=e=>Se.get(`/live-chat/attempts/${e}/transcript`).then(Wn),Ije=(e,t)=>Se.post(`/live-chat/attempts/${e}/read`,{revision:t}).then(Wn),Pje=(e,t,n="")=>Se.post(`/live-chat/attempts/${e}/assist`,{mode:t,text:n}).then(Wn),Lje=(e=30)=>Se.get("/live-chat/analytics",{params:{days:e}}).then(Wn),IY=e=>e?.response?.data?.detail?.code||null,ih=(e,t="Something went wrong. Please try again.")=>e?.response?.data?.detail?.message||t,Oje=(e,t,n)=>Se.post(`/live-chat/conversations/${e}/typing`,{expert_id:t,typing:n}).then(Wn),Mje=(e,t)=>Se.post(`/live-chat/attempts/${e}/typing`,{typing:t}).then(Wn),Me={HOME:"/",LOGIN:"/login",SIGNUP:"/signup",DASHBOARD:"/dashboard",LAB:"/lab",CREATE_EXPERT:"/experts/new",EXPLORE:"/explore",PRICING:"/pricing",PROFILE:"/myaccount",PUBLIC_PAGE:"/myaccount/page",CREATORS:"/creators",LEADS:"/dashboard/leads",LIVE_CHAT:"/dashboard/live-chat",FOR_CREATORS:"/forcreators",FOR_BUSINESS:"/forbusiness",TERMS:"/terms",PRIVACY:"/privacy",DATA_DELETION:"/data-deletion",INTERNAL:"/internal",INTERNAL_USERS:"/internal/users",INTERNAL_CHATS:"/internal/chats",INTERNAL_PROFILE_PRESETS:"/internal/profile-presets"},PY=[Me.HOME,Me.PRICING,Me.TERMS,Me.PRIVACY,Me.DATA_DELETION],vN=["#4F46E5","#0891B2","#0D9488","#059669","#D97706","#DC2626","#7C3AED","#2563EB"],Dje={clinical_caring:"Supporter",scientific_researcher:"Scientist",educational_explainer:"Coach",strategic_advisor:"Advisor",systems_architect:"Engineer",Supporter:"Supporter",Scientist:"Scientist",Coach:"Coach",Advisor:"Advisor",Engineer:"Engineer"},wN=e=>Dje[e]||e,$je={message:{peak:.09,notes:[[784,0],[1046.5,.085]],decay:.5},joined:{peak:.08,notes:[[1046.5,0],[1318.5,.09],[1568,.18]],decay:.6},request:{peak:.12,notes:[[1318.5,0],[1046.5,.22]],decay:.9}};let Tl=null;function i1(e="message"){const t=$je[e];if(t)try{if(navigator.userActivation&&!navigator.userActivation.hasBeenActive)return;const n=window.AudioContext||window.webkitAudioContext;if(!n)return;Tl=Tl||new n,Tl.state==="suspended"&&Tl.resume().catch(()=>{});const r=Tl.createBiquadFilter();r.type="lowpass",r.frequency.value=4500,r.connect(Tl.destination);const a=Tl.currentTime+.01;
56t.notes.forEach(([i,o])=>{const l=a+o;[[i,t.peak,t.decay],[i*4,t.peak*.18,.08]].forEach(([c,u,d])=>{const h=Tl.createOscillator(),p=Tl.createGain();h.type="sine",h.frequency.value=c,p.gain.setValueAtTime(1e-4,l),p.gain.linearRampToValueAtTime(u,l+.006),p.gain.exponentialRampToValueAtTime(1e-4,l+d),h.connect(p).connect(r),h.start(l),h.stop(l+d+.05)})})}catch{}}const KT="ge:offer-live-chat";function Fje(e){!e||typeof window>"u"||window.dispatchEvent(new CustomEvent(KT,{detail:{expertId:e}}))}const XT="ge:live-chat-sync";function Bje(e){!e||typeof window>"u"||window.dispatchEvent(new CustomEvent(XT,{detail:{conversationId:e}}))}function q4(e){return e?{"--indigo":e,"--indigo-deep":`color-mix(in srgb, ${e} 82%, black)`}:void 0}const rD=20;function LY(e,t=""){const n=String(e||"").split(/\s+/).filter(Boolean).slice(0,2).join(" ");return n?n.length>rD?`${n.slice(0,rD-1).trimEnd()}â¦`:n:t}const JT=8e3,OY=100;function W4(e){return e.trim()?[...e].length>JT||new TextEncoder().encode(e).length>32768?"Keep your message within 8,000 characters and 32 KiB.":null:"Write a message before sending."}const aD=e=>typeof e.revision=="number"?e.revision:Number.MAX_SAFE_INTEGER;function QT(e,t){const n=new Map(e.map(r=>[r.id,r]));return t.forEach(r=>{const a=r.clientMessageId||r.client_message_id;a&&n.delete(a),n.set(r.id,{...r,_pending:!1})}),[...n.values()].sort((r,a)=>aD(r)-aD(a))}function Mw(e,t=0){return e.reduce((n,r)=>typeof r.revision=="number"&&r.revision>n?r.revision:n,t)}function MY(e,t){const n=new Set(t.messages.map(o=>o.id)),r=t.state!=="ai",a=t.startRevision,i=o=>typeof a!="number"||typeof o.revision!="number"||o.revision>=a;return e.filter(o=>!n.has(o.id)&&!(r&&o.source==="human"&&i(o)))}function Uje(e){return Mw(e.filter(t=>t.role==="creator"))}function zje(e,t){const n=e.filter(a=>a.role==="user").at(-1),r=t?.creatorReadRevision;return!n||typeof n.revision!="number"||typeof r!="number"?null:r>=n.revision?n.id:null}function Hje(e,t,n){const r=e==="embed"?n:t;try{const a=new URL(r);return a.protocol!=="http:"&&a.protocol!=="https:"?null:e==="embed"?a.href:`${a.origin}${a.pathname}`}catch{return null}}const DY=String.raw`(?:talk|speak|chat|connect)(?:ing)?(?:\s+me)?(?:\s+(?:to|with))?`,qje=[new RegExp(String.raw`\b${DY}\s+(?:a\s+|an\s+|the\s+)?(?:real\s+|actual\s+|live\s+)?(?:human|person|creator|owner|agent|someone\s+real|real\s+one)\b`,"i"),/\b(?:talk|speak|chat)(?:ing)?\s+(?:to|with)\s+(?:you|u)\s+(?:directly|personally|live|in\s+person)\b/i,/\b(?:real|actual)\s+(?:person|human)\b/i,/\blive\s+(?:agent|person|chat|support)\b/i,/\b(?:need|want)\s+(?:a\s+)?human\b/i,/\b(?:you|u)\s+yourself\b/i,/\bare\s+(?:you|u)\s+(?:a\s+)?(?:real|human|a\s+person)\b/i,/\bis\s+this\s+(?:a\s+)?(?:bot|robot|ai)\b/i];function Wje(e,t=""){const n=String(e||"");if(qje.some(i=>i.test(n)))return!0;const r=String(t||"").trim();if(!r||r==="the creator")return!1;const a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(String.raw`\b${DY}\s+${a}\b`,"i").test(n)}const Vje=/^[A-Za-z0-9._+'-]{1,64}@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/,Gje=/^\+?[0-9 ().-]{6,40}$/;function Yje(e,t){const n=String(e||"").trim(),r="".split(/\s+/).filter(Boolean).join(" "),a={};n&&(n.length>254||!Vje.test(n))&&(a.email="Check the email address.");const i=r.replace(/\D/g,"").length;return r&&(!Gje.test(r)||i<7||i>15)&&(a.phone="Check the phone number."),{email:n,phone:r,errors:a}}const Cp={count:30,title:60,text:2e3},ZT=e=>String(e||"").trim().split(/\s+/)[0]||"";function Kje(e,{visitorLabel:t,creatorName:n,expertName:r}={}){const a=String(t||"").trim(),i={visitor_name:!a||a.toLowerCase()==="visitor"?"there":ZT(a),creator_name:ZT(n),expert_name:String(r||"").trim()||"my AI expert"};return String(e||"").replace(/\{(visitor_name|creator_name|expert_name)\}/g,(o,l)=>i[l])}function Xje(e){const t=/^\/([^\n]*)$/.exec(String(e||""));return t?t[1]:null}function Jje(e,t){const n=String(t||"").trim().toLowerCase();return(e||[]).filter(r=>!n||String(r.title||"").toLowerCase().includes(n))}function jN(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:e<60?`${Math.round(e)}s`:e<3600?`${Math.round(e/60)} min`:`${(e/3600).toFixed(1).replace(/\.0$/,"")} h`}function iD(e){return typeof e!="number"||!Number.isFinite(e)?null:`${Math.round(e>1?e:e*100)}%`}function Qje(e,t){const n=(e||0)+(t||0);return n?(e||0)/n:null}const Zje=e=>/^https:\/\/[^\s]+$/i.test(String(e||"")),$Y="ge.liveChat.desktopAlerts";function V4(){try{return localStorage.getItem($Y)==="on"}catch{return!1}}function eA(e){try{localStorage.setItem($Y,e?"on":"off")}catch{}}const tA={id:null},Ry=new Map;let oD=null;function G4(e,t){return e!==oD&&(Ry.clear(),oD=e),Ry.has(t)||Ry.set(t,{data:void 0,promise:null,again:!1}),Ry.get(t)}function Bl(e,t){return e?G4(e,t).data:void 0}function sA(e,t,n){e&&(G4(e,t).data=n)}function oh(e,t,n,{join:r=!1}={}){const a=G4(e,t);if(a.promise)return r||(a.again=!0),a.promise;const i=()=>n().then(o=>(a.data=o,o));return a.promise=(async()=>{try{let o=await i();for(;a.again;)a.again=!1,o=await i();return o}finally{a.promise=null,a.again=!1}})(),a.promise}const _N=Me.LIVE_CHAT,lD=/^\(\d+\) /,kN=()=>window.location.pathname===Me.LIVE_CHAT,e_e=10,t_e=45e3,s_e=8;function n_e(){const{user:e}=Ut();return e?.id?s.jsx(r_e,{userId:e.id}):null}function r_e({userId:e}){const{addToast:t}=f.useContext(Zs),n=Ps(),[r,a]=f.useState(!1),[i,o]=f.useState(0),[l,c]=f.useState(0),u=f.useRef(null),d=f.useRef(null);f.useEffect(()=>{let y=!1;return oh(e,"settings",P_,{join:!0}).then(v=>{y||a(!!(v?.featureEnabled&&v?.enabled))}).catch(()=>{}),()=>{y=!0}},[e]);const h=f.useCallback((y,v,w)=>
56{if((document.hidden||!document.hasFocus())&&V4()&&typeof Notification<"u"&&Notification.permission==="granted")try{const j=new Notification(y,{body:v,tag:w});j.onclick=()=>{window.focus(),n(_N),j.close()}}catch{}},[n]),p=f.useCallback((y,v)=>{i1("request"),kN()&&!document.hidden||t(s.jsxs(s.Fragment,{children:["New live chat request."," ",s.jsx(Le,{to:_N,className:"font-medium text-indigo underline underline-offset-2",children:"Open live chat"})]}),"info"),h("New live chat request",y>1?`${y} people are waiting`:v||"","ge-live-chat-request")},[t,h]),m=f.useCallback((y,v)=>{i1("message");const w=LY(v,"Visitor"),j=kN()&&!document.hidden;j&&y===tA.id||(j||t(s.jsxs(s.Fragment,{children:["New message from ",w,"."," ",s.jsx(Le,{to:_N,className:"font-medium text-indigo underline underline-offset-2",children:"Open live chat"})]}),"info"),h("New live chat message",`From ${w}`,"ge-live-chat-message"))},[t,h]),g=f.useCallback(async()=>{try{const v=(await YT({state:"human",limit:e_e}))?.attempts||[],w=Object.fromEntries(v.map(S=>[S.id,S.unreadCount||0])),j=d.current;if(d.current=w,c(v.reduce((S,_)=>S+(_.unreadCount||0),0)),!j)return;const E=v.find(S=>(S.unreadCount||0)>(j[S.id]||0));E&&m(E.id,E.visitorLabel||"Visitor")}catch{}},[m]),x=f.useCallback(async()=>{try{const y=await YT({state:"waiting",limit:1}),v=y?.counts?.waiting||0,w=u.current;u.current=v,o(v),w!==null&&v>w&&p(v,y?.attempts?.[0]?.expertName)}catch{}},[p]);Ow(r?`live-chat:creator:${e}`:null,{enabled:r,onSignal:y=>{const v=y?.event;!v||v==="state"||v==="request"?(x(),g()):(v==="message"?y.actor!=="creator":v==="read"&&y.actor==="creator")&&g()},onReconcile:()=>{x(),g()}}),f.useEffect(()=>{if(!i)return;let y=0;const v=window.setInterval(()=>{if(!(kN()&&!document.hidden&&document.hasFocus())){if(y+=1,y>s_e){window.clearInterval(v);return}i1("request")}},t_e);return()=>window.clearInterval(v)},[i]);const b=i+l;return f.useEffect(()=>{const y=()=>{const v=document.title.replace(lD,"");document.title=document.hidden&&b>0?`(${b}) ${v}`:v};return y(),document.addEventListener("visibilitychange",y),()=>{document.removeEventListener("visibilitychange",y),document.title=document.title.replace(lD,"")}},[b]),null}function a_e(){const{user:e,isAuthenticated:t,isLoading:n}=Ut(),r=an(),a=l_();return n?s.jsx(il,{fullPage:!0,text:"Loading..."}):t?e?.account_completed===!1?s.jsx(Pn,{to:"/complete-account",replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(vs,{noIndex:!0}),s.jsx(n_e,{}),s.jsx(vh,{context:a})]}):s.jsx(Pn,{to:Me.LOGIN,replace:!0,state:{from:r}})}const i_e=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function Ch(e){if(e instanceof Date)return e;if(typeof e=="number")return new Date(e);if(typeof e!="string"||!e)return new Date(NaN);const t=e.trim();return new Date(i_e.test(t)?`${t.replace(" ","T")}Z`:t)}function Cx(e){return e?Ch(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):""}function FY(e){if(!e)return"";const t=e.trim().split(/\s+/);return t.length===1?t[0].substring(0,2).toUpperCase():(t[0][0]+t[1][0]).toUpperCase()}function o_e(e){if(!e)return vN[0];let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return vN[Math.abs(t)%vN.length]}function nA(e){const t=Math.max(0,Math.floor(e||0));return`${String(Math.floor(t/60)).padStart(2,"0")}:${String(t%60).padStart(2,"0")}`}const l_e={xs:"w-5 h-5 text-[10px]",sm:"w-8 h-8 text-xs",md:"w-9 h-9 text-sm",lg:"w-10 h-10 text-base",xl:"w-12 h-12 text-lg","2xl":"w-16 h-16 text-xl","3xl":"w-20 h-20 text-2xl"},c_e={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6","2xl":"w-8 h-8","3xl":"w-10 h-10"};function ws({name:e,size:t="md",className:n="",src:r,variant:a="square"}){const[i,o]=f.useState(!1),l=FY(e),c=o_e(e);f.useEffect(()=>{o(!1)},[r]);const u=r&&!i;return s.jsx("div",{className:`inline-flex items-center justify-center rounded-full font-medium text-cream shrink-0 overflow-hidden ${l_e[t]} ${n}`,style:{backgroundColor:u?"transparent":c},"aria-label":e,children:u?s.jsx("img",{src:r,alt:e,className:"w-full h-full object-cover rounded-[inherit]",style:{display:"block"},onError:()=>o(!0)}):a==="expert"?s.jsx(qh,{className:`${c_e[t]} text-cream/90`}):l})}const cD={flat:"/brand/logo-flat.svg",gradient:"/brand/logo-gradient.svg",indigo:"/brand/logo-indigo.svg",light:"/brand/logo-light.svg",white:"/brand/logo-white.svg",mono:"/brand/logo-indigo-mono.svg",mark:"/brand/logo-mark.svg",markFlat:"/brand/logo-mark-indigo.svg"};function bn({variant:e="flat",height:t=28,className:n=""}){const r=cD[e]||cD.gradient;return s.jsx("img",{src:r,alt:"great experts",style:{height:`${t}px`,width:"auto"},className:n})}const uD=[{label:"Overview",icon:dY,href:Me.INTERNAL,view:"overview"},{label:"Users",icon:B4,href:Me.INTERNAL_USERS,view:"users"},{label:"Subscriptions",icon:Rw,href:`${Me.INTERNAL}?view=subscriptions`,view:"subscriptions"},{label:"Tools",icon:nje,group:"tools",children:[{label:"Profile presets",icon:Pf,href:Me.INTERNAL_PROFILE_PRESETS,view:"presets"},{label:"Chat exports",icon:Eh,href:Me.INTERNAL_CHATS,view:"chats"}]}];function u_e(){const{user:e,logout:t}=Ut(),n=an(),r=f.useRef(null),[a,i]=f.useState(!1),[o,l]=f.useState({}),c=n.pathname.startsWith(Me.INTERNAL_USERS)?"users":n.pathname===Me.INTERNAL_CHATS?"chats":n.pathname===Me.INTERNAL_PROFILE_PRESETS?"presets":new URLSearchParams(n.search).get("view")||"overview",u=uD.find(h=>h.children?.some(p=>p.view===c))?.group,d=({label:h,icon:p,href:m,view:g},x=!1)=>s.jsxs(Le,{to:m,onClick:()=>i(!1),"aria-current":c===g?"page":void 0,className:x?"internal-nav__link internal-nav__link--sub":"internal-nav__link",children:[s.jsx(p,{"aria-hidden":"true"}),s.jsx("span",{children:h})]},g);return f.useEffect(()=>{const h=p=>{p.key==="Escape"&&i(!1)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[]),f.useEffect(()=>{r.current?.scrollTo({top:0,left:0,behavior:"auto"})},[n.pathname]),f.useEffect(()=>{const h=r.current;if(!h)return;let p=0;const m=()=>{h.dataset.scrollbar="visible",clearTimeout(p),p=setTimeout(()=>{delete h.dataset.scrollbar},900)},g=x=>{const{right:b}=h.getBoundingClientRect();b-x.clientX<=20&&m()};return h.addEventListener("scroll",m,{passive:!0}),h.addEventListener("pointermove",g,{passive:!0}),()=>{clearTimeout(p),h.removeEventListener("scroll",m),h.removeEventListener("pointermove",g)}},[]),s.jsxs("div",{className:"internal-shell","data-nav-collapsed":"false",children:[s.jsx(vs,{title:"Internal | Great Experts",path:Me.INTERNAL,noIndex:!0}),s.jsx("a",{className:"internal-skip-link",href:"#internal-main",children:"Skip to content"}),s.jsxs("header",{className:"internal-mobile-header",children:[s.jsxs(Le,{to:Me.INTERNAL,className:"internal-mobile-header__brand","aria-label":"Great Experts Internal overview",children:[s.jsx(bn,{variant:"flat",height:34}),s.jsx("span",{className:"internal-mobile-header__label",children:"Internal"})]}),s.jsx("button",{type:"button",onClick:()=>i(h=>!h),className:"internal-icon-button","aria-label":a?"Close internal navigation":"Open internal navigation","aria-expanded":a,"aria-controls":"internal-navigation",children:a?s.jsx(as,{"aria-hidden":"true"}):s.jsx(xl,{"aria-hidden":"true"})})]}),s.jsxs("aside",{className:"internal-nav",id:"internal-navigation","data-open":a,"data-collapsed":"false",children:[s.jsx("div",{className:"internal-nav__brand",children:s.jsxs(Le,{to:Me.INTERNAL,"aria-label":"Great Experts Internal overview",onClick:()=>i(!1),children:[s.jsx("span",{className:"internal-nav__logo-full",children:s.jsx(bn,{variant:"flat",height:44})}),s.jsx("span",{className:"internal-nav__logo-mark",children:s.jsx(bn,{variant:"markFlat",he
56ight:34})})]})}),s.jsx("nav",{className:"internal-nav__links","aria-label":"Internal navigation",children:uD.map(h=>{if(h.children){const{label:p,icon:m,group:g,children:x}=h,b=o[g]??u===g,y=`internal-nav-${g}`;return s.jsxs("div",{className:"internal-nav__group","data-expanded":b,children:[s.jsxs("button",{type:"button",className:"internal-nav__link internal-nav__group-toggle","aria-expanded":b,"aria-controls":y,"data-has-active":u===g||void 0,onClick:()=>l(v=>({...v,[g]:!b})),children:[s.jsx(m,{"aria-hidden":"true"}),s.jsx("span",{children:p}),s.jsx(Is,{"aria-hidden":"true",className:"internal-nav__group-chevron"})]}),s.jsx("div",{className:"internal-nav__submenu",id:y,hidden:!b,children:x.map(v=>d(v,!0))})]},g)}return d(h)})}),s.jsx("div",{className:"internal-nav__footer",children:s.jsxs("div",{className:"internal-nav__person",children:[s.jsx(ws,{name:e?.full_name||e?.email||"Admin",src:e?.avatar_url,size:"md"}),s.jsxs("div",{className:"internal-nav__person-copy",children:[s.jsx("p",{className:"internal-nav__name",children:e?.full_name||"GE Team"}),s.jsx("p",{className:"internal-nav__role",children:"GE Team"})]}),s.jsxs("button",{type:"button",onClick:t,className:"internal-signout",title:"Sign out",children:[s.jsx(L4,{"aria-hidden":"true"}),s.jsx("span",{className:"sr-only",children:"Sign out"})]})]})})]}),s.jsx("main",{ref:r,className:"internal-main",id:"internal-main",inert:a?!0:void 0,"aria-hidden":a||void 0,children:s.jsx(vh,{})})]})}const Y4="local-template-",ac=!1;function BY(e){const t=window.localStorage.getItem(e);if(!t)return{templates:[],order:[]};try{const n=JSON.parse(t);if(!Array.isArray(n.templates)||!Array.isArray(n.order))throw new Error;return n}catch{throw new Error("Local templates could not be read. Your saved data has not been changed.")}}function d_e(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{throw new Error("Could not save in this browser. Free some browser storage or use a smaller card image.")}}function UY(e,t){const n=[...e?.templates||[],...t.templates],r=new Map(t.order.map((a,i)=>[a,i]));return n.sort((a,i)=>(r.get(a.id)??1/0)-(r.get(i.id)??1/0)),{...e,templates:n}}async function zY(){const{data:{session:e}}=await Rt.auth.getSession();if(!e?.user?.id)throw new Error("Your session has expired. Please log in again.");return`internal-profile-templates:v1:https://mlqdoeokttnrcylciaet.supabase.co:${e.user.id}`}async function L_(e){return ac?UY(e,BY(await zY())):e}async function O_(e){const{data:t,error:n}=await Rt.rpc("get_internal_profile_look_presets");if(n)throw br(n,"Failed to load profile presets.");const r=await zY(),a=e(BY(r));return d_e(r,a),UY(t,a)}const dD={NOT_AUTHENTICATED:"Your session has expired. Please log in again.",NOT_INTERNAL:"You don't have access to this tool. It's restricted to internal team members.",NOT_FOUND:"No chat found for that ID. Double-check the ID and try again.",UNKNOWN_ID_TYPE:"That ID is not a chat (conv_â¦) ID.",INVALID_PLAN:"That subscription filter is not supported.",INVALID_RANK:"That ranking option is not supported.",INVALID_ACTIVITY:"That activity filter is not supported.",USER_NOT_FOUND:"That user no longer exists.",INVALID_PRESET_LABEL:"Preset names must be between 1 and 80 characters.",INVALID_PRESET_THUMBNAIL:"That thumbnail URL is too long.",INVALID_PRESET_DESIGN:"Design JSON must be an object smaller than 50 KB.",DEFAULT_PRESET_MUST_BE_ENABLED:"The default preset must also be enabled.",PRESET_REQUIRED:"At least one preset must stay enabled.",PRESET_NOT_FOUND:"That preset no longer exists. Reload and try again.",INVA
56LID_PRESET_ORDER:"Preset order changed elsewhere. Reload and try again.",INVALID_PROFILE_LINK:"Paste a valid profile link or handle.",PROFILE_NOT_FOUND:"No profile matches that link or handle.",PROFILE_STYLE_NOT_FOUND:"That profile has no saved page style to import.",PROFILE_PRESET_IMPORT_UNAVAILABLE:"Profile import is temporarily unavailable.",PROFILE_PRESET_IMPORT_FAILED:"Failed to import that profile look.",SYSTEM_PRESET_CANNOT_BE_DELETED:"Built-in presets can be disabled, but not deleted.",INVALID_ACTION:"That subscription action is not supported.",INVALID_END_DATE:"Pick an end date in the future (up to 5 years out).",TOO_MANY_USERS:"Select at most 200 users at a time.",NO_USERS_SELECTED:"Select at least one user first."};function br(e,t){const n=e?.response?.data?.detail,a=(typeof n=="string"?n:[n?.code,n?.message].filter(Boolean).join(" "))||e?.message||"",i=Object.keys(dD).sort((o,l)=>l.length-o.length).find(o=>a.includes(o));return new Error(i?dD[i]:a||t)}async function HY(){const{data:e,error:t}=await Rt.rpc("check_internal_access");if(t){if((t.message||"").includes("NOT_INTERNAL"))return!1;throw new Error(t.message||"Access check failed.")}return e===!0}async function M_({search:e="",plan:t="all",days:n=1,limit:r=12,offset:a=0}={}){const{data:i,error:o}=await Rt.rpc("get_internal_admin_dashboard",{p_search:e,p_plan:t,p_days:n,p_limit:r,p_offset:a});if(o)throw br(o,"Failed to load the internal dashboard.");return i}async function h_e({days:e=30}={}){const{data:t,error:n}=await Rt.rpc("get_internal_overview",{p_days:e});if(!n)return t;if(!Fu(n,"get_internal_overview"))throw br(n,"Failed to load the overview.");const[r,a]=await Promise.allSettled([M_({days:e,limit:5}),D_({days:e,limit:5,rankBy:"leads",activity:"active"})]);if(r.status==="rejected")throw r.reason;const i=a.status==="fulfilled"&&a.value?.analytics_available!==!1?a.value:null;return{authorized:r.value?.authorized===!0,period_days:e,summary:{...r.value?.summary,active_users:i?.summary?.active_users??null,conversations:i?.summary?.conversations??null,leads:i?.summary?.leads??null},subscription_mix:r.value?.subscription_mix,conversation_trend:i?.engagement_trend??null,newest_users:r.value?.users||[],top_lead_users:i?(i.users||[]).filter(o=>Number(o.leads_count)>0):null}}async function p_e({days:e=30}={}){const{data:t,error:n}=await Rt.rpc("get_internal_subscription_overview",{p_days:e});if(!n)return t;if(Fu(n,"get_internal_subscription_overview"))return null;throw br(n,"Failed to load subscriptions.")}async function m_e({days:e=30}={}){const{data:t,error:n}=await Rt.rpc("get_internal_lead_followup",{p_days:e});if(!n)return t;if(Fu(n,"get_internal_lead_followup"))return null;throw br(n,"Failed to load lead follow-up.")}async function f_e({days:e=30}={}){const{data:t,error:n}=await Rt.rpc("get_internal_embed_trend",{p_days:e});if(!n)return t;if(Fu(n,"get_internal_embed_trend"))return null;throw br(n,"Failed to load the embed trend.")}async function qY({days:e=30}={}){const{data:t,error:n}=await Rt.rpc("get_internal_profile_trend",{p_days:e});if(!n)return t;if(Fu(n,"get_internal_profile_trend"))return null;throw br(n,"Failed to load the profile trend.")}async function g_e({days:e=30}={}){const{data:t,error:n}=await Rt.rpc("get_internal_conversation_channels",{p_days:e});if(!n)return t;if(Fu(n,"get_internal_conversation_channels"))return null;throw br(n,"Failed to load conversation channels.")}function Fu(e,t){const n=`${e?.code||""} ${e?.message||""} ${e?.details||""}`.toLowerCase();return n.includes(t.toLowerCase())&&(n.includes("pgrst202")||n.includes("schema cache")||n.includes("could not find"))}async function D_({search:e="",plan:t="all",days:n=30,limit:r=10,offset:a=0,rankBy:i="conversations",activity:o="all",profile:l="all"}={}){const{data:c,error:u}=await Rt.rpc("get_internal_users_dashboard",{p_search:e,p_plan:t,p_days:n,p_limit:r,p_offset:a,p_rank_by:i,p_activity:o,...l!=="all"?{p_profile:l}:{}});if(!u)return c;if(!Fu(u,"get_internal_users_dashboard"))throw br(u,"Failed to load user analytics.");if(l!=="all")throw new Error("Profile filters are available after the next database update.");const d=await M_({search:e,plan:t,days:0,limit:r,offset:a});return{authorized:d?.authorized===!0,analytics_available:!1,period_days:n,rank_by:i,activity:o,summary:{total_users:d?.summary?.total_users??null,active_users:null,conversations:null,messages:null,leads:null,contacts:null},engagement_trend:[],total_matching:d?.total_matching??0,users:(d?.users||[]).map((h,p)=>({...h,rank_position:a+p+1,conversations_count:null,messages_count:null,leads_count:null,contacts_count:null,last_active_at:null}))}}async function WY({userId:e,days:t=30,hint:n=null}={}){const r=String(e||"").trim();if(!r)throw new Error("A user ID is required.");const{data:a,error:i}=await Rt.rpc("get_internal_user_analytics",{p_user_id:r,p_days:t});if(!i)return a;
56if(!Fu(i,"get_internal_user_analytics"))throw br(i,"Failed to load this userâs analytics.");let o=n?.id===r?n:null;if(!o)for(const l of[0,100]){const c=await D_({days:t,limit:100,offset:l,rankBy:"recent"});if(o=(c?.users||[]).find(u=>u.id===r)||null,o||l+100>=Number(c?.total_matching||0))break}if(!o)throw new Error("This user could not be found in the current analytics rollout.");return{authorized:!0,analytics_available:!1,period_days:t,user:o,engagement_trend:[]}}async function x_e(e){const{data:t,error:n}=await Rt.rpc("export_chat_for_internal",{p_chat_id:e});if(n)throw br(n,"Failed to load chat.");return t}async function b_e(){const{data:e,error:t}=await Rt.rpc("get_internal_profile_look_presets");if(t)throw br(t,"Failed to load profile presets.");return L_(e)}async function hD(e){if(ac&&e.id.startsWith(Y4))return O_(r=>({...r,templates:r.templates.map(a=>a.id===e.id?{...a,label:e.label,thumbnail:e.thumbnail,design:e.design,enabled:e.enabled}:a)}));const{data:t,error:n}=await Rt.rpc("update_internal_profile_look_preset",{p_id:e.id,p_label:e.label,p_thumbnail:e.thumbnail||"",p_design:e.design,p_enabled:e.enabled,p_is_default:e.isDefault});if(n)throw br(n,"Failed to save that preset.");return L_(t)}async function y_e(e){if(ac)return O_(r=>({...r,templates:[...r.templates,{id:`${Y4}${crypto.randomUUID()}`,kind:"preset",label:e.label,thumbnail:e.thumbnail||"",design:e.design,enabled:!0,isDefault:!1,isSystem:!1,isLocal:!0}]}));const{data:t,error:n}=await Rt.rpc("create_internal_profile_look_preset",{p_label:e.label,p_thumbnail:e.thumbnail||"",p_design:e.design});if(n)throw br(n,"Failed to create that template.");return t}async function v_e(e){if(ac)return O_(r=>({...r,order:e}));const{data:t,error:n}=await Rt.rpc("reorder_internal_profile_look_presets",{p_ids:e});if(n)throw br(n,"Failed to reorder presets.");return t}async function w_e(e,t=""){try{const n=await Se.post("/internal/profile-presets/import",{profile:e,label:t});return L_(n.data)}catch(n){throw br(n,"Failed to import that profile look.")}}async function j_e(e){if(ac&&e.startsWith(Y4))return O_(r=>({...r,templates:r.templates.filter(a=>a.id!==e),order:r.order.filter(a=>a!==e)}));const{data:t,error:n}=await Rt.rpc("delete_internal_profile_look_preset",{p_id:e});if(n)throw br(n,"Failed to delete that preset.");return L_(t)}async function K4(e){const t=[...new Set((e||[]).filter(Boolean))];if(!t.length)return{};const{data:n,error:r}=await Rt.rpc("get_internal_creator_subscriptions",{p_user_ids:t});if(r)throw br(r,"Failed to load subscriptions.");return n||{}}async function __e({userIds:e,action:t,plan:n=null,endsAt:r=null}){const{data:a,error:i}=await Rt.rpc("update_internal_creator_subscriptions",{p_user_ids:e,p_action:t,p_plan:n,p_ends_at:r});if(i)throw br(i,"Failed to update subscriptions.");return a}async function VY({userId:e,days:t=30}={}){const{data:n,error:r}=await Rt.rpc("get_internal_user_usage",{p_user_id:String(e||"").trim(),p_days:t});if(r)throw br(r,"Failed to load usage insights.");return n}const pD="flex min-h-[44px] w-full items-center justify-center gap-2.5 rounded-pill px-[18px] py-2.5 text-sm font-semibold transition-colors duration-base ease-standard focus-visible:outline-none focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-60";function GY({size:e=19}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",className:"shrink-0","aria-hidden":"true",children:[s.jsx("path",{d:"M17.64 9.2c0-.637-.057-1.251-.164-1.84H9v3.481h4.844c-.209 1.125-.843 2.078-1.796 2.717v2.258h2.908c1.702-1.567 2.684-3.874 2.684-6.615z",fill:"#4285F4"}),s.jsx("path",{d:"M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.836.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.331A8.997 8.997 0 0 0 9 18z",fill:"#34A853"}),s.jsx("path",{d:"M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05"}),s.jsx("path",{d:"M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z",fill:"#EA4335"})]})}
56function YY({onGoogle:e,onX:t,pending:n=null}){const r=!!n;return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("button",{type:"button",onClick:e,disabled:r,"aria-busy":n==="Google",className:`${pD} border border-rule bg-white text-ink hover:border-ink-light`,children:[s.jsx(GY,{}),"Continue with Google"]}),s.jsxs("button",{type:"button",onClick:t,disabled:r,"aria-busy":n==="X",className:`${pD} border border-ink bg-ink text-paper hover:border-ink-soft hover:bg-ink-soft`,children:[s.jsx("span",{className:"invert",children:s.jsx(g0,{size:17})}),"Continue with X"]})]})}function ec(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function k_e(e){const t=[{label:"At least 8 characters",met:e.length>=8},{label:"One uppercase letter (A-Z)",met:/[A-Z]/.test(e)},{label:"One lowercase letter (a-z)",met:/[a-z]/.test(e)},{label:"One number (0-9)",met:/\d/.test(e)}];return{isValid:t.every(n=>n.met),requirements:t}}function KY(e){return!e||e.trim().length<2?"Name must be at least 2 characters.":e.trim().length>100?"Name must be less than 100 characters.":/^[\p{L}\p{M}\p{N}\s.,&'â-]+$/u.test(e.trim())?null:"Name contains characters we cannot use."}function mD({accessError:e="",onAttempt:t}){const{googleLogin:n,login:r}=Ut(),[a,i]=f.useState(""),[o,l]=f.useState(""),[c,u]=f.useState(!1),[d,h]=f.useState(""),[p,m]=f.useState(""),[g,x]=f.useState(!1),[b,y]=f.useState(!1),v=async()=>{h(""),m(""),t?.();try{sessionStorage.setItem("postAuthRedirect",Me.INTERNAL)}catch{h("Google sign-in requires browser storage. Enable it and try again."),m("form");return}y(!0);try{await n()}catch(E){h(E.message||"Google sign-in failed."),m("form"),y(!1)}},w=async E=>{if(E.preventDefault(),h(""),m(""),t?.(),!ec(a)){h("Enter a valid team email address."),m("email");return}if(!o){h("Enter your password."),m("password");return}x(!0);try{await r(a,o)}catch(S){h(S.response?.data?.detail?.message||"Invalid email or password."),m("form")}finally{x(!1)}},j=d||e;return s.jsxs("div",{className:"internal-login",children:[s.jsx(vs,{title:"Internal sign in | Great Experts",path:Me.INTERNAL,noIndex:!0}),s.jsx("a",{className:"internal-skip-link",href:"#internal-sign-in",children:"Skip to sign in"}),s.jsxs("div",{className:"internal-login__frame",children:[s.jsxs("header",{className:"internal-login__topbar",children:[s.jsx(Le,{to:Me.HOME,"aria-label":"Great Experts home",children:s.jsx(bn,{variant:"flat",height:40})}),s.jsxs(Le,{to:Me.HOME,className:"internal-login__back",children:[s.jsx(ja,{"aria-hidden":"true"}),"Back to Great Experts"]})]}),s.jsxs("main",{className:"internal-login__content",id:"internal-sign-in",children:[s.jsxs("section",{className:"internal-login__story","aria-labelledby":"internal-login-title",children:[s.jsx("span",{className:"internal-login__scope",children:"Staff only"}),s.jsxs("h1",{className:"internal-login__title",id:"internal-login-title",children:[s.jsx("strong",{className:"internal-login__title-brand",children:"Great Experts"}),s.jsx("span",{className:"internal-login__title-team",children:"Team"})]}),s.jsx("p",{className:"internal-login__lede",children:"Monitor platform activity, member profiles, subscriptions, and the operational signals behind Great Experts."}),s.jsxs("p",{className:"internal-login__trust",children:[s.jsx(Vh,{"aria-hidden":"true"}),"Access is restricted to active team accounts with internal permission."]})]}),s.jsx("section",{className:"internal-login__panel","aria-labelledby":"internal-form-title",children:s.jsxs("div",{className:"internal-login__panel-inner",children:[s.jsx("h2",{id:"internal-form-title",children:"Sign in"}),s.jsx("p",{className:"internal-login__panel-copy",children:"Use your Great Experts team account."}),s.jsxs("div",{className:"internal-login__auth-options",children:[s.jsxs("button",{type:"button",className:"internal-login__google",onClick:v,disabled:g||b,"aria-busy":b,children:[b?s.jsx(vt,{className:"internal-login__spinner","aria-hidden":"true"}):s.jsx(GY,{}),b?"Redirecting to Googleâ¦":"Sign in with Google"]}),s.jsx("div",{className:"internal-login__divider",role:"separator",children:s.jsx("span",{children:"Or sign in with email"})}),s.jsxs("form",{onSubmit:w,className:"internal-login__form",noValidate:!0,children:[j&&s.jsxs("p",{className:"internal-form-error",id:"internal-login-error",role:"alert",children:[s.jsx(Co,{"aria-hidden":"true"}),s.jsx("span",{children:j})]}),s.jsxs("div",{className:"internal-field",children:[s.jsx("label",{className:"internal-field__label",htmlFor:"internal-email",children:"Team email"}),s.jsx("span",{className:"internal-field__control",children:s.jsx("input",{id:"internal-email",type:"email",placeholder:"[email protected]",value:a,onChange:E=>i(E.target.value),autoComplete:"email",autoFocus:!0,"aria-invalid":p==="email","aria-describedby":j?"internal-login-error":void 0})})]}),s.jsxs("div",{className:"internal-field",children:[s.jsx("label",{className:"internal-field__label",htmlFor:"internal-password",children:"Password"}),s.jsxs("span",{className:"internal-field__control",children:[s.jsx("input",{id:"internal-password",type:c?"text":"password",placeholder:"Enter your password",value:o,onChange:E=>l(E.target.value),autoComplete:"current-password","aria-invalid":p==="password","aria-describedby":j?"internal-login-error":void 0}),s.jsx("button",{type:"button",className:"internal-field__reveal",onClick:()=>u(E=>!E),"aria-label":c?"Hide password":"Show password",children:c?s.jsx(vb,{"aria-hidden":"true"}):s.jsx(Sh,{"aria-hidden":"true"})})]})]}),s.jsxs("button",{type:"submit",className:"internal-login__submit",disabled:g||b,children:[g&&s.jsx(vt,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),g?"Signing inâ¦":"Sign in"]})]})]}),s.jsx("p",{className:"internal-login__support",children:"Need access? Contact a platform administrator."})]})})]})]})]})}async function N_e({checkAccess:e}){try{return await e()===!0}catch{return!1}}const E_e="This account could not be verified as an active internal team member.";function S_e(){const{user:e,isAuthenticated:t,isLoading:n}=Ut(),[r,a]=f.useState(null),[i,o]=f.useState(null),l=e?.id||e?.email||null;return f.useEffect(()=>{if(!t||!l||r===l)return;let c=!0;return N_e({checkAccess:HY}).then(u=>{c&&(u?a(l):o(l))}),()=>{c=!1}},[t,l,r]),n?s.jsx(il,{fullPage:!0,text:"Loading Internalâ¦"}):t?e?.account_completed===!1?s.jsx(Pn,{to:"/complete-account",replace:!0}):r!==l?i===l?s.jsx(mD,{accessError:E_e}):s.jsx(il,{fullPage:!0,text:"Verifying internal accessâ¦"}):s.jsxs(s.Fragment,{children:[s.jsx(vs,{noIndex:!0}),s.jsx(vh,{})]}):s.jsx(mD,{})}function C_e(e){if(!e)return Promise.resolve(!1);const t=Bl(e,"settings");return t?Promise.resolve(!!t.featureEnabled):oh(e,"settings",P_,{join:!0}).then(n=>!!n?.featureEnabled).catch(()=>!1)}function XY(){const{user:e,isLoading:t}=Ut(),n=e?.id||null,[r,a]=f.useState({userId:void 0,allowed:null});return f.useEffect(()=>{if(t)return;let i=!1;return C_e(n).then(o=>{i||a({userId:n,allowed:o})}),()=>{i=!0}},[t,n]),r.userId===n?r.allowed:null}const T_e=5e3,A_e=3e4,ic=new Map,o1=new Map;function Bu(e){return String(e||"")}function JY(e,t){return`${Bu(e)}:${t||""}`}function QY(e){const t=String(e||"").trim();return!t||t==="New Chat"}
56function R_e(e,t,n){!e||!t||!n||QY(n)||o1.set(JY(e,t),{title:n,timestamp:Date.now()})}function I_e(e,t,n){if(!e||!t)return null;const r=JY(e,t),a=o1.get(r);return a?Date.now()-a.timestamp>A_e||!QY(n)?(o1.delete(r),null):a.title:null}function P_e(e,t){const n=t?.data?.conversations;return Array.isArray(n)?{...t,data:{...t.data,conversations:n.map(r=>{const a=I_e(e,r.id,r.title);return a?{...r,title:a}:r})}}:t}function Tx(e){const t=e?.data?.conversations;return Array.isArray(t)?{...e,data:{...e.data,conversations:t.map(n=>({...n}))}}:e}function $_(e,t){const n=Bu(e);if(!n)return;const r=P_e(e,t);ic.set(n,{payload:Tx(r),timestamp:Date.now(),promise:null})}function fD(e){const t=Bu(e);t&&ic.delete(t)}function L_e(e){const t=Bu(e),n=t?ic.get(t):null;return n?.payload?Tx(n.payload):null}function O_e(e,t){const n=Bu(e);if(!n||!t)return;const r=ic.get(n),a=r?.payload?.data?.conversations;if(!Array.isArray(a))return;const i=[t,...a.filter(o=>o.id!==t.id)];$_(e,{...r.payload,data:{...r.payload.data,conversations:i}})}function rA(e,t){const n=Bu(e);if(!n||!t)return;const r=ic.get(n),a=r?.payload?.data?.conversations;Array.isArray(a)&&$_(e,{...r.payload,data:{...r.payload.data,conversations:a.filter(i=>i.id!==t)}})}function M_e(e,t,n){const r=Bu(e);if(!r||!t)return;R_e(e,t,n);const a=ic.get(r),i=a?.payload?.data?.conversations;Array.isArray(i)&&$_(e,{...a.payload,data:{...a.payload.data,conversations:i.map(o=>o.id===t?{...o,title:n}:o)}})}function aA(e,t,n){M_e(e,t,n)}async function ZY(e,t){let n=null;try{n=await e.json()}catch{}const r=n?.detail||{},a=r.message||`${t} failed: ${e.status}`,i=new Error(a);return i.status=e.status,i.code=r.code||null,i.data=n,i}async function D_e(e,t,n=[],r=[],a=null){const i=await f0({"Content-Type":"application/json"}),o=await fetch(`${Hr}/experts/${e}/test/stream`,{method:"POST",headers:i,body:JSON.stringify({message:t,conversation_history:n,attachment_ids:r}),signal:a});if(!o.ok)throw await ZY(o,"Stream request");return o.body}let iA=null;function gD(e){iA=e||null}async function $_e(e,t,n=[],r=null,a=null,i=null,o={}){const l={message:t,conversation_id:r||null,parent_message_id:i||null,attachment_ids:n};iA&&(l.widget_key=iA),o.saasProfile&&(l.saas_profile=!0),typeof o.creatorSummaryConsent=="boolean"&&(l.creator_summary_consent=o.creatorSummaryConsent);const c=await f0({"Content-Type":"application/json"}),u=await fetch(`${Hr}/experts/${e}/chat/stream`,{method:"POST",headers:c,body:JSON.stringify(l),signal:a});if(!u.ok)throw await ZY(u,"Stream request");return u.body}async function Nb(e,t=null,n=null,{limit:r=50,before:a=null}={}){const i={limit:r};return t&&(i.conversation_id=t),a&&(i.before=a),(await Se.get(`/experts/${e}/chat/messages`,{params:i,signal:n})).data}async function F_(e,{force:t=!1}={}){const n=Bu(e),r=n?ic.get(n):null,a=r?.payload&&Date.now()-r.timestamp<T_e;if(!t&&a)return Tx(r.payload);if(!t&&r?.promise)return r.promise.then(Tx);const i=Se.get(`/experts/${e}/conversations`).then(o=>($_(e,o.data),o.data)).catch(o=>{throw n&&ic.delete(n),o});return n&&ic.set(n,{payload:r?.payload||null,timestamp:r?.timestamp||0,promise:i}),i.then(Tx)}async function X4(e){const t=await Se.post(`/experts/${e}/conversations`),n=t.data?.data?.conversation;return n&&O_e(e,n),t.data}async function F_e(e,t){const n=await Se.delete(`/experts/${e}/conversations/${t}`);return rA(e,t),n.data}const To=["business-chat","business-sources","business-contact","business-knowledge","business-voice","business-offerings","business-building","business-customize","business-congratulations"],eK="business-dashboard";function B_e(e=""){return!1}const v0="Hi! How can I help you today?",B_="Do you have a question?",J4="#4f46e5",U_e=/^#[0-9a-f]{6}$/i;function mc(e){return e==="inline"||e==="bubble"?e:""}function U_(e=""){return new URLSearchParams(typeof e=="string"?e:"").get("journey")==="business"}function Q4(e){const t=String(e||"").trim();if(!t)return"yourwebsite.com";try{return new URL(/^https?:\/\//i.test(t)?t:`https://${t}`).hostname.replace(/^www\./,"")}catch{return t}}function oA(e){const t=String(e||"").trim();
56return t?(Q4(t).split(".")[0]||"").split(/[-_]+/).filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" "):""}function Df(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=(r,a)=>typeof r=="string"?r.slice(0,a):"";return{color:U_e.test(t.color)?t.color.toLowerCase():J4,name:n(t.name,60),greeting:n(t.greeting,160),showAvatar:t.showAvatar!==!1,showTeaser:t.showTeaser===!0,teaserText:n(t.teaserText,80),showCallBadge:t.showCallBadge!==!1}}function tK(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=(n,r)=>typeof n=="string"?n.slice(0,r):"";return{expertId:t(e.expertId,80),keyId:t(e.keyId,120),domain:t(e.domain,253),serving:e.serving===!0,error:t(e.error,300)}}function z_e(e,t,n){const r=Df(e);return{mode:mc(t)||"bubble",bubble_color:r.color,show_avatar_on_bubble:!!n&&r.showAvatar,show_teaser:r.showTeaser,teaser_text:r.teaserText.trim()||B_,show_call_badge:r.showCallBadge}}const tl="/experts/new?from=app",oc=`${Me.CREATE_EXPERT}?start=welcome`,Eb=`${Me.CREATE_EXPERT}?start=platforms`,ol=`${Me.CREATE_EXPERT}?journey=business`,H_e=new Set(["welcome","platforms"]),q_e=new Set(["profile-knowledge","profile-voice","profile-identity","profile-offerings","profile-building","profile-ready","profile-plan"]),W_e=300*1e3;function sK(e){const t=new URLSearchParams(typeof e=="string"?e:""),n=t.get("start");return!!(t.get("draft")||t.get("connected")||t.get("connection")||H_e.has(n)||t.get("from")==="app"||U_(t.toString()))}function nK(e){return!e||e.kind==="journey"?ol:e.to}function V_e({search:e,hasJourney:t=!1,accountCreatedAt:n=null,now:r=Date.now()}){if(sK(e)||t)return!0;const a=new Date(n||"").getTime();return Number.isFinite(a)&&r-a<W_e}function xD({hasLiveExpert:e=!1,latestDraftId:t="",journey:n=null}={}){return e?{kind:"dashboard",to:Me.DASHBOARD}:t?{kind:"resume",to:`${Me.CREATE_EXPERT}?draft=${encodeURIComponent(t)}`}:n?.journey==="business"?{kind:"resume",to:ol}:q_e.has(n?.screen)||n?.screen==="templates"&&n?.templateCompleted===!0?{kind:"resume",to:tl}:n?.templateCompleted===!0?{kind:"resume",to:Eb}:{kind:"journey",to:oc}}function jc(){const e=f.useContext(VG);if(!e)throw new Error("useExperts must be used within an ExpertsProvider");const{dispatch:t,...n}=e,r=f.useCallback(async(l={})=>{t({type:"SET_LOADING"});try{const c=await Tw(l);return t({type:"SET_EXPERTS",payload:c.data.experts}),c.data.experts}catch(c){throw t({type:"SET_ERROR",payload:c.response?.data?.detail?.message||"Failed to fetch experts"}),c}},[t]),a=f.useCallback(async l=>{const c=await Kbe(l);return t({type:"ADD_EXPERT",payload:c.data.expert}),c.data.expert},[t]),i=f.useCallback(async(l,c)=>{const u=await a1(l,c);return t({type:"UPDATE_EXPERT",payload:u.data.expert}),u.data.expert},[t]),o=f.useCallback(async l=>{await T_(l),t({type:"DELETE_EXPERT",payload:l})},[t]);return{...n,fetchExperts:r,createExpert:a,updateExpert:i,deleteExpert:o}}function Z4(){try{if(globalThis.crypto?.randomUUID)return globalThis.crypto.randomUUID()}catch{}const e=Array.from({length:16},()=>Math.floor(Math.random()*256));e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=e.map(n=>n.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function eR(e,t={}){if(typeof window>"u")return null;const n=Z4();return window.dataLayer=window.dataLayer||[],window.dataLayer.push({event_id:n,ge_path:window.location?.pathname||"",...t,event:e}),bT?.capture(e,{event_id:n,...t}),n}function lh(e,t,n={}){if(typeof window>"u")return null;const r=`ge_tracked:${e}`;try{if(window.sessionStorage.getItem(r))return null;window.sessionStorage.setItem(r,"1")}catch{}return eR(t,n)}const bD="gx_profile_visitor_session",G_e=new Set(["profile","embed","platform","voice","unknown"]);function rK(e){return e?e():Z4()}function Y_e(e=globalThis.sessionStorage,t=Z4){try{const n=e.getItem(bD);if(n)return n;const r=t();return e.setItem(bD,r),r}catch{return t()}}function K_e({creatorId:e,sessionKey:t,uuid:n}={}){const r=rK(n);return!r||!e||!t?null:{eventId:r,eventType:"profile_view",sessionKey:t,creatorId:e,surface:"profile"}}function aK({creatorId:e,expertId:t,messageId:n,elementRef:r,title:a,surface:i,sessionKey:o,uuid:l}={}){if(!r||!G_e.has(i)||(n||i==="voice"?!t:!e))return null;const c=rK(l);return c?{eventId:c,eventType:"element_click",...o?{sessionKey:o}:{},...e?{creatorId:e}:{},...t?{expertId:t}:{},...n?{messageId:n}:{},elementRef:r,...a?{title:a}:{},surface:i}:null}function X_e(e,{apiBaseUrl:t,fetchImpl:n=globalThis.fetch}={}){if(!e||!t||typeof n!="function")return;const r=`${t}/leads/public/interactions`,a={method:"POST",headers:{"Content-Type":"application/json"},keepalive:!0,body:JSON.stringify(e)};return(async()=>{for(let i=0;i<2;i+=1)try{if((await n(r,a))?.ok)return!0}catch{}return!1})()}const J_e=500;async function Q_e(e){const t=[];let n=0;for(;;){const r=await e({limit:J_e,offset:n});if(t.push(...Array.isArray(r?.requests)?r.requests:[]),!r?.hasMore)return{...r,requests:t};const a=Number(r.nextOffset);if(!Number.isSafeInteger(a)||a<=n)throw new Error("Invalid contact request pagination cursor.");n=a}}async function $r(){return(await Se.get("/leads/settings")).data.data}async function Xl({enabled:e,config:t}){return(await Se.put("/leads/settings",{enabled:e,config:t})).data.data}const mm={"X-Offering-Review-Version":"2"},NN=["queued","reading","extracting"];async function Sb(e){return(await Se.post(`/leads/offering-imports/${encodeURIComponent(e)}/stop`)).data.data}async function Z_e(e){for(let t=0;;t++)try{return(await Se.post("/leads/offering-prices",{url:e},{headers:mm,timeout:6e4})).data.data}catch(n){const r=Number(n.response?.headers?.["retry-after"]);if(t>=2||n.response?.status!==429||!Number.isFinite(r)||r<0||r>60)throw n;await new Promise(a=>setTimeout(a,r*1e3+100))}}async function eke(e){try{return{product:(await Se.post("/leads/product-preview",{url:e},{timeout:25e3})).data.data,reason:""}}catch(t){if(t.response?.status===404)return{product:null,reason:"no-product"};if(t.response?.status===502)return{product:null,reason:"blocked"};throw t}}async function iK(e,{jobId:t,requestKey:n=crypto.randomUUID(),force:r=!1,onProgress:a,signal:i}={}){const o=Array.isArray(e)?e:[e];let l;const c=async()=>
56{if(i?.aborted)throw!i.reason?.stopRequested&&l&&NN.includes(l.status)&&await Sb(l.id),new DOMException("Import cancelled","AbortError")};if(t){try{l=(await Se.get(`/leads/offering-imports/${encodeURIComponent(t)}`,{headers:mm})).data.data}catch(h){if(h.response?.status!==404)throw h;n=crypto.randomUUID()}await c(),r&&(l&&NN.includes(l.status)&&await Sb(t),l=null)}await c(),l||(l=(await Se.post("/leads/offering-imports",{urls:o,requestKey:n},{headers:mm})).data.data),await c(),o.some(h=>!l.sources.includes(h))&&(l=(await Se.post(`/leads/offering-imports/${encodeURIComponent(l.id)}/sources`,{urls:o},{headers:mm})).data.data);const u=()=>({kind:l.rows.length?"products":"none",products:l.rows.filter(h=>h.section==="product"),services:l.rows.filter(h=>h.section==="service"),import:l});let d=0;for(;;){if(await c(),a?.(u()),!NN.includes(l.status))return u();await new Promise(h=>setTimeout(h,Math.min(1500+d++*100,4e3))),await c(),l=(await Se.get(`/leads/offering-imports/${encodeURIComponent(l.id)}`,{headers:mm})).data.data}}async function oK(e,t){const n=[...e.products.map(a=>({...a,section:"product"})),...e.services.map(a=>({...a,section:"service"}))],r={kind:e.kind,products:[],services:[]};for(let a=0;a<n.length;a+=10){const i=n.slice(a,a+10),o=await Se.post("/leads/offering-images",{kind:e.kind,products:i.filter(l=>l.section==="product"),services:i.filter(l=>l.section==="service")},{timeout:3e4,headers:mm});r.products.push(...o.data.data.products),r.services.push(...o.data.data.services),t?.(Math.min(a+10,n.length),n.length)}return r}async function tR(e={}){return(await Se.get("/leads/requests",{params:e})).data.data}function tke(e={}){return Q_e(t=>tR({...e,...t}))}async function ske(e){return(await Se.get(`/leads/requests/${e}`)).data.data}async function nke({expertId:e,limit:t=100,offset:n=0}={}){return(await Se.get("/leads/conversations",{params:{expertId:e||void 0,limit:t,offset:n}})).data.data}async function lK(e){return(await Se.get(`/leads/conversations/${e}`)).data.data}async function rke(){const e=[];let t=0,n=0;do{const r=await nke({limit:500,offset:t});if(e.push(...r.conversations||[]),n=r.total||e.length,!r.hasMore||r.nextOffset==null)break;t=r.nextOffset}while(t<n);return{conversations:e,total:n}}async function ake(e,t){return(await Se.patch(`/leads/requests/${e}`,t)).data.data}async function ike(e,t){return(await Se.post(`/leads/requests/${e}/activity`,{t})).data.data}const oke=["1d","7d","30d","all"];async function lke(e="30d",t=null){const n=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return(await Se.get("/leads/insights",{params:{tz:n,period:oke.includes(e)?e:"30d",...t?{expertId:t}:{}}})).data.data}async function cke(){return(await Se.get("/leads/insights/topics")).data.data}async function cK(e){return(await Se.get(`/leads/public/experts/${e}/lead-config`)).data.data}async function uke(e,t){return(await Se.post(`/leads/public/experts/${e}/contact-requests`,t)).data.data}async function yD(e){return(await Se.get(`/leads/public/creators/${e}/lead-config`)).data.data}async function uK(e,t){return(await Se.post(`/leads/public/creators/${e}/contact-requests`,t)).data.data}function sR(e){X_e(e,{apiBaseUrl:Hr})}const dK="ge_business_account:",hK={isBusiness:!1,expertId:""},lA=new Set;let Zp=null;function vD(e){try{const t=localStorage.getItem(dK+e);return t?JSON.parse(t):null}catch{return null}}function dke(e,t){try{localStorage.setItem(dK+e,JSON.stringify(t))}catch{}}function pK(e,t){dke(e,t),lA.forEach(n=>n(e,t))}function hke(e){const t=e&&typeof e=="object"?e:{};return t.accountType!=="business"?hK:{isBusiness:!0,expertId:typeof t.businessExpertId=="string"?t.businessExpertId:""}}function pke(e){if(Zp?.userId!==e){const t=$r().then(n=>{const r=hke(n?.config);return pK(e,r),r});Zp={userId:e,promise:t},t.catch(()=>{Zp?.promise===t&&(Zp=null)})}return Zp.promise}async function mke(e,t){await Xl({config:{accountType:"business",businessExpertId:t}});const n={isBusiness:!0,expertId:t};Zp={userId:e,promise:Promise.resolve(n)},pK(e,n)}function z_(){const{user:e}=Ut(),t=e?.id||"",[n,r]=f.useState(null);f.useEffect(()=>{if(!t)return;let i=!0;const o=(l,c)=>{i&&l===t&&r({userId:t,value:c})};return lA.add(o),pke(t).then(l=>o(t,l)).catch(()=>{i&&!vD(t)&&r({userId:t,value:hK})}),()=>{i=!1,lA.delete(o)}},[t]);const a=t?n?.userId===t?n.value:vD(t):null;return{loaded:!!a,isBusiness:!!a?.isBusiness,expertId:a?.expertId||""}}function Jm(e){return Number(e?.document_count||0)}function fke(e,t=""){const n=t.trim().toLowerCase();return n?e.filter(r=>r.name?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)||r.tagline?.toLowerCase().includes(n)):e}function gke(e){if(!e)return"Recently";const t=new Date(e);return Number.isNaN(t.getTime())?"Recently":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(t)}const cA=new Set;
56function Uc(){cA.forEach(e=>e())}function mK({enabled:e=!0,includeEmpty:t=!1}={}){const[n,r]=f.useState([]),[a,i]=f.useState(!!e),[o,l]=f.useState(!1),[c,u]=f.useState(""),d=f.useCallback(async()=>{if(!e)return[];i(!0),u("");try{const m=((await Tw({status:"draft",sort:"updated_at",order:"desc"})).data?.experts||[]).filter(g=>t||Jm(g)>0);return r(m),m}catch{return u("Could not load drafts."),[]}finally{i(!1),l(!0)}},[e,t]);f.useEffect(()=>{if(!e){i(!1);return}d();const p=()=>{d()};return cA.add(p),()=>{cA.delete(p)}},[e,d]);const h=f.useCallback(p=>{r(m=>m.filter(g=>g.id!==p)),Uc()},[]);return{draftExperts:n,isDraftsLoading:a,hasLoadedDrafts:o,draftsError:c,refreshDraftExperts:d,removeDraftExpert:h}}function gt({className:e=""}){return s.jsx("div",{"aria-hidden":"true",className:`ge-skeleton rounded-md ${e}`})}const xke=!1,bke=!1,yke=[{to:Me.LAB,label:"My Lab",icon:AY,publicTo:"/login",exact:!1},{to:"/explore/experts",label:"Explore",icon:aY},{to:Me.CREATORS,label:"Creators",icon:e=>s.jsx(E1e,{...e,style:{transform:"scaleX(-1)"}})}],vke="text-[11px] font-medium uppercase tracking-[0.2em] text-ink-mid",fK="group flex items-center gap-[13px] px-3 min-h-[44px] lg:min-h-[40px] rounded-[14px] text-[13.5px] whitespace-nowrap transition-[background-color,color,transform,padding,column-gap] duration-[340ms] ease-standard",gK=`${fK} font-medium text-ink-mid hover:text-ink hover:translate-x-[7px]`,xK=`${fK} font-semibold bg-indigo/10 text-indigo`,l1="shrink-0 transition-transform duration-[340ms] ease-standard group-hover:-translate-y-[3px] group-hover:-rotate-45";function wke({rail:e,children:t}){return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:`${vke} px-3 mt-3 mb-1 ${e?"lg:hidden":""}`,children:t}),e&&s.jsx("span",{"aria-hidden":"true",className:"hidden lg:block mx-2.5 my-2 h-px bg-ink/[0.08]"})]})}function aa({to:e,label:t,icon:n,end:r=!0,rail:a=!1,onClose:i,extraClassName:o=""}){return s.jsxs(Ll,{to:e,end:r,onClick:i,title:a?t:void 0,"aria-label":a?t:void 0,className:({isActive:l})=>`${l?xK:gK} ${a?"lg:px-[10px] lg:gap-0 lg:hover:translate-x-0":""} ${o}`,children:[s.jsx(n,{className:`w-[19px] h-[19px] ${l1}`}),s.jsx("span",{className:`truncate flex-1 ${a?"lg:hidden":""}`,children:t})]})}const wD=15e3,jke=3e4,_ke=100,kke=8;function EN(e){const t=String(e||"").trim();return!t||t==="New Chat"}function Nke({titleWidth:e="w-14"}){return s.jsxs("div",{"aria-hidden":"true",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 mb-2",children:[s.jsx(gt,{className:`h-3 ${e}`}),s.jsx(gt,{className:"h-6 w-6"})]}),s.jsx("div",{className:"space-y-1",children:[0,1,2].map(t=>s.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2",children:[s.jsx(gt,{className:"h-6 w-6 rounded-full"}),s.jsx(gt,{className:`h-3 ${t===1?"w-28":"w-36"}`})]},t))})]})}function Eke(){return s.jsxs("div",{className:"flex items-center gap-3 px-3 py-2","aria-hidden":"true",children:[s.jsx(gt,{className:"h-9 w-9 rounded-full"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx(gt,{className:"h-3 w-28"}),s.jsx(gt,{className:"h-2 w-16"})]}),s.jsx(gt,{className:"h-8 w-8"})]})}function Ske({isOpen:e,onClose:t,mode:n="expanded",onToggleDesktop:r,overlay:a=!1}){const i=a||n==="rail",[o,l]=f.useState(!1),[c,u]=f.useState(!1),d=f.useRef(!1),h=f.useRef(null),p=f.useRef(!1),m=f.useRef(null),g=i&&!o,x=i&&o,b=a&&!x,y=b&&c,{logout:v,user:w,balance:j,isLoading:E}=Ut(),S=XY(),_=!E&&!!w;j?.answers;const{experts:k,isLoading:C,hasLoaded:N}=jc(),{draftExperts:A,hasLoadedDrafts:T,refreshDraftExperts:I}=mK({enabled:_,includeEmpty:!0}),{recentExperts:$}=A4(),O=an(),U=Ps(),F=f.useMemo(()=>k.filter(pe=>pe.status==="active"),[k]),H=f.useMemo(()=>F.filter(pe=>!pe.is_public).length,[F]),G=F.length>0,M=A.length>0,z=f.useMemo(()=>A.filter(pe=>Jm(pe)>0).length,[A]),W=A[0]?.id,D=!G&&M,Z=D?`${Me.CREATE_EXPERT}?draft=${encodeURIComponent(W)}`:tl,V=D?"Continue Creating":"Create my AI Expert",L=_&&(C&&!N||!G&&!T),K=z_(),te=K.isBusiness?F.find(pe=>pe.id===K.expertId)||F[0]:null,Q=f.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),Y=f.useCallback(pe=>{Q(),d.current=pe,l(pe)},[Q]),J=f.useCallback(pe=>{Q(),h.current=setTimeout(()=>{h.current=null,d.current=pe,l(pe)}
56,_ke)},[Q]),P=f.useCallback(pe=>{if(!(!i||pe.pointerType!=="mouse")){if(a){if(d.current){Q();return}J(!0);return}l(!0)}},[i,a,Q,J]),ee=f.useCallback(pe=>{!i||pe?.target?.closest?.("[data-no-peek-zone]")||Y(!0)},[i,Y]),X=f.useCallback(pe=>{if(!i||pe.pointerType!=="mouse"||p.current)return;const Ne=m.current?.querySelector("[data-no-peek-zone]")?.getBoundingClientRect();if(!d.current&&Ne&&pe.clientY>=Ne.top-kke){Q();return}if(a){if(!d.current&&h.current)return;P(pe);return}Y(!0)},[i,a,Q,P,Y]),ae=f.useCallback(()=>{if(a){if(!d.current){Q();return}J(!1);return}Y(!1)},[a,Q,J,Y]),me=f.useCallback(pe=>{a&&pe.clientX<pe.currentTarget.getBoundingClientRect().right||(p.current=!1,ae())},[a,ae]),q=f.useCallback(()=>{p.current=!0,Y(!1)},[Y]),he=f.useCallback(()=>{q(),t?.()},[q,t]),se=f.useCallback(()=>{if(a){p.current=d.current,Y(!d.current);return}if(x){q();return}r?.()},[a,x,r,Y,q]);f.useEffect(()=>{d.current=o},[o]),f.useEffect(()=>()=>Q(),[Q]),f.useEffect(()=>{a||q()},[a,q]),f.useEffect(()=>{const pe=window.matchMedia("(min-width: 1024px)"),Ne=()=>u(pe.matches);return Ne(),pe.addEventListener("change",Ne),()=>pe.removeEventListener("change",Ne)},[]);const[le,ke]=f.useState(!0),oe=new URLSearchParams(O.search).get("filter"),Oe=O.pathname.startsWith(Me.LAB),Je=f.useMemo(()=>Object.fromEntries(k.map(pe=>[pe.id,pe])),[k]),Ie=f.useMemo(()=>{const pe=new Map,Ne=Ue=>{Ue?.id&&(pe.set(Ue.id,Ue.id),Ue.slug&&pe.set(Ue.slug,Ue.id))};return k.forEach(Ne),$.forEach(Ne),pe},[k,$]),ue=f.useCallback(pe=>{if(!pe)return null;const Ne=Ie.get(pe);return Ne||(pe.startsWith("exp_")?pe:null)},[Ie]),[be,Re]=f.useState(!1),[Ge,it]=f.useState(!1),[ut,$t]=f.useState({}),[tt,He]=f.useState({}),[wt,St]=f.useState({}),Zt=f.useRef({}),Jt=f.useRef({}),$e=f.useRef({}),Qe=f.useRef({}),ct=f.useRef({}),ve=f.useCallback((pe,Ne,Ue)=>{!pe||!Ne||!Ue||(Qe.current[pe]||(Qe.current[pe]={}),Qe.current[pe][Ne]={title:Ue,timestamp:Date.now()})},[]),Ye=f.useCallback((pe,Ne)=>{!pe||!Ne||(ct.current[pe]||(ct.current[pe]={}),ct.current[pe][Ne]=Date.now(),delete Qe.current[pe]?.[Ne])},[]),rt=f.useCallback((pe,Ne,Ue=Date.now())=>{const dt=ct.current[pe]?.[Ne];return dt?Ue-dt>jke?(delete ct.current[pe][Ne],Object.keys(ct.current[pe]).length===0&&delete ct.current[pe],!1):!0:!1},[]),De=f.useCallback((pe,Ne,Ue=[])=>{const dt=Qe.current[pe]||{},Xe=Date.now(),xt=new Map(Ue.map(_t=>[_t.id,_t])),et=new Set,st=(Ne||[]).flatMap(_t=>{if(rt(pe,_t.id,Xe))return[];et.add(_t.id);const zt=dt[_t.id],us=xt.get(_t.id);return EN(_t.title)&&us&&!EN(us.title)?[{..._t,title:us.title}]:zt?Xe-zt.timestamp>wD?(delete dt[_t.id],[_t]):EN(_t.title)?[{..._t,title:zt.title}]:(delete dt[_t.id],[_t]):[_t]});return Object.entries(dt).forEach(([_t,zt])=>{if(et.has(_t)||rt(pe,_t,Xe))return;if(Xe-zt.timestamp>wD){delete dt[_t];return}const us=xt.get(_t);us&&st.unshift({...us,title:zt.title})}),Object.keys(dt).length===0&&delete Qe.current[pe],st},[rt]),qe=f.useCallback((pe,Ne)=>{!pe||!Ne||(Ye(pe,Ne),St(Ue=>{const dt=Ue[pe]||[];return{...Ue,[pe]:dt.filter(Xe=>Xe.id!==Ne)}}))},[Ye]),ye=f.useCallback((pe,Ne,Ue)=>{!pe||!Ne||!Ue||(ve(pe,Ne,Ue),St(dt=>{const Xe=dt[pe]||[],xt=new Date().toISOString(),et=Xe.find(zt=>zt.id===Ne),st={...et||{id:Ne,created_at:xt,updated_at:xt},title:Ue,updated_at:et?.updated_at||xt},_t=et?Xe.map(zt=>zt.id===Ne?st:zt):[st,...Xe];return{...dt,[pe]:_t}}))},[ve]),Ze=f.useCallback(async function pe(Ne,{force:Ue=!1}={}){if(!Ne)return;if(Jt.current[Ne])return $e.current[Ne]={force:Ue||!!$e.current[Ne]?.force},Jt.current[Ne];const dt=(async()=>{try{const Xe=await F_(Ne,{force:Ue});St(xt=>({...xt,[Ne]:De(Ne,Xe.data.conversations||[],xt[Ne]||[])})),Zt.current[Ne]=Date.now()}catch{St(Xe=>({...Xe,[Ne]:Xe[Ne]??[]}))}finally{Jt.current[Ne]=null;const Xe=$e.current[Ne];Xe&&($e.current[Ne]=null,pe(Ne,Xe))}})();return Jt.current[Ne]=dt,dt},[De]);f.useCallback(async pe=>{const Ne=ut[pe];$t(Ue=>({...Ue,[pe]:!Ne})),Ne?He(Ue=>({...Ue,[pe]:!0})):(He(Ue=>({...Ue,[pe]:!1})),await Ze(pe))},[ut,Ze]),f.useEffect(()=>{const pe=O.pathname.match(/^\/experts\/([^/]+)\/chat/);if(pe){const Ne=ue(pe[1]);if(!Ne)return;
56const Ue=O.pathname.match(/^\/experts\/[^/]+\/chat\/([^/]+)$/),dt=Ue?Ue[1]:null;$t(et=>!et[Ne]&&!tt[Ne]?{...et,[Ne]:!0}:et);const Xe=Zt.current[Ne]||0;(!wt[Ne]||dt||Date.now()-Xe>5e3)&&Ze(Ne)}},[O.pathname,ue]),f.useEffect(()=>{const pe=O.pathname.match(/^\/experts\/([^/]+)\/chat/),Ne=pe?ue(pe[1]):null;$t(Ue=>Ne?Object.keys(Ue).some(Xe=>Xe!==Ne&&Ue[Xe])?Ue[Ne]?{[Ne]:!0}:{}:Ue:Object.keys(Ue).length===0?Ue:{})},[O.pathname,ue]),f.useEffect(()=>{const pe=Ne=>{const Ue=Ne?.detail||{},dt=ue(Ue.expertId)||Ue.expertId,Xe=new Set;dt&&Ue.conversationId&&Ue.title&&ye(dt,Ue.conversationId,Ue.title),dt&&Ue.deletedConversationId&&qe(dt,Ue.deletedConversationId);const xt=(et,st={})=>{!et||Xe.has(et)||(Xe.add(et),Ze(et,st))};if(dt)(!(Ue.conversationId&&Ue.title||Ue.deletedConversationId)||Ue.force)&&xt(dt,{force:!!Ue.force});else{Object.keys(ut).forEach(st=>{ut[st]&&xt(st,{force:!!Ue.force})});const et=O.pathname.match(/^\/experts\/([^/]+)\/chat/);if(et){const st=ue(et[1]);if(!st)return;xt(st,{force:!!Ue.force})}}};return window.addEventListener("gs:refresh-expert-conversations",pe),()=>window.removeEventListener("gs:refresh-expert-conversations",pe)},[ut,O.pathname,Ze,ue,ye,qe]),f.useEffect(()=>{const pe=()=>{$t(Ne=>({...Ne})),I()};return window.addEventListener("gs:refresh-experts",pe),()=>window.removeEventListener("gs:refresh-experts",pe)},[I]);const jt=$.filter(pe=>{const Ne=Je[pe.id];return!(Ne&&Ne.status!=="active")}).map(pe=>({...pe,slug:Je[pe.id]?.slug||pe.slug,name:Je[pe.id]?.name||pe.name,avatar_url:Je[pe.id]?.avatar_url||pe.avatar_url}));be||jt.slice(0,3);const Nt=a?"lg:w-[226px]":g?"lg:w-[56px]":"lg:w-[226px]",ne=a?x?"ge-nav-glass":"":g?"ge-nav-glass ge-nav-glass-rail":"ge-nav-glass",ge=a?"lg:absolute lg:z-30":"lg:relative lg:z-20",xe=a?x?"lg:translate-x-0":"lg:-translate-x-[calc(100%+24px)]":"lg:translate-x-0";return s.jsxs(s.Fragment,{children:[e&&s.jsx("div",{className:"fixed inset-0 bg-ink/40 z-30 lg:hidden",onClick:he}),a&&s.jsx("div",{className:`hidden lg:block fixed inset-0 z-[25] bg-ink/20 backdrop-blur-[6px] transition-opacity duration-[400ms] ease-standard motion-reduce:transition-none ${x?"opacity-100":"opacity-0 pointer-events-none"}`,onClick:pe=>{const Ne=m.current?.getBoundingClientRect().right;Ne!=null&&pe.clientX<Ne||q()},"aria-hidden":"true"}),a&&s.jsx("div",{className:"hidden lg:block fixed left-0 top-0 bottom-0 z-[31] w-10",onPointerEnter:P,onPointerLeave:me,children:s.jsx("button",{type:"button",onClick:se,onFocus:ee,className:`absolute left-2 top-1/2 -translate-y-1/2 flex w-[26px] h-[26px] items-center justify-center rounded-full border border-indigo/30 bg-paper/95 text-indigo shadow-[0_10px_22px_-12px_rgba(60,50,120,0.7)] backdrop-blur-[14px] hover:bg-indigo-wash ${x?"opacity-0 pointer-events-none":"opacity-100"}`,"aria-label":"Open sidebar",title:"Open sidebar",tabIndex:x?-1:0,children:s.jsx(hn,{className:"w-3.5 h-3.5"})})}),s.jsxs("aside",{ref:m,onPointerOver:X,onPointerLeave:me,onFocus:ee,onBlur:ae,className:`bg-cream-deep w-64 flex-shrink-0 fixed top-0 left-0 h-full z-40 overflow-hidden transition-[transform,width,margin] duration-200 ease-standard lg:duration-[400ms] lg:overflow-visible lg:bg-transparent lg:my-[14px] lg:ml-[14px] lg:h-[calc(100%-28px)] ${ge} ${ne} ${Nt} ${xe} ${b?"lg:border-0 lg:shadow-none":""} ${e?"translate-x-0":"-translate-x-full"}`,children:[!a&&s.jsx("button",{onClick:se,className:"hidden lg:flex absolute top-1/2 -translate-y-1/2 -right-[13px] z-30 w-[26px] h-[26px] items-center justify-center rounded-full border border-indigo/30 bg-paper/95 text-indigo shadow-[0_10px_22px_-12px_rgba(60,50,120,0.7)] backdrop-blur-[14px] transition-colors hover:bg-indigo-wash","aria-label":g?"Expand sidebar":"Collapse sidebar",title:g?"Expand sidebar":"Collapse sidebar",children:s.jsx(hn,{className:`w-3.5 h-3.5 transition-transform duration-200 ${g?"":"rotate-180"}`})}),s.jsxs("div",{inert:y?!0:void 0,"aria-hidden":y||void 0,className:`flex flex-col h-full gap-1.5 px-3 pt-6 pb-3 lg:pt-3.5 transition-[padding] duration-200 ease-standard lg:duration-[340ms] ${g?"lg:px-2":""} ${b?"lg:invisible lg:pointer-events-none lg:overflow-hidden":""}`,children:[s.jsxs("div",{className:`flex items-center justify-between flex-shrink-0 h-11 overflow-hidden ${g?"lg:justify-center":""}`,children:[s.jsx(Ll,{to:Me.DASHBOARD,onClick:he,className:"flex items-center px-1","aria-label":"Great Experts home",children:s.jsx(bn,{variant:g?"markFlat":"flat",height:g?26:30})}),s.jsx("button",{onClick:he,className:"flex lg:hidden w-9 h-9 items-center justify-center rounded-md text-ink-light hover:text-ink-mid hover:bg-cream-tint transition-colors","aria-label":"Close sidebar",children:s.jsx(Pw,{className:"w-[17px] h-[17px]"})})]}),s.jsx(aa,{to:_?Me.DASHBOARD:"/",label:_?"Dashboard":"Home",icon:dY,rail:g,onClose:he,extraClassName:"flex-shrink-0"}),s.jsxs("div",{className:"flex-1 min-h-0 flex flex-col gap-0.5 overflow-y-auto overflow-x-hidden no-scrollbar",children:[_?L?s.jsx("div",{className:g?"lg:hidden":void 0,children:s.jsx(Nke,{titleWidth:"w-16"})}):K.isBusiness?s.jsxs(s.Fragment,{children:[s.jsx(aa,{to:"/dashboard/embed",label:"Customize embed",icon:rY,rail:g,onClose:he}
56),te&&s.jsx(aa,{to:`/experts/${te.slug||te.id}/edit`,label:"Edit my expert",icon:Ms,rail:g,onClose:he}),s.jsx(aa,{to:"/dashboard/inventory",label:"Inventory",icon:jb,rail:g,onClose:he}),s.jsx(aa,{to:Me.LEADS,label:"Leads & Insights",icon:yb,rail:g,onClose:he}),s.jsx(aa,{to:Me.PROFILE,label:"Account",icon:ZM,rail:g,onClose:he}),s.jsx(aa,{to:"/myaccount/subscriptions",label:"Subscription Plan",icon:kb,rail:g,onClose:he})]}):s.jsxs(s.Fragment,{children:[G&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center",children:[s.jsxs(Ll,{to:`${Me.LAB}/experts`,onClick:he,title:g?"My AI Experts":void 0,"aria-label":g?"My AI Experts":void 0,className:`flex-1 min-w-0 ${Oe&&!oe?xK:gK} ${g?"lg:px-[10px] lg:gap-0 lg:hover:translate-x-0":""}`,children:[s.jsx(Ms,{className:`w-[19px] h-[19px] ${l1}`}),s.jsx("span",{className:`truncate flex-1 ${g?"lg:hidden":""}`,children:"My AI Experts"})]}),(z>0||H>0)&&s.jsx("button",{onClick:()=>ke(pe=>!pe),"aria-expanded":le,"aria-label":le?"Collapse My AI Experts submenu":"Expand My AI Experts submenu",className:`w-6 h-6 flex items-center justify-center shrink-0 rounded-md text-ink-light hover:text-ink-mid hover:bg-cream-tint transition-colors ${g?"lg:hidden":""}`,children:le?s.jsx(Is,{className:"w-3 h-3"}):s.jsx(hn,{className:"w-3 h-3"})})]}),le&&(z>0||H>0)&&s.jsxs("div",{className:`ml-5 pl-2 border-l border-rule space-y-0.5 ${g?"lg:hidden":""}`,children:[z>0&&s.jsxs(Ll,{to:`${Me.LAB}/experts?filter=draft`,onClick:he,className:`flex items-center gap-2 px-2 py-1.5 rounded-lg text-xs transition-colors ${Oe&&oe==="draft"?"bg-indigo/10 text-indigo font-medium":"text-ink-mid hover:text-ink hover:bg-cream-tint"}`,children:[s.jsx(mwe,{className:"w-3.5 h-3.5 shrink-0"}),s.jsx("span",{className:"truncate flex-1",children:"Drafts"}),s.jsx("span",{className:"shrink-0 rounded-pill bg-peach-tint px-1.5 py-0.5 text-[10px] font-semibold text-peach-deep",children:z})]}),H>0&&s.jsxs(Ll,{to:`${Me.LAB}/experts?filter=private`,onClick:he,className:`flex items-center gap-2 px-2 py-1.5 rounded-lg text-xs transition-colors ${Oe&&oe==="private"?"bg-indigo/10 text-indigo font-medium":"text-ink-mid hover:text-ink hover:bg-cream-tint"}`,children:[s.jsx(Zi,{className:"w-3.5 h-3.5 shrink-0"}),s.jsx("span",{className:"truncate flex-1",children:"Private experts"}),s.jsx("span",{className:"shrink-0 rounded-pill bg-indigo-wash px-1.5 py-0.5 text-[10px] font-semibold text-indigo-deep",children:H})]})]}),s.jsx(aa,{to:Me.PUBLIC_PAGE,label:"Edit my Profile",icon:Ci,rail:g,onClose:he}),s.jsx(aa,{to:Me.LEADS,label:"Insights & Leads",icon:yb,rail:g,onClose:he}),S&&s.jsx(aa,{to:Me.LIVE_CHAT,label:"Live chat",icon:ni,rail:g,onClose:he}),s.jsx(aa,{to:"/dashboard/creator",label:"Earnings",icon:Rw,rail:g,onClose:he})]}),!G&&s.jsx(aa,{to:"/myaccount/subscriptions",label:"Subscribed Experts",icon:$4,rail:g,onClose:he}),s.jsx(aa,{to:Me.PROFILE,label:"Account",icon:ZM,rail:g,onClose:he}),!G&&s.jsxs("div",{className:`flex-none flex flex-col mt-3.5 pt-3 border-t border-ink/[0.08] ${g?"lg:hidden":""}`,children:[s.jsx("p",{className:"px-3 mb-1 font-heading text-sm tracking-[-0.018em] text-ink",children:"Want a profile of your own?"}),s.jsxs(Ll,{to:Z,onClick:he,className:"group flex items-center gap-[11px] min-h-[44px] lg:min-h-[40px] px-3 rounded-[14px] bg-indigo/10 text-[13.5px] font-semibold text-indigo transition-transform duration-[340ms] ease-standard hover:translate-x-[7px]",children:[D?s.jsx(H1e,{className:`w-[15px] h-[15px] ${l1}`}):s.jsx(Es,{className:`w-[15px] h-[15px] ${l1}`}),s.jsx("span",{className:"flex-1 min-w-0 truncate",children:V})]})]}),G&&s.jsx(aa,{to:"/myaccount/subscriptions",label:"Subscription Plan",icon:kb,rail:g,onClose:he})]}):s.jsxs(s.Fragment,{children:[s.jsx(wke,{rail:g,children:"Menu"}),yke.map(pe=>s.jsx(aa,{to:!E&&!_&&pe.publicTo?pe.publicTo:pe.to,end:pe.exact!==!1,label:pe.label,icon:pe.icon,rail:g,onClose:he},pe.to)),s.jsx(aa,{to:"/dashboard/creator",label:"Earnings",icon:Rw,rail:g,onClose:he})]}),xke]}),bke,s.jsx("span",{"aria-hidden":"true",className:"flex-none h-px mx-1.5 mt-1.5 bg-ink/[0.07]"}),s.jsxs("div",{className:"flex-none pt-1.5","data-no-peek-zone":!0,children:[E?s.jsx(Eke,{}):_?s.jsxs("div",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-2xl border border-white/90 bg-white/70 shadow-[0_12px_26px_-20px_rgba(60,50,12
560,0.6)] ${g?"lg:flex-col lg:gap-2 lg:p-0 lg:border-0 lg:bg-transparent lg:shadow-none":""}`,children:[s.jsxs("button",{onClick:()=>{U(Me.PROFILE),he()},title:w?.full_name||"My details",className:`flex items-center gap-2.5 flex-1 min-w-0 hover:opacity-80 transition-opacity ${g?"lg:flex-none lg:w-full lg:justify-center":""}`,children:[s.jsx(ws,{name:w?.full_name,size:"sm",src:w?.avatar_url}),s.jsx("span",{className:`flex-1 min-w-0 text-left text-[13px] leading-[1.3] font-semibold text-ink-mid truncate ${g?"lg:hidden":""}`,children:w?.full_name||"User"})]}),s.jsx("button",{onClick:()=>{U(Me.HOME),he(),v()},className:"w-9 h-9 flex items-center justify-center shrink-0 rounded-xl border border-white/90 bg-white/70 text-ink-soft hover:text-destructive hover:border-destructive/40 transition-colors",title:"Sign out","aria-label":"Sign out",children:s.jsx(L4,{className:"w-[17px] h-[17px]"})})]}):s.jsxs("div",{className:`space-y-2 ${g?"lg:hidden":""}`,children:[s.jsxs(Ll,{to:Me.CREATE_EXPERT,onClick:he,className:"inline-flex items-center justify-center gap-1.5 w-full px-4 py-2.5 rounded-[14px] text-[13px] font-semibold whitespace-nowrap bg-ink text-cream hover:bg-ink-mid transition-colors",children:["Create your expert",s.jsx("span",{"aria-hidden":"true",children:"â"})]}),s.jsx(Ll,{to:"/login",onClick:he,className:"inline-flex items-center justify-center w-full px-4 py-2.5 rounded-[14px] text-[13px] font-medium whitespace-nowrap border border-white/90 bg-white/70 text-ink hover:border-ink-light transition-colors",children:"Log in"})]}),g&&!E&&!_&&s.jsx(Ll,{to:"/login",className:"hidden lg:flex w-9 h-9 mx-auto items-center justify-center rounded-xl border border-white/90 bg-white/70 text-ink-mid hover:text-indigo-deep hover:border-indigo-soft transition-colors",title:"Log in","aria-label":"Log in",children:s.jsx(fY,{className:"w-4 h-4"})})]})]})]})]})}const Qm="https://calendly.com/anna-greatspire/strategy-call",gr={home:"/",builder:"/experts/new",creators:"/forcreators",wellness:"/forpractitioners",why:"/whyus",pricing:"/pricing",login:"/login",signup:"/experts/new",earnings:"/dashboard/creator",terms:"/terms",privacy:"/privacy",saas:"#your-website",business:"/forbusiness"},Cke=9,Tke=[{n:"01",title:"Answers, day and night",detail:"Someone asks at 2am, right after your new post. Your Profile answers the way you would, without waiting for you to wake up.",points:[{icon:"clock",label:"Available around the clock"},{icon:"mic",label:"Can speak in your cloned voice, if you want"},{icon:"phone",label:"By chat or by call"}]},{n:"02",title:"Recommends your offers",detail:"Nobody needs to read through your whole offer to find the right thing.",points:[{icon:"target",label:"Finds the fit, sends them straight there"},{icon:"bag",label:"Your products, sessions, masterclasses and courses"},{icon:"link",label:"Affiliate links included, for extra income"}]},{n:"03",title:"Captures every lead",detail:"Real interest becomes a name and an email, ready for you to follow up.",points:[{icon:"inbox",label:"Straight to your inbox"},{icon:"check",label:"Tracked: new, contacted, booked"},{icon:"download",label:"Easy exports to CSV"}]},{n:"04",title:"Turns questions into ideas",detail:"You stop guessing what to make next. A summary of what people keep asking shows you what your audience wants.",points:[{icon:"layers",label:"Grouped by topic"},{icon:"chart",label:"Counted, never guessed"},{icon:"calendar",label:"Shows the busiest hours and days"}]},{n:"05",title:"Speaks your audience's language",detail:"Someone writes in Spanish, and the answer comes back in Spanish. Same tone, same expertise.",points:[{icon:"languages",label:"Detects the language, whichever it is"},{icon:"reply",label:"Replies in the same one"},{icon:"mic",label:"Sounds like you in all of them"}]},{n:"06",title:"Never invents an answer",detail:"It answers from what you gave it, and nothing else.",points:[{icon:"upload",label:"Only your material: social media, PDFs, calls and more"},{icon:"shield",label:"Nothing pulled from the internet"},{icon:"help",label:"Says when it does not know"}]}],Ake=[{n:"01",title:"Connect your socials, add your files",text:"Nothing new to write. It learns from what you already published.",sources:["linkedin","instagram","facebook","tiktok","youtube"]},{n:"02",title:"Pick the voice and the style",text:"Clone your own voice from a short recording, or pick a ready one."},{n:"03",title:"Add your sessions and products",text:"Ebooks, courses, retreats, consulting, your own shop. Everything you sell, in one place it can recommend from."},{n:"04",title:"Share your link",text:"One link for Instagram, TikTok, YouTube and email. It works everywhere."}],Tm=[{id:"free",name:"Free",blurb:"Try it with what you have.",rowBlurb:"Everything you need to try it, with what you already have.",monthly:"$0",annual:"$0",period:"",features:["Fully customised profile with your AI Expert","One AI Expert","500 answers, lifetime","15 min of voice, 10 contacts"],cta:"Get started"},{id:"lite",name:"Lite",blurb:"When your page starts working.",monthly:"$9.99",annual:"$8.29",period:"/month",features:["Everything in Free","500 answers a month","60 min of voice a month","100 contacts","Embed on your site"],cta:"Get started"},{id:"starter",name:"Starter",blurb:"For selling sessions and products.",monthly:"$19.99",annual:"$16.59",period:"/month",features:["Everything in Lite","Two AI Experts","1200 answers, 200 voice min","500 contacts, 3 languages","Embed on your site"],cta:"Get started",featured:!0,badge:"Recommended"},{id:"pro",name:"Pro",blurb:"For a full brand presence.",monthly:"$59.99",annual:"$49.99",period:"/month",features:["Everything in Starter","Four AI Experts, cloned voice","3000 answers, 700 voice min","2000 contacts, no badge","Embed on your site"],cta:"Get started"},{id:"enterprise",name:"Enterprise",blurb:"For agencies and team
56s.",rowBlurb:"Team seats, dedicated support, and custom contracts.",monthly:"Custom",annual:"Custom",period:"",note:"Tailored to your team",features:["Everything in Pro","Unlimited Experts","Unlimited chat and contacts","API, SSO, dedicated manager"],cta:"Get in touch",contact:!0}],Rke={columns:["Plan","Free","Lite","Starter","Pro","Enterprise"],rows:[["Price","$0","$9.99/mo","$19.99/mo","$59.99/mo","Talk to us"],["Annual","â","$99.48/yr","$199.08/yr","$599.88/yr","â"],["Commission","0%","0%","0%","0%","0%"],["Voice","15 min to start","60 min/mo","200 min/mo","700 min/mo","Custom"],["Max per call","3 min","5 min","15 min","30 min","Unlimited"],["Top up anytime","â","$0.25/min","$0.22/min","$0.20/min","Custom"],["Text chat","500 lifetime","500/mo","1200/mo","3000/mo","Unlimited"],["Contacts (leads)","10","100","500","2000","Unlimited"],["Experts","1","1","2","4","Unlimited"],["Profile and appearance","Full","Full","Full","Full","Full"],["Knowledge import","All sources","All sources","All sources","All sources","All sources + API"],["Analytics","Coming soon","Coming soon","Coming soon","Coming soon","Coming soon"],['"Powered by" badge',"Yes","Yes","Yes","Off","Off"],["Support","Email + Expert","Email + Expert","Email + Expert","Email + Expert, 24h","Dedicated manager"],["Call languages","1","1","3","20","Full support"]]},Ike=[{n:"01",q:"How is this different from a standard link in bio?",a:"A link in bio is a list of links. This is one page with everything you have, and an AI Expert that answers questions based only on your knowledge. It recommends the right product, session or course, and shares the details."},{n:"02",q:"What if I have no materials yet?",a:"You do not need to write anything new. Connect your socials and it learns from what you have already published. You can add files, links or notes later, whenever you want."},{n:"03",q:"Is my cloned voice protected?",a:"Yes. Your cloned voice works only on your own profile and only through your AI Expert. Nobody else can use it, and you can delete it at any time."},{n:"04",q:"How does it help me sell?",a:"People tell your AI Expert what they are dealing with, and it recommends the option that actually fits, with the link to it. Your booking calendar, your shop, your course, your ebook, wherever it already lives. Everything sits in one place, so nothing gets lost."},{n:"05",q:"Where do I put the link?",a:"In your bio on Instagram, TikTok, YouTube or LinkedIn. In your newsletter, in your email signature, or straight into a DM when someone asks what you do."}],Pke=[{n:"01",q:"What happens when I reach my account plan limit?",a:"Your profile stays online and everything on it keeps working. Your AI Expert pauses until the next month, or until you top up or upgrade."},{n:"02",q:"Can I change plans later?",a:"Yes, up or down, at any time. Changes apply from your next billing date."},{n:"03",q:"What is the free plan for?",a:"Building your profile and seeing what your audience actually asks. One AI Expert, 500 answers, 15 minutes of voice, no card required."},{n:"04",q:"Do you take any commission on what I sell?",a:"No. Some link in bio tools take a cut of what you sell. We think everything you earn belongs to you, so we take 0% on every plan."},{n:"05",q:"Can I cancel?",a:"Yes, any time. You keep access to all your features until the end of your billing cycle."}],Lke=[{label:"For your website",to:gr.saas,anchor:!0},{label:"Pricing",to:gr.pricing},{label:"Why us",to:gr.why},{label:"For Creators",to:gr.creators},{label:"Wellness",to:gr.wellness}],jD="block rounded-lg px-3.5 py-3 text-[15px] font-medium text-ink-soft transition-colors active:bg-indigo-wash active:text-indigo";function Oke(){const{user:e}=Ut(),[t,n]=f.useState(!1),r=()=>n(!1);return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-expanded":t,"aria-label":t?"Close menu":"Open menu",onClick:()=>n(a=>!a),className:"ml-2 flex h-9 w-9 items-center justify-center rounded-md border border-rule bg-paper text-ink shadow-subtle transition-colors active:bg-cream-deep",children:t?s.jsx(as,{className:"h-[19px] w-[19px] text-indigo",strokeWidth:2,"aria-hidden":"true"}):s.jsx(xl,{className:"h-[19px] w-[19px]",strokeWidth:2,"aria-hidden":"true"})}),t&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 z-40",onClick:r,"aria-hidden":"true"}),s.jsxs("nav",{"aria-label":"Audience navigation",className:"absolute right-3 top-full z-50 mt-1 w-64 roun
56ded-2xl border border-rule bg-paper p-2 shadow-overlay",children:[Lke.map(a=>a.anchor?s.jsx("a",{href:a.to,className:jD,onClick:r,children:a.label},a.label):s.jsx(Le,{to:a.to,className:jD,onClick:r,children:a.label},a.label)),e?s.jsx("div",{className:"mt-2 flex flex-col gap-2 border-t border-rule pt-2",children:s.jsx(Le,{to:"/dashboard",onClick:r,className:"block rounded-pill bg-indigo px-4 py-3 text-center text-sm font-semibold text-cream transition-colors active:bg-indigo-deep",children:"Dashboard"})}):s.jsxs("div",{className:"mt-2 flex flex-col gap-2 border-t border-rule pt-2",children:[s.jsx(Le,{to:"/experts/new",onClick:r,className:"block rounded-pill bg-indigo px-4 py-3 text-center text-sm font-semibold text-cream transition-colors active:bg-indigo-deep",children:"Register"}),s.jsx(Le,{to:gr.login,onClick:r,className:"block rounded-pill border border-rule bg-paper px-4 py-[11px] text-center text-sm font-semibold text-ink transition-colors active:bg-cream-deep",children:"Log in"})]})]})]})]})}const Mke=[];function Dke({onMenuClick:e,scrolled:t=!1}){const{user:n,isLoading:r}=Ut(),a=an(),i=Mke.some(x=>a.pathname===x),{searchQuery:o,dispatch:l}=f.useContext(Zs),[c,u]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{const x=b=>{(b.metaKey||b.ctrlKey)&&b.key==="k"&&(b.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]);const h=()=>{l({type:"SET_SEARCH",payload:""}),d.current?.focus()},p=a.pathname===Me.HOME,m=PY.includes(a.pathname)?"hidden":"lg:hidden",g=p?t?"bg-paper/70 backdrop-blur-md border-b border-rule/60":"bg-transparent":"bg-paper/40 backdrop-blur-md";return s.jsxs("header",{className:`${m} h-14 relative z-10 flex items-center justify-between px-4 flex-shrink-0 transition-colors duration-200 ${g}`,children:[s.jsx(Le,{to:Me.HOME,className:`${m} pointer-events-auto ${p?"relative":"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}`,"aria-label":"Great Experts home",children:s.jsx(bn,{height:40})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e&&a.pathname!==Me.HOME&&s.jsx("button",{onClick:e,className:`w-9 h-9 flex items-center justify-center rounded-md text-ink-muted hover:bg-cream-deep transition-colors ${m}`,children:s.jsx(Pw,{className:"w-[18px] h-[18px]"})}),i&&s.jsxs("div",{className:`relative hidden sm:block max-w-md flex-1 transition-all duration-200 ${c?"max-w-lg":""}`,children:[s.jsx(Fa,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 transition-colors ${c?"text-indigo":"text-ink-light"}`}),s.jsx("input",{ref:d,type:"text",placeholder:"Search expertsâ¦",value:o,onChange:x=>l({type:"SET_SEARCH",payload:x.target.value}),onFocus:()=>u(!0),onBlur:()=>u(!1),className:"w-full pl-9 pr-16 py-2 text-sm rounded-md border border-rule bg-paper text-ink placeholder-ink-muted focus:outline-none focus:shadow-focus focus:border-indigo transition-all"}),o?s.jsx("button",{onClick:h,className:"absolute right-2 top-1/2 -translate-y-1/2 w-6 h-6 flex items-center justify-center rounded-md text-ink-light hover:text-ink-mid hover:bg-cream-deep transition-colors",children:s.jsx(as,{className:"w-3.5 h-3.5"})}):s.jsx("kbd",{className:"absolute right-2.5 top-1/2 -translate-y-1/2 hidden md:inline-flex items-center gap-0.5 px-1.5 py-0.5 font-mono text-[10px] font-medium uppercase tracking-eyebrow text-ink-muted bg-cream-deep rounded-sm border border-rule",children:"âK"})]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[a.pathname===Me.HOME&&s.jsx("div",{className:"sm:hidden",children:s.jsx(Oke,{})}),r?s.jsx(gt,{className:`ml-2 h-9 w-20 ${a.pathname===Me.HOME?"hidden sm:block":""}`}):n?s.jsxs(Le,{to:Me.PROFILE,className:`items-center gap-2 ml-2 text-ink-mid hover:text-ink transition-colors ${a.pathname===Me.HOME?"hidden sm:flex":"flex"}`,children:[s.jsx(F4,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline text-sm font-medium",children:"Account"})]}):s.jsx("div",{className:"flex items-center gap-2 ml-2",children:s.jsx(Le,{to:Me.CREATE_EXPERT,className:`w-20 text-center py-2 rounded-md text-sm font-medium bg-indigo text-cream hover:bg-indigo-deep transition-colors ${a.pathname===Me.HOME?"hidden sm:block":""}`,children:"Register"})})]})]})}const bK=RY,yK=e=>String(e?.username||"").trim()||String(e?.slug||"").trim();function Th(e){const t=yK(e);return t?`/${t}
56`:`/creators/${e?.id??""}`}function ll(e){return`${typeof window<"u"?window.location.origin:bK}${Th(e)}`}function qd(e){return`/creators/${e?.id||yK(e)||""}`}function H_(e){return`${(typeof window<"u"?window.location.origin:bK).replace(/^https?:\/\//,"")}${Th(e)}`}const Dw=460,uA=844;function $ke({slot:e,creator:t,containerRef:n,nonce:r=0}){const[a,i]=f.useState(null);if(f.useEffect(()=>{const c=n?.current;if(!e||!c)return;const u=()=>{const h=c.getBoundingClientRect(),p=e.getBoundingClientRect();i({left:p.left-h.left+c.scrollLeft,top:p.top-h.top+c.scrollTop,width:p.width,height:p.height})};u();const d=new ResizeObserver(u);return d.observe(e),d.observe(c),e.offsetParent?.parentElement&&d.observe(e.offsetParent.parentElement),window.addEventListener("resize",u),()=>{d.disconnect(),window.removeEventListener("resize",u)}},[e,n]),!t?.id)return null;const o=!e||!a,l=a?Math.max(a.width/Dw,a.height/uA):1;return s.jsx("div",{"aria-hidden":o?"true":void 0,className:`absolute overflow-hidden rounded-[1.5rem] bg-cream ${o?"invisible pointer-events-none":""}`,style:o?{left:0,top:0,width:1,height:1}:a,children:s.jsx("iframe",{src:`${qd(t)}?preview=1&device=mobile${r?`&v=${r}`:""}`,title:"My public page",className:"border-0 origin-top-left rounded-[inherit]",style:{width:Dw,height:uA,transform:`scale(${l})`}})})}async function q_(){const{data:e,error:t}=await Rt.rpc("get_my_profile").single();if(t)throw new Error(t.message);return{status:"success",data:{user:e}}}const SN={EMAIL_EXISTS:"This email is already in use.",SLUG_TAKEN:"This username is already taken.",SLUG_RESERVED:"This username is reserved.",SLUG_INVALID:"Use 3 to 40 characters: lowercase letters, numbers and hyphens."};async function ch(e){const{data:t,error:n}=await Rt.rpc("update_my_profile",{p_full_name:e.full_name??null,p_email:e.email??null,p_bio:e.bio??null,p_website:e.website??null,p_contact:e.contact??null,p_username:e.username??e.slug??null,p_phone:e.phone??null}).single();if(n){const r=n.message||"",a=Object.keys(SN).find(i=>r.includes(i))||(n.code==="23505"?"EMAIL_EXISTS":null);if(a){const i=new Error(SN[a]);throw i.response={status:a==="EMAIL_EXISTS"||a==="SLUG_TAKEN"?409:422,data:{detail:{code:a,message:SN[a]}}},i}throw new Error(r)}return{status:"success",data:{user:t}}}async function Fke({immediate:e=!1}={}){return(await Se.delete("/users/me",{params:{immediate:e}})).data}async function Bke(){return(await Se.get("/users/me/deletion-preview")).data}async function Uke(){return(await Se.post("/users/me/restore")).data}async function nR(e){return(await Se.get("/users/check-username",{params:{username:e}})).data}async function zke(e,{preset:t=!1}={}){const n=new FormData;return n.append("file",e),t&&n.append("preset","true"),(await Se.post("/users/avatar",n,{headers:{"Content-Type":"multipart/form-data"}})).data}async function Hke(e){const t=new FormData;return t.append("file",e),(await Se.post("/users/banner",t,{headers:{"Content-Type":"multipart/form-data"}})).data}async function qke(){return(await Se.delete("/users/banner")).data}async function Wke(e){const t=new FormData;return t.append("file",e),(await Se.post("/users/page-logo",t,{headers:{"Content-Type":"multipart/form-data"}})).data}async function Vke(){return(await Se.delete("/users/page-logo")).data}async function Gke(e){const t=new FormData;return t.append("file",e),(await Se.post("/users/page-photo",t,{headers:{"Content-Type":"multipart/form-data"}})).data}async function Yke(){return(await Se.delete("/users/page-photo")).data}async function Kke(e){const t=new FormData;return t.append("file",e),(await Se.post("/users/page-bg",t,{headers:{"Content-Type":"multipart/form-data"}})).data}async function rR(e){const t=new FormData;return t.append("file",e),(await Se.post("/users/page-product-image",t,{headers:{"Content-Type":"multipart/form-data"}})).data}async function aR(e){return rR(e)}async function Xke(e){return(await Se.get("/users/video-thumbnail",{params:{url:e}})).data}async function Jke(){return(await Se.delete("/users/page-bg")).data}async function Qke(e){const t=new FormData;return t.append("file",e),(await Se.post("/users/page-ground",t,{headers:{"Content-Type":"multipart/form-data"}})).data}async function Zke(){return(await Se.delete("/users/page-ground")).data}function e2e(){const{user:e,updateUser:t,logout:n}=Ut(),{addToast:r}=f.useContext(Zs),a=Ps(),[i,o]=f.useState(!1),[l,c]=f.useState("");
56if(!e?.deletion_requested_at)return null;const u=async()=>{o(!0),c("");try{await Uke(),t({...e,deletion_requested_at:null}),r("Welcome back. Your account has been restored.","success")}catch(d){c(d.response?.data?.detail?.message||"We could not restore your account. Contact support.")}finally{o(!1)}};return s.jsx("div",{className:"fixed inset-0 z-[100] grid place-items-center bg-cream p-4",children:s.jsxs("div",{className:"w-full max-w-md rounded-lg border border-rule bg-paper p-6 text-ink shadow-xl sm:p-8",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-md bg-destructive/10",children:s.jsx(Qs,{className:"h-5 w-5 text-destructive","aria-hidden":"true"})}),s.jsx("h1",{className:"font-heading text-2xl font-medium tracking-[-0.018em] text-ink",children:"Account scheduled for deletion"})]}),s.jsxs("p",{className:"mt-5 text-sm leading-relaxed text-ink-mid",children:["You asked us to delete this account on ",s.jsx("strong",{className:"text-ink",children:Cx(e.deletion_requested_at)}),". Everything will be permanently removed once the recovery window ends. If this was a mistake, you can restore your account now. Restored experts stay unpublished until you republish them."]}),l&&s.jsx("div",{className:"mt-4 rounded-md border border-destructive/30 bg-cream-deep p-3",role:"alert",children:s.jsx("p",{className:"text-sm text-destructive",children:l})}),s.jsxs("div",{className:"mt-6 flex flex-col-reverse gap-3 sm:flex-row",children:[s.jsx("button",{type:"button",disabled:i,onClick:async()=>{await n(),a("/")},className:"inline-flex h-11 flex-1 items-center justify-center whitespace-nowrap rounded-pill border border-rule bg-paper px-4 text-sm font-medium text-ink transition-colors duration-fast ease-standard hover:border-ink-light hover:bg-cream-deep focus-visible:outline-none focus-visible:shadow-focus disabled:opacity-55",children:"Keep deletion, sign out"}),s.jsx("button",{type:"button",onClick:u,disabled:i,className:"inline-flex h-11 flex-1 items-center justify-center whitespace-nowrap rounded-pill border border-indigo bg-indigo px-4 text-sm font-medium text-cream transition-colors duration-fast ease-standard hover:border-indigo-deep hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-55",children:i?"Restoringâ¦":"Restore my account"})]})]})})}const iR=f.createContext({});function Gh(e){const t=f.useRef(null);return t.current===null&&(t.current=e()),t.current}const t2e=typeof window<"u",oR=t2e?f.useLayoutEffect:f.useEffect,W_=f.createContext(null);function lR(e,t){e.indexOf(t)===-1&&e.push(t)}function $w(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}function s2e([...e],t,n){const r=t<0?e.length+t:t;if(r>=0&&r<e.length){const a=n<0?e.length+n:n,[i]=e.splice(t,1);e.splice(a,0,i)}return e}const cl=(e,t,n)=>n>t?t:n<e?e:n;let cR=()=>{};const Nu={},vK=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function wK(e){return typeof e=="object"&&e!==null}const jK=e=>/^0[^.\s]+$/u.test(e);function _K(e){let t;return()=>(t===void 0&&(t=e()),t)}const Qi=e=>e,n2e=(e,t)=>n=>t(e(n)),w0=(...e)=>e.reduce(n2e),Cb=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class uR{constructor(){this.subscriptions=[]}add(t){return lR(this.subscriptions,t),()=>$w(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 i=0;i<a;i++){const o=this.subscriptions[i];o&&o(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ni=e=>e*1e3,Gi=e=>e/1e3;function kK(e,t){return t?e*(1e3/t):0}const NK=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,r2e=1e-7,a2e=12;function i2e(e,t,n,r,a){let i,o,l=0;do o=t+(n-t)/2,i=NK(o,r,a)-e,i>0?n=o:t=o;while(Math.abs(i)>r2e&&++l<a2e);return o}function j0(e,t,n,r){if(e===t&&n===r)return Qi;const a=i=>i2e(i,0,1,e,n);return i=>i===0||i===1?i:NK(a(i),t,r)}const EK=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,SK=e=>t=>1-e(1-t),CK=j0(.33,1.53,.69,.99),dR=SK(CK),TK=EK(dR),AK=e=>e>=1?1:(e*=2)<1?.5*dR(e):.5*(2-Math.pow(2,-10*(e-1))),hR=e=>1-Math.sin(Math.acos(e)),RK=SK(hR),IK=EK(hR),o2e=j0(.42,0,1,1),l2e=j0(0,0,.58,1),PK=j0(.42,0,.58,1),c2e=e=>Array.isArray(e)&&typeof e[0]!="number",LK=e=>Array.isArray(e)&&typeof e[0]=="number",u2e={linear:Qi,easeIn:o2e,easeInOut:PK,easeOut:l2e,circIn:hR,circInOut:IK,circOut:RK,backIn:dR,backInOut:TK,backOut:CK,anticipate:AK},d2e=e=>typeof e=="string",_D=e=>{if(LK(e)){cR(e.length===4);const[t,n,r,a]=e;return j0(t,n,r,a)}else if(d2e(e))return u2e[e];return e},Iy=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function h2e(e,t){let n=new Set,r=new Set,a=!1,i=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(d){o.has(d)&&(u.schedule(d),e()),d(l)}const u={schedule:(d,h=!1,p=!1)=>{const g=p&&a?n:r;return h&&o.add(d),g.add(d),d},cancel:d=>
vendor: 70,639 bytes, line 56
56{r.delete(d),o.delete(d)},process:d=>{if(l=d,a){i=!0;return}a=!0;const h=n;n=r,r=h,n.forEach(c),n.clear(),a=!1,i&&(i=!1,u.process(d))}};return u}const p2e=40;function OK(e,t){let n=!1,r=!0;const a={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=Iy.reduce((w,j)=>(w[j]=h2e(i),w),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:h,preRender:p,render:m,postRender:g}=o,x=()=>{const w=Nu.useManualTiming,j=w?a.timestamp:performance.now();n=!1,w||(a.delta=r?1e3/60:Math.max(Math.min(j-a.timestamp,p2e),1)),a.timestamp=j,a.isProcessing=!0,l.process(a),c.process(a),u.process(a),d.process(a),h.process(a),p.process(a),m.process(a),g.process(a),a.isProcessing=!1,n&&t&&(r=!1,e(x))},b=()=>{n=!0,r=!0,a.isProcessing||e(x)};return{schedule:Iy.reduce((w,j)=>{const E=o[j];return w[j]=(S,_=!1,k=!1)=>(n||b(),E.schedule(S,_,k)),w},{}),cancel:w=>{for(let j=0;j<Iy.length;j++)o[Iy[j]].cancel(w)},state:a,steps:o}}const{schedule:pn,cancel:fc,state:Kr,steps:CN}=OK(typeof requestAnimationFrame<"u"?requestAnimationFrame:Qi,!0);let c1;function m2e(){c1=void 0}const Oa={now:()=>(c1===void 0&&Oa.set(Kr.isProcessing||Nu.useManualTiming?Kr.timestamp:performance.now()),c1),set:e=>{c1=e,queueMicrotask(m2e)}},MK=e=>t=>typeof t=="string"&&t.startsWith(e),DK=MK("--"),f2e=MK("var(--"),pR=e=>f2e(e)?g2e.test(e.split("/*")[0].trim()):!1,g2e=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function kD(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const $f={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Tb={...$f,transform:e=>cl(0,1,e)},Py={...$f,default:1},Ax=e=>Math.round(e*1e5)/1e5,mR=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function x2e(e){return e==null}const b2e=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,fR=(e,t)=>n=>!!(typeof n=="string"&&b2e.test(n)&&n.startsWith(e)||t&&!x2e(n)&&Object.prototype.hasOwnProperty.call(n,t)),$K=(e,t,n)=>r=>{if(typeof r!="string")return r;const[a,i,o,l]=r.match(mR);return{[e]:parseFloat(a),[t]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},y2e=e=>cl(0,255,e),TN={...$f,transform:e=>Math.round(y2e(e))},Wd={test:fR("rgb","red"),parse:$K("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+TN.transform(e)+", "+TN.transform(t)+", "+TN.transform(n)+", "+Ax(Tb.transform(r))+")"};function v2e(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 dA={test:fR("#"),parse:v2e,transform:Wd.transform},_0=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),zc=_0("deg"),sl=_0("%"),qt=_0("px"),w2e=_0("vh"),j2e=_0("vw"),ND={...sl,parse:e=>sl.parse(e)/100,transform:e=>sl.transform(e*100)},fm={test:fR("hsl","hue"),parse:$K("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+sl.transform(Ax(t))+", "+sl.transform(Ax(n))+", "+Ax(Tb.transform(r))+")"},mr={test:e=>Wd.test(e)||dA.test(e)||fm.test(e),parse:e=>Wd.test(e)?Wd.parse(e):fm.test(e)?fm.parse(e):dA.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Wd.transform(e):fm.transform(e),getAnimatableNone:e=>{const t=mr.parse(e);return t.alpha=0,mr.transform(t)}},_2e=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function k2e(e){return isNaN(e)&&typeof e=="string"&&(e.match(mR)?.length||0)+(e.match(_2e)?.length||0)>0}const FK="number",BK="color",N2e="var",E2e="var(",ED="${}",S2e=/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 Zm(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},a=[];let i=0;const l=t.replace(S2e,c=>(mr.test(c)?(r.color.push(i),a.push(BK),n.push(mr.parse(c))):c.startsWith(E2e)?(r.var.push(i),a.push(N2e),n.push(c)):(r.number.push(i),a.push(FK),n.push(parseFloat(c))),++i,ED)).split(ED);return{values:n,split:l,indexes:r,types:a}}function C2e(e){return Zm(e).values}function UK({split:e,types:t}){const n=e.length;return r=>{let a="";for(let i=0;i<n;i++)if(a+=e[i],r[i]!==void 0){const o=t[i];o===FK?a+=Ax(r[i]):o===BK?a+=mr.transform(r[i]):a+=r[i]}return a}}function T2e(e){return UK(Zm(e))}const A2e=e=>typeof e=="number"?0:mr.test(e)?mr.getAnimatableNone(e):e,R2e=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:A2e(e);function I2e(e){const t=Zm(e);return UK(t)(t.values.map((r,a)=>R2e(r,t.split[a])))}const _o={test:k2e,parse:C2e,createTransformer:T2e,getAnimatableNone:I2e};function AN(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function P2e({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let a=0,i=0,o=0;if(!t)a=i=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;a=AN(c,l,e+1/3),i=AN(c,l,e),o=AN(c,l,e-1/3)}return{red:Math.round(a*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Fw(e,t){return n=>n>0?t:e}const En=(e,t,n)=>e+(t-e)*n,RN=(e,t,n)=>{const r=e*e,a=n*(t*t-r)+r;return a<0?0:Math.sqrt(a)},L2e=[dA,Wd,fm],O2e=e=>L2e.find(t=>t.test(e));function SD(e){const t=O2e(e);if(!t)return!1;let n=t.parse(e);return t===fm&&(n=P2e(n)),n}const CD=(e,t)=>{const n=SD(e),r=SD(t);if(!n||!r)return Fw(e,t);const a={...n};return i=>(a.red=RN(n.red,r.red,i),a.green=RN(n.green,r.green,i),a.blue=RN(n.blue,r.blue,i),a.alpha=En(n.alpha,r.alpha,i),Wd.transform(a))},hA=new Set(["none","hidden"]);function M2e(e,t){return hA.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function D2e(e,t){return n=>En(e,t,n)}function gR(e){return typeof e=="number"?D2e:typeof e=="string"?pR(e)?Fw:mr.test(e)?CD:B2e:Array.isArray(e)?zK:typeof e=="object"?mr.test(e)?CD:$2e:Fw}function zK(e,t){const n=[...e],r=n.length,a=e.map((i,o)=>gR(i)(i,t[o]));return i=>{for(let o=0;o<r;o++)n[o]=a[o](i);return n}}function $2e(e,t){const n={...e,...t},r={};for(const a in n)e[a]!==void 0&&t[a]!==void 0&&(r[a]=gR(e[a])(e[a],t[a]));return a=>{for(const i in r)n[i]=r[i](a);return n}}function F2e(e,t){const n=[],r={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const i=t.types[a],o=e.indexes[i][r[i]],l=e.values[o]??0;n[a]=l,r[i]++}return n}const B2e=(e,t)=>{const n=_o.createTransformer(t),r=Zm(e),a=Zm(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?hA.has(e)&&!a.values.length||hA.has(t)&&!r.values.length?M2e(e,t):w0(zK(F2e(r,a),a.values),n):Fw(e,t)};function HK(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?En(e,t,n):gR(e)(e,t)}const U2e=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>pn.update(t,n),stop:()=>fc(t),now:()=>Kr.isProcessing?Kr.timestamp:Oa.now()}},qK=(e,t,n=10)=>{let r="";const a=Math.max(Math.round(t/n),2);for(let i=0;i<a;i++)r+=Math.round(e(i/(a-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Bw=2e4;function xR(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Bw;)t+=n,r=e.next(t);return t>=Bw?1/0:t}function z2e(e,t=100,n){const r=n({...e,keyframes:[0,t]}),a=Math.min(xR(r),Bw);return{type:"keyframes",ease:i=>r.next(a*i).value/t,duration:Gi(a)}}const Jn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function pA(e,t){return e*Math.sqrt(1-t*t)}const H2e=12;function q2e(e,t,n){let r=n;for(let a=1;a<H2e;a++)r=r-e(r)/t(r);return r}const IN=.001;function W2e({duration:e=Jn.duration,bounce:t=Jn.bounce,velocity:n=Jn.velocity,mass:r=Jn.mass}){let a,i,o=1-t;o=cl(Jn.minDamping,Jn.maxDamping,o),e=cl(Jn.minDuration,Jn.maxDuration,Gi(e)),o<1?(a=u=>{const d=u*o,h=d*e,p=d-n,m=pA(u,o),g=Math.exp(-h);return IN-p/m*g},i=u=>{const h=u*o*e,p=h*n+n,m=Math.pow(o,2)*Math.pow(u,2)*e,g=Math.exp(-h),x=pA(Math.pow(u,2),o);return(-a(u)+IN>0?-1:1)*((p-m)*g)/x}):(a=u=>{const d=Math.exp(-u*e),h=(u-n)*e+1;return-IN+d*h},i=u=>{const d=Math.exp(-u*e),h=(n-u)*(e*e);return d*h});const l=5/e,c=q2e(a,i,l);if(e=Ni(e),isNaN(c))return{stiffness:Jn.stiffness,damping:Jn.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const V2e=["duration","bounce"],G2e=["stiffness","damping","mass"];function TD(e,t){return t.some(n=>e[n]!==void 0)}function Y2e(e){let t={velocity:Jn.velocity,stiffness:Jn.stiffness,damping:Jn.damping,mass:Jn.mass,isResolvedFromDuration:!1,...e};if(!TD(e,G2e)&&TD(e,V2e))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),a=r*r,i=2*cl(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:Jn.mass,stiffness:a,damping:i}}else{const n=W2e({...e,velocity:0});t={...t,...n,mass:Jn.mass},t.isResolvedFromDuration=!0}return t}function Uw(e=Jn.visualDuration,t=Jn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:a}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:h,velocity:p,isResolvedFromDuration:m}=Y2e({...n,velocity:-Gi(n.velocity||0)}),g=p||0,x=u/(2*Math.sqrt(c*d)),b=o-i,y=Gi(Math.sqrt(c/d)),v=Math.abs(b)<5;r||(r=v?Jn.restSpeed.granular:Jn.restSpeed.default),a||(a=v?Jn.restDelta.granular:Jn.restDelta.default);let w,j,E,S,_,k;if(x<1)E=pA(y,x),S=(g+x*y*b)/E,w=N=>{const A=Math.exp(-x*y*N);return o-A*(S*Math.sin(E*N)+b*Math.cos(E*N))},_=x*y*S+b*E,k=x*y*b-S*E,j=N=>Math.exp(-x*y*N)*(_*Math.sin(E*N)+k*Math.cos(E*N));else if(x===1){w=A=>o-Math.exp(-y*A)*(b+(g+y*b)*A);const N=g+y*b;j=A=>Math.exp(-y*A)*(y*N*A-g)}else{const N=y*Math.sqrt(x*x-1);w=$=>{const O=Math.exp(-x*y*$),U=Math.min(N*$,300);return o-O*((g+x*y*b)*Math.sinh(U)+N*b*Math.cosh(U))/N};const A=(g+x*y*b)/N,T=x*y*A-b*N,I=x*y*b-A*N;j=$=>{const O=Math.exp(-x*y*$),U=Math.min(N*$,300);return O*(T*Math.sinh(U)+I*Math.cosh(U))}}const C={calculatedDuration:m&&h||null,velocity:N=>Ni(j(N)),next:N=>{if(!m&&x<1){const T=Math.exp(-x*y*N),I=Math.sin(E*N),$=Math.cos(E*N),O=o-T*(S*I+b*$),U=Ni(T*(_*I+k*$));return l.done=Math.abs(U)<=r&&Math.abs(o-O)<=a,l.value=l.done?o:O,l}const A=w(N);if(m)l.done=N>=h;else{const T=Ni(j(N));l.done=Math.abs(T)<=r&&Math.abs(o-A)<=a}return l.value=l.done?o:A,l},toString:()=>{const N=Math.min(xR(C),Bw),A=qK(T=>C.next(N*T).value,N,30);return N+"ms "+A},toTransition:()=>{}};return C}Uw.applyToOptions=e=>{const t=z2e(e,100,Uw);return e.ease=t.ease,e.duration=Ni(t.duration),e.type="keyframes",e};const K2e=5;function WK(e,t,n){const r=Math.max(t-K2e,0);return kK(n-e(r),t-r)}function mA({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:a=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const h=e[0],p={done:!1,value:h},m=k=>l!==void 0&&k<l||c!==void 0&&k>c,g=k=>l===void 0?c:c===void 0||Math.abs(l-k)<Math.abs(c-k)?l:c;let x=n*t;const b=h+x,y=o===void 0?b:o(b);y!==b&&(x=y-h);const v=k=>-x*Math.exp(-k/r),w=k=>y+v(k),j=k=>{const C=v(k),N=w(k);p.done=Math.abs(C)<=u,p.value=p.done?y:N};let E,S;const _=k=>{m(p.value)&&(E=k,S=Uw({keyframes:[p.value,g(p.value)],velocity:WK(w,k,p.value),damping:a,stiffness:i,restDelta:u,restSpeed:d}))};return _(0),{calculatedDuration:null,next:k=>{let C=!1;return!S&&E===void 0&&(C=!0,j(k),_(k)),E!==void 0&&k>=E?S.next(k-E):(!C&&j(k),p)}}}function X2e(e,t,n){const r=[],a=n||Nu.mix||HK,i=e.length-1;for(let o=0;o<i;o++){let l=a(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||Qi:t;l=w0(c,l)}r.push(l)}return r}function VK(e,t,{clamp:n=!0,ease:r,mixer:a}={}){const i=e.length;if(cR(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=X2e(t,r,a),c=l.length,u=d=>{if(o&&d<e[0])return t[0];let h=0;if(c>1)for(;h<e.length-2&&!(d<e[h+1]);h++);const p=Cb(e[h],e[h+1],d);return l[h](p)};return n?d=>u(cl(e[0],e[i-1],d)):u}function J2e(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const a=Cb(0,t,r);e.push(En(n,1,a))}}function Q2e(e){const t=[0];return J2e(t,e.length-1),t}function Z2e(e,t){return e.map(n=>n*t)}function eNe(e,t){return e.map(()=>t||PK).splice(0,e.length-1)}function Rx({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const a=c2e(r)?r.map(_D):_D(r),i={done:!1,value:t[0]},o=Z2e(n&&n.length===t.length?n:Q2e(t),e),l=VK(o,t,{ease:Array.isArray(a)?a:eNe(t,a)});return{calculatedDuration:e,next:c=>(i.value=l(c),i.done=c>=e,i)}}const tNe=e=>e!==null;function V_(e,{repeat:t,repeatType:n="loop"},r,a=1){const i=e.filter(tNe),l=a<0||t&&n!=="loop"&&t%2===1?0:i.length-1;return!l||r===void 0?i[l]:r}const sNe={decay:mA,inertia:mA,tween:Rx,keyframes:Rx,spring:Uw};function GK(e){typeof e.type=="string"&&(e.type=sNe[e.type])}class bR{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)}}const nNe=e=>e/100;class zw extends bR{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==Oa.now()&&this.tick(Oa.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;GK(t);const{type:n=Rx,repeat:r=0,repeatDelay:a=0,repeatType:i,velocity:o=0}=t;let{keyframes:l}=t;const c=n||Rx;c!==Rx&&typeof l[0]!="number"&&(this.mixKeyframes=w0(nNe,HK(l[0],l[1])),l=[0,100]);const u=c({...t,keyframes:l});i==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...l].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=xR(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+a,this.totalDuration=this.resolvedDuration*(r+1)-a,this.generator=u}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:i,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:h,repeatType:p,repeatDelay:m,type:g,onUpdate:x,finalKeyframe:b}=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 y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>a;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let w=this.currentTime,j=r;if(h){const k=Math.min(this.currentTime,a)/l;let C=Math.floor(k),N=k%1;!N&&k>=1&&(N=1),N===1&&C--,C=Math.min(C,h+1),C%2&&(p==="reverse"?(N=1-N,m&&(N-=m/l)):p==="mirror"&&(j=o)),w=cl(0,1,N)*l}let E;v?(this.delayState.value=d[0],E=this.delayState):E=j.next(w),i&&!v&&(E.value=i(E.value));let{done:S}=E;!v&&c!==null&&(S=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const _=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return _&&g!==mA&&(E.value=V_(d,this.options,b,this.speed)),x&&x(E.value),_&&this.finish(),E}then(t,n){return this.finished.then(t,n)}get duration(){return Gi(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Gi(t)}get time(){return Gi(this.currentTime)}set time(t){t=Ni(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?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return WK(r=>this.generator.next(r).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(Oa.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Gi(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=U2e,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(Oa.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 rNe(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Vd=e=>e*180/Math.PI,fA=e=>{const t=Vd(Math.atan2(e[1],e[0]));return gA(t)},aNe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:fA,rotateZ:fA,skewX:e=>Vd(Math.atan(e[1])),skewY:e=>Vd(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},gA=e=>(e=e%360,e<0&&(e+=360),e),AD=fA,RD=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),ID=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),iNe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:RD,scaleY:ID,scale:e=>(RD(e)+ID(e))/2,rotateX:e=>gA(Vd(Math.atan2(e[6],e[5]))),rotateY:e=>gA(Vd(Math.atan2(-e[2],e[0]))),rotateZ:AD,rotate:AD,skewX:e=>Vd(Math.atan(e[4])),skewY:e=>Vd(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function xA(e){return e.includes("scale")?1:0}function bA(e,t){if(!e||e==="none")return xA(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,a;if(n)r=iNe,a=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=aNe,a=l}if(!a)return xA(t);const i=r[t],o=a[1].split(",").map(lNe);return typeof i=="function"?i(o):o[i]}const oNe=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return bA(n,t)};function lNe(e){return parseFloat(e.trim())}const Ff=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Bf=new Set(Ff),PD=e=>e===$f||e===qt,cNe=new Set(["x","y","z"]),uNe=Ff.filter(e=>!cNe.has(e));function dNe(e){const t=[];return uNe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const du={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const a=e.max-e.min;return r==="border-box"?a:a-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const a=e.max-e.min;return r==="border-box"?a:a-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})=>bA(t,"x"),y:(e,{transform:t})=>bA(t,"y")};du.translateX=du.x;du.translateY=du.y;const uh=new Set;let yA=!1,vA=!1,wA=!1;function YK(){if(vA){const e=Array.from(uh).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const a=dNe(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(([i,o])=>{r.getValue(i)?.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}vA=!1,yA=!1,uh.forEach(e=>e.complete(wA)),uh.clear()}function KK(){uh.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(vA=!0)})}function hNe(){wA=!0,KK(),YK(),wA=!1}class yR{constructor(t,n,r,a,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=a,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(uh.add(this),yA||(yA=!0,pn.read(KK),pn.resolveKeyframes(YK))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:a}=this;if(t[0]===null){const i=a?.get(),o=t[t.length-1];if(i!==void 0)t[0]=i;else if(r&&n){const l=r.readValue(n,o);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=o),a&&i===void 0&&a.set(t[0])}rNe(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),uh.delete(this)}cancel(){this.state==="scheduled"&&(uh.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const pNe=e=>e.startsWith("--");function XK(e,t,n){pNe(t)?e.style.setProperty(t,n):e.style[t]=n}const mNe={};function JK(e,t){const n=_K(e);return()=>mNe[t]??n()}const fNe=JK(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),QK=JK(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),rx=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,LD={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:rx([0,.65,.55,1]),circOut:rx([.55,0,1,.45]),backIn:rx([.31,.01,.66,-.59]),backOut:rx([.33,1.53,.69,.99])};function ZK(e,t){if(e)return typeof e=="function"?QK()?qK(e,t):"ease-out":LK(e)?rx(e):Array.isArray(e)?e.map(n=>ZK(n,t)||LD.easeOut):LD[e]}function gNe(e,t,n,{delay:r=0,duration:a=300,repeat:i=0,repeatType:o="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[t]:n};c&&(d.offset=c);const h=ZK(l,a);Array.isArray(h)&&(d.easing=h);const p={delay:r,duration:a,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return u&&(p.pseudoElement=u),e.animate(d,p)}function eX(e){return typeof e=="function"&&"applyToOptions"in e}function xNe({type:e,...t}){return eX(e)&&QK()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class tX extends bR{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:a,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=t;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=t,cR(typeof t.type!="string");const u=xNe(t);this.animation=gNe(n,r,a,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=V_(a,this.options,l,this.speed);this.updateMotionValue&&this.updateMotionValue(d),XK(n,r,d),this.animation.cancel()}c?.(),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(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Gi(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Gi(t)}get time(){return Gi(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ni(t),n&&this.animation.pause()}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,rangeStart:n,rangeEnd:r,observe:a}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&fNe()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Qi):a(this)}}const sX={anticipate:AK,backInOut:TK,circInOut:IK};function bNe(e){return e in sX}function yNe(e){typeof e.ease=="string"&&bNe(e.ease)&&(e.ease=sX[e.ease])}const PN=10;class vNe extends tX{constructor(t){yNe(t),GK(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:a,element:i,...o}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const l=new zw({...o,autoplay:!1}),c=Math.max(PN,Oa.now()-this.startTime),u=cl(0,PN,c-PN),d=l.sample(c).value,{name:h}=this.options;i&&h&&XK(i,h,d),n.setWithVelocity(l.sample(Math.max(0,c-u)).value,d,u),l.stop()}}const OD=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(_o.test(e)||e==="0")&&!e.startsWith("url("));function wNe(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 jNe(e,t,n,r){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=OD(a,t),l=OD(i,t);return!o||!l?!1:wNe(e)||(n==="spring"||eX(n))&&r}function jA(e){e.duration=0,e.type="keyframes"}const nX=new Set(["opacity","clipPath","filter","transform"]),_Ne=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function kNe(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&_Ne.test(e[t]))return!0;return!1}const NNe=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),ENe=_K(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function SNe(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:a,damping:i,type:o,keyframes:l}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=t.owner.getProps();return ENe()&&n&&(nX.has(n)||NNe.has(n)&&kNe(l))&&(n!=="transform"||!d)&&!u&&!r&&a!=="mirror"&&i!==0&&o!=="inertia"}const CNe=40;class TNe extends bR{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:a=0,repeatDelay:i=0,repeatType:o="loop",keyframes:l,name:c,motionValue:u,element:d,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Oa.now();const p={autoplay:t,delay:n,type:r,repeat:a,repeatDelay:i,repeatType:o,name:c,motionValue:u,element:d,...h},m=d?.KeyframeResolver||yR;this.keyframeResolver=new m(l,(g,x,b)=>this.onKeyframesResolved(g,x,p,!b),c,u,d),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,r,a){this.keyframeResolver=void 0;const{name:i,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=r;this.resolvedAt=Oa.now();let h=!0;jNe(t,i,o,l)||(h=!1,(Nu.instantAnimations||!c)&&d?.(V_(t,r,n)),t[0]=t[t.length-1],jA(r),r.repeat=0);const m={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>CNe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},g=h&&!u&&SNe(m),x=m.motionValue?.owner?.current;let b;if(g)try{b=new vNe({...m,element:x})}catch{b=new zw(m)}else b=new zw(m);b.finished.then(()=>{this.notifyFinished()}).catch(Qi),this.pendingTimeline&&(this.stopTimeline=b.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=b}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(),hNe()),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()}}function rX(e,t,n,r=0,a=1){const i=Array.from(e).sort((u,d)=>u.sortNodePosition(d)).indexOf(t),o=e.size,l=(o-1)*r;return typeof n=="function"?n(i,o):a===1?i*r:l-i*r}const ANe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function RNe(e){const t=ANe.exec(e);if(!t)return[,];const[,n,r,a]=t;return[`--${n??r}`,a]}function aX(e,t,n=1){const[r,a]=RNe(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return vK(o)?parseFloat(o):o}return pR(a)?aX(a,t,n+1):a}const INe={type:"spring",stiffness:500,damping:25,restSpeed:10},PNe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),LNe={type:"keyframes",duration:.8},ONe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},MNe=(e,{keyframes:t})=>t.length>2?LNe:Bf.has(e)?e.startsWith("scale")?PNe(t[1]):INe:ONe;function iX(e,t){if(e?.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function vR(e,t){const n=e?.[t]??e?.default??e;return n!==e?iX(n,e):n}const DNe=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function $Ne(e){for(const t in e)if(!DNe.has(t))return!0;return!1}const wR=(e,t,n,r={},a,i)=>o=>{const l=vR(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Ni(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:p=>{t.set(p),l.onUpdate&&l.onUpdate(p)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:i?void 0:a};$Ne(l)||Object.assign(d,MNe(e,d)),d.duration&&(d.duration=Ni(d.duration)),d.repeatDelay&&(d.repeatDelay=Ni(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(jA(d),d.delay===0&&(h=!0)),(Nu.instantAnimations||Nu.skipAnimations||a?.shouldSkipAnimations)&&(h=!0,jA(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,h&&!i&&t.get()!==void 0){const p=V_(d.keyframes,l);if(p!==void 0){pn.update(()=>{d.onUpdate(p),d.onComplete()});return}}return l.isSync?new zw(d):new TNe(d)};function MD(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function jR(e,t,n,r){if(typeof t=="function"){const[a,i]=MD(r);t=t(n!==void 0?n:e.custom,a,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[a,i]=MD(r);t=t(n!==void 0?n:e.custom,a,i)}return t}function dh(e,t,n){const r=e.getProps();return jR(r,t,n!==void 0?n:r.custom,e)}const oX=new Set(["width","height","top","left","right","bottom",...Ff]),DD=30,FNe=e=>!isNaN(parseFloat(e)),Ix={current:void 0};class BNe{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const a=Oa.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 i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Oa.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=FNe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new uR);const r=this.events[t].add(n);return t==="change"?()=>{r(),pn.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 Ix.current&&Ix.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Oa.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>DD)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,DD);return kK(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 Ah(e,t){return new BNe(e,t)}const _A=e=>Array.isArray(e);function UNe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Ah(n))}function zNe(e){return _A(e)?e[e.length-1]||0:e}function HNe(e,t){const n=dh(e,t);let{transitionEnd:r={},transition:a={},...i}=n||{};i={...i,...r};for(const o in i){const l=zNe(i[o]);UNe(e,o,l)}}const zr=e=>!!(e&&e.getVelocity);function qNe(e){return!!(zr(e)&&e.add)}function kA(e,t){const n=e.getValue("willChange");if(qNe(n))return n.add(t);if(!n&&Nu.WillChange){const r=new Nu.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function _R(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const WNe="framerAppearId",lX="data-"+_R(WNe);function cX(e){return e.props[lX]}function VNe({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function uX(e,t,{delay:n=0,transitionOverride:r,type:a}={}){let{transition:i,transitionEnd:o,...l}=t;const c=e.getDefaultTransition();i=i?iX(i,c):c;const u=i?.reduceMotion;r&&(i=r);const d=[],h=a&&e.animationState&&e.animationState.getState()[a];for(const p in l){const m=e.getValue(p,e.latestValues[p]??null),g=l[p];if(g===void 0||h&&VNe(h,p))continue;const x={delay:n,...vR(i||{},p)},b=m.get();if(b!==void 0&&!m.isAnimating()&&!Array.isArray(g)&&g===b&&!x.velocity){pn.update(()=>m.set(g));continue}let y=!1;if(window.MotionHandoffAnimation){const j=cX(e);if(j){const E=window.MotionHandoffAnimation(j,p,pn);E!==null&&(x.startTime=E,y=!0)}}kA(e,p);const v=u??e.shouldReduceMotion;m.start(wR(p,m,g,v&&oX.has(p)?{type:!1}:x,e,y));const w=m.animation;w&&d.push(w)}if(o){const p=()=>pn.update(()=>{o&&HNe(e,o)});d.length?Promise.all(d).then(p):p()}return d}function NA(e,t,n={}){const r=dh(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(a=n.transitionOverride);const i=r?()=>Promise.all(uX(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:h}=a;return GNe(e,t,c,u,d,h,n)}:()=>Promise.resolve(),{when:l}=a;if(l){const[c,u]=l==="beforeChildren"?[i,o]:[o,i];return c().then(()=>u())}else return Promise.all([i(),o(n.delay)])}function GNe(e,t,n=0,r=0,a=0,i=1,o){const l=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),l.push(NA(c,t,{...o,delay:n+(typeof r=="function"?0:r)+rX(e.variantChildren,c,r,a,i)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(l)}function YNe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const a=t.map(i=>NA(e,i,n));r=Promise.all(a)}else if(typeof t=="string")r=NA(e,t,n);else{const a=typeof t=="function"?dh(e,t,n.custom):t;r=Promise.all(uX(e,a,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const KNe={test:e=>e==="auto",parse:e=>e},dX=e=>t=>t.test(e),hX=[$f,qt,sl,zc,j2e,w2e,KNe],$D=e=>hX.find(dX(e));function XNe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||jK(e):!0}const JNe=new Set(["brightness","contrast","saturate","opacity"]);function QNe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(mR)||[];if(!r)return e;const a=n.replace(r,"");let i=JNe.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+a+")"}const ZNe=/\b([a-z-]*)\(.*?\)/gu,EA={..._o,getAnimatableNone:e=>{const t=e.match(ZNe);return t?t.map(QNe).join(" "):e}},SA={..._o,getAnimatableNone:e=>{const t=_o.parse(e);return _o.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},FD={...$f,transform:Math.round},eEe={rotate:zc,rotateX:zc,rotateY:zc,rotateZ:zc,scale:Py,scaleX:Py,scaleY:Py,scaleZ:Py,skew:zc,skewX:zc,skewY:zc,distance:qt,translateX:qt,translateY:qt,translateZ:qt,x:qt,y:qt,z:qt,perspective:qt,transformPerspective:qt,opacity:Tb,originX:ND,originY:ND,originZ:qt},kR={borderWidth:qt,borderTopWidth:qt,borderRightWidth:qt,borderBottomWidth:qt,borderLeftWidth:qt,borderRadius:qt,borderTopLeftRadius:qt,borderTopRightRadius:qt,borderBottomRightRadius:qt,borderBottomLeftRadius:qt,width:qt,maxWidth:qt,height:qt,maxHeight:qt,top:qt,right:qt,bottom:qt,left:qt,inset:qt,insetBlock:qt,insetBlockStart:qt,insetBlockEnd:qt,insetInline:qt,insetInlineStart:qt,insetInlineEnd:qt,padding:qt,paddingTop:qt,paddingRight:qt,paddingBottom:qt,paddingLeft:qt,paddingBlock:qt,paddingBlockStart:qt,paddingBlockEnd:qt,paddingInline:qt,paddingInlineStart:qt,paddingInlineEnd:qt,margin:qt,marginTop:qt,marginRight:qt,marginBottom:qt,marginLeft:qt,marginBlock:qt,marginBlockStart:qt,marginBlockEnd:qt,marginInline:qt,marginInlineStart:qt,marginInlineEnd:qt,fontSize:qt,backgroundPositionX:qt,backgroundPositionY:qt,...eEe,zIndex:FD,fillOpacity:Tb,strokeOpacity:Tb,numOctaves:FD},tEe={...kR,color:mr,backgroundColor:mr,outlineColor:mr,fill:mr,stroke:mr,borderColor:mr,borderTopColor:mr,borderRightColor:mr,borderBottomColor:mr,borderLeftColor:mr,filter:EA,WebkitFilter:EA,mask:SA,WebkitMask:SA},pX=e=>tEe[e],sEe=new Set([EA,SA]);function mX(e,t){let n=pX(e);return sEe.has(n)||(n=_o),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const nEe=new Set(["auto","none","0"]);function rEe(e,t,n){let r=0,a;for(;r<e.length&&!a;){const i=e[r];typeof i=="string"&&!nEe.has(i)&&Zm(i).values.length&&(a=e[r]),r++}if(a&&n)for(const i of t)e[i]=mX(n,a)}class aEe extends yR{constructor(t,n,r,a,i){super(t,n,r,a,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let d=0;d<t.length;d++){let h=t[d];if(typeof h=="string"&&(h=h.trim(),pR(h))){const p=aX(h,n.current);p!==void 0&&(t[d]=p),d===t.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!oX.has(r)||t.length!==2)return;const[a,i]=t,o=$D(a),l=$D(i),c=kD(a),u=kD(i);if(c!==u&&du[r]){this.needsMeasurement=!0;return}if(o!==l)if(PD(o)&&PD(l))for(let d=0;d<t.length;d++){const h=t[d];typeof h=="string"&&(t[d]=parseFloat(h))}else du[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let a=0;a<t.length;a++)(t[a]===null||XNe(t[a]))&&r.push(a);r.length&&rEe(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=du[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 i=r.length-1,o=r[i];r[i]=du[n](t.measureViewportBox(),window.getComputedStyle(t.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function fX(e,t,n){if(e==null)return[];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).filter(r=>r!=null)}const gX=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function u1(e){return wK(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:NR}=OK(queueMicrotask,!1),oo={x:!1,y:!1};function xX(){return oo.x||oo.y}function iEe(e){return e==="x"||e==="y"?oo[e]?null:(oo[e]=!0,()=>{oo[e]=!1}):oo.x||oo.y?null:(oo.x=oo.y=!0,()=>{oo.x=oo.y=!1})}function bX(e,t){const n=fX(e),r=new AbortController,a={passive:!0,...t,signal:r.signal};return[n,a,()=>r.abort()]}function oEe(e){return!(e.pointerType==="touch"||xX())}function lEe(e,t,n={}){const[r,a,i]=bX(e,n);return r.forEach(o=>{let l=!1,c=!1,u;const d=()=>{o.removeEventListener("pointerleave",g)},h=b=>{u&&(u(b),u=void 0),d()},p=b=>{l=!1,window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),c&&(c=!1,h(b))},m=()=>{l=!0,window.addEventListener("pointerup",p,a),window.addEventListener("pointercancel",p,a)},g=b=>{if(b.pointerType!=="touch"){if(l){c=!0;return}h(b)}},x=b=>{if(!oEe(b))return;c=!1;const y=t(o,b);typeof y=="function"&&(u=y,o.addEventListener("pointerleave",g,a))};o.addEventListener("pointerenter",x,a),o.addEventListener("pointerdown",m,a)}),i}const yX=(e,t)=>t?e===t?!0:yX(e,t.parentElement):!1,ER=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,cEe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function uEe(e){return cEe.has(e.tagName)||e.isContentEditable===!0}const dEe=new Set(["INPUT","SELECT","TEXTAREA"]);function hEe(e){return dEe.has(e.tagName)||e.isContentEditable===!0}const d1=new WeakSet;function BD(e){return t=>{t.key==="Enter"&&e(t)}}function LN(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const pEe=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=BD(()=>{if(d1.has(n))return;LN(n,"down");const a=BD(()=>{LN(n,"up")}),i=()=>LN(n,"cancel");n.addEventListener("keyup",a,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function UD(e){return ER(e)&&!xX()}const zD=new WeakSet;function mEe(e,t,n={}){const[r,a,i]=bX(e,n),o=l=>{const c=l.currentTarget;if(!UD(l)||zD.has(l))return;d1.add(c),n.stopPropagation&&zD.add(l);const u=t(c,l),d=(m,g)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",p),d1.has(c)&&d1.delete(c),UD(m)&&typeof u=="function"&&u(m,{success:g})},h=m=>{d(m,c===window||c===document||n.useGlobalTarget||yX(c,m.target))},p=m=>{d(m,!1)};window.addEventListener("pointerup",h,a),window.addEventListener("pointercancel",p,a)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,a),u1(l)&&(l.addEventListener("focus",u=>pEe(u,a)),!uEe(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),i}function SR(e){return wK(e)&&"ownerSVGElement"in e}const h1=new WeakMap;let p1;const vX=(e,t,n)=>(r,a)=>a&&a[0]?a[0][e+"Size"]:SR(r)&&"getBBox"in r?r.getBBox()[t]:r[n],fEe=vX("inline","width","offsetWidth"),gEe=vX("block","height","offsetHeight");function xEe({target:e,borderBoxSize:t}){h1.get(e)?.forEach(n=>{n(e,{get width(){return fEe(e,t)},get height(){return gEe(e,t)}})})}function bEe(e){e.forEach(xEe)}function yEe(){typeof ResizeObserver>"u"||(p1=new ResizeObserver(bEe))}function vEe(e,t){p1||yEe();const n=fX(e);return n.forEach(r=>{let a=h1.get(r);a||(a=new Set,h1.set(r,a)),a.add(t),p1?.observe(r)}),()=>{n.forEach(r=>{const a=h1.get(r);a?.delete(t),a?.size||p1?.unobserve(r)})}}const m1=new Set;let gm;function wEe(){gm=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};m1.forEach(t=>t(e))},window.addEventListener("resize",gm)}function jEe(e){return m1.add(e),gm||wEe(),()=>{m1.delete(e),!m1.size&&typeof gm=="function"&&(window.removeEventListener("resize",gm),gm=void 0)}}function HD(e,t){return typeof e=="function"?jEe(e):vEe(e,t)}function _Ee(e){return SR(e)&&e.tagName==="svg"}function kEe(...e){const t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],a=e[1+n],i=e[2+n],o=e[3+n],l=VK(a,i,o);return t?l(r):l}const NEe=[...hX,mr,_o],EEe=e=>NEe.find(dX(e)),qD=()=>({translate:0,scale:1,origin:0,originPoint:0}),xm=()=>({x:qD(),y:qD()}),WD=()=>({min:0,max:0}),_r=()=>({x:WD(),y:WD()}),SEe=new WeakMap;function G_(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Ab(e){return typeof e=="string"||Array.isArray(e)}const CR=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],TR=["initial",...CR];function Y_(e){return G_(e.animate)||TR.some(t=>Ab(e[t]))}function wX(e){return!!(Y_(e)||e.variants)}function CEe(e,t,n){for(const r in t){const a=t[r],i=n[r];if(zr(a))e.addValue(r,a);else if(zr(i))e.addValue(r,Ah(a,{owner:e}));else if(i!==a)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(a):o.hasAnimated||o.set(a)}else{const o=e.getStaticValue(r);e.addValue(r,Ah(o!==void 0?o:a,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Hw={current:null},AR={current:!1},TEe=typeof window<"u";function jX(){if(AR.current=!0,!!TEe)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Hw.current=e.matches;e.addEventListener("change",t),t()}else Hw.current=!1}const VD=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let qw={};function _X(e){qw=e}function AEe(){return qw}class REe{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:a,skipAnimations:i,blockInitialAnimation:o,visualState:l},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=yR,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=Oa.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,pn.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=l;this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=a,this.skipAnimationsConfig=i,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=Y_(n),this.isVariantNode=wX(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:h,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in p){const g=p[m];u[m]!==void 0&&zr(g)&&g.set(u[m])}}mount(t){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=t,SEe.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(AR.current||jX(),this.shouldReduceMotion=Hw.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),fc(this.notifyUpdate),fc(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&nX.has(t)&&this.current instanceof HTMLElement){const{factory:o,keyframes:l,times:c,ease:u,duration:d}=n.accelerate,h=new tX({element:this.current,name:t,keyframes:l,times:c,ease:u,duration:Ni(d)}),p=o(h);this.valueSubscriptions.set(t,()=>{p(),h.cancel()});return}const r=Bf.has(t);r&&this.onBindTransform&&this.onBindTransform();const a=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&pn.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{a(),i&&i(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in qw){const n=qw[t];if(!n)continue;const{isEnabled:r,Feature:a}=n;if(!this.features[t]&&a&&r(this.props)&&(this.features[t]=new a(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):_r()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<VD.length;r++){const a=VD[r];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const i="on"+a,o=t[i];o&&(this.propEventSubscriptions[a]=this.on(a,o))}this.prevMotionValues=CEe(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Ah(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(vK(r)||jK(r))?r=parseFloat(r):!EEe(r)&&_o.test(n)&&(r=mX(t,n)),this.setBaseTarget(t,zr(r)?r.get():r)),zr(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const i=jR(this.props,n,this.presenceContext?.custom);i&&(r=i[t])}if(n&&r!==void 0)return r;const a=this.getBaseTargetFromProps(this.props,t);return a!==void 0&&!zr(a)?a:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new uR),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){NR.render(this.render)}}class kX extends REe{constructor(){super(...arguments),this.KeyframeResolver=aEe}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;zr(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Uu{constructor(t){this.isMounted=!1,this.node=t}update(){}}function NX({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function IEe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function PEe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function ON(e){return e===void 0||e===1}function CA({scale:e,scaleX:t,scaleY:n}){return!ON(e)||!ON(t)||!ON(n)}function Ed(e){return CA(e)||EX(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function EX(e){return GD(e.x)||GD(e.y)}function GD(e){return e&&e!=="0%"}function Ww(e,t,n){const r=e-n,a=t*r;return n+a}function YD(e,t,n,r,a){return a!==void 0&&(e=Ww(e,a,r)),Ww(e,n,r)+t}function TA(e,t=0,n=1,r,a){e.min=YD(e.min,t,n,r,a),e.max=YD(e.max,t,n,r,a)}function SX(e,{x:t,y:n}){TA(e.x,t.translate,t.scale,t.originPoint),TA(e.y,n.translate,n.scale,n.originPoint)}const KD=.999999999999,XD=1.0000000000001;function LEe(e,t,n,r=!1){const a=n.length;if(!a)return;t.x=t.y=1;let i,o;for(let l=0;l<a;l++){i=n[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&(Xo(e.x,-i.scroll.offset.x),Xo(e.y,-i.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,SX(e,o)),r&&Ed(i.latestValues)&&f1(e,i.latestValues,i.layout?.layoutBox))}t.x<XD&&t.x>KD&&(t.x=1),t.y<XD&&t.y>KD&&(t.y=1)}function Xo(e,t){e.min+=t,e.max+=t}function JD(e,t,n,r,a=.5){const i=En(e.min,e.max,a);TA(e,t,n,i,r)}function QD(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function f1(e,t,n){const r=n??e;JD(e.x,QD(t.x,r.x),t.scaleX,t.scale,t.originX),JD(e.y,QD(t.y,r.y),t.scaleY,t.scale,t.originY)}function CX(e,t){return NX(PEe(e.getBoundingClientRect(),t))}function OEe(e,t,n){const r=CX(e,n),{scroll:a}=t;return a&&(Xo(r.x,a.offset.x),Xo(r.y,a.offset.y)),r}const MEe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},DEe=Ff.length;function $Ee(e,t,n){let r="",a=!0;for(let i=0;i<DEe;i++){const o=Ff[i],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number")c=l===(o.startsWith("scale")?1:0);else{const u=parseFloat(l);c=o.startsWith("scale")?u===1:u===0}if(!c||n){const u=gX(l,kR[o]);if(!c){a=!1;const d=MEe[o]||o;r+=`${d}(${u}) `}n&&(t[o]=u)}}return r=r.trim(),n?r=n(t,a?"":r):a&&(r="none"),r}function RR(e,t,n){const{style:r,vars:a,transformOrigin:i}=e;let o=!1,l=!1;for(const c in t){const u=t[c];if(Bf.has(c)){o=!0;continue}else if(DK(c)){a[c]=u;continue}else{const d=gX(u,kR[c]);c.startsWith("origin")?(l=!0,i[c]=d):r[c]=d}}if(t.transform||(o||n?r.transform=$Ee(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;r.transformOrigin=`${c} ${u} ${d}`}}function TX(e,{style:t,vars:n},r,a){const i=e.style;let o;for(o in t)i[o]=t[o];a?.applyProjectionStyles(i,r);for(o in n)i.setProperty(o,n[o])}function ZD(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const wg={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(qt.test(e))e=parseFloat(e);else return e;const n=ZD(e,t.target.x),r=ZD(e,t.target.y);return`${n}% ${r}%`}},FEe={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,a=_o.parse(e);if(a.length>5)return r;const i=_o.createTransformer(e),o=typeof a[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;a[0+o]/=l,a[1+o]/=c;const u=En(l,c,.5);return typeof a[2+o]=="number"&&(a[2+o]/=u),typeof a[3+o]=="number"&&(a[3+o]/=u),i(a)}},AA={borderRadius:{...wg,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:wg,borderTopRightRadius:wg,borderBottomLeftRadius:wg,borderBottomRightRadius:wg,boxShadow:FEe};function AX(e,{layout:t,layoutId:n}){return Bf.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!AA[e]||e==="opacity")}function IR(e,t,n){const r=e.style,a=t?.style,i={};if(!r)return i;for(const o in r)(zr(r[o])||a&&zr(a[o])||AX(o,e)||n?.getValue(o)?.liveStyle!==void 0)&&(i[o]=r[o]);return i}function BEe(e){return window.getComputedStyle(e)}class UEe extends kX{constructor(){super(...arguments),this.type="html",this.renderInstance=TX}readValueFromInstance(t,n){if(Bf.has(n))return this.projection?.isProjecting?xA(n):oNe(t,n);{const r=BEe(t),a=(DK(n)?r.getPropertyValue(n):r[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(t,{transformPagePoint:n}){return CX(t,n)}build(t,n,r){RR(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return IR(t,n,r)}}const zEe={offset:"stroke-dashoffset",array:"stroke-dasharray"},HEe={offset:"strokeDashoffset",array:"strokeDasharray"};function qEe(e,t,n=1,r=0,a=!0){e.pathLength=1;const i=a?zEe:HEe;e[i.offset]=`${-r}`,e[i.array]=`${t} ${n}`}const WEe=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function RX(e,{attrX:t,attrY:n,attrScale:r,pathLength:a,pathSpacing:i=1,pathOffset:o=0,...l},c,u,d){if(RR(e,l,u),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p}=e;h.transform&&(p.transform=h.transform,delete h.transform),(p.transform||h.transformOrigin)&&(p.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),p.transform&&(p.transformBox=d?.transformBox??"fill-box",delete h.transformBox);for(const m of WEe)h[m]!==void 0&&(p[m]=h[m],delete h[m]);t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),a!==void 0&&qEe(h,a,i,o,!1)}const IX=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),PX=e=>typeof e=="string"&&e.toLowerCase()==="svg";function VEe(e,t,n,r){TX(e,t,void 0,r);for(const a in t.attrs)e.setAttribute(IX.has(a)?a:_R(a),t.attrs[a])}function LX(e,t,n){const r=IR(e,t,n);for(const a in e)if(zr(e[a])||zr(t[a])){const i=Ff.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;r[i]=e[a]}return r}class GEe extends kX{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=_r}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Bf.has(n)){const r=pX(n);return r&&r.default||0}return n=IX.has(n)?n:_R(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return LX(t,n,r)}build(t,n,r){RX(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,a){VEe(t,n,r,a)}mount(t){this.isSVGTag=PX(t.tagName),super.mount(t)}}const YEe=TR.length;function OX(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?OX(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<YEe;n++){const r=TR[n],a=e.props[r];(Ab(a)||a===!1)&&(t[r]=a)}return t}function MX(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const KEe=[...CR].reverse(),XEe=CR.length;function JEe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>YNe(e,n,r)))}function QEe(e){let t=JEe(e),n=e8(),r=!0,a=!1;const i=u=>(d,h)=>{const p=dh(e,h,u==="exit"?e.presenceContext?.custom:void 0);if(p){const{transition:m,transitionEnd:g,...x}=p;d={...d,...x,...g}}return d};function o(u){t=u(e)}function l(u){const{props:d}=e,h=OX(e.parent)||{},p=[],m=new Set;let g={},x=1/0;for(let y=0;y<XEe;y++){const v=KEe[y],w=n[v],j=d[v]!==void 0?d[v]:h[v],E=Ab(j),S=v===u?w.isActive:null;S===!1&&(x=y);let _=j===h[v]&&j!==d[v]&&E;if(_&&(r||a)&&e.manuallyAnimateOnMount&&(_=!1),w.protectedKeys={...g},!w.isActive&&S===null||!j&&!w.prevProp||G_(j)||typeof j=="boolean")continue;if(v==="exit"&&w.isActive&&S!==!0){w.prevResolvedValues&&(g={...g,...w.prevResolvedValues});continue}const k=ZEe(w.prevProp,j);let C=k||v===u&&w.isActive&&!_&&E||y>x&&E,N=!1;const A=Array.isArray(j)?j:[j];let T=A.reduce(i(v),{});S===!1&&(T={});const{prevResolvedValues:I={}}=w,$={...I,...T},O=H=>{C=!0,m.has(H)&&(N=!0,m.delete(H)),w.needsAnimating[H]=!0;const G=e.getValue(H);G&&(G.liveStyle=!1)};for(const H in $){const G=T[H],M=I[H];if(g.hasOwnProperty(H))continue;let z=!1;_A(G)&&_A(M)?z=!MX(G,M):z=G!==M,z?G!=null?O(H):m.add(H):G!==void 0&&m.has(H)?O(H):w.protectedKeys[H]=!0}w.prevProp=j,w.prevResolvedValues=T,w.isActive&&(g={...g,...T}),(r||a)&&e.blockInitialAnimation&&(C=!1);const U=_&&k;C&&(!U||N)&&p.push(...A.map(H=>{const G={type:v};if(typeof H=="string"&&(r||a)&&!U&&e.manuallyAnimateOnMount&&e.parent){const{parent:M}=e,z=dh(M,H);if(M.enteringChildren&&z){const{delayChildren:W}=z.transition||{};G.delay=rX(M.enteringChildren,e,W)}}return{animation:H,options:G}}))}if(m.size){const y={};if(typeof d.initial!="boolean"){const v=dh(e,Array.isArray(d.initial)?d.initial[0]:d.initial);v&&v.transition&&(y.transition=v.transition)}m.forEach(v=>{const w=e.getBaseTarget(v),j=e.getValue(v);j&&(j.liveStyle=!0),y[v]=w??null}),p.push({animation:y})}let b=!!p.length;return r&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(b=!1),r=!1,a=!1,b?t(p):Promise.resolve()}function c(u,d){if(n[u].isActive===d)return Promise.resolve();e.variantChildren?.forEach(p=>p.animationState?.setActive(u,d)),n[u].isActive=d;const h=l(u);for(const p in n)n[p].protectedKeys={};return h}return{animateChanges:l,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=e8(),a=!0}}}function ZEe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!MX(t,e):!1}function td(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function e8(){return{animate:td(!0),whileInView:td(),whileHover:td(),whileTap:td(),whileDrag:td(),whileFocus:td(),exit:td()}}function RA(e,t){e.min=t.min,e.max=t.max}function no(e,t){RA(e.x,t.x),RA(e.y,t.y)}function t8(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const DX=1e-4,eSe=1-DX,tSe=1+DX,$X=.01,sSe=0-$X,nSe=0+$X;function Ma(e){return e.max-e.min}function rSe(e,t,n){return Math.abs(e-t)<=n}function s8(e,t,n,r=.5){e.origin=r,e.originPoint=En(t.min,t.max,e.origin),e.scale=Ma(n)/Ma(t),e.translate=En(n.min,n.max,e.origin)-e.originPoint,(e.scale>=eSe&&e.scale<=tSe||isNaN(e.scale))&&(e.scale=1),(e.translate>=sSe&&e.translate<=nSe||isNaN(e.translate))&&(e.translate=0)}function Px(e,t,n,r){s8(e.x,t.x,n.x,r?r.originX:void 0),s8(e.y,t.y,n.y,r?r.originY:void 0)}function n8(e,t,n,r=0){const a=r?En(n.min,n.max,r):n.min;e.min=a+t.min,e.max=e.min+Ma(t)}function aSe(e,t,n,r){n8(e.x,t.x,n.x,r?.x),n8(e.y,t.y,n.y,r?.y)}function r8(e,t,n,r=0){const a=r?En(n.min,n.max,r):n.min;e.min=t.min-a,e.max=e.min+Ma(t)}function Vw(e,t,n,r){r8(e.x,t.x,n.x,r?.x),r8(e.y,t.y,n.y,r?.y)}function a8(e,t,n,r,a){return e-=t,e=Ww(e,1/n,r),a!==void 0&&(e=Ww(e,1/a,r)),e}function iSe(e,t=0,n=1,r=.5,a,i=e,o=e){if(sl.test(t)&&(t=parseFloat(t),t=En(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=En(i.min,i.max,r);e===i&&(l-=t),e.min=a8(e.min,t,n,l,a),e.max=a8(e.max,t,n,l,a)}function i8(e,t,[n,r,a],i,o){iSe(e,t[n],t[r],t[a],t.scale,i,o)}const oSe=["x","scaleX","originX"],lSe=["y","scaleY","originY"];function o8(e,t,n,r){i8(e.x,t,oSe,n?n.x:void 0,r?r.x:void 0),i8(e.y,t,lSe,n?n.y:void 0,r?r.y:void 0)}function l8(e){return e.translate===0&&e.scale===1}function FX(e){return l8(e.x)&&l8(e.y)}function c8(e,t){return e.min===t.min&&e.max===t.max}function cSe(e,t){return c8(e.x,t.x)&&c8(e.y,t.y)}function u8(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function BX(e,t){return u8(e.x,t.x)&&u8(e.y,t.y)}function d8(e){return Ma(e.x)/Ma(e.y)}function h8(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Wo(e){return[e("x"),e("y")]}function uSe(e,t,n){let r="";const a=e.x.translate/t.x,i=e.y.translate/t.y,o=n?.z||0;if((a||i||o)&&(r=`translate3d(${a}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:h,rotateY:p,skewX:m,skewY:g}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),h&&(r+=`rotateX(${h}deg) `),p&&(r+=`rotateY(${p}deg) `),m&&(r+=`skewX(${m}deg) `),g&&(r+=`skewY(${g}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const UX=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],dSe=UX.length,p8=e=>typeof e=="string"?parseFloat(e):e,m8=e=>typeof e=="number"||qt.test(e);function hSe(e,t,n,r,a,i){a?(e.opacity=En(0,n.opacity??1,pSe(r)),e.opacityExit=En(t.opacity??1,0,mSe(r))):i&&(e.opacity=En(t.opacity??1,n.opacity??1,r));for(let o=0;o<dSe;o++){const l=UX[o];let c=f8(t,l),u=f8(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||m8(c)===m8(u)?(e[l]=Math.max(En(p8(c),p8(u),r),0),(sl.test(u)||sl.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=En(t.rotate||0,n.rotate||0,r))}function f8(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const pSe=zX(0,.5,RK),mSe=zX(.5,.95,Qi);function zX(e,t,n){return r=>r<e?0:r>t?1:n(Cb(e,t,r))}function fSe(e,t,n){const r=zr(e)?e:Ah(e);return r.start(wR("",r,t,n)),r.animation}function Rb(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const gSe=(e,t)=>e.depth-t.depth;class xSe{constructor(){this.children=[],this.isDirty=!1}add(t){lR(this.children,t),this.isDirty=!0}remove(t){$w(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(gSe),this.isDirty=!1,this.children.forEach(t)}}function bSe(e,t){const n=Oa.now(),r=({timestamp:a})=>{const i=a-n;i>=t&&(fc(r),e(i-t))};return pn.setup(r,!0),()=>fc(r)}function g1(e){return zr(e)?e.get():e}class ySe{constructor(){this.members=[]}add(t){lR(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const a=r.instance;(!a||a.isConnected===!1)&&!r.snapshot&&($w(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if($w(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){for(let n=this.members.indexOf(t)-1;n>=0;n--){const r=this.members[n];if(r.isPresent!==!1&&r.instance?.isConnected!==!1)return this.promote(r),!0}return!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:a}=r.options,{layoutDependency:i}=t.options;(a===void 0||a!==i)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const x1={hasAnimatedSinceResize:!0,hasEverUpdated:!1},MN=["","X","Y","Z"],vSe=1e3;let wSe=0;function DN(e,t,n,r){const{latestValues:a}=t;a[e]&&(n[e]=a[e],t.setStaticValue(e,0),r&&(r[e]=0))}function HX(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=cX(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:a,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",pn,!(a||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&HX(r)}function qX({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:a}){return class{constructor(o={},l=t?.()){this.id=wSe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>
vendor: 1,503 bytes, line 56
56{this.projectionUpdateScheduled=!1,this.nodes.forEach(kSe),this.nodes.forEach(ASe),this.nodes.forEach(RSe),this.nodes.forEach(NSe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new xSe)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new uR),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=SR(o)&&!_Ee(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),e){let d,h=0;const p=()=>this.root.updateBlockedByResize=!1;pn.read(()=>{h=window.innerWidth}),e(o,()=>{const m=window.innerWidth;m!==h&&(h=m,this.root.updateBlockedByResize=!0,d&&d(),d=bSe(p,250),x1.hasAnimatedSinceResize&&(x1.hasAnimatedSinceResize=!1,this.nodes.forEach(b8)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:h,hasRelativeLayoutChanged:p,layout:m})=>
vendor: 19,036 bytes, line 56
56{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||MSe,{onLayoutAnimationStart:x,onLayoutAnimationComplete:b}=u.getProps(),y=!this.targetLayout||!BX(this.targetLayout,m),v=!h&&p;if(this.options.layoutRoot||this.resumeFrom||v||h&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...vR(g,"layout"),onPlay:x,onComplete:b};(u.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(d,v)}else h||b8(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),fc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ISe),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&HX(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const h=this.path[d];h.shouldResetTransform=!0,(typeof h.latestValues.x=="string"||typeof h.latestValues.y=="string")&&(h.isLayoutDirty=!0),h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const c=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),c&&this.nodes.forEach(SSe),this.nodes.forEach(g8);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(x8);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(CSe),this.nodes.forEach(TSe),this.nodes.forEach(jSe),this.nodes.forEach(_Se)):this.nodes.forEach(x8),this.clearAllSnapshots();const l=Oa.now();Kr.delta=cl(0,1e3/60,l-Kr.timestamp),Kr.timestamp=l,Kr.isProcessing=!0,CN.update.process(Kr),CN.preRender.process(Kr),CN.render.process(Kr),Kr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,NR.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ESe),this.sharedNodes.forEach(PSe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,pn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){pn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ma(this.snapshot.measuredBox.x)&&!Ma(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=_r()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!a)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!FX(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||Ed(this.latestValues)||d)&&(a(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),DSe(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return _r();const l=o.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some($Se))){const{scroll:u}=this.root;u&&(Xo(l.x,u.offset.x),Xo(l.y,u.offset.y))}return l}removeElementScroll(o){const l=_r();if(no(l,o),this.scroll?.wasRoot)return l;for(let c=0;c<this.path.length;c++){const u=this.path[c],{scroll:d,options:h}=u;u!==this.root&&d&&h.layoutScroll&&(d.wasRoot&&no(l,o),Xo(l.x,d.offset.x),Xo(l.y,d.offset.y))}return l}applyTransform(o,l=!1,c){const u=c||_r();no(u,o);for(let d=0;d<this.path.length;d++){const h=this.path[d];!l&&h.options.layoutScroll&&h.scroll&&h!==h.root&&(Xo(u.x,-h.scroll.offset.x),Xo(u.y,-h.scroll.offset.y)),Ed(h.latestValues)&&f1(u,h.latestValues,h.layout?.layoutBox)}return Ed(this.latestValues)&&f1(u,this.latestValues,this.layout?.layoutBox),u}removeTransform(o){const l=_r();no(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!Ed(u.latestValues))continue;let d;u.instance&&(CA(u.latestValues)&&u.updateSnapshot(),d=_r(),no(d,u.measurePageBox())),o8(l,u.latestValues,u.snapshot?.layoutBox,d)}return Ed(this.latestValues)&&o8(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Kr.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:h}=this.options;if(!this.layout||!(d||h))return;this.resolvedRelativeTargetAt=Kr.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=_r(),this.targetWithTransforms=_r()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),aSe(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):no(this.target,this.layout.layoutBox),SX(this.target,this.targetDelta)):no(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||CA(this.parent.latestValues)||EX(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,c){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_r(),this.relativeTargetOrigin=_r(),Vw(this.relativeTargetOrigin,l,c,this.options.layoutAnchor||void 0),no(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const o=this.getLead(),l=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Kr.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;no(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,p=this.treeScale.y;LEe(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=_r());const{target:m}=o;if(!m){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(t8(this.prevProjectionDelta.x,this.projectionDelta.x),t8(this.prevProjectionDelta.y,this.projectionDelta.y)),Px(this.projectionDelta,this.layoutCorrected,m,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==p||!h8(this.projectionDelta.x,this.prevProjectionDelta.x)||!h8(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",m))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.visualElement?.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=xm(),this.projectionDelta=xm(),this.projectionDeltaWithTransform=xm()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},h=xm();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const p=_r(),m=c?c.source:void 0,g=this.layout?this.layout.source:void 0,x=m!==g,b=this.getStack(),y=!b||b.members.length<=1,v=!!(x&&!y&&this.options.crossfade===!0&&!this.path.some(OSe));this.animationProgress=0;let w;this.mixTargetDelta=j=>{const E=j/1e3;y8(h.x,o.x,E),y8(h.y,o.y,E),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Vw(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),LSe(this.relativeTarget,this.relativeTargetOrigin,p,E),w&&cSe(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=_r()),no(w,this.relativeTarget)),x&&(this.animationValues=d,hSe(d,u,this.latestValues,E,v,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(fc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=pn.update(()=>{x1.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Ah(0)),this.motionValue.jump(0,!1),this.currentAnimation=fSe(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(vSe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&WX(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||_r();const h=Ma(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+h;const p=Ma(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+p}no(l,c),f1(l,d),Px(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new ySe),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){const{layoutId:o}=this.options;return o?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:o}=this.options;return o?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&DN("z",o,u,this.animationValues);for(let d=0;d<MN.length;d++)DN(`rotate${MN[d]}`,o,u,this.animationValues),DN(`skew${MN[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=g1(l?.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=g1(l?.pointerEvents)||""),this.hasProjected&&!Ed(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let h=uSe(this.projectionDeltaWithTransform,this.treeScale,d);c&&(h=c(d,h)),o.transform=h;const{x:p,y:m}=this.projectionDelta;o.transformOrigin=`${p.origin*100}% ${m.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const g in AA){if(d[g]===void 0)continue;const{correct:x,applyTo:b,isCSSVariable:y}=AA[g],v=h==="none"?d[g]:x(d[g],u);if(b){const w=b.length;for(let j=0;j<w;j++)o[b[j]]=v}else y?this.options.visualElement.renderState.vars[g]=v:o[g]=v}this.options.layoutId&&(o.pointerEvents=u===this?g1(l?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>o.currentAnimation?.stop()),this.root.nodes.forEach(g8),this.root.sharedNodes.clear()}}}function jSe(e){e.updateLayout()}function _Se(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=e.layout,{animationType:a}=e.options,i=t.source!==e.layout.source;if(a==="size")Wo(d=>{const h=i?t.measuredBox[d]:t.layoutBox[d],p=Ma(h);h.min=n[d].min,h.max=h.min+p});else if(a==="x"||a==="y"){const d=a==="x"?"y":"x";RA(i?t.measuredBox[d]:t.layoutBox[d],n[d])}else WX(a,t.layoutBox,n)&&Wo(d=>{const h=i?t.measuredBox[d]:t.layoutBox[d],p=Ma(n[d]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+p)});const o=xm();Px(o,n,t.layoutBox);const l=xm();i?Px(l,e.applyTransform(r,!0),t.measuredBox):Px(l,n,t.layoutBox);const c=!FX(o);let u=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:h,layout:p}=d;if(h&&p){const m=e.options.layoutAnchor||void 0,g=_r();Vw(g,t.layoutBox,h.layoutBox,m);const x=_r();Vw(x,n,p.layoutBox,m),BX(g,x)||(u=!0),d.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=g,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:l,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function kSe(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function NSe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ESe(e){e.clearSnapshot()}function g8(e){e.clearMeasurements()}function SSe(e){e.isLayoutDirty=!0,e.updateLayout()}function x8(e){e.isLayoutDirty=!1}function CSe(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function TSe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function b8(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function ASe(e){e.resolveTargetDelta()}function RSe(e){e.calcProjection()}
vendor: 10,593 bytes, lines 56-64
56function ISe(e){e.resetSkewAndRotation()}function PSe(e){e.removeLeadSnapshot()}function y8(e,t,n){e.translate=En(t.translate,0,n),e.scale=En(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function v8(e,t,n,r){e.min=En(t.min,n.min,r),e.max=En(t.max,n.max,r)}function LSe(e,t,n,r){v8(e.x,t.x,n.x,r),v8(e.y,t.y,n.y,r)}function OSe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const MSe={duration:.45,ease:[.4,0,.1,1]},w8=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),j8=w8("applewebkit/")&&!w8("chrome/")?Math.round:Qi;function _8(e){e.min=j8(e.min),e.max=j8(e.max)}function DSe(e){_8(e.x),_8(e.y)}function WX(e,t,n){return e==="position"||e==="preserve-aspect"&&!rSe(d8(t),d8(n),.2)}function $Se(e){return e!==e.root&&e.scroll?.wasRoot}const FSe=qX({attachResizeListener:(e,t)=>Rb(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),$N={current:void 0},VX=qX({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!$N.current){const e=new FSe({});e.mount(window),e.setOptions({layoutScroll:!0}),$N.current=e}return $N.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),K_=f.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function k8(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function BSe(...e){return t=>{let n=!1;const r=e.map(a=>{const i=k8(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<r.length;a++){const i=r[a];typeof i=="function"?i():k8(e[a],null)}}}}function USe(...e){return f.useCallback(BSe(...e),e)}class zSe extends f.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(u1(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,a=u1(r)&&r.offsetWidth||0,i=u1(r)&&r.offsetHeight||0,o=getComputedStyle(n),l=this.props.sizeRef.current;l.height=parseFloat(o.height),l.width=parseFloat(o.width),l.top=n.offsetTop,l.left=n.offsetLeft,l.right=a-l.width-l.left,l.bottom=i-l.height-l.top}return null}componentDidUpdate(){}render(){return this.props.children}}function HSe({children:e,isPresent:t,anchorX:n,anchorY:r,root:a,pop:i}){const o=f.useId(),l=f.useRef(null),c=f.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:u}=f.useContext(K_),d=e.props?.ref??e?.ref,h=USe(l,d);return f.useInsertionEffect(()=>{const{width:p,height:m,top:g,left:x,right:b,bottom:y}=c.current;if(t||i===!1||!l.current||!p||!m)return;const v=n==="left"?`left: ${x}`:`right: ${b}`,w=r==="bottom"?`bottom: ${y}`:`top: ${g}`;l.current.dataset.motionPopId=o;const j=document.createElement("style");u&&(j.nonce=u);const E=a??document.head;return E.appendChild(j),j.sheet&&j.sheet.insertRule(` 57 [data-motion-pop-id="${o}"] { 58 position: absolute !important; 59 width: ${p}px !important; 60 height: ${m}px !important; 61 ${v}px !important; 62 ${w}px !important; 63 } 64 `),()=>{l.current?.removeAttribute("data-motion-pop-id"),E.contains(j)&&E.removeChild(j)}},[t]),s.jsx(zSe,{isPresent:t,childRef:l,sizeRef:c,pop:i,children:i===!1?e:f.cloneElement(e,{ref:h})})}const qSe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:a,presenceAffectsLayout:i,mode:o,anchorX:l,anchorY:c,root:u})=>{const d=Gh(WSe),h=f.useId();let p=!0,m=f.useMemo(()=>(p=!1,{id:h,initial:t,isPresent:n,custom:a,onExitComplete:g=>{d.set(g,!0);for(const x of d.values())if(!x)return;r&&r()},register:g=>(d.set(g,!1),()=>d.delete(g))}),[n,d,r]);return i&&p&&(m={...m}),f.useMemo(()=>{d.forEach((g,x)=>d.set(x,!1))},[n]),f.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),e=s.jsx(HSe,{pop:o==="popLayout",isPresent:n,anchorX:l,anchorY:c,root:u,children:e}),s.jsx(W_.Provider,{value:m,children:e})};function WSe(){return new Map}function GX(e=!0){const t=f.useContext(W_);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:a}=t,i=f.useId();f.useEffect(()=>{if(e)return a(i)},[e]);const o=f.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const Ly=e=>e.key||"";function N8(e){const t=[];return f.Children.forEach(e,n=>{f.isValidElement(n)&&t.push(n)}),t}const Ei=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:a=!0,mode:i="sync",propagate:o=!1,anchorX:l="left",anchorY:c="top",root:u})=>{const[d,h]=GX(o),p=f.useMemo(()=>N8(e),[e]),m=o&&!d?[]:p.map(Ly),g=f.useRef(!0),x=f.useRef(p),b=Gh(()=>new Map),y=f.useRef(new Set),[v,w]=f.useState(p),[j,E]=f.useState(p);oR(()=>{g.current=!1,x.current=p;for(let k=0;k<j.length;k++){const C=Ly(j[k]);m.includes(C)?(b.delete(C),y.current.delete(C)):b.get(C)!==!0&&b.set(C,!1)}},[j,m.length,m.join("-")]);const S=[];if(p!==v){let k=[...p];for(let C=0;C<j.length;C++){const N=j[C],A=Ly(N);m.includes(A)||(k.splice(C,0,N),S.push(N))}return i==="wait"&&S.length&&(k=S),E(N8(k)),w(p),null}const{forceRender:_}=f.useContext(iR);return s.jsx(s.Fragment,{children:j.map(k=>{const C=Ly(k),N=o&&!d?!1:p===j||m.includes(C),A=()=>{if(y.current.has(C))return;if(b.has(C))y.current.add(C),b.set(C,!0);else return;let T=!0;b.forEach(I=>{I||(T=!1)}),T&&(_?.(),E(x.current),o&&h?.(),r&&r())};return s.jsx(qSe,{isPresent:N,initial:!g.current||n?void 0:!1,custom:t,presenceAffectsLayout:a,mode:i,root:u,onExitComplete:N?void 0:A,anchorX:l,anchorY:c,children:k},C)})})},YX=f.createContext({strict:!1}),E8={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let S8=!1;function VSe(){if(S8)return;const e={};for(const t in E8)e[t]={isEnabled:n=>E8[t].some(r=>!!n[r])};_X(e),S8=!0}function KX(){return VSe(),AEe()}function GSe(e){const t=KX();for(const n in e)t[n]={...t[n],...e[n]};_X(t)}const YSe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Gw(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||YSe.has(e)}let XX=e=>!Gw(e);function KSe(e){typeof e=="function"&&(XX=t=>t.startsWith("on")?!Gw(t):e(t))}try{KSe(require("@emotion/is-prop-valid").default)}catch{}function XSe(e,t,n){const r={};for(const a in e)a==="values"&&typeof e.values=="object"||zr(e[a])||(XX(a)||n===!0&&Gw(a)||!t&&!Gw(a)||e.draggable&&a.startsWith("onDrag"))&&(r[a]=e[a]);return r}const X_=f.createContext({});function JSe(e,t){if(Y_(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Ab(n)?n:void 0,animate:Ab(r)?r:void 0}}return e.inherit!==!1?t:{}}function QSe(e){const{initial:t,animate:n}=JSe(e,f.useContext(X_));return f.useMemo(()=>({initial:t,animate:n}),[C8(t),C8(n)])}function C8(e){return Array.isArray(e)?e.join(" "):e}const PR=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function JX(e,t,n){for(const r in t)!zr(t[r])&&!AX(r,n)&&(e[r]=t[r])}function ZSe({transformTemplate:e},t){return f.useMemo(()=>{const n=PR();return RR(n,t,e),Object.assign({},n.vars,n.style)},[t])}function eCe(e,t){const n=e.style||{},r={};return JX(r,n,e),Object.assign(r,ZSe(e,t)),r}function tCe(e,t){const n={},r=eCe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const QX=()=>({...PR(),attrs:{}});function sCe(e,t,n,r){const a=f.useMemo(()=>{const i=QX();return RX(i,t,PX(r),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};JX(i,e.style,e),a.style={...i,...a.style}}return a}const nCe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function LR(e){return typeof e!="string"||e.includes("-")?!1:!!(nCe.indexOf(e)>-1||/[A-Z]/u.test(e))}function rCe(e,t,n,{latestValues:r},a,i=!1,o){const c=(o??LR(e)?sCe:tCe)(t,r,a,e),u=XSe(t,typeof e=="string",i),d=e!==f.Fragment?{...u,...c,ref:n}:{},{children:h}=t,p=f.useMemo(()=>zr(h)?h.get():h,[h]);return f.createElement(e,{...d,children:p})}function aCe({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,a){return{latestValues:iCe(n,r,a,e),renderState:t()}}function iCe(e,t,n,r){const a={},i=r(e,{});for(const p in i)a[p]=g1(i[p]);let{initial:o,animate:l}=e;const c=Y_(e),u=wX(e);t&&u&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const h=d?l:o;if(h&&typeof h!="boolean"&&!G_(h)){const p=Array.isArray(h)?h:[h];for(let m=0;m<p.length;m++){const g=jR(e,p[m]);if(g){const{transitionEnd:x,transition:b,...y}=g;for(const v in y){let w=y[v];if(Array.isArray(w)){const j=d?w.length-1:0;w=w[j]}w!==null&&(a[v]=w)}for(const v in x)a[v]=x[v]}}}return a}const ZX=e=>(t,n)=>{const r=f.useContext(X_),a=f.useContext(W_),i=()=>aCe(e,t,r,a);return n?i():Gh(i)},oCe=ZX({scrapeMotionValuesFromProps:IR,createRenderState:PR}),lCe=ZX({scrapeMotionValuesFromProps:LX,createRenderState:QX}),cCe=Symbol.for("motionComponentSymbol");function uCe(e,t,n){const r=f.useRef(n);f.useInsertionEffect(()=>{r.current=n});const a=f.useRef(null);return f.useCallback(i=>{i&&e.onMount?.(i);const o=r.current;if(typeof o=="function")if(i){const l=o(i);typeof l=="function"&&(a.current=l)}else a.current?(a.current(),a.current=null):o(i);else o&&(o.current=i);t&&(i?t.mount(i):t.unmount())},[t])}const eJ=f.createContext({});function em(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function dCe(e,t,n,r,a,i){const{visualElement:o}=f.useContext(X_),l=f.useContext(YX),c=f.useContext(W_),u=f.useContext(K_),d=u.reducedMotion,h=u.ski
vendor: 22,854 bytes, line 64
64pAnimations,p=f.useRef(null),m=f.useRef(!1);r=r||l.renderer,!p.current&&r&&(p.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:d,skipAnimations:h,isSVG:i}),m.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));const g=p.current,x=f.useContext(eJ);g&&!g.projection&&a&&(g.type==="html"||g.type==="svg")&&hCe(p.current,n,a,x);const b=f.useRef(!1);f.useInsertionEffect(()=>{g&&b.current&&g.update(n,c)});const y=n[lX],v=f.useRef(!!y&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(y)&&window.MotionHasOptimisedAnimation?.(y));return oR(()=>{m.current=!0,g&&(b.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),g.scheduleRenderMicrotask(),v.current&&g.animationState&&g.animationState.animateChanges())}),f.useEffect(()=>{g&&(!v.current&&g.animationState&&g.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(y)}),v.current=!1),g.enteringChildren=void 0)}),g}function hCe(e,t,n,r){const{layoutId:a,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutAnchor:d,layoutCrossfade:h}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:tJ(e.parent)),e.projection.setOptions({layoutId:a,layout:i,alwaysMeasureLayout:!!o||l&&em(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:c,layoutRoot:u,layoutAnchor:d})}function tJ(e){if(e)return e.options.allowProjection!==!1?e.projection:tJ(e.parent)}function FN(e,{forwardMotionProps:t=!1,type:n}={},r,a){r&&GSe(r);const i=n?n==="svg":LR(e),o=i?lCe:oCe;function l(u,d){let h;const p={...f.useContext(K_),...u,layoutId:pCe(u)},{isStatic:m}=p,g=QSe(u),x=o(u,m);if(!m&&typeof window<"u"){mCe();const b=fCe(p);h=b.MeasureLayout,g.visualElement=dCe(e,x,p,a,b.ProjectionNode,i)}return s.jsxs(X_.Provider,{value:g,children:[h&&g.visualElement?s.jsx(h,{visualElement:g.visualElement,...p}):null,rCe(e,u,uCe(x,g.visualElement,d),x,m,t,i)]})}l.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const c=f.forwardRef(l);return c[cCe]=e,c}function pCe({layoutId:e}){const t=f.useContext(iR).id;return t&&e!==void 0?t+"-"+e:e}function mCe(e,t){f.useContext(YX).strict}function fCe(e){const t=KX(),{drag:n,layout:r}=t;if(!n&&!r)return{};const a={...n,...r};return{MeasureLayout:n?.isEnabled(e)||r?.isEnabled(e)?a.MeasureLayout:void 0,ProjectionNode:a.ProjectionNode}}function gCe(e,t){if(typeof Proxy>"u")return FN;const n=new Map,r=(i,o)=>FN(i,o,e,t),a=(i,o)=>r(i,o);return new Proxy(a,{get:(i,o)=>o==="create"?r:(n.has(o)||n.set(o,FN(o,void 0,e,t)),n.get(o))})}const xCe=(e,t)=>t.isSVG??LR(e)?new GEe(t):new UEe(t,{allowProjection:e!==f.Fragment});class bCe extends Uu{constructor(t){super(t),t.animationState||(t.animationState=QEe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();G_(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let yCe=0;class vCe extends Uu{constructor(){super(...arguments),this.id=yCe++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&r===!1){if(this.isExitComplete){const{initial:i,custom:o}=this.node.getProps();if(typeof i=="string"){const l=dh(this.node,i,o);if(l){const{transition:c,transitionEnd:u,...d}=l;for(const h in d)this.node.getValue(h)?.jump(d[h])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const a=this.node.animationState.setActive("exit",!t);n&&!t&&a.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const wCe={animation:{Feature:bCe},exit:{Feature:vCe}};function k0(e){return{point:{x:e.pageX,y:e.pageY}}}const jCe=e=>t=>ER(t)&&e(t,k0(t));function Lx(e,t,n,r){return Rb(e,t,jCe(n),r)}const sJ=({current:e})=>e?e.ownerDocument.defaultView:null,T8=(e,t)=>Math.abs(e-t);function _Ce(e,t){const n=T8(e.x,t.x),r=T8(e.y,t.y);return Math.sqrt(n**2+r**2)}const A8=new Set(["auto","scroll"]);class nJ{constructor(t,n,{transformPagePoint:r,contextWindow:a=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=m=>{this.handleScroll(m.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Oy(this.lastRawMoveEventInfo,this.transformPagePoint));const m=BN(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,x=_Ce(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!x)return;const{point:b}=m,{timestamp:y}=Kr;this.history.push({...b,timestamp:y});const{onStart:v,onMove:w}=this.handlers;g||(v&&v(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,m)},this.handlePointerMove=(m,g)=>{this.lastMoveEvent=m,this.lastRawMoveEventInfo=g,this.lastMoveEventInfo=Oy(g,this.transformPagePoint),pn.update(this.updatePoint,!0)},this.handlePointerUp=(m,g)=>{this.end();const{onEnd:x,onSessionEnd:b,resumeAnimation:y}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=BN(m.type==="pointercancel"?this.lastMoveEventInfo:Oy(g,this.transformPagePoint),this.history);this.startEvent&&x&&x(m,v),b&&b(m,v)},!ER(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=a||window;const c=k0(t),u=Oy(c,this.transformPagePoint),{point:d}=u,{timestamp:h}=Kr;this.history=[{...d,timestamp:h}];const{onSessionStart:p}=n;p&&p(t,BN(u,this.history)),this.removeListeners=w0(Lx(this.contextWindow,"pointermove",this.handlePointerMove),Lx(this.contextWindow,"pointerup",this.handlePointerUp),Lx(this.contextWindow,"pointercancel",this.handlePointerUp)),l&&this.startScrollTracking(l)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(A8.has(r.overflowX)||A8.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,a=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},i={x:a.x-n.x,y:a.y-n.y};i.x===0&&i.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(t,a),pn.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),fc(this.updatePoint)}}function Oy(e,t){return t?{point:t(e.point)}:e}function R8(e,t){return{x:e.x-t.x,y:e.y-t.y}}function BN({point:e},t){return{point:e,delta:R8(e,rJ(t)),offset:R8(e,kCe(t)),velocity:NCe(t,.1)}}function kCe(e){return e[0]}function rJ(e){return e[e.length-1]}function NCe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const a=rJ(e);for(;n>=0&&(r=e[n],!(a.timestamp-r.timestamp>Ni(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&a.timestamp-r.timestamp>Ni(t)*2&&(r=e[1]);const i=Gi(a.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(a.x-r.x)/i,y:(a.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function ECe(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?En(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?En(n,e,r.max):Math.min(e,n)),e}function I8(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function SCe(e,{top:t,left:n,bottom:r,right:a}){return{x:I8(e.x,n,a),y:I8(e.y,t,r)}}function P8(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function CCe(e,t){return{x:P8(e.x,t.x),y:P8(e.y,t.y)}}function TCe(e,t){let n=.5;const r=Ma(e),a=Ma(t);return a>r?n=Cb(t.min,t.max-r,e.min):r>a&&(n=Cb(e.min,e.max-a,t.min)),cl(0,1,n)}function ACe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const IA=.35;function RCe(e=IA){return e===!1?e=0:e===!0&&(e=IA),{x:L8(e,"left","right"),y:L8(e,"top","bottom")}}function L8(e,t,n){return{min:O8(e,t),max:O8(e,n)}}function O8(e,t){return typeof e=="number"?e:e[t]||0}const ICe=new WeakMap;class PCe{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=_r(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:a}=this.visualElement;if(a&&a.isPresent===!1)return;const i=h=>{n&&this.snapToCursor(k0(h).point),this.stopAnimation()},o=(h,p)=>{const{drag:m,dragPropagation:g,onDragStart:x}=this.getProps();if(m&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=iEe(m),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Wo(y=>{let v=this.getAxisMotionValue(y).get()||0;if(sl.test(v)){const{projection:w}=this.visualElement;if(w&&w.layout){const j=w.layout.layoutBox[y];j&&(v=Ma(j)*(parseFloat(v)/100))}}this.originPoint[y]=v}),x&&pn.update(()=>x(h,p),!1,!0),kA(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},l=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p;const{dragPropagation:m,dragDirectionLock:g,onDirectionLock:x,onDrag:b}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:y}=p;if(g&&this.currentDirection===null){this.currentDirection=OCe(y),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",p.point,y),this.updateAxis("y",p.point,y),this.visualElement.render(),b&&pn.update(()=>b(h,p),!1,!0)},c=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p,this.stop(h,p),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new nJ(t,{onSessionStart:i,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:sJ(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,a=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!a||!r)return;const{velocity:o}=a;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&pn.postRender(()=>l(r,a))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:a}=this.getProps();if(!r||!My(t,a,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=ECe(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,a=this.constraints;t&&em(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=SCe(r.layoutBox,t):this.constraints=!1,this.elastic=RCe(n),a!==this.constraints&&!em(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Wo(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=ACe(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!em(t))return!1;const r=t.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const i=OEe(r,a.root,this.visualElement.getTransformPagePoint());let o=CCe(a.layout.layoutBox,i);if(n){const l=n(IEe(o));this.hasMutatedConstraints=!!l,l&&(o=NX(l))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:a,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Wo(d=>{if(!My(d,n,this.currentDirection))return;let h=c&&c[d]||{};(o===!0||o===d)&&(h={min:0,max:0});const p=a?200:1e6,m=a?40:1e7,g={type:"inertia",velocity:r?t[d]:0,bounceStiffness:p,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return kA(this.visualElement,t),r.start(wR(t,r,0,n,this.visualElement,!1))}stopAnimation(){Wo(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),a=r[n];return a||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Wo(n=>{const{drag:r}=this.getProps();if(!My(n,r,this.currentDirection))return;const{projection:a}=this.visualElement,i=this.getAxisMotionValue(n);if(a&&a.layout){const{min:o,max:l}=a.layout.layoutBox[n],c=i.get()||0;i.set(t[n]-En(o,l,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!em(n)||!r||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};Wo(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();a[o]=TCe({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Wo(o=>{if(!My(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(En(c,u,a[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;ICe.set(this.visualElement,this);const t=this.visualElement.current,n=Lx(t,"pointerdown",u=>{const{drag:d,dragListener:h=!0}=this.getProps(),p=u.target,m=p!==t&&hEe(p);d&&h&&!m&&this.start(u)});let r;const a=()=>{const{dragConstraints:u}=this.getProps();em(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=LCe(t,u.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,o=i.addEventListener("measure",a);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),pn.read(a);const l=Rb(window,"resize",()=>this.scalePositionWithinConstraints()),c=i.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(Wo(h=>{const p=this.getAxisMotionValue(h);p&&(this.originPoint[h]+=u[h].translate,p.set(p.get()+u[h].translate))}),this.visualElement.render())}));return()=>{l(),n(),o(),c&&c(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:a=!1,dragConstraints:i=!1,dragElastic:o=IA,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:a,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function M8(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function LCe(e,t,n){const r=HD(e,M8(n)),a=HD(t,M8(n));return()=>{r(),a()}}function My(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function OCe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class MCe extends Uu{constructor(t){super(t),this.removeGroupControls=Qi,this.removeListeners=Qi,this.controls=new PCe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Qi}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const UN=e=>(t,n)=>{e&&pn.update(()=>e(t,n),!1,!0)};class DCe extends Uu{constructor(){super(...arguments),this.removePointerDownListener=Qi}onPointerDown(t){this.session=new nJ(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:sJ(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:a}=this.node.getProps();return{onSessionStart:UN(t),onStart:UN(n),onMove:UN(r),onEnd:(i,o)=>{delete this.session,a&&pn.postRender(()=>a(i,o))}}}mount(){this.removePointerDownListener=Lx(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let zN=!1;class $Ce extends f.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:a}=this.props,{projection:i}=t;i&&(n.group&&n.group.add(i),r&&r.register&&a&&r.register(i),zN&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),x1.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:a,isPresent:i}=this.props,{projection:o}=r;return o&&(o.isPresent=i,t.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),zN=!0,a||t.layoutDependency!==n||n===void 0||t.isPresent!==i?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||pn.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),NR.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:a}=t;zN=!0,a&&(a.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(a),r&&r.deregister&&r.deregister(a))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function aJ(e){const[t,n]=GX(),r=f.useContext(iR);return s.jsx($Ce,{...e,layoutGroup:r,switchLayoutGroup:f.useContext(eJ),isPresent:t,safeToRemove:n})}const FCe={pan:{Feature:DCe},drag:{Feature:MCe,ProjectionNode:VX,MeasureLayout:aJ}};function D8(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const a="onHover"+n,i=r[a];i&&pn.postRender(()=>i(t,k0(t)))}class BCe extends Uu{mount(){const{current:t}=this.node;t&&(this.unmount=lEe(t,(n,r)=>(D8(this.node,r,"Start"),a=>D8(this.node,a,"End"))))}unmount(){}}class UCe extends Uu{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=w0(Rb(this.node.current,"focus",()=>this.onFocus()),Rb(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function $8(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const a="onTap"+(n==="End"?"":n),i=r[a];i&&pn.postRender(()=>i(t,k0(t)))}class zCe extends Uu{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=mEe(t,(a,i)=>($8(this.node,i,"Start"),(o,{success:l})=>$8(this.node,o,l?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:r?.tap===!1})}unmount(){}}const PA=new WeakMap,HN=new WeakMap,HCe=e=>{const t=PA.get(e.target);t&&t(e)},qCe=e=>{e.forEach(HCe)};function WCe({root:e,...t}){const n=e||document;HN.has(n)||HN.set(n,{});const r=HN.get(n),a=JSON.stringify(t);return r[a]||(r[a]=new IntersectionObserver(qCe,{root:e,...t})),r[a]}function VCe(e,t,n){const r=WCe(t);return PA.set(e,n),r.observe(e),()=>{PA.delete(e),r.unobserve(e)}}const GCe={some:0,all:1};class YCe extends Uu{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:a="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof a=="number"?a:GCe[a]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),p=u?d:h;p&&p(c)};this.stopObserver=VCe(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(KCe(t,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function KCe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const XCe={inView:{Feature:YCe},tap:{Feature:zCe},focus:{Feature:UCe},hover:{Feature:BCe}},JCe={layout:{ProjectionNode:VX,MeasureLayout:aJ}},QCe={...wCe,...XCe,...FCe,...JCe},Dn=gCe(QCe,xCe);function iJ(e){const t=Gh(()=>Ah(e)),{isStatic:n}=f.useContext(K_);if(n){const[,r]=f.useState(e);f.useEffect(()=>t.on("change",r),[])}return t}function oJ(e,t){const n=iJ(t()),r=()=>n.set(t());return r(),oR(()=>{const a=()=>pn.preRender(r,!1,!0),i=e.map(o=>o.on("change",a));return()=>
64{i.forEach(o=>o()),fc(r)}}),n}function ZCe(e){Ix.current=[],e();const t=oJ(Ix.current,e);return Ix.current=void 0,t}function eTe(e,t,n,r){if(typeof e=="function")return ZCe(e);const i=typeof t=="function"?t:kEe(t,n,r),o=Array.isArray(e)?F8(e,i):F8([e],([c])=>i(c)),l=Array.isArray(e)?void 0:e.accelerate;return l&&!l.isTransformed&&typeof t!="function"&&Array.isArray(n)&&r?.clamp!==!1&&(o.accelerate={...l,times:t,keyframes:n,isTransformed:!0}),o}function F8(e,t){const n=Gh(()=>[]);return oJ(e,()=>{n.length=0;const r=e.length;for(let a=0;a<r;a++)n[a]=e[a].get();return t(n)})}function zu(){!AR.current&&jX();const[e]=f.useState(Hw.current);return e}const lJ=f.createContext(null);function tTe(e,t,n,r){if(!r)return e;const a=e.findIndex(d=>d.value===t);if(a===-1)return e;const i=r>0?1:-1,o=e[a+i];if(!o)return e;const l=e[a],c=o.layout,u=En(c.min,c.max,.5);return i===1&&l.layout.max+n>u||i===-1&&l.layout.min+n<u?s2e(e,a,a+i):e}function sTe({children:e,as:t="ul",axis:n="y",onReorder:r,values:a,...i},o){const l=Gh(()=>Dn[t]),c=[],u=f.useRef(!1),d=f.useRef(null),h={axis:n,groupRef:d,registerItem:(g,x)=>{const b=c.findIndex(y=>g===y.value);b!==-1?c[b].layout=x[n]:c.push({value:g,layout:x[n]}),c.sort(rTe)},updateOrder:(g,x,b)=>{if(u.current)return;const y=tTe(c,g,x,b);if(c!==y){u.current=!0;const v=[...a];for(let w=0;w<y.length;w++)if(c[w].value!==y[w].value){const j=a.indexOf(c[w].value),E=a.indexOf(y[w].value);j!==-1&&E!==-1&&([v[j],v[E]]=[v[E],v[j]]);break}r(v)}}};f.useEffect(()=>{u.current=!1});const p=g=>{d.current=g,typeof o=="function"?o(g):o&&(o.current=g)},m={overflowAnchor:"none",...i.style};return s.jsx(l,{...i,style:m,ref:p,ignoreStrict:!0,children:s.jsx(lJ.Provider,{value:h,children:e})})}const nTe=f.forwardRef(sTe);function rTe(e,t){return e.layout.min-t.layout.min}const Dy=50,B8=25,aTe=new Set(["auto","scroll"]),Ox=new WeakMap,Mx=new WeakMap;let ax=null;function iTe(){if(ax){const e=LA(ax,"y");e&&(Mx.delete(e),Ox.delete(e));const t=LA(ax,"x");t&&t!==e&&(Mx.delete(t),Ox.delete(t)),ax=null}}function oTe(e,t){const n=getComputedStyle(e),r=t==="x"?n.overflowX:n.overflowY,a=e===document.body||e===document.documentElement;return aTe.has(r)||a}function LA(e,t){let n=e?.parentElement;for(;n;){if(oTe(n,t))return n;n=n.parentElement}return null}function lTe(e,t,n){const r=t.getBoundingClientRect(),a=n==="x"?Math.max(0,r.left):Math.max(0,r.top),i=n==="x"?Math.min(window.innerWidth,r.right):Math.min(window.innerHeight,r.bottom),o=e-a,l=i-e;if(o<Dy){const c=1-o/Dy;return{amount:-B8*c*c,edge:"start"}}else if(l<Dy){const c=1-l/Dy;return{amount:B8*c*c,edge:"end"}}return{amount:0,edge:null}}function cTe(e,t,n,r){if(!e)return;ax=e;const a=LA(e,n);if(!a)return;const i=t-(n==="x"?window.scrollX:window.scrollY),{amount:o,edge:l}=lTe(i,a,n);if(l===null){Mx.delete(a),Ox.delete(a);return}const c=Mx.get(a),u=a===document.body||a===document.documentElement;if(c!==l){if(!(l==="start"&&r<0||l==="end"&&r>0))return;Mx.set(a,l);const h=n==="x"?a.scrollWidth-(u?window.innerWidth:a.clientWidth):a.scrollHeight-(u?window.innerHeight:a.clientHeight);Ox.set(a,h)}if(o>0){const d=Ox.get(a);if((n==="x"?u?window.scrollX:a.scrollLeft:u?window.scrollY:a.scrollTop)>=d)return}n==="x"?u?window.scrollBy({left:o}):a.scrollLeft+=o:u?window.scrollBy({top:o}):a.scrollTop+=o}function U8(e,t=0){return zr(e)?e:iJ(t)}function uTe({children:e,style:t={},value:n,as:r="li",onDrag:a,onDragEnd:i,layout:o=!0,...l},c){const u=Gh(()=>Dn[r]),d=f.useContext(lJ),h={x:U8(t.x),y:U8(t.y)},p=eTe([h.x,h.y],([y,v])=>y||v?1:"unset"),{axis:m,registerItem:g,updateOrder:x,groupRef:b}=d;return s.jsx(u,{drag:m,...l,dragSnapToOrigin:!0,style:{...t,x:h.x,y:h.y,zIndex:p},layout:o,onDrag:(y,v)=>{const{velocity:w,point:j}=v,E=h[m].get();x(n,E,w[m]),cTe(b.current,j[m],m,w[m]),a&&a(y,v)},onDragEnd:(y,v)=>{iTe(),i&&i(y,v)},onLayoutMeasure:y=>{g(n,y)},ref:c,ignoreStrict:!0,children:e})}const dTe=f.forwardRef(uTe);function b1(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?b1=function(t){return typeof t}:b1=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b1(e)}var cJ="dahlia",hTe=function(t){return t===3?"v3":t},uJ="https://js.stripe.com",pTe="".concat(uJ,"/").concat(cJ,"/stripe.js"),mTe=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,fTe=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;var gTe=function(t){return mTe.test(t)||fTe.test(t)},xTe=function(){for(var t=document.querySelectorAll('script[src^="'.concat(uJ,'"]')),n=0;n<t.length;n++){var r=t[n];if(gTe(r.src))return r}return null},z8=function(t){var n="",r=document.createElement("script");r.src="".concat(pTe).concat(n);var a=document.head||document.body;if(!a)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return a.appendChild(r),r},bTe=function(t,n){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"9.10.0",startTime:n})},jg=null,$y=null,Fy=null,yTe=function(t){return function(n){t(new Error("Failed to load Stripe.js",{cause:n}))}},vTe=function(t,n){return function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))}},wTe=function(t){return jg!==null?jg:(jg=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe){n(window.Stripe);return}try{var a=xTe();if(!(a&&t)){if(!a)a=z8(t);else if(a&&Fy!==null&&$y!==null){var i;a.removeEventListener("load",Fy),a.removeEventListener("error",$y),(i=a.parentNode)===null||i===void 0||i.removeChild(a),a=z8(t)}}Fy=vTe(n,r),$y=yTe(r),a.addEventListener("load",Fy),a.addEventListener("error",$y)}catch(o){r(o);return}}),jg.catch(function(n){return jg=null,Promise.reject(n)}))},jTe=function(t,n,r){if(t===null)return null;var a=n[0];if(typeof a!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(b1(a)," instead."));var i=a.match(/^pk_test/),o=hTe(t.version),l=cJ;i&&o!==l&&console.warn("Stripe.js@".concat(o," was loaded on the page, but @stripe/stripe-js@").concat("9.10.0"," expected Stripe.js@").concat(l,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var c=t.apply(void 0,n);return bTe(c,r),c}
64,_g,dJ=!1,hJ=function(){return _g||(_g=wTe(null).catch(function(t){return _g=null,Promise.reject(t)}),_g)};Promise.resolve().then(function(){return hJ()}).catch(function(e){dJ||console.warn(e)});var _Te=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];dJ=!0;var a=Date.now();return hJ().then(function(i){return jTe(i,n,a)})};function H8(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function kTe(e){if(Array.isArray(e))return e}function pJ(e,t,n){return(t=ATe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function NTe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function ETe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 65In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function q8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function W8(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?q8(Object(n),!0).forEach(function(r){pJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q8(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function STe(e,t){if(e==null)return{};var n,r,a=CTe(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function CTe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function mJ(e,t){return kTe(e)||NTe(e,t)||RTe(e,t)||ETe()}function TTe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ATe(e){var t=TTe(e,"string");return typeof t=="symbol"?t:t+""}function OA(e){"@babel/helpers - typeof";return OA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},OA(e)}function RTe(e,t){if(e){if(typeof e=="string")return H8(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H8(e,t):void 0}}var ia=function(t,n,r){var a=!!r,i=B.useRef(r);B.useEffect(function(){i.current=r},[r]),B.useEffect(function(){if(!a||!t)return function(){};var o=function(){if(i.current)return i.current.apply(i,arguments)};return t.on(n,o),function(){t.off(n,o)}},[a,n,t,i])},MA=function(t){var n=B.useRef(t);return B.useEffect(function(){n.current=t},[t]),n.current},ef=function(t){return t!==null&&OA(t)==="object"},ITe=function(t){return ef(t)&&typeof t.then=="function"},PTe=function(t){return ef(t)&&typeof t.elements=="function"&&typeof t.createToken=="function"&&typeof t.createPaymentMethod=="function"&&typeof t.confirmCardPayment=="function"},V8="[object Object]",LTe=function e(t,n){if(!ef(t)||!ef(n))return t===n;var r=Array.isArray(t),a=Array.isArray(n);if(r!==a)return!1;var i=Object.prototype.toString.call(t)===V8,o=Object.prototype.toString.call(n)===V8;if(i!==o)return!1;if(!i&&!r)return t===n;var l=Object.keys(t),c=Object.keys(n);if(l.length!==c.length)return!1;for(var u={},d=0;d<l.length;d+=1)u[l[d]]=!0;for(var h=0;h<c.length;h+=1)u[c[h]]=!0;var p=Object.keys(u);if(p.length!==l.length)return!1;var m=t,g=n,x=function(y){return e(m[y],g[y])};return p.every(x)},OTe=function(t,n,r){return ef(t)?Object.keys(t).reduce(function(a,i){var o=!ef(n)||!LTe(t[i],n[i]);return r.includes(i)?(o&&console.warn("Unsupported prop change: options.".concat(i," is not a mutable property.")),a):o?W8(W8({},a||{}),{},pJ({},i,t[i])):a},null):null},fJ="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",G8=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fJ;if(t===null||PTe(t))return t;throw new Error(n)},MTe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fJ;if(ITe(t))return{tag:"async",stripePromise:Promise.resolve(t).then(function(a){return G8(a,n)})};var r=G8(t,n);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},DTe=function(t){!t||!t._registerWrapper||!t.registerAppInfo||(t._registerWrapper({name:"react-stripe-js",version:"6.8.0"}),t.registerAppInfo({name:"react-stripe-js",version:"6.8.0",url:"https://stripe.com/docs/stripe-js/react"}))},gJ=B.createContext(null);gJ.displayName="ElementsContext";var $Te=function(t,n){if(!t)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(n," in an <Elements> provider."));return t};Qt.any,Qt.object;Qt.func.isRequired;var xJ=B.createContext(null);xJ.displayName="CheckoutContext";var Y8=function(t){var n=B.useContext(xJ),r=B.useContext(gJ);if(n){if(r)throw new Error("You cannot wrap the part of your app that ".concat(t," in both a checkout provider and <Elements> provider."));return n}else return $Te(r,t)},FTe=["mode"],BTe=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},Qn=function(t,n,r){var a="".concat(BTe(t),"Element"),i=function(u){var d=u.id,h=u.className,p=u.options,m=p===void 0?{}:p,g=u.onBlur,x=u.onFocus,b=u.onReady,y=u.onChange,v=u.onEscape,w=u.onClick,j=u.onLoadError,E=u.onLoaderStart,S=u.onNetworksChange,_=u.onConfirm,k=u.onCancel,C=u.onShippingAddressChange,N=u.onShippingRateChange,A=u.onSavedPaymentMethodRemove,T=u.onSavedPaymentMethodUpdate,I=u.onAvailablePaymentMethodsChange,$=Y8("mounts <".concat(a,">")),O="elements"in $?$.elements:null,U="checkoutState"in $?$.checkoutState:null,F=U?.type==="success"||U?.type==="loading"?U.sdk:null,H=B.use
65State(null),G=mJ(H,2),M=G[0],z=G[1],W=B.useRef(null),D=B.useRef(null);ia(M,"blur",g),ia(M,"focus",x),ia(M,"escape",v),ia(M,"click",w),ia(M,"loaderror",j),ia(M,"loaderstart",E),ia(M,"networkschange",S),ia(M,"confirm",_),ia(M,"cancel",k),ia(M,"shippingaddresschange",C),ia(M,"shippingratechange",N),ia(M,"savedpaymentmethodremove",A),ia(M,"savedpaymentmethodupdate",T),ia(M,"availablepaymentmethodschange",I),ia(M,"change",y);var Z;b&&(t==="expressCheckout"?Z=b:Z=function(){b(M)}),ia(M,"ready",Z),B.useLayoutEffect(function(){if(W.current===null&&D.current!==null&&(O||F)){var L=null;if(F){var K=F,te=F;switch(t){case"paymentForm":L=te.createForm(m);break;case"payment":L=K.createPaymentElement(m);break;case"address":if("mode"in m){var Q=m.mode,Y=STe(m,FTe);if(Q==="shipping")L=K.createShippingAddressElement(Y);else if(Q==="billing")L=K.createBillingAddressElement(Y);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":L=K.createExpressCheckoutElement(m);break;case"currencySelector":L=F.createCurrencySelectorElement();break;case"taxId":L=K.createTaxIdElement(m);break;case"contactDetails":L=K.createContactDetailsElement();break;case"terms":L=K.createTermsElement(m);break;default:throw new Error("<".concat(a,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else O&&(L=O.create(t,m));W.current=L,z(L),L&&L.mount(D.current)}},[O,F,m]);var V=MA(m);return B.useEffect(function(){if(W.current){var L=OTe(m,V,["paymentRequest"]);L&&"update"in W.current&&W.current.update(L)}},[m,V]),B.useLayoutEffect(function(){return function(){if(W.current&&typeof W.current.destroy=="function")try{W.current.destroy(),W.current=null}catch{}}},[]),B.createElement("div",{id:d,className:h,ref:D})},o=function(u){Y8("mounts <".concat(a,">"));var d=u.id,h=u.className;return B.createElement("div",{id:d,className:h})},l=n?o:i;return l.propTypes={id:Qt.string,className:Qt.string,onChange:Qt.func,onBlur:Qt.func,onFocus:Qt.func,onReady:Qt.func,onEscape:Qt.func,onClick:Qt.func,onLoadError:Qt.func,onLoaderStart:Qt.func,onNetworksChange:Qt.func,onConfirm:Qt.func,onCancel:Qt.func,onShippingAddressChange:Qt.func,onShippingRateChange:Qt.func,onSavedPaymentMethodRemove:Qt.func,onSavedPaymentMethodUpdate:Qt.func,onAvailablePaymentMethodsChange:Qt.func,options:Qt.object},l.displayName=a,l.__elementType=t,l},Vn=typeof window>"u",OR=B.createContext(null);OR.displayName="EmbeddedCheckoutProviderContext";var bJ=function(){var t=B.useContext(OR);if(!t)throw new Error("<EmbeddedCheckout> must be used within <EmbeddedCheckoutProvider>");return t},UTe="Invalid prop `stripe` supplied to `EmbeddedCheckoutProvider`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",zTe=function(t){var n=t.stripe,r=t.options,a=t.children,i=B.useMemo(function(){return MTe(n,UTe)},[n]),o=B.useRef(null),l=B.useRef(null),c=B.useState({embeddedCheckout:null}),u=mJ(c,2),d=u[0],h=u[1];B.useEffect(function(){if(!(l.current||o.current)){var g=function(b){l.current||o.current||(l.current=b,o.current=l.current.createEmbeddedCheckoutPage(r).then(function(y){h({embeddedCheckout:y})}))};i.tag==="async"&&!l.current&&(r.clientSecret||r.fetchClientSecret)?i.stripePromise.then(function(x){x&&g(x)}):i.tag==="sync"&&!l.current&&(r.clientSecret||r.fetchClientSecret)&&g(i.stripe)}},[i,r,d,l]),B.useEffect(function(){return function(){d.embeddedCheckout?(o.current=null,d.embeddedCheckout.destroy()):o.current&&o.current.then(function(){o.current=null,d.embeddedCheckout&&d.embeddedCheckout.destroy()})}},[d.embeddedCheckout]),B.useEffect(function(){DTe(l)},[l]);var p=MA(n);B.useEffect(function(){p!==null&&p!==n&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the `stripe` prop after setting it.")},[p,n]);var m=MA(r);return B.useEffect(function(){if(m!=null){if(r==null){console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot unset options after setting them.");return}r.clientSecret===void 0&&r.fetchClientSecret===void 0&&console.warn("Invalid props passed to EmbeddedCheckoutProvider: You must provide one of either `options.fetchClientSecret` or `options.clientSecret`."),m.clientSecret!=null&&r.clientSecret!==m.clientSecret&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the client secret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead."),m.fetchClientSecret!=null&&r.fetchClientSecret!==m.fetchClientSecret&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change fetchClientSecret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead."),m.onComplete!=null&&r.onComplete!==m.onComplete&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onComplete option after setting it."),m.onShippingDetailsChange!=null&&r.onShippingDetailsChange!==m.onShippingDetailsChange&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onShippingDetailsChange option after setting it."),m.onLineItemsChange!=null&&r.onLineItemsChange!==m.onLineItemsChange&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onLineItemsChange option after setting it.")}},[m,r]),B.createElement(OR.Provider,{value:d},a)},HTe=function(t){var n=t.id,r=t.className,a=bJ(),i=a.embeddedCheckout,o=B.useRef(!1),l=B.useRef(null);return B.useLayoutEffect(function(){return!o.current&&i&&l.current!==null&&(i.mount(l.current),o.current=!0),function(){if(o.current&&i)try{i.unmount(),o.current=!1}catch{}}},[i]),B.createElement("div",{ref:l,id:n,className:r})},qTe=function(t){var n=t.id,r=t.className;return bJ(),B.createElement("div",{id:n,className:r})},WTe=Vn?qTe:HTe;Qn("auBankAccount",Vn);Qn("card",Vn);Qn("cardNumber",Vn);Qn("cardExpiry",Vn);Qn("cardCvc",Vn);Qn("currencySelector",Vn);Qn("iban",Vn);Qn("payment",Vn);Qn("expressCheckout",Vn);Qn("paymentRequestButton",Vn);Qn("linkAuthentication",Vn);Qn("contactDetails",Vn);Qn("address",Vn);Qn("shippingAddress",Vn);Qn("paymentMethodMessaging",Vn);Qn("taxId",Vn);
65Qn("issuingCardNumberDisplay",Vn);Qn("issuingCardCvcDisplay",Vn);Qn("issuingCardExpiryDisplay",Vn);Qn("issuingCardPinDisplay",Vn);Qn("issuingCardCopyButton",Vn);Qn("terms",Vn);function MR({clientSecret:e,sessionId:t,publishableKey:n,onComplete:r,onClose:a,title:i="Complete payment"}){const[o,l]=f.useState(!1),c=f.useMemo(()=>n?_Te(n):null,[n]),u=f.useCallback(async()=>{if(!(!t||o)){l(!0);try{await r?.(t)}finally{l(!1)}}},[t,r,o]);return!e||!n||!c?null:s.jsxs("div",{className:"fixed inset-0 z-[100] flex items-end sm:items-center justify-center p-0 sm:p-4",children:[s.jsx("button",{type:"button","aria-label":"Close checkout",className:"absolute inset-0 bg-ink/50 backdrop-blur-[2px]",onClick:a,disabled:o}),s.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"embedded-checkout-title",className:"relative w-full sm:max-w-lg max-h-[92vh] sm:max-h-[90vh] flex flex-col rounded-t-2xl sm:rounded-2xl bg-paper border border-rule shadow-overlay overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 border-b border-rule shrink-0",children:[s.jsx("h2",{id:"embedded-checkout-title",className:"font-heading text-base font-semibold text-ink",children:i}),s.jsx("button",{type:"button",onClick:a,disabled:o,className:"p-1.5 rounded-lg text-ink-mid hover:text-ink hover:bg-cream-deep transition-colors disabled:opacity-50","aria-label":"Close",children:s.jsx(as,{className:"w-5 h-5"})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 px-1 sm:px-2 py-2",children:o?s.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-16 text-ink-mid",children:[s.jsx(vt,{className:"w-8 h-8 animate-spin text-indigo"}),s.jsx("p",{className:"text-sm",children:"Confirming your planâ¦"})]}):s.jsx(zTe,{stripe:c,options:{clientSecret:e,onComplete:u},children:s.jsx(WTe,{})})})]})]})}async function VTe(){return(await Se.get("/creator/subscription/usage")).data}async function DR(e){return(await Se.post("/creator/subscription/start-trial",{plan:e})).data}async function $R(e,t="monthly"){return(await Se.post("/creator/subscription/checkout",{plan:e,billing:t})).data}async function yJ(e){return(await Se.post("/creator/subscription/checkout/confirm",{session_id:e})).data}async function Eu(){return(await Se.get("/creator/subscription")).data}async function vJ(){return(await Se.post("/creator/subscription/cancel")).data}async function wJ(e,t=null,n="monthly"){return(await Se.post("/creator/subscription/change-plan",{plan:e,billing:n,keep_expert_ids:t})).data}async function GTe(){return(await Se.get("/creator/embedded-experts")).data}function jJ({addToast:e,onPaid:t,title:n="Start your plan"}={}){const[r,a]=f.useState(null),[i,o]=f.useState(!1),l=f.useCallback(async(h,p="monthly")=>{if(!i){o(!0);try{const m=await $R(h,p),g=m?.data||m;if(!g?.client_secret||!g?.session_id||!g?.publishable_key)throw new Error("Checkout could not be prepared. Please try again.");a({clientSecret:g.client_secret,sessionId:g.session_id,publishableKey:g.publishable_key})}catch(m){const g=m?.response?.data?.detail;if(g?.code==="CHECKOUT_REJECTED"&&/active plan/i.test(g?.message||"")){e?.("You're all set. Your plan is already active.","success");try{t?.((await Eu()).data)}catch{}}else e?.(g?.message||(g?.code==="PAYMENTS_DISABLED"?"Payments are not available right now.":m?.message||"Could not start checkout."),"error")}finally{o(!1)}}},[i,e,t]),c=f.useCallback(()=>a(null),[]),u=f.useCallback(async h=>{try{const p=await yJ(h);a(null),e?.("Payment received. Your plan is active.","success"),t?.(p?.data)}catch(p){a(null),e?.(p?.response?.data?.detail?.message||"Payment received. Your plan will show as active in a moment.","info"),t?.(null)}},[e,t]),d=r?s.jsx(MR,{clientSecret:r.clientSecret,sessionId:r.sessionId,publishableKey:r.publishableKey,title:n,onComplete:u,onClose:c}):null;return{open:l,busy:i,modal:d,isOpen:!!r}}const YTe=new Set(["lite","starter","pro"]);Tm.filter(e=>YTe.has(e.id));const J_=e=>{const t=e==="practitioner"?"starter":e;return Tm.find(n=>n.id===t)||Tm[0]},_J="ge.trialNudge.snoozedUntil",K8=3;function KTe(e=Date.now()){const t=new Date(e);return t.setHours(24,0,0,0),t.getTime()}function XTe(e,t=Date.now(),n=0){if(!e||e.unlimited)return null;const r=e.trial||{};return!r.used||e.active&&!r.active||n>t?null:e.active?(Number.isFinite(r.days_left)?r.days_left:K8+1)<=K8?"urgent":"running":r.expired?"expired":null}function JTe(e=globalThis.localStorage){try{const t=e?.getItem(_J),n=t?Number(t):0;return Number.isFinite(n)?n:0}catch{return 0}}function QTe(e=Date.now(),t=globalThis.localStorage){try{t?.setItem(_J,String(KTe(e)))}catch{}}
65function ZTe(e,t=7){const n=Number.isFinite(e?.days_left)?Math.max(0,Math.min(t,e.days_left)):t;return(t-n)/t}const eAe=new Set([Me.CREATE_EXPERT,Me.PRICING,"/myaccount/subscriptions","/checkout/success","/checkout/cancel"]),tAe=7,DA=26,X8=2*Math.PI*DA;function sAe(e,t,n){const r=Cx(t.ends_at),a=Math.max(0,Math.round(t.days_left??0));return e==="expired"?{title:"Your trial has ended",body:`Your expert is on the Free plan now. Start ${n.name} and everything picks up where it left off.`,cta:`Pay for ${n.name}`,count:null}:e==="urgent"?{title:a<=1?"Last day of your trial":`${a} days left on your trial`,body:`Start your ${n.name} plan before ${r} and your expert stays live, with nothing to set up again.`,cta:`Pay for ${n.name}`,count:a}:{title:`You're on the ${n.name} trial`,body:`Everything is unlocked until ${r}. Start your plan today and nothing changes on that date.`,cta:`Pay for ${n.name}`,count:a}}function nAe(){const{addToast:e}=f.useContext(Zs),t=an(),n=zu(),[r,a]=f.useState(null),[i,o]=f.useState(()=>JTe()>Date.now()),l=f.useCallback(()=>{Eu().then(y=>a(y?.data||null)).catch(()=>a(null))},[]);f.useEffect(()=>{l()},[l]);const c=f.useCallback(y=>{y?a(y):l()},[l]),u=jJ({addToast:e,onPaid:c,title:"Start your plan"}),h=eAe.has(t.pathname)?null:XTe(r,0,i?1:0),p=r?.trial||{},m=J_(p.plan||r?.plan||"starter"),g=()=>{QTe(),o(!0)},x=h?sAe(h,p,m):null,b=ZTe(p,tAe);return s.jsxs(s.Fragment,{children:[s.jsx(Ei,{children:h&&x&&s.jsxs(Dn.aside,{className:`trial-nudge trial-nudge--${h}`,role:"status","aria-live":"polite",initial:n?{opacity:0}:{opacity:0,y:28},animate:{opacity:1,y:0},exit:n?{opacity:0}:{opacity:0,y:16},transition:{duration:.42,ease:[.16,1,.3,1]},children:[s.jsx("button",{type:"button",className:"trial-nudge__close",onClick:g,"aria-label":"Not now",children:s.jsx(as,{size:15,"aria-hidden":"true"})}),s.jsxs("div",{className:"trial-nudge__row",children:[x.count!==null?s.jsxs("div",{className:"trial-nudge__dial","aria-hidden":"true",children:[s.jsxs("svg",{viewBox:"0 0 64 64",width:"64",height:"64",children:[s.jsx("circle",{cx:"32",cy:"32",r:DA,className:"trial-nudge__track"}),s.jsx("circle",{cx:"32",cy:"32",r:DA,className:"trial-nudge__arc",strokeDasharray:X8,strokeDashoffset:X8*b})]}),s.jsx("span",{className:"trial-nudge__num",children:x.count})]}):s.jsx("div",{className:"trial-nudge__dial trial-nudge__dial--flat","aria-hidden":"true",children:s.jsx("span",{className:"trial-nudge__num",children:"0"})}),s.jsxs("div",{className:"trial-nudge__text",children:[s.jsx("h2",{className:"trial-nudge__title",children:x.title}),s.jsx("p",{className:"trial-nudge__body",children:x.body})]})]}),s.jsxs("button",{type:"button",className:"trial-nudge__cta",onClick:()=>u.open(m.id),disabled:u.busy,children:[s.jsx("span",{className:"trial-nudge__cta-label",children:u.busy?"Opening checkout":x.cta}),s.jsxs("span",{className:"trial-nudge__cta-price",children:[m.monthly,"/mo ",s.jsx(xn,{size:16,"aria-hidden":"true"})]})]}),s.jsxs("p",{className:"trial-nudge__fine",children:["Billed monthly from today. Cancel anytime."," ",s.jsx(Le,{className:"trial-nudge__link",to:"/myaccount/subscriptions",children:"Compare or switch plans"})]})]},h)}),u.modal]})}function Yh(){const{user:e}=Ut(),[t,n]=f.useState(null),r=e?.username||e?.slug||(e?.id&&t?.id===e.id?t.username:"");f.useEffect(()=>{if(e?.username||e?.slug||!e?.id)return;let i=!1;return q_().then(o=>{i||n({id:e.id,username:o?.data?.user?.username||o?.data?.user?.slug||""})}).catch(()=>{}),()=>{i=!0}},[e?.username,e?.slug,e?.id]);const a=f.useMemo(()=>({id:e?.id,username:r,full_name:e?.full_name}),[e?.id,e?.full_name,r]);return{slug:r,username:r,creator:a}}const rAe=[/^\/experts\/[^/]+\/chat(\/[^/]+)?$/];function aAe(e){return rAe.some(t=>t.test(e))}const iAe=[/^\/profile(\/|$)/,/^\/experts\/[^/]+\/edit/,/^\/experts\/new/];function oAe(e){return e===Me.PROFILE||e.startsWith(`${Me.PROFILE}/`)||iAe.some(t=>t.test(e))}const lAe=["/dashboard/creator",Me.LEADS,Me.PROFILE,"/myaccount/subscriptions",`${Me.LAB}/experts`];function cAe(){const[e,t]=f.useState(null),[n,r]=f.useState(!0),[a,i]=f.useState(!1),o=an(),l=aAe(o.pathname),c=o.pathname===Me.CREATE_EXPERT,u=o.pathname===Me.DASHBOARD,d=o.pathname===Me.PROFILE,h=o.pathname===Me.PUBLIC_PAGE,p=u||lAe.includes(o.pathname),g=o.pathname==="/"||o.pathname===Me.PRICING,[x,b]=f.useState(null),[y,v]=f.useState(!1),[w,j]=f.useState(0),E=f.useRef(o.pathname),S=f.useCallback(Z=>{b(Z),Z&&(v(!0),oAe(E.current)&&j(V=>V+1))},[]);f.useEffect(()=>{E.current=o.pathname},[o.pathname]);const{creator:_}=Yh(),{fetchExperts:k}=jc(),{user:C}=Ut(),N=e===o.pathname;f.useEffect(()=>{C&&k().catch(()=>{})},[C]),f.useEffect(()=>{if(!C)return;const Z=sessionStorage.getItem("wizard_draft_expert_id");Z&&o.pathname!==Me.CREATE_EXPERT&&(T_(Z).catch(()=>{}),sessionStorage.removeItem("wizard_draft_expert_id"))},[C]);const A=f.useRef(null),T=f.useRef(null),I=f.useRef(new Map);f.useEffect(()=>{const Z=T.current,V=A.current;if(!Z||!V)return;const L=new IntersectionObserver(([K])=>i(!K.isIntersecting),{root:V});return L.observe(Z),()=>L.disconnect()},[]),f.useLayoutEffect(()=>{const Z=A.current;if(!Z)return;const{key:V}=o;Z.scrollTo({top:I.current.get(V)??0,behavior:"instant"});const L=()=>I.current.set(V,Z.scrollTop);return Z.addEventListener("scroll",L,{passive:!0}),()=>Z.removeEventListener("scroll",L)},[o.key]);
65const $=h||n?"rail":"expanded",O=()=>t(Z=>Z===o.pathname?null:o.pathname),U=()=>{t(null),r(!0)},F=()=>r(Z=>!Z),H=f.useCallback(()=>j(Z=>Z+1),[]),G={onMenuClick:O,onToggleDesktop:F,registerPreviewSlot:S,refreshPreview:H},M=PY.includes(o.pathname),z=!!C&&o.pathname===Me.PRICING&&new URLSearchParams(o.search).has("for"),W=(!M||z)&&!c,D=W?h?"lg:pl-4":"lg:pl-5":"lg:pl-0";return s.jsxs("div",{className:`relative h-[100dvh] flex overflow-hidden safe-area-top ${p?"ge-page-wash":"bg-paper"}`,children:[s.jsx(e2e,{}),C&&s.jsx(nAe,{}),W&&s.jsx(Ske,{isOpen:N,onClose:U,mode:$,onToggleDesktop:F,overlay:h}),s.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${p?"bg-transparent":"bg-paper"}`,children:l?s.jsx("div",{className:`flex flex-col flex-1 min-h-0 bg-paper p-0 sm:p-2 ${D}`,children:s.jsx(vh,{context:G})}):s.jsx("div",{className:`relative flex flex-col flex-1 min-h-0 p-0 ${p?"bg-transparent":"bg-paper"} ${M?D:`sm:p-2 ${D}`}`,children:s.jsxs("div",{className:`dashboard-content-panel relative flex flex-col flex-1 min-h-0 ${p?"bg-transparent":"bg-paper"} ${c?"overflow-x-visible overflow-y-hidden":"overflow-hidden"} ${M?"":"rounded-xl border border-rule shadow-card"}`,children:[s.jsx(Dke,{onMenuClick:W?O:void 0,scrolled:a}),s.jsxs("main",{ref:A,className:`relative flex-1 p-4 lg:p-6 overflow-y-auto overscroll-contain no-scrollbar ${c?"overflow-x-visible":"overflow-x-clip"} ${u?"pt-3 lg:pt-4 short:pt-2":""} ${g?"-mt-14 pt-14 scroll-smooth lg:mt-0 lg:pt-0":""}`,children:[s.jsx("div",{ref:T,"aria-hidden":"true",className:"h-px w-full"}),s.jsx("div",{className:c||M?"w-full":`mx-auto ${u?"max-w-6xl xl:max-w-[84rem]":"max-w-6xl"} ${d?"h-full":""}`,children:s.jsx(vh,{context:G},o.pathname)}),y&&s.jsx($ke,{slot:x,creator:_,containerRef:A,nonce:w})]})]})})})]})}
65const ix=new Map,$A=new Set,kJ=new Set;let NJ=[];const y1=()=>{NJ=[...ix.values()],$A.forEach(e=>e())},uAe=e=>($A.add(e),()=>$A.delete(e)),dAe=()=>NJ,hAe=[],pAe=()=>hAe;function FA(e,{expertId:t,userId:n},r){if(ix.get(e)?.status==="learning")return ix.get(e).promise;const a={key:e,expertId:t,userId:n,status:"learning",promise:null};return ix.set(e,a),a.promise=Promise.resolve().then(r).then(()=>{ix.delete(e),y1()},i=>{a.status="failed",a.error=i?.message||"Some content could not be processed.",y1()}),y1(),a.promise}function mAe(e,t,n,r){return FA(`connector:${t}`,{expertId:e,userId:n},async()=>{let a=!1;for(;;){const i=(await Xm(e,t)).data;if(i?.result?.profile_media_ready&&!a)try{await r?.(),window.dispatchEvent(new CustomEvent("profile-media-ready",{detail:{userId:n}})),a=!0}catch{}if(i?.status==="completed")return;if(i?.status==="failed")throw new Error(i.message||"Content import failed.");await new Promise(o=>setTimeout(o,3e3))}})}function fAe(e){kJ.add(e),y1()}const gAe=e=>kJ.has(e);function xAe(){const{user:e}=Ut(),n=f.useSyncExternalStore(uAe,dAe,pAe).filter(i=>i.userId===e?.id&&gAe(i.expertId));if(!n.length)return null;const r=n.find(i=>i.status==="learning"),a=r||n[0];return s.jsxs("div",{role:"status",className:"fixed bottom-[max(1rem,env(safe-area-inset-bottom))] left-1/2 z-[10060] flex w-[calc(100%-2rem)] max-w-md -translate-x-1/2 items-center gap-3 rounded-2xl border border-black/10 bg-white py-2 pl-4 pr-2 text-sm text-ink shadow-lg sm:w-max sm:rounded-full",children:[r&&s.jsx(vt,{size:16,className:"shrink-0 animate-spin motion-reduce:animate-none","aria-hidden":"true"}),s.jsx("span",{className:"min-w-0 flex-1 leading-snug",children:r?"Learning from your contentâ¦":"Some content needs attention."}),s.jsx(Le,{className:"inline-flex min-h-[44px] shrink-0 items-center justify-center whitespace-nowrap rounded-xl bg-indigo/5 px-3 font-semibold text-indigo focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo sm:rounded-full",to:r?`/experts/${a.expertId}/chat`:`/experts/${a.expertId}/edit`,children:r?"Chat now":"Review"})]})}const J8={success:"border-l-indigo",error:"border-l-destructive",info:"border-l-ink"},Q8={success:"text-indigo-deep",error:"text-destructive",info:"text-ink-mid"},bAe={success:Aw,error:Co,info:al};function yAe(){const{toasts:e,removeToast:t}=f.useContext(Zs);return e.length?s.jsx("div",{className:"fixed top-4 right-4 z-50 flex flex-col gap-2 w-80",children:e.map(n=>{const r=bAe[n.type]||al;return s.jsxs("div",{className:`bg-paper rounded-lg shadow-overlay border border-rule border-l-4 ${J8[n.type]||J8.info} p-4 flex items-start gap-3 animate-in slide-in-from-right`,children:[s.jsx(r,{className:`w-5 h-5 shrink-0 mt-0.5 ${Q8[n.type]||Q8.info}`}),s.jsx("p",{className:"text-sm flex-1 text-ink",children:n.message}),s.jsx("button",{onClick:()=>t(n.id),className:"text-ink-light hover:text-ink-mid","aria-label":"Dismiss",children:s.jsx(as,{className:"w-4 h-4"})})]},n.id)})}):null}function vAe(e){if(!e)return!1;const t=(e.message||String(e)).toLowerCase();return t.includes("is not valid json")||t.includes("unexpected end of json input")||t.includes("unexpected token '<'")||t.includes("<!doctype")||t.includes("failed to fetch dynamically imported module")||t.includes("error loading dynamically imported module")||t.includes("importing a module script failed")}const Z8="gs:stale-deploy-attempts";function wAe(){let e=0;try{e=Number(sessionStorage.getItem(Z8))||0}catch{}e+=1;try{sessionStorage.setItem(Z8,String(e))}catch{}return e===1?0:e===2?1500:e===3?3e3:e===4?6e3:e===5?12e3:3e4}function jAe(){const e=Sq(),t=!yh(e)&&vAe(e);if(f.useEffect(()=>{if(!t)return;const r=setTimeout(()=>window.location.reload(),wAe());return()=>clearTimeout(r)},[t]),t)return s.jsx("div",{style:{minHeight:"100vh",width:"100%",background:"#FAF9F5"},"aria-hidden":"true"});const n=yh(e)?e.status:null;return s.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,fontFamily:"Inter, system-ui, sans-serif",color:"#111"},children:s.jsxs("div",{style:{maxWidth:480,textAlign:"center"},children:[s.jsx("h1",{style:{fontSize:20,fontWeight:600,marginBottom:8},children:n?`${n} â Something went wrong`:"Something went wrong"}),s.jsx("p",{style:{fontSize:14,color:"#555",marginBottom:16},children:"An unexpected error occurred. Please try again."}),s.jsx("button",{type:"button",onClick:()=>window.location.reload(),style:{padding:"8px 16px",borderRadius:8,border:"1px solid #ddd",background:"#fff",cursor:"pointer"},children:"Reload"})]})})}const e$={primary:"btn btn-primary",ink:"btn btn-ink",secondary:"btn btn-secondary",ghost:"btn btn-ghost",danger:"btn bg-destructive text-white hover:bg-destructive/90"},_Ae={sm:"px-4 py-1.5 text-xs",md:"px-5 py-2 text-sm",lg:"px-6 py-2.5 text-base"};function yt({children:e,variant:t="primary",size:n="md",isLoading:r=!1,disabled:a=!1,className:i="",icon:o,...l}){return s.jsxs("button",{className:`${e$[t]||e$.primary} ${_Ae[n]} ${i}`,disabled:a||r,...l,children:[r?s.jsx(vt,{className:"w-4 h-4 animate-spin"}):o?s.jsx(o,{className:"w-4 h-4"}):null,e]}
65)}function ul({label:e,type:t="text",error:n,hint:r,icon:a,maxLength:i,showCounter:o=!0,className:l="",labelClassName:c="text-xs font-mono font-medium uppercase tracking-eyebrow text-ink-muted",inputClassName:u="rounded-md",...d}){const[h,p]=f.useState(!1),m=t==="password",g=t==="textarea",x=o&&i&&d.value,b=d.id,y=`w-full ${u} border bg-paper px-4 py-2.5 text-sm text-ink placeholder-ink-muted transition-all focus:outline-none focus:shadow-focus focus:border-indigo disabled:opacity-50 disabled:cursor-not-allowed ${n?"border-destructive":"border-rule"} ${a?"pl-10":""} ${m?"pr-10":""} ${x&&!g?"pr-14":""}`;return s.jsxs("div",{className:l,children:[e&&s.jsx("label",{htmlFor:b,className:`block mb-2 ${c}`,children:e}),s.jsxs("div",{className:"relative",children:[a&&s.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:s.jsx(a,{className:"w-4 h-4 text-ink-light"})}),g?s.jsx("textarea",{className:y+" resize-none"+(a?" pl-10":""),maxLength:i,...d}):s.jsx("input",{type:m&&h?"text":t,className:y,maxLength:i,...d}),m&&s.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center",onClick:()=>p(!h),tabIndex:-1,"aria-label":h?"Hide password":"Show password",children:h?s.jsx(vb,{className:"w-4 h-4 text-ink-light"}):s.jsx(Sh,{className:"w-4 h-4 text-ink-light"})}),x&&!g&&s.jsxs("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-[10px] font-mono font-medium text-ink-muted",children:[d.value.length,"/",i]}),x&&g&&s.jsxs("span",{className:"absolute right-3 bottom-2 text-[10px] font-mono font-medium text-ink-muted",children:[d.value.length,"/",i]})]}),r&&!n&&s.jsx("p",{className:"mt-1 text-xs text-ink-muted",children:r}),n&&s.jsx("p",{className:"mt-1 text-sm text-destructive",children:n})]})}function _a({message:e,className:t=""}){return e?s.jsxs("div",{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400 ${t}`,children:[s.jsx(Co,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{children:e})]}):null}const t$={labelClassName:"text-[12.5px] font-medium text-ink-mid",inputClassName:"rounded-lg"};function kAe({onPasswordless:e}){const{login:t}=Ut(),[n,r]=f.useState(""),[a,i]=f.useState(""),[o,l]=f.useState(""),[c,u]=f.useState(!1),d=async h=>{if(h.preventDefault(),l(""),!ec(n)){l("Please enter a valid email address.");return}if(!a){l("Please enter your password.");return}u(!0);try{await t(n,a)}catch(p){l(p.response?.data?.detail?.message||"Invalid email or password.")}finally{u(!1)}};return s.jsxs("form",{onSubmit:d,className:"space-y-3",children:[s.jsx(_a,{message:o}),s.jsx(ul,{id:"login-email",label:"Email",type:"email",placeholder:"[email protected]",value:n,onChange:h=>r(h.target.value),icon:qr,autoComplete:"email",...t$}),s.jsxs("div",{children:[s.jsx(ul,{id:"login-password",label:"Password",type:"password",placeholder:"Enter your password",value:a,onChange:h=>i(h.target.value),icon:Zi,autoComplete:"current-password",...t$}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3 text-[12.5px] font-medium",children:[e?s.jsx("button",{type:"button",onClick:e,className:"rounded-sm text-ink-mid transition-colors duration-base ease-standard hover:text-indigo focus-visible:outline-none focus-visible:shadow-focus",children:"Email me a link"}):s.jsx("span",{}),s.jsx(Le,{to:"/forgot-password",className:"text-indigo hover:text-indigo-deep",children:"Forgot password?"})]})]}),s.jsx(yt,{type:"submit",isLoading:c,className:"w-full min-h-[46px] text-[14.5px] font-semibold",children:"Log in"})]})}const qN=[{id:"priya",bg:"/auth/priya-bg.webp",portrait:"/auth/priya-portrait.webp",alt:"Priya, founder of Plainly, on her Great Experts profile"},{id:"lukas",bg:"/auth/lukas-bg.webp",portrait:"/auth/lukas-portrait.webp",alt:"Lukas, resident DJ, on his Great Experts profile"},{id:"elena",bg:"/auth/elena-bg.webp",portrait:"/auth/elena-portrait.webp",alt:"Elena, pottery studio in London, on her Great Experts profile"},{id:"jonathan",bg:"/auth/jonathan-bg.webp",portrait:"/auth/jonathan-portrait.webp",alt:"Jonathan, digital artist, on his Great Experts profile"},{id:"farouk",bg:"/auth/farouk-bg.webp",portrait:"/auth/farouk-portrait.webp",alt:"Farouk, coffee master, on his Great Experts profile"}],NAe=3200,s$="ease-[cubic-bezier(0.2,0.6,0.2,1)]";function EJ({slides:e=!0}){const[t,n]=f.useState(0),[r,a]=f.useState(!1),i=t%qN.length;return f.useEffect(()=>{const o=window.matchMedia("(min-width: 1024px)"),l=()=>a(o.matches);return l(),o.addEventListener("change",l),()=>o.removeEventListener("change",l)},[]),f.useEffect(()=>{if(!e||!r||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const o=setInterval(()=>n(l=>l+1),NAe);return()=>clearInterval(o)},[r,e]),e?s.jsxs("div",{className:"relative hidden overflow-hidden bg-ink lg:col-start-1 lg:row-start-1 lg:block",children:[r&&qN.map((o,l)=>{const c=l===i,u=l<=t+1;return s.jsx("div",{className:`absolute inset-0 flex items-center justify-center transition-[opacity,transform] duration-1000 ${s$} motion-reduce:transition-none ${c?"z-[2] scale-100 opacity-100":"z-[1] scale-[1.045] opacity-0"}`,children:u&&s.jsxs(s.Fragment,{children:[s.jsx("img",{src:o.bg,alt:"","aria-hidden":"true",className:"absolute inset-0 h-full w-full object-cover"}),s.jsx("img",{src:o.portrait,alt:o.alt,style:{height:"min(576px, calc(100dvh - 160px))"},className:"relative aspect-[0.52] max-w-[62%] rounded-[26px] border border-paper/20 object-cover object-top shadow-[0_40px_90px_-34px_rgba(20,20,19,0.8)]"})]})},o.id)}),s.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-[6] h-[22%] bg-gradient-to-b from-ink/0 to-ink/[0.38]"}),s.jsx(Le,{to:Me.HOME,className:"absolute left-7 top-6 z-[8] inline-flex",children:s.jsx(bn,{variant:"white",height:28,className:"drop-shadow-[0_1px_8px_rgba(20,20,19,0.5)]"})}),s.jsx("div",{className:"absolute inset-x-9 bottom-8 z-[8] flex items-center gap-2","aria-hidden":"true",children:qN.map((o,l)=>s.jsx("span",{className:`h-[7px] rounded-pill transition-all duration-500 ${s$} ${l===i?"w-[22px] bg-paper":"w-[7px] bg-paper/50"}`},o.id))})]}):s.jsxs("div",{className:"relative hidden overflow-hidden bg-ink lg:col-start-1 lg:row-start-1 lg:block",children:[s.jsx("img",{src:"/auth/business-video-bg.jpg",alt:"",className:"absolute inset-0 h-full w-full object-cover"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center px-8",children:s.jsx("div",{"data-auth-media":"video","aria-hidden":"true",style:{height:"min(680px, calc(100dvh - 96px))"},className:"aspect-[0.52] w-full max-w-[72%] rounded-[28px] border border-white/35 bg-white/10 shadow-[0_40px_90px_-34px_rgba(20,20,19,0.45)]"})}),s.jsx(Le,{to:Me.HOME,className:"absolute left-7 top-6 z-[8] inline-flex",children:s.jsx(bn,{variant:"white",height:28,className:"drop-shadow-[0_1px_8px_rgba(20,20,19,0.5)]"})})]})}
65function SJ({title:e,accent:t,footer:n,children:r}){return s.jsxs("div",{className:"w-full max-w-[352px] animate-slide-up motion-reduce:animate-none",children:[s.jsx("div",{className:"mb-7 flex justify-center lg:hidden",children:s.jsx(Le,{to:Me.HOME,children:s.jsx(bn,{height:40})})}),s.jsxs("div",{className:"rounded-[20px] border border-rule bg-paper px-[26px] pb-7 pt-[34px] shadow-[0_30px_70px_-38px_rgba(20,20,19,0.4)] short:pb-5 short:pt-7",children:[s.jsxs("h1",{className:"text-center font-display text-[27px] font-normal leading-[1.1] tracking-[-0.005em] text-ink short:text-[24px]",children:[e," ",s.jsx("em",{className:"italic text-indigo",children:t})]}),r]}),n]})}function CJ({children:e}){return s.jsxs("div",{className:"flex items-center gap-3.5",children:[s.jsx("span",{className:"h-px flex-1 bg-rule"}),s.jsx("span",{className:"text-xs text-ink-mid",children:e}),s.jsx("span",{className:"h-px flex-1 bg-rule"})]})}function tf({id:e,checked:t,onChange:n,children:r,labelClassName:a="text-ink-mid",textClassName:i="text-xs leading-relaxed"}){return s.jsxs("label",{htmlFor:e,className:"flex items-start gap-2.5 cursor-pointer select-none",children:[s.jsx("input",{id:e,type:"checkbox",checked:t,onChange:o=>n(o.target.checked),className:"mt-0.5 h-4 w-4 shrink-0 rounded border-rule accent-indigo focus:ring-indigo"}),s.jsx("span",{className:`${i} ${a}`,children:r})]})}const Q_="2026-04-24",EAe="2026-07-15",Ib=`terms:${Q_}|privacy:${EAe}`,n$=`terms:${Q_}`,SAe=`voice-clone:${Q_}`,CAe=`voice-localization:${Q_}`;async function gc({consentType:e,tosVersion:t,checkboxStates:n,expertId:r=null}){const{data:a}=await Se.post("/consent",{consent_type:e,tos_version:t,checkbox_states:n,expert_id:r});return a}function TJ(e){return String(e||"").replace(/[^\p{L}]+/gu," ").trim().replace(new RegExp("\\b\\p{L}","gu"),t=>t.toUpperCase())}function TAe(e){return TJ(e)}function AJ(e){return TJ(String(e||"").split("@")[0].split("+")[0])}function AAe(e){const t=Math.max(0,e);return`${String(Math.floor(t/60)).padStart(2,"0")}:${String(t%60).padStart(2,"0")}`}function FR({open:e,mode:t="login",expertId:n=null,conversationId:r=null,onClose:a,onSuccess:i,allowSignup:o=!0,allowGoogle:l=!0,hasPendingQuestion:c=!1,pendingAttachmentIds:u=[]}){const{login:d,googleLogin:h,captureSaasEmail:p,signup:m,startEmailCode:g,verifyEmailCode:x,transferAnonymousConversation:b,updateUser:y}=Ut(),[v,w]=f.useState("email"),[j,E]=f.useState(t==="gate"?"gate":"login"),[S,_]=f.useState(""),[k,C]=f.useState(""),[N,A]=f.useState(""),[T,I]=f.useState(null),[$,O]=f.useState(0),[U,F]=f.useState(0),[H,G]=f.useState(Date.now()),[M,z]=f.useState(""),[W,D]=f.useState(""),[Z,V]=f.useState(!1),[L,K]=f.useState(t==="terms"),[te,Q]=f.useState(!1),[Y,J]=f.useState(!1),[P,ee]=f.useState(!1);f.useEffect(()=>{if(!e)return;w("email"),E(t==="gate"?"gate":"login"),z(""),D(""),A(""),I(null),K(t==="terms"),ee(!1);const ue=window.setInterval(()=>G(Date.now()),1e3);return()=>window.clearInterval(ue)},[e,t]);const X=f.useMemo(()=>Math.max(0,Math.ceil(($-H)/1e3)),[$,H]),ae=Math.max(0,Math.ceil((U-H)/1e3)),me=j==="gate"||j==="signup";if(!e)return null;const q=async()=>{if(z(""),!ec(S))return z("Please enter a valid email address."),!1;V(!0);try{const ue=await g({email:S,purpose:j,expertId:n,conversationId:r,attachmentIds:u}),be=ue.data,Re=Date.now();return I(be.challenge_id),O(Re+be.expires_in*1e3),F(Re+be.resend_in*1e3),D(ue.message),A(""),!0}catch(ue){return z(ue.response?.data?.detail?.message||ue.message||"Could not send a code."),!1}finally{V(!1)}},he=async()=>{if(!me){await q();return}if(z(""),!ec(S)){z("Please enter a valid email address.");return}if(!P){z("Agree to the Terms and Privacy Policy and confirm you are at least 18 to continue.");return}V(!0);try{const ue=await p({email:S,purpose:j,expertId:n,conversationId:r,consentAccepted:P});i?.(ue.data)}catch(ue){z(ue.response?.data?.detail?.message||ue.message||"Could not save your email.")}finally{V(!1)}},se=async()=>{if(z(""),X<=0){z("This code expired. Send a new code to continue.");return}if(!/^\d{6}$/.test(N)){z("Enter the six-digit code.");return}V(!0);try{const ue=await x({challengeId:T,email:S,code:N});ue.data?.requires_terms?K(!0):i?.(ue.data)}catch(ue){z(ue.response?.data?.detail?.message||ue.message||"The code is invali
65d or expired.")}finally{V(!1)}},le=async()=>{if(!te||!Y){z("Accept the Terms and confirm your age to continue.");return}V(!0),z("");try{await gc({consentType:"account_creation",tosVersion:Ib,checkboxStates:{terms_privacy:!0,age_18:!0}}),y({terms_current:!0}),i?.({conversation_transferred:!0})}catch(ue){z(ue.response?.data?.detail?.message||"Could not save your acceptance.")}finally{V(!1)}},ke=async ue=>{if(ue.preventDefault(),z(""),!ec(S)||!k){z("Enter your email and password.");return}V(!0);try{const be=await d(S,k);((await b(be.data?.anonymous_access_token,n,r,u))?.terms_current??be.data?.user?.terms_current)===!1?K(!0):i?.({conversation_transferred:!0})}catch(be){z(be.response?.data?.detail?.message||"Invalid email or password.")}finally{V(!1)}},oe=()=>{const ue=new Uint8Array(32);return crypto.getRandomValues(ue),`${btoa(String.fromCharCode(...ue))}aA1!`},Oe=async ue=>{if(ue.preventDefault(),z(""),!ec(S)){z("Please enter a valid email address.");return}if(!P){z("Agree to the Terms and Privacy Policy and confirm you are at least 18 to continue.");return}V(!0);try{const be=AJ(S)||"there",Re=await m(be,S,oe(),{});((await b(Re.data?.anonymous_access_token,n,r,u))?.terms_current??Re.data?.user?.terms_current)===!1?K(!0):i?.({conversation_transferred:!0})}catch(be){const Re=be.response?.data?.detail?.code;Re==="EMAIL_EXISTS"||Re==="EMAIL_CONFIRMATION_REQUIRED"?await q()?(z(""),D("You already have an account. Enter the code we just emailed you.")):z("You already have an account, but we could not email a code just now. Wait a moment and try again."):z(be.response?.data?.detail?.message||be.message||"Could not create your account.")}finally{V(!1)}},Je=async()=>{if(z(""),me&&v!=="password"&&!P){z("Agree to the Terms and Privacy Policy and confirm you are at least 18 to continue.");return}V(!0);try{await h({preserveSaasConversation:!0,returnPath:`${window.location.pathname}${window.location.search}${window.location.hash}`,expertId:n,conversationId:r,attachmentIds:u,consentAccepted:me&&v!=="password"&&P})}catch(ue){z(ue.message||"Google sign-in failed. Please try again."),V(!1)}},Ie=t==="terms"?"Review the current terms":t==="gate"?"Continue your conversation":t==="register"||j==="signup"?"Create your account":t==="login-required"?"Log in to chat":"Log in";return s.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-ink/45 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"saas-auth-title",children:s.jsxs("div",{className:"relative w-full max-w-md rounded-3xl border border-rule bg-paper p-6 shadow-2xl sm:p-8",children:[a&&!L&&s.jsx("button",{type:"button",onClick:a,className:"absolute right-4 top-4 roun
65ded-full p-2 text-ink-muted hover:bg-cream","aria-label":"Close",children:s.jsx(as,{size:18})}),s.jsx("h2",{id:"saas-auth-title",className:"pr-8 font-display text-2xl text-ink",children:Ie}),t==="register"&&!L&&s.jsx("p",{className:"mt-2 text-xs text-ink-mid",children:"Your conversation carries over, and youâll go straight to checkout."}),t==="login-required"&&!L&&j==="login"&&s.jsx("p",{className:"mt-2 text-xs text-ink-mid",children:c?"This expert asks visitors to log in first. Your question is saved and sends after you log in.":"This expert asks visitors to log in first."}),t==="gate"&&!L&&s.jsx("p",{className:"mt-2 text-xs text-ink-mid",children:c?"Your conversation and pending question are saved while you continue.":"Your conversation is saved while you continue."}),L?s.jsxs("div",{className:"mt-6 space-y-4",children:[s.jsx("p",{className:"text-sm text-ink-mid",children:"Before continuing, accept the current Great Experts terms."}),s.jsxs("label",{className:"flex items-start gap-3 text-sm text-ink",children:[s.jsx("input",{type:"checkbox",checked:te,onChange:ue=>Q(ue.target.checked),className:"mt-1"}),s.jsxs("span",{children:["I agree to the ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noreferrer",className:"text-indigo underline",children:"Terms"})," and ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noreferrer",className:"text-indigo underline",children:"Privacy Policy"}),"."]})]}),s.jsxs("label",{className:"flex items-start gap-3 text-sm text-ink",children:[s.jsx("input",{type:"checkbox",checked:Y,onChange:ue=>J(ue.target.checked),className:"mt-1"}),s.jsx("span",{children:"I confirm that I am at least 18 years old."})]}),s.jsx("button",{type:"button",disabled:Z,onClick:le,className:"w-full rounded-full bg-indigo px-5 py-3 font-semibold text-cream disabled:opacity-50",children:"Continue conversation"})]}):v==="password"?s.jsxs("form",{onSubmit:ke,className:"mt-6 space-y-4",children:[l&&s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",disabled:Z,onClick:Je,className:"flex min-h-[52px] w-full items-center justify-center gap-3 rounded-full border-[1.5px] border-cream-tint bg-cream px-5 py-3 text-sm font-semibold text-ink transition-colors duration-base ease-standard hover:border-ink-light hover:bg-cream-deep disabled:cursor-not-allowed disabled:opacity-60",children:[s.jsxs("svg",{width:"19",height:"19",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",className:"shrink-0","aria-hidden":"true",children:[s.jsx("path",{d:"M17.64 9.2c0-.637-.057-1.251-.164-1.84H9v3.481h4.844c-.209 1.125-.843 2.078-1.796 2.717v2.258h2.908c1.702-1.567 2.684-3.874 2.684-6.615z",fill:"#4285F4"}),s.jsx("path",{d:"M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.836.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.331A8.997 8.997 0 0 0 9 18z",fill:"#34A853"}),s.jsx("path",{d:"M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05"}),s.jsx("path",{d:"M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z",fill:"#EA4335"})]}),"Continue with Google"]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"h-px flex-1 bg-rule"}),s.jsx("span",{className:"text-xs text-ink-muted",children:"or"}),s.jsx("span",{className:"h-px flex-1 bg-rule"})]})]}),s.jsx("input",{type:"email",value:S,onChange:ue=>_(ue.target.value),placeholder:"Email",autoComplete:"email",className:"w-full rounded-xl border border-rule bg-white px-4 py-3 text-sm outline-none focus:border-indigo"}),s.jsx("input",{type:"password",value:k,onChange:ue=>C(ue.target.value),placeholder:"Password",autoComplete:"current-password",className:"w-full rounded-xl border border-rule bg-white px-4 py-3 text-sm outline-none focus:border-indigo"}),s.jsx("button",{type:"submit",disabled:Z,className:"w-full rounded-full bg-indigo px-5 py-3 text-sm font-semibold text-cream disabled:opacity-50",children:"Log in with password"}),s.jsxs("p",{className:"w-full text-center text-xs text-ink-mid",children:["Continue with"," ",s.jsx("button",{type:"button",onClick:()=>w("email"),className:"font-semibold text-indigo hover:text-indigo-deep",children:"email instead"})]})]}):s.jsxs("div",{className:"mt-6 space-y-4",children:[!T&&l&&s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",disabled:Z,onClick:Je,className:"flex min-h-[52px] w-full items-center justify-center gap-3 rounded-full border-[1.5px] border-cream-tint bg-cream px-5 py-3 text-sm font-semibold text-ink transition-colors duration-base ease-standard hover:border-ink-light hover:bg-cream-deep disabled:cursor-not-allowed disabled:opacity-60",children:[s.jsxs("svg",{width:"19",height:"19",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",className:"shrink-0","aria-hidden":"true",children:[s.jsx("path",{d:"M17.64 9.2c0-.637-.057-1.251-.164-1.84H9v3.481h4.844c-.209 1.125-.843 2.078-1.796 2.717v2.258h2.908c1.702-1.567 2.684-3.874 2.684-6.615z",fill:"#4285F4"}),s.jsx("path",{d:"M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.836.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.331A8.997 8.997 0 0 0 9 18z",fill:"#34A853"}),s.jsx("path",{d:"M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.99
656 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05"}),s.jsx("path",{d:"M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z",fill:"#EA4335"})]}),"Continue with Google"]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"h-px flex-1 bg-rule"}),s.jsx("span",{className:"text-xs text-ink-muted",children:"or"}),s.jsx("span",{className:"h-px flex-1 bg-rule"})]})]}),s.jsx("input",{type:"email",value:S,onChange:ue=>_(ue.target.value),disabled:!!T,placeholder:"[email protected]",autoComplete:"email",className:"w-full rounded-xl border border-rule bg-white px-4 py-3 text-sm outline-none focus:border-indigo disabled:bg-cream"}),me&&s.jsxs(tf,{id:"saas-email-capture-consent",checked:P,onChange:ue=>{ee(ue),ue&&z("")},labelClassName:"text-ink-mid",textClassName:"text-xs leading-5",children:["I agree to the"," ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"text-indigo underline hover:text-indigo-deep",children:"Terms and Conditions"})," ","and"," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-indigo underline hover:text-indigo-deep",children:"Privacy Policy"}),", and confirm I am at least 18 years of age."]}),t==="register"&&!T?s.jsxs(s.Fragment,{children:[s.jsxs(tf,{id:"saas-register-consent",checked:P,onChange:ue=>{ee(ue),ue&&z("")},labelClassName:"text-ink-mid",textClassName:"text-xs leading-5",children:["I agree to the"," ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"text-indigo underline hover:text-indigo-deep",children:"Terms and Conditions"})," ","and"," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-indigo underline hover:text-indigo-deep",children:"Privacy Policy"}),", and confirm I am at least 18 years of age."]}),s.jsx("button",{type:"button",disabled:Z,onClick:Oe,className:"w-full rounded-full bg-indigo px-5 py-3 text-sm font-semibold text-cream disabled:opacity-50",children:Z?"Creating your accountâ¦":"Continue with email"})]}):T&&!me?s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:6,value:N,onChange:ue=>A(ue.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"Six-digit code",className:"w-full rounded-xl border border-rule bg-white px-4 py-3 text-center font-mono text-2xl tracking-[0.35em] outline-none focus:border-indigo"}),s.jsx("p",{className:"text-center text-sm font-medium text-ink-mid",children:X>0?`Code expires in ${AAe(X)}`:"This code expired. Send a new code to continue."}),s.jsx("button",{type:"button",disabled:Z,onClick:se,className:"w-full rounded-full bg-indigo px-5 py-3 font-semibold text-cream disabled:opacity-50",children:"Verify and continue"}),s.jsx("button",{type:"button",disabled:Z||ae>0,onClick:q,className:"w-full text-sm font-medium text-indigo disabled:text-ink-muted",children:ae>0?`Resend code in ${ae}s`:"Send a new code"})]}):s.jsx("button",{type:"button",disabled:Z,onClick:he,className:"w-full rounded-full bg-indigo px-5 py-3 text-sm font-semibold text-cream disabled:opacity-50",children:"Continue with email"}),W&&s.jsx("p",{className:"text-center text-sm text-ink-mid",children:W}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"h-px flex-1 bg-rule"}),s.jsx("span",{className:"text-xs text-ink-muted",children:"or"}),s.jsx("span",{className:"h-px flex-1 bg-rule"})]}),s.jsxs("p",{className:"w-full text-center text-xs text-ink-mid",children:["Already have an account?"," ",t==="register"?s.jsx("button",{type:"button",disabled:Z,onClick:q,className:"font-semibold text-indigo hover:text-indigo-deep disabled:text-ink-muted",children:"Email me a login code"}):s.jsx("button",{type:"button",onClick:()=>w("password"),className:"font-semibold text-indigo hover:text-indigo-deep",children:"Log in with password"})]})]}),o&&!L&&t!=="gate"&&t!=="register"&&j==="login"&&s.jsxs("button",{type:"button",onClick:()=>{w("email"),E("signup"),I(null),ee(!1),D(""),z("")},className:"mt-5 w-full text-sm text-ink-mid",children:["New to Great Experts? ",s.jsx("span",{className:"font-semibold text-indigo",children:"Sign up now"})]}),M&&s.jsx("p",{className:"mt-4 rounded-xl bg-red-50 px-3 py-2 text-sm text-red-700",children:M})]})})}function RAe(){return s.jsx("div",{className:"h-dvh overflow-y-auto bg-cream flex items-center justify-center px-4 py-12","aria-hidden":"true",children:s.jsx("div",{className:"w-full max-w-[352px]",children:s.jsxs("div",{className:"bg-paper rounded-[20px] border border-rule shadow-card px-[26px] pb-8 pt-[34px] space-y-3",children:[s.jsx(gt,{className:"h-8 w-44 mx-auto"}),s.jsx(gt,{className:"h-11 w-full rounded-pill"}),s.jsx(gt,{className:"h-11 w-full rounded-pill"}),s.jsx(gt,{className:"h-16 w-full"}),s.jsx(gt,{className:"h-16 w-full"}),s.jsx(gt,{className:"h-11 w-full rounded-pill"})]})})})}function IAe(){const{user:e,isAuthenticated:t,isLoading:n,googleLogin:r,xLogin:a}=Ut(),i=an(),o=new URLSearchParams(i.search).get("redirect"),l=i.state?.from,c=typeof l=="string"?l:l?.pathname?`${l.pathname}${l.search||""}`:o||Me.DASHBOARD,[u,d]=f.useState(""),[h,p]=f.useState(null),[m,g]=f.useState(!1);if(n)return s.jsx(RAe,{});if(!n&&t&&!(m&&e?.terms_current===!1))return s.jsx(Pn,{to:e?.account_completed===!1?"/complete-account":c,replace:!0});const x=async(b,y)=>{d(""),p(b);try{c&&typeof c=="string"&&c.startsWith("/")&&sessionStorage.setItem("postAuthRedirect",c)}catch{}try{await y()}catch(v){d(v.message||`${b} sign-in failed.`),p(null)}};return s.jsxs("div",{className:"h-dvh overflow-y-auto bg-cream text-ink grid grid-cols-1 lg:grid-cols-[1.05fr_1fr]",children:[s.jsx(vs,{title:"Sign in | Great Experts",description:"Sign in to Great Experts. Chat with expert-built AI agents grounded in their own knowledge.",path:"/login"}),s.jsx(EJ,{}),s.jsx("div",{className:"flex items-center justify-center px-4 pb-12 pt-[max(3rem,env(safe-area-inset-top))] sm:px-11 lg:col-start-2 lg:row-start-1 lg:py-8 short:lg:py-4",children:s.jsx(SJ,{title:"Welcome",accent:"back",footer
65:s.jsxs("p",{className:"mt-[22px] text-center text-[11px] leading-normal text-ink-muted short:mt-3",children:["By continuing you agree to our"," ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"text-indigo hover:text-indigo-deep",children:"Terms"})," ","and"," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-indigo hover:text-indigo-deep",children:"Privacy Policy"}),"."]}),children:s.jsxs("div",{className:"mt-4 space-y-3 short:mt-3 short:space-y-2.5",children:[s.jsx(YY,{pending:h,onGoogle:()=>x("Google",r),onX:()=>x("X",a)}),u&&s.jsx("p",{className:"text-center text-sm text-destructive",children:u}),s.jsx(CJ,{children:"Or log in with email"}),s.jsx(kAe,{onPasswordless:()=>g(!0)}),s.jsxs("p",{className:"text-center text-[13px] text-ink-mid",children:["New here?"," ",s.jsx(Le,{to:Me.SIGNUP,state:{from:c},className:"font-semibold text-indigo hover:text-indigo-deep",children:"Create your profile and AI Expert"})]})]})})}),s.jsx(FR,{open:m,mode:"login",allowSignup:!1,onClose:()=>g(!1),onSuccess:()=>g(!1)})]})}function PAe({isAuthenticated:e,accountEmail:t,enteredEmail:n}){if(!e)return"fresh";const r=String(t||"").trim().toLowerCase(),a=String(n||"").trim().toLowerCase();return r&&a&&r===a?"continue":"switch"}const r$={labelClassName:"text-[12.5px] font-medium text-ink-mid",inputClassName:"rounded-lg"};function LAe({consent:e,onConsentChange:t,consentValid:n,onPrepareHandoff:r,onSubmittingChange:a,onAuthorizeProfileClaim:i,onClearHandoff:o,claimedSlug:l="",returnPath:c=""}){const{signup:u,isAuthenticated:d,updateUser:h,logout:p,user:m}=Ut(),[g,x]=f.useState(()=>m?.email||""),[b,y]=f.useState(""),[v,w]=f.useState(!1),[j,E]=f.useState(""),[S,_]=f.useState(!1),[k,C]=f.useState(!1),N=f.useRef(null),A=f.useRef(!1);f.useEffect(()=>{j&&N.current?.scrollIntoView({behavior:"smooth",block:"center"})},[j]);const T=k_e(b),I=async $=>{$.preventDefault(),E("");const O=PAe({isAuthenticated:d,accountEmail:m?.email,enteredEmail:g});if(O==="switch"&&!k){C(!0);return}if(O!=="continue"){if(!ec(g)){E("Please enter a valid email address.");return}if(!T.isValid){E("Password does not meet all requirements.");return}}if(!n){E("Please accept the required terms to create your account.");return}_(!0),a?.(!0),r?.();let U=O==="continue";try{if(!U){O==="switch"&&await p();const F={...l?{claimed_username:l}:{},...c.startsWith("/")?{post_signup_redirect:c}:{}};await u(TAe(l)||AJ(g),g,b,F),U=!0}await gc({consentType:"account_creation",tosVersion:Ib,checkboxStates:{terms_privacy:e.terms_privacy,age_18:e.age_18}}),h({terms_current:!0}),i?.({createdAccount:O!=="continue"}),o?.()}catch(F){const H=F.response?.data?.detail?.code;!U&&H!=="EMAIL_CONFIRMATION_REQUIRED"&&o?.(),E(U?"We could not record your agreement. Please try again.":F.response?.data?.detail?.message||"Failed to create account.")}finally{_(!1),a?.(!1)}};return s.jsxs("form",{onSubmit:I,className:"space-y-3.5 short:space-y-2.5",children:[s.jsx("div",{ref:N,className:"scroll-mt-4",children:s.jsx(_a,{message:j})}),s.jsx(ul,{id:"signup-email",label:"Email",type:"email",placeholder:"[email protected]",value:g,onChange:$=>{A.current=!0,C(!1),x($.target.value)},icon:qr,autoComplete:"email",...r$}),s.jsxs("div",{className:"relative",children:[s.jsx(ul,{id:"signup-password",label:"Password",type:"password",placeholder:"Create a password",value:b,onChange:$=>y($.target.value),onFocus:()=>w(!0),onBlur:()=>w(!1),icon:Zi,autoComplete:"new-password",...r$}),b&&v&&s.jsx("ul",{className:"pointer-events-none absolute inset-x-0 top-full z-10 mt-1.5 space-y-1 rounded-lg border border-rule bg-paper p-2.5 shadow-overlay","aria-label":"Password requirements",children:T.requirements.map($=>s.jsxs("li",{className:"flex items-center gap-1.5 text-[11.5px] leading-4",children:[$.met?s.jsx(ft,{className:"h-3 w-3 shrink-0 text-indigo-deep","aria-hidden":"true"}):s.jsx(as,{className:"h-3 w-3 shrink-0 text-ink-light","aria-hidden":"true"}),s.jsx("span",{className:$.met?"text-indigo-deep":"text-ink-muted",children:$.label})]},$.label))})]}),s.jsxs(tf,{id:"consent-terms-age",checked:n,onChange:$=>t($),textClassName:"text-[11.5px] leading-relaxed",children:["I confirm I'm 18 or older and agree to the"," ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"text-indigo hover:text-indigo-deep",children:"Terms and Conditions"})," ","and the"," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-indigo hover:text-indigo-deep",children:"Privacy Policy"}),"."]}),k&&s.jsxs("div",{className:"rounded-lg border border-rule bg-cream-tint px-3 py-2.5 text-[12.5px] leading-normal text-ink-mid",children:["You're signed in as ",s.jsx("strong",{className:"text-ink",children:m?.email}),". Continuing signs you out and creates a new account for ",s.jsx("strong",{className:"text-ink",children:g}),"."," ",s.jsx("button",{type:"button",className:"font-semibold text-indigo hover:text-indigo-deep",onClick:()=>{C(!1),A.current=!1,x(m?.email||"")}
65,children:"Stay signed in instead"})]}),s.jsx(yt,{type:"submit",isLoading:S,disabled:!n,className:"w-full min-h-[46px] text-[14.5px] font-semibold",children:k?"Sign out and create new account":"Create my Profile and AI Expert"})]})}const a$=[.2,.6,.2,1],i$=Dn.div,OAe="rounded-[28px] border border-white/70 bg-white shadow-[0_28px_70px_-16px_rgba(20,20,19,0.35),0_0_0_1px_rgba(20,20,19,0.05)] supports-[backdrop-filter:blur(0)]:bg-white/[0.86] supports-[backdrop-filter:blur(0)]:backdrop-blur-2xl supports-[backdrop-filter:blur(0)]:backdrop-saturate-150";function en({isOpen:e,onClose:t,title:n,children:r,maxWidth:a="max-w-md",className:i="",backdropClassName:o="bg-ink/60",backdropZ:l="z-[80]",contentZ:c="z-[90]",contained:u=!1,surface:d=!1,glass:h=!1,hideTitle:p=!1}){const m=f.useRef(null),g=f.useRef(null),x=f.useRef(t);f.useEffect(()=>{x.current=t},[t]),f.useEffect(()=>{if(!e)return;g.current=document.activeElement;const y=document.body.style.overflow,v=w=>{if(w.target.closest?.('[role="dialog"]')!==m.current||(w.key==="Escape"&&x.current(),w.key!=="Tab"||!m.current))return;const j=m.current.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])');j.length?w.shiftKey&&document.activeElement===j[0]?(w.preventDefault(),j[j.length-1].focus()):!w.shiftKey&&document.activeElement===j[j.length-1]&&(w.preventDefault(),j[0].focus()):(w.preventDefault(),m.current.focus())};return document.addEventListener("keydown",v),u||(document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",v),u||(document.body.style.overflow=y),g.current?.focus?.()}},[u,e]),f.useEffect(()=>{e&&m.current&&m.current.focus()},[e]);const b=s.jsx(Ei,{children:e&&s.jsxs(s.Fragment,{children:[s.jsx(i$,{initial:{opacity:0}
65,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2,ease:a$},onClick:y=>{y.stopPropagation(),t()},className:`${u?"absolute":"fixed"} inset-0 ${l} ${o}`},"modal-backdrop"),s.jsx(i$,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.2,ease:a$},onClick:y=>y.stopPropagation(),className:`${u?"absolute":"fixed"} inset-0 ${c} flex items-center justify-center p-4 pointer-events-none`,children:s.jsxs("div",{ref:m,className:`w-full ${a} pointer-events-auto ${h?OAe:d?"ge-surface bg-indigo-wash":"bg-paper rounded-lg shadow-overlay border border-rule"} focus:outline-none ${i}`,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":n,children:[n&&!p&&s.jsx("div",{className:"px-6 pt-5 pb-1",children:s.jsx("h2",{className:"font-heading text-xl font-medium text-ink tracking-tight",children:n})}),s.jsx("div",{className:p?"":"px-6 pb-6 pt-4",children:r})]})},"modal-content")]})});return u?b:Mn.createPortal(b,document.body)}const Yw="gx_welcome_pending";function MAe({isOpen:e,onClose:t,fullName:n}){const r=Ps(),a=(n||"").trim().split(" ")[0],i=a?`Welcome, ${a}.`:"Welcome to Great Experts.";return s.jsxs(en,{isOpen:e,onClose:t,title:i,children:[s.jsx("p",{className:"text-sm text-ink-mid leading-relaxed",children:"Your account is ready. Claim your handle and add a photo so people can find you, or take a look around first."}),s.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2 mt-6",children:[s.jsx(yt,{variant:"secondary",size:"lg",onClick:t,className:"!rounded-md",children:"Look around first"}),s.jsx(yt,{size:"lg",onClick:()=>{t(),r(Me.PROFILE)},className:"!rounded-md",children:"Complete my profile"})]})]})}const BR="create_expert_preauth_v1",RJ=new Set(["welcome","platforms","profile-knowledge","profile-voice","profile-identity","profile-offerings","profile-test","templates","profile-building","profile-ready","profile-plan","business-chat","business-sources","business-contact","business-knowledge","business-voice","business-offerings","business-building","business-customize","business-congratulations"]),DAe=new Set(["platforms","profile-knowledge","profile-voice","profile-identity","profile-offerings","profile-test","profile-building","profile-ready","profile-plan"]);function IJ(e){return typeof e=="string"&&e.length<=80?e:""}function PJ(e){return Array.isArray(e)?Array.from(new Set(e.flatMap(t=>{try{const n=new URL(String(t||"").trim());return["http:","https:"].includes(n.protocol)?[n.toString()]:[]}catch{return[]}}))):[]}function Su(){try{const e=JSON.parse(sessionStorage.getItem(BR)||"{}");if(!e||typeof e!="object"||Array.isArray(e))return{};const t=RJ.has(e.screen)?e.screen:"welcome";return{screen:t,username:typeof e.username=="string"?e.username:"",templateId:IJ(e.templateId),templateCompleted:e.templateCompleted===!0||DAe.has(t),additionalLinks:PJ(e.additionalLinks),completed:e.completed===!0,knowledgeCompleted:e.knowledgeCompleted===!0,knowledgeSkipped:e.knowledgeSkipped===!0,publicationConsentAccepted:e.publicationConsentAccepted===!0||e.knowledgeCompleted===!0&&e.knowledgeSkipped!==!0,voiceCompleted:e.voiceCompleted===!0,identityCompleted:e.identityCompleted===!0||e.testCompleted===!0,profileBuilt:e.profileBuilt===!0,testCompleted:e.testCompleted===!0,journey:e.journey==="business"?"business":"profile",embedMode:mc(e.embedMode),widget:e.widget?Df(e.widget):null,embed:tK(e.embed)}}catch{return{}}}function Pt(e){const t=Su(),n={screen:RJ.has(e?.screen)?e.screen:t.screen||"welcome",username:typeof e?.username=="string"?e.username:t.username||"",templateId:typeof e?.templateId=="string"?IJ(e.templateId):t.templateId||"",templateCompleted:typeof e?.templateCompleted=="boolean"?e.templateCompleted:t.templateCompleted===!0,additionalLinks:Array.isArray(e?.additionalLinks)?PJ(e.additionalLinks):t.additionalLinks||[],completed:typeof e?.completed=="boolean"?e.completed:t.completed===!0,knowledgeCompleted:typeof e?.knowledgeCompleted=="boolean"?e.knowledgeCompleted:t.knowledgeCompleted===!0,knowledgeSkipped:typeof e?.knowledgeSkipped=="boolean"?e.knowledgeSkipped:t.knowledgeSkipped===!0,publicationConsentAccepted:typeof e?.publicationConsentAccepted=="boolean"?e.publicationConsentAccepted:t.publicationConsentAccepted===!0||e?.knowledgeCompleted===!0&&e?.knowledgeSkipped!==!0,voiceCompleted:typeof e?.voiceCompleted=="boolean"?e.voiceCompleted:t.voiceCompleted===!0,identityCompleted:typeof e?.identityCompleted=="boolean"?e.identityCompleted:t.identityCompleted===!0||e?.testCompleted===!0,profileBuilt:typeof e?.profileBuilt=="boolean"?e.profileBuilt:t.profileBuilt===!0,testCompleted:typeof e?.testCompleted=="boolean"?e.testCompleted:t.testCompleted===!0,journey:e?.journey==="business"||e?.journey==="profile"?e.journey:t.journey==="business"?"business":"profile",embedMode:Object.hasOwn(e||{},"embedMode")?mc(e.embedMode):mc(t.embedMode),widget:Object.hasOwn(e||{},"widget")?e.widget?Df(e.widget):null:t.widget||null,embed:Object.hasOwn(e||{},"embed")?tK(e.embed):t.embed||null};try{sessionStorage.setItem(BR,JSON.stringify(n))}catch{}return n}function sf(){try{sessionStorage.removeItem(BR)}catch{}}function $Ae(){const e=Su();return!!(e.username||e.templateId||e.screen!=="welcome")}function N0(){const{user:e,isAuthenticated:t,isLoading:n}=Ut(),[r,a]=f.useState(null);if(f.useEffect(()=>{if(!t||!e?.id)return;let o=!1;return Promise.all([Tw({status:"active"}),Tw({status:"draft",sort:"updated_at",order:"desc"})]).then(([l,c])=>{o||a({userId:e.id,entry:xD({hasLiveExpert:(l.data?.experts||[]).length>0,latestDraftId:(c.data?.experts||[])[0]?.id||"",journey:Su()})})}).catch(()=>{o||a({userId:e.id,entry:xD({hasLiveExpert:!0})})}),()=>{o=!0}},[t,e?.id]),!t)return{status:"anonymous",entry:null,isLoading:n};const i=r?.userId===e?.id?r.entry:null;return i?{status:i.kind,entry:i,isLoading:!1}:{status:"loading",entry:null,isLoading:!0}}const Kw="create_expert_pending_profile_claim_v1",UR="create_expert_authorized_profile_claim_v1";function LJ(e){const t=typeof e=="string"?e.trim().toLowerCase():"";return/^[a-z0-9](?:[a-z0-9-]{1,38}[a-z0-9])?$/.test(t)?t:""}function OJ(e){try{return LJ(sessionStorage.getItem(e))}catch{return""}}function MJ(e,t){const n=LJ(t);try{n?sessionStorage.setItem(e,n):sessionStorage.removeItem(e)}catch{}return n}function FAe(e){return MJ(Kw,e)}function BAe(){const e=OJ(Kw);try{sessionStorage.removeItem(Kw)}catch{}return e}function Z_(){try{sessionStorage.removeItem(Kw)}catch{}}function zR(e){return MJ(UR,e)}function UAe(){return OJ(UR)}function nf(){try{sessionStorage.removeItem(UR)}catch{}}function zAe(){return s.jsx("div",{className:"h-dvh overflow-y-auto bg-cream flex items-center justify-center px-4 py-12","aria-hidden":"true",children:s.jsx("div",{className:"w-full max-w-[352px]",children:s.jsxs("div",{className:"bg-paper rounded-[20px] border border-rule shadow-card px-[26px] pb-8 pt-[34px] space-y-3",children:[s.jsx(gt,{className:"h-8 w-48 mx-auto"}),s.jsx(gt,{className:"h-11 w-full rounded-pill"}),s.jsx(gt,{className:"h-11 w-full rounded-pill"}),s.jsx(gt,{className:"h-16 w-full"}),s.jsx(gt,{className:"h-16 w-full"}),s.jsx(gt,{className:"h-11 w-full rounded-pill"})]})})})}function HAe(e){const t=e?.created_at;if(!(!t||Date.now()-new Date(t).getTime()>=6e4))try{sessionStorage.setItem(Yw,"1")}catch{}}function qAe(){const{user:e,isAuthenticated:t,isLoading:n,googleLogin:r,xLogin:a}=Ut(),{entry:i,isLoading:o}=N0(),l=an(),c=Ps(),u=l.state?.from,d=typeof u=="string"||!!u?.pathname,h=typeof u=="string"?u:u?.pathname?`${u.pathname}${u.search||""}`:oc,p=Su(),m=p.username||"",x=m&&(h===Me.CREATE_EXPERT||!d&&p.templateCompleted)?Eb:h,b=h===ol,[y,v]=f.useState(!1),[w,j]=f.useState(!1),[E,S]=f.useState(""),[_,k]=f.useState(null),[C,N]=f.useState(null),[A,T]=f.useState(!1),[I,$]=f.useState({terms_privacy:!1,age_18:!1}),O=I.terms_privacy&&I.age_18,U=W=>
65$({terms_privacy:W,age_18:W}),F=f.useRef(null),H=()=>{try{x&&x.startsWith("/")&&sessionStorage.setItem("postAuthRedirect",x),sessionStorage.setItem("pendingConsent",JSON.stringify({terms_privacy:!0,age_18:!0})),FAe(m)}catch{}},G=()=>{try{sessionStorage.removeItem("postAuthRedirect"),sessionStorage.removeItem("pendingConsent"),Z_()}catch{}};if(f.useEffect(()=>{E&&F.current?.scrollIntoView({behavior:"smooth",block:"center"})},[E]),!y&&(n||t&&!w&&o))return s.jsx(zAe,{});if(!n&&!t&&!m&&!d)return s.jsx(Pn,{to:Me.CREATE_EXPERT,replace:!0});if(!y&&!n&&t&&e?.terms_current===!0){const W=w?x:i?.to||Me.HOME;return W===Me.DASHBOARD&&HAe(e),s.jsx(Pn,{to:W,replace:!0})}const M=async(W,D,Z=!1)=>{if(S(""),!O&&!Z){T(!1),N(W);return}k(W),H();try{await D()}catch(V){G(),S(V.message||`${W} sign-up failed.`),k(null)}},z=()=>{if(!A||!C||_)return;const W=C;U(!0),N(null),M(W,W==="Google"?r:a,!0)};return s.jsxs("div",{className:"h-dvh overflow-y-auto bg-cream text-ink grid grid-cols-1 lg:grid-cols-[1.05fr_1fr]",children:[s.jsx(vs,{title:"Sign up | Great Experts",description:"Create your Great Experts account. Chat with AI experts grounded in real human knowledge.",path:"/signup"}),s.jsxs(en,{isOpen:!!C,onClose:()=>N(null),title:"One quick step",maxWidth:"max-w-sm",children:[s.jsxs("p",{className:"mb-5 text-sm leading-relaxed text-ink-mid",children:["Confirm the following to continue with ",C,"."]}),s.jsx("div",{className:"rounded-xl border border-rule bg-cream p-4",children:s.jsxs(tf,{id:"oauth-signup-consent",checked:A,onChange:T,textClassName:"text-sm leading-relaxed",children:["I confirm I'm 18 or older and agree to the"," ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"text-indigo underline",children:"Terms and Conditions"})," ","and the"," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-indigo underline",children:"Privacy Policy"}),"."]})}),s.jsxs(yt,{type:"button",className:"mt-5 w-full !rounded-pill min-h-[48px]",disabled:!A||!!_,onClick:z,children:["Agree & continue with ",C]}),s.jsx("button",{type:"button",className:"mt-2 min-h-[44px] w-full rounded-lg text-sm text-ink-mid hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo",onClick:()=>N(null),children:"Cancel"})]}),s.jsx(EJ,{slides:!b}),s.jsx("div",{className:"flex items-center justify-center px-4 pb-12 pt-[max(3rem,env(safe-area-inset-top))] sm:px-11 lg:col-start-2 lg:row-start-1 lg:py-8 short:lg:py-3",children:s.jsx(SJ,{title:b?"Grow your":"Create your",accent:b?"Business":"profile",footer:b?null:s.jsx("p",{className:"mx-auto mt-[22px] max-w-[38ch] text-center text-[12.5px] leading-normal text-ink-muted short:mt-2.5",children:"Free to start. No card required. 0% commission on everything you sell."}),children:s.jsxs("div",{className:"mt-4 space-y-3.5 short:mt-3 short:space-y-2.5",children:[s.jsx(YY,{pending:_,onGoogle:()=>M("Google",r),onX:()=>M("X",a)}),E&&s.jsx("p",{ref:F,className:"scroll-mt-4 text-center text-sm text-destructive",children:E}),s.jsx(CJ,{children:"Or sign up with email"}),s.jsx(LAe,{consent:I,onConsentChange:U,consentValid:O,onPrepareHandoff:H,onSubmittingChange:v,onAuthorizeProfileClaim:({createdAccount:W})=>{zR(m),W&&j(!0)},onClearHandoff:G,claimedSlug:m,returnPath:x}),b?s.jsx("button",{type:"button",className:"mx-auto block min-h-11 text-[13px] font-semibold text-ink-mid underline-offset-2 hover:text-ink hover:underline",onClick:()=>{Pt({screen:"business-sources",journey:"business"}),c(ol)},children:"Skip for now"}):null,s.jsxs("p",{className:"text-center text-[13px] text-ink-mid",children:["Already have an account?"," ",s.jsx(Le,{to:Me.LOGIN,state:{from:h.startsWith(Me.CREATE_EXPERT)?Me.HOME:h},className:"font-semibold text-indigo hover:text-indigo-deep",children:"Log in"})]})]})})})]})}function WAe(){const e=new URLSearchParams(window.location.search),t=new URLSearchParams(window.location.hash.replace(/^#/,""));return e.get("error_description")||t.get("error_description")||e.get("error")||t.get("error")||""}function VAe(){const e=new URLSearchParams(window.location.search),t=new URLSearchParams(window.location.hash.replace(/^#/,""));return e.get("error_code")||t.get("error_code")||""}function GAe(){const e=new URLSearchParams(window.location.search);return Lu(e.get("next"),"")}function YAe(){try{return Lu(sessionStorage.getItem("pendingConsentRedirect"),"")}catch{return""}}function KAe(e){try{sessionStorage.setItem("pendingConsentRedirect",Lu(e,Me.DASHBOARD))}catch{}}function o$(){try{sessionStorage.removeItem("pendingConsentRedirect")}catch{}}function l$(e){const t=new Date(e?.created_at||"").getTime();return Number.isFinite(t)&&Date.now()-t<5*6e4}function XAe(){try{const e=sessionStorage.getItem("postAuthRedirect")||"";if(e.startsWith("/experts/new"))return e}catch{}return null}function JAe(e=2500){return new Promise(t=>{let n,r=!1;const a=l=>{r||(r=!0,clearTimeout(i),n?.unsubscribe(),t(l))},i=setTimeout(()=>a(null),e),{data:o}=Rt.auth.onAuthStateChange((l,c)=>{c?.access_token&&a(c)});n=o.subscription,r&&n?.unsubscribe()})}async function QAe(){const t=new URLSearchParams(window.location.search).get("code");if(t){const{data:r,error:a}=await Rt.auth.exchangeCodeForSession(t);if(a)throw a;if(r?.session)return r.session}const{data:{session:n}}=await Rt.auth.getSession();return n||await JAe()}function c$(e,t){const n=e.user?.created_at,r=n&&Date.now()-new Date(n).getTime()<6e4,a=r&&t===Me.DASHBOARD?oc:t,i=()=>window.location.replace(a);if(r){if(a===Me.DASHBOARD)try{sessionStorage.setItem(Yw,"1")}catch{}let o=!1;const l=()=>{o||(o=!0,i())};window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"sign_up",eventCallback:l,eventTimeout:1500}),setTimeout(l,1600)}else i()}function ZAe(){const e=Ps(),[t,n]=f.useState(""),[r,a]=f.useState(!1),[i,o]=f.useState(!1),[l,c]=f.useState({terms_privacy:!1,age_18:!1}),[u,d]=f.useState(!1),[h,p]=f.useState(""),m=f.useRef({session:null,target:"/dashboard"}),g=l.terms_privacy&&l.age_18;f.useEffect(()=>{let b=!1;
65async function y(){const v=Dxe(),w=v?.returnPath||"/login",j=GAe(),E=YAe();try{const S=WAe();if(S){const z=XAe();pN();try{sessionStorage.removeItem("postAuthRedirect")}catch{}if(z){const D=VAe()==="identity_already_exists"||/already linked|already exists/i.test(S)?"That account is already connected to another creator. Sign in with a different social account, or disconnect it there first.":S,Z=z.includes("?")?"&":"?";window.location.replace(`${z}${Z}connection=error&message=${encodeURIComponent(D.slice(0,300))}`);return}n(S),setTimeout(()=>e(w,{replace:!0}),1500);return}const _=await QAe();if(b)return;if(!_?.access_token){n("Sign-in did not complete. Please try again."),v?a(!0):(pN(),setTimeout(()=>e(w,{replace:!0}),1500));return}try{window.history.replaceState({},"",window.location.pathname)}catch{}let k=v?.returnPath||E||"/dashboard",C="";try{C=sessionStorage.getItem("postAuthRedirect")||"",sessionStorage.removeItem("postAuthRedirect")}catch{}!v&&C?k=Lu(C,k):!v&&j&&(k=j);let N=null;try{const z=sessionStorage.getItem("pendingConsent");sessionStorage.removeItem("pendingConsent"),z&&(N=JSON.parse(z))}catch{}const A=v?.consentAccepted?{terms_privacy:!0,age_18:!0}:N,T=A?.terms_privacy===!0&&A?.age_18===!0;let I=!1;if(T)try{await gc({consentType:"account_creation",tosVersion:Ib,checkboxStates:{terms_privacy:!!A.terms_privacy,age_18:!!A.age_18}}),I=!0}catch{p("We could not record your agreement. Please review it and try again.")}v?.anonymousAccessToken&&v.expertId&&await SG(v.anonymousAccessToken,v.expertId,v.conversationId,v.attachmentIds);const $=wG();if($&&!_.user?.is_anonymous)try{await MG($),jG()}catch{}const O=_G();if(O&&!_.user?.is_anonymous)try{const z=await $G(O);NG(z.data?.expert?.id),kG()}catch{}pN();let U=null;try{U=(await tx()).data?.user||null}catch{}const F=BAe(),H=j&&(_.user?.user_metadata?.claimed_username||_.user?.user_metadata?.claimed_slug)||"",G=F||H,M=k.startsWith(Me.CREATE_EXPERT);if(M&&G&&l$(U)){const z=zR(G);z?(Pt({screen:"platforms",username:z,templateCompleted:!0}),k=Eb):(Pt({screen:"welcome",username:""}),k=oc)}else M&&G&&(nf(),U?Pt({screen:"platforms",username:""}):(Pt({screen:"welcome",username:G}),k=oc));if((k===oc||k===Eb)&&U&&!l$(U)&&(k=Me.HOME),I||U?.terms_current===!0){o$(),c$(_,k);return}m.current={session:_,target:k},KAe(k),o(!0)}catch(S){if(b)return;n(S.message||"Sign-in did not complete. Please try again."),v?a(!0):setTimeout(()=>e("/login",{replace:!0}),1500)}}return y(),()=>{b=!0}},[e]);const x=async()=>{if(g){d(!0),p("");try{await gc({consentType:"account_creation",tosVersion:Ib,checkboxStates:{terms_privacy:!0,age_18:!0}});const{session:b,target:y}=m.current;o$(),c$(b,y)}catch{p("We could not record your agreement. Please try again."),d(!1)}}};return i?s.jsx("div",{className:"min-h-[100dvh] bg-cream px-4 flex flex-col items-center justify-center",children:s.jsxs("div",{className:"w-full max-w-[400px] bg-paper rounded-lg border border-rule shadow-card p-6",children:[s.jsx(bn,{height:56}),s.jsx("h1",{className:"font-heading text-xl font-medium text-ink tracking-tight mt-4 mb-1",children:"One last step"}),s.jsx("p",{className:"text-sm text-ink-mid mb-5",children:"Please accept the following to finish creating your account."}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs(tf,{id:"callback-consent-terms-privacy",checked:l.terms_privacy,onChange:b=>c(y=>({...y,terms_privacy:b})),children:["I agree to the"," ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"text-indigo hover:text-indigo-deep underline",children:"Terms and Conditions"})," ","and"," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-indigo hover:text-indigo-deep underline",children:"Privacy Policy"}),"."]}),s.jsx(tf,{id:"callback-consent-age",checked:l.age_18,onChange:b=>c(y=>({...y,age_18:b})),children:"By checking this box, I confirm I am at least 18 years of age."})]}),h&&s.jsx("p",{className:"mt-3 text-sm text-destructive",role:"alert",children:h}),s.jsx(yt,{type:"button",onClick:x,isLoading:u,disabled:!g,className:"w-full !rounded-md mt-5",children:"Continue"})]})}):s.jsx("div",{className:"min-h-[100dvh] bg-cream px-4 flex flex-col items-center justify-center",children:s.jsxs("div",{className:"flex flex-col items-center gap-4",children:[s.jsx(bn,{height:64}),s.jsx("p",{className:"text-ink-mid",children:t||"Completing sign-inâ¦"}),t&&r&&s.jsx(yt,{type:"button",onClick:()=>window.location.reload(),children:"Try again"})]})})}function e3e(){const[e,t]=f.useState(""),[n,r]=f.useState(!1),[a,i]=f.useState(""),[o,l]=f.useState(!1),c=async u=>{u.preventDefault(),i(""),r(!0);try{await Xxe(e),l(!0)}catch{l(!0)}finally{r(!1)}};return s.jsxs("div",{className:"relative flex min-h-dvh flex-col items-center justify-center overflow-hidden bg-cream px-6 py-14 text-ink",children:[s.jsxs("div",{className:"pointer-events-none absolute inset-0 overflow-hidden","aria-hidden":"true",children:[s.jsx("div",{className:"absolute -left-40 -top-[180px] h-[640px] w-[640px] animate-drift rounded-full bg-[radial-gradient(circle,rgba(61,61,245,0.24)_0%,rgba(61,61,245,0)_68%)] blur-[76px] [animation-duration:22s] motion-reduce:animate-none"}),s.jsx("div",{className:"absolute -bottom-[220px] -right-[180px] h-[720px] w-[720px] animate-drift rounded-full bg-[radial-gradient(circle,rgba(230,195,179,0.52)_0%,rgba(230,195,179,0)_68%)] blur-[76px] [animation-direction:reverse] [animation-duration:26s] motion-reduce:animate-none"})]}),s.jsx(Le,{to:Me.HOME,className:"relative z-[2] mb-10 inline-flex sm:absolute sm:left-11 sm:top-8 sm:mb-0",children:s.jsx(bn,{height:38})}),s.jsx("div",{className:"relative z-[1] w-full max-w-[480px] animate-slide-up motion-reduce:animate-none",children:s.jsxs("div",{className:"rounded-[28px] border border-rule bg-paper p-8 shadow-[0_1px_3px_rgba(20,18,40,0.05),0_20px_44px_-22px_rgba(20,18,40,0.22),0_54px_100px_-44px_rgba(61,61,245,0.30)] sm:px-12 sm:pb-11 sm:pt-14",children:[o?s.jsxs("div",{className:"text-center",role:"status","aria-live":"polite",children:[s.jsx("div",{className:"mx-auto mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-indigo-wash",children:s.jsx(qr,{className:"h-[30px] w-[30px] text-indigo",strokeWidth:1.7})}),s.jsx("span",{className:"font-mono text-[11px] font-medium uppercase tracking-eyebrow text-ink-muted",children:"Check your email"}),s.jsxs("h1",{className:"mb-3.5 mt-2 font-display text-[32px] leading-[1.05] tracking-[-0.02em] sm:text-[40px]",children:["Email ",s.jsx("em",{className:"italic text-indigo",children:"sent"})]}),s.jsxs("p",{className:"mx-auto max-w-[38ch] text-[15.5px] leading-relaxed text-ink-mid",children:["If an account exists with ",s.jsx("strong",{className:"font-semibold text-ink",children:e}),", you'll receive a password reset link. The link will expire in 24 hours."]}),s.jsxs("p",{className:"mx-auto mt-4 max-w-[38ch] text-[15.5px] leading-relaxed text-ink-mid",children:["Don't see it in your inbox? Be sure to check your"," ",s.jsx("strong",{className:"font-semibold text-ink",children:"spam or junk folder"}),"."]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.jsxs("h1",{className:"mb-3.5 font-display text-[38px] leading-[1.02] tracking-[-0.02em] sm:text-[54px]",children:["Forgot your ",s.jsx("em",{className:"italic text-indigo",children:"password?"})]}),s.jsx("p",{className:"mx-auto max-w-[34ch] text-[15.5px] leading-normal text-ink-mid",children:"Enter your email address and we'll send you a link to reset it."})]}),s.jsxs("form",{onSubmit:c,className:"space-y-5",children:[s.jsx(_a,{message:a}
65),s.jsx(ul,{label:"Email",type:"email",value:e,onChange:u=>t(u.target.value),placeholder:"[email protected]",icon:qr,autoComplete:"email",required:!0,autoFocus:!0,disabled:n}),s.jsx(yt,{type:"submit",isLoading:n,disabled:n||!e,className:"w-full !rounded-pill min-h-[52px] text-base shadow-[0_10px_24px_-9px_rgba(61,61,245,0.55)]",children:"Send reset link"})]})]}),s.jsx("p",{className:"mt-8 text-center text-[14.5px] text-ink-mid",children:s.jsxs(Le,{to:Me.LOGIN,className:"inline-flex items-center gap-1.5 font-semibold text-indigo transition-colors duration-base ease-standard hover:text-indigo-deep",children:[s.jsx(ja,{className:"h-4 w-4"}),"Back to log in"]})})]})})]})}const t3e=e=>{const t=[];return e.length<8&&t.push("At least 8 characters"),/[A-Z]/.test(e)||t.push("One uppercase letter"),/[a-z]/.test(e)||t.push("One lowercase letter"),/\d/.test(e)||t.push("One number"),t};function WN({children:e}){return s.jsxs("div",{className:"relative flex min-h-dvh flex-col items-center justify-center overflow-hidden bg-cream px-6 py-14 text-ink",children:[s.jsxs("div",{className:"pointer-events-none absolute inset-0 overflow-hidden","aria-hidden":"true",children:[s.jsx("div",{className:"absolute -left-40 -top-[180px] h-[640px] w-[640px] animate-drift rounded-full bg-[radial-gradient(circle,rgba(61,61,245,0.24)_0%,rgba(61,61,245,0)_68%)] blur-[76px] [animation-duration:22s] motion-reduce:animate-none"}),s.jsx("div",{className:"absolute -bottom-[220px] -right-[180px] h-[720px] w-[720px] animate-drift rounded-full bg-[radial-gradient(circle,rgba(230,195,179,0.52)_0%,rgba(230,195,179,0)_68%)] blur-[76px] [animation-direction:reverse] [animation-duration:26s] motion-reduce:animate-none"})]}),s.jsx(Le,{to:Me.HOME,className:"relative z-[2] mb-10 inline-flex sm:absolute sm:left-11 sm:top-8 sm:mb-0",children:s.jsx(bn,{height:38})}),s.jsx("div",{className:"relative z-[1] w-full max-w-[480px] animate-slide-up motion-reduce:animate-none",children:s.jsx("div",{className:"rounded-[28px] border border-rule bg-paper p-8 shadow-[0_1px_3px_rgba(20,18,40,0.05),0_20px_44px_-22px_rgba(20,18,40,0.22),0_54px_100px_-44px_rgba(61,61,245,0.30)] sm:px-12 sm:pb-11 sm:pt-14",children:e})})]})}function s3e(){const e=Ps(),[t,n]=f.useState(""),[r,a]=f.useState(""),[i,o]=f.useState(!1),[l,c]=f.useState(""),[u,d]=f.useState(!1),[h,p]=f.useState(!1),[m,g]=f.useState(!0),[x,b]=f.useState(!1),y=t3e(t),v=t===r&&r!=="";f.useEffect(()=>{let j=!1;async function E(){try{const{data:{session:S}}=await Rt.auth.getSession();if(j)return;S?.access_token?b(!0):(c("This password reset link is invalid or has expired."),b(!1))}catch{j||(c("Could not validate the reset link."),b(!1))}finally{j||g(!1)}}return E(),()=>{j=!0}},[]);const w=async j=>{if(j.preventDefault(),c(""),y.length>0){c("Please meet all password requirements.");return}if(t!==r){c("Passwords do not match.");return}o(!0);try{await Jxe(t),d(!0)}catch(E){const S=E.response?.data?.detail?.message||"Failed to reset password. The link may have expired.";c(S)}finally{o(!1)}};return m?s.jsx(WN,{children:s.jsxs("div",{className:"py-4 text-center",role:"status","aria-live":"polite",children:[s.jsx(vt,{className:"mx-auto mb-4 h-8 w-8 animate-spin text-indigo"}),s.jsx("p",{className:"text-[15.5px] text-ink-mid",children:"Validating reset link..."})]})}):!x&&!u?s.jsx(WN,{children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mx-auto mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10",children:s.jsx(Co,{className:"h-[30px] w-[30px] text-destructive",strokeWidth:1.7})}),s.jsxs("h1",{className:"mb-3.5 font-display text-[32px] leading-[1.05] tracking-[-0.02em] sm:text-[40px]",children:["Link ",s.jsx("em",{className:"italic text-indigo",children:"expired"})]}),s.jsx("p",{className:"mx-auto mb-7 max-w-[38ch] text-[15.5px] leading-relaxed text-ink-mid",children:l||"This password reset link is invalid, has expired, or has already been used. Please request a new one."}),s.jsx(Le,{to:"/forgot-password",className:"block",children:s.jsx(yt,{className:"w-full !rounded-pill min-h-[52px] text-base shadow-[0_10px_24px_-9px_rgba(61,61,245,0.55)]",children:"Request new link"})})]})}):s.jsx(WN,{children:u?s.jsxs("div",{className:"text-center",role:"status","aria-live":"polite",children:[s.jsx("div",{className:"mx-auto mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-indigo-wash",children:s.jsx(ft,{className:"h-[30px] w-[30px] text-indigo",strokeWidth:2})}),s.jsxs("h1",{className:"mb-3.5 font-display text-[32px] leading-[1.05] tracking-[-0.02em] sm:text-[40px]",children:["Password ",s.jsx("em",{className:"italic text-indigo",children:"reset"})]}),s.jsx("p",{className:"mx-auto mb-7 max-w-[38ch] text-[15.5px] leading-relaxed text-ink-mid",children:"Your password has been reset. You can now log in with your new password."}),s.jsx(yt,{onClick:()=>
65e("/login"),className:"w-full !rounded-pill min-h-[52px] text-base shadow-[0_10px_24px_-9px_rgba(61,61,245,0.55)]",children:"Go to login"})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.jsxs("h1",{className:"mb-3.5 font-display text-[38px] leading-[1.02] tracking-[-0.02em] sm:text-[46px]",children:["Create new ",s.jsx("em",{className:"italic text-indigo",children:"password"})]}),s.jsx("p",{className:"mx-auto max-w-[34ch] text-[15.5px] leading-normal text-ink-mid",children:"Enter a new password for your account."})]}),s.jsxs("form",{onSubmit:w,className:"space-y-5",children:[s.jsx(_a,{message:l}),s.jsxs("div",{children:[s.jsx(ul,{label:"New password",type:"password",value:t,onChange:j=>n(j.target.value),onFocus:()=>p(!0),placeholder:"Enter new password",icon:Zi,autoComplete:"new-password",required:!0,autoFocus:!0,disabled:i}),h&&s.jsx("div",{className:"mt-3 space-y-1.5 pl-1",children:[{text:"At least 8 characters",valid:t.length>=8},{text:"One uppercase letter",valid:/[A-Z]/.test(t)},{text:"One lowercase letter",valid:/[a-z]/.test(t)},{text:"One number",valid:/\d/.test(t)}].map(j=>s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[j.valid?s.jsx(ft,{className:"h-3.5 w-3.5 shrink-0 text-indigo-deep"}):s.jsx(as,{className:"h-3.5 w-3.5 shrink-0 text-ink-light"}),s.jsx("span",{className:j.valid?"text-indigo-deep":"text-ink-muted",children:j.text})]},j.text))})]}),s.jsx(ul,{label:"Confirm password",type:"password",value:r,onChange:j=>a(j.target.value),placeholder:"Confirm new password",icon:Zi,autoComplete:"new-password",required:!0,disabled:i,error:r&&!v?"Passwords do not match":void 0}),s.jsx(yt,{type:"submit",isLoading:i,disabled:i||y.length>0||!v,className:"w-full !rounded-pill min-h-[52px] text-base shadow-[0_10px_24px_-9px_rgba(61,61,245,0.55)]",children:"Reset password"})]}),s.jsx("p",{className:"mt-8 text-center text-[14.5px] text-ink-mid",children:s.jsxs(Le,{to:Me.LOGIN,className:"inline-flex items-center gap-1.5 font-semibold text-indigo transition-colors duration-base ease-standard hover:text-indigo-deep",children:[s.jsx(ja,{className:"h-4 w-4"}),"Back to login"]})})]})})}[...To];function HR({screen:e,onGo:t}){return Ps(),null}const bl={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":!0};function DJ({className:e=""}){return s.jsxs("svg",{...bl,className:e,children:[s.jsx("path",{d:"M12 3l1.9 4.6 4.6 1.9-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3Z"}),s.jsx("path",{d:"M18 16.5l.8 1.9 1.9.8-1.9.8-.8 1.9-.8-1.9-1.9-.8 1.9-.8.8-1.9Z"})]})}function n3e({className:e=""}){return s.jsxs("svg",{...bl,className:e,children:[s.jsx("circle",{cx:"12",cy:"8.5",r:"3.6"}),s.jsx("path",{d:"M4.8 20c1.1-3.4 3.9-5.2 7.2-5.2s6.1 1.8 7.2 5.2"})]})}function BA({className:e=""}){return s.jsxs("svg",{...bl,className:e,children:[s.jsx("path",{d:"M4 19V5"}),s.jsx("path",{d:"M4 19h16"}),s.jsx("path",{d:"M8 19v-6"}),s.jsx("path",{d:"M13 19V9"}),s.jsx("path",{d:"M18 19v-9"})]})}function r3e({className:e=""}){return s.jsxs("svg",{...bl,className:e,children:[s.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"3"}),s.jsx("path",{d:"M3 10.5h18"})]})}function a3e({className:e=""}){return s.jsxs("svg",{...bl,className:e,children:[s.jsx("path",{d:"M10.5 13.5a3.5 3.5 0 0 1 0-5l2-2a3.5 3.5 0 0 1 5 5l-1 1"}),s.jsx("path",{d:"M13.5 10.5a3.5 3.5 0 0 1 0 5l-2 2a3.5 3.5 0 0 1-5-5l1-1"})]})}function $J({className:e=""}){return s.jsxs("svg",{...bl,className:e,children:[s.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"}),s.jsx("path",{d:"M8 9.5h8"}),s.jsx("path",{d:"M8 14.5h5"})]})}function FJ({className:e=""}){return s.jsx("svg",{...bl,className:e,children:s.jsx("path",{d:"M12 3.5l2.4 5.1 5.6.8-4 3.9 1 5.6-5-2.7-5 2.7 1-5.6-4-3.9 5.6-.8L12 3.5Z"})})}function BJ({className:e=""}){return s.jsxs("svg",{...bl,className:e,children:[s.jsx("path",{d:"M9.5 8L6 12l3.5 4"}),s.jsx("path",{d:"M14.5 8L18 12l-3.5 4"})]})}function i3e({className:e=""}){return s.jsxs("svg",{...bl,className:e,children:[s.jsx("path",{d:"M12 5v14"}),s.jsx("path",{d:"M5 12h14"})]})}function UJ({className:e=""}){return s.jsxs("svg",{...bl,strokeWidth:1.6,className:e,children:[s.jsx("path",{d:"M15 5.5V4.8A1.8 1.8 0 0 0 13.2 3H6.8A1.8 1.8 0 0 0 5 4.8v14.4A1.8 1.8 0 0 0 6.8 21h6.4a1.8 1.8 0 0 0 1.8-1.8v-.7"}),s.jsx("path",{d:"M11 12h10"}),s.jsx("path",{d:"M18 8.5l3.5 3.5L18 15.5"})]})}function Gd({title:e,children:t}){return s.jsxs("section",{children:[s.jsx("h2",{className:"ge-surface-eyebrow mb-2 short:mb-1 tall:mb-3 px-1",children:e}),s.jsx("div",{className:"overflow-hidden ge-surface divide-y divide-[rgba(20,20,19,0.06)]",children:t})]})}function kr({icon:e,label:t,note:n,to:r,onClick:a,disabled:i=!1}){const o=i||!r&&!a,l=s.jsxs(s.Fragment,{children:[s.jsx(e,{className:`w-[18px] h-[18px] tall:w-5 tall:h-5 shrink-0 ${o?"text-ink-light":"text-indigo"}`,"aria-hidden":"true"}),s.jsx("span",{className:`flex-1 min-w-0 truncate text-[15.5px] tall:text-[16.5px] font-[450] ${o?"text-ink-muted":"text-ink"}`,children:t}),n&&s.jsx("span",{className:"shrink-0 text-[13px] text-ink-muted tabular-nums",children:n}),s.jsx(hn,{className:`w-4 h-4 shrink-0 ${o?"text-ink-light/60":"text-ink-light"}`,"aria-hidden":"true"})]}),c="flex items-center gap-3.5 tall:gap-4 w-full min-h-[56px] short:min-h-[46px] tall:min-h-[68px] px-5 tall:px-7 py-2.5 short:py-2 tall:py-3.5 text-left",u=`${c} ge-surface-row focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo`;return o?s.jsx("div",{className:`${c}
65 cursor-not-allowed`,"aria-disabled":"true",children:l}):r?s.jsx(Le,{to:r,className:u,children:l}):s.jsx("button",{type:"button",onClick:a,className:u,children:l})}function zJ(){const{expertId:e}=z_(),{experts:t,hasLoaded:n,error:r}=jc(),a=f.useMemo(()=>t.find(m=>m.status==="active")?.id||"",[t]),i=e||a,[o,l]=f.useState({key:"",expert:null,embed:null,failed:!1}),[c,u]=f.useState(0),d=`${i}:${c}`;f.useEffect(()=>{if(!i)return;let m=!1;return Promise.all([cu(i),XG(i).catch(()=>null)]).then(([g,x])=>{m||l({key:d,expert:g?.data?.expert||null,embed:x?.data||null,failed:!1})}).catch(()=>{m||l({key:d,expert:null,embed:null,failed:!0})}),()=>{m=!0}},[i,d]);const h=f.useCallback(()=>u(m=>m+1),[]),p=o.key===d;return{expertId:i,loading:i?!p&&!o.expert:!n&&!r,expert:o.expert,embed:o.embed,failed:p&&o.failed,reload:h}}function HJ(e){return e?.domain?e.serving?{tone:"live",label:`Live on ${e.domain}`}:{tone:"paused",label:`Paused on ${e.domain}`}:{tone:"idle",label:"Not on a website yet"}}function o3e(){const[e,t]=f.useState({newLeads:0,products:null,services:null,planName:null});return f.useEffect(()=>{let n=!1;const r=a=>{n||t(i=>({...i,...a}))};return tR().then(a=>r({newLeads:(a?.requests||[]).filter(i=>i.status==="New").length})).catch(()=>{}),$r().then(a=>{const i=a?.config||{},o=Array.isArray(i.items)?i.items:[],l=Array.isArray(i.services)?i.services:[];r({products:o.filter(c=>c?.type==="product"&&String(c.title||"").trim()).length,services:l.filter(c=>String(c?.name||"").trim()).length})}).catch(()=>{}),Eu().then(a=>{const i=a?.data||{};r({planName:i.active?J_(i.plan).name:"Free"})}).catch(()=>{}),()=>{n=!0}},[]),e}function u$(e,t,n){return e===null?null:e===0?"Add":`${e} ${e===1?t:n}`}function d$(){const{logout:e}=Ut(),t=Ps(),{expert:n,embed:r}=zJ(),{newLeads:a,products:i,services:o,planName:l}=o3e(),c=HJ(r),u=r?.config||{},d=r?.key_id?`/embed/${encodeURIComponent(r.key_id)}?${new URLSearchParams({accent:u.bubble_color||J4,host:r.domain||""})}`:"",h=n?.name||"",p=n?`/experts/${n.slug||n.id}/edit`:null;return s.jsxs("div",{className:"pb-6 sm:pb-8 short:pb-3",children:[s.jsx(vs,{title:"Dashboard | Great Experts",path:"/dashboard",noIndex:!0}),s.jsxs("header",{className:"ge-surface flex flex-wrap items-center gap-x-5 gap-y-3 px-5 py-3 sm:px-7 tall:px-9 short:py-2 tall:py-5 mb-6 sm:mb-7 short:mb-4 tall:mb-9",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"font-heading text-[28px] tall:text-[34px] font-normal leading-[1.1] tracking-[-0.018em] text-ink text-balance",children:h?s.jsxs(s.Fragment,{children:["Welcome back, ",s.jsx("span",{className:"italic text-indigo",children:h})]}):"Welcome back"}),s.jsxs("p",{className:`bd-status is-${c.tone}`,children:[s.jsx("span",{"aria-hidden":"true"}),c.label]})]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2 sm:gap-2.5",children:[s.jsxs(Le,{to:"/dashboard/embed#install",className:"ge-surface-btn short:h-9",children:[s.jsx("span",{className:"hidden sm:inline",children:"Get my code"}),s.jsx("span",{className:"sm:hidden",children:"Code"})]}),s.jsx("button",{type:"button",onClick:()=>{t(Me.HOME),e()},className:"ge-surface-btn ge-surface-btn-icon shrink-0 short:h-9 short:w-9","aria-label":"Sign out",title:"Sign out",children:s.jsx(UJ,{className:"w-[18px] h-[18px]"})})]})]}),s.jsxs("div",{className:"grid gap-6 lg:gap-8 short:lg:gap-5 tall:lg:gap-10 lg:grid-cols-[minmax(0,1fr)_22rem] xl:gr
65id-cols-[minmax(0,1fr)_26rem]",children:[s.jsxs("div",{className:"space-y-5 short:space-y-3 tall:space-y-7",children:[s.jsxs(Gd,{title:"My chat",children:[s.jsx(kr,{icon:BJ,label:"Customize my embed",to:"/dashboard/embed"}),s.jsx(kr,{icon:DJ,label:"Edit my expert",to:p})]}),s.jsxs(Gd,{title:"Inventory",children:[s.jsx(kr,{icon:Mf,label:"Shop",note:u$(i,"product","products"),to:"/dashboard/inventory?tab=shop"}),s.jsx(kr,{icon:I4,label:"Services",note:u$(o,"service","services"),to:"/dashboard/inventory?tab=services"}),s.jsx(kr,{icon:Ts,label:"Contact",to:"/dashboard/inventory?tab=contact"})]}),s.jsxs(Gd,{title:"Leads",children:[s.jsx(kr,{icon:BA,label:"Leads",note:a>0?`${a} new`:null,to:`${Me.LEADS}?tab=requests`}),Nx&&s.jsx(kr,{icon:bY,label:"Conversations",to:`${Me.LEADS}?tab=conversations`}),s.jsx(kr,{icon:BA,label:"Insights",to:Me.LEADS})]}),s.jsxs(Gd,{title:"My account",children:[s.jsx(kr,{icon:$J,label:"My details",to:Me.PROFILE}),s.jsx(kr,{icon:FJ,label:"Subscription plan",note:l,to:"/myaccount/subscriptions"})]})]}),s.jsxs("aside",{className:"bd-preview ge-surface","aria-label":"Try your chat",children:[s.jsxs("div",{className:"bd-preview-head",children:[s.jsx("h2",{className:"ge-surface-eyebrow",children:"Try your chat"}),s.jsx(Le,{to:"/dashboard/embed",className:"bd-preview-link",children:"Customize"})]}),s.jsx("div",{className:"bd-preview-chat",children:d?s.jsx("iframe",{src:d,title:"Your chat",allow:"microphone; clipboard-write"}):s.jsxs("div",{className:"bd-preview-empty",children:[s.jsx("strong",{children:"Your chat shows here"}),s.jsx("span",{children:"Once your chat is set up on a website, you can try it right here."})]})})]})]})]})}const qJ=["phone","message"],qR=["text","textarea","select","radio","multi","checkbox"],ek=["select","radio","multi"],v1=10,WJ=120,VJ=120,UA=20,GJ=80,h$={text:300,textarea:2e3},l3e=["compact","default","custom"],Xw={compact:12,default:20},w1=0,zA=64;function Jw(e){const t=Math.round(Number(e));return Number.isFinite(t)?Math.min(zA,Math.max(w1,t)):Xw.default}function YJ(e={}){return e.contactSpacing==="custom"?Jw(e.contactSpacingPx):Xw[e.contactSpacing]??Xw.default}const c3e=/^cf_[A-Za-z0-9]{1,24}$/,Cu=e=>qJ.includes(e?.id),WR=e=>ek.includes(e?.type),KJ=e=>e==="text"||e==="textarea"||e==="select",VR=e=>e==="radio"||e==="multi",u3e=["any","text","number","phone"];function d3e(e,t){const n=String(t??"");return e==="number"?n.replace(/\D/g,""):e==="phone"?n.replace(/[^\d+ ]/g,"").replace(/(?!^)\+/g,""):e==="text"?n.replace(new RegExp("\\p{N}","gu"),""):n}function HA(){return`cf_${Math.random().toString(36).slice(2,10)||"0"}`}function XJ(e){const t=new Set,n=[];let r=0;for(const i of Array.isArray(e)?e:[]){if(!i||typeof i!="object")continue;if(Cu(i)){t.has(i.id)||n.push({id:i.id}),t.add(i.id);continue}if(!qR.includes(i.type)||r>=v1)continue;let o=typeof i.id=="string"&&c3e.test(i.id)?i.id:HA();for(;t.has(o);)o=HA();t.add(o),r+=1,n.push({id:o,type:i.type,label:String(i.label??"").slice(0,WJ),required:i.required===!0,placeholder:KJ(i.type)?String(i.placeholder??"").slice(0,VJ):"",layout:VR(i.type)&&i.layout==="chips"?"chips":"list",accept:i.type==="text"&&u3e.includes(i.accept)?i.accept:"any",options:ek.includes(i.type)?(Array.isArray(i.options)?i.options:[]).map(l=>String(l??"").slice(0,GJ)).slice(0,UA):[]})}return[...qJ.filter(i=>!t.has(i)).map(i=>({id:i})),...n]}function h3e(e){return XJ(e).flatMap(t=>{if(Cu(t))return[t];const n=t.label.trim();if(!n)return[];const r=[...new Set(t.options.map(a=>a.trim()).filter(Boolean))];return WR(t)&&!r.length?[]:[{...t,label:n,placeholder:t.placeholder.trim(),options:r}]})}function p3e(e){return{id:HA(),type:e,label:"",required:!1,placeholder:"",layout:"list",accept:"any",options:ek.includes(e)?["",""]:[]}}function m3e(e,t){const n=ek.includes(t)?e.options.length?e.options:["",""]:[];return{...e,type:t,options:n,placeholder:KJ(t)?e.placeholder:"",layout:VR(t)?e.layout:"list",accept:t==="text"?e.accept:"any"}}function f3e(e,t,n){if(t===n||t<0||n<0||t>=e.length||n>=e.length)return e;const r=[...e],[a]=r.splice(t,1);return r.splice(n,0,a),r}const g3e=e=>e.filter(t=>!Cu(t)).length;function JJ(e){return e.type==="multi"?[]:e.type==="checkbox"?!1:""}function QJ(e,t){return Cu(e)||!e.required?!1:e.type==="multi"?!Array.isArray(t)||t.length===0:e.type==="checkbox"?t!==!0:typeof t!="string"||!t.trim()}function ZJ(e,t){return e.flatMap(n=>{if(Cu(n))return[];const r=t[n.id]??JJ(n);if(n.type==="checkbox")return[{id:n.id,value:r===!0}];if(n.type==="multi")return r.length?[{id:n.id,value:r}]:[];const a=String(r).trim();return a?[{id:n.id,value:a}]:[]})}const qA=120,GR={chatNow:"Chat now",chatMini:"Chat",expertProfile:"Expert profile",openChat:"Open chat",callSubline:"",callPill:"Call",tabAll:"All",categoryOther:"Other",seeAll:"See all",showLess:"Show less",contactTitle:"Send a contact request",contactEmail:"Email",contactPhone:"Phone number",contactMessage:"Share a little context: goals, timing, anything that helps.",contactChooseOne:"Choose one",contactPickAny:"pick any",contactSentTitle:"Request sent",contactReplyTo:"The reply will go to",contactDone:"Done",contactError:"Could not send your request. Please try again."},x3e=Object.keys(GR);function pa(e,t){const n=e?.pageText?.[t];return typeof n=="string"&&n.trim()||GR[t]||""}function eQ(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{};return Object.fromEntries(x3e.map(n=>[n,typeof t[n]=="string"?t[n].slice(0,qA):""]))}function b3e(e){return Object.fromEntries(Object.entries(eQ(e)).map(([t,n])=>[t,n.trim()]).filter(([,t])=>t))}const WA="Ask my AI",YR=40,rf=60,tQ=e=>typeof e=="string"?e.slice(0,YR):"";function KR(e){return(typeof e?.buttonLabel=="string"?e.buttonLabel.trim():"").slice(0,YR)||"Book"}function y3e(e,t="Buy"){return(typeof e?.buttonLabel=="string"?e.buttonLabel.trim():"").slice(0,rf)||t}function XR(e=[],t){if(t==="none"||!e.length)return null;const n=e.find(a=>String(a.id)===String(t));if(n)return n;const r=[...e].sort((a,i)=>new Date(a.created_at)-new Date(i.created_at));return t==="last"?r[r.length-1]:r[0]}function Qw(e){return Array.isArray(e?.voice_languages)&&e.voice_languages.length>0}function v3e(e){return e?Qw(e)?!0:e.voice_enabled===!0||e.voice_preset_enabled!==!1:!1}function w3e(e=[],t=null,n=null,r=0){const i=n!=null&&String(n)!==""&&e.find(l=>String(l.id)===String(n))||null,o=i||t||null;
65return{expert:o,requested:i,visible:!!o&&(r!==1||!!i)}}const p$=[{code:"EUR",symbol:"â¬"},{code:"USD",symbol:"$"},{code:"GBP",symbol:"£"},{code:"PLN",symbol:"zÅ"},{code:"INR",symbol:"â¹"},{code:"AUD",symbol:"A$"},{code:"CAD",symbol:"C$"},{code:"CHF",symbol:"CHF"},{code:"SEK",symbol:"SEK"},{code:"AED",symbol:"AED"},{code:"JPY",symbol:"Â¥"},{code:"BRL",symbol:"R$"},{code:"ZAR",symbol:"ZAR"}],Rh=[...p$,...(typeof Intl.supportedValuesOf=="function"?Intl.supportedValuesOf("currency"):[]).filter(e=>!p$.some(t=>t.code===e)).map(e=>({code:e,symbol:e}))],E0="EUR",j3e=/^[A-Za-z0-9_-]{1,120}$/;function Kh(e="element"){const t=String(e).replace(/[^A-Za-z0-9_-]/g,"").slice(0,24)||"element";return globalThis.crypto?.randomUUID?`${t}_${globalThis.crypto.randomUUID().replace(/-/g,"")}`:`${t}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,12)}`}function Zw(e,t,n,r){const a=typeof e=="string"?e:"";if(j3e.test(a))return a;const i=`${t}:${n}:${String(r??"")}`;let o=2166136261;for(let l=0;l<i.length;l+=1)o^=i.charCodeAt(l),o=Math.imul(o,16777619);return`${t}_legacy_${(o>>>0).toString(36)}`}function ej(...e){return e.find(t=>typeof t=="string"&&t)||""}function sQ(e){return Rh.find(t=>t.code===e)?.symbol||Rh.find(t=>t.code===E0).symbol}const _3e=/[^\s\d.,\-/]/;function S0(e,t=E0){const n=String(e??"").trim();if(!n)return"";if(/^free$/i.test(n))return"Free";if(_3e.test(n))return n;if(Number(n.replace(/,/g,""))===0)return"Free";if(t==="PLN")return`${n} zÅ`;const r=sQ(t);return/^[A-Za-z]/.test(r)?`${r} ${n}`:`${r}${n}`}const k3e=[2,3,0],nQ=2,N3e=3,E3e=5,S3e=["arch","blob","hex","circle","rounded","diamond"],VA=["sm","md","lg"],rQ=["brand","match","color","image"],C3e=["auto","custom"],By="#407F57",m$=["#FFFFFF","#F5F3EC","#F7EDE6","#EEEAF8","#1C1917"],Am=[{id:"sans",label:"Inter",note:"Clean and neutral",group:"Sans",stack:"'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif"},{id:"manrope",label:"Manrope",note:"Bold and clear",group:"Sans",google:"Manrope:wght@400;500;600;700;800",stack:"'Manrope', ui-sans-serif, system-ui, sans-serif"},{id:"serif",label:"Fraunces",note:"Warm and editorial",group:"Serif",stack:"'Fraunces', Georgia, 'Times New Roman', serif"},{id:"rounded",label:"System rounded",note:"Soft and friendly",group:"Sans",stack:"ui-rounded, 'SF Pro Rounded', 'Avenir Next', 'Trebuchet MS', sans-serif"},{id:"mono",label:"JetBrains Mono",note:"Technical and precise",group:"Mono",stack:"'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace"},{id:"dm-sans",label:"DM Sans",note:"Geometric and calm",group:"Sans",google:"DM+Sans:ital,opsz,wght@0,9..40,300..700;1,9..40,300..700",stack:"'DM Sans', ui-sans-serif, system-ui, sans-serif"},{id:"work-sans",label:"Work Sans",note:"Steady and modern",group:"Sans",google:"Work+Sans:ital,wght@0,300..700;1,300..700",stack:"'Work Sans', ui-sans-serif, system-ui, sans-serif"},{id:"figtree",label:"Figtree",note:"Friendly and bright",group:"Sans",google:"Figtree:ital,wght@0,300..800;1,300..800",stack:"'Figtree', ui-sans-serif, system-ui, sans-serif"},{id:"plus-jakarta",label:"Plus Jakarta Sans",note:"Crisp and premium",group:"Sans",google:"Plus+Jakarta+Sans:ital,wght@0,300..700;1,300..700",stack:"'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif"},{id:"outfit",label:"Outfit",note:"Bold and graphic",group:"Sans",google:"Outfit:[email protected]",stack:"'Outfit', ui-sans-serif, system-ui, sans-serif"},{id:"nunito",label:"Nunito",note:"Rounded and warm",group:"Sans",google:"Nunito:ital,wght@0,300..800;1,300..800",stack:"'Nunito', ui-sans-serif, system-ui, sans-serif"},{id:"poppins",label:"Poppins",note:"Round and confident",group:"Sans",google:"Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400;1,600",stack:"'Poppins', ui-sans-serif, system-ui, sans-serif"},{id:"space-grotesk",label:"Space Grotesk",note:"Quirky and technical",group:"Sans",google:"Space+Grotesk:[email protected]",stack:"'Space Grotesk', ui-sans-serif, system-ui, sans-serif"},{id:"playfair",label:"Playfair Display",note:"High contrast, elegant",group:"Serif",google:"Playfair+Display:ital,wght@0,400..8
6500;1,400..800",stack:"'Playfair Display', Georgia, serif"},{id:"lora",label:"Lora",note:"Readable and literary",group:"Serif",google:"Lora:ital,wght@0,400..700;1,400..700",stack:"'Lora', Georgia, serif"},{id:"source-serif",label:"Source Serif 4",note:"Quiet and bookish",group:"Serif",google:"Source+Serif+4:ital,opsz,wght@0,8..60,300..700;1,8..60,300..700",stack:"'Source Serif 4', Georgia, serif"},{id:"crimson",label:"Crimson Pro",note:"Classic and slim",group:"Serif",google:"Crimson+Pro:ital,wght@0,300..700;1,300..700",stack:"'Crimson Pro', Georgia, serif"},{id:"instrument-serif",label:"Instrument Serif",note:"Editorial and striking",group:"Serif",google:"Instrument+Serif:ital@0;1",stack:"'Instrument Serif', Georgia, serif"},{id:"dm-serif",label:"DM Serif Display",note:"Big and expressive",group:"Serif",google:"DM+Serif+Display:ital@0;1",stack:"'DM Serif Display', Georgia, serif"},{id:"bricolage",label:"Bricolage Grotesque",note:"Playful and editorial",group:"Display",google:"Bricolage+Grotesque:opsz,[email protected],300..800",stack:"'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif"},{id:"unbounded",label:"Unbounded",note:"Loud and futuristic",group:"Display",google:"Unbounded:[email protected]",stack:"'Unbounded', ui-sans-serif, system-ui, sans-serif"},{id:"ibm-plex-mono",label:"IBM Plex Mono",note:"Even and engineered",group:"Mono",google:"IBM+Plex+Mono:ital,wght@0,300;0,400;0,500;0,600;1,400",stack:"'IBM Plex Mono', ui-monospace, Menlo, monospace"}],aQ=Am.map(e=>e.id),T3e=["Sans","Serif","Display","Mono"];function iQ(e){const t=typeof e=="string"?e:Ba(e&&e.headerStyle?e:{headerStyle:e}).font;return Am.find(n=>n.id===t)||Am[0]}function JR(e){return iQ(e).stack}function A3e(e){const n=(Array.isArray(e)?e:[e]).map(r=>iQ(r).google).filter((r,a,i)=>r&&i.indexOf(r)===a);return n.length?`https://fonts.googleapis.com/css2?${n.map(r=>`family=${r}`).join("&")}&display=swap`:""}const R3e=[{id:"dots",label:"Dots",icon:"···"},{id:"grid",label:"Grid",icon:"â¦"},{id:"waves",label:"Waves",icon:"â¿"},{id:"mesh",label:"Mesh",icon:"â"},{id:"orbs",label:"Orbs",icon:"ââ"}],I3e=R3e.map(e=>e.id),f$={cream:"#FDFCF8",ink:"#1C1917",sage:"#E8F0EA",peach:"#F7EDE6",lavender:"#EEEAF8",sky:"#E6F1F8",rose:"#F8E8EC",midnight:"#12162B",sand:"#F2EBD9",slate:"#EAEEF3"},QR=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function Yd(e,t="#F5F3EC"){const n=String(e??"").trim();if(!QR.test(n))return t;if(n.length===4){const[,r,a,i]=n;return`#${r}${r}${a}${a}${i}${i}`.toUpperCase()}return n.toUpperCase()}function hh(e){const t=String(e??"").trim();return QR.test(t)?Yd(t,"#000000"):null}function ZR(e){return String(e??"").replace(/\s+/g," ").trim()}function eI(e,t){const n=String(e??"");return n.trim()?typeof t=="number"?n.slice(0,t):n:""}const j1="radial-gradient(45% 40% at 8% 5%, rgba(61,61,245,.12), transparent 70%), radial-gradient(45% 45% at 95% 20%, rgba(230,195,179,.55), transparent 70%), radial-gradient(50% 50% at 50% 100%, rgba(133,92,214,.10), transparent 70%), #F5F3EC";function P3e(e,t="#F5F3EC"){const n=Yd(t,"#F5F3EC");switch(e){case"dots":return`radial-gradient(circle at 1px 1px, rgba(28,25,23,.1) 1.2px, transparent 0) 0 0 / 18px 18px, ${n}`;case"grid":return`linear-gradient(rgba(28,25,23,.06) 1px, transparent 1px) 0 0 / 24px 24px, linear-gradient(90deg, rgba(28,25,23,.06) 1px, transparent 1px) 0 0 / 24px 24px, ${n}`;case"waves":return`repeating-linear-gradient(105deg, transparent, transparent 12px, rgba(28,25,23,.05) 12px, rgba(28,25,23,.05) 13px), radial-gradient(80% 50% at 20% 100%, rgba(61,61,245,.08), transparent 55%), ${n}`;case"mesh":return`radial-gradient(40% 35% at 15% 20%, rgba(61,61,245,.14), transparent 60%), radial-gradient(35% 40% at 85% 30%, rgba(133,92,214,.12), transparent 55%), radial-gradient(45% 40% at 50% 90%, rgba(230,195,179,.2), transparent 60%), ${n}`;case"orbs":return`radial-gradient(circle at 18% 22%, rgba(255,255,255,.45) 0 48px, transparent 50px), radial-gradient(circle at 82% 18%, rgba(61,61,245,.12) 0 64px, transparent 66px), radial-gradient(circle at 70% 78%, rgba(230,195,179,.35) 0 90px, transparent 92px), radial-gradient(circle at 22% 72%, rgba(133,92,214,.1) 0 56px, transparent 58px), ${n}`;default:return n}}function L3e(e,t){const n=String(e||"").replace(/\\/g,"\\\\").replace(/"/g,'\\"'),r=Yd(t,"#F5F3EC");return`center / cover no-repeat url("${n}"), ${r}`}function fu(e={}){return e.heroSurfaceOn===!1?null:e.heroSurfaceUrl||null}const tk="Send a request",tj=60,Gs={enabled:!0,handover:"Contact",desc:"Your request goes straight to the creator,",contactCta:tk,confirm:"Thanks, your request has been received. You will usually get a reply within 2 business days by email.",rtime:"",currency:E0,services:[],items:[],categories:{},roles:[],socials:[],featuredExpertId:"",steps:{contact:!0,services:!0,booking:!1},bookingUrl:"",collect:{phone:!0,message:!0},contactFields:[{id:"phone"},{id:"message"}],contactDividers:!1,contactSpacing:"default",contactSpacingPx:20,share:"choice-full",notifyExtra:[],order:[],layouts:{},headerStyle:{bannerUrl:null,photoUrl:null,identity:"name",logoUrl:null,displayName:"",font:"sans",nameSize:"md",bioSize:"md",nameColor:null,bioColor:null,autoColor:!1,heroSurfaceColor:"#FFFFFF",heroSurfaceUrl:null,heroSurfaceOn:!0,componentColorMode:"auto",componentColor:"#3D3DF5",componentTextColor:null,shape:"arch",shapeColor:"#E6C3B3",pageBg:"brand",pageBgColor:"#F5F3EC",pageBgPattern:"dots",pageBgUrl:null},headings:{},headingColors:{},customs:{},profileExperts:[],profileExpertsOff:[],trim:nQ,callStyle:0,callColor:null,floatingAsk:!0,floatingAskText:"Ask anything...",floatingAskCall:!0},sk=80,Pb="Ask anything...";function sj(e={}){return(typeof e?.floatingAskText=="string"?e.floatingAskText.trim():"").slice(0,sk)||Pb}function nk(e={}
65){return(typeof e?.contactCta=="string"?e.contactCta.trim():"").slice(0,tj)||tk}function oQ(e,t){const n=String(e||"").trim();if(n)return n.slice(0,200);const r=String(t||"").trim(),a=r.indexOf("@");return((a>0?r.slice(0,a).trim():"")||r||"Visitor").slice(0,200)}const O3e=["video","podcast","post","resource","product"],M3e=["course","ebook","product"],D3e=["youtube","spotify","tiktok","vimeo","loom","instagram","facebook","linkedin","x"],$3e=["header","expert","services","media","products","contact","custom"],g$=["custom"],F3e=["header","expert","services","media","products","contact"],lQ=5,Lb=5,nj=60,tI=500,sI=8,nI=60,rI=["services","media","products"],mn=e=>String(e??"").split("#")[0],rj=e=>{const t=String(e??"").trim().slice(0,80);return/^[A-Za-z0-9_-]+$/.test(t)?t:""};function cQ(e){const t=On(e);return Object.fromEntries(rI.map(n=>{const r=new Set,a=fa(t[n]).filter(i=>i&&typeof i=="object").map(i=>({id:rj(i.id),name:String(i.name||"").slice(0,nI),img:String(i.img||"")})).filter(i=>!i.id||r.has(i.id)?!1:(r.add(i.id),!0)).slice(0,sI);return[n,a]}))}function nl(e,t){const n=mn(t);return rI.includes(n)?fa(On(e?.categories)[n]):[]}function B3e(e){return Object.fromEntries(Object.entries(cQ(e)).map(([t,n])=>[t,n.map(r=>({id:r.id,name:r.name.trim().slice(0,nI),...r.img.trim()?{img:r.img.trim()}:{}})).filter(r=>r.name)]))}const dl=e=>fa(e).filter(t=>typeof t=="string"||typeof t=="number").map(String).filter(Boolean);function aI(e){const t=new Set;let n=0;const r=[];for(const a of fa(e)){const i=String(a??""),o=mn(i);if($3e.includes(o)){if(g$.includes(o)){if(!i.includes("#")||n>=lQ||t.has(i))continue;n+=1}else if(t.has(o))continue;t.add(g$.includes(o)?i:o),r.push(i)}}return r.length?["header",...r.filter(a=>a!=="header")]:[]}function wa(e={}){const t=aI(e.order);return t.length?t:[...F3e]}function af(e,t,n=""){return String(On(e.headings)[t]??"").trim()||n}function of(e,t){return hh(On(e.headingColors)[t])}const GA=e=>`${e}:shelves`,YA=e=>`${e}:desc`;function Tp(e,t){return of(e,GA(t))||of(e,t)}function rk(e,t=""){const n=Number(e),r=mn(t)==="header"?E3e:N3e;return Number.isInteger(n)&&n>0&&n<=r?n:0}function Ih(e,t){return rk(On(e.layouts)[t],t)}const U3e={2:"line-clamp-2",3:"line-clamp-3",0:""};function iI(e){const t=Number(On(e).trim);return k3e.includes(t)?t:nQ}function z3e(e){return U3e[iI(e)]}const aj=["sage","compact","icon","ink","row","warm","bar"];function Uf(e){const t=Number(On(e).callStyle);return Number.isInteger(t)&&t>0&&t<aj.length?t:0}function KA(e){return aj[Uf(e)]}function ph(e){const t=On(e).callColor;return t==null||t===""?null:QR.test(String(t))?String(t).toUpperCase():null}const oI=60;function ak(e){const t=On(e).callLabel;return typeof t=="string"?t.trim().slice(0,oI):""}function Xh(e=[],t={}){const n=dl(On(t).profileExperts),r=new Map(e.map(a=>[String(a.id),a]));return n.map(a=>r.get(a)).filter(Boolean)}const ik=e=>e?.type==="product";function uQ(e,t){const n=mn(t)==="products";return fa(e.items).filter(r=>ik(r)===n)}function dQ(e){const t={media:!1,product:!1};return fa(e).map(n=>{const r=ik(n)?"product":"media";if(!!n?.featured&&!t[r])return t[r]=!0,{...n,featured:!0};if(!n||!("featured"in n))return n;const i={...n};return delete i.featured,i})}function hQ(e,t){const n=uQ(e,t).filter(a=>String(a?.title??"").trim()),r=n.find(a=>a.featured)||null;return{featured:r,rest:r?n.filter(a=>a!==r):n}}function x$(e){return hQ(e,"media")}function b$(e){return hQ(e,"products")}function H3e(e,t,{experts:n=[]}={}){switch(mn(t)){case"expert":return n.length?Xh(n,e).length:dl(e.profileExperts).length;case"services":return fa(e.services).filter(r=>String(r?.name??"").trim()).length;case"media":case"products":return uQ(e,t).filter(r=>String(r?.title??"").trim()).length;case"custom":{const r=On(On(e.customs)[t]),i=fa(r.links).some(l=>String(l?.label??"").trim()||String(l?.url??"").trim());return af(e,t)||String(r.text??"").trim()||i?1:0}default:return 1}}const On=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{},fa=e=>Array.isArray(e)?e:[];function pQ(e,t){const n=fa(e).filter(a=>typeof a=="string"),r=Aa(t);return!r||n.some(a=>Aa(a)===r)||n.length>=8?n:[...n,r]}function ar(e={}){const t=On(e),n={...Gs.steps,...On(t.steps),booking:!1};return{...Gs,...t,currency:Rh.some(r=>r.code===t.currency)?t.currency:E0,steps:n,collect:{...Gs.collect,...On(t.collect)},contactFields:XJ(t.contactFields),contactDividers:t.contactDividers===!0,contactSpacing:t.contactSpacing==="roomy"?"custom"
65:l3e.includes(t.contactSpacing)?t.contactSpacing:"default",contactSpacingPx:t.contactSpacing==="roomy"?28:Jw(t.contactSpacingPx??20),services:fa(t.services).filter(r=>r&&typeof r=="object").map((r,a)=>{const i={...r,id:Zw(r.id,"service",a,ej(r.url,r.name)),name:String(r.name||""),buttonLabel:tQ(r.buttonLabel),desc:String(r.desc||""),price:String(r.price||""),url:String(r.url||""),img:String(r.img||"")},o=rj(r.categoryId);return o?i.categoryId=o:delete i.categoryId,i}),items:fa(t.items).filter(r=>r&&typeof r=="object").map((r,a)=>{const i={...r,id:Zw(r.id,"item",a,ej(r.url,r.title)),type:O3e.includes(r.type)?r.type:"resource",kind:M3e.includes(r.kind)?r.kind:"product",title:String(r.title||""),buttonLabel:typeof r.buttonLabel=="string"?r.buttonLabel.slice(0,rf):"",meta:String(r.meta||""),url:String(r.url||""),img:String(r.img||""),thumbnailMode:["auto","custom","none"].includes(r.thumbnailMode)?r.thumbnailMode:r.img?"custom":"auto",thumbnailLink:String(r.thumbnailLink||""),provider:D3e.includes(r.provider)?r.provider:"",duration:String(r.duration||"").slice(0,12),embed:r.embed!==!1,price:String(r.price||""),featured:!!r.featured},o=rj(r.categoryId);return o?i.categoryId=o:delete i.categoryId,i}),categories:cQ(t.categories),roles:fa(t.roles).filter(r=>typeof r=="string").slice(0,3),socials:pQ(fa(t.socials).filter(r=>typeof r=="string"),t.bookingUrl),bookingUrl:"",notifyExtra:fa(t.notifyExtra).filter(r=>typeof r=="string"),order:aI(t.order),layouts:q3e(t.layouts),headerStyle:Ba({headerStyle:t.headerStyle}),headings:G3e(t.headings),headingColors:Y3e(t.headingColors),customs:K3e(t.customs),profileExperts:dl(t.profileExperts),profileExpertsOff:dl(t.profileExpertsOff),trim:iI(t),callStyle:Uf(t),callColor:ph(t),callLabel:ak(t),pageText:eQ(t.pageText),floatingAsk:t.floatingAsk!==!1,floatingAskText:sj(t),floatingAskCall:t.floatingAskCall!==!1,contactCta:typeof t.contactCta=="string"?t.contactCta.slice(0,tj):tk}}function q3e(e){return Object.fromEntries(Object.entries(On(e)).map(([t,n])=>[t,rk(n,t)]))}function Ba(e={}){const t=On(On(e).headerStyle),n=typeof t.bannerUrl=="string"?t.bannerUrl.trim():"",r=typeof t.photoUrl=="string"?t.photoUrl.trim():"",a=typeof t.logoUrl=="string"?t.logoUrl.trim():"",i=typeof t.pageBg=="string"?t.pageBg.trim():"";let o=i,l=t.pageBgColor;f$[i]&&(o="color",l=l||f$[i]),o==="pattern"&&(o="color"),rQ.includes(o)||(o=Gs.headerStyle.pageBg);const c=typeof t.pageBgUrl=="string"?t.pageBgUrl.trim():"",u=typeof t.heroSurfaceUrl=="string"?t.heroSurfaceUrl.trim():"",d=typeof t.pageBgPattern=="string"?t.pageBgPattern.trim():"",h=t.autoColor,p=h===!0||h===1||h==="1"||h==="true",m=typeof t.componentColorMode=="string"?t.componentColorMode.trim():"",g=typeof t.font=="string"?t.font.trim():"",x=typeof t.nameSize=="string"?t.nameSize.trim():"",b=typeof t.bioSize=="string"?t.bioSize.trim():"";return{bannerUrl:n||null,photoUrl:r||null,identity:t.identity==="logo"?"logo":"name",logoUrl:a||null,displayName:typeof t.displayName=="string"?t.displayName.slice(0,100):"",font:aQ.includes(g)?g:Gs.headerStyle.font,nameSize:VA.includes(x)?x:Gs.headerStyle.nameSize,bioSize:VA.includes(b)?b:Gs.headerStyle.bioSize,nameColor:hh(t.nameColor),bioColor:hh(t.bioColor),autoColor:p,heroSurfaceColor:Yd(t.heroSurfaceColor,Gs.headerStyle.heroSurfaceColor),heroSurfaceUrl:u||null,heroSurfaceOn:t.heroSurfaceOn!==!1,componentColorMode:C3e.includes(m)?m:Gs.headerStyle.componentColorMode,componentColor:Yd(t.componentColor,Gs.headerStyle.componentColor),componentTextColor:hh(t.componentTextColor),shape:S3e.includes(t.shape)?t.shape:Gs.headerStyle.shape,shapeColor:Yd(t.shapeColor,Gs.headerStyle.shapeColor),pageBg:o,pageBgColor:Yd(l,Gs.headerStyle.pageBgColor),pageBgPattern:I3e.includes(d)?d:Gs.headerStyle.pageBgPattern,pageBgUrl:c||null}}function lI(e={},t=""){const n=eI(Ba(e).displayName);return n||String(t??"").trim()}const W3e=20;function cI(e){const t=ZR(e)||"this creator";return t.length>W3e?"Call my AI":`Call ${t}'s AI`}function uI(e={},t=""){const n=Ba(e).photoUrl;return n||(typeof t=="string"?t.trim():"")||null}function V3e(e,t=null){const n=Ba(typeof e=="string"?{headerStyle:{pageBg:e}}:{headerStyle:e});switch(n.pageBg){case"match":return t||j1;case"color":return n.pageBgColor;case"pattern":return P3e(n.pageBgPattern,n.pageBgColor);case"image":return n.pageBgUrl?L3e(n.pageBgUrl,n.pageBgColor):j1;default:return j1}}function G3e(e){return Object.fromEntries(Object.entries(On(e)).map(([t,n])=>[t,String(n??"").slice(0,nj)]))}function Y3e(e){return Object.fromEntries(Object.entries(On(e)).map(([t,n])=>[t,hh(n)]).filter(([,t])=>t))}function K3e(e){return Object.fromEntries(Object.entries(On(e)).filter(([t])=>mn(t)==="custom").map(([t,n])=>{const r=On(n);return[t,{text:String(r.text??"").slice(0,tI),links:fa(r.links).filter(a=>a&&typeof a=="object").slice(0,Lb).map((a,i)=>({id:Zw(a.id,"link",i,`${t}:${ej(a.url,a.label)}`),label:String(a.label??""),url:String(a.url??""),price:String(a.price??"")}))}]}))}function dI(e,t="",n=!1){const r=pQ(e.socials.map(l=>
65_1(l)).filter(Boolean),e.bookingUrl),a=B3e(e.categories),i=Object.fromEntries(rI.map(l=>[l,new Set(a[l].map(c=>c.id))])),o=(l,c)=>{const u={...l},d=rj(l.categoryId);return d&&i[c].has(d)?u.categoryId=d:delete u.categoryId,u};return{handover:e.handover.trim()||Gs.handover,desc:e.desc.trim()||Gs.desc,contactCta:nk(e),confirm:e.confirm.trim()||Gs.confirm,rtime:e.rtime.trim(),currency:e.currency,services:e.services.filter(l=>l.name.trim()||l.desc.trim()).map(l=>o({...l,buttonLabel:tQ(l.buttonLabel)},"services")),items:dQ(e.items.filter(l=>l.title.trim()||l.url.trim()).map(l=>o(l,ik(l)?"products":"media"))),categories:a,roles:e.roles.map(l=>eI(l,140)).filter(Boolean).slice(0,3),socials:r,featuredExpertId:e.featuredExpertId,steps:{contact:n,services:!0,booking:!1},bookingUrl:"",collect:e.collect,contactFields:h3e(e.contactFields),contactDividers:e.contactDividers===!0,contactSpacing:e.contactSpacing,contactSpacingPx:e.contactSpacingPx,share:e.share,notifyExtra:t.split(",").map(l=>l.trim()).filter(Boolean).slice(0,5),...fQ(e)}}function mQ(e,t){const n=dI(e,"",t);return{...fQ(e),services:n.services,items:n.items,categories:n.categories,roles:n.roles,socials:n.socials,currency:n.currency,bookingUrl:"",featuredExpertId:n.featuredExpertId,desc:n.desc,contactCta:n.contactCta,collect:n.collect,contactFields:n.contactFields,contactDividers:n.contactDividers,contactSpacing:n.contactSpacing,contactSpacingPx:n.contactSpacingPx,steps:{...n.steps,booking:!1}}}function fQ(e){const t=aI(e.order),n=new Set(t);n.add("header");const r=l=>Object.fromEntries(Object.entries(On(l)).filter(([c])=>n.has(c))),a=Object.fromEntries(Object.entries(r(e.headings)).map(([l,c])=>[l,String(c??"").trim().slice(0,nj)]).filter(([,l])=>l)),i=Object.fromEntries(Object.entries(On(e.headingColors)).filter(([l])=>n.has(l.split(":")[0])).map(([l,c])=>[l,hh(c)]).filter(([,l])=>l)),o=Object.fromEntries(Object.entries(r(e.customs)).map(([l,c])=>{const u=On(c);return[l,{text:String(u.text??"").trim().slice(0,tI),links:fa(u.links).map((d,h)=>{const p={id:Zw(d?.id,"link",h,`${l}:${ej(d?.url,d?.label)}`),label:String(d?.label??"").trim().slice(0,nj),url:String(d?.url??"").trim()},m=String(d?.price??"").trim().slice(0,40);return m&&(p.price=m),p}).filter(d=>d.label||d.url).slice(0,Lb)}]}));return{order:t,layouts:Object.fromEntries(Object.entries(r(e.layouts)).map(([l,c])=>[l,rk(c,l)]).filter(([,l])=>l>0)),headerStyle:Ba(e),headings:a,headingColors:i,customs:o,profileExperts:dl(e.profileExperts),profileExpertsOff:dl(e.profileExpertsOff),trim:iI(e),callStyle:Uf(e),callColor:ph(e),callLabel:ak(e),pageText:b3e(e.pageText),floatingAsk:e.floatingAsk!==!1,floatingAskText:sj(e),floatingAskCall:e.floatingAskCall!==!1}}function Aa(e){const t=String(e??"").trim();return/^https?:\/\/\S+$/i.test(t)?t:""}function _1(e){const t=String(e??"").trim();return t?/^https?:\/\//i.test(t)?Aa(t):t.startsWith("//")?Aa(`https:${t}`):/^[a-z][a-z0-9+.-]*:/i.test(t)?"":!/\s/.test(t)&&/^[\w.-]+\.[\w.-]+/.test(t)?Aa(`https://${t}`):"":""}const X3e=[{value:"recruiting",label:"Recruiting talent"},{value:"looking-for-work",label:"Looking for work"}];function J3e(e,t="",n=!1){const r=dI(e,t,n);return{...r,enabled:n,categories:Object.fromEntries(Object.entries(r.categories).map(([a,i])=>[a,i.map(o=>({...o,img:Aa(o.img)}))])),services:r.services.filter(a=>a.name.trim()).map(a=>({...a,action:a.action==="buy"&&Aa(a.url)?"buy":"contact",url:a.action==="buy"?Aa(a.url):"",img:Aa(a.img)})),items:r.items.filter(a=>a.title.trim()).map(a=>({...a,url:Aa(a.url),img:Aa(a.img)})),socials:r.socials.map(Aa).filter(Boolean).slice(0,8),bookingUrl:"",steps:{...r.steps,booking:!1},customs:Object.fromEntries(Object.entries(r.customs).map(([a,i])=>[a,{...i,links:i.links.map(o=>({...o,url:Aa(o.url)}))}]))}}const Q3e={expert:"AI expert",services:"Services",media:"Content",products:"Shop",contact:"Contact request",custom:"Custom section"};function Z3e(e={}){const t=ar(e.config),n={hasPublicExpert:!!e.hasPublicExpert};return wa(t).flatMap(r=>{const a=mn(r),i=Q3e[a];return i?[{key:r,label:a==="custom"?af(t,r,i):i,filled:H3e(t,r,n)>0}]:[]})}function e5e(e=[]){const t=e.filter(r=>r.filled).length,n=e.length;return{done:t,total:n,pct:n?Math.round(t/n*100):0}}function t5e(e){return`${Me.PUBLIC_PAGE}?section=${encodeURIComponent(e)}`}function s5e(e=[]){return e.some(t=>t.filled&&t.key!=="contact")}function n5e(){const[e,t]=f.useState({isLoading:!0,hasError:!1,sections:[]});return f.useEffect(()=>{let n=!1;return $r().then(r=>{n||t({isLoading:!1,hasError:!1,sections:Z3e(r)})}).catch(()=>{n||t(r=>({...r,isLoading:!1,hasError:!0}))}),()=>{n=!0}},[]),{...e,progress:e5e(e.sections),hasPageContent:s5e(e.sections)}}function r5e({creator:e,registerPreviewSlot:t}){const{isLoading:n,hasError:r,hasPageContent:a}=n5e(),i=!n&&!r&&!a;return s.jsx("div",{className:"ge-surface flex h-full flex-col p-5 sm:p-6 short:p-3.5",children:i?s.jsx(i5e,{creator:e}):s.jsx(a5e,{creator:e,registerPreviewSlot:t})})}function a5e({creator:e,registerPreviewSlot:t}){const n=r=>t?.(r);return s.jsxs(s.Fragment,{children:[s.jsx(gQ,{slotRef:n}),s.jsxs(Le,{to:Th(e),target:"_blank",rel:"noopener noreferrer",className:"mt-5 short:mt-3 shrink-0 flex items-center justify-center gap-1.5 rounded-md text-[13px] font-medium text-ink-mid hover:text-indigo-deep focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo transition-colors",children:[s.jsx("span",{className:"truncate",children:H_(e)}),s.jsx(Af,{className:"w-3.5 h-3.5 shrink-0 text-ink-light","aria-hidden":"true"})]})]})}function i5e({creator:e}){return s.jsxs(s.Fragment,{children:[s.jsx(gQ,{children:s.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full px-6 text-center bg-cream",children:[s.jsx(ws,{name:e?.full_name,size:"2xl",src:e?.avatar_url}),s.jsx("p",{className:"mt-4 font-heading text-lg font-medium text-ink tracking-tight text-balance",children:"Your page is waiting"}),s.jsx("p",{className:"mt-1.5 text-xs text-ink-mid text-balance",children:"Add your AI expert, your services and your links, and this is what people will see."})]})}),s.jsxs(Le,{to:Me.PUBLIC_PAGE,className:"btn btn-primary mt-5 w-full text-sm",children:[s.jsx(R_,{className:"w-4 h-4","aria-hidden":"true"}),"Set up my page"]}),s.jsx("p",{className:"mt-2.5 text-center text-[13px] text-ink-muted truncate",children:H_(e)})]})}function gQ({children:e=null,slotRef:t=null}){return s.jsx("div",{className:"ge-device relative mx-auto w-full p-2",style:{maxWidth:`calc(${Dw}px + 1rem)`},children:s.jsxs("div",{ref:t,style:{aspectRatio:`${Dw} / ${uA}`},className:"relative w-full overflow-hidden rounded-[1.5rem] bg-cream",children:[e,s.jsx("span",{"aria-hidden":"true",className:"absolute bottom-[5px] left-1/2 -translate-x-1/2 w-[76px] h-[3px] rounded-pill bg-ink/25"})]})})}async function o5e(){return(await Se.get("/profile-personalization")).data.data}async function l5e(e,t=!1){return(await Se.post("/profile-personalization",{sources:e,retry:t})).data.data}async function c5e(e,t){return(await Se.post("/profile-personalization/decision",{action:e,original:t})).data.data}function hI(e=!0){const[t,n]=f.useState({status:"loading"}),r=f.useRef(0),[a,i]=f.useState(0),o=["queued","running"].includes(t.status);f.useEffect(()=>{if(!e)return;let d=!1;const h=r.current;let p,m=0;const g=async()=>{try{const x=await o5e();if(d||h!==r.current)return;m=0,n(x),["queued","running"].includes(x.status)&&(p=setTimeout(g,1800))}catch{if(d||h!==r.current)return;++m<3?p=setTimeout(g,1800):n(x=>x.template?x:{...x,status:"failed",reason:"request_failed"})}};return g(),()=>{d=!0,clearTimeout(p)}},[e,o,a]);const l=f.useCallback(async(d,h=!1)=>{r.current+=1,n(p=>({...p,status:"queued"}));try{const p=await l5e(d,h);return r.current+=1,i(m=>m+1),n(p),p}catch(p){throw r.current+=1,n(m=>({...m,status:"failed",reason:"request_failed"})),p}},[]),c=f.useCallback(async(d,h)=>{r.current+=1;try{const p=await c5e(d,h);return n(p),p}finally{r.current+=1,i(p=>p+1)}},[]),u=f.useCallback(()=>{r.current+=1,n(d=>({...d,status:"loading"})),i(d=>d+1)},[]);return{state:t,start:l,decide:c,refresh:u}}function xQ(e){return e?.kind==="custom"}const u5e=["bannerUrl","font","nameSize","bioSize","pageBg","pageBgColor","pageBgPattern","pageBgUrl","autoColor","heroSurfaceColor","heroSurfaceUrl","heroSurfaceOn","nameColor","bioColor","shape","shapeColor","componentColorMode","componentColor"];function XA(e={},t){const n=t?.design?.headerStyle||{},r={...e};return u5e.forEach(a=>{n[a]!==void 0&&(r[a]=n[a])}),r.autoColor=n.autoColor??!1,n.heroSurfaceOn!==void 0?r.heroSurfaceOn=n.heroSurfaceOn:n.heroSurfaceUrl?r.heroSurfaceOn=!0:n.heroSurfaceColor&&(r.heroSurfaceOn=!1),r}function JA(e={},t){if(xQ(t)){const r={...Gs.headerStyle,bannerUrl:e.headerStyle?.bannerUrl??null};return{headerStyle:XA(e.headerStyle,{design:{headerStyle:r}}),callStyle:Gs.callStyle,callColor:Gs.callColor,order:[],layouts:{header:0}}}const n=t?.design||{};return{headerStyle:XA(e.headerStyle,t),callStyle:n.callStyle??e.callStyle,callColor:n.callColor??e.callColor,order:n.order?[...n.order]:e.order,layouts:{...e.layouts||{},...n.layouts||{},header:n.headerLayout??e.layouts?.header??0}}}function C0(e,t){const n=JA(e,t);t?.design&&Object.hasOwn(t.design,"callColor")&&(n.callColor=t.design.callColor);const r=wa(e);if(t?.id==="personalized"){const{order:o,...l}=n;return{...e,...l,order:r}}const a=(n.order||[]).filter(o=>r.includes(o)),i=[...new Set(["header",...a,...r])];return{...e,...n,order:i}}function QA(e,t){const n=C0(e,t);return["headerStyle","layouts","order","callStyle","callColor"].every(r=>JSON.stringify(n[r])===JSON.stringify(e[r]))}function lf(e){return{headerStyle:XA({},{design:{headerStyle:e.headerStyle}}),layouts:{...e.layouts},order:[...wa(e)],callStyle:e.callStyle,callColor:e.callColor}}function bQ(e,t){const n=wa(e),r=t.order.filter(i=>n.includes(i)),a=Object.fromEntries(Object.entries(e.layouts).filter(([i])=>n.includes(i)&&!t.order.includes(i)));return{...e,headerStyle:{...e.headerStyle,...t.headerStyle},layouts:{...t.layouts,...a},order:[...new Set(["header",...r,...n])],callStyle:t.callStyle,callColor:t.callColor}}const pI="gx:preview-ready",mI="gx:preview-config",yQ="gx:preview-focus",fI="gx:preview-profile",d5e="gx:preview-edit";function Dx(e,t){return e.origin===window.location.origin&&e.data?.type===t}function vQ(e=[],t=[]){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t.filter(l=>l&&l.id!=null&&l.id!==""):[];if(!r.length)return n;const a=new Map(n.map(l=>[String(l.id),l]));r.forEach(l=>{const c=String(l.id);a.set(c,{...a.get(c)||{},...l})});const i=new Set,o=[];return[...n,...r].forEach(l=>{const c=String(l.id);i.has(c)||(i.add(c),o.push(a.get(c)))}),o}function h5e(e,t){if(!e||t==null||t==="")return null;const n=e[String(t)];return!Array.isArray(n)||n.length!==3?null:n.map(r=>String(r||""))}function p5e(e){const t=String(e||"").replace(/[^a-z0-9-]/gi,"-");return t?`[data-sec="${t}"], #profile-${t}`:""}function m5e(e){if(!e||typeof e.closest!="function")return!1;const t=e.closest("a[href]");if(!t||t.closest("[data-preview-safe]"))return!1;const n=t.getAttribute("target");if(n&&n!=="_self")return!1;const r=String(t.getAttribute("href")||"").trim();return!(!r||r.startsWith("#")||r.startsWith("mailto:")||r.startsWith("tel:"))}function wQ({profilePath:e,config:t,profile:n,interactive:r=!1}){const a=f.useRef(null),i=f.useRef(null),[o,l]=f.useState(300),[c,u]=f.useState(!1);return f.useEffect(()=>{const d=new ResizeObserver(([h])=>l(h.contentRect.width));return d.observe(i.current),()=>d.disconnect()},[]),f.useEffect(()=>{const d=()=>{a.current?.contentWindow?.postMessage({type:mI,config:t},location.origin),n&&a.current?.contentWindow?.postMessage({type:fI,profile:n},location.origin)},h=p=>{p.origin!==location.origin||p.source!==a.current?.contentWindow||p.data?.type!==pI||(u(!0),d())};return window.addEventListener("message",h),c&&d(),()=>window.removeEventListener("message",h)},[t,n,c]),s.jsx("span",{ref:i,className:"ppb-personalized-preview",style:{aspectRatio:"9 / 16"},children:s.jsx("iframe",{ref:a,title:"Personalized profile preview",tabIndex:r?0:-1,src:`${e}${e.includes("?")?"&":"?"}preview=1&device=responsive${n?"&preview_source=parent":""}`,style:{width:450,height:800,transform:`scale(${o/450})`,pointerEvents:r?"auto":"none"}})})}
65function jQ({isOpen:e,onClose:t,state:n,onStart:r,onAccept:a,config:i,profile:o,profilePath:l}){const[c,u]=f.useState(!1),[d,h]=f.useState(""),[p,m]=f.useState(!1),[g,x]=f.useState(""),b=!!n?.template,y=!!n?.sources?.length,v=n?.enabled===!1,w=!v&&!b&&["idle","queued","running"].includes(n?.status),j=async S=>{u(!0),h("");try{await S()}catch(_){h(_?.response?.data?.detail?.message||"Something went wrong. Please try again.")}finally{u(!1)}},E=()=>{c||t()};return s.jsxs(en,{isOpen:e,onClose:E,title:b?"A look inspired by you":"Personalizing your profile",hideTitle:!0,className:"ppb-personalize-dialog",backdropZ:"z-[10020]",contentZ:"z-[10030]",children:[s.jsx("button",{type:"button",className:"ppb-personalize-close",onClick:E,disabled:c,"aria-label":"Close personalization",children:s.jsx(as,{size:18,"aria-hidden":"true"})}),s.jsx("div",{className:"ppb-personalize-eyebrow",children:"A little more you"}),b?s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"A look inspired by you"}),s.jsx("div",{className:"ppb-personalize-result",children:s.jsx(wQ,{profilePath:l,config:C0(i,n.template),profile:o,interactive:!0})}),s.jsxs("div",{className:"ppb-personalize-actions",children:[s.jsx("button",{type:"button",onClick:E,disabled:c,children:"Discard"}),s.jsx("button",{type:"button",className:"is-primary",onClick:()=>j(a),disabled:c,children:c?"Savingâ¦":"Accept"})]})]}):w?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ppb-personalize-art","aria-hidden":"true",children:[s.jsx("div",{className:"ppb-personalize-halo"}),s.jsx("div",{className:"ppb-personalize-orbit is-outer",children:s.jsx("span",{})}),s.jsx("div",{className:"ppb-personalize-orbit is-inner",children:s.jsx("span",{})}),s.jsxs("div",{className:"ppb-personalize-orb",children:[s.jsx("div",{className:"ppb-personalize-colors"}),s.jsx(Ms,{size:34,strokeWidth:1.5})]}),s.jsx("span",{className:"ppb-personalize-spark is-first"}),s.jsx("span",{className:"ppb-personalize-spark is-second"})]}),s.jsx("h2",{children:"Making it yours"}),s.jsxs("div",{className:"ppb-personalize-status",role:"status",children:[s.jsx("span",{children:"Personalizing your profile"}),s.jsxs("span",{className:"ppb-personalize-dots","aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]})]}),s.jsx("div",{className:"ppb-personalize-track","aria-hidden":"true",children:s.jsx("span",{})})]}):s.jsxs(s.Fragment,{children:[s.jsx(Ms,{className:"ppb-personalize-empty-icon",size:40,"aria-hidden":"true"}),s.jsx("h2",{children:v?"Personalization is coming soon":y?"We couldnât create your look yet":"Letâs discover your style"}),s.jsx("p",{className:"ppb-personalize-explanation",children:v?"Please check back later.":y?n?.reason==="already_matches"?"Your current look already matches the suggested design.":n?.reason==="no_meaningful_style"?"We saved your links, but couldnât get enough usable visual detail yet. Social profiles may show a login page. Retry with the imported posts, or choose another link.":"Your links are saved. We couldnât finish inspecting them this time. Please try again.":"Add a website or public social profile with photos or branding so we can create a look inspired by you."}),!v&&s.jsxs(s.Fragment,{children:[y&&s.jsx("ul",{className:"ppb-personalize-sources","aria-label":"Saved personalization links",children:n.sources.map(S=>s.jsx("li",{children:S},S))}),p?s.jsxs("form",{className:"ppb-personalize-source",onSubmit:S=>{S.preventDefault(),j(()=>r([g,...(n?.sources||[]).filter(_=>_!==g)].slice(0,6),!0))},children:[s.jsx("label",{htmlFor:"personalization-url",children:"Website or social profile"}),s.jsx("input",{id:"personalization-url",value:g,onChange:S=>x(S.target.value),placeholder:"https://your-website.com",required:!0,maxLength:2e3}),s.jsx("button",{className:"is-primary",type:"submit",disabled:c||!g.trim(),children:c?"Inspectingâ¦":"Create my look"})]}):s.jsx("button",{type:"button",className:"ppb-personalize-add",onClick:()=>m(!0),children:y?"Use another link":"Add website or social media"}),y&&s.jsx("button",{className:"ppb-personalize-retry",type:"button",disabled:c,onClick:()=>j(()=>r(void 0,!0)),children:"Try again"})]})]}),d&&s.jsx("p",{role:"alert",className:"ppb-personalize-error",children:d})]})}const gI="gx_personalize_after_congrats";function f5e(){try{sessionStorage.setItem(gI,"1")}catch{}}function _Q(){try{return sessionStorage.getItem(gI)==="1"}catch{return!1}}function y$(){try{sessionStorage.removeItem(gI)}catch{}}function kQ({userId:e,welcomeOpen:t=!1,personalization:n,config:r,profile:a,profilePath:i,onAccept:o}){const[l]=f.useState(_Q),[c,u]=f.useState(!1),[d,h]=f.useState(!1),p=f.useRef(!1),{state:m,start:g,decide:x}=n;f.useEffect(()=>{if(!l||!e||t)return;const v=setTimeout(()=>u(!0),2e3);return()=>clearTimeout(v)},[l,e,t]),f.useEffect(()=>{if(!(!l||!c||t||p.current)){if(m.enabled===!1||m.decision==="accepted"||m.decision==="discarded"||m.autoPresented||["failed","ineligible"].includes(m.status)){p.current=!0,y$();return}m.status!=="ready"||!m.template||!r||(p.current=!0,y$(),x("presented").then(v=>{v.claimed!==!1&&h(!0)}).catch(()=>{}))}},[l,c,t,m.enabled,m.decision,m.autoPresented,m.status,m.template,r,x]);const b=()=>
65{h(!1),x("discard").catch(()=>{})},y=async()=>{await o(),h(!1)};return!d||m.status!=="ready"||!m.template?null:s.jsx(jQ,{isOpen:d,onClose:b,state:m,onStart:g,onAccept:y,config:r,profile:a,profilePath:i})}function g5e({user:e,creator:t,welcomeOpen:n,refreshPreview:r}){const[a]=f.useState(_Q),[i,o]=f.useState(null),l=hI(a&&!!e?.id);f.useEffect(()=>{if(!a||!e?.id)return;let u=!1;return $r().then(d=>{u||o(d?.config||{})}).catch(()=>{}),()=>{u=!0}},[a,e?.id]);const c=async()=>{const u=await $r();await l.decide("accept",lf(u?.config||{})),r?.()};return s.jsx(kQ,{userId:e?.id,welcomeOpen:n,personalization:l,config:i,onAccept:c,profile:{full_name:e?.full_name||"Your profile",bio:e?.bio||"",avatar_url:e?.avatar_url},profilePath:qd(t||e)})}function x5e({isOpen:e,onClose:t,experts:n,plan:r}){const[a,i]=f.useState(null);f.useEffect(()=>{if(!e)return;let c=!1;return GTe().then(u=>{if(c)return;const d=u?.data?.embedded||u?.embedded||[];i(Object.fromEntries(d.map(h=>[h.expert_id,h.domain])))}).catch(()=>{c||i({})}),()=>{c=!0}},[e]);const o=a?[...n].sort((c,u)=>+!!a[u.id]-+!!a[c.id]):n,l=r.active&&!r.unlimited&&r.embeddedCount>=r.maxExperts;return s.jsxs(en,{isOpen:e,onClose:t,title:"Embed on my website",maxWidth:"max-w-lg",children:[s.jsx("p",{className:"text-sm text-ink-mid",children:"Let visitors chat with one of your experts on your own site, as a floating bubble or an inline panel. One expert, one website â pick which."}),s.jsx("ul",{className:"mt-4 -mx-1 divide-y divide-rule max-h-[52vh] overflow-y-auto",children:o.map(c=>{const u=a?.[c.id];return s.jsx("li",{children:s.jsxs(Le,{to:`/experts/${c.slug||c.id}/edit?section=embed`,onClick:t,className:"flex items-center gap-3 px-1 py-3 rounded-md transition-colors hover:bg-cream-deep focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo",children:[s.jsx(ws,{name:c.name,size:"sm",variant:"expert",src:c.avatar_url}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-ink",children:c.name}),a===null?s.jsx(gt,{className:"mt-1 h-2.5 w-28"}):s.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5",children:[s.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 rounded-full shrink-0 ${u?"bg-indigo":"bg-ink-light"}`}),s.jsx("span",{className:"truncate text-xs text-ink-muted",children:u||"Not on a website yet"})]})]}),s.jsx(hn,{className:"w-4 h-4 shrink-0 text-ink-light","aria-hidden":"true"})]})},c.id)})}),s.jsxs("div",{className:"mt-4 pt-3 border-t border-rule",children:[r.active?s.jsx("p",{className:"text-xs text-ink-muted",children:r.unlimited?`${r.embeddedCount} embedded. Your account has no limit.`:`${r.embeddedCount} of ${r.maxExperts} expert${r.maxExperts===1?"":"s"} embedded on your plan.`}):s.jsx("p",{className:"text-xs text-ink-muted",children:"You can set an embed up now. It starts working on your website the moment you begin a plan."}),(l||!r.active)&&s.jsx(Le,{to:"/pricing?for=creators",onClick:t,className:"mt-2 inline-block text-xs font-medium text-indigo-deep hover:underline",children:r.active?"Upgrade to embed more experts":"See the plans"})]})]})}async function xI(e="this_month",t=null,n=null){const r={period:e};return e==="custom"&&(t&&(r.start=t),n&&(r.end=n)),(await Se.get("/creators/me/dashboard",{params:r})).data}function b5e(e){return String(e||"").trim().split(/\s+/)[0]||"there"}const y5e={active:!1,unlimited:!1,embeddedCount:0,maxExperts:0,name:null};function v5e(){const[e,t]=f.useState({newLeads:0,pendingUsd:0,plan:y5e});return f.useEffect(()=>{let n=!1;const r=a=>{n||t(i=>({...i,...a}))};return tR().then(a=>r({newLeads:(a?.requests||[]).filter(i=>i.status==="New").length})).catch(()=>{}),xI("all_time").then(a=>r({pendingUsd:a?.data?.earnings?.pending_payout||0})).catch(()=>{}),Eu().then(a=>{const i=a?.data||{};r({plan:{active:!!i.active,unlimited:!!i.unlimited,embeddedCount:i.embedded_count||0,maxExperts:i.max_experts||0,name:i.active?J_(i.plan).name:"Free"}})}).catch(()=>{}),()=>{n=!0}},[]),e}function w5e(){const{user:e,logout:t}=Ut(),n=Ps(),{experts:r,hasLoaded:a}=jc(),{creator:i}=Yh(),{addToast:o}=f.useContext(Zs),{registerPreviewSlot:l,refreshPreview:c}=l_()||{},{newLeads:u,pendingUsd:d,plan:h}=v5e(),[p,m]=f.useState(!1);f.useEffect(()=>{e?.id&&lh("dashboard_view","ge_dashboard_view",{external_id:e.id})},[e?.id]);const[g,x]=f.useState(()=>{try{return sessionStorage.getItem(Yw)!=="1"?!1:(sessionStorage.removeItem(Yw),!0)}catch{return!1}}),b=f.useMemo(()=>r.filter(E=>E.status==="active"),[r]),y=f.useMemo(()=>a&&b.length===0?{label:"Create my AI Expert",to:tl}
65:{label:b.length===1?"Edit my AI Expert":"Edit my AI Experts",to:`${Me.LAB}/experts`},[b,a]),v=f.useMemo(()=>{if(!a||b.length>1)return{onClick:()=>m(!0)};if(b.length===0)return{to:tl};const E=b[0];return{to:`/experts/${E.slug||E.id}/edit?section=embed`}},[b,a]),w=h.active?h.unlimited?`${h.embeddedCount} embedded`:`${h.embeddedCount} of ${h.maxExperts}`:h.embeddedCount>0?"Paused":"Needs a plan",j=async()=>{const E=ll(i);if(navigator.share)try{await navigator.share({title:"My AI expert",url:E});return}catch{return}try{await navigator.clipboard.writeText(E),o("Link copied. Put it wherever people find you.","success")}catch{o("Copy failed. Open your page and copy the address.","error")}};return s.jsxs("div",{className:"pb-6 sm:pb-8 short:pb-3",children:[s.jsx(vs,{title:"Dashboard | Great Experts",path:"/dashboard",noIndex:!0}),s.jsxs("header",{className:"ge-surface flex flex-wrap items-center gap-x-5 gap-y-3 px-5 py-3 sm:px-7 tall:px-9 short:py-2 tall:py-5 mb-6 sm:mb-7 short:mb-4 tall:mb-9",children:[s.jsxs("h1",{className:"min-w-0 font-heading text-[28px] tall:text-[34px] font-normal leading-[1.1] tracking-[-0.018em] text-ink text-balance",children:["Good to see you,"," ",s.jsx("span",{className:"italic text-indigo",children:b5e(e?.full_name)})]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2 sm:gap-2.5",children:[s.jsxs(Le,{to:Th(i),target:"_blank",rel:"noopener noreferrer",className:"ge-surface-btn short:h-9",children:[s.jsx("span",{className:"hidden sm:inline",children:"View my page"}),s.jsx("span",{className:"sm:hidden",children:"View"})]}),s.jsxs("button",{type:"button",onClick:j,className:"ge-surface-btn short:h-9",children:[s.jsx("span",{className:"hidden sm:inline",children:"Share my link"}),s.jsx("span",{className:"sm:hidden",children:"Share"})]}),s.jsx("button",{type:"button",onClick:()=>{n(Me.HOME),t()},className:"ge-surface-btn ge-surface-btn-icon shrink-0 short:h-9 short:w-9","aria-label":"Sign out",title:"Sign out",children:s.jsx(UJ,{className:"w-[18px] h-[18px]"})})]})]}),s.jsxs("div",{className:"grid gap-6 lg:gap-8 short:lg:gap-5 tall:lg:gap-10 lg:grid-cols-[minmax(0,1fr)_22rem] xl:gr
65id-cols-[minmax(0,1fr)_26rem]",children:[s.jsxs("div",{className:"space-y-5 short:space-y-3 tall:space-y-7",children:[s.jsxs(Gd,{title:"My expert",children:[s.jsx(kr,{icon:DJ,label:y.label,to:y.to}),s.jsx(kr,{icon:n3e,label:"Edit my profile page",to:Me.PUBLIC_PAGE}),s.jsx(kr,{icon:BJ,label:"Embed on my website",note:w,to:v.to,onClick:v.onClick}),b.length>0&&s.jsx(kr,{icon:i3e,label:"Add a new expert",to:tl})]}),s.jsxs(Gd,{title:"My performance",children:[s.jsx(kr,{icon:BA,label:"Insights & leads",note:u>0?`${u} new`:null,to:Me.LEADS}),s.jsx(kr,{icon:r3e,label:"Earnings",note:d>0?`$${d.toFixed(2)}`:null,to:"/dashboard/creator"})]}),s.jsxs(Gd,{title:"My account",children:[s.jsx(kr,{icon:a3e,label:"Affiliate programme",note:"Coming soon",disabled:!0}),s.jsx(kr,{icon:$J,label:"My details",to:Me.PROFILE}),s.jsx(kr,{icon:FJ,label:"Subscription plan",note:h.name,to:"/myaccount/subscriptions"})]})]}),s.jsx(r5e,{creator:{...i,avatar_url:e?.avatar_url},registerPreviewSlot:l})]}),s.jsx(x5e,{isOpen:p,onClose:()=>m(!1),experts:b,plan:h}),s.jsx(MAe,{isOpen:g&&!!e,onClose:()=>x(!1),fullName:e?.full_name}),s.jsx(g5e,{user:e,creator:i,welcomeOpen:g&&!!e,refreshPreview:c})]})}function j5e(){const{search:e}=an(),{loaded:t,isBusiness:n}=z_();return B_e(e)?s.jsxs(s.Fragment,{children:[s.jsx(HR,{screen:eK}),s.jsx(d$,{})]}):t?n?s.jsx(d$,{}):s.jsx(w5e,{}):null}var VN,v$;function _5e(){if(v$)return VN;v$=1;var e=!1,t,n,r,a,i,o,l,c,u,d,h,p,m,g,x;function b(){if(!e){e=!0;var v=navigator.userAgent,w=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Ice
65weasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(v),j=/(Mac OS X)|(Windows)|(Linux)/.exec(v);if(p=/\b(iPhone|iP[ao]d)/.exec(v),m=/\b(iP[ao]d)/.exec(v),d=/Android/i.exec(v),g=/FBAN\/\w+;/i.exec(v),x=/Mobile/i.exec(v),h=!!/Win64/.exec(v),w){t=w[1]?parseFloat(w[1]):w[5]?parseFloat(w[5]):NaN,t&&document&&document.documentMode&&(t=document.documentMode);var E=/(?:Trident\/(\d+.\d+))/.exec(v);o=E?parseFloat(E[1])+4:t,n=w[2]?parseFloat(w[2]):NaN,r=w[3]?parseFloat(w[3]):NaN,a=w[4]?parseFloat(w[4]):NaN,a?(w=/(?:Chrome\/(\d+\.\d+))/.exec(v),i=w&&w[1]?parseFloat(w[1]):NaN):i=NaN}else t=n=r=i=a=NaN;if(j){if(j[1]){var S=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(v);l=S?parseFloat(S[1].replace("_",".")):!0}else l=!1;c=!!j[2],u=!!j[3]}else l=c=u=!1}}var y={ie:function(){return b()||t},ieCompatibilityMode:function(){return b()||o>t},ie64:function(){return y.ie()&&h},firefox:function(){return b()||n},opera:function(){return b()||r},webkit:function(){return b()||a},safari:function(){return y.webkit()},chrome:function(){return b()||i},windows:function(){return b()||c},osx:function(){return b()||l},linux:function(){return b()||u},iphone:function(){return b()||p},mobile:function(){return b()||p||m||d||x},nativeApp:function(){return b()||g},android:function(){return b()||d},ipad:function(){return b()||m}};return VN=y,VN}var GN,w$;function k5e(){if(w$)return GN;w$=1;var e=!!(typeof window<"u"&&window.document&&window.document.createElement),t={canUseDOM:e,canUseWorkers:typeof Worker<"u",canUseEventListeners:e&&!!(window.addEventListener||window.attachEvent),canUseViewport:e&&!!window.screen,isInWorker:!e};return GN=t,GN}var YN,j$;
65function N5e(){if(j$)return YN;j$=1;var e=k5e(),t;e.canUseDOM&&(t=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function n(r,a){if(!e.canUseDOM||a&&!("addEventListener"in document))return!1;var i="on"+r,o=i in document;if(!o){var l=document.createElement("div");l.setAttribute(i,"return;"),o=typeof l[i]=="function"}return!o&&t&&r==="wheel"&&(o=document.implementation.hasFeature("Events.wheel","3.0")),o}return YN=n,YN}var KN,_$;function E5e(){if(_$)return KN;_$=1;var e=_5e(),t=N5e(),n=10,r=40,a=800;function i(o){var l=0,c=0,u=0,d=0;return"detail"in o&&(c=o.detail),"wheelDelta"in o&&(c=-o.wheelDelta/120),"wheelDeltaY"in o&&(c=-o.wheelDeltaY/120),"wheelDeltaX"in o&&(l=-o.wheelDeltaX/120),"axis"in o&&o.axis===o.HORIZONTAL_AXIS&&(l=c,c=0),u=l*n,d=c*n,"deltaY"in o&&(d=o.deltaY),"deltaX"in o&&(u=o.deltaX),(u||d)&&o.deltaMode&&(o.deltaMode==1?(u*=r,d*=r):(u*=a,d*=a)),u&&!l&&(l=u<1?-1:1),d&&!c&&(c=d<1?-1:1),{spinX:l,spinY:c,pixelX:u,pixelY:d}}return i.getEventType=function(){return e.firefox()?"DOMMouseScroll":t("wheel")?"wheel":"mousewheel"},KN=i,KN}var XN,k$;function S5e(){return k$||(k$=1,XN=E5e()),XN}var C5e=S5e();const T5e=xc(C5e);function Ob(e){"@babel/helpers - typeof";return Ob=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ob(e)}function A5e(e,t){if(Ob(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ob(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function R5e(e){var t=A5e(e,"string");return Ob(t)=="symbol"?t:t+""}function I5e(e,t,n){return(t=R5e(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Or(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?N$(Object(n),!0).forEach(function(r){I5e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function P5e(e,t,n,r,a,i=0){const{width:o,height:l}=cf(e,t,i),c=Math.min(o,n),u=Math.min(l,r);return c>u*a?{width:u*a,height:u}:{width:c,height:c/a}}function L5e(e){return e.width>e.height?e.width/e.naturalWidth:e.height/e.naturalHeight}function kg(e,t,n,r,a=0){const{width:i,height:o}=cf(t.width,t.height,a);return{x:E$(e.x,i,n.width,r),y:E$(e.y,o,n.height,r)}}function E$(e,t,n,r){const a=Math.abs(t*r/2-n/2);return ok(e,-a,a)}function S$(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function C$(e,t){return Math.atan2(t.y-e.y,t.x-e.x)*180/Math.PI}function O5e(e,t,n,r,a,i=0,o=!0){const l=o?M5e:D5e,c=cf(t.width,t.height,i),u=cf(t.naturalWidth,t.naturalHeight,i),d={x:l(100,((c.width-n.width/a)/2-e.x/a)/c.width*100),y:l(100,((c.height-n.height/a)/2-e.y/a)/c.height*100),width:l(100,n.width/c.width*100/a),height:l(100,n.height/c.height*100/a)},h=Math.round(l(u.width,d.width*u.width/100)),p=Math.round(l(u.height,d.height*u.height/100)),m=u.width>=u.height*r?{width:Math.round(p*r),height:p}:{width:h,height:Math.round(h/r)};return{croppedAreaPercentages:d,croppedAreaPixels:Or(Or({},m),{},{x:Math.round(l(u.width-m.width,d.x*u.width/100)),y:Math.round(l(u.height-m.height,d.y*u.height/100))})}}function M5e(e,t){return Math.min(e,Math.max(0,t))}function D5e(e,t){return t}function $5e(e,t,n,r,a,i){const o=cf(t.width,t.height,n),l=ok(r.width/o.width*(100/e.width),a,i);return{crop:{x:l*o.width/2-r.width/2-o.width*l*(e.x/100),y:l*o.height/2-r.height/2-o.height*l*(e.y/100)},zoom:l}}function F5e(e,t,n){const r=L5e(t);return n.height>n.width?n.height/(e.height*r):n.width/(e.width*r)}
65function B5e(e,t,n=0,r,a,i){const o=cf(t.naturalWidth,t.naturalHeight,n),l=ok(F5e(e,t,r),a,i),c=r.height>r.width?r.height/e.height:r.width/e.width;return{crop:{x:((o.width-e.width)/2-e.x)*c,y:((o.height-e.height)/2-e.y)*c},zoom:l}}function T$(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function U5e(e){return e*Math.PI/180}function cf(e,t,n){const r=U5e(n);return{width:Math.abs(Math.cos(r)*e)+Math.abs(Math.sin(r)*t),height:Math.abs(Math.sin(r)*e)+Math.abs(Math.cos(r)*t)}}function ok(e,t,n){return Math.min(Math.max(e,t),n)}function Uy(...e){return e.filter(t=>typeof t=="string"&&t.length>0).join(" ").trim()}var z5e=`.reactEasyCrop_Container { 66 position: absolute; 67 top: 0; 68 left: 0; 69 right: 0; 70 bottom: 0; 71 overflow: hidden; 72 user-select: none; 73 touch-action: none; 74 cursor: move; 75 display: flex; 76 justify-content: center; 77 align-items: center; 78} 79 80.reactEasyCrop_Image, 81.reactEasyCrop_Video { 82 will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */ 83 max-width: unset; /* prevent global img/video reset rules from constraining the cropper media */ 84} 85 86.reactEasyCrop_Contain { 87 max-width: 100%; 88 max-height: 100%; 89 margin: auto; 90 position: absolute; 91 top: 0; 92 bottom: 0; 93 left: 0; 94 right: 0; 95} 96.reactEasyCrop_Cover_Horizontal { 97 width: 100%; 98 height: auto; 99} 100.reactEasyCrop_Cover_Vertical { 101 width: auto; 102 height: 100%; 103} 104 105.reactEasyCrop_CropArea { 106 position: absolute; 107 left: 50%; 108 top: 50%; 109 transform: translate(-50%, -50%); 110 border: 1px solid rgba(255, 255, 255, 0.5); 111 box-sizing: border-box; 112 box-shadow: 0 0 0 9999em; 113 color: rgba(0, 0, 0, 0.5); 114 overflow: hidden; 115} 116 117.reactEasyCrop_CropAreaRound { 118 border-radius: 50%; 119} 120 121.reactEasyCrop_CropAreaGrid::before { 122 content: ' '; 123 box-sizing: border-box; 124 position: absolute; 125 border: 1px solid rgba(255, 255, 255, 0.5); 126 top: 0; 127 bottom: 0; 128 left: 33.33%; 129 right: 33.33%; 130 border-top: 0; 131 border-bottom: 0; 132} 133 134.reactEasyCrop_CropAreaGrid::after { 135 content: ' '; 136 box-sizing: border-box; 137 position: absolute; 138 border: 1px solid rgba(255, 255, 255, 0.5); 139 top: 33.33%; 140 bottom: 33.33%; 141 left: 0; 142 right: 0; 143 border-left: 0; 144 border-right: 0; 145} 146`;const H5e=1,q5e=3,W5e=1;var lk=class ro extends f.Component{constructor(...t){super(...t),this.cropperRef=f.createRef(),this.imageRef=f.createRef(),this.videoRef=f.createRef(),this.containerPosition={x:0,y:0},this.containerRef=null,this.styleRef=null,this.containerRect=null,this.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},this.dragStartPosition={x:0,y:0},this.dragStartCrop={x:0,y:0},this.gestureZoomStart=0,this.gestureRotationStart=0,this.isTouching=!1,this.lastPinchDistance=0,this.lastPinchRotation=0,this.rafDragTimeout=null,this.rafPinchTimeout=null,this.wheelTimer=null,this.currentDoc=typeof document<"u"?document:null,this.currentWindow=typeof window<"u"?window:null,this.resizeObserver=null,this.previousCropSize=null,this.isInitialized=!1,this.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},this.initResizeObserver=()=>{if(typeof window.ResizeObserver>"u"||!this.containerRef)return;let n=!0;this.resizeObserver=new window.ResizeObserver(r=>{if(n){n=!1;return}this.computeSizes()}),this.resizeObserver.observe(this.containerRef)},this.preventZoomSafari=n=>n.preventDefault(),this.cleanEvents=()=>{this.currentDoc&&(this.currentDoc.removeEventListener("mousemove",this.onMouseMove),this.currentDoc.removeEventListener("mouseup",this.onDragStopped),this.currentDoc.removeEventListener("touchmove",this.onTouchMove),this.currentDoc.removeEventListener("touchend",this.onDragStopped),this.currentDoc.removeEventListener("gesturechange",this.onGestureChange),this.currentDoc.removeEventListener("gestureend",this.onGestureEnd),this.currentDoc.removeEventListener("scroll",this.onScroll))},this.clearScrollEvent=()=>{this.containerRef&&this.containerRef.removeEventListener("wheel",this.onWheel),this.wheelTimer&&clearTimeout(this.wheelTimer)},this.onMediaLoad=()=>{const n=this.computeSizes();n&&(this.previousCropSize=n,this.emitCropData(),this.setInitialCrop(n),this.isInitialized=!0),this.props.onMediaLoaded&&this.props.onMediaLoaded(this.mediaSize)},this.setInitialCrop=n=>{if(this.props.initialCroppedAreaPercentages){const{crop:r,zoom:a}=$5e(this.props.initialCroppedAreaPercentages,this.mediaSize,this.props.rotation,n,this.props.minZoom,this.props.maxZoom);this.props.onCropChange(r),this.props.onZoomChange&&this.props.onZoomChange(a)}else if(this.props.initialCroppedAreaPixels){const{crop:r,zoom:a}=B5e(this.props.initialCroppedAreaPixels,this.mediaSize,this.props.rotation,n,this.props.minZoom,this.props.maxZoom);this.props.onCropChange(r),this.props.onZoomChange&&this.props.onZoomChange(a)}},this.computeSizes=()=>{const n=this.imageRef.current||this.videoRef.current;if(n&&this.containerRef){var r,a,i,o,l,c;this.containerRect=this.containerRef.getBoundingClientRect(),this.saveContainerPosition();const u=this.containerRect.width/this.containerRect.height,d=((r=this.imageRef.current)===null||r===void 0?void 0:r.naturalWi
146dth)||((a=this.videoRef.current)===null||a===void 0?void 0:a.videoWidth)||0,h=((i=this.imageRef.current)===null||i===void 0?void 0:i.naturalHeight)||((o=this.videoRef.current)===null||o===void 0?void 0:o.videoHeight)||0,p=n.offsetWidth<d||n.offsetHeight<h,m=d/h;let g;if(p)switch(this.state.mediaObjectFit){default:case"contain":g=u>m?{width:this.containerRect.height*m,height:this.containerRect.height}:{width:this.containerRect.width,height:this.containerRect.width/m};break;case"horizontal-cover":g={width:this.containerRect.width,height:this.containerRect.width/m};break;case"vertical-cover":g={width:this.containerRect.height*m,height:this.containerRect.height};break}else g={width:n.offsetWidth,height:n.offsetHeight};this.mediaSize=Or(Or({},g),{},{naturalWidth:d,naturalHeight:h}),this.props.setMediaSize&&this.props.setMediaSize(this.mediaSize);const x=this.props.cropSize?this.props.cropSize:P5e(this.mediaSize.width,this.mediaSize.height,this.containerRect.width,this.containerRect.height,this.props.aspect,this.props.rotation);return(((l=this.state.cropSize)===null||l===void 0?void 0:l.height)!==x.height||((c=this.state.cropSize)===null||c===void 0?void 0:c.width)!==x.width)&&this.props.onCropSizeChange&&this.props.onCropSizeChange(x),this.setState({cropSize:x},this.recomputeCropPosition),this.props.setCropSize&&this.props.setCropSize(x),x}},this.saveContainerPosition=()=>{if(this.containerRef){const n=this.containerRef.getBoundingClientRect();this.containerPosition={x:n.left,y:n.top}}},this.onMouseDown=n=>{this.currentDoc&&(n.preventDefault(),this.currentDoc.addEventListener("mousemove",this.onMouseMove),this.currentDoc.addEventListener("mouseup",this.onDragStopped),this.saveContainerPosition(),this.onDragStart(ro.getMousePoint(n)))},this.onMouseMove=n=>this.onDrag(ro.getMousePoint(n)),this.onScroll=n=>{this.currentDoc&&(n.preventDefault(),this.saveContainerPosition())},this.onTouchStart=n=>{this.currentDoc&&(this.isTouching=!0,!(this.props.onTouchRequest&&!this.props.onTouchRequest(n))&&(this.currentDoc.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.currentDoc.addEventListener("touchend",this.onDragStopped),this.saveContainerPosition(),n.touches.length===2?this.onPinchStart(n):n.touches.length===1&&this.onDragStart(ro.getTouchPoint(n.touches[0]))))},this.onTouchMove=n=>{n.preventDefault(),n.touches.length===2?this.onPinchMove(n):n.touches.length===1&&this.onDrag(ro.getTouchPoint(n.touches[0]))},this.onGestureStart=n=>{this.currentDoc&&(n.preventDefault(),this.currentDoc.addEventListener("gesturechange",this.onGestureChange),this.currentDoc.addEventListener("gestureend",this.onGestureEnd),this.gestureZoomStart=this.props.zoom,this.gestureRotationStart=this.props.rotation)},this.onGestureChange=n=>{if(n.preventDefault(),this.isTouching)return;const r=ro.getMousePoint(n),a=this.gestureZoomStart-1+n.scale;if(this.setNewZoom(a,r,{shouldUpdatePosition:!0}),this.props.onRotationChange){const i=this.gestureRotationStart+n.rotation;this.props.onRotationChange(i)}},this.onGestureEnd=n=>{this.cleanEvents()},this.onDragStart=({x:n,y:r})=>{var a,i;this.dragStartPosition={x:n,y:r},this.dragStartCrop=Or({},this.props.crop),(a=(i=this.props).onInteractionStart)===null||a===void 0||a.call(i)},this.onDrag=({x:n,y:r})=>{this.currentWindow&&(this.rafDragTimeout&&this.currentWindow.cancelAnimationFrame(this.rafDragTimeout),this.rafDragTimeout=this.currentWindow.requestAnimationFrame(()=>{if(!this.state.cropSize||n===void 0||r===void 0)return;const a=n-this.dragStartPosition.x,i=r-this.dragStartPosition.y,o={x:this.dragStartCrop.x+a,y:this.dragStartCrop.y+i},l=this.props.restrictPosition?kg(o,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):o;this.props.onCropChange(l)}))},this.onDragStopped=()=>{var n,r;this.isTouching=!1,this.cleanEvents(),this.emitCropData(),(n=(r=this.props).onInteractionEnd)===null||n===void 0||n.call(r)},this.onWheel=n=>{if(!this.currentWindow||this.props.onWheelRequest&&!this.props.onWheelRequest(n))return;n.preventDefault();const r=ro.getMousePoint(n),{pixelY:a}=T5e(n),i=this.props.zoom-a*this.props.zoomSpeed/200;this.setNewZoom(i,r,{shouldUpdatePosition:!0}),this.state.hasWheelJustStarted||this.setState({hasWheelJustStarted:!0},()=>{var o,l;return(o=(l=this.props).onInteractionStart)===null||o===void 0?void 0:o.call(l)}),this.wheelTimer&&clearTimeout(this.wheelTimer),this.wheelTimer=this.currentWindow.setTimeout(()=>this.setState({hasWheelJustStarted:!1},()=>{var o,l;return(o=(l=this.props).onInteractionEnd)===null||o===void 0?void 0:o.call(l)}),250)},this.getPointOnContainer=({x:n,y:r},a)=>
146{if(!this.containerRect)throw new Error("The Cropper is not mounted");return{x:this.containerRect.width/2-(n-a.x),y:this.containerRect.height/2-(r-a.y)}},this.getPointOnMedia=({x:n,y:r})=>{const{crop:a,zoom:i}=this.props;return{x:(n+a.x)/i,y:(r+a.y)/i}},this.setNewZoom=(n,r,{shouldUpdatePosition:a=!0}={})=>{if(!this.state.cropSize||!this.props.onZoomChange)return;const i=ok(n,this.props.minZoom,this.props.maxZoom);if(a){const o=this.getPointOnContainer(r,this.containerPosition),l=this.getPointOnMedia(o),c={x:l.x*i-o.x,y:l.y*i-o.y},u=this.props.restrictPosition?kg(c,this.mediaSize,this.state.cropSize,i,this.props.rotation):c;this.props.onCropChange(u)}this.props.onZoomChange(i)},this.getCropData=()=>this.state.cropSize?O5e(this.props.restrictPosition?kg(this.props.crop,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):this.props.crop,this.mediaSize,this.state.cropSize,this.getAspect(),this.props.zoom,this.props.rotation,this.props.restrictPosition):null,this.emitCropData=()=>{const n=this.getCropData();if(!n)return;const{croppedAreaPercentages:r,croppedAreaPixels:a}=n;this.props.onCropComplete&&this.props.onCropComplete(r,a),this.props.onCropAreaChange&&this.props.onCropAreaChange(r,a)},this.emitCropAreaChange=()=>{const n=this.getCropData();if(!n)return;const{croppedAreaPercentages:r,croppedAreaPixels:a}=n;this.props.onCropAreaChange&&this.props.onCropAreaChange(r,a)},this.recomputeCropPosition=()=>{var n,r;if(!this.state.cropSize)return;let a=this.props.crop;if(this.isInitialized&&(!((n=this.previousCropSize)===null||n===void 0)&&n.width)&&(!((r=this.previousCropSize)===null||r===void 0)&&r.height)&&(Math.abs(this.previousCropSize.width-this.state.cropSize.width)>1e-6||Math.abs(this.previousCropSize.height-this.state.cropSize.height)>1e-6)){const o=this.state.cropSize.width/this.previousCropSize.width,l=this.state.cropSize.height/this.previousCropSize.height;a={x:this.props.crop.x*o,y:this.props.crop.y*l}}const i=this.props.restrictPosition?kg(a,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):a;this.previousCropSize=this.state.cropSize,this.props.onCropChange(i),this.emitCropData()},this.onKeyDown=n=>{const{crop:r,onCropChange:a,keyboardStep:i,zoom:o,rotation:l}=this.props;let c=i;if(!this.state.cropSize)return;n.shiftKey&&(c*=.2);let u=Or({},r);switch(n.key){case"ArrowUp":u.y-=c,n.preventDefault();break;case"ArrowDown":u.y+=c,n.preventDefault();break;case"ArrowLeft":u.x-=c,n.preventDefault();break;case"ArrowRight":u.x+=c,n.preventDefault();break;default:return}if(this.props.restrictPosition&&(u=kg(u,this.mediaSize,this.state.cropSize,o,l)),!n.repeat){var d,h;(d=(h=this.props).onInteractionStart)===null||d===void 0||d.call(h)}a(u)},this.onKeyUp=n=>{var r,a;switch(n.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":n.preventDefault();break;default:return}this.emitCropData(),(r=(a=this.props).onInteractionEnd)===null||r===void 0||r.call(a)}}componentDidMount(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=z5e,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))}componentWillUnmount(){var t;
146if(!(!this.currentDoc||!this.currentWindow)){if(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef){var n;(n=this.styleRef.parentNode)===null||n===void 0||n.removeChild(this.styleRef)}this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent()}}componentDidUpdate(t){var n,r,a,i,o,l,c,u;if(t.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):t.aspect!==this.props.aspect?this.computeSizes():t.objectFit!==this.props.objectFit?this.computeSizes():t.zoom!==this.props.zoom?this.recomputeCropPosition():((n=t.cropSize)===null||n===void 0?void 0:n.height)!==((r=this.props.cropSize)===null||r===void 0?void 0:r.height)||((a=t.cropSize)===null||a===void 0?void 0:a.width)!==((i=this.props.cropSize)===null||i===void 0?void 0:i.width)?this.computeSizes():(((o=t.crop)===null||o===void 0?void 0:o.x)!==((l=this.props.crop)===null||l===void 0?void 0:l.x)||((c=t.crop)===null||c===void 0?void 0:c.y)!==((u=this.props.crop)===null||u===void 0?void 0:u.y))&&this.emitCropAreaChange(),t.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),t.video!==this.props.video){var d;(d=this.videoRef.current)===null||d===void 0||d.load()}const h=this.getObjectFit();h!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:h},this.computeSizes)}getAspect(){const{cropSize:t,aspect:n}=this.props;return t?t.width/t.height:n}getObjectFit(){if(this.props.objectFit==="cover"){if((this.imageRef.current||this.videoRef.current)&&this.containerRef){var t,n,r,a;this.containerRect=this.containerRef.getBoundingClientRect();const i=this.containerRect.width/this.containerRect.height;return(((t=this.imageRef.current)===null||t===void 0?void 0:t.naturalWidth)||((n=this.videoRef.current)===null||n===void 0?void 0:n.videoWidth)||0)/(((r=this.imageRef.current)===null||r===void 0?void 0:r.naturalHeight)||((a=this.videoRef.current)===null||a===void 0?void 0:a.videoHeight)||0)<i?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit}onPinchStart(t){const n=ro.getTouchPoint(t.touches[0]),r=ro.getTouchPoint(t.touches[1]);this.lastPinchDistance=S$(n,r),this.lastPinchRotation=C$(n,r),this.onDragStart(T$(n,r))}onPinchMove(t){if(!this.currentDoc||!this.currentWindow)return;const n=ro.getTouchPoint(t.touches[0]),r=ro.getTouchPoint(t.touches[1]),a=T$(n,r);this.onDrag(a),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(()=>{const i=S$(n,r),o=this.props.zoom*(i/this.lastPinchDistance);this.setNewZoom(o,a,{shouldUpdatePosition:!1}),this.lastPinchDistance=i;const l=C$(n,r),c=this.props.rotation+(l-this.lastPinchRotation);this.props.onRotationChange&&this.props.onRotationChange(c),this.lastPinchRotation=l})}render(){var t;const{image:n,video:r,mediaProps:a,cropperProps:i,transform:o,crop:{x:l,y:c},rotation:u,zoom:d,cropShape:h,showGrid:p,roundCropAreaPixels:m,style:{containerStyle:g,cropAreaStyle:x,mediaStyle:b},classes:{containerClassName:y,cropAreaClassName:v,mediaClassName:w}}=this.props,j=(t=this.state.mediaObjectFit)!==null&&t!==void 0?t:this.getObjectFit();return f.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:E=>this.containerRef=E,"data-testid":"container",style:g,className:Uy("reactEasyCrop_Container",y)},n?f.createElement("img",Or(Or({alt:"",className:Uy("reactEasyCrop_Image",j==="contain"&&"reactEasyCrop_Contain",j==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",j==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",w)},a),{},{src:n,ref:this.imageRef,style:Or(Or({},b),{},{transform:o||`translate(${l}px, ${c}px) rotate(${u}deg) scale(${d})`}),onLoad:this.onMediaLoad})):r&&f.createElement("video",Or(Or({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:Uy("reactEasyCrop_Video",j==="contain"&&"reactEasyCrop_Contain",j==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",j==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",w)},a),{},{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:Or(Or({},b),{},{transform:o||`translate(${l}px, ${c}px) rotate(${u}deg) scale(${d})`}),controls:!1}),(Array.isArray(r)?r:[{src:r}]).map(E=>f.createElement("source",Or({key:E.src},E)))),this.state.cropSize&&f.createElement("div",Or({ref:this.cropperRef,style:Or(Or({},x),{},{width:m?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:m?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:Uy("reactEasyCrop_CropArea",h==="round"&&"reactEasyCrop_CropAreaRound",p&&"reactEasyCrop_CropAreaGrid",v)},i)))}};lk.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:q5e,minZoom:H5e,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:W5e};lk.getMousePoint=e=>({x:Number(e.clientX),y:Number(e.clientY)});lk.getTouchPoint=e=>({x:Number(e.clientX),y:Number(e.clientY)});var V5e=lk;const NQ=512,G5e=1920;function Y5e(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=n,r.src=e})}function K5e(e,t,n){const r=Number(e),a=Number.isFinite(r)?Math.min(G5e,Math.max(1,Math.round(r))):NQ,i=Number.isFinite(Number(t))&&Number(t)>0?Number(t):1,o=n!=="jpeg"&&n!=="image/jpeg";return{width:a,height:Math.max(1,Math.round(a/i)),type:o?"image/webp":"image/jpeg",name:o?"crop.webp":"avatar.jpg"}}async function X5e(e,t,n){const r=await Y5e(e),a=K5e(n.outputWidth,n.aspect,n.outputFormat),i=document.createElement("canvas");i.width=a.width,i.height=a.height,i.getContext("2d").drawImage(r,t.x,t.y,t.width,t.height,0,0,a.width,a.height);const l=await new Promise((c,u)=>{i.toBlob(d=>d?c(d):u(new Error("Crop failed")),a.type,.9)});return new File([l],a.name,{type:a.type})}function J5e(e,t){const n=Number(e);if(Number.isFinite(n)&&n>=1.5){const a=n>=2.5;return{maxWidth:a?"max-w-2xl":"max-w-3xl",stageClass:a?"relative w-full h-52 sm:h-64 roun
146ded-lg overflow-hidden bg-ink/90":"relative w-full h-[min(58dvh,32rem)] rounded-lg overflow-hidden bg-ink/90"}}return t==="rect"?{maxWidth:"max-w-md",stageClass:"relative mx-auto w-full max-w-[min(100%,22rem)] h-[min(56dvh,30rem)] rounded-lg overflow-hidden bg-ink/90"}:{maxWidth:"max-w-md",stageClass:"relative w-full h-64 sm:h-72 rounded-lg overflow-hidden bg-ink/90"}}function T0({imageSrc:e,isOpen:t,onCancel:n,onSave:r,cropShape:a="round",aspect:i=1,outputWidth:o=NQ,outputFormat:l="webp",title:c="Position your photo",backdropZ:u,contentZ:d}){const[h,p]=f.useState({x:0,y:0}),[m,g]=f.useState(1),[x,b]=f.useState(null),[y,v]=f.useState(!1),w=f.useCallback((k,C)=>{b(C)},[]),j=()=>{p({x:0,y:0}),g(1),b(null)},E=()=>{j(),n()},S=async()=>{if(!(!x||y)){v(!0);try{const k=await X5e(e,x,{outputWidth:o,aspect:i,outputFormat:l});j(),r(k)}finally{v(!1)}}},_=J5e(i,a);return s.jsxs(en,{isOpen:t,onClose:E,title:c,backdropZ:u,contentZ:d,maxWidth:_.maxWidth,className:"max-h-[calc(100dvh-2rem)] overflow-y-auto",children:[s.jsx("p",{className:"text-xs text-ink-light mb-4",children:"Drag to reposition and zoom until it looks right."}),s.jsx("div",{className:_.stageClass,children:e&&s.jsx(V5e,{image:e,crop:h,zoom:m,aspect:i,cropShape:a,showGrid:!1,onCropChange:p,onZoomChange:g,onCropComplete:w})}),s.jsx("input",{type:"range",min:1,max:3,step:.01,value:m,onChange:k=>g(Number(k.target.value)),"aria-label":"Zoom",className:"w-full mt-4 accent-indigo"}),s.jsxs("div",{className:"flex gap-3 mt-5",children:[s.jsx(yt,{variant:"secondary",type:"button",className:"flex-1 justify-center",onClick:E,children:"Cancel"}),s.jsx(yt,{type:"button",className:"flex-1 justify-center",isLoading:y,onClick:S,children:"Save"})]})]})}const Ph=30*1024*1024,Q5e=1.5*1024*1024,Z5e=5*1024*1024,Lh="30MB",e4e=3840,t4e=6*1024*1024;function A0(e){return bI(e,{maxDimension:e4e,quality:.92,compressAbove:t4e})}function s4e(e,t,n){const r=Math.max(1,Math.round(e||0)),a=Math.max(1,Math.round(t||0)),i=Math.max(r,a);if(!n||i<=n)return{width:r,height:a};const o=n/i;return{width:Math.max(1,Math.round(r*o)),height:Math.max(1,Math.round(a*o))}}async function n4e(e){try{return await createImageBitmap(e,{imageOrientation:"from-image"})}catch{return createImageBitmap(e)}}function A$(e,t,n){return new Promise(r=>e.toBlob(r,t,n))}async function r4e(e,t,n){const r=await A$(e,"image/webp",t);if(r?.type==="image/webp")return r;if(n==="image/png")return null;const a=await A$(e,"image/jpeg",t);return a?.type==="image/jpeg"?a:null}async function bI(e,{maxDimension:t=1920,quality:n=.85,compressAbove:r=Q5e}={}){if(!e||e.size<=r||typeof document>"u"||typeof createImageBitmap!="function")return e;try{const a=await n4e(e),{width:i,height:o}=s4e(a.width,a.height,t),l=document.createElement("canvas");l.width=i,l.height=o;const c=l.getContext("2d");c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high",c.drawImage(a,0,0,i,o),a.close?.();const u=await r4e(l,n,e.type);if(!u||u.size>=e.size)return e;const d=u.type==="image/webp"?"webp":"jpg";return new File([u],`${e.name.replace(/\.[^.]+$/,"")}.${d}`,{type:u.type,lastModified:Date.now()})}catch{return e}}const a4e=110;function i4e({text:e}){const t=e.split(" "),[n,r]=f.useState(()=>window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?t.length:0),a=n>=t.length;return f.useEffect(()=>{if(a)return;const i=setTimeout(()=>r(o=>o+1),a4e);return()=>clearTimeout(i)},[n,a]),s.jsxs("p",{children:[t.slice(0,n).join(" "),a?null:s.jsx("span",{className:"ce-bb-cursor"})]})}function EQ({name:e,src:t}){const n=String(e||"").trim().charAt(0).toUpperCase();return s.jsx("span",{className:"ce-bb-chat-avatar",children:t?s.jsx("img",{src:t,alt:""}):n})}const SQ=EQ;function o4e({stage:e,name:t,greeting:n,streamGreeting:r}){const a=e==="ready",i=n.trim()||v0;return s.jsxs("div",{className:"ce-bb-chat-panel",children:[s.jsxs("div",{className:"ce-bb-chat-head",children:[s.jsx(SQ,{name:t}),t?s.jsx("strong",{className:"ce-bb-chat-name",children:t}):s.jsx("i",{})]}),s.jsxs("div",{className:"ce-bb-chat-thread",children:[s.jsx("div",{className:"ce-bb-answer",children:a?r?s.jsx(i4e,{text:i}):s.jsx("p",{children:i}):e==="voice"?s.jsx("span",{className:"ce-bb-wave","aria-hidden":"true",children:Array.from({length:14},(o,l)=>s.jsx("i",{style:{"--i":l}},l))}):s.jsxs("span",{className:"ce-bb-lines",children:[s.jsx("i",{}),s.jsx("i",{})]})}),s.jsxs("div",{className:"ce-bb-starters",children:[s.jsx("i",{}),s.jsx("i",{})]})]}),s.jsxs("div",{className:"ce-bb-chat-composer",children:[s.jsx("span",{}),s.jsx("b",{children:s.jsx(rl,{size:12,strokeWidth:2.6})})]})]})}function l4e({stage:e="ready",embedMode:t="",website:n="",color:r="",name:a="",greeting:i="",showAvatar:o=!1,showCallBadge:l=!1,showTeaser:c=!1,teaserText:u="",streamGreeting:d=!1,liveChat:h=null,avatarSrc:p=""}){const m=mc(t)||"bubble",g=!!h,[x,b]=f.useState(!0),y=h||s.jsx(o4e,{stage:e,name:a,greeting:i,streamGreeting:d}),v=o?s.jsx(SQ,{name:a,src:p}):s.jsx(ni,{size:18,strokeWidth:2.2,"aria-hidden":"true"}),w=u.trim()||B_;return s.jsxs("div",{className:"ce-bb-window","data-stage":e,"data-mode":m,"data-live":g||void 0,style:r?{"--bb-accent":r}:void 0,"aria-hidden":g?void 0:"true",children:[s.jsxs("div",{className:"ce-bb-bar","aria-hidden":"true",children:[s.jsxs("span",{className:"ce-bb-dots",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}),s.jsx("span",{className:"ce-bb-url",children:Q4(n)})]}),s.jsxs("div",{className:"ce-bb-page",children:[s.jsxs("div",{className:"ce-bb-nav","aria-hidden":"true",children:[s.jsxs("span",{className:"ce-bb-brand",children:[s.jsx("b",{}),s.jsx("i",{})]}),s.jsxs("span",{className:"ce-bb-links",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}),s.jsx("i",{className:"is-nav-cta"})]}),s.jsxs("div",{className:"ce-bb-hero","aria-hidden":"true",children:[s.jsxs("div",{className:"ce-bb-hero-copy",children:[s.jsx("i",{className:"is-eyebrow"}),s.jsx("i",{className:"is-title"}),s.jsx("i",{className:"is-title is-short"}),s.jsx("i",{className:"is-line"}),s.jsx("i",{className:"is-line is-short"}),s.jsxs("span",{className:"ce-bb-ctas",children:[s.jsx("i",{className:"is-cta"}),s.jsx("i",{className:"is-cta is-ghost"})]})]}),m==="bubble"?s.jsx("span",{className:"ce-bb-media",children:s.jsx(b0,{size:22,strokeWidth:1.6})}):null]}),m==="inline"?s.jsx("div",{className:"ce-bb-inline-slot",children:y}):s.jsx("div",{className:"ce-bb-features","aria-hidden":"true",children:[0,1,2].map(j=>s.jsxs("span",{children:[s.jsx("i",{className:"is-icon"}),s.jsx("i",{className:"is-head"}),s.jsx("i",{}),s.jsx("i",{className:"is-short"})]},j))})]}),m==="bubble"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"ce-bb-bubble-panel","data-open":x,inert:!x,children:y}),c?g?s.jsx("button",{type:"button",className:"ce-bb-teaser",onClick:()=>b(!0),children:w}):s.jsx("span",{className:"ce-bb-teaser",children:w}):null,g?s.jsx("button",{type:"button",className:`ce-bb-launcher${o?" has-avatar":""}`,"aria-expanded":x,"aria-label":x?"Close chat":"Open chat",onClick:()=>b(j=>!j),children:v}):s.jsx("span",{className:`ce-bb-launcher${o?" has-avatar":""}`,children:v}),l?s.jsx("span",{className:"ce-bb-call-badge","aria-hidden":"true",children:s.jsx(Ts,{size:9,strokeWidth:2.6})}):null]}):null]})}const ck=(function(e){if(e==null)return h4e;if(typeof e=="function")return uk(e);if(typeof e=="object")return Array.isArray(e)?c4e(e):u4e(e);
vendor: 9,883 bytes, line 146
146if(typeof e=="string")return d4e(e);throw new Error("Expected function, string, or object as test")});function c4e(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ck(e[n]);return uk(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function u4e(e){const t=e;return uk(n);function n(r){const a=r;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function d4e(e){return uk(t);function t(n){return n&&n.type===e}}function uk(e){return t;function t(n,r,a){return!!(p4e(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function h4e(){return!0}function p4e(e){return e!==null&&typeof e=="object"&&"type"in e}const CQ=[],ox=!0,ZA=!1,bm="skip";function yI(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const i=ck(a),o=r?-1:1;l(e,void 0,[])();function l(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const m=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(m?"<"+m+">":""))+")"})}return p;function p(){let m=CQ,g,x,b;if((!t||i(c,u,d[d.length-1]||void 0))&&(m=m4e(n(c,d)),m[0]===ZA))return m;if("children"in c&&c.children){const y=c;if(y.children&&m[0]!==bm)for(x=(r?y.children.length:-1)+o,b=d.concat(y);x>-1&&x<y.children.length;){const v=y.children[x];if(g=l(v,x,b)(),g[0]===ZA)return g;x=typeof g[1]=="number"?g[1]:x+o}}return m}}}function m4e(e){return Array.isArray(e)?e:typeof e=="number"?[ox,e]:e==null?CQ:[e]}function hl(e,t,n,r){let a,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,a=n):(i=t,o=n,a=r),yI(e,i,l,a);function l(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return o(c,h,d)}}const uf={indicator:"indicator",textOnly:"text-only",remove:"remove"};function f4e({defaultOrigin:e="",allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:a=[],blockedImageClass:i="inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm",blockedLinkClass:o="text-gray-500",linkBlockPolicy:l=uf.indicator,imageBlockPolicy:c=uf.indicator}){const u=t.length&&!t.every(h=>h==="*"),d=n.length&&!n.every(h=>h==="*");if(!e&&(u||d))throw new Error("defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided");return h=>{const p=w4e(e,t,n,r,a,i,o,l,c);TQ(h),hl(h,p)}}function R$(e,t){if(typeof e!="string")return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))try{return new URL(e,"http://example.com")}catch{return null}return null}}function g4e(e){return typeof e!="string"?!1:e.startsWith("/")||e.startsWith("./")||e.startsWith("../")}const x4e=new Set(["https:","http:","irc:","ircs:","mailto:","xmpp:","blob:"]),b4e=new Set(["javascript:","data:","file:","vbscript:"]);function I$(e,t,n,r=!1,a=!1,i=[]){if(!e)return null;if(typeof e=="string"&&e.startsWith("#")&&!a)try{if(new URL(e,"http://example.com").hash===e)return e}catch{}if(typeof e=="string"&&e.startsWith("data:"))return a&&r&&e.startsWith("data:image/")?e:null;if(typeof e=="string"&&e.startsWith("blob:")){try{if(new URL(e).protocol==="blob:"&&e.length>5){const d=e.substring(5);if(d&&d.length>0&&d!=="invalid")return e}}catch{return null}return null}const o=R$(e,n);if(!o||b4e.has(o.protocol)||!(x4e.has(o.protocol)||i.includes(o.protocol)||i.includes("*")))return null;if(o.protocol==="mailto:"||!o.protocol.match(/^https?:$/))return o.href;const c=g4e(e);return o&&t.some(u=>{const d=R$(u,n);return!d||d.origin!==o.origin?!1:o.href.startsWith(d.href)})?c?o.pathname+o.search+o.hash:o.href:t.includes("*")?o.protocol!=="https:"&&o.protocol!=="http:"?null:c?o.pathname+o.search+o.hash:o.href:null}function TQ(e){if("children"in e&&Array.isArray(e.children)){e.children=e.children.filter(t=>t!=null);for(const t of e.children)TQ(t)}}const JN=Symbol("node-seen");function y4e(e,t,n){return t===uf.remove?{type:"remove"}:t===uf.textOnly?{type:"replace",element:{type:"element",tagName:"span",properties:{},children:[...e.children]}}:{type:"replace",element:{type:"element",tagName:"span",properties:{title:"Blocked URL: "+String(e.properties.href),class:n},children:[...e.children,{type:"text",value:" [blocked]"}]}}}function v4e(e,t,n){if(t===uf.remove)return{type:"remove"};if(t===uf.textOnly){const r=String(e.properties.alt||"");return r?{type:"replace",element:{type:"element",tagName:"span",properties:{},children:[{type:"text",value:r}]}}:{type:"remove"}}return{type:"replace",element:{type:"element",tagName:"span",properties:{class:n},children:[{type:"text",value:"[Image blocked: "+String(e.properties.alt||"No description")+"]"}]}}}const w4e=(e,t,n,r,a,i,o,l,c)=>{const u=(d,h,p)=>{if(d.type!=="element"||d[JN])return ox;if(d.tagName==="a"){const m=I$(d.properties.href,t,e,!1,!1,a);if(m===null){if(d[JN]=!0,hl(d,u),p&&typeof h=="number"){const g=y4e(d,l,o);if(g.type==="remove")return p.children.splice(h,1),[bm,h];p.children[h]=g.element}return bm}else return d.properties.href=m,d.properties.target="_blank",d.properties.rel="noopener noreferrer",ox}if(d.tagName==="img"){const m=I$(d.properties.src,n,e,r,!0,a);if(m===null){if(d[JN]=!0,hl(d,u),p&&typeof h=="number"){const g=v4e(d,c,i);if(g.type==="remove")return p.children.splice(h,1),[bm,h];p.children[h]=g.element}return bm}else return d.properties.src=m,ox}return ox};return u},AQ=-1,dk=0,$x=1,ij=2,vI=3,wI=4,jI=5,_I=6,RQ=7,IQ=8,P$=typeof self=="object"?self:globalThis,j4e=(e,t)=>{const n=(a,i)=>(e.set(i,a),a),r=a=>{if(e.has(a))return e.get(a);const[i,o]=t[a];switch(i){case dk:case AQ:return n(o,a);case $x:{const l=n([],a);for(const c of o)l.push(r(c));return l}case ij:{const l=n({},a);for(const[c,u]of o)l[r(c)]=r(u);return l}case vI:return n(new Date(o),a);case wI:{const{source:l,flags:c}=o;return n(new RegExp(l,c),a)}case jI:{const l=n(new Map,a);for(const[c,u]of o)l.set(r(c),r(u));return l}case _I:{const l=n(new Set,a);for(const c of o)l.add(r(c));return l}case RQ:{const{name:l,message:c}=o;return n(new P$[l](c),a)}case IQ:return n(BigInt(o),a);case"BigInt":return n(Object(BigInt(o)),a);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new P$[i](o),a)};return r},L$=e=>j4e(new Map,e)(0),Ap="",{toString:_4e}={},{keys:k4e}=Object,Ng=e=>{const t=typeof e;if(t!=="object"||!e)return[dk,t];const n=_4e.call(e).slice(8,-1);switch(n){case"Array":return[$x,Ap];case"Object":return[ij,Ap];case"Date":return[vI,Ap];case"RegExp":return[wI,Ap];case"Map":return[jI,Ap];case"Set":return[_I,Ap];case"DataView":return[$x,n]}return n.includes("Array")?[$x,n]:n.includes("Error")?[RQ,n]:[ij,n]},zy=([e,t])=>e===dk&&(t==="function"||t==="symbol"),N4e=(e,t,n,r)=>{const a=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=Ng(o);switch(l){case dk:{let d=o;switch(c){case"bigint":l=IQ,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return a([AQ],o)}return a([l,d],o)}case $x:{if(c){let p=o;return c==="DataView"?p=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(o)),a([c,[...p]],o)}const d=[],h=a([l,d],o);for(const p of o)d.push(i(p));return h}case ij:{if(c)switch(c){case"BigInt":return a([c,o.toString()],o);case"Boolean":case"Number":case"String":return a([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],h=a([l,d],o);for(const p of k4e(o))(e||!zy(Ng(o[p])))&&d.push([i(p),i(o[p])]);return h}case vI:return a([l,o.toISOString()],o);case wI:{const{source:d,flags:h}=o;return a([l,{source:d,flags:h}],o)}case jI:{const d=[],h=a([l,d],o);for(const[p,m]of o)(e||!(zy(Ng(p))||zy(Ng(m))))&&d.push([i(p),i(m)]);return h}case _I:{const d=[],h=a([l,d],o);for(const p of o)(e||!zy(Ng(p)))&&d.push(i(p));return h}}const{message:u}=o;return a([l,{name:c,message:u}],o)};return i},O$=(e,{json:t,lossy:n}={})=>{const r=[];return N4e(!(t||n),!!t,new Map,r)(e),r},Oh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?L$(O$(e,t)):structuredClone(e):(e,t)=>L$(O$(e,t));class R0{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}R0.prototype.normal={};R0.prototype.property={};R0.prototype.space=void 0;function PQ(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new R0(n,r,t)}function Mb(e){return e.toLowerCase()}class ri{constructor(t,n){this.attribute=n,this.property=t}}ri.prototype.attribute="";ri.prototype.booleanish=!1;ri.prototype.boolean=!1;ri.prototype.commaOrSpaceSeparated=!1;ri.prototype.commaSeparated=!1;ri.prototype.defined=!1;ri.prototype.mustUseProperty=!1;ri.prototype.number=!1;ri.prototype.overloadedBoolean=!1;ri.prototype.property="";ri.prototype.spaceSeparated=!1;ri.prototype.space=void 0;let E4e=0;const _s=Jh(),dr=Jh(),e3=Jh(),bt=Jh(),_n=Jh(),Rm=Jh(),ci=Jh();function Jh(){return 2**++E4e}const t3=Object.freeze(Object.defineProperty({__proto__:null,boolean:_s,booleanish:dr,commaOrSpaceSeparated:ci,commaSeparated:Rm,number:bt,overloadedBoolean:e3,spaceSeparated:_n},Symbol.toStringTag,{value:"Module"})),QN=Object.keys(t3);class kI extends ri{constructor(t,n,r,a){let i=-1;if(super(t,n),M$(this,"space",a),typeof r=="number")for(;++i<QN.length;){const o=QN[i];M$(this,QN[i],(r&t3[o])===t3[o])}}}kI.prototype.defined=!0;function M$(e,t,n){n&&(e[t]=n)}function zf(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new kI(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Mb(r)]=r,n[Mb(i.attribute)]=r}return new R0(t,n,e.space)}const LQ=zf({properties:{ariaActiveDescendant:null,ariaAtomic:dr,ariaAutoComplete:null,ariaBusy:dr,ariaChecked:dr,ariaColCount:bt,ariaColIndex:bt,ariaColSpan:bt,ariaControl
vendor: 4,006 bytes, line 146
146s:_n,ariaCurrent:null,ariaDescribedBy:_n,ariaDetails:null,ariaDisabled:dr,ariaDropEffect:_n,ariaErrorMessage:null,ariaExpanded:dr,ariaFlowTo:_n,ariaGrabbed:dr,ariaHasPopup:null,ariaHidden:dr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_n,ariaLevel:bt,ariaLive:null,ariaModal:dr,ariaMultiLine:dr,ariaMultiSelectable:dr,ariaOrientation:null,ariaOwns:_n,ariaPlaceholder:null,ariaPosInSet:bt,ariaPressed:dr,ariaReadOnly:dr,ariaRelevant:null,ariaRequired:dr,ariaRoleDescription:_n,ariaRowCount:bt,ariaRowIndex:bt,ariaRowSpan:bt,ariaSelected:dr,ariaSetSize:bt,ariaSort:null,ariaValueMax:bt,ariaValueMin:bt,ariaValueNow:bt,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function OQ(e,t){return t in e?e[t]:t}function MQ(e,t){return OQ(e,t.toLowerCase())}const S4e=zf({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Rm,acceptCharset:_n,accessKey:_n,action:null,allow:null,allowFullScreen:_s,allowPaymentRequest:_s,allowUserMedia:_s,alt:null,as:null,async:_s,autoCapitalize:null,autoComplete:_n,autoFocus:_s,autoPlay:_s,blocking:_n,capture:null,charSet:null,checked:_s,cite:null,className:_n,cols:bt,colSpan:null,content:null,contentEditable:dr,controls:_s,controlsList:_n,coords:bt|Rm,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_s,defer:_s,dir:null,dirName:null,disabled:_s,download:e3,draggable:dr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_s,formTarget:null,headers:_n,height:bt,hidden:e3,high:bt,href:null,hrefLang:null,htmlFor:_n,httpEquiv:_n,id:null,imageSizes:null,imageSrcSet:null,inert:_s,inputMode:null,integrity:null,is:null,isMap:_s,itemId:null,itemProp:_n,itemRef:_n,itemScope:_s,itemType:_n,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_s,low:bt,manifest:null,max:null,maxLength:bt,media:null,method:null,min:null,minLength:bt,multiple:_s,muted:_s,name:null,nonce:null,noModule:_s,noValidate:_s,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_s,optimum:bt,pattern:null,ping:_n,placeholder:null,playsInline:_s,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_s,referrerPolicy:null,rel:_n,required:_s,reversed:_s,rows:bt,rowSpan:bt,sandbox:_n,scope:null,scoped:_s,seamless:_s,selected:_s,shadowRootClonable:_s,shadowRootDelegatesFocus:_s,shadowRootMode:null,shape:null,size:bt,sizes:null,slot:null,span:bt,spellCheck:dr,src:null,
146srcDoc:null,srcLang:null,srcSet:null,start:bt,step:null,style:null,tabIndex:bt,target:null,title:null,translate:null,type:null,typeMustMatch:_s,useMap:null,value:dr,width:bt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_n,axis:null,background:null,bgColor:null,border:bt,borderColor:null,bottomMargin:bt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_s,declare:_s,event:null,face:null,frame:null,frameBorder:null,hSpace:bt,leftMargin:bt,link:null,longDesc:null,lowSrc:null,marginHeight:bt,marginWidth:bt,noResize:_s,noHref:_s,noShade:_s,noWrap:_s,object:null,profile:null,prompt:null,rev:null,rightMargin:bt,rules:null,scheme:null,scrolling:dr,standby:null,summary:null,text:null,topMargin:bt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:bt,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_s,disableRemotePlayback:_s,prefix:null,property:null,results:bt,security:null,unselectable:null},space:"html",transform:MQ}),C4e=zf({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav
146-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ci,accentHeight:bt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:bt,amplitude:bt,arabicForm:null,ascent:bt,attributeName:null,attributeType:null,azimuth:bt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:bt,by:null,calcMode:null,capHeight:bt,className:_n,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:bt,diffuseConstant:bt,direction:null,display:null,dur:null,divisor:bt,dominantBaseline:null,download:_s,dx:null,dy:null,edgeMode:null,editable:null,elevation:bt,enableBackground:null,end:null,event:null,exponent:bt,externalResourcesRequired:null,fill:null,fillOpacity:bt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Rm,g2:Rm,glyphName:Rm,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:bt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:bt,horizOriginX:bt,horizOriginY:bt,id:null,ideographic:bt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:bt,k:bt,k1:bt,k2:bt,k3:bt,k4:bt,kernelMatrix:ci,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:bt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:bt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,on
vendor: 4,918 bytes, line 146
146Zoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:bt,overlineThickness:bt,paintOrder:null,panose1:null,path:null,pathLength:bt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_n,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:bt,pointsAtY:bt,pointsAtZ:bt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ci,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ci,rev:ci,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ci,requiredFeatures:ci,requiredFonts:ci,requiredFormats:ci,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:bt,specularExponent:bt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:bt,strikethroughThickness:bt,string:null,stroke:null,strokeDashArray:ci,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:bt,strokeOpacity:bt,strokeWidth:null,style:null,surfaceScale:bt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ci,tabIndex:bt,tableValues:null,target:null,targetX:bt,targetY:bt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ci,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:bt,underlineThickness:bt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:bt,values:null,vAlphabetic:bt,vMathematical:bt,vectorEffect:null,vHanging:bt,vIdeographic:bt,version:null,vertAdvY:bt,vertOriginX:bt,vertOriginY:bt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:bt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:OQ}),DQ=zf({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),$Q=zf({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:MQ}),FQ=zf({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),T4e={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},A4e=/[A-Z]/g,D$=/-[a-z]/g,R4e=/^data[-\w.:]+$/i;function I0(e,t){const n=Mb(t);let r=t,a=ri;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&R4e.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(D$,P4e);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!D$.test(i)){let o=i.replace(A4e,I4e);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=kI}return new a(r,t)}function I4e(e){return"-"+e.toLowerCase()}function P4e(e){return e.charAt(1).toUpperCase()}const Hf=PQ([LQ,S4e,DQ,$Q,FQ],"html"),yl=PQ([LQ,C4e,DQ,$Q,FQ],"svg");function $$(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(a,r).trim();(o||!i)&&t.push(o),a=r+1,r=n.indexOf(",",a)}return t}function NI(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const F$=/[#.]/g;function L4e(e,t){const n=e||"",r={};let a=0,i,o;for(;a<n.length;){F$.lastIndex=a;const l=F$.exec(n),c=n.slice(a,l?l.index:n.length);c&&(i?i==="#"?r.id=c:Array.isArray(r.className)?r.className.push(c):r.className=[c]:o=c,a+=c.length),l&&(i=l[0],a++)}return{type:"element",tagName:o||t||"div",properties:r,children:[]}}function B$(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function EI(e){return e.join(" ").trim()}function BQ(e,t,n){const r=n?$4e(n):void 0;function a(i,o,...l){let c;if(i==null){c={type:"root",children:[]};const u=o;l.unshift(u)}else{c=L4e(i,t);const u=c.tagName.toLowerCase(),d=r?r.get(u):void 0;if(c.tagName=d||u,O4e(o))l.unshift(o);else for(const[h,p]of Object.entries(o))M4e(e,c.properties,h,p)}for(const u of l)s3(c.children,u);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return a}function O4e(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;
vendor: 5,253 bytes, lines 146-147
146if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const a=t[r];if(a&&typeof a=="object"){if(!Array.isArray(a))return!0;const i=a;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function M4e(e,t,n,r){const a=I0(e,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?a.spaceSeparated?i=B$(r):a.commaSeparated?i=$$(r):a.commaOrSpaceSeparated?i=B$($$(r).join(" ")):i=U$(a,a.property,r):Array.isArray(r)?i=[...r]:i=a.property==="style"?D4e(r):String(r);if(Array.isArray(i)){const o=[];for(const l of i)o.push(U$(a,a.property,l));i=o}a.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[a.property]=i}}function s3(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)s3(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?s3(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function U$(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Mb(n)===Mb(t)))return!0}return n}function D4e(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function $4e(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const F4e=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],B4e=BQ(Hf,"div"),U4e=BQ(yl,"g",F4e);function z4e(e){const t=String(e),n=[];return{toOffset:a,toPoint:r};function r(i){if(typeof i=="number"&&i>-1&&i<=t.length){let o=0;for(;;){let l=n[o];if(l===void 0){const c=z$(t,n[o-1]);l=c===-1?t.length+1:c+1,n[o]=l}if(l>i)return{line:o+1,column:i-(o>0?n[o-1]:0)+1,offset:i};o++}}}function a(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length<i.line;){const l=n[n.length-1],c=z$(t,l),u=c===-1?t.length+1:c+1;if(l===u)break;n.push(u)}const o=(i.line>1?n[i.line-2]:0)+i.column-1;if(o<n[i.line-1])return o}}}function z$(e,t){const n=e.indexOf("\r",t),r=e.indexOf(` 147`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const Kd={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},UQ={}.hasOwnProperty,H4e=Object.prototype;function q4e(e,t){const n=t||{};return SI({file:n.file||void 0,location:!1,schema:n.space==="svg"?yl:Hf,verbose:n.verbose||!1},e)}function SI(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},k1(e,r,n),n}case"#document":case"#document-fragment":{const r=t,a="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:zQ(e,t.childNodes),data:{quirksMode:a}},e.file&&e.location){const i=String(e.file),o=z4e(i),l=o.toPoint(0),c=o.toPoint(i.length);n.position={start:l,end:c}}return n}case"#documentType":{const r=t;return n={type:"doctype"},k1(e,r,n),n}case"#text":{const r=t;return n={type:"text",value:r.value},k1(e,r,n),n}default:return n=W4e(e,t),n}}function zQ(e,t){let n=-1;const r=[];for(;++n<t.length;){const a=SI(e,t[n]);r.push(a)}return r}function W4e(e,t){const n=e.schema;e.schema=t.namespaceURI===Kd.svg?yl:Hf;let r=-1;const a={};for(;++r<t.attrs.length;){const l=t.attrs[r],c=(l.prefix?l.prefix+":":"")+l.name;UQ.call(H4e,c)||(a[c]=l.value)}const o=(e.schema.space==="svg"?U4e:B4e)(t.tagName,a,zQ(e,t.childNodes));if(k1(e,t,o),o.tagName==="template"){const l=t,c=l.sourceCodeLocation,u=c&&c.startTag&&ym(c.startTag),d=c&&c.endTag&&ym(c.endTag),h=SI(e,l.content);u&&d&&e.file&&(h.position={start:u.end,end:d.start}),o.content=h}return e.schema=n,o}function k1(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=V4e(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function V4e(e,t,n){const r=ym(n);if(t.type==="element"){const a=t.children[t.children.length-1];if(r&&!n.endTag&&a&&a.position&&a.position.end&&(r.end=Object.assign({},a.position.end)),e.verbose){const i={};let o;if(n.attrs)for(o in n.attrs)UQ.call(n.attrs,o)&&(i[I0(e.schema,o).property]=ym(n.attrs[o]));n.startTag;const l=ym(n.startTag),c=n.endTag?ym(n.endTag):void 0,u={opening:l};c&&(u.closing=c),u.properties=i,t.data={position:u}}}return r}function ym(e){const t=H$({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=H$({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function H$(e){return e.line&&e.column?e:void 0}const q$={}.hasOwnProperty;function CI(e,t){const n=t||{};
vendor: 4,620 bytes, line 147
147function r(a,...i){let o=r.invalid;const l=r.handlers;if(a&&q$.call(a,e)){const c=String(a[e]);o=q$.call(l,c)?l[c]:r.unknown}if(o)return o.call(this,a,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const G4e={},Y4e={}.hasOwnProperty,HQ=CI("type",{handlers:{root:X4e,element:tRe,text:Z4e,comment:eRe,doctype:Q4e}});function K4e(e,t){const r=(t||G4e).space;return HQ(e,r==="svg"?yl:Hf)}function X4e(e,t){const n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=TI(e.children,n,t),qf(e,n),n}function J4e(e,t){const n={nodeName:"#document-fragment",childNodes:[]};return n.childNodes=TI(e.children,n,t),qf(e,n),n}function Q4e(e){const t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return qf(e,t),t}function Z4e(e){const t={nodeName:"#text",value:e.value,parentNode:null};return qf(e,t),t}function eRe(e){const t={nodeName:"#comment",data:e.value,parentNode:null};return qf(e,t),t}function tRe(e,t){const n=t;let r=n;e.type==="element"&&e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=yl);const a=[];let i;if(e.properties){for(i in e.properties)if(i!=="children"&&Y4e.call(e.properties,i)){const c=sRe(r,i,e.properties[i]);c&&a.push(c)}}const o=r.space,l={nodeName:e.tagName,tagName:e.tagName,attrs:a,namespaceURI:Kd[o],childNodes:[],parentNode:null};return l.childNodes=TI(e.children,l,r),qf(e,l),e.tagName==="template"&&e.content&&(l.content=J4e(e.content,r)),l}function sRe(e,t,n){const r=I0(e,t);if(n===!1||n===null||n===void 0||typeof n=="number"&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?NI(n):EI(n));const a={name:r.attribute,value:n===!0?"":String(n)};if(r.space&&r.space!=="html"&&r.space!=="svg"){const i=a.name.indexOf(":");i<0?a.prefix="":(a.name=a.name.slice(i+1),a.prefix=r.attribute.slice(0,i)),a.namespace=Kd[r.space]}return a}function TI(e,t,n){let r=-1;const a=[];if(e)for(;++r<e.length;){const i=HQ(e[r],n);i.parentNode=t,a.push(i)}return a}function qf(e,t){const n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}const qQ=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],nRe=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),Bn="�";var ie;(function(e){e[e.EOF=-1]="EOF",e[e.NULL=0]="NULL",e[e.TABULATION=9]="TABULATION",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.LINE_FEED=10]="LINE_FEED",e[e.FORM_FEED=12]="FORM_FEED",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_9=57]="DIGIT_9",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",e[e.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_A=97]="LATIN_SMALL_A",e[e.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(ie||(ie={}));const Ya={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function WQ(e){return e>=55296&&e<=57343}function rRe(e){return e>=56320&&e<=57343}function aRe(e,t){return(e-55296)*1024+9216+t}function VQ(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function GQ(e){return e>=64976&&e<=65007||nRe.has(e)}var Fe;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invali
vendor: 6,671 bytes, line 147
147dFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(Fe||(Fe={}));const iRe=65536;class oRe{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=iRe,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:a,offset:i}=this,o=a+n,l=i+n;return{code:t,startLine:r,endLine:r,startCol:o,endCol:o,startOffset:l,endOffset:l}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(rRe(n))return this.pos++,this._addGap(),aRe(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,ie.EOF;return this._err(Fe.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r<t.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==t.charCodeAt(r))return!1;return!0}peek(t){const n=this.pos+t;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,ie.EOF;const r=this.html.charCodeAt(n);return r===ie.CARRIAGE_RETURN?ie.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,ie.EOF;let t=this.html.charCodeAt(this.pos);return t===ie.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,ie.LINE_FEED):t===ie.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,WQ(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===ie.LINE_FEED||t===ie.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){VQ(t)?this._err(Fe.controlCharacterInInputStream):GQ(t)&&this._err(Fe.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var Rs;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(Rs||(Rs={}));function YQ(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const lRe
vendor: 8,319 bytes, line 147
147=new Uint16Array('áµ<ÃıÊÒÕ»×ÙµÛÞ¢ßà à©àªà¶¡à¹à¼à¼¦áá¨á¡ááááá¥\0\0\0\0\0\0á«áá¦á°á·á½¾â â°âââ»ââ ¤â¤â´â¹â¿ããºã¹ã¬ã£¾ã¨¨ã©±ã« 㬮à EMabcfglmnoprstu\\bfms�¦³¹ÃÃligè»ÃäPè»&ä¦cuteè»Ãäreve;äÄiyx}rcè»Ãä;är;ìðraveè»Ãäpha;äacr;äd;æ©Ägp¡on;äf;ìð¸plyFunction;æ¡ingè»Ã
ä
Äcs¾Ãr;ìðign;æildeè»Ãämlè»ÃäÐaceforsuåûþÄÄĢħĪÄcrêòkslash;æÅ¶Ã¶Ã¸;æ«§ed;æy;äÆcrtÄ
ÄÄause;æµnoullis;æ¬a;är;ìð
pf;ìð¹eve;äcòÄmpeq;æÜHOacdefhilorsuÅÅÅÆÆÆ¢ÆµÆ·ÆºÇÈɳɸɾcy;ä§PYè»Â©ä©ÆcpyÅŢźute;äÄ;iŧŨætalDifferentialD;æ
leys;æÈaeioÆÆÆÆron;ädilè»Ãärc;änint;æ°ot;äÄdnƧÆilla;ä¸terDot;ä·Ã²Å¿i;ä§rcleÈDMPTÇÇÇÇot;æinus;ælus;æimes;æoÄcsǢǸkwiseContourIntegral;æ²eCurlyÄDQÈÈoubleQuote;æuote;æÈlnpuÈȨÉÉonÄ;eȥȦæ·;æ©´ÆgitȯȶȺruent;æ¡nt;æ¯ourIntegral;æ®ÄfrÉÉ;æoduct;ænterClockwiseContourIntegral;æ³oss;樯cr;ìðpÄ;CÊÊ
æap;æÖDJSZacefiosÊ Ê¬Ê°Ê´Ê¸ËËˡ˦̳ÒÄ;oŹʥtrahd;æ¤cy;äcy;ä
cy;äÆgrsÊ¿ËËger;æ¡r;æ¡hv;櫤ÄayËËron;ä;älÄ;tËËæa;är;ìðÄaf˫̧Äcm˰̢riticalÈADGTÌÌÌÌcute;ä´oÅ´ÌÌ;äbleAcute;ärave;ä ilde;äond;æferentialD;æ
Ѱ̽\0\0\0ÍÍ\0Ð
f;ìð»Æ;DEÍÍÍä¨ot;æqual;æbleÌCDLRUVͣͲÎÏϢϸontourIntegraìȹoɴ͹\0\0ͻ»ÍnArrow;æÄeoÎΤftÆARTÎÎΡrrow;æightArrow;æeÃ¥ËngÄLRΫÏeftÄARγιrrow;æ¸ightArrow;æºightArrow;æ¹ightÄATÏÏrrow;æee;æ¨pÉÏ©\0\0ϯrrow;æownArrow;æerticalBar;æ¥nÌABLRTaÐЪаÑѿͼrrowÆ;BUÐÐТæar;æ¤pArrow;æµreve;äeftËк\0Ñ\0ÑightVector;æ¥eeVector;æ¥ectorÄ;BÑÑæ½ar;æ¥ightÇѧ\0ѱeeVector;æ¥ectorÄ;BѺѻæar;æ¥eeÄ;AÒÒæ¤rrow;æ§ÄctÒÒr;ìðrok;äà NTacdfglmopqstuxÒ½ÓÓÓÓÓ¢Ó§Ó®ÓµÔ¡Ô¯Ô¶ÕÕÕ Õ¥G;ä
Hè»Ãäcuteè»ÃäÆaiyÓÓÓron;ärcè»Ãä;äot;är;ìðraveè»Ãäement;æÄapÓºÓ¾cr;ätyÉÔ\0\0ÔmallSquare;æ»erySmallSquare;æ«ÄgpÔ¦Ôªon;äf;ìð¼silon;äuÄaiÔ¼ÕlÄ;TÕÕæ©µilde;ælibrium;æÄciÕÕr;æ°m;橳a;ämlè»ÃäÄipÕªÕ¯sts;æonentialE;æ
ÊcfiosÖ
ÖÖÖ²×y;ä¤r;ìðlledÉÖ\0\0Ö£mallSquare;æ¼erySmallSquare;æªÍ°Öº\0Ö¿\0\0×f;ìð½All;æriertrf;æ±cÃ²×ØJTabcdfgorst×¨×¬×¯×ºØØØØØØ£Ù¬Ù²cy;äè»>ä¾mmaÄ;d׷׸ä;äreve;äÆeiyØØØdil;ä¢rc;ä;äot;ä r;ìð;æpf;ìð¾eaterÌEFGLSTصÙÙÙÙÙ¦qualÄ;Lؾؿæ¥ess;æullEqual;æ§reater;檢ess;æ·lantEqual;橾ilde;æ³cr;ìð¢;æ«ÐAacfiosuÚ
ÚÚÚÚÚªÚ¾ÛRDcy;äªÄctÚÚek;ä;äirc;ä¤r;ælbertSpace;æÇ°Ú¯\0Ú²f;æizontalLine;æÄctÛÛ
òکrok;ä¦mpÅÛÛownHumðįqual;æÜEJOacdfgmnostuÛºÛ¾ÜÜÜÜÜܡܨÝݸÞÞÞcy;älig;ä²cy;äcuteè»ÃäÄiyÜÜrcè»Ãä;äot;ä°r;æraveè»ÃäÆ;apÜ Ü¯Ü¿ÄcgÜ´Ü·r;äªinaryI;æ
lieóÏÇ´Ý\0Ý¢Ä;eÝÝæ¬ÄgrÝÝral;æ«section;æisibleÄCTݬݲomma;æ£imes;æ¢ÆgptÝ¿ÞÞon;ä®f;ìða;äcr;æilde;ä¨Ç«Þ\0Þcy;älè»ÃäÊcfosuÞ¬Þ·Þ¼ßßÄiyÞ±Þµrc;ä´;är;ìðpf;ìðÇ£ß\0ßr;ìð¥rcy;äkcy;äÎHJacfosߤߨ߽߬߱à à cy;ä¥cy;äppa;äÄeyß¶ß»dil;ä¶;är;ìðpf;ìðcr;ìð¦ÖJTaceflmostà ¥à ©à ¬à¡à¡£à¦³à¦¸à§à§à¨·à©cy;äè»<ä¼Êcmnprà ·à ¼à¡à¡à¡ute;ä¹bda;äg;æªlacetrf;ær;æÆaeyà¡à¡à¡¡ron;ä½dil;ä»;äÄfsࡨ॰tÔACDFRTUVarࡾࢩࢱࣦ࣠ࣼयà¥Î४Änrà¢à¢gleBracket;æ¨rowÆ;BRà¢à¢à¢æar;æ¤ightArrow;æeiling;æoǵࢷ\0à£bleBracket;æ¦nÇà£\0à£eeVector;楡ectorÄ;Bà£à£æar;æ¥loor;æightÄAV࣯ࣵrrow;æector;æ¥Äerà¤à¤eÆ;AVà¤à¤à¤æ£rrow;æ¤ector;æ¥iangleÆ;BEतथऩæ²ar;æ§qual;æ´pÆDTVषà¥à¥ownVector;æ¥eeVector;æ¥ ectorÄ;Bà¥à¥æ¿ar;æ¥ectorÄ;B॥०æ¼ar;æ¥ightáÎsÌEFGLSTॾà¦à¦à¦à¦¢à¦qualGreater;æullEqual;æ¦reater;æ¶ess;檡lantEqual;橽ilde;æ²r;ìðÄ;eঽাæftarrow;æidot;ä¿Ænpwà§à¨à¨gÈLRlrà§à§·à¨à¨eftÄAR০৬rrow;æµightArrow;æ·ightArrow;æ¶eftÄarγà¨ightáοightáÏf;ìðerÄLRਢਬeftArrow;æightArrow;æÆchtਾà©à©Ã²à¡;æ°rok;ä
;æªÐacefiosuà©à©à© ੷੼àª
àªàªp;æ¤
y;äÄdl੥੯iumSpace;ælintrf;æ³r;ìðnusPlus;æpf;ìðcò੶;äÒJacefostuણધàªà«à¬à¬à¶à¶à¶cy;äcute;ä
Æaey઴હાron;ä
dil;ä
;äÆgswà«à«°à¬ativeÆMTVà«à«à«¨ediumSpace;æhiÄcn૦à«Ã«à«eryThiîà«tedÄGL૸à¬reaterGreateòٳessLesóà©Line;är;ìðÈBnptଢନଷ଺reak;æ BreakingSpace;ä f;æÚ;CDEGHLNPRSTVàààªà¼à®¡à¯«à°à±à²à²¦à³àµ¡à¶
櫬Äouàà¤ngruent;æ¢pCap;æoubleVerticalBar;æ¦Ælqxà®à®à®ement;æualÄ;Tà®à®æ ilde;ìâ̸ists;æreaterÎ;EFGLSTஶஷ஽à¯à¯à¯à¯¥æ¯qual;æ±ullEqual;ìâ§Ì¸reater;ìâ«Ì¸ess;æ¹lantEqual;ì⩾̸ilde;æµumpÅ௲௽ownHump;ìâ̸qual;ìâ̸eÄfsà°à°§tTriangleÆ;BEà°à°à°¡æªar;ìâ§Ì¸qual;æ¬sÌ;EGLSTవశ఼à±à±à±æ®qual;æ°reater;æ¸ess;ìâªÌ¸lantEqual;ì⩽̸ilde;æ´estedÄGL౨౹reaterGreater;ì⪢̸essLess;ì⪡̸recedesÆ;ESà²à²à²æqual;ì⪯̸lantEqual;æ ÄeiಫಹverseElement;æghtTriangleÆ;BEà³à³à³æ«ar;ìâ§Ì¸qual;æÄquà³à´uareSuÄbp೨೹setÄ;Eà³°à³³ìâ̸qual;æ¢ersetÄ;Eà´à´ìâ̸qual;æ£Æbcpà´à´¤àµsetÄ;Eà´à´ìââqual;æceedsÈ;ESTà´²à´³à´»àµæqual;ì⪰̸lantEqual;æ¡ilde;ìâ¿Ì¸ersetÄ;Eàµàµìââqual;æildeÈ;EFT൮൯൵ൿæqual;æullEqual;æilde;æerticalBar;æ¤cr;ìð©ildeè»Ãä;äÜEacdfgmoprstuvà¶½à·à·à·à·à· à·§à·¼à¸à¸ ยา฿à¹lig;ä
cuteè»ÃäÄiyà·à·rcè»Ãä;äblac;ä
r;ìðraveè»ÃäÆaei෮ෲ෶cr;ä
ga;ä©cron;äpf;ìðenCurlyÄDQà¸à¸oubleQuote;æuote;æ;æ©Äclวฬr;ìðªashè»ÃäiŬื฼deè»Ãäes;樷mlè»ÃäerÄBPà¹à¹ Äarà¹à¹r;æ¾acÄekà¹à¹;æet;æ´arenthesis;æÒacfhilors๿àºàºàºàºàºàºàº°à»¼rtialD;æy;är;ìði;ä¦;ä usMinus;ä±ÄipຢàºncareplanÃ¥Úf;æÈ;eio຺ູ໠໤檻cedesÈ;ESTà»à»à»à»æºqual;檯lantEqual;æ¼ilde;æ¾me;æ³Ädp໩໮uct;æortionÄ;aȥ໹l;æÄcià¼à¼r;ìð«;ä¨ÈUfosà¼à¼à¼à¼OTè»"ä¢r;ìðpf;æcr;ìð¬ØBEacefhiorsu༾à½à½à½ ཱིྦྷྪà¾áá©á´á¾arr;æ¤Gè»Â®ä®Æcnrà½à½à½ute;ä
g;æ«rÄ;tà½à½æ l;æ¤Æaeyཧཬཱron;ä
dil;ä
;ä Ä;vླྀཹæerseÄEUà¾à¾Älqà¾à¾ement;æuilibrium;æpEquilibrium;楯r»ཹo;ä¡ghtÐACDFTUVaà¿à¿«à¿³á¢á¨ááÏÄnrà¿à¿gleBracket;æ©rowÆ;BLà¿à¿à¿¡æar;æ¥eftArrow;æeiling;æoǵ࿹\0á
bleBracket;æ§nÇá\0áeeVector;æ¥ectorÄ;Bááæar;æ¥loor;æÄerááeÆ;AVáµá¶á¼æ¢rrow;æ¦ector;æ¥iangleÆ;BEáááæ³ar;æ§qual;æµpÆDTVá£á®á¸ownVector;æ¥eeVector;æ¥ectorÄ;Bááæ¾ar;æ¥ectorÄ;Bááæar;æ¥Äpuááf;ændImplies;楰ightarrow;æÄchá¹á¼r;æ;æ±leDelayed;æ§´ÚHOacfhimoqstuá¤á±á·á½ááá
á
á
¡á
§áµá»á¿ÄCcá©á®Hcy;ä©y;ä¨FTcy;ä¬cute;ä
Ê;aeiyáááááæª¼ron;ä
dil;ä
rc;ä
;ä¡r;ìðortÈDLRUáªá´á¾á
ownArrow»ÐeftArrow»à¢ightArrow»à¿pArrow;ægma;ä£allCircle;æpf;ìðɲá
\0\0á
°t;æareÈ;ISUá
ȇ
¼áá¯æ¡ntersection;æuÄbpáásetÄ;Eááæqual;æersetÄ;Eá¨á©æqual;ænion;æcr;ìð®ar;æÈbcmpááááÄ;sááæetÄ;Eááqual;æÄchá á
eedsÈ;ESTáá®á´á¿æ»qual;檰lantEqual;æ½ilde;æ¿Tháà¾;æÆ;esááá£ærsetÄ;Eááæqual;æet»áÖHRSacfhiorsá¾ááááá±á¶ááááORNè»ÃäADE;æ¢ÄHcáácy;äy;ä¦Äbuáá;ä;䤯aeyá¥áªá¯ron;ä
¤dil;ä
¢;ä¢r;ìðÄeiá»áDzá\0áefore;æ´a;äÄcnáákSpace;ìââSpace;ældeÈ;EFTá«á¬á²á¼æ¼qual;æullEqual;æ
ilde;æpf;ìðipleDot;æÄctáár;ìð¯rok;ä
¦à«¡á·ááá¦\0á¬á±\0\0\0\0\0á¸á½á·á
\0á¿áááÄcrá»áuteè»ÃärÄ;oááæcir;æ¥rÇ£á\0áy;äve;ä
¬Äiyáá£rcè»Ãä;ä£blac;ä
°r;ìðraveè»Ãäacr;ä
ªÄdiáá©erÄBPááÄaráár;äacÄekáá;æet;æµarenthesis;æonÄ;Pá°á±ælus;æÄgpá»á¿on;ä
²f;ìðÐADETadpsáá®á¸áϨááá³rrowÆ;BDá
á á¤ar;æ¤ownArrow;æ
ownArrow;æquilibrium;楮eeÄ;Aááæ¥rrow;æ¥ownáϳerÄLRáá¨eftArrow;æightArrow;æiÄ;lá¹áºäon;ä¥ing;ä
®cr;ìð°ilde;ä
¨mlè»ÃäÒDbcdefosvá§á¬á°á³á¾á
áááash;æ«ar;æ««y;äashÄ;lá»á¼æ©;櫦Äeráá
;æÆbtyáááºar;æÄ;iáácalÈBLSTá¡á¥áªá´ar;æ£ine;ä¼eparator;æilde;æThinSpace;ær;ìðpf;ìðcr;ìð±dash;æªÊcefosá§á¬á±á¶á¼irc;ä
´dge;ær;
vendor: 7,828 bytes, line 147
147ìðpf;ìðcr;ìð²Èfiosáááár;ìð;äpf;ìðcr;ìð³ÒAIUacfosuá±áµá¹á½ááááá cy;ä¯cy;äcy;ä®cuteè»ÃäÄiyáárc;ä
¶;ä«r;ìðpf;ìðcr;ìð´ml;ä
¸ÐHacdefosáµá¹á¿áááá á¤cy;äcute;ä
¹Äayááron;ä
½;äot;ä
»Ç²á\0áoWidtèà«a;är;æ¨pf;æ¤cr;ìðµà¯¡ááá\0á°á¶á¿\0\0\0\0ááá«áá\0ááá²á¹\0á¾cuteè»Ã¡ä¡reve;äÌ;Ediuyááá¡á£á¨áæ¾;ìâ¾Ì³;æ¿rcè»Ã¢ä¢teè»Â´Ì;ä°ligè»Ã¦ä¦Ä;r²áº;ìðraveè»Ã ä ÄepááÄfpáásym;æµÃ¨áha;ä±ÄapácÄclá¤á§r;äg;樿ɤá°\0\0áÊ;adsváºá»á¿ááæ§nd;æ©;æ©lope;æ©;æ©Î;elmrszááááá¿ááæ ;榤e»ásdÄ;aá¥á¦æ¡Ñ¡á°á²á´á¶á¸áºá¼á¾;榨;榩;榪;榫;榬;æ¦;榮;榯tÄ;vá
áæbÄ;dááæ¾;æ¦Äptááh;æ¢Â»Â¹arr;æ¼Ägpá£á§on;ä
f;ìðÎ;Eaeiopáá»á½áááá;æ©°cir;橯;æd;æs;ä§roxÄ;eááñáingè»Ã¥ä¥Æctyá¡á¦á¨r;ìð¶;äªmpÄ;eáá¯Ã±Êildeè»Ã£ä£mlè»Ã¤ä¤Äciááoninôɲnt;æ¨à Nabcdefiklnoprsuáá±á°á¼ááá¸á½á á¦á ¹á¡á᤽á¥á¥°ot;æ«Äcrá¶ákÈcepsáá
ááong;æpsilon;ä¶rime;æµimÄ;eááæ½q;æÅ¶á¢á¦ee;æ½edÄ;gá¬áæ
e»árkÄ;táá·brk;æ¶Äoyáá;ä±quo;æÊcmprtááá¡á¤á¨ausÄ;eÄÄptyv;榰séánoÃµÄÆahwá¯á±á³;ä²;æ¶een;æ¬r;ìðgÎcostuvwááá³ááááÆaiuáááÃ°Ý rc;æ¯pÂ»á±Ædptá¤á¨áot;æ¨lus;æ¨imes;æ¨É±á¹\0\0á¾cup;æ¨ar;æ
riangleÄduááown;æ½p;æ³plus;æ¨eÃ¥áÃ¥áarow;æ¤Æakoáá ¦á µÄcná²á £kÆlstáºÖ«á ozenge;æ§«riangleÈ;dlrá á á á æ´own;æ¾eft;æight;æ¸k;æ£Æ±á «\0á ³Æ²á ¯\0á ±;æ;æ4;æck;æÄeoá ¾á¡Ä;qá¡á¡ì=â¥uiv;ìâ¡â¥t;æÈptwxá¡á¡á¡§á¡¬f;ìðÄ;táá¡£om»átie;æØDHUVbdhmptuvá¢
á¢á¢ªá¢»á£á£á£¬á£¿á¤
á¤á¤á¤¡ÈLRlrá¢á¢á¢á¢;æ;æ;æ;æÊ;DUduᢡᢢᢤᢦᢨæ;æ¦;æ©;æ¤;æ§ÈLRlrᢳᢵᢷᢹ;æ;æ;æ;æÎ;HLRhlrá£á£á£á£á£á£á£æ;æ¬;æ£;æ ;æ«;æ¢;æox;æ§ÈLRlrᣤᣦᣨᣪ;æ;æ;æ;æÊ;DUduڽ᣷᣹᣻᣽;æ¥;æ¨;æ¬;æ´inus;ælus;æimes;æ ÈLRlrá¤á¤á¤á¤;æ;æ;æ;æÎ;HLRhlrᤰᤱᤳᤵᤷ᤻᤹æ;æª;æ¡;æ;æ¼;æ¤;æÄevÄ£á¥barè»Â¦ä¦Èceioá¥á¥á¥á¥ r;ìð·mi;æmÄ;eáálÆ;bhᥨᥩᥫä;æ§
sub;æÅ¬á¥´á¥¾lÄ;e᥹᥺æ¢t»᥺pÆ;Eeįá¦
á¦;檮Ä;qÛÛೡᦧ\0᧨á¨á¨á¨²\0ᨷá©\0\0᪴\0\0á«\0\0ᬡᬮáá\0᯽\0á°Æcprá¦á¦²á§ute;äÌ;abcdsᦿá§á§á§á§á§æ©nd;æ©rcup;æ©Äauá§á§p;æ©p;æ©ot;æ©;ìâ©ï¸Äeo᧢᧥t;æÃ®ÚÈaeiuá§°á§»á¨á¨
ǰ᧵\0᧸s;æ©on;ädilè»Ã§ä§rc;äpsÄ;sá¨á¨æ©m;æ©ot;äÆdmná¨á¨ ᨦilè»Â¸Æptyv;榲tè¢;eá¨á¨®ä¢räƲr;ìð Æceiᨽá©á©y;äckÄ;má©á©æark»á©;ärÎ;Ecefmsá©á© ᩢᩫ᪤᪪᪮æ;æ§Æ;elᩩᩪá©äq;æeɡᩴ\0\0áªrrowÄlr᩼áªeft;æºight;æ»ÊRSacdáªáªáªáªáªÂ»à½;æst;æirc;æash;ænint;æ¨id;櫯cir;æ§ubsÄ;u᪻᪼æ£it»᪼ˬá«á«á«º\0á¬onÄ;eá«á«äºÄ;qÃÃÉá«\0\0á«¢aÄ;tá«á«ä¬;äÆ;fl᫨᫩᫫æÃ®á
eÄmx᫱᫶ent»᫩eóÉǧ᫾\0á¬Ä;dá»á¬ot;æ©nÃ´ÉÆfryá¬á¬á¬;ìðoäÉè©;sÅá¬r;æÄaoᬥᬩrr;æµss;æÄcuᬲᬷr;ìð¸ÄbpᬼáÄ;eááæ«;æ«Ä;eááæ«;æ«dot;æ¯Îdelprvwá á¬á·á®á®¬á¯á¯¹arrÄlrá¨áª;椸;椵ɰá²\0\0áµr;æc;æarrÄ;pá¿á®æ¶;椽Ì;bcdosá®á®á®á®¡á®¥á®¨æªrcap;æ©Äauá®á®p;æ©p;æ©ot;ær;æ©
;ìâªï¸Èalrv᮵ᮿá¯á¯£rrÄ;mᮼᮽæ·;椼yÆevwá¯á¯á¯qɰá¯\0\0á¯reãá³uãáµee;æedge;æenè»Â¤ä¤earrowÄlrᯮ᯳eft»á®ight»ᮽeäá¯Äciá°á°oninôǷnt;æ±lcty;æà¦AHabcdefhijlorstuwz᰸᰻᰿á±á±©á±µá²á²á²¬á²·á³»á³¿á´áµ»á¶á¶«á¶»á·á·ròÎar;楥Èglrsá±á±á±á±ger;æ eth;æ¸Ã²á³hÄ;vá±á±æÂ»à¤Å«á±¡á±§arow;æ¤aãÌÄayᱮᱳron;ä;ä´Æ;ao̲ᱼá²ÄgrÊ¿á²r;ætseq;æ©·Æglmá²á²á²è»Â°ä°ta;ä´ptyv;榱ÄirᲣᲨsht;楿;ìð¡arÄlrᲳᲵ»à£Â»áÊaegsvá³Í¸á³á³á³ mÆ;oșá³á³ndÄ;șá³uit;æ¦amma;äin;æ²Æ;io᳧᳨᳸ä·deè÷;oá³§á³°ntimes;ænø᳷cy;äcɯá´\0\0á´rn;æop;æÊlptuwá´á´á´¢áµáµlar;ä¤f;ìðÊ;empsÌá´á´·á´½áµqÄ;dÍá´³ot;æinus;æ¸lus;æquare;æ¡blebarwedgåúnÆadhá®áµáµ§ownarrowóá²arpoonÄlrᵲᵶefôᲴighôᲶŢᵿá¶
karo÷à½É¯á¶\0\0á¶rn;æop;æÆcotá¶á¶£á¶¦Äryá¶á¶¡;ìð¹;äl;æ§¶rok;äÄdrá¶°á¶´ot;æ±iÄ;fá¶ºá æ¿Äahá·á·ròЩaòྦangle;榦Äciá·á·y;ägrarr;æ¿à¤Dacdefglmnopqrstuxá¸á¸á¸á¸¸Õ¸á¸¼á¹á¹¡á¹¾áº¥áº¯áº½á»¡á¼ªá¼·á½á½á½ÄDoá¸á´´oôá²Äcsá¸á¸uteè»Ã©ä©ter;æ©®ÈaioyḢḧḱḶron;ärÄ;cá¸á¸®æè»Ãªäªlon;æ;äot;äÄDrá¹á¹
ot;æ;ìð¢Æ;rsá¹á¹á¹æªaveè»Ã¨ä¨Ä;dá¹á¹æªot;æªÈ;ilsṪṫṲṴæªnters;æ§;æÄ;dṹṺæªot;æªÆapsáº
áºáºcr;ätyÆ;sváºáºáºæ
et»áºpÄ1;áºáº¤Ä³áº¡áº£;æ;æ
æÄgsẪẬ;ä
p;æÄgpẴẸon;äf;ìðÆalsá»á»á»rÄ;sá»á»æl;æ§£us;橱iÆ;lvá»á»á»äµon»á»;äµÈcsuvỪỳá¼á¼£Äioữḱrc»Ḯɩỹ\0\0á»»ÃÕantÄglá¼á¼tr»á¹ess»ṺÆaeiá¼á¼á¼ls;ä½st;ævÄ;DȵἠD;橸parsl;æ§¥ÄDaἯἳot;ærr;楱Æcdiá¼¾á½á»¸r;æ¯oôÍÄahá½á½;ä·è»Ã°ä°Ämrá½á½lè»Ã«ä«o;æ¬Æcipὡὤὧl;ä¡sôծÄeoὬὴctatioîÕnentialåչৡá¾\0á¾\0ᾡᾧ\0\0á¿á¿\0á¿\0ῦῪâ\0ââllingdotseñá¹y;ämale;æÆilrá¾á¾³á¿lig;èï¬É©á¾¹\0\0á¾½g;èï¬ig;èï¬;ìð£lig;èï¬lig;ìfjÆaltá¿á¿á¿¡t;æig;èï¬ns;æ±of;äǰ΅\0ῳf;ìðÄakÖ¿á¿·Ä;vῼ´æ;æ«artint;æ¨ÄaoââÄcsââαââ°â¸â
â\0âβâ¢â¥â§âªâ¬\0â®è»Â½ä½;æ
è»Â¼ä¼;æ
;æ
;æ
Ƴâ´\0â¶;æ
;æ
Ê´â¾â\0\0âè»Â¾ä¾;æ
;æ
5;æ
ƶâ\0â;æ
;æ
8;æ
l;æwn;æ¢cr;ìð»à¢Eabcdefgijlnorstvââââ¥â°â´â°âµâºâ¿âââ¸Ìâ¾â
âÄ;lÙâ;æªÆcmpâââute;äµmaÄ;dâá³ä³;æªreve;äÄiyâªâ®rc;ä;ä³ot;ä¡È;lqsؾÙâ½âÆ;qsؾÙâlanô٥È;cdlÙ¥âââ¥c;檩otÄ;oââæªÄ;lâ¢â£æª;æªÄ;eâªâìâï¸s;æªr;ìð¤Ä;gÙ³Ømel;æ·cy;äÈ;EajÙâââ;æª;檥;檤ÈEaesâââ©â´;æ©pÄ;pâ£â¤æªrox»â¤Ä;qâ®â¯æªÄ;qâ®âim;æ§pf;ìðÄciâ
â
r;æmÆ;elÙ«â
â
;æª;æªè>;cdlqr×®â
â
ªâ
®â
³â
¹Äciâ
¥â
§;檧r;橺ot;æPar;æ¦uest;橼Êadelsââ
ªâÙâǰâ\0âproøâr;楸qÄlqØ¿âlesóâiÃÙ«Äenâ£ârtneqq;ìâ©ï¸Ã
âªÔAabcefkosyâââ±âµâºâââ¯â¨â½ròΠÈilmrâââârsðáf»â¤ilôکÄdrâ â¤cy;äÆ;cwࣴâ«â¯ir;æ¥;æar;æirc;䥯alrââârtsÄ;uââæ¥it»âlip;æ¦con;æ¹r;ìð¥sÄewâ£â©arow;椥arow;椦Êamoprâºâ¾âââ£rr;æ¿tht;æ»kÄlrââeftarrow;æ©ightarrow;æªf;ìðbar;æÆcltâ¯â´â¸r;ìð½asèâ´rok;ä§Äbpââull;æhen»á±à«¡â£\0âª\0â¸â
â\0ââ³\0\0â¸â¢â§â¢â¿\0ââªâ´cuteè»ÃäÆ;iyݱâ°âµrcè»Ã®ä®;ä¸Äcxâ¼â¿y;äµclè»Â¡ä¡ÄfrÎâ;ìð¦raveè»Ã¬ä¬È;inoܾââ©â®Äinâ¢â¦nt;æ¨t;æfin;æ§ta;æ©lig;䳯aopâ¾ââÆcgtâ
ââr;䫯elpÜââinÃ¥ÞarÃ´Ü h;ä±f;æ·ed;äµÊ;cfotÓ´â¬â±â½âare;æ
inÄ;tâ¸â¹æie;æ§doôâÊ;celpÝââââ¡al;æºÄgrââeróá£Ã£âarhk;æ¨rod;樼Ècgptâ¯â²â¶â»y;äon;ä¯f;ìða;ä¹uestè»Â¿ä¿Äciââr;ìð¾nÊ;EdsvÓ´âââ¡Ó³;æ¹ot;æµÄ;vâ¦â§æ´;æ³Ä;iÝ·â®lde;ä©Ç«â¸\0â¼cy;älè»Ã¯ä¯Ìcfmosuââââ¡â§âµÄiyâârc;äµ;ä¹r;ìð§ath;ä·pf;ìðÇ£â¬\0â±r;ìð¿rcy;äkcy;äÐacfghjosâââ¢â§ââ±âµâ»ppaÄ;vââäº;ä°Äeyââ dil;ä·;äºr;ìð¨reen;ä¸cy;ä
cy;äpf;ìðcr;ìðà®ABEHabcdefghjlmnoprstuvâ°ââââââ½âââââ¥â¹â½ââ²âââ¨âââ â Æartâ·âºâ¼ròà§Ã²Îail;æ¤arr;æ¤Ä;gà¦â;æªar;楢ॣâ¥\0âª\0â±\0\0\0\0\0âµâº\0âââ\0â¹ute;äºmptyv;榴raîà¡bda;ä»gÆ;dlà¢ââ;æ¦Ã¥à¢;æª
uoè»Â«ä«rÐ;bfhlpstà¢ââ¦â©â«â®â±âµÄ;fà¢â£s;æ¤s;æ¤Ã«âp;æ«l;椹im;楳l;æ¢Æ;aeâ¿ââæª«il;æ¤Ä;sââæª;ìâªï¸Æabrââârr;æ¤rk;æ²Äakâ¢â¬cÄekâ¨âª;ä»;äÄesâ±â³;æ¦lÄduâ¹â»;æ¦;æ¦Èaeuyââââron;ä¾Ädiââil;ä¼Ã¬à¢°Ã¢â©;
vendor: 4,294 bytes, line 147
147ä»Ècqrsâ£â¦ââ½a;椶uoÄ;rà¸áÄduâ²â·har;楧shar;æ¥h;æ²Ê;fgqsââà¦â³â¿æ¤tÊahlrtââ¤â·ââ¨rrowÄ;tà¢â¡aéâ¶arpoonÄduâ¯â´own»Ñp»०eftarrows;æightÆahsââârrowÄ;sࣴࢧarpoonóà¾quigarro÷â°hreetimes;æÆ;qsâà¦âºlanôবÊ;cdgsবââââ¨c;檨otÄ;oââæ©¿Ä;rââæª;æªÄ;eâ¢â¥ìâï¸s;æªÊadegsâ³â¹â½ââpproøâot;æqÄgqââ
ôà¦gtòâôà¦iÃলÆilrâ࣡âsht;楼;ìð©Ä;Eà¦â£;æªÅ¡â©â¶rÄduâ²â®Ä;l॥â³;楪lk;æcy;äÊ;achtà©ââââròâorneòá´ard;楫ri;æºÄioââ¤dot;ä
ustÄ;aâ¬âæ°che»âÈEaesâ»â½ââ;æ¨pÄ;pââæªrox»âÄ;qââæªÄ;qââ»im;æ¦Ðabnoptwzâ©â´â·ââ¯âââÄnrâ®â±g;æ¬r;æ½rëà£gÆlmrâ¿ââeftÄar০âightá৲apsto;æ¼ightá৽parrowÄlrâ¥â©efôâight;æ¬Æaflâ¶â¹â½r;æ¦
;ìðus;æ¨imes;樴šââst;æÃ¡áÆ;efââá ænge»âarÄ;lâ¤â¥ä¨t;æ¦Êachmtâ³â¶â¼â
âròࢨorneòá¶arÄ;dà¾â;æ¥;æri;æ¿Ìachiqtââà©â¢â®â»quo;æ¹r;ìðmÆ;egলâªâ¬;æª;æªÄbuâªâ³oÄ;rà¸â¹;ærok;ä
è<;cdhilqrà «ââ¹ââ â¥âªâ°Äciââ;檦r;橹reÃ¥â²mes;æarr;楶uest;æ©»ÄPiâµâ¹ar;æ¦Æ;efâ à¤á ærÄduâ â shar;æ¥har;楦Äenâ â ¡rtneqq;ìâ¨ï¸Ã
â ÜDacdefhilnopsuâ¡â¡
â¢â¢â¢â¢ ⢥⢨â£â£¢â£¤àªâ£³â¤Dot;æºÈclprâ¡â¡â¡£â¡½rè»Â¯ä¯Äetâ¡â¡;æÄ;eâ¡â¡æ se»â¡Ä;sá»â¡¨toÈ;dluá»â¡³â¡·â¡»owîÒefôà¤Ã°áker;æ®Äoyâ¢â¢mma;権;ä¼ash;æasuredangle»á¦r;ìðªo;æ§Æcdn⢯⢴â£roè»ÂµäµÈ;acdá¤â¢½â£â£sôá§ir;æ«°otè»Â·ÆµusÆ;bdâ£á¤â£æÄ;uá´¼â£;横ţâ£â£¡p;æ«Ã²âðàªÄdp⣩⣮els;æ§f;ìðÄct⣸⣽r;ìðpos»áÆ;lmâ¤â¤â¤ä¼timap;æ¸à°GLRVabcdefghijlmoprstuvwâ¥â¥â¥¾â¦â¦â§â§©â¨â¨â©â©âªâªâª¤âª¨â¬â¬ââ¿â®®â°´â±§â±¼â³©Ägtâ¥â¥;ìâ̸Ä;vâ¥à¯ìâ«âÆeltâ¥â¥²â¥¶ftÄar⥡⥧rrow;æightarrow;æ;ìâ̸Ä;v⥻à±ìâªâightarrow;æÄDdâ¦â¦ash;æ¯ash;æ®Êbcnpt⦣⦧⦬⦱â§la»Ëute;ä
g;ìâ âÊ;Eiopà¶â¦¼â§â§
â§;ì⩰̸d;ìâ̸s;ä
roøà¶urÄ;aâ§â§æ®lÄ;sâ§à¬¸Ç³â§\0â§£pè»Â ଷmpÄ;e௹à°Êaeouyâ§´â§¾â¨â¨â¨Ç°â§¹\0â§»;æ©on;ä
dil;ä
ngÄ;dൾâ¨ot;ìâ©Ì¸p;æ©;ä½ash;æÎ;Aadqsxà®â¨©â¨â¨»â©â©
â©rr;ærÄhr⨳⨶k;椤Ä;oá²á°ot;ìâ̸uiöà£Äeiâ©â©ar;椨Ãà®istÄ;sà® à®r;ìð«ÈEestà¯
⩦⩹⩼Æ;qs஼â©à¯¡Æ;qs஼à¯
â©´lanô௢iÃ௪Ä;rà®¶âªÂ»à®·ÆAapâªâªâªrò⥱rr;æ®ar;櫲Æ;svà¾âªà¾Ä;d⪡⪢æ¼;æºcy;äÎAEadest⪷⪺⪾â«â«
⫶⫹rò⥦;ìâ¦Ì¸rr;ær;æ¥È;fqsà°»â«â«£â«¯tÄarâ«â«rro÷â«ightarroÃ·âªÆ;qs఻⪺⫪lanôà±Ä;sà±â«´Â»à°¶iÃà±Ä;rవ⫾iÄ;eà°à°¥iäà¶Äptâ¬â¬f;ìðè¬;inâ¬â¬â¬¶ä¬nÈ;Edvà®â¬¤â¬¨â¬®;ìâ¹Ì¸ot;ìâµÌ¸Ç¡à®â¬³â¬µ;æ·;æ¶iÄ;vಸ⬼ǡಸââ;æ¾;æ½Æaorââ£â©rÈ;astà»âââlleìà»l;ì⫽â¥;ìâ̸lint;æ¨Æ;ceà²â°â³uåಥÄ;cà²â¸Ä;eà²â½Ã±à²ÈAaitâ®â®â®â®§ròâ¦rrÆ;cwâ®â®â®æ;ì⤳̸;ìâ̸ghtarrow»â®riÄ;eà³à³Îchimpqu⮽â¯â¯â¬à¸â¯¤â¯¯È;cerà´²â¯à´·â¯uÃ¥àµ
;ìðortÉâ¬
\0\0â¯aráâmÄ;e൮â¯Ä;q൴൳suÄbp⯫â¯Ã¥à³¸Ã¥à´Æbcp⯶â°â°È;Ees⯿â°à´¢â°æ;ìâ«
̸etÄ;eà´â°qÄ;qà´£â°cÄ;eà´²â°Ã±à´¸È;EesⰢⰣàµâ°§æ
;ìâ«Ì¸etÄ;eàµâ°®qÄ;qൠⰣÈgilrⰽⰿâ±
â±Ã¬à¯ldeè»Ã±ä±Ã§à±iangleÄlrâ±â±eftÄ;eà°â±Ã±à°¦ightÄ;eà³â±¥Ã±à³Ä;mⱬâ±ä½Æ;esⱴⱵⱹä£ro;æp;æÒDHadgilrsâ²â²â²â²â²£â²°â²¶â³â³£ash;æarr;æ¤p;ìââash;æ¬ÄetⲨⲬ;ìâ¥â;ì>ânfin;æ§ÆAetâ²½â³â³
rr;æ¤;ìâ¤âÄ;râ³â³ì<âie;ìâ´âÄAtâ³â³rr;æ¤rie;ìâµâim;ìâ¼âÆAanâ³°â³´â´rr;ærÄhr⳺⳽k;椣Ä;oá§á¥ear;椧ááª\0\0\0\0\0\0\0\0\0\0\0\0\0â´\0â´¸âµâµ ⵥ⵲â¶á¬\0\0â¶â¶«\0â·â·\0â·â¸â¸«â¸¾â¹Äcsâ´±áªuteè»Ã³ä³Äiyâ´¼âµ
rÄ;cáªâµè»Ã´ä´;ä¾Êabios᪠âµâµÇâµlac;ä
v;樸old;榼lig;ä
Äcr⵩âµir;榿;ìð¬Í¯âµ¹\0\0âµ¼\0â¶n;äaveè»Ã²ä²;æ§Äbmâ¶à·´ar;榵Èacitâ¶â¶â¶¥â¶¨ròáªÄirâ¶â¶ r;榾oss;榻nÃ¥à¹;æ§Æaeiⶱⶵⶹcr;ä
ga;äÆcdnâ·â·
Çron;ä¿;榶pf;ìð Æaelâ·â·Çr;榷rp;榹Î;adiosvⷪⷫⷮâ¸â¸â¸â¸æ¨ròáªÈ;efmâ··â·¸â¸â¸
æ©rÄ;oⷾⷿæ´f»ⷿè»Âªäªè»Âºäºgof;æ¶r;æ©lope;æ©;æ©Æcloâ¸â¸¡â¸§Ã²â¸ashè»Ã¸ä¸l;æiŬⸯ⸴deè»ÃµäµesÄ;aÇ⸺s;樶mlè»Ã¶ä¶bar;æ½à«¡â¹\0â¹½\0âºâº\0⺢⺹\0\0â»àº\0â¼\0\0⼫⾼\0â¿rÈ;
vendor: 6,210 bytes, line 147
147astÐâ¹§â¹²àº
è¶;lâ¹â¹®ä¶leìÐɩ⹸\0\0â¹»m;櫳;櫽y;ä¿rÊcimptâºâºâºá¡¥âºnt;ä¥od;ä®il;æ°enk;æ±r;ìðÆimo⺨⺰⺴Ä;vâºâº®ä;ämaô੶ne;æÆ;tv⺿â»â»ächfork»´;äÄauâ»â»nÄckâ»â»kÄ;hâ´â»;æÃ¶â´sÒ;abcdemst⻳⻴á¤â»¹â»½â¼â¼â¼â¼ä«cir;樣ir;樢Äouáµâ¼;樥;橲nè»Â±àºim;樦wo;樧Æipuâ¼â¼ â¼¥ntint;æ¨f;ìð¡ndè»Â£ä£Ô;Eaceinosuà»â¼¿â½â½â½â¾â¾â¾â½¾â¾¶;檳p;檷uÃ¥à»Ä;cà»â½Ì;acensà»â½â½â½¦â½¨â½¾pproøâ½urlyeñà»Ã±à»Æaes⽯⽶⽺pprox;檹qq;檵im;æ¨iÃà»meÄ;sâ¾àº®æ²ÆEas⽸â¾â½ºÃ°â½µÆdfp໬â¾â¾¯Æals⾠⾥⾪lar;æ®ine;æurf;æÄ;t໻⾴ï໻rel;æ°Äciâ¿â¿
r;ìð
;äncsp;æÌfiopsuâ¿â¢â¿â¿¥â¿«â¿±r;ìð®pf;ìð¢rime;æcr;ìðÆaeo⿸ããtÄei⿾ã
rnionóڰnt;æ¨stÄ;eããä¿Ã±á¼Ã´à¼àªABHabcdefhilmnoprstuxããããã ãã«ã
ã
¢ã
²ãããã¤ã©ãã®ã²ãã°ã·Æartãããròá³Ã²Ïail;æ¤aròᱥar;楤Îcdenqrtã¨ãµã¸ã¿ãããÄeuãã±;ìâ½Ì±te;ä
iãá
®mptyv;榳gÈ;delà¿ããã;æ¦;榥åà¿uoè»Â»ä»rÖ;abcfhlpstwà¿ã¬ã¯ã·ã¹ã¼ã¾ããããp;極Ä;fà¿ ã´s;æ¤ ;椳s;æ¤Ã«âðâ®l;æ¥
im;楴l;æ£;æÄaiããil;æ¤oÄ;nããæ¶alÃ³à¼Æabrã§ãªã®ròá¥rk;æ³Äakã³ã½cÄekã¹ã»;ä½;äÄesãã;æ¦lÄduãã;æ¦;æ¦Èaeuyããã§ã©ron;ä
Ädiã¡ã¥il;ä
ì࿲âãº;äÈclqsã´ã·ã½ã
a;椷dhar;楩uoÄ;rÈÈh;æ³Æacgã
ã
à½lÈ;ipsླྀã
ã
ánÃ¥á»arôྩt;æÆilrã
©á£ã
®sht;楽;ìð¯Äaoã
·ãrÄduã
½ã
¿Â»Ñ»Ä;láã;楬Ä;vããä;䱯gnsãã¹ã¼htÌahlrstã¤ã°ããã¤ã®rrowÄ;tà¿ãaéãarpoonÄduã»ã¿owîã
¾p»áeftÄahããrrowó࿪arpoonóÕightarrows;æquigarro÷ãhreetimes;æg;äingdotseñἲÆahmãããrò࿪aòÕ;æoustÄ;aããæ±che»ãmid;æ«®Èabptã²ã½ããÄnrã·ãºg;ær;æ¾rëáÆaflãããr;æ¦;ìð£us;樮imes;樵Äapãã§rÄ;gã£ã¤ä©t;æ¦olint;æ¨aròã£Èachqã»ãá¼ã
quo;æºr;ìðÄbuã»ãoÄ;rÈÈÆhirããã reÃ¥ã¸mes;æiÈ;eflãªáá ¡ã«æ¹tri;æ§luhar;楨;æàµ¡ãããã¬ã¸ã±\0ãºã¤\0\0ã¬ã°\0ã¨ãããã±ãã±\0ã\0\0ã³cute;ä
quïâºÔ;Eaceinpsyáã³ãµã¿ããããã¦ã©;檴ǰãº\0ã¼;檸on;ä
¡uÃ¥á¾Ä;dá³ãil;ä
rc;ä
ÆEasããã;檶p;檺im;æ©olint;æ¨iÃá;äotÆ;beã´áµãµæ
;橦ÎAacmstxãããããã£ãrr;ærÄhrããëâ¨Ä;oਸ਼਴tè»Â§ä§i;ä»war;椩mÄinã©Ã°nuóñt;æ¶rÄ;oã¶âìð°Èacoyãããã rp;æ¯Ähyããcy;ä;ärtÉã\0\0ãiäá¤araì⹯è»ÂäÄgmã¨ã´maÆ;fvã±ã²ã²ä;äÐ;deglnprá«ã
ããããã¡ã¦ot;橪Ä;qá±á°Ä;Eããæª;æª Ä;Eããæª;æªe;ælus;樤arr;楲aròá½Èaeitã¸ãããÄlsã½ãlsetméãªhp;樳parsl;槤Ädlá£ãe;æ£Ä;eããæªªÄ;sã¢ã£æª¬;ìâª¬ï¸Æflpã®ã³ãtcy;äÄ;bã¸ã¹ä¯Ä;aã¾ã¿æ§r;æ¿f;ìð¤aÄdrãÐesÄ;uããæ it»ãÆcsuã ã¹ãÄauã¥ã¯pÄ;sáã«;ìâï¸pÄ;sá´ãµ;ìâï¸uÄbpã¿ãÆ;esááãetÄ;eáãñáÆ;esá¨áãetÄ;eá¨ãÃ±á®Æ;afá
»ã¦Ö°rÅ¥ã«Ö±Â»á
¼aròá
Ècemtã¹ã¾ãã
r;ìðtmîñiìãaræá¾ÄarããrÄ;fãá¿æÄanããightÄepã£ãªpsiloîỠhé⺯s»â¡Êbcmnpã»ãáããÒ;Edemnprsãããããã£ã¬ã±ã¶æ;æ«
ot;檽Ä;dáãot;æ«ult;æ«ÄEeã¨ãª;æ«;ælus;檿arr;楹Æeiuã½ããtÆ;enãã
ãqÄ;qáãeqÄ;qã«ã¨m;æ«Äbpãã;æ«;æ«cÌ;acensáã¬ã²ã¹ã»ã¦pproøãºurlyeñá¾Ã±á³Æaesãããpproøãqñãg;æªÚ123;Edehlmnpsã©ã¬ã¯áã²ã´ãããããã¨ãè»Â¹ä¹è»Â²ä²è»Â³ä³;æ«Äosã¹ã¼t;檾ub;æ«Ä;dá¢ã
ot;æ«sÄouããl;æb;æ«arr;楻ult;æ«ÄEeã¤ã¦;æ«;ælus;æ«Æeiuã´ããtÆ;enáã¼ãqÄ;qá¢ã²eqÄ;qã§ã¤m;æ«Äbpãã;æ«;æ«ÆAanãã ãrr;ærÄhrã¦ã¨Ã«â®Ä;oਫ਩war;椪ligè»Ãä௡ããã áã³ã¹\0ã¾ã\0\0\0\0\0ãã\0ãã¬\0\0\0ãɲã\0\0ãget;æ;ärÃ«à¹Æaeyã¦ã«ã°ron;ä
¥dil;ä
£;älrec;ær;ìð±Èeikoãããµã¼Ç²ã\0ãeÄ4fááaÆ;svãããä¸ym;äÄcnã¢ã²kÄasã¨ã®pproøáim»á¬sðáÄasãºã®Ã°árnè»Ã¾ä¾Ç¬Ìãâ§esèÃ;bdãããäÄ;aá¤ãr;樱;樰Æepsã¡ã£ãáâ©È;bcfÒã¬ã°ã´ot;æ¶ir;櫱Ä;oã¹ã¼ìð¥rk;æ«Ã¡ã¢rime;æ´Æaipããã¤dÃ¥áÎadempstã¡ããããããngleÊ;dlqrã°ã±ã¶ããæµown»ᶻeftÄ;eâ ã¾Ã±à¤®;æightÄ;eãªãñáot;æ¬inus;樺lus;樹b;æ§ime;樻ezium;æ¢Æchtã²ã½ãÄryã·ã»;ìð;äcy;ärok;ä
§Äioããxôá·headÄlrãã eftarro÷à¡ightarrow»à½à¤AHabcdfghlmoprstuwãããã¤ã°ã¼ã ã 㠣㠴ã¡ã¡ã¡«ã¢©ã£ã£ã£ªã£¶ròÏar;楣Äcrãã¢uteè»ÃºäºÃ²á
rÇ£ãª\0ãy;äve;ä
Äiyãµãºrcè»Ã»ä»;äÆabhã ã ã ròálac;ä
±aòáÄirã ã sht;楾;ìð²raveè»Ã¹ä¹Å¡ã §ã ±rÄlr㠬㠮»à¥Â»álk;æÄctã ¹ã¡É¯ã ¿\0\0ã¡rnÄ;eã¡
ã¡ær»ã¡op;æri;æ¸Äalã¡ã¡cr;ä
«è»Â¨ÍÄgp㡢㡦on;ä
³f;ìð¦Ìadhlsuá
㡸㡽á²ã¢ã¢ ownáá³arpoonÄlrã¢ã¢efôã ighô㠯iÆ;hlã¢ã¢ã¢ä
»áºon»ã¢parrows;æÆcit㢰ã£ã£É¯ã¢¶\0\0ã£rnÄ;e㢼㢽ær»㢽op;æng;ä
¯ri;æ¹cr;ìðÆdirã£ã£ã£¢ot;æ°lde;ä
©iÄ;fã°ã£¨Â»á Äam㣯㣲rò㢨lè»Ã¼ä¼angle;榧ÞABDacdeflnoprszã¤ã¤ã¤©ã¤ã¦µã¦¸ã¦½ã§ã§¤ã§¨ã§³ã§¹ã§½ã¨ã¨ ròϷarÄ;v㤦㤧櫨;æ«©asèϡÄnr㤲㤷grt;æ¦Îeknprstã£ã¥ã¥ã¥ã¥ã¥¤ã¦appáâothinÃ§áºÆhirã«â»ã¥opô⾵Ä;há·ã¥¢Ã¯ãÄiu㥩ã¥gmáã³Äbp㥲ã¦setneqÄ;q㥽ã¦ìâï¸;ìâ«ï¸setneqÄ;qã¦ã¦ìâï¸;ìâ«ï¸Ährã¦ã¦etáãiangleÄlr㦪㦯eft»थight»áy;ä²ashÂ»á¶Æelrã§ã§ã§Æ;beâ·ªã§ã§ar;æ»q;ælip;æ®Äbtã§á¨aòá©r;ìð³tré㦮suÄbp㧯㧱»à´Â»àµpf;ìð§roð໻tré㦴Äcuã¨ã¨r;ìðÄbpã¨ã¨nÄEeã¦ã¨Â»ã¥¾nÄEeã¦ã¨Â»ã¦igzag;æ¦Îcefoprs㨶㨻ã©ã©ã©ã©¡ã©ªirc;ä
µÄdiã©ã©Äbgã©
ã©ar;æ©eÄ;qáºã©;æerp;ær;ìð´pf;ìð¨Ä;eá¹ã©¦atèá¹cr;ìðà«£áãª\0ãª\0ãªãª\0\0ãªãª¨ãª«ãª¯\0\0ã«ã«\0ã«áátréár;ìðµÄAaãªãªròÏrò৶;ä¾ÄAa㪡㪤ròθrò৫aðâis;æ»Ædptá¤ãªµãª¾Äfl㪺á©;ìð©imÃ¥á²ÄAaã«ã«ròÏròà¨Äcqã«á¸r;ìðÄptáã«réáÐacefiosu㫰㫽ã¬ã¬ã¬ã¬ã¬ã¬¡cÄuyã«¶ã«»teè»Ã½ä½;äÄiyã¬ã¬rc;ä
·;änè»Â¥ä¥r;ìð¶cy;äpf;ìðªcr;ìðÄcm㬦㬩y;älè»Ã¿ä¿Ôacdefhioswããããã¤ã©ãã´ãºã®cute;ä
ºÄayããron;ä
¾;ä·ot;ä
¼Äetãã¡træáa;ä¶r;ìð·cy;ä¶grarr;æpf;ìð«cr;ìðÄjnã®
ã®;æj;æ
147'.split("").map(e=>e.charCodeAt(0))),cRe=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function uRe(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=cRe.get(e))!==null&&t!==void 0?t:e}var Br;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(Br||(Br={}));const dRe=32;var hu;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(hu||(hu={}));function n3(e){return e>=Br.ZERO&&e<=Br.NINE}function hRe(e){return e>=Br.UPPER_A&&e<=Br.UPPER_F||e>=Br.LOWER_A&&e<=Br.LOWER_F}function pRe(e){return e>=Br.UPPER_A&&e<=Br.UPPER_Z||e>=Br.LOWER_A&&e<=Br.LOWER_Z||n3(e)}function mRe(e){return e===Br.EQUALS||pRe(e)}var Mr;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(Mr||(Mr={}));var Jl;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Jl||(Jl={}));class fRe{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=Mr.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Jl.Strict}startEntity(t){this.decodeMode=t,this.state=Mr.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case Mr.EntityStart:return t.charCodeAt(n)===Br.NUM?(this.state=Mr.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=Mr.NamedEntity,this.stateNamedEntity(t,n));case Mr.NumericStart:return this.stateNumericStart(t,n);case Mr.NumericDecimal:return this.stateNumericDecimal(t,n);case Mr.NumericHex:return this.stateNumericHex(t,n);case Mr.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|dRe)===Br.LOWER_X?(this.state=Mr.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=Mr.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,a){if(n!==r){const i=r-n;this.result=this.result*Math.pow(a,i)+Number.parseInt(t.substr(n,i),a),this.consumed+=i}}stateNumericHex(t,n){const r=n;for(;n<t.length;){const a=t.charCodeAt(n);if(n3(a)||hRe(a))n+=1;else return this.addToNumericResult(t,r,n,16),this.emitNumericEntity(a,3)}return this.addToNumericResult(t,r,n,16),-1}stateNumericDecimal(t,n){const r=n;for(;n<t.length;){const a=t.charCodeAt(n);if(n3(a))n+=1;else return this.addToNumericResult(t,r,n,10),this.emitNumericEntity(a,2)}return this.addToNumericResult(t,r,n,10),-1}emitNumericEntity(t,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===Br.SEMI)this.consumed+=1;else if(this.decodeMode===Jl.Strict)return 0;return this.emitCodePoint(uRe(this.result),this.consumed),this.errors&&(t!==Br.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let a=r[this.treeIndex],i=(a&hu.VALUE_LENGTH)>>14;for(;n<t.length;n++,this.excess++){const o=t.charCodeAt(n);if(this.treeIndex=gRe(r,a,this.treeIndex+Math.max(1,i),o),this.treeIndex<0)return this.result===0||this.decodeMode===Jl.Attribute&&(i===0||mRe(o))?0:this.emitNotTerminatedNamedEntity();if(a=r[this.treeIndex],i=(a&hu.VALUE_LENGTH)>>14,i!==0){if(o===Br.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Jl.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,a=(r[n]&hu.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,a,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:a}=this;return this.emitCodePoint(n===1?a[t]&~hu.VALUE_LENGTH:a[t+1],r),n===3&&this.emitCodePoint(a[t+2],r),r}end(){var t;switch(this.state){case Mr.NamedEntity:return this.result!==0&&(this.decodeMode!==Jl.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Mr.NumericDecimal:return this.emitNumericEntity(0,2);case Mr.NumericHex:return this.emitNumericEntity(0,3);case Mr.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Mr.EntityStart:return 0}}}function gRe(e,t,n,r){const a=(t&hu.BRANCH_LENGTH)>>7,i=t&hu.JUMP_TABLE;if(a===0)return i!==0&&r===i?n:-1;if(i){const c=r-i;return c<0||c>=a?-1:e[n+c]-1}let o=n,l=o+a-1;for(;o<=l;){const c=o+l>>>1,u=e[c];if(u<r)o=c+1;else if(u>r)l=c-1;else return e[c+a]}return-1}var nt;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(nt||(nt={}));var mh;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(mh||(mh={}));var Fi;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Fi||(Fi={}));var Ee;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="str
147ike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(Ee||(Ee={}));var R;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(R||(R={}));const xRe=new Map([[Ee.A,R.A],[Ee.ADDRESS,R.ADDRESS],[Ee.ANNOTATION_XML,R.ANNOTATION_XML],[Ee.APPLET,R.APPLET],[Ee.AREA,R.AREA],[Ee.ARTICLE,R.ARTICLE],[Ee.ASIDE,R.ASIDE],[Ee.B,R.B],[Ee.BASE,R.BASE],[Ee.BASEFONT,R.BASEFONT],[Ee.BGSOUND,R.BGSOUND],[Ee.BIG,R.BIG],[Ee.BLOCKQUOTE,R.BLOCKQUOTE],[Ee.BODY,R.BODY],[Ee.BR,R.BR],[Ee.BUTTON,R.BUTTON],[Ee.CAPTION,R.CAPTION],[Ee.CENTER,R.CENTER],[Ee.CODE,R.CODE],[Ee.COL,R.COL],[Ee.COLGROUP,R.COLGROUP],[Ee.DD,R.DD],[Ee.DESC,R.DESC],[Ee.DETAILS,R.DETAILS],[Ee.DIALOG,R.DIALOG],[Ee.DIR,R.DIR],[Ee.DIV,R.DIV],[Ee.DL,R.DL],[Ee.DT,R.DT],[Ee.EM,R.EM],[Ee.EMBED,R.EMBED],[Ee.FIELDSET,R.FIELDSET],[Ee.FIGCAPTION,R.FIGCAPTION],[Ee.FIGURE,R.FIGURE],[Ee.FONT,R.FONT],[Ee.FOOTER,R.FOOTER],[Ee.FOREIGN_OBJECT,R.FOREIGN_OBJECT],[Ee.FORM,R.FORM],[Ee.FRAME,R.FRAME],[Ee.FRAMESET,R.FRAMESET],[Ee.H1,R.H1],[Ee.H2,R.H2],[Ee.H3,R.H3],[Ee.H4,R.H4],[Ee.H5,R.H5],[Ee.H6,R.H6],[Ee.HEAD,R.HEAD],[Ee.HEADER,R.HEADER],[Ee.HGROUP,R.HGROUP],[Ee.HR,R.HR],[Ee.HTML,R.HTML],[Ee.I,R.I],[Ee.IMG,R.IMG],[Ee.IMAGE,R.IMAGE],[Ee.INPUT,R.INPUT],[Ee.IFRAME,R.IFRAME],[Ee.KEYGEN,R.KEYGEN],[Ee.LABEL,R.LABEL],[Ee.LI,R.LI],[Ee.LINK,R.LINK],[Ee.LISTING,R.LISTING],[Ee.MAIN,R.MAIN],[Ee.MALIGNMARK,R.MALIGNMARK],[Ee.MARQUEE,R.MARQUEE],[Ee.MATH,R.MATH],[Ee.MENU,R.MENU],[Ee.META,R.META],[Ee.MGLYPH,R.MGLYPH],[Ee.MI,R.MI],[Ee.MO,R.MO],[Ee.MN,R.MN],[Ee.MS,R.MS],[Ee.MTEXT,R.MTEXT],[Ee.NAV,R.NAV],[Ee.NOBR,R.NOBR],[Ee.NOFRAMES,R.NOFRAMES],[Ee.NOEMBED,R.NOEMBED],[Ee.NOSCRIPT,R.NOSCRIPT],[Ee.OBJECT,R.OBJECT],[Ee.OL,R.OL],[Ee.OPTGROUP,R.OPTGROUP],[Ee.OPTION,R.OPTION],[Ee.P,R.P],[Ee.PARAM,R.PARAM],[Ee.PLAINTEXT,R.PLAINTEXT],[Ee.PRE,R.PRE],[Ee.RB,R.RB],[Ee.RP,R.RP],[Ee.RT,R.RT],[Ee.RTC,R.RTC],[Ee.RUBY,R.RUBY],[Ee.S,R.S],[Ee.SCRIPT,R.SCRIPT],[Ee.SEARCH,R.SEARCH],[Ee.SECTION,R.SECTION],[Ee.SELECT,R.SELECT],[Ee.SOURCE,R.SOURCE],[Ee.SMALL,R.SMALL],[Ee.SPAN,R.SPAN],[Ee.STRIKE,R.STRIKE],[Ee.STRONG,R.STRONG],[Ee.STYLE,R.STYLE],[Ee.SUB,R.SUB],[Ee.SUMMARY,R.SUM
vendor: 107,550 bytes, line 147
147MARY],[Ee.SUP,R.SUP],[Ee.TABLE,R.TABLE],[Ee.TBODY,R.TBODY],[Ee.TEMPLATE,R.TEMPLATE],[Ee.TEXTAREA,R.TEXTAREA],[Ee.TFOOT,R.TFOOT],[Ee.TD,R.TD],[Ee.TH,R.TH],[Ee.THEAD,R.THEAD],[Ee.TITLE,R.TITLE],[Ee.TR,R.TR],[Ee.TRACK,R.TRACK],[Ee.TT,R.TT],[Ee.U,R.U],[Ee.UL,R.UL],[Ee.SVG,R.SVG],[Ee.VAR,R.VAR],[Ee.WBR,R.WBR],[Ee.XMP,R.XMP]]);function Wf(e){var t;return(t=xRe.get(e))!==null&&t!==void 0?t:R.UNKNOWN}const ht=R,bRe={[nt.HTML]:new Set([ht.ADDRESS,ht.APPLET,ht.AREA,ht.ARTICLE,ht.ASIDE,ht.BASE,ht.BASEFONT,ht.BGSOUND,ht.BLOCKQUOTE,ht.BODY,ht.BR,ht.BUTTON,ht.CAPTION,ht.CENTER,ht.COL,ht.COLGROUP,ht.DD,ht.DETAILS,ht.DIR,ht.DIV,ht.DL,ht.DT,ht.EMBED,ht.FIELDSET,ht.FIGCAPTION,ht.FIGURE,ht.FOOTER,ht.FORM,ht.FRAME,ht.FRAMESET,ht.H1,ht.H2,ht.H3,ht.H4,ht.H5,ht.H6,ht.HEAD,ht.HEADER,ht.HGROUP,ht.HR,ht.HTML,ht.IFRAME,ht.IMG,ht.INPUT,ht.LI,ht.LINK,ht.LISTING,ht.MAIN,ht.MARQUEE,ht.MENU,ht.META,ht.NAV,ht.NOEMBED,ht.NOFRAMES,ht.NOSCRIPT,ht.OBJECT,ht.OL,ht.P,ht.PARAM,ht.PLAINTEXT,ht.PRE,ht.SCRIPT,ht.SECTION,ht.SELECT,ht.SOURCE,ht.STYLE,ht.SUMMARY,ht.TABLE,ht.TBODY,ht.TD,ht.TEMPLATE,ht.TEXTAREA,ht.TFOOT,ht.TH,ht.THEAD,ht.TITLE,ht.TR,ht.TRACK,ht.UL,ht.WBR,ht.XMP]),[nt.MATHML]:new Set([ht.MI,ht.MO,ht.MN,ht.MS,ht.MTEXT,ht.ANNOTATION_XML]),[nt.SVG]:new Set([ht.TITLE,ht.FOREIGN_OBJECT,ht.DESC]),[nt.XLINK]:new Set,[nt.XML]:new Set,[nt.XMLNS]:new Set},r3=new Set([ht.H1,ht.H2,ht.H3,ht.H4,ht.H5,ht.H6]);Ee.STYLE,Ee.SCRIPT,Ee.XMP,Ee.IFRAME,Ee.NOEMBED,Ee.NOFRAMES,Ee.PLAINTEXT;var de;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(de||(de={}));const ir={DATA:de.DATA,RCDATA:de.RCDATA,RAWTEXT:de.RAWTEXT,SCRIPT_DATA:de.SCRIPT_DATA,PLAINTEXT:de.PLAINTEXT,CDATA_SECTION:de.CDATA_SECTION};function yRe(e){return e>=ie.DIGIT_0&&e<=ie.DIGIT_9}function lx(e){return e>=ie.LATIN_CAPITAL_A&&e<=ie.LATIN_CAPITAL_Z}function vRe(e){return e>=ie.LATIN_SMALL_A&&e<=ie.LATIN_SMALL_Z}function Hc(e){return vRe(e)||lx(e)}function W$(e){return Hc(e)||yRe(e)}function Hy(e){return e+32}function KQ(e){return e===ie.SPACE||e===ie.LINE_FEED||e===ie.TABULATION||e===ie.FORM_FEED}function V$(e){return KQ(e)||e===ie.SOLIDUS||e===ie.GREATER_THAN_SIGN}function wRe(e){return e===ie.NULL?Fe.nullCharacterReference:e>1114111?Fe.characterReferenceOutsideUnicodeRange:WQ(e)?Fe.surrogateCharacterReference:GQ(e)?Fe.noncharacterCharacterReference:VQ(e)||e===ie.CARRIAGE_RETURN?Fe.controlCharacterReference:null}class jRe{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=de.DATA,this.returnState=de.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new oRe(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new fRe(lRe,(r,a)=>{this.preprocessor.pos=this.entityStartPos+a-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(Fe.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(Fe.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const a=wRe(r);a&&this._err(a,1)}}:void 0)}_err(t,n=0){var r,a;(a=(r=this.handler).onParseError)===null||a===void 0||a.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t?.())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n<t;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,n){return this.preprocessor.startsWith(t,n)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:Rs.START_TAG,tagName:"",tagID:R.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:Rs.END_TAG,tagName:"",tagID:R.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:Rs.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:Rs.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,n){this.currentCharacterToken={type:t,chars:n,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,n;const r=this.currentToken;if(YQ(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const a=(t=(n=r.location).attrs)!==null&&t!==void 0?t:n.attrs=Object.create(null);a[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(Fe.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const t=this.currentToken;this.prepareToken(t),t.tagID=Wf(t.tagName),t.type===Rs.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(Fe.endTagWithAttributes),t.selfClosing&&this._err(Fe.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Rs.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Rs.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Rs.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Rs.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=KQ(t)?Rs.WHITESPACE_CHARACTER:t===ie.NULL?Rs.NULL_CHARACTER:Rs.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Rs.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=de.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Jl.Attribute:Jl.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===de.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===de.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===de.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case de.DATA:{this._stateData(t);break}case de.RCDATA:{this._stateRcdata(t);break}case de.RAWTEXT:{this._stateRawtext(t);break}case de.SCRIPT_DATA:{this._stateScriptData(t);break}case de.PLAINTEXT:{this._statePlaintext(t);break}case de.TAG_OPEN:{this._stateTagOpen(t);break}case de.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case de.TAG_NAME:{this._stateTagName(t);break}case de.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case de.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case de.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case de.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case de.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case de.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case de.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case de.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case de.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case de.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case de.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case de.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case de.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case de.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case de.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case de.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case de.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case de.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case de.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case de.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case de.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case de.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case de.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case de.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case de.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case de.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case de.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case de.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case de.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case de.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case de.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case de.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case de.BOGUS_COMMENT:{this._stateBogusComment(t);break}case de.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case de.COMMENT_START:{this._stateCommentStart(t);break}case de.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case de.COMMENT:{this._stateComment(t);break}case de.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case de.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case de.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case de.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case de.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case de.COMMENT_END:{this._stateCommentEnd(t);break}case de.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case de.DOCTYPE:{this._stateDoctype(t);break}case de.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case de.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case de.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case de.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case de.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case de.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case de.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case de.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case de.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case de.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case de.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case de.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case de.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case de.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case de.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case de.CDATA_SECTION:{this._stateCdataSection(t);break}case de.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case de.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case de.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case de.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case ie.LESS_THAN_SIGN:{this.state=de.TAG_OPEN;break}case ie.AMPERSAND:{this._startCharacterReference();break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this._emitCodePoint(t);break}case ie.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case ie.AMPERSAND:{this._startCharacterReference();break}case ie.LESS_THAN_SIGN:{this.state=de.RCDATA_LESS_THAN_SIGN;break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this._emitChars(Bn);break}case ie.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case ie.LESS_THAN_SIGN:{this.state=de.RAWTEXT_LESS_THAN_SIGN;break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this._emitChars(Bn);break}case ie.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case ie.LESS_THAN_SIGN:{this.state=de.SCRIPT_DATA_LESS_THAN_SIGN;break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this._emitChars(Bn);break}case ie.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this._emitChars(Bn);break}case ie.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Hc(t))this._createStartTagToken(),this.state=de.TAG_NAME,this._stateTagName(t);else switch(t){case ie.EXCLAMATION_MARK:{this.state=de.MARKUP_DECLARATION_OPEN;break}case ie.SOLIDUS:{this.state=de.END_TAG_OPEN;break}case ie.QUESTION_MARK:{this._err(Fe.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=de.BOGUS_COMMENT,this._stateBogusComment(t);break}case ie.EOF:{this._err(Fe.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(Fe.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=de.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Hc(t))this._createEndTagToken(),this.state=de.TAG_NAME,this._stateTagName(t);else switch(t){case ie.GREATER_THAN_SIGN:{this._err(Fe.missingEndTagName),this.state=de.DATA;break}case ie.EOF:{this._err(Fe.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(Fe.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=de.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const n=this.currentToken;switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:{this.state=de.BEFORE_ATTRIBUTE_NAME;break}case ie.SOLIDUS:{this.state=de.SELF_CLOSING_START_TAG;break}case ie.GREATER_THAN_SIGN:{this.state=de.DATA,this.emitCurrentTagToken();break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),n.tagName+=Bn;break}case ie.EOF:{this._err(Fe.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(lx(t)?Hy(t):t)}}_stateRcdataLessThanSign(t){t===ie.SOLIDUS?this.state=de.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=de.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){Hc(t)?(this.state=de.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=de.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=de.BEFORE_ATTRIBUTE_NAME,!1;case ie.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=de.SELF_CLOSING_START_TAG,!1;case ie.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=de.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=de.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===ie.SOLIDUS?this.state=de.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=de.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){Hc(t)?(this.state=de.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=de.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=de.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case ie.SOLIDUS:{this.state=de.SCRIPT_DATA_END_TAG_OPEN;break}case ie.EXCLAMATION_MARK:{this.state=de.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=de.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){Hc(t)?(this.state=de.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=de.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=de.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===ie.HYPHEN_MINUS?(this.state=de.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=de.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===ie.HYPHEN_MINUS?(this.state=de.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=de.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case ie.HYPHEN_MINUS:{this.state=de.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case ie.LESS_THAN_SIGN:{this.state=de.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this._emitChars(Bn);break}case ie.EOF:{this._err(Fe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case ie.HYPHEN_MINUS:{this.state=de.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case ie.LESS_THAN_SIGN:{this.state=de.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this.state=de.SCRIPT_DATA_ESCAPED,this._emitChars(Bn);break}case ie.EOF:{this._err(Fe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=de.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case ie.HYPHEN_MINUS:{this._emitChars("-");break}case ie.LESS_THAN_SIGN:{this.state=de.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case ie.GREATER_THAN_SIGN:{this.state=de.SCRIPT_DATA,this._emitChars(">");break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this.state=de.SCRIPT_DATA_ESCAPED,this._emitChars(Bn);break}case ie.EOF:{this._err(Fe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=de.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===ie.SOLIDUS?this.state=de.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Hc(t)?(this._emitChars("<"),this.state=de.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=de.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Hc(t)?(this.state=de.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=de.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=de.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(Ya.SCRIPT,!1)&&V$(this.preprocessor.peek(Ya.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Ya.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=de.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case ie.HYPHEN_MINUS:{this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case ie.LESS_THAN_SIGN:{this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this._emitChars(Bn);break}case ie.EOF:{this._err(Fe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case ie.HYPHEN_MINUS:{this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case ie.LESS_THAN_SIGN:{this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Bn);break}case ie.EOF:{this._err(Fe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case ie.HYPHEN_MINUS:{this._emitChars("-");break}case ie.LESS_THAN_SIGN:{this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case ie.GREATER_THAN_SIGN:{this.state=de.SCRIPT_DATA,this._emitChars(">");break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Bn);break}case ie.EOF:{this._err(Fe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===ie.SOLIDUS?(this.state=de.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Ya.SCRIPT,!1)&&V$(this.preprocessor.peek(Ya.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Ya.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=de.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=de.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:break;case ie.SOLIDUS:case ie.GREATER_THAN_SIGN:case ie.EOF:{this.state=de.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case ie.EQUALS_SIGN:{this._err(Fe.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=de.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=de.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:case ie.SOLIDUS:case ie.GREATER_THAN_SIGN:case ie.EOF:{this._leaveAttrName(),this.state=de.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case ie.EQUALS_SIGN:{this._leaveAttrName(),this.state=de.BEFORE_ATTRIBUTE_VALUE;break}case ie.QUOTATION_MARK:case ie.APOSTROPHE:case ie.LESS_THAN_SIGN:{this._err(Fe.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this.currentAttr.name+=Bn;break}default:this.currentAttr.name+=String.fromCodePoint(lx(t)?Hy(t):t)}}_stateAfterAttributeName(t){switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:break;case ie.SOLIDUS:{this.state=de.SELF_CLOSING_START_TAG;break}case ie.EQUALS_SIGN:{this.state=de.BEFORE_ATTRIBUTE_VALUE;break}case ie.GREATER_THAN_SIGN:{this.state=de.DATA,this.emitCurrentTagToken();break}case ie.EOF:{this._err(Fe.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=de.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:break;case ie.QUOTATION_MARK:{this.state=de.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case ie.APOSTROPHE:{this.state=de.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.missingAttributeValue),this.state=de.DATA,this.emitCurrentTagToken();break}default:this.state=de.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case ie.QUOTATION_MARK:{this.state=de.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case ie.AMPERSAND:{this._startCharacterReference();break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this.currentAttr.value+=Bn;break}case ie.EOF:{this._err(Fe.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case ie.APOSTROPHE:{this.state=de.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case ie.AMPERSAND:{this._startCharacterReference();break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this.currentAttr.value+=Bn;break}case ie.EOF:{this._err(Fe.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:{this._leaveAttrValue(),this.state=de.BEFORE_ATTRIBUTE_NAME;break}case ie.AMPERSAND:{this._startCharacterReference();break}case ie.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=de.DATA,this.emitCurrentTagToken();break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this.currentAttr.value+=Bn;break}case ie.QUOTATION_MARK:case ie.APOSTROPHE:case ie.LESS_THAN_SIGN:case ie.EQUALS_SIGN:case ie.GRAVE_ACCENT:{this._err(Fe.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case ie.EOF:{this._err(Fe.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:{this._leaveAttrValue(),this.state=de.BEFORE_ATTRIBUTE_NAME;break}case ie.SOLIDUS:{this._leaveAttrValue(),this.state=de.SELF_CLOSING_START_TAG;break}case ie.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=de.DATA,this.emitCurrentTagToken();break}case ie.EOF:{this._err(Fe.eofInTag),this._emitEOFToken();break}default:this._err(Fe.missingWhitespaceBetweenAttributes),this.state=de.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case ie.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=de.DATA,this.emitCurrentTagToken();break}case ie.EOF:{this._err(Fe.eofInTag),this._emitEOFToken();break}default:this._err(Fe.unexpectedSolidusInTag),this.state=de.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const n=this.currentToken;switch(t){case ie.GREATER_THAN_SIGN:{this.state=de.DATA,this.emitCurrentComment(n);break}case ie.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),n.data+=Bn;break}default:n.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(Ya.DASH_DASH,!0)?(this._createCommentToken(Ya.DASH_DASH.length+1),this.state=de.COMMENT_START):this._consumeSequenceIfMatch(Ya.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(Ya.DOCTYPE.length+1),this.state=de.DOCTYPE):this._consumeSequenceIfMatch(Ya.CDATA_START,!0)?this.inForeignNode?this.state=de.CDATA_SECTION:(this._err(Fe.cdataInHtmlContent),this._createCommentToken(Ya.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=de.BOGUS_COMMENT):this._ensureHibernation()||(this._err(Fe.incorrectlyOpenedComment),this._createCommentToken(2),this.state=de.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case ie.HYPHEN_MINUS:{this.state=de.COMMENT_START_DASH;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.abruptClosingOfEmptyComment),this.state=de.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=de.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const n=this.currentToken;switch(t){case ie.HYPHEN_MINUS:{this.state=de.COMMENT_END;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.abruptClosingOfEmptyComment),this.state=de.DATA,this.emitCurrentComment(n);break}case ie.EOF:{this._err(Fe.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=de.COMMENT,this._stateComment(t)}}_stateComment(t){const n=this.currentToken;switch(t){case ie.HYPHEN_MINUS:{this.state=de.COMMENT_END_DASH;break}case ie.LESS_THAN_SIGN:{n.data+="<",this.state=de.COMMENT_LESS_THAN_SIGN;break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),n.data+=Bn;break}case ie.EOF:{this._err(Fe.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const n=this.currentToken;switch(t){case ie.EXCLAMATION_MARK:{n.data+="!",this.state=de.COMMENT_LESS_THAN_SIGN_BANG;break}case ie.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=de.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===ie.HYPHEN_MINUS?this.state=de.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=de.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===ie.HYPHEN_MINUS?this.state=de.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=de.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==ie.GREATER_THAN_SIGN&&t!==ie.EOF&&this._err(Fe.nestedComment),this.state=de.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const n=this.currentToken;switch(t){case ie.HYPHEN_MINUS:{this.state=de.COMMENT_END;break}case ie.EOF:{this._err(Fe.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=de.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const n=this.currentToken;switch(t){case ie.GREATER_THAN_SIGN:{this.state=de.DATA,this.emitCurrentComment(n);break}case ie.EXCLAMATION_MARK:{this.state=de.COMMENT_END_BANG;break}case ie.HYPHEN_MINUS:{n.data+="-";break}case ie.EOF:{this._err(Fe.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=de.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const n=this.currentToken;switch(t){case ie.HYPHEN_MINUS:{n.data+="--!",this.state=de.COMMENT_END_DASH;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.incorrectlyClosedComment),this.state=de.DATA,this.emitCurrentComment(n);break}case ie.EOF:{this._err(Fe.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=de.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:{this.state=de.BEFORE_DOCTYPE_NAME;break}case ie.GREATER_THAN_SIGN:{this.state=de.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case ie.EOF:{this._err(Fe.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Fe.missingWhitespaceBeforeDoctypeName),this.state=de.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(lx(t))this._createDoctypeToken(String.fromCharCode(Hy(t))),this.state=de.DOCTYPE_NAME;else switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:break;case ie.NULL:{this._err(Fe.unexpectedNullCharacter),this._createDoctypeToken(Bn),this.state=de.DOCTYPE_NAME;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=de.DATA;break}case ie.EOF:{this._err(Fe.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=de.DOCTYPE_NAME}}_stateDoctypeName(t){const n=this.currentToken;switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:{this.state=de.AFTER_DOCTYPE_NAME;break}case ie.GREATER_THAN_SIGN:{this.state=de.DATA,this.emitCurrentDoctype(n);break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),n.name+=Bn;break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(lx(t)?Hy(t):t)}}_stateAfterDoctypeName(t){const n=this.currentToken;switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:break;case ie.GREATER_THAN_SIGN:{this.state=de.DATA,this.emitCurrentDoctype(n);break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(Ya.PUBLIC,!1)?this.state=de.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(Ya.SYSTEM,!1)?this.state=de.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(Fe.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=de.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const n=this.currentToken;switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:{this.state=de.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case ie.QUOTATION_MARK:{this._err(Fe.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=de.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case ie.APOSTROPHE:{this._err(Fe.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=de.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=de.DATA,this.emitCurrentDoctype(n);break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Fe.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=de.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:break;case ie.QUOTATION_MARK:{n.publicId="",this.state=de.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case ie.APOSTROPHE:{n.publicId="",this.state=de.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=de.DATA,this.emitCurrentDoctype(n);break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Fe.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=de.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case ie.QUOTATION_MARK:{this.state=de.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),n.publicId+=Bn;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=de.DATA;break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case ie.APOSTROPHE:{this.state=de.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),n.publicId+=Bn;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=de.DATA;break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:{this.state=de.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case ie.GREATER_THAN_SIGN:{this.state=de.DATA,this.emitCurrentDoctype(n);break}case ie.QUOTATION_MARK:{this._err(Fe.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=de.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case ie.APOSTROPHE:{this._err(Fe.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=de.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Fe.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=de.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const n=this.currentToken;switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:break;case ie.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=de.DATA;break}case ie.QUOTATION_MARK:{n.systemId="",this.state=de.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case ie.APOSTROPHE:{n.systemId="",this.state=de.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Fe.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=de.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const n=this.currentToken;switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:{this.state=de.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case ie.QUOTATION_MARK:{this._err(Fe.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=de.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case ie.APOSTROPHE:{this._err(Fe.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=de.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=de.DATA,this.emitCurrentDoctype(n);break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Fe.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=de.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:break;case ie.QUOTATION_MARK:{n.systemId="",this.state=de.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case ie.APOSTROPHE:{n.systemId="",this.state=de.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=de.DATA,this.emitCurrentDoctype(n);break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Fe.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=de.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case ie.QUOTATION_MARK:{this.state=de.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),n.systemId+=Bn;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=de.DATA;break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case ie.APOSTROPHE:{this.state=de.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter),n.systemId+=Bn;break}case ie.GREATER_THAN_SIGN:{this._err(Fe.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=de.DATA;break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case ie.SPACE:case ie.LINE_FEED:case ie.TABULATION:case ie.FORM_FEED:break;case ie.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=de.DATA;break}case ie.EOF:{this._err(Fe.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Fe.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=de.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const n=this.currentToken;switch(t){case ie.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=de.DATA;break}case ie.NULL:{this._err(Fe.unexpectedNullCharacter);break}case ie.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case ie.RIGHT_SQUARE_BRACKET:{this.state=de.CDATA_SECTION_BRACKET;break}case ie.EOF:{this._err(Fe.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===ie.RIGHT_SQUARE_BRACKET?this.state=de.CDATA_SECTION_END:(this._emitChars("]"),this.state=de.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case ie.GREATER_THAN_SIGN:{this.state=de.DATA;break}case ie.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=de.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}t===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(ie.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&W$(this.preprocessor.peek(1))?de.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){W$(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===ie.SEMICOLON&&this._err(Fe.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const XQ=new Set([R.DD,R.DT,R.LI,R.OPTGROUP,R.OPTION,R.P,R.RB,R.RP,R.RT,R.RTC]),G$=new Set([...XQ,R.CAPTION,R.COLGROUP,R.TBODY,R.TD,R.TFOOT,R.TH,R.THEAD,R.TR]),oj=new Set([R.APPLET,R.CAPTION,R.HTML,R.MARQUEE,R.OBJECT,R.TABLE,R.TD,R.TEMPLATE,R.TH]),_Re=new Set([...oj,R.OL,R.UL]),kRe=new Set([...oj,R.BUTTON]),Y$=new Set([R.ANNOTATION_XML,R.MI,R.MN,R.MO,R.MS,R.MTEXT]),K$=new Set([R.DESC,R.FOREIGN_OBJECT,R.TITLE]),NRe=new Set([R.TR,R.TEMPLATE,R.HTML]),ERe=new Set([R.TBODY,R.TFOOT,R.THEAD,R.TEMPLATE,R.HTML]),SRe=new Set([R.TABLE,R.TEMPLATE,R.HTML]),CRe=new Set([R.TD,R.TH]);class TRe{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=R.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===R.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===nt.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,n){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,n,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const a=this._indexOf(t)+1;this.items.splice(a,0,n),this.tagIDs.splice(a,0,r),this.stackTop++,a===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,a===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==nt.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<t)}}popUntilElementPopped(t){const n=this._indexOf(t);this.shortenToLength(Math.max(n,0))}popUntilPopped(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(r3,nt.HTML)}popUntilTableCellPopped(){this.popUntilPopped(CRe,nt.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,n){for(let r=this.stackTop;r>=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(SRe,nt.HTML)}clearBackToTableBodyContext(){this.clearBackTo(ERe,nt.HTML)}clearBackToTableRowContext(){this.clearBackTo(NRe,nt.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===R.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===R.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const a=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case nt.HTML:{if(a===t)return!0;if(n.has(a))return!1;break}case nt.SVG:{if(K$.has(a))return!1;break}case nt.MATHML:{if(Y$.has(a))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,oj)}hasInListItemScope(t){return this.hasInDynamicScope(t,_Re)}hasInButtonScope(t){return this.hasInDynamicScope(t,kRe)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case nt.HTML:{if(r3.has(n))return!0;if(oj.has(n))return!1;break}case nt.SVG:{if(K$.has(n))return!1;break}case nt.MATHML:{if(Y$.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===nt.HTML)switch(this.tagIDs[n]){case t:return!0;case R.TABLE:case R.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===nt.HTML)switch(this.tagIDs[t]){case R.TBODY:case R.THEAD:case R.TFOOT:return!0;case R.TABLE:case R.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===nt.HTML)switch(this.tagIDs[n]){case t:return!0;case R.OPTION:case R.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&XQ.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&G$.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&G$.has(this.currentTagId);)this.pop()}}const ZN=3;var Jo;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Jo||(Jo={}));const X$={type:Jo.Marker};class ARe{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],a=n.length,i=this.treeAdapter.getTagName(t),o=this.treeAdapter.getNamespaceURI(t);for(let l=0;l<this.entries.length;l++){const c=this.entries[l];if(c.type===Jo.Marker)break;const{element:u}=c;if(this.treeAdapter.getTagName(u)===i&&this.treeAdapter.getNamespaceURI(u)===o){const d=this.treeAdapter.getAttrList(u);d.length===a&&r.push({idx:l,attrs:d})}}return r}_ensureNoahArkCondition(t){if(this.entries.length<ZN)return;const n=this.treeAdapter.getAttrList(t),r=this._getNoahArkConditionCandidates(t,n);if(r.length<ZN)return;const a=new Map(n.map(o=>[o.name,o.value]));let i=0;for(let o=0;o<r.length;o++){const l=r[o];l.attrs.every(c=>a.get(c.name)===c.value)&&(i+=1,i>=ZN&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(X$)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:Jo.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Jo.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(X$);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===Jo.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===Jo.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===Jo.Element&&n.element===t)}}const qc={createDocument(){return{nodeName:"#document",mode:Fi.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const a=e.childNodes.find(i=>i.nodeName==="#documentType");if(a)a.name=t,a.publicId=n,a.systemId=r;else{const i={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};qc.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(qc.isTextNode(n)){n.value+=t;return}}qc.appendChild(e,qc.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&qc.isTextNode(r)?r.value+=t:qc.insertBefore(e,qc.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName==="#text"},isCommentNode(e){return e.nodeName==="#comment"},isDocumentTypeNode(e){return e.nodeName==="#documentType"},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,"tagName")},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},JQ="html",RRe="about:legacy-compat",IRe="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",QQ=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],PRe=[...QQ,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],LRe=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),ZQ=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],ORe=[...ZQ,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function J$(e,t){return t.some(n=>e.startsWith(n))}function MRe(e){return e.name===JQ&&e.publicId===null&&(e.systemId===null||e.systemId===RRe)}function DRe(e){if(e.name!==JQ)return Fi.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===IRe)return Fi.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),LRe.has(n))return Fi.QUIRKS;let r=t===null?PRe:QQ;if(J$(n,r))return Fi.QUIRKS;if(r=t===null?ZQ:ORe,J$(n,r))return Fi.LIMITED_QUIRKS}return Fi.NO_QUIRKS}const Q$={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},$Re="definitionurl",FRe="definitionURL",BRe=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),URe=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:nt.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:nt.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:nt.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:nt.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:nt.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:nt.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:nt.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:nt.XML}],["xml:space",{prefix:"xml",name:"space",namespace:nt.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:nt.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:nt.XMLNS}]]),zRe=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),HRe=new Set([R.B,R.BIG,R.BLOCKQUOTE,R.BODY,R.BR,R.CENTER,R.CODE,R.DD,R.DIV,R.DL,R.DT,R.EM,R.EMBED,R.H1,R.H2,R.H3,R.H4,R.H5,R.H6,R.HEAD,R.HR,R.I,R.IMG,R.LI,R.LISTING,R.MENU,R.META,R.NOBR,R.OL,R.P,R.PRE,R.RUBY,R.S,R.SMALL,R.SPAN,R.STRONG,R.STRIKE,R.SUB,R.SUP,R.TABLE,R.TT,R.U,R.UL,R.VAR]);function qRe(e){const t=e.tagID;return t===R.FONT&&e.attrs.some(({name:r})=>r===mh.COLOR||r===mh.SIZE||r===mh.FACE)||HRe.has(t)}function eZ(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===$Re){e.attrs[t].name=FRe;break}}function tZ(e){for(let t=0;t<e.attrs.length;t++){const n=BRe.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function AI(e){for(let t=0;t<e.attrs.length;t++){const n=URe.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function WRe(e){const t=zRe.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Wf(e.tagName))}function VRe(e,t){return t===nt.MATHML&&(e===R.MI||e===R.MO||e===R.MN||e===R.MS||e===R.MTEXT)}function GRe(e,t,n){if(t===nt.MATHML&&e===R.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===mh.ENCODING){const a=n[r].value.toLowerCase();return a===Q$.TEXT_HTML||a===Q$.APPLICATION_XML}}return t===nt.SVG&&(e===R.FOREIGN_OBJECT||e===R.DESC||e===R.TITLE)}function YRe(e,t,n,r){return(!r||r===nt.HTML)&&GRe(e,t,n)||(!r||r===nt.MATHML)&&VRe(e,t)}const KRe="hidden",XRe=8,JRe=3;var fe;(function(e){e[e.INITIAL=0]="INITIAL",e[e.BEFORE_HTML=1]="BEFORE_HTML",e[e.BEFORE_HEAD=2]="BEFORE_HEAD",e[e.IN_HEAD=3]="IN_HEAD",e[e.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",e[e.AFTER_HEAD=5]="AFTER_HEAD",e[e.IN_BODY=6]="IN_BODY",e[e.TEXT=7]="TEXT",e[e.IN_TABLE=8]="IN_TABLE",e[e.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",e[e.IN_CAPTION=10]="IN_CAPTION",e[e.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",e[e.IN_TABLE_BODY=12]="IN_TABLE_BODY",e[e.IN_ROW=13]="IN_ROW",e[e.IN_CELL=14]="IN_CELL",e[e.IN_SELECT=15]="IN_SELECT",e[e.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",e[e.IN_TEMPLATE=17]="IN_TEMPLATE",e[e.AFTER_BODY=18]="AFTER_BODY",e[e.IN_FRAMESET=19]="IN_FRAMESET",e[e.AFTER_FRAMESET=20]="AFTER_FRAMESET",e[e.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",e[e.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(fe||(fe={}));const QRe={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},sZ=new Set([R.TABLE,R.TBODY,R.TFOOT,R.THEAD,R.TR]),Z$={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:qc,onParseError:null};class eF{constructor(t,n,r=null,a=null){this.fragmentContext=r,this.scriptHandler=a,this.currentToken=null,this.stopped=!1,this.insertionMode=fe.INITIAL,this.originalInsertionMode=fe.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...Z$,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new jRe(this.options,this),this.activeFormattingElements=new ARe(this.treeAdapter),this.fragmentContextID=r?Wf(this.treeAdapter.getTagName(r)):R.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new TRe(this.document,this.treeAdapter,this)}static parse(t,n){const r=new this(n);return r.tokenizer.write(t,!0),r.document}static getFragmentParser(t,n){const r={...Z$,...n};t??(t=r.treeAdapter.createElement(Ee.TEMPLATE,nt.HTML,[]));const a=r.treeAdapter.createElement("documentmock",nt.HTML,[]),i=new this(r,a,t);return i.fragmentContextID===R.TEMPLATE&&i.tmplInsertionModeStack.unshift(fe.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,n),n}_err(t,n,r){var a;if(!this.onParseError)return;const i=(a=t.location)!==null&&a!==void 0?a:QRe,o={code:n,startLine:i.startLine,startCol:i.startCol,startOffset:i.startOffset,endLine:r?i.startLine:i.endLine,endCol:r?i.startCol:i.endCol,endOffset:r?i.startOffset:i.endOffset};this.onParseError(o)}onItemPush(t,n,r){var a,i;(i=(a=this.treeAdapter).onItemPush)===null||i===void 0||i.call(a,t),r&&this.openElements.stackTop>0&&this._setContextModes(t,n)}onItemPop(t,n){var r,a;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(a=(r=this.treeAdapter).onItemPop)===null||a===void 0||a.call(r,t,this.openElements.current),n){let i,o;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,o=this.fragmentContextID):{current:i,currentTagId:o}=this.openElements,this._setContextModes(i,o)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===nt.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,nt.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=fe.TEXT}switchToPlaintextParsing(){this.insertionMode=fe.TEXT,this.originalInsertionMode=fe.IN_BODY,this.tokenizer.state=ir.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===Ee.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==nt.HTML))switch(this.fragmentContextID){case R.TITLE:case R.TEXTAREA:{this.tokenizer.state=ir.RCDATA;break}case R.STYLE:case R.XMP:case R.IFRAME:case R.NOEMBED:case R.NOFRAMES:case R.NOSCRIPT:{this.tokenizer.state=ir.RAWTEXT;break}case R.SCRIPT:{this.tokenizer.state=ir.SCRIPT_DATA;break}case R.PLAINTEXT:{this.tokenizer.state=ir.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",a=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,a),t.location){const o=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));o&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,nt.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,nt.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(Ee.HTML,nt.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,R.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const a=this.treeAdapter.getChildNodes(n),i=r?a.lastIndexOf(r):a.length,o=a[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,a=this.treeAdapter.getTagName(t),i=n.type===Rs.END_TAG&&a===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,i)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===R.SVG&&this.treeAdapter.getTagName(n)===Ee.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===nt.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===R.MGLYPH||t.tagID===R.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,nt.HTML)}_processToken(t){switch(t.type){case Rs.CHARACTER:{this.onCharacter(t);break}case Rs.NULL_CHARACTER:{this.onNullCharacter(t);break}case Rs.COMMENT:{this.onComment(t);break}case Rs.DOCTYPE:{this.onDoctype(t);break}case Rs.START_TAG:{this._processStartTag(t);break}case Rs.END_TAG:{this.onEndTag(t);break}case Rs.EOF:{this.onEof(t);break}case Rs.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const a=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return YRe(t,a,i,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(a=>a.type===Jo.Marker||this.openElements.contains(a.element)),r=n===-1?t-1:n-1;for(let a=r;a>=0;a--){const i=this.activeFormattingElements.entries[a];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=fe.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(R.P),this.openElements.popUntilTagNamePopped(R.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case R.TR:{this.insertionMode=fe.IN_ROW;return}case R.TBODY:case R.THEAD:case R.TFOOT:{this.insertionMode=fe.IN_TABLE_BODY;return}case R.CAPTION:{this.insertionMode=fe.IN_CAPTION;return}case R.COLGROUP:{this.insertionMode=fe.IN_COLUMN_GROUP;return}case R.TABLE:{this.insertionMode=fe.IN_TABLE;return}case R.BODY:{this.insertionMode=fe.IN_BODY;return}case R.FRAMESET:{this.insertionMode=fe.IN_FRAMESET;return}case R.SELECT:{this._resetInsertionModeForSelect(t);return}case R.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case R.HTML:{this.insertionMode=this.headElement?fe.AFTER_HEAD:fe.BEFORE_HEAD;return}case R.TD:case R.TH:{if(t>0){this.insertionMode=fe.IN_CELL;return}break}case R.HEAD:{if(t>0){this.insertionMode=fe.IN_HEAD;return}break}}this.insertionMode=fe.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===R.TEMPLATE)break;if(r===R.TABLE){this.insertionMode=fe.IN_SELECT_IN_TABLE;return}}this.insertionMode=fe.IN_SELECT}_isElementCausesFosterParenting(t){return sZ.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case R.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===nt.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case R.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return bRe[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){CPe(this,t);return}switch(this.insertionMode){case fe.INITIAL:{Eg(this,t);break}case fe.BEFORE_HTML:{Fx(this,t);break}case fe.BEFORE_HEAD:{Bx(this,t);break}case fe.IN_HEAD:{Ux(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{zx(this,t);break}case fe.AFTER_HEAD:{Hx(this,t);break}case fe.IN_BODY:case fe.IN_CAPTION:case fe.IN_CELL:case fe.IN_TEMPLATE:{rZ(this,t);break}case fe.TEXT:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case fe.IN_TABLE:case fe.IN_TABLE_BODY:case fe.IN_ROW:{eE(this,t);break}case fe.IN_TABLE_TEXT:{uZ(this,t);break}case fe.IN_COLUMN_GROUP:{lj(this,t);break}case fe.AFTER_BODY:{cj(this,t);break}case fe.AFTER_AFTER_BODY:{N1(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){SPe(this,t);return}switch(this.insertionMode){case fe.INITIAL:{Eg(this,t);break}case fe.BEFORE_HTML:{Fx(this,t);break}case fe.BEFORE_HEAD:{Bx(this,t);break}case fe.IN_HEAD:{Ux(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{zx(this,t);break}case fe.AFTER_HEAD:{Hx(this,t);break}case fe.TEXT:{this._insertCharacters(t);break}case fe.IN_TABLE:case fe.IN_TABLE_BODY:case fe.IN_ROW:{eE(this,t);break}case fe.IN_COLUMN_GROUP:{lj(this,t);break}case fe.AFTER_BODY:{cj(this,t);break}case fe.AFTER_AFTER_BODY:{N1(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){a3(this,t);return}switch(this.insertionMode){case fe.INITIAL:case fe.BEFORE_HTML:case fe.BEFORE_HEAD:case fe.IN_HEAD:case fe.IN_HEAD_NO_SCRIPT:case fe.AFTER_HEAD:case fe.IN_BODY:case fe.IN_TABLE:case fe.IN_CAPTION:case fe.IN_COLUMN_GROUP:case fe.IN_TABLE_BODY:case fe.IN_ROW:case fe.IN_CELL:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:case fe.IN_TEMPLATE:case fe.IN_FRAMESET:case fe.AFTER_FRAMESET:{a3(this,t);break}case fe.IN_TABLE_TEXT:{Sg(this,t);break}case fe.AFTER_BODY:{aIe(this,t);break}case fe.AFTER_AFTER_BODY:case fe.AFTER_AFTER_FRAMESET:{iIe(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case fe.INITIAL:{oIe(this,t);break}case fe.BEFORE_HEAD:case fe.IN_HEAD:case fe.IN_HEAD_NO_SCRIPT:case fe.AFTER_HEAD:{this._err(t,Fe.misplacedDoctype);break}case fe.IN_TABLE_TEXT:{Sg(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,Fe.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?TPe(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case fe.INITIAL:{Eg(this,t);break}case fe.BEFORE_HTML:{lIe(this,t);break}case fe.BEFORE_HEAD:{uIe(this,t);break}case fe.IN_HEAD:{Io(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{pIe(this,t);break}case fe.AFTER_HEAD:{fIe(this,t);break}case fe.IN_BODY:{ka(this,t);break}case fe.IN_TABLE:{df(this,t);break}case fe.IN_TABLE_TEXT:{Sg(this,t);break}case fe.IN_CAPTION:{dPe(this,t);break}case fe.IN_COLUMN_GROUP:{PI(this,t);break}case fe.IN_TABLE_BODY:{mk(this,t);break}case fe.IN_ROW:{fk(this,t);break}case fe.IN_CELL:{mPe(this,t);break}case fe.IN_SELECT:{pZ(this,t);break}case fe.IN_SELECT_IN_TABLE:{gPe(this,t);break}case fe.IN_TEMPLATE:{bPe(this,t);break}case fe.AFTER_BODY:{vPe(this,t);break}case fe.IN_FRAMESET:{wPe(this,t);break}case fe.AFTER_FRAMESET:{_Pe(this,t);break}case fe.AFTER_AFTER_BODY:{NPe(this,t);break}case fe.AFTER_AFTER_FRAMESET:{EPe(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?APe(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case fe.INITIAL:{Eg(this,t);break}case fe.BEFORE_HTML:{cIe(this,t);break}case fe.BEFORE_HEAD:{dIe(this,t);break}case fe.IN_HEAD:{hIe(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{mIe(this,t);break}case fe.AFTER_HEAD:{gIe(this,t);break}case fe.IN_BODY:{pk(this,t);break}case fe.TEXT:{tPe(this,t);break}case fe.IN_TABLE:{Db(this,t);break}case fe.IN_TABLE_TEXT:{Sg(this,t);break}case fe.IN_CAPTION:{hPe(this,t);break}case fe.IN_COLUMN_GROUP:{pPe(this,t);break}case fe.IN_TABLE_BODY:{i3(this,t);break}case fe.IN_ROW:{hZ(this,t);break}case fe.IN_CELL:{fPe(this,t);break}case fe.IN_SELECT:{mZ(this,t);break}case fe.IN_SELECT_IN_TABLE:{xPe(this,t);break}case fe.IN_TEMPLATE:{yPe(this,t);break}case fe.AFTER_BODY:{gZ(this,t);break}case fe.IN_FRAMESET:{jPe(this,t);break}case fe.AFTER_FRAMESET:{kPe(this,t);break}case fe.AFTER_AFTER_BODY:{N1(this,t);break}}}onEof(t){switch(this.insertionMode){case fe.INITIAL:{Eg(this,t);break}case fe.BEFORE_HTML:{Fx(this,t);break}case fe.BEFORE_HEAD:{Bx(this,t);break}case fe.IN_HEAD:{Ux(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{zx(this,t);break}case fe.AFTER_HEAD:{Hx(this,t);break}case fe.IN_BODY:case fe.IN_TABLE:case fe.IN_CAPTION:case fe.IN_COLUMN_GROUP:case fe.IN_TABLE_BODY:case fe.IN_ROW:case fe.IN_CELL:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:{lZ(this,t);break}case fe.TEXT:{sPe(this,t);break}case fe.IN_TABLE_TEXT:{Sg(this,t);break}case fe.IN_TEMPLATE:{fZ(this,t);break}case fe.AFTER_BODY:case fe.IN_FRAMESET:case fe.AFTER_FRAMESET:case fe.AFTER_AFTER_BODY:case fe.AFTER_AFTER_FRAMESET:{II(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===ie.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case fe.IN_HEAD:case fe.IN_HEAD_NO_SCRIPT:case fe.AFTER_HEAD:case fe.TEXT:case fe.IN_COLUMN_GROUP:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:case fe.IN_FRAMESET:case fe.AFTER_FRAMESET:{this._insertCharacters(t);break}case fe.IN_BODY:case fe.IN_CAPTION:case fe.IN_CELL:case fe.IN_TEMPLATE:case fe.AFTER_BODY:case fe.AFTER_AFTER_BODY:case fe.AFTER_AFTER_FRAMESET:{nZ(this,t);break}case fe.IN_TABLE:case fe.IN_TABLE_BODY:case fe.IN_ROW:{eE(this,t);break}case fe.IN_TABLE_TEXT:{cZ(this,t);break}}}}function ZRe(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):oZ(e,t),n}function eIe(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const a=e.openElements.items[r];if(a===t.element)break;e._isSpecialElement(a,e.openElements.tagIDs[r])&&(n=a)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function tIe(e,t,n){let r=t,a=e.openElements.getCommonAncestor(t);for(let i=0,o=a;o!==n;i++,o=a){a=e.openElements.getCommonAncestor(o);const l=e.activeFormattingElements.getElementEntry(o),c=l&&i>=JRe;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(o)):(o=sIe(e,l),r===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function sIe(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function nIe(e,t,n){const r=e.treeAdapter.getTagName(t),a=Wf(r);if(e._isElementCausesFosterParenting(a))e._fosterParentElement(n);else{const i=e.treeAdapter.getNamespaceURI(t);a===R.TEMPLATE&&i===nt.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function rIe(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:a}=n,i=e.treeAdapter.createElement(a.tagName,r,a.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,a),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i,a.tagID)}function RI(e,t){for(let n=0;n<XRe;n++){const r=ZRe(e,t);if(!r)break;const a=eIe(e,r);if(!a)break;e.activeFormattingElements.bookmark=r;const i=tIe(e,a,r.element),o=e.openElements.getCommonAncestor(r.element);e.treeAdapter.detachNode(i),o&&nIe(e,o,i),rIe(e,a,r)}}function a3(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function aIe(e,t){e._appendCommentNode(t,e.openElements.items[0])}function iIe(e,t){e._appendCommentNode(t,e.document)}function II(e,t){if(e.stopped=!0,t.location){const n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],a=e.treeAdapter.getNodeSourceCodeLocation(r);if(a&&!a.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const i=e.openElements.items[1],o=e.treeAdapter.getNodeSourceCodeLocation(i);o&&!o.endTag&&e._setEndLocation(i,t)}}}}function oIe(e,t){e._setDocumentType(t);const n=t.forceQuirks?Fi.QUIRKS:DRe(t);MRe(t)||e._err(t,Fe.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=fe.BEFORE_HTML}function Eg(e,t){e._err(t,Fe.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Fi.QUIRKS),e.insertionMode=fe.BEFORE_HTML,e._processToken(t)}function lIe(e,t){t.tagID===R.HTML?(e._insertElement(t,nt.HTML),e.insertionMode=fe.BEFORE_HEAD):Fx(e,t)}function cIe(e,t){const n=t.tagID;(n===R.HTML||n===R.HEAD||n===R.BODY||n===R.BR)&&Fx(e,t)}function Fx(e,t){e._insertFakeRootElement(),e.insertionMode=fe.BEFORE_HEAD,e._processToken(t)}function uIe(e,t){switch(t.tagID){case R.HTML:{ka(e,t);break}case R.HEAD:{e._insertElement(t,nt.HTML),e.headElement=e.openElements.current,e.insertionMode=fe.IN_HEAD;break}default:Bx(e,t)}}function dIe(e,t){const n=t.tagID;n===R.HEAD||n===R.BODY||n===R.HTML||n===R.BR?Bx(e,t):e._err(t,Fe.endTagWithoutMatchingOpenElement)}function Bx(e,t){e._insertFakeElement(Ee.HEAD,R.HEAD),e.headElement=e.openElements.current,e.insertionMode=fe.IN_HEAD,e._processToken(t)}function Io(e,t){switch(t.tagID){case R.HTML:{ka(e,t);break}case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:{e._appendElement(t,nt.HTML),t.ackSelfClosing=!0;break}case R.TITLE:{e._switchToTextParsing(t,ir.RCDATA);break}case R.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,ir.RAWTEXT):(e._insertElement(t,nt.HTML),e.insertionMode=fe.IN_HEAD_NO_SCRIPT);break}case R.NOFRAMES:case R.STYLE:{e._switchToTextParsing(t,ir.RAWTEXT);break}case R.SCRIPT:{e._switchToTextParsing(t,ir.SCRIPT_DATA);break}case R.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=fe.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(fe.IN_TEMPLATE);break}case R.HEAD:{e._err(t,Fe.misplacedStartTagForHeadElement);break}default:Ux(e,t)}}function hIe(e,t){switch(t.tagID){case R.HEAD:{e.openElements.pop(),e.insertionMode=fe.AFTER_HEAD;break}case R.BODY:case R.BR:case R.HTML:{Ux(e,t);break}case R.TEMPLATE:{Qh(e,t);break}default:e._err(t,Fe.endTagWithoutMatchingOpenElement)}}function Qh(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==R.TEMPLATE&&e._err(t,Fe.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(R.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,Fe.endTagWithoutMatchingOpenElement)}function Ux(e,t){e.openElements.pop(),e.insertionMode=fe.AFTER_HEAD,e._processToken(t)}function pIe(e,t){switch(t.tagID){case R.HTML:{ka(e,t);break}case R.BASEFONT:case R.BGSOUND:case R.HEAD:case R.LINK:case R.META:case R.NOFRAMES:case R.STYLE:{Io(e,t);break}case R.NOSCRIPT:{e._err(t,Fe.nestedNoscriptInHead);break}default:zx(e,t)}}function mIe(e,t){switch(t.tagID){case R.NOSCRIPT:{e.openElements.pop(),e.insertionMode=fe.IN_HEAD;break}case R.BR:{zx(e,t);break}default:e._err(t,Fe.endTagWithoutMatchingOpenElement)}}function zx(e,t){const n=t.type===Rs.EOF?Fe.openElementsLeftAfterEof:Fe.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=fe.IN_HEAD,e._processToken(t)}function fIe(e,t){switch(t.tagID){case R.HTML:{ka(e,t);break}case R.BODY:{e._insertElement(t,nt.HTML),e.framesetOk=!1,e.insertionMode=fe.IN_BODY;break}case R.FRAMESET:{e._insertElement(t,nt.HTML),e.insertionMode=fe.IN_FRAMESET;break}case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:case R.NOFRAMES:case R.SCRIPT:case R.STYLE:case R.TEMPLATE:case R.TITLE:{e._err(t,Fe.abandonedHeadElementChild),e.openElements.push(e.headElement,R.HEAD),Io(e,t),e.openElements.remove(e.headElement);break}case R.HEAD:{e._err(t,Fe.misplacedStartTagForHeadElement);break}default:Hx(e,t)}}function gIe(e,t){switch(t.tagID){case R.BODY:case R.HTML:case R.BR:{Hx(e,t);break}case R.TEMPLATE:{Qh(e,t);break}default:e._err(t,Fe.endTagWithoutMatchingOpenElement)}}function Hx(e,t){e._insertFakeElement(Ee.BODY,R.BODY),e.insertionMode=fe.IN_BODY,hk(e,t)}function hk(e,t){switch(t.type){case Rs.CHARACTER:{rZ(e,t);break}case Rs.WHITESPACE_CHARACTER:{nZ(e,t);break}case Rs.COMMENT:{a3(e,t);break}case Rs.START_TAG:{ka(e,t);break}case Rs.END_TAG:{pk(e,t);break}case Rs.EOF:{lZ(e,t);break}}}function nZ(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function rZ(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function xIe(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function bIe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function yIe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,nt.HTML),e.insertionMode=fe.IN_FRAMESET)}function vIe(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,nt.HTML)}function wIe(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&r3.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,nt.HTML)}function jIe(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,nt.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function _Ie(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,nt.HTML),n||(e.formElement=e.openElements.current))}function kIe(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const a=e.openElements.tagIDs[r];if(n===R.LI&&a===R.LI||(n===R.DD||n===R.DT)&&(a===R.DD||a===R.DT)){e.openElements.generateImpliedEndTagsWithExclusion(a),e.openElements.popUntilTagNamePopped(a);break}if(a!==R.ADDRESS&&a!==R.DIV&&a!==R.P&&e._isSpecialElement(e.openElements.items[r],a))break}e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,nt.HTML)}function NIe(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,nt.HTML),e.tokenizer.state=ir.PLAINTEXT}function EIe(e,t){e.openElements.hasInScope(R.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(R.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,nt.HTML),e.framesetOk=!1}function SIe(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Ee.A);n&&(RI(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,nt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function CIe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,nt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function TIe(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(R.NOBR)&&(RI(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,nt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function AIe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,nt.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function RIe(e,t){e.treeAdapter.getDocumentMode(e.document)!==Fi.QUIRKS&&e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,nt.HTML),e.framesetOk=!1,e.insertionMode=fe.IN_TABLE}function aZ(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,nt.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function iZ(e){const t=YQ(e,mh.TYPE);return t!=null&&t.toLowerCase()===KRe}function IIe(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,nt.HTML),iZ(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function PIe(e,t){e._appendElement(t,nt.HTML),t.ackSelfClosing=!0}function LIe(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._appendElement(t,nt.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function OIe(e,t){t.tagName=Ee.IMG,t.tagID=R.IMG,aZ(e,t)}function MIe(e,t){e._insertElement(t,nt.HTML),e.skipNextNewLine=!0,e.tokenizer.state=ir.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=fe.TEXT}function DIe(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,ir.RAWTEXT)}function $Ie(e,t){e.framesetOk=!1,e._switchToTextParsing(t,ir.RAWTEXT)}function tF(e,t){e._switchToTextParsing(t,ir.RAWTEXT)}function FIe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,nt.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===fe.IN_TABLE||e.insertionMode===fe.IN_CAPTION||e.insertionMode===fe.IN_TABLE_BODY||e.insertionMode===fe.IN_ROW||e.insertionMode===fe.IN_CELL?fe.IN_SELECT_IN_TABLE:fe.IN_SELECT}function BIe(e,t){e.openElements.currentTagId===R.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,nt.HTML)}function UIe(e,t){e.openElements.hasInScope(R.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,nt.HTML)}function zIe(e,t){e.openElements.hasInScope(R.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(R.RTC),e._insertElement(t,nt.HTML)}function HIe(e,t){e._reconstructActiveFormattingElements(),eZ(t),AI(t),t.selfClosing?e._appendElement(t,nt.MATHML):e._insertElement(t,nt.MATHML),t.ackSelfClosing=!0}function qIe(e,t){e._reconstructActiveFormattingElements(),tZ(t),AI(t),t.selfClosing?e._appendElement(t,nt.SVG):e._insertElement(t,nt.SVG),t.ackSelfClosing=!0}function sF(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,nt.HTML)}function ka(e,t){switch(t.tagID){case R.I:case R.S:case R.B:case R.U:case R.EM:case R.TT:case R.BIG:case R.CODE:case R.FONT:case R.SMALL:case R.STRIKE:case R.STRONG:{CIe(e,t);break}case R.A:{SIe(e,t);break}case R.H1:case R.H2:case R.H3:case R.H4:case R.H5:case R.H6:{wIe(e,t);break}case R.P:case R.DL:case R.OL:case R.UL:case R.DIV:case R.DIR:case R.NAV:case R.MAIN:case R.MENU:case R.ASIDE:case R.CENTER:case R.FIGURE:case R.FOOTER:case R.HEADER:case R.HGROUP:case R.DIALOG:case R.DETAILS:case R.ADDRESS:case R.ARTICLE:case R.SEARCH:case R.SECTION:case R.SUMMARY:case R.FIELDSET:case R.BLOCKQUOTE:case R.FIGCAPTION:{vIe(e,t);break}case R.LI:case R.DD:case R.DT:{kIe(e,t);break}case R.BR:case R.IMG:case R.WBR:case R.AREA:case R.EMBED:case R.KEYGEN:{aZ(e,t);break}case R.HR:{LIe(e,t);break}case R.RB:case R.RTC:{UIe(e,t);break}case R.RT:case R.RP:{zIe(e,t);break}case R.PRE:case R.LISTING:{jIe(e,t);break}case R.XMP:{DIe(e,t);break}case R.SVG:{qIe(e,t);break}case R.HTML:{xIe(e,t);break}case R.BASE:case R.LINK:case R.META:case R.STYLE:case R.TITLE:case R.SCRIPT:case R.BGSOUND:case R.BASEFONT:case R.TEMPLATE:{Io(e,t);break}case R.BODY:{bIe(e,t);break}case R.FORM:{_Ie(e,t);break}case R.NOBR:{TIe(e,t);break}case R.MATH:{HIe(e,t);break}case R.TABLE:{RIe(e,t);break}case R.INPUT:{IIe(e,t);break}case R.PARAM:case R.TRACK:case R.SOURCE:{PIe(e,t);break}case R.IMAGE:{OIe(e,t);break}case R.BUTTON:{EIe(e,t);break}case R.APPLET:case R.OBJECT:case R.MARQUEE:{AIe(e,t);break}case R.IFRAME:{$Ie(e,t);break}case R.SELECT:{FIe(e,t);break}case R.OPTION:case R.OPTGROUP:{BIe(e,t);break}case R.NOEMBED:case R.NOFRAMES:{tF(e,t);break}case R.FRAMESET:{yIe(e,t);break}case R.TEXTAREA:{MIe(e,t);break}case R.NOSCRIPT:{e.options.scriptingEnabled?tF(e,t):sF(e,t);break}case R.PLAINTEXT:{NIe(e,t);break}case R.COL:case R.TH:case R.TD:case R.TR:case R.HEAD:case R.FRAME:case R.TBODY:case R.TFOOT:case R.THEAD:case R.CAPTION:case R.COLGROUP:break;default:sF(e,t)}}function WIe(e,t){if(e.openElements.hasInScope(R.BODY)&&(e.insertionMode=fe.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function VIe(e,t){e.openElements.hasInScope(R.BODY)&&(e.insertionMode=fe.AFTER_BODY,gZ(e,t))}function GIe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function YIe(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(R.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(R.FORM):n&&e.openElements.remove(n))}function KIe(e){e.openElements.hasInButtonScope(R.P)||e._insertFakeElement(Ee.P,R.P),e._closePElement()}function XIe(e){e.openElements.hasInListItemScope(R.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(R.LI),e.openElements.popUntilTagNamePopped(R.LI))}function JIe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function QIe(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function ZIe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function ePe(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Ee.BR,R.BR),e.openElements.pop(),e.framesetOk=!1}function oZ(e,t){const n=t.tagName,r=t.tagID;for(let a=e.openElements.stackTop;a>0;a--){const i=e.openElements.items[a],o=e.openElements.tagIDs[a];if(r===o&&(r!==R.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=a&&e.openElements.shortenToLength(a);break}if(e._isSpecialElement(i,o))break}}function pk(e,t){switch(t.tagID){case R.A:case R.B:case R.I:case R.S:case R.U:case R.EM:case R.TT:case R.BIG:case R.CODE:case R.FONT:case R.NOBR:case R.SMALL:case R.STRIKE:case R.STRONG:{RI(e,t);break}case R.P:{KIe(e);break}case R.DL:case R.UL:case R.OL:case R.DIR:case R.DIV:case R.NAV:case R.PRE:case R.MAIN:case R.MENU:case R.ASIDE:case R.BUTTON:case R.CENTER:case R.FIGURE:case R.FOOTER:case R.HEADER:case R.HGROUP:case R.DIALOG:case R.ADDRESS:case R.ARTICLE:case R.DETAILS:case R.SEARCH:case R.SECTION:case R.SUMMARY:case R.LISTING:case R.FIELDSET:case R.BLOCKQUOTE:case R.FIGCAPTION:{GIe(e,t);break}case R.LI:{XIe(e);break}case R.DD:case R.DT:{JIe(e,t);break}case R.H1:case R.H2:case R.H3:case R.H4:case R.H5:case R.H6:{QIe(e);break}case R.BR:{ePe(e);break}case R.BODY:{WIe(e,t);break}case R.HTML:{VIe(e,t);break}case R.FORM:{YIe(e);break}case R.APPLET:case R.OBJECT:case R.MARQUEE:{ZIe(e,t);break}case R.TEMPLATE:{Qh(e,t);break}default:oZ(e,t)}}function lZ(e,t){e.tmplInsertionModeStack.length>0?fZ(e,t):II(e,t)}function tPe(e,t){var n;t.tagID===R.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function sPe(e,t){e._err(t,Fe.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function eE(e,t){if(e.openElements.currentTagId!==void 0&&sZ.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=fe.IN_TABLE_TEXT,t.type){case Rs.CHARACTER:{uZ(e,t);break}case Rs.WHITESPACE_CHARACTER:{cZ(e,t);break}}else P0(e,t)}function nPe(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,nt.HTML),e.insertionMode=fe.IN_CAPTION}function rPe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,nt.HTML),e.insertionMode=fe.IN_COLUMN_GROUP}function aPe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Ee.COLGROUP,R.COLGROUP),e.insertionMode=fe.IN_COLUMN_GROUP,PI(e,t)}function iPe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,nt.HTML),e.insertionMode=fe.IN_TABLE_BODY}function oPe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Ee.TBODY,R.TBODY),e.insertionMode=fe.IN_TABLE_BODY,mk(e,t)}function lPe(e,t){e.openElements.hasInTableScope(R.TABLE)&&(e.openElements.popUntilTagNamePopped(R.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function cPe(e,t){iZ(t)?e._appendElement(t,nt.HTML):P0(e,t),t.ackSelfClosing=!0}function uPe(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,nt.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function df(e,t){switch(t.tagID){case R.TD:case R.TH:case R.TR:{oPe(e,t);break}case R.STYLE:case R.SCRIPT:case R.TEMPLATE:{Io(e,t);break}case R.COL:{aPe(e,t);break}case R.FORM:{uPe(e,t);break}case R.TABLE:{lPe(e,t);break}case R.TBODY:case R.TFOOT:case R.THEAD:{iPe(e,t);break}case R.INPUT:{cPe(e,t);break}case R.CAPTION:{nPe(e,t);break}case R.COLGROUP:{rPe(e,t);break}default:P0(e,t)}}function Db(e,t){switch(t.tagID){case R.TABLE:{e.openElements.hasInTableScope(R.TABLE)&&(e.openElements.popUntilTagNamePopped(R.TABLE),e._resetInsertionMode());break}case R.TEMPLATE:{Qh(e,t);break}case R.BODY:case R.CAPTION:case R.COL:case R.COLGROUP:case R.HTML:case R.TBODY:case R.TD:case R.TFOOT:case R.TH:case R.THEAD:case R.TR:break;default:P0(e,t)}}function P0(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,hk(e,t),e.fosterParentingEnabled=n}function cZ(e,t){e.pendingCharacterTokens.push(t)}function uZ(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Sg(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)P0(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const dZ=new Set([R.CAPTION,R.COL,R.COLGROUP,R.TBODY,R.TD,R.TFOOT,R.TH,R.THEAD,R.TR]);function dPe(e,t){const n=t.tagID;dZ.has(n)?e.openElements.hasInTableScope(R.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(R.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=fe.IN_TABLE,df(e,t)):ka(e,t)}function hPe(e,t){const n=t.tagID;switch(n){case R.CAPTION:case R.TABLE:{e.openElements.hasInTableScope(R.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(R.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=fe.IN_TABLE,n===R.TABLE&&Db(e,t));break}case R.BODY:case R.COL:case R.COLGROUP:case R.HTML:case R.TBODY:case R.TD:case R.TFOOT:case R.TH:case R.THEAD:case R.TR:break;default:pk(e,t)}}function PI(e,t){switch(t.tagID){case R.HTML:{ka(e,t);break}case R.COL:{e._appendElement(t,nt.HTML),t.ackSelfClosing=!0;break}case R.TEMPLATE:{Io(e,t);break}default:lj(e,t)}}function pPe(e,t){switch(t.tagID){case R.COLGROUP:{e.openElements.currentTagId===R.COLGROUP&&(e.openElements.pop(),e.insertionMode=fe.IN_TABLE);break}case R.TEMPLATE:{Qh(e,t);break}case R.COL:break;default:lj(e,t)}}function lj(e,t){e.openElements.currentTagId===R.COLGROUP&&(e.openElements.pop(),e.insertionMode=fe.IN_TABLE,e._processToken(t))}function mk(e,t){switch(t.tagID){case R.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,nt.HTML),e.insertionMode=fe.IN_ROW;break}case R.TH:case R.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(Ee.TR,R.TR),e.insertionMode=fe.IN_ROW,fk(e,t);break}case R.CAPTION:case R.COL:case R.COLGROUP:case R.TBODY:case R.TFOOT:case R.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=fe.IN_TABLE,df(e,t));break}default:df(e,t)}}function i3(e,t){const n=t.tagID;switch(t.tagID){case R.TBODY:case R.TFOOT:case R.THEAD:{e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=fe.IN_TABLE);break}case R.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=fe.IN_TABLE,Db(e,t));break}case R.BODY:case R.CAPTION:case R.COL:case R.COLGROUP:case R.HTML:case R.TD:case R.TH:case R.TR:break;default:Db(e,t)}}function fk(e,t){switch(t.tagID){case R.TH:case R.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,nt.HTML),e.insertionMode=fe.IN_CELL,e.activeFormattingElements.insertMarker();break}case R.CAPTION:case R.COL:case R.COLGROUP:case R.TBODY:case R.TFOOT:case R.THEAD:case R.TR:{e.openElements.hasInTableScope(R.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=fe.IN_TABLE_BODY,mk(e,t));break}default:df(e,t)}}function hZ(e,t){switch(t.tagID){case R.TR:{e.openElements.hasInTableScope(R.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=fe.IN_TABLE_BODY);break}case R.TABLE:{e.openElements.hasInTableScope(R.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=fe.IN_TABLE_BODY,i3(e,t));break}case R.TBODY:case R.TFOOT:case R.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(R.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=fe.IN_TABLE_BODY,i3(e,t));break}case R.BODY:case R.CAPTION:case R.COL:case R.COLGROUP:case R.HTML:case R.TD:case R.TH:break;default:Db(e,t)}}function mPe(e,t){const n=t.tagID;dZ.has(n)?(e.openElements.hasInTableScope(R.TD)||e.openElements.hasInTableScope(R.TH))&&(e._closeTableCell(),fk(e,t)):ka(e,t)}function fPe(e,t){const n=t.tagID;switch(n){case R.TD:case R.TH:{e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=fe.IN_ROW);break}case R.TABLE:case R.TBODY:case R.TFOOT:case R.THEAD:case R.TR:{e.openElements.hasInTableScope(n)&&(e._closeTableCell(),hZ(e,t));break}case R.BODY:case R.CAPTION:case R.COL:case R.COLGROUP:case R.HTML:break;default:pk(e,t)}}function pZ(e,t){switch(t.tagID){case R.HTML:{ka(e,t);break}case R.OPTION:{e.openElements.currentTagId===R.OPTION&&e.openElements.pop(),e._insertElement(t,nt.HTML);break}case R.OPTGROUP:{e.openElements.currentTagId===R.OPTION&&e.openElements.pop(),e.openElements.currentTagId===R.OPTGROUP&&e.openElements.pop(),e._insertElement(t,nt.HTML);break}case R.HR:{e.openElements.currentTagId===R.OPTION&&e.openElements.pop(),e.openElements.currentTagId===R.OPTGROUP&&e.openElements.pop(),e._appendElement(t,nt.HTML),t.ackSelfClosing=!0;break}case R.INPUT:case R.KEYGEN:case R.TEXTAREA:case R.SELECT:{e.openElements.hasInSelectScope(R.SELECT)&&(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode(),t.tagID!==R.SELECT&&e._processStartTag(t));break}case R.SCRIPT:case R.TEMPLATE:{Io(e,t);break}}}function mZ(e,t){switch(t.tagID){case R.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===R.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===R.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===R.OPTGROUP&&e.openElements.pop();break}case R.OPTION:{e.openElements.currentTagId===R.OPTION&&e.openElements.pop();break}case R.SELECT:{e.openElements.hasInSelectScope(R.SELECT)&&(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode());break}case R.TEMPLATE:{Qh(e,t);break}}}function gPe(e,t){const n=t.tagID;
vendor: 6,696 bytes, line 147
147n===R.CAPTION||n===R.TABLE||n===R.TBODY||n===R.TFOOT||n===R.THEAD||n===R.TR||n===R.TD||n===R.TH?(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode(),e._processStartTag(t)):pZ(e,t)}function xPe(e,t){const n=t.tagID;n===R.CAPTION||n===R.TABLE||n===R.TBODY||n===R.TFOOT||n===R.THEAD||n===R.TR||n===R.TD||n===R.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode(),e.onEndTag(t)):mZ(e,t)}function bPe(e,t){switch(t.tagID){case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:case R.NOFRAMES:case R.SCRIPT:case R.STYLE:case R.TEMPLATE:case R.TITLE:{Io(e,t);break}case R.CAPTION:case R.COLGROUP:case R.TBODY:case R.TFOOT:case R.THEAD:{e.tmplInsertionModeStack[0]=fe.IN_TABLE,e.insertionMode=fe.IN_TABLE,df(e,t);break}case R.COL:{e.tmplInsertionModeStack[0]=fe.IN_COLUMN_GROUP,e.insertionMode=fe.IN_COLUMN_GROUP,PI(e,t);break}case R.TR:{e.tmplInsertionModeStack[0]=fe.IN_TABLE_BODY,e.insertionMode=fe.IN_TABLE_BODY,mk(e,t);break}case R.TD:case R.TH:{e.tmplInsertionModeStack[0]=fe.IN_ROW,e.insertionMode=fe.IN_ROW,fk(e,t);break}default:e.tmplInsertionModeStack[0]=fe.IN_BODY,e.insertionMode=fe.IN_BODY,ka(e,t)}}function yPe(e,t){t.tagID===R.TEMPLATE&&Qh(e,t)}function fZ(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(R.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):II(e,t)}function vPe(e,t){t.tagID===R.HTML?ka(e,t):cj(e,t)}function gZ(e,t){var n;if(t.tagID===R.HTML){if(e.fragmentContext||(e.insertionMode=fe.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===R.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else cj(e,t)}function cj(e,t){e.insertionMode=fe.IN_BODY,hk(e,t)}function wPe(e,t){switch(t.tagID){case R.HTML:{ka(e,t);break}case R.FRAMESET:{e._insertElement(t,nt.HTML);break}case R.FRAME:{e._appendElement(t,nt.HTML),t.ackSelfClosing=!0;break}case R.NOFRAMES:{Io(e,t);break}}}function jPe(e,t){t.tagID===R.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==R.FRAMESET&&(e.insertionMode=fe.AFTER_FRAMESET))}function _Pe(e,t){switch(t.tagID){case R.HTML:{ka(e,t);break}case R.NOFRAMES:{Io(e,t);break}}}function kPe(e,t){t.tagID===R.HTML&&(e.insertionMode=fe.AFTER_AFTER_FRAMESET)}function NPe(e,t){t.tagID===R.HTML?ka(e,t):N1(e,t)}function N1(e,t){e.insertionMode=fe.IN_BODY,hk(e,t)}function EPe(e,t){switch(t.tagID){case R.HTML:{ka(e,t);break}case R.NOFRAMES:{Io(e,t);break}}}function SPe(e,t){t.chars=Bn,e._insertCharacters(t)}function CPe(e,t){e._insertCharacters(t),e.framesetOk=!1}function xZ(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==nt.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function TPe(e,t){if(qRe(t))xZ(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===nt.MATHML?eZ(t):r===nt.SVG&&(WRe(t),tZ(t)),AI(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function APe(e,t){if(t.tagID===R.P||t.tagID===R.BR){xZ(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===nt.HTML){e._endTagOutsideForeignContent(t);break}const a=e.treeAdapter.getTagName(r);if(a.toLowerCase()===t.tagName){t.tagName=a,e.openElements.shortenToLength(n);break}}}Ee.AREA,Ee.BASE,Ee.BASEFONT,Ee.BGSOUND,Ee.BR,Ee.COL,Ee.EMBED,Ee.FRAME,Ee.HR,Ee.IMG,Ee.INPUT,Ee.KEYGEN,Ee.LINK,Ee.META,Ee.PARAM,Ee.SOURCE,Ee.TRACK,Ee.WBR;const gk=bZ("end"),vl=bZ("start");function bZ(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function yZ(e){const t=vl(e),n=gk(e);if(t&&n)return{start:t,end:n}}const RPe=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,IPe=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),nF={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function vZ(e,t){const n=zPe(e),r=CI("type",{handlers:{root:PPe,element:LPe,text:OPe,comment:jZ,doctype:MPe,raw:$Pe},unknown:FPe}),a={parser:n?new eF(nF):eF.getFragmentParser(void 0,nF),handle(l){r(l,a)},stitches:!1,options:t||{}};r(e,a),Vf(a,vl());const i=n?a.parser.document:a.parser.getFragment(),o=q4e(i,{file:a.options.file});return a.stitches&&hl(o,"comment",function(l,c,u){const d=l;if(d.value.stitch&&u&&c!==void 0){const h=u.children;return h[c]=d.value.stitch,c}}),o.type==="root"&&o.children.length===1&&o.children[0].type===e.type?o.children[0]:o}function wZ(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function PPe(e,t){wZ(e.children,t)}function LPe(e,t){BPe(e,t),wZ(e.children,t),UPe(e,t)}function OPe(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);const n={type:Rs.CHARACTER,chars:e.value,location:L0(e)};Vf(t,vl(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function MPe(e,t){const n={type:Rs.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:L0(e)};Vf(t,vl(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function DPe(e,t){t.stitches=!0;const n=HPe(e);if("children"in e&&"children"in n){const r=vZ({type:"root",children:e.children},t.options);n.children=r.children}jZ({type:"comment",value:{stitch:n}},t)}function jZ(e,t){const n=e.value,r={type:Rs.COMMENT,data:n,location:L0(e)};Vf(t,vl(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function $Pe(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,_Z(t,vl(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(RPe,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function FPe(e,t){const n=e;
vendor: 11,567 bytes, line 147
147if(t.options.passThrough&&t.options.passThrough.includes(n.type))DPe(n,t);else{let r="";throw IPe.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function Vf(e,t){_Z(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=ir.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function _Z(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function BPe(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===ir.PLAINTEXT)return;Vf(t,vl(e));const r=t.parser.openElements.current;let a="namespaceURI"in r?r.namespaceURI:Kd.html;a===Kd.html&&n==="svg"&&(a=Kd.svg);const i=K4e({...e,children:[]},{space:a===Kd.svg?"svg":"html"}),o={type:Rs.START_TAG,tagName:n,tagID:Wf(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in i?i.attrs:[],location:L0(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function UPe(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&qQ.includes(n)||t.parser.tokenizer.state===ir.PLAINTEXT)return;Vf(t,gk(e));const r={type:Rs.END_TAG,tagName:n,tagID:Wf(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:L0(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===ir.RCDATA||t.parser.tokenizer.state===ir.RAWTEXT||t.parser.tokenizer.state===ir.SCRIPT_DATA)&&(t.parser.tokenizer.state=ir.DATA)}function zPe(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function L0(e){const t=vl(e)||{line:void 0,column:void 0,offset:void 0},n=gk(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function HPe(e){return"children"in e?Oh({...e,children:[]}):Oh(e)}function o3(e){return function(t,n){return vZ(t,{...e,file:n})}}const sd=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],Od={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...sd,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...sd],h2:[["className","sr-only"]],img:[...sd,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...sd,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...sd],table:[...sd],ul:[...sd,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},Zc={}.hasOwnProperty;function qPe(e,t){let n={type:"root",children:[]};const r={schema:t?{...Od,...t}:Od,stack:[]},a=kZ(r,e);return a&&(Array.isArray(a)?a.length===1?n=a[0]:n.children=a:n=a),n}function kZ(e,t){if(t&&typeof t=="object"){const n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return WPe(e,n);case"doctype":return VPe(e,n);case"element":return GPe(e,n);case"root":return YPe(e,n);case"text":return KPe(e,n)}}}function WPe(e,t){if(e.schema.allowComments){const n=typeof t.value=="string"?t.value:"",r=n.indexOf("-->"),i={type:"comment",value:r<0?n:n.slice(0,r)};return O0(i,t),i}}function VPe(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return O0(n,t),n}}function GPe(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const r=NZ(e,t.children),a=XPe(e,t.properties);e.stack.pop();let i=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(i=!0,e.schema.ancestors&&Zc.call(e.schema.ancestors,n))){const l=e.schema.ancestors[n];let c=-1;for(i=!1;++c<l.length;)e.stack.includes(l[c])&&(i=!0)}if(!i)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;const o={type:"element",tagName:n,properties:a,children:r};return O0(o,t),o}function YPe(e,t){const r={type:"root",children:NZ(e,t.children)};return O0(r,t),r}function KPe(e,t){const r={type:"text",value:typeof t.value=="string"?t.value:""};return O0(r,t),r}function NZ(e,t){const n=[];if(Array.isArray(t)){const r=t;let a=-1;for(;++a<r.length;){const i=kZ(e,r[a]);i&&(Array.isArray(i)?n.push(...i):n.push(i))}}return n}function XPe(e,t){const n=e.stack[e.stack.length-1],r=e.schema.attributes,a=e.schema.required,i=r&&Zc.call(r,n)?r[n]:void 0,o=r&&Zc.call(r,"*")?r["*"]:void 0,l=t&&typeof t=="object"?t:{},c={};let u;for(u in l)if(Zc.call(l,u)){const d=l[u];let h=rF(e,aF(i,u),u,d);h==null&&(h=rF(e,aF(o,u),u,d)),h!=null&&(c[u]=h)}if(a&&Zc.call(a,n)){const d=a[n];for(u in d)Zc.call(d,u)&&!Zc.call(c,u)&&(c[u]=d[u])}return c}function rF(e,t,n,r){return t?Array.isArray(r)?JPe(e,t,n,r):EZ(e,t,n,r):void 0}function JPe(e,t,n,r){let a=-1;const i=[];for(;++a<r.length;){const o=EZ(e,t,n,r[a]);(typeof o=="number"||typeof o=="string")&&i.push(o)}return i}function EZ(e,t,n,r){if(!(typeof r!="boolean"&&typeof r!="number"&&typeof r!="string")&&QPe(e,n,r)){if(typeof t=="object"&&t.length>1){let a=!1,i=0;for(;++i<t.length;){const o=t[i];if(o&&typeof o=="object"&&"flags"in o){if(o.test(String(r))){a=!0;break}}else if(o===r){a=!0;break}}if(!a)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function QPe(e,t,n){const r=e.schema.protocols&&Zc.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;const a=String(n),i=a.indexOf(":"),o=a.indexOf("?"),l=a.indexOf("#"),c=a.indexOf("/");if(i<0||c>-1&&i>c||o>-1&&i>o||l>-1&&i>l)return!0;let u=-1;for(;++u<r.length;){const d=r[u];if(i===d.length&&a.slice(0,d.length)===d)return!0}return!1}function O0(e,t){const n=yZ(t);t.data&&(e.data=Oh(t.data)),n&&(e.position=n)}function aF(e,t){let n,r=-1;if(e)for(;++r<e.length;){const a=e[r],i=typeof a=="string"?a:a[0];if(i===t)return a;i==="data*"&&(n=a)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return n}function SZ(e){return function(t){return qPe(t,e)}}function uj(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}const La=Hu(/[A-Za-z]/),ba=Hu(/[\dA-Za-z]/),ZPe=Hu(/[#-'*+\--9=?A-Z^-~]/);function dj(e){return e!==null&&(e<32||e===127)}const l3=Hu(/\d/),eLe=Hu(/[\dA-Fa-f]/),tLe=Hu(/[!-/:-@[-`{-~]/);function rs(e){return e!==null&&e<-2}function yn(e){return e!==null&&(e<0||e===32)}function Os(e){return e===-2||e===-1||e===32}const xk=Hu(new RegExp("\\p{P}|\\p{S}","u")),Mh=Hu(/\s/);function Hu(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function sLe(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function nLe(e,t,n){const a=ck((n||{}).ignore||[]),i=rLe(t);let o=-1;for(;++o<i.length;)yI(e,"text",l);function l(u,d){let h=-1,p;for(;++h<d.length;){const m=d[h],g=p?p.children:void 0;if(a(m,g?g.indexOf(m):void 0,p))return;p=m}if(p)return c(u,d)}function c(u,d){const h=d[d.length-1],p=i[o][0],m=i[o][1];let g=0;const b=h.children.indexOf(u);let y=!1,v=[];p.lastIndex=0;let w=p.exec(u.value);for(;w;){const j=w.index,E={index:w.index,input:w.input,stack:[...d,u]};let S=m(...w,E);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?p.lastIndex=j+1:(g!==j&&v.push({type:"text",value:u.value.slice(g,j)}),Array.isArray(S)?v.push(...S):S&&v.push(S),g=j+w[0].length,y=!0),!p.global)break;w=p.exec(u.value)}return y?(g<u.value.length&&v.push({type:"text",value:u.value.slice(g)}),h.children.splice(b,1,...v)):v=[u],b+v.length}}function rLe(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([aLe(a[0]),iLe(a[1])])}return t}function aLe(e){return typeof e=="string"?new RegExp(sLe(e),"g"):e}function iLe(e){return typeof e=="function"?e:function(){return e}}const tE="phrasing",sE=["autolink","link","image","label"];function oLe(){return{transforms:[mLe],enter:{literalAutolink:cLe,literalAutolinkEmail:nE,literalAutolinkHttp:nE,literalAutolinkWww:nE},exit:{literalAutolink:pLe,literalAutolinkEmail:hLe,literalAutolinkHttp:uLe,literalAutolinkWww:dLe}}}function lLe(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:tE,notInConstruct:sE},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:tE,notInConstruct:sE},{character:":",before:"[ps]",after:"\\/",inConstruct:tE,notInConstruct:sE}]}}function cLe(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function nE(e){this.config.enter.autolinkProtocol.call(this,e)}function uLe(e){this.config.exit.autolinkProtocol.call(this,e)}function dLe(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function hLe(e){this.config.exit.autolinkEmail.call(this,e)}function pLe(e){this.exit(e)}function mLe(e){nLe(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,fLe],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S}
147)([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),gLe]],{ignore:["link","linkReference"]})}function fLe(e,t,n,r,a){let i="";if(!CZ(a)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!xLe(n)))return!1;const o=bLe(n+r);if(!o[0])return!1;const l={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function gLe(e,t,n,r){return!CZ(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function xLe(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function bLe(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=uj(e,"(");let i=uj(e,")");for(;r!==-1&&a>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function CZ(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Mh(n)||xk(n))&&(!t||n!==47)}function ko(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}TZ.peek=SLe;function yLe(){this.buffer()}function vLe(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function wLe(){this.buffer()}function jLe(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function _Le(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ko(this.sliceSerialize(e)).toLowerCase(),n.label=t}function kLe(e){this.exit(e)}function NLe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ko(this.sliceSerialize(e)).toLowerCase(),n.label=t}function ELe(e){this.exit(e)}function SLe(){return"["}function TZ(e,t,n,r){const a=n.createTracker(r);let i=a.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return i+=a.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),o(),i+=a.move("]"),i}function CLe(){return{enter:{gfmFootnoteCallString:yLe,gfmFootnoteCall:vLe,gfmFootnoteDefinitionLabelString:wLe,gfmFootnoteDefinition:jLe},exit:{gfmFootnoteCallString:_Le,gfmFootnoteCall:kLe,gfmFootnoteDefinitionLabelString:NLe,gfmFootnoteDefinition:ELe}}}function TLe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:TZ},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,i,o){const l=i.createTracker(o);let c=l.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?` 148`:" ")+i.indentLines(i.containerFlow(r,l.current()),t?AZ:ALe))),u(),c}}function ALe(e,t,n){return t===0?e:AZ(e,t,n)}function AZ(e,t,n){return(n?"":" ")+e}const RLe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];RZ.peek=MLe;function ILe(){return{canContainEols:["delete"],enter:{strikethrough:LLe},exit:{strikethrough:OLe}}}function PLe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:RLe}],handlers:{delete:RZ}}}function LLe(e){this.enter({type:"delete",children:[]},e)}function OLe(e){this.exit(e)}function RZ(e,t,n,r){const a=n.createTracker(r),i=n.enter("strikethrough");let o=a.move("~~");return o+=n.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),i(),o}function MLe(){return"~"}function DLe(e){return e.length}function $Le(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||DLe,i=[],o=[],l=[],c=[];let u=0,d=-1;for(;++d<e.length;){const x=[],b=[];let y=-1;for(e[d].length>u&&(u=e[d].length);++y<e[d].length;){const v=FLe(e[d][y]);if(n.alignDelimiters!==!1){const w=a(v);b[y]=w,(c[y]===void 0||w>c[y])&&(c[y]=w)}x.push(v)}o[d]=x,l[d]=b}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<u;)i[h]=iF(r[h]);else{const x=iF(r);for(;++h<u;)i[h]=x}h=-1;const p=[],m=[];for(;++h<u;){const x=i[h];let b="",y="";x===99?(b=":",y=":"):x===108?b=":":x===114&&(y=":");
vendor: 19,656 bytes, lines 148-162
148let v=n.alignDelimiters===!1?1:Math.max(1,c[h]-b.length-y.length);const w=b+"-".repeat(v)+y;n.alignDelimiters!==!1&&(v=b.length+v+y.length,v>c[h]&&(c[h]=v),m[h]=v),p[h]=w}o.splice(1,0,p),l.splice(1,0,m),d=-1;const g=[];for(;++d<o.length;){const x=o[d],b=l[d];h=-1;const y=[];for(;++h<u;){const v=x[h]||"";let w="",j="";if(n.alignDelimiters!==!1){const E=c[h]-(b[h]||0),S=i[h];S===114?w=" ".repeat(E):S===99?E%2?(w=" ".repeat(E/2+.5),j=" ".repeat(E/2-.5)):(w=" ".repeat(E/2),j=w):j=" ".repeat(E)}n.delimiterStart!==!1&&!h&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||h)&&y.push(" "),n.alignDelimiters!==!1&&y.push(w),y.push(v),n.alignDelimiters!==!1&&y.push(j),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||h!==u-1)&&y.push("|")}g.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return g.join(` 149`)}function FLe(e){return e==null?"":String(e)}function iF(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function BLe(e,t,n,r){const a=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),ULe);return a(),o}function ULe(e,t,n){return">"+(n?"":" ")+e}function zLe(e,t){return oF(e,t.inConstruct,!0)&&!oF(e,t.notInConstruct,!1)}function oF(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function lF(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===` 150`&&zLe(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\ 151`}function HLe(e,t){const n=String(e);let r=n.indexOf(t),a=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++i>o&&(o=i):i=1,a=r+t.length,r=n.indexOf(t,a);return o}function qLe(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function WLe(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function VLe(e,t,n,r){const a=WLe(n),i=e.value||"",o=a==="`"?"GraveAccent":"Tilde";if(qLe(e,n)){const h=n.enter("codeIndented"),p=n.indentLines(i,GLe);return h(),p}const l=n.createTracker(r),c=a.repeat(Math.max(HLe(i,a)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const h=n.enter(`codeFencedLang${o}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` 152`,encode:["`"],...l.current()})),h()}return d+=l.move(` 153`),i&&(d+=l.move(i+` 154`)),d+=l.move(c),u(),d}function GLe(e,t,n){return(n?"":" ")+e}function LI(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function YLe(e,t,n,r){const a=LI(n),i=a==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` 155`,...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+a),u+=c.move(n.safe(e.title,{before:u,after:a,...c.current()})),u+=c.move(a),l()),o(),u}function KLe(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function $b(e){return"&#x"+e.toString(16).toUpperCase()+";"}function hf(e){if(e===null||yn(e)||Mh(e))return 1;if(xk(e))return 2}function hj(e,t,n){const r=hf(e),a=hf(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}IZ.peek=XLe;function IZ(e,t,n,r){const a=KLe(n),i=n.enter("emphasis"),o=n.createTracker(r),l=o.move(a);let c=o.move(n.containerPhrasing(e,{after:a,before:l,...o.current()}));const u=c.charCodeAt(0),d=hj(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(c=$b(u)+c.slice(1));const h=c.charCodeAt(c.length-1),p=hj(r.after.charCodeAt(0),h,a);p.inside&&(c=c.slice(0,-1)+$b(h));const m=o.move(a);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},l+c+m}function XLe(e,t,n){return n.options.emphasis||"*"}const JLe={};function OI(e,t){const n=JLe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return PZ(e,r,a)}function PZ(e,t,n){if(QLe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return cF(e.children,t,n)}return Array.isArray(e)?cF(e,t,n):""}function cF(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=PZ(e[a],t,n);return r.join("")}function QLe(e){return!!(e&&typeof e=="object")}function ZLe(e,t){let n=!1;return hl(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ZA}),!!((!e.depth||e.depth<3)&&OI(e)&&(t.options.setext||n))}function e6e(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(ZLe(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),p=n.containerPhrasing(e,{...i.current(),before:` 156`,after:` 157`});return h(),d(),p+` 158`+(a===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(` 159`))+1))}const o="#".repeat(a),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:` 160`,...i.current()});return/^[\t ]/.test(u)&&(u=$b(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}LZ.peek=t6e;function LZ(e){return e.value||""}function t6e(){return"<"}OZ.peek=s6e;function OZ(e,t,n,r){const a=LI(n),i=a==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+a),u+=c.move(n.safe(e.title,{before:u,after:a,...c.current()})),u+=c.move(a),l()),u+=c.move(")"),o(),u}function s6e(){return"!"}MZ.peek=n6e;function MZ(e,t,n,r){const a=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),a==="full"||!u||u!==h?c+=l.move(h+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function n6e(){return"!"}DZ.peek=r6e;function DZ(e,t,n){let r=e.value||"",a="`",i=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return a+r+a}function r6e(){return"`"}function $Z(e,t){const n=OI(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}FZ.peek=a6e;function FZ(e,t,n,r){const a=LI(n),i=a==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,c;if($Z(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let h=o.move("<");return h+=o.move(n.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),l(),n.stack=d,h}l=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=o.move(" "+a),u+=o.move(n.safe(e.title,{before:u,after:a,...o.current()})),u+=o.move(a),c()),u+=o.move(")"),l(),u}function a6e(e,t,n){return $Z(e,n)?"<":"["}BZ.peek=i6e;function BZ(e,t,n,r){const a=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),a==="full"||!u||u!==h?c+=l.move(h+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function i6e(){return"["}function MI(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function o6e(e){const t=MI(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function l6e(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function UZ(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function c6e(e,t,n,r){const a=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?l6e(n):MI(n);const l=e.ordered?o==="."?")":".":o6e(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),UZ(n)===o&&d){let h=-1;for(;++h<e.children.length;){const p=e.children[h];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,a(),u}function u6e(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function d6e(e,t,n,r){const a=u6e(n);let i=n.bulletCurrent||MI(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(h,p,m){return p?(m?"":" ".repeat(o))+h:(m?i:i+" ".repeat(o-i.length))+h}}function h6e(e,t,n,r){const a=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),a(),o}const p6e=ck(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function m6e(e,t,n,r){return(e.children.some(function(o){return p6e(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function f6e(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}zZ.peek=g6e;function zZ(e,t,n,r){const a=f6e(n),i=n.enter("strong"),o=n.createTracker(r),l=o.move(a+a);let c=o.move(n.containerPhrasing(e,{after:a,before:l,...o.current()}));const u=c.charCodeAt(0),d=hj(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(c=$b(u)+c.slice(1));const h=c.charCodeAt(c.length-1),p=hj(r.after.charCodeAt(0),h,a);p.inside&&(c=c.slice(0,-1)+$b(h));const m=o.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},l+c+m}function g6e(e,t,n){return n.options.strong||"*"}function x6e(e,t,n,r){return n.safe(e.value,r)}function b6e(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function y6e(e,t,n){const r=(UZ(n)+(n.options.ruleSpaces?" ":"")).repeat(b6e(n));return n.options.ruleSpaces?r.slice(0,-1):r}const HZ={blockquote:BLe,break:lF,code:VLe,definition:YLe,emphasis:IZ,hardBreak:lF,heading:e6e,html:LZ,image:OZ,imageReference:MZ,inlineCode:DZ,link:FZ,linkReference:BZ,list:c6e,listItem:d6e,paragraph:h6e,root:m6e,strong:zZ,text:x6e,thematicBreak:y6e},uF=document.createElement("i");function DI(e){const t="&"+e+";";uF.innerHTML=t;const n=uF.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function qZ(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}const v6e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function w6e(e){return e.replace(v6e,j6e)}function j6e(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return qZ(n.slice(i?2:1),i?16:10)}return DI(n)||e}function _6e(){return{enter:{table:k6e,tableData:dF,tableHeader:dF,tableRow:E6e},exit:{codeText:S6e,table:N6e,tableData:rE,tableHeader:rE,tableRow:rE}}}function k6e(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function N6e(e){this.exit(e),this.data.inTable=void 0}function E6e(e){this.enter({type:"tableRow",children:[]},e)}function rE(e){this.exit(e)}function dF(e){this.enter({type:"tableCell",children:[]},e)}function S6e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,C6e));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function C6e(e,t){return t==="|"?t:e}function T6e(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` 161`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:o,tableCell:c,tableRow:l}};function o(m,g,x,b){return u(d(m,x,b),m.align)}function l(m,g,x,b){const y=h(m,x,b),v=u([y]);return v.slice(0,v.indexOf(` 162`))}function c(m,g,x,b){const y=x.enter("tableCell"),v=x.enter("phrasing"),w=x.containerPhrasing(m,{...b,before:i,after:i});return v(),y(),w}function u(m,g){return $Le(m,{align:g,alignDelimiters:r,padding:n,stringLength:a})}function d(m,g,x){const b=m.children;let y=-1;const v=[],w=g.enter("table");for(;++y<b.length;)v[y]=h(b[y],g,x);return w(),v}function h(m,g,x){const b=m.children;let y=-1;const v=[],w=g.enter("tableRow");for(;++y<b.length;)v[y]=c(b[y],m,g,x);return w(),v}function p(m,g,x){let b=HZ.inlineCode(m,g,x);return x.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function A6e(){return{exit:{taskListCheckValueChecked:hF,taskListCheckValueUnchecked:hF,paragraph:I6e}}}function R6e(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:P6e}}}function hF(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function I6e(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let i=-1,o;for(;++i<a.length;){const l=a[i];if(l.type==="paragraph"){o=l;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function P6e(e,t,n,r){const a=e.children[0],i=typeof e.checked=="boolean"&&a&&a.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(o);let c=HZ.listItem(e,t,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function L6e(){return[oLe(),CLe(),ILe(),_6e(),A6e()]}function O6e(e){return{extensions:[lLe(),TLe(e),PLe(),T6e(e),R6e()]}}function Si(e,t,n,r){const a=e.length;let i=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Bi(e,t){return e.length>0?(Si(e,e.length,0,t),e):t}const pF={}.hasOwnProperty;function WZ(e){const t={};let n=-1;for(;++n<e.length;)M6e(t,e[n]);return t}function M6e(e,t){let n;for(n in t){const a=(pF.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){pF.call(a,o)||(a[o]=[]);const l=i[o];D6e(a[o],Array.isArray(l)?l:l?[l]:[])}}}function D6e(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Si(e,0,0,r)}const $6e={tokenize:q6e,partial:!0},VZ={tokenize:W6e,partial:!0},GZ={tokenize:V6e,partial:!0},YZ={tokenize:G6e,partial:!0},F6e={tokenize:Y6e,partial:!0},KZ={name:"wwwAutolink",tokenize:z6e,previous:JZ},XZ={name:"protocolAutolink",tokenize:H6e,previous:QZ},_c={name:"emailAutolink",tokenize:U6e,previous:ZZ},wl={};function B6e(){return{text:wl}}let nd=48;for(;nd<123;)wl[nd]=_c,nd++,nd===58?nd=65:nd===91&&(nd=97);wl[43]=_c;wl[45]=_c;wl[46]=_c;wl[95]=_c;wl[72]=[_c,XZ];wl[104]=[_c,XZ];wl[87]=[_c,KZ];wl[119]=[_c,KZ];function U6e(e,t,n){const r=this;let a,i;return o;function o(h){return!c3(h)||!ZZ.call(r,r.previous)||$I(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(h))}function l(h){return c3(h)?(e.consume(h),l):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(F6e,d,u)(h):h===45||h===95||ba(h)?(i=!0,e.consume(h),c):d(h)}function u(h){return e.consume(h),a=!0,c}function d(h){return i&&a&&La(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function z6e(e,t,n){const r=this;return a;function a(o){return o!==87&&o!==119||!JZ.call(r,r.previous)||$I(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check($6e,e.attempt(VZ,e.attempt(GZ,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function H6e(e,t,n){const r=this;let a="",i=!1;return o;
vendor: 4,368 bytes, line 162
162function o(h){return(h===72||h===104)&&QZ.call(r,r.previous)&&!$I(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(h),e.consume(h),l):n(h)}function l(h){if(La(h)&&a.length<5)return a+=String.fromCodePoint(h),e.consume(h),l;if(h===58){const p=a.toLowerCase();if(p==="http"||p==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),i?u:(i=!0,c)):n(h)}function u(h){return h===null||dj(h)||yn(h)||Mh(h)||xk(h)?n(h):e.attempt(VZ,e.attempt(GZ,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function q6e(e,t,n){let r=0;return a;function a(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),a):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function W6e(e,t,n){let r,a,i;return o;function o(u){return u===46||u===95?e.check(YZ,c,l)(u):u===null||yn(u)||Mh(u)||u!==45&&xk(u)?c(u):(i=!0,e.consume(u),o)}function l(u){return u===95?r=!0:(a=r,r=void 0),e.consume(u),o}function c(u){return a||r||!i?n(u):t(u)}}function V6e(e,t){let n=0,r=0;return a;function a(o){return o===40?(n++,e.consume(o),a):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(YZ,t,i)(o):o===null||yn(o)||Mh(o)?t(o):(e.consume(o),a)}function i(o){return o===41&&r++,e.consume(o),a}}function G6e(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),i):l===93?(e.consume(l),a):l===60||l===null||yn(l)||Mh(l)?t(l):n(l)}function a(l){return l===null||l===40||l===91||yn(l)||Mh(l)?t(l):r(l)}function i(l){return La(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),r):La(l)?(e.consume(l),o):n(l)}}function Y6e(e,t,n){return r;function r(i){return e.consume(i),a}function a(i){return ba(i)?n(i):t(i)}}function JZ(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||yn(e)}function QZ(e){return!La(e)}function ZZ(e){return!(e===47||c3(e))}function c3(e){return e===43||e===45||e===46||e===95||ba(e)}function $I(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function Gf(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&ba(e.charCodeAt(n+1))&&ba(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function bk(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const u3={name:"attention",resolveAll:K6e,tokenize:X6e};function K6e(e,t){let n=-1,r,a,i,o,l,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},p={...e[n][1].start};mF(h,-c),mF(p,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Bi(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Bi(u,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Bi(u,bk(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Bi(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",a,t]]
vendor: 4,482 bytes, line 162
162),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Bi(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Si(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function X6e(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=hf(r);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),d=hf(c),h=!d||d===2&&a||n.includes(c),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(a||!p)),u._close=!!(i===42?p:p&&(d||!h)),t(c)}}function mF(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const J6e={name:"autolink",tokenize:Q6e};function Q6e(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return La(m)?(e.consume(m),o):m===64?n(m):u(m)}function o(m){return m===43||m===45||m===46||ba(m)?(r=1,l(m)):u(m)}function l(m){return m===58?(e.consume(m),r=0,c):(m===43||m===45||m===46||ba(m))&&r++<32?(e.consume(m),l):(r=0,u(m))}function c(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||dj(m)?n(m):(e.consume(m),c)}function u(m){return m===64?(e.consume(m),d):ZPe(m)?(e.consume(m),u):n(m)}function d(m){return ba(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||ba(m))&&r++<63){const g=m===45?p:h;return e.consume(m),g}return n(m)}}function Us(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Os(c)?(e.enter(n),l(c)):t(c)}function l(c){return Os(c)&&i++<a?(e.consume(c),l):(e.exit(n),t(c))}}const M0={partial:!0,tokenize:Z6e};function Z6e(e,t,n){return r;function r(i){return Os(i)?Us(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||rs(i)?t(i):n(i)}}const eee={continuation:{tokenize:tOe},exit:sOe,name:"blockQuote",tokenize:eOe};function eOe(e,t,n){const r=this;return a;function a(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Os(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function tOe(e,t,n){const r=this;return a;function a(o){return Os(o)?Us(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(eee,t,n)(o)}}function sOe(e){e.exit("blockQuote")}const tee={name:"characterEscape",tokenize:nOe};function nOe(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return tLe(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const see={name:"characterReference",tokenize:rOe};function rOe(e,t,n){const r=this;let a=0,i,o;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=ba,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=eLe,d):(e.enter("characterReferenceValue"),i=7,o=l3,d(h))}function d(h){if(h===59&&a){const p=e.exit("characterReferenceValue");return o===ba&&!DI(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&a++<i?(e.consume(h),d):n(h)}}const fF={partial:!0,tokenize:iOe},gF={concrete:!0,name:"codeFenced",tokenize:aOe};function aOe(e,t,n){const r=this,a={partial:!0,tokenize:E};let i=0,o=0,l;return c;function c(S){return u(S)}function u(S){const _=r.events[r.events.length-1];return i=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,l=S,e.enter("co
162deFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(S)}function d(S){return S===l?(o++,e.consume(S),d):o<3?n(S):(e.exit("codeFencedFenceSequence"),Os(S)?Us(e,h,"whitespace")(S):h(S))}function h(S){return S===null||rs(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(fF,x,j)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===null||rs(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(S)):Os(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Us(e,m,"whitespace")(S)):S===96&&S===l?n(S):(e.consume(S),p)}function m(S){return S===null||rs(S)?h(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||rs(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(S)):S===96&&S===l?n(S):(e.consume(S),g)}function x(S){return e.attempt(a,j,b)(S)}function b(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),y}function y(S){return i>0&&Os(S)?Us(e,v,"linePrefix",i+1)(S):v(S)}function v(S){return S===null||rs(S)?e.check(fF,x,j)(S):(e.enter("codeFlowValue"),w(S))}function w(S){return S===null||rs(S)?(e.exit("codeFlowValue"),v(S)):(e.consume(S),w)}function j(S){return e.exit("codeFenced"),t(S)}function E(S,_,k){let C=0;return N;function N(O){return S.enter("lineEnding"),S.consume(O),S.exit("lineEnding"),A}function A(O){return S.enter("codeFencedFence"),Os(O)?Us(S,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):T(O)}function T(O){return O===l?(S.enter("codeFencedFenceSequence"),I(O)):k(O)}function I(O){return O===l?(C++,S.consume(O),I):C>=o?(S.exit("codeFencedFenceSequence"),Os(O)?Us(S,$,"whitespace")(O):$(O)):k(O)}function $(O){return O===null||rs(O)?(S.exit("codeFencedFence"),_(O)):k(O)}}}function iOe(e,t,n){const r=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const aE={name:"codeIndented",tokenize:lOe},oOe={partial:!0,tokenize:cOe};function lOe(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Us(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):rs(u)?e.attempt(oOe,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||rs(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function cOe(e,t,n){const r=this;return a;function a(o){return r.parser.lazy[r.now().line]?n(o):rs(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):Us(e,i,"linePrefix",5)(o)}function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):rs(o)?a(o):n(o)}}const uOe={name:"codeText",previous:hOe,resolve:dOe,tokenize:pOe};function dOe(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function hOe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function pOe(e,t,n){let r=0,a,i;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),r++,l):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(i=e.enter("codeTextSequence"),a=0,d(h)):rs(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||rs(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class mOe{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Cg(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Cg(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Cg(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Cg(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Cg(this.left,n.reverse())}}}function Cg(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function nee(e){const t={};let n=-1,r,a,i,o,l,c,u;const d=new mOe(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,fOe(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(r[1].end={...d.get(a)[1].start},l=d.slice(a,n),l.unshift(r),d.splice(a,n-a+1,l))}}return Si(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function fOe(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let d,h,p=-1,m=n,g=0,x=0;const b=[x];for(;m;){for(;e.get(++a)[1]!==m;);i.push(a),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),h&&o.defineSki
vendor: 27,300 bytes, line 162
162p(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(x=p+1,b.push(x),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(o.events=[],m?(m._tokenizer=void 0,m.previous=void 0):b.pop(),p=b.length;p--;){const y=l.slice(b[p],b[p+1]),v=i.pop();c.push([v,v+y.length-1]),e.splice(v,2,y)}for(c.reverse(),p=-1;++p<c.length;)u[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return u}const gOe={resolve:bOe,tokenize:yOe},xOe={partial:!0,tokenize:vOe};function bOe(e){return nee(e),e}function yOe(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?i(l):rs(l)?e.check(xOe,o,i)(l):(e.consume(l),a)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function vOe(e,t,n){const r=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Us(e,i,"linePrefix")}function i(o){if(o===null||rs(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function ree(e,t,n,r,a,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(y){return y===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(y),e.exit(i),p):y===null||y===32||y===41||dj(y)?n(y):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),x(y))}function p(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===62?(e.exit("chunkString"),e.exit(l),p(y)):y===null||y===60||rs(y)?n(y):(e.consume(y),y===92?g:m)}function g(y){return y===60||y===62||y===92?(e.consume(y),m):m(y)}function x(y){return!d&&(y===null||y===41||yn(y))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(y)):d<u&&y===40?(e.consume(y),d++,x):y===41?(e.consume(y),d--,x):y===null||y===32||y===40||dj(y)?n(y):(e.consume(y),y===92?b:x)}function b(y){return y===40||y===41||y===92?(e.consume(y),x):x(y)}}function aee(e,t,n,r,a,i){const o=this;let l=0,c;return u;function u(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),d}function d(m){return l>999||m===null||m===91||m===93&&!c||m===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):rs(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||rs(m)||l++>999?(e.exit("chunkString"),d(m)):(e.consume(m),c||(c=!Os(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(e.consume(m),l++,h):h(m)}}function iee(e,t,n,r,a,i){let o;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),o=p===40?41:p,c):n(p)}function c(p){return p===o?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===o?(e.exit(i),c(o)):p===null?n(p):rs(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Us(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===o||p===null||rs(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===o||p===92?(e.consume(p),d):d(p)}}function qx(e,t){let n;return r;function r(a){return rs(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Os(a)?Us(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const wOe={name:"definition",tokenize:_Oe},jOe={partial:!0,tokenize:kOe};function _Oe(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),o(m)}function o(m){return aee.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function l(m){return a=ko(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),c):n(m)}function c(m){return yn(m)?qx(e,u)(m):u(m)}function u(m){return ree(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(jOe,h,h)(m)}function h(m){return Os(m)?Us(e,p,"whitespace")(m):p(m)}function p(m){return m===null||rs(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function kOe(e,t,n){return r;function r(l){return yn(l)?qx(e,a)(l):n(l)}function a(l){return iee(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Os(l)?Us(e,o,"whitespace")(l):o(l)}function o(l){return l===null||rs(l)?t(l):n(l)}}const NOe={name:"hardBreakEscape",tokenize:EOe};function EOe(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return rs(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const SOe={name:"headingAtx",resolve:COe,tokenize:TOe};function COe(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Si(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function TOe(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||yn(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||rs(d)?(e.exit("atxHeading"),t(d)):Os(d)?Us(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||yn(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const AOe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xF=["pre","script","style","textarea"],ROe={concrete:!0,name:"htmlFlow",resolveTo:LOe,tokenize:OOe},IOe={partial:!0,tokenize:DOe},POe={partial:!0,tokenize:MOe};function LOe(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function OOe(e,t,n){const r=this;let a,i,o,l,c;return u;function u(D){return d(D)}function d(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),h}function h(D){return D===33?(e.consume(D),p):D===47?(e.consume(D),i=!0,x):D===63?(e.consume(D),a=3,r.interrupt?t:M):La(D)?(e.consume(D),o=String.fromCharCode(D),b):n(D)}function p(D){return D===45?(e.consume(D),a=2,m):D===91?(e.consume(D),a=5,l=0,g):La(D)?(e.consume(D),a=4,r.interrupt?t:M):n(D)}function m(D){return D===45?(e.consume(D),r.interrupt?t:M):n(D)}function g(D){const Z="CDATA[";return D===Z.charCodeAt(l++)?(e.consume(D),l===Z.length?r.interrupt?t:T:g):n(D)}function x(D){return La(D)?(e.consume(D),o=String.fromCharCode(D),b):n(D)}function b(D){if(D===null||D===47||D===62||yn(D)){const Z=D===47,V=o.toLowerCase();return!Z&&!i&&xF.includes(V)?(a=1,r.interrupt?t(D):T(D)):AOe.includes(o.toLowerCase())?(a=6,Z?(e.consume(D),y):r.interrupt?t(D):T(D)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(D):i?v(D):w(D))}return D===45||ba(D)?(e.consume(D),o+=String.fromCharCode(D),b):n(D)}function y(D){return D===62?(e.consume(D),r.interrupt?t:T):n(D)}function v(D){return Os(D)?(e.consume(D),v):N(D)}function w(D){return D===47?(e.consume(D),N):D===58||D===95||La(D)?(e.consume(D),j):Os(D)?(e.consume(D),w):N(D)}function j(D){return D===45||D===46||D===58||D===95||ba(D)?(e.consume(D),j):E(D)}function E(D){return D===61?(e.consume(D),S):Os(D)?(e.consume(D),E):w(D)}function S(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),c=D,_):Os(D)?(e.consume(D),S):k(D)}function _(D){return D===c?(e.consume(D),c=null,C):D===null||rs(D)?n(D):(e.consume(D),_)}function k(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||yn(D)?E(D):(e.consume(D),k)}function C(D){return D===47||D===62||Os(D)?w(D):n(D)}function N(D){return D===62?(e.consume(D),A):n(D)}function A(D){return D===null||rs(D)?T(D):Os(D)?(e.consume(D),A):n(D)}function T(D){return D===45&&a===2?(e.consume(D),U):D===60&&a===1?(e.consume(D),F):D===62&&a===4?(e.consume(D),z):D===63&&a===3?(e.consume(D),M):D===93&&a===5?(e.consume(D),G):rs(D)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(IOe,W,I)(D)):D===null||rs(D)?(e.exit("htmlFlowData"),I(D)):(e.consume(D),T)}function I(D){return e.check(POe,$,W)(D)}function $(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),O}function O(D){return D===null||rs(D)?I(D):(e.enter("htmlFlowData"),T(D))}function U(D){return D===45?(e.consume(D),M):T(D)}function F(D){return D===47?(e.consume(D),o="",H):T(D)}function H(D){if(D===62){const Z=o.toLowerCase();return xF.includes(Z)?(e.consume(D),z):T(D)}return La(D)&&o.length<8?(e.consume(D),o+=String.fromCharCode(D),H):T(D)}function G(D){return D===93?(e.consume(D),M):T(D)}function M(D){return D===62?(e.consume(D),z):D===45&&a===2?(e.consume(D),M):T(D)}function z(D){return D===null||rs(D)?(e.exit("htmlFlowData"),W(D)):(e.consume(D),z)}function W(D){return e.exit("htmlFlow"),t(D)}}function MOe(e,t,n){const r=this;return a;function a(o){return rs(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function DOe(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(M0,t,n)}}const $Oe={name:"htmlText",tokenize:FOe};function FOe(e,t,n){const r=this;let a,i,o;return l;function l(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),c}function c(M){return M===33?(e.consume(M),u):M===47?(e.consume(M),E):M===63?(e.consume(M),w):La(M)?(e.consume(M),k):n(M)}function u(M){return M===45?(e.consume(M),d):M===91?(e.consume(M),i=0,g):La(M)?(e.consume(M),v):n(M)}function d(M){return M===45?(e.consume(M),m):n(M)}function h(M){return M===null?n(M):M===45?(e.consume(M),p):rs(M)?(o=h,F(M)):(e.consume(M),h)}function p(M){return M===45?(e.consume(M),m):h(M)}function m(M){return M===62?U(M):M===45?p(M):h(M)}function g(M){const z="CDATA[";return M===z.charCodeAt(i++)?(e.consume(M),i===z.length?x:g):n(M)}function x(M){return M===null?n(M):M===93?(e.consume(M),b):rs(M)?(o=x,F(M)):(e.consume(M),x)}function b(M){return M===93?(e.consume(M),y):x(M)}function y(M){return M===62?U(M):M===93?(e.consume(M),y):x(M)}function v(M){return M===null||M===62?U(M):rs(M)?(o=v,F(M)):(e.consume(M),v)}function w(M){return M===null?n(M):M===63?(e.consume(M),j):rs(M)?(o=w,F(M)):(e.consume(M),w)}function j(M){return M===62?U(M):w(M)}function E(M){return La(M)?(e.consume(M),S):n(M)}function S(M){return M===45||ba(M)?(e.consume(M),S):_(M)}function _(M){return rs(M)?(o=_,F(M)):Os(M)?(e.consume(M),_):U(M)}function k(M){return M===45||ba(M)?(e.consume(M),k):M===47||M===62||yn(M)?C(M):n(M)}function C(M){return M===47?(e.consume(M),U):M===58||M===95||La(M)?(e.consume(M),N):rs(M)?(o=C,F(M)):Os(M)?(e.consume(M),C):U(M)}function N(M){return M===45||M===46||M===58||M===95||ba(M)?(e.consume(M),N):A(M)}function A(M){return M===61?(e.consume(M),T):rs(M)?(o=A,F(M)):Os(M)?(e.consume(M),A):C(M)}function T(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),a=M,I):rs(M)?(o=T,F(M)):Os(M)?(e.consume(M),T):(e.consume(M),$)}function I(M){return M===a?(e.consume(M),a=void 0,O):M===null?n(M):rs(M)?(o=I,F(M)):(e.consume(M),I)}function $(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||yn(M)?C(M):(e.consume(M),$)}function O(M){return M===47||M===62||yn(M)?C(M):n(M)}function U(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function F(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),H}function H(M){return Os(M)?Us(e,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):G(M)}function G(M){return e.enter("htmlTextData"),o(M)}}const FI={name:"labelEnd",resolveAll:HOe,resolveTo:qOe,tokenize:WOe},BOe={tokenize:VOe},UOe={tokenize:GOe},zOe={tokenize:YOe};function HOe(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&Si(e,0,e.length,n),e}function qOe(e,t){let n=e.length,r=0,a,i,o,l;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=Bi(l,e.slice(i+1,i+r+3)),l=Bi(l,[["enter",d,t]]),l=Bi(l,bk(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=Bi(l,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),l=Bi(l,e.slice(o+1)),l=Bi(l,[["exit",c,t]]),Si(e,i,e.length,l),e}function WOe(e,t,n){const r=this;let a=r.events.length,i,o;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return l;function l(p){return i?i._inactive?h(p):(o=r.parser.defined.includes(ko(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(BOe,d,o?d:h)(p):p===91?e.attempt(UOe,d,o?u:h)(p):o?d(p):h(p)}function u(p){return e.attempt(zOe,d,h)(p)}function d(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function VOe(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return yn(h)?qx(e,i)(h):i(h)}function i(h){return h===41?d(h):ree(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return yn(h)?qx(e,c)(h):d(h)}function l(h){return n(h)}function c(h){return h===34||h===39||h===40?iee(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return yn(h)?qx(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function GOe(e,t,n){const r=this;return a;function a(l){return aee.call(r,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(ko(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function YOe(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const KOe={name:"labelStartImage",resolveAll:FI.resolveAll,tokenize:XOe};function XOe(e,t,n){const r=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const JOe={name:"labelStartLink",resolveAll:FI.resolveAll,tokenize:QOe};function QOe(e,t,n){const r=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const iE={name:"lineEnding",tokenize:ZOe};function ZOe(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Us(e,t,"linePrefix")}}const E1={name:"thematicBreak",tokenize:eMe};function eMe(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return a=u,l(u)}function l(u){return u===a?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||rs(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===a?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Os(u)?Us(e,l,"whitespace")(u):l(u))}}const Xa={continuation:{tokenize:rMe},exit:iMe,name:"list",tokenize:nMe},tMe={partial:!0,tokenize:oMe},sMe={partial:!0,tokenize:aMe};function nMe(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return l;function l(m){const g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:l3(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(E1,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(m)}return n(m)}function c(m){return l3(m)&&++o<10?(e.consume(m),c):(!r.interrupt||o<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(M0,r.interrupt?n:d,e.attempt(tMe,p,h))}function d(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function h(m){return Os(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function rMe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(M0,a,i);function a(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Us(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Os(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(sMe,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Us(e,e.attempt(Xa,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function aMe(e,t,n){const r=this;return Us(e,a,"listItemIndent",r.containerState.size+1);function a(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function iMe(e){e.exit(this.containerState.type)}function oMe(e,t,n){const r=this;return Us(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=r.events[r.events.length-1];return!Os(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const bF={name:"setextUnderline",resolveTo:lMe,tokenize:cMe};function lMe(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function cMe(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),a=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===a?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Os(u)?Us(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||rs(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const uMe={tokenize:bMe,partial:!0};function dMe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fMe,continuation:{tokenize:gMe},exit:xMe}},text:{91:{name:"gfmFootnoteCall",tokenize:mMe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:hMe,resolveTo:pMe}}}}function hMe(e,t,n){const r=this;let a=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;a--;){const c=r.events[a][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const u=ko(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function pMe(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function mMe(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return l;function l(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(h){if(i>999||h===93&&!o||h===null||h===91||yn(h))return n(h);if(h===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return a.includes(ko(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return yn(h)||(o=!0),i++,e.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(e.consume(h),i++,u):u(h)}}function fMe(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(o>999||g===93&&!l||g===null||g===91||yn(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return i=ko(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return yn(g)||(l=!0),o++,e.consume(g),g===92?h:d}function h(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function p(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),a.includes(i)||a.push(i),Us(e,m,"gfmFootnoteDefinitionWhitespace")):n(g)}function m(g){return t(g)}}function gMe(e,t,n){return e.check(M0,t,e.attempt(uMe,t,n))}function xMe(e){e.exit("gfmFootnoteDefinition")}function bMe(e,t,n){const r=this;return Us(e,a,"gfmFootnoteDefinitionIndent",5);function a(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function yMe(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},h={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},p=[["enter",d,l],["enter",o[u][1],l],["exit",o[u][1],l],["enter",h,l]],m=l.parser.constructs.insideSpan.null;m&&Si(p,p.length,0,bk(m,o.slice(u+1,c),l)),Si(p,p.length,0,[["exit",h,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",d,l]]),Si(o,u-1,c-u+3,p),c=u+p.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,l,c){const u=this.previous,d=this.events;let h=0;return p;function p(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(g):(o.enter("strikethroughSequenceTemporary"),m(g))}function m(g){const x=hf(u);if(g===126)return h>1?c(g):(o.consume(g),h++,m);if(h<2&&!n)return c(g);const b=o.exit("strikethroughSequenceTemporary"),y=hf(g);return b._open=!y||y===2&&!!x,b._close=!x||x===2&&!!y,l(g)}}}class vMe{constructor(){this.map=[]}add(t,n,r){wMe(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];
vendor: 6,878 bytes, line 162
162r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const i of a)t.push(i);a=r.pop()}this.map.length=0}}function wMe(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function jMe(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function _Me(){return{flow:{null:{name:"table",tokenize:kMe,resolveAll:NMe}}}}function kMe(e,t,n){const r=this;let a=0,i=0,o;return l;function l(N){let A=r.events.length-1;for(;A>-1;){const $=r.events[A][1].type;if($==="lineEnding"||$==="linePrefix")A--;else break}const T=A>-1?r.events[A][1].type:null,I=T==="tableHead"||T==="tableRow"?S:c;return I===S&&r.parser.lazy[r.now().line]?n(N):I(N)}function c(N){return e.enter("tableHead"),e.enter("tableRow"),u(N)}function u(N){return N===124||(o=!0,i+=1),d(N)}function d(N){return N===null?n(N):rs(N)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),m):n(N):Os(N)?Us(e,d,"whitespace")(N):(i+=1,o&&(o=!1,a+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(N)))}function h(N){return N===null||N===124||yn(N)?(e.exit("data"),d(N)):(e.consume(N),N===92?p:h)}function p(N){return N===92||N===124?(e.consume(N),h):h(N)}function m(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),o=!1,Os(N)?Us(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):g(N))}function g(N){return N===45||N===58?b(N):N===124?(o=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),x):E(N)}function x(N){return Os(N)?Us(e,b,"whitespace")(N):b(N)}function b(N){return N===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),y):N===45?(i+=1,y(N)):N===null||rs(N)?j(N):E(N)}function y(N){return N===45?(e.enter("tableDelimiterFiller"),v(N)):E(N)}function v(N){return N===45?(e.consume(N),v):N===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(N))}function w(N){return Os(N)?Us(e,j,"whitespace")(N):j(N)}function j(N){return N===124?g(N):N===null||rs(N)?!o||a!==i?E(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):E(N)}function E(N){return n(N)}function S(N){return e.enter("tableRow"),_(N)}function _(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),_):N===null||rs(N)?(e.exit("tableRow"),t(N)):Os(N)?Us(e,_,"whitespace")(N):(e.enter("data"),k(N))}function k(N){return N===null||N===124||yn(N)?(e.exit("data"),_(N)):(e.consume(N),N===92?C:k)}function C(N){return N===92||N===124?(e.consume(N),k):k(N)}}function NMe(e,t){let n=-1,r=!0,a=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,u,d,h;const p=new vMe;for(;++n<e.length;){const m=e[n],g=m[1];m[0]==="enter"?g.type==="tableHead"?(l=!1,c!==0&&(yF(p,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,h=void 0,i=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(n,0,[["enter",d,t]])),a=g.type==="tableDelimiterRow"?2:d?3:1):a&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],h=qy(p,t,i,a,void 0,h),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],h=qy(p,t,i,a,void 0,h)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(l=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],h=qy(p,t,i,a,n,h)):o[1]!==0&&(h=qy(p,t,o,a,n,h)),a=0):a&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&yF(p,t,c,u,d),p.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=jMe(t.events,n))}return e}function qy(e,t,n,r,a,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},tm(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=tm(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=tm(t.events,n[2]),d=tm(t.events,n[3]),h={type:l,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const p=t.events[n[2]],m=t.events[n[3]];if(p[1].end=Object.assign({},m[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,x=n[3]-n[2]-1;e.add(g,x,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return a!==void 0&&(i.end=Object.assign({},tm(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function yF(e,t,n,r,a){const i=[],o=tm(t.events,n);a&&(a.end=Object.assign({},o),i.push(["exit",a,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function tm(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const EMe={name:"tasklistCheck",tokenize:CMe};function SMe(){return{text:{91:EMe}}}function CMe(e,t,n){const r=this;return a;function a(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return yn(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return rs(c)?t(c):Os(c)?e.check({tokenize:TMe},t,n)(c):n(c)}}function TMe(e,t,n){return Us(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function AMe(e){return WZ([B6e(),dMe(),yMe(e),_Me(),SMe()])}const RMe={};function IMe(e){const t=this,n=e||RMe,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(AMe(n)),i.push(L6e()),o.push(O6e(n))}var PMe=Object.defineProperty,LMe=Object.defineProperties,OMe=Object.getOwnPropertyDescriptors,vF=Object.getOwnPropertySymbols,MMe=Object.prototype.hasOwnProperty,DMe=Object.prototype.propertyIsEnumerable,wF=(e,t,n)=>t in e?PMe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oee=(e,t)=>
162{for(var n in t||(t={}))MMe.call(t,n)&&wF(e,n,t[n]);if(vF)for(var n of vF(t))DMe.call(t,n)&&wF(e,n,t[n]);return e},lee=(e,t)=>LMe(e,OMe(t)),Ua=(e,t)=>{let n=!1,r=!1;for(let a=0;a<t;a+=1){if(e[a]==="\\"&&a+1<e.length&&e[a+1]==="`"){a+=1;continue}if(e.substring(a,a+3)==="```"){r=!r,a+=2;continue}!r&&e[a]==="`"&&(n=!n)}return n||r},$Me=(e,t)=>{let n=e.substring(t,t+3)==="```",r=t>0&&e.substring(t-1,t+2)==="```",a=t>1&&e.substring(t-2,t+1)==="```";return n||r||a},FMe=e=>{let t=0;for(let n=0;n<e.length;n+=1){if(e[n]==="\\"&&n+1<e.length&&e[n+1]==="`"){n+=1;continue}e[n]==="`"&&!$Me(e,n)&&(t+=1)}return t},Tu=(e,t)=>{let n=!1,r=!1,a=-1;for(let i=0;i<e.length;i+=1){if(e[i]==="\\"&&i+1<e.length&&e[i+1]==="`"){i+=1;continue}if(e.substring(i,i+3)==="```"){r=!r,i+=2;continue}if(!r&&e[i]==="`")if(n){if(a<t&&t<i)return!0;n=!1,a=-1}else n=!0,a=i}return!1},BMe=/^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm,UMe=e=>!e||typeof e!="string"||!e.includes(">")?e:e.replace(BMe,(t,n,r,a)=>Ua(e,a)?t:`${n}\\>${r}`),zMe=/(\*\*)([^*]*\*?)$/,HMe=/(__)([^_]*?)$/,qMe=/(\*\*\*)([^*]*?)$/,WMe=/(\*)([^*]*?)$/,VMe=/(_)([^_]*?)$/,GMe=/(`)([^`]*?)$/,YMe=/(~~)([^~]*?)$/,Zh=/^[\s_~*`]*$/,cee=/^[\s]*[-*+][\s]+$/,KMe=/[\p{L}\p{N}_]/u,XMe=/^```[^`\n]*```?$/,JMe=/^\*{4,}$/,QMe=/(__)([^_]+)_$/,ZMe=/(~~)([^~]+)~$/,jF=/~~/g,Au=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95?!0:KMe.test(e)},eDe=(e,t)=>{let n=1;for(let r=t-1;r>=0;r-=1)if(e[r]==="]")n+=1;else if(e[r]==="["&&(n-=1,n===0))return r;return-1},uee=(e,t)=>{let n=1;for(let r=t+1;r<e.length;r+=1)if(e[r]==="[")n+=1;else if(e[r]==="]"&&(n-=1,n===0))return r;return-1},yk=(e,t)=>{let n=!1,r=!1;for(let a=0;a<e.length&&a<t;a+=1){if(e[a]==="\\"&&e[a+1]==="$"){a+=1;continue}e[a]==="$"&&(e[a+1]==="$"?(r=!r,a+=1,n=!1):r||(n=!n))}return n||r},tDe=(e,t)=>{for(let n=t;n<e.length;n+=1){if(e[n]===")")return!0;if(e[n]===` 163`)return!1}return!1},dee=(e,t)=>{for(let n=t-1;n>=0;n-=1){if(e[n]===")")return!1;if(e[n]==="(")return n>0&&e[n-1]==="]"?tDe(e,t):!1;if(e[n]===` 164`)return!1}return!1},sDe=(e,t)=>{for(let n=t-1;n>=0;n-=1){if(e[n]===">")return!1;if(e[n]==="<"){let r=n+1<e.length?e[n+1]:"";return r>="a"&&r<="z"||r>="A"&&r<="Z"||r==="/"}if(e[n]===` 165`)return!1}return!1},BI=(e,t,n)=>{let r=0;for(let c=t-1;c>=0;c-=1)if(e[c]===` 166`){r=c+1;break}let a=e.length;for(let c=t;c<e.length;c+=1)if(e[c]===` 167`){a=c;break}let i=e.substring(r,a),o=0,l=!1;for(let c of i)if(c===n)o+=1;else if(c!==" "&&c!==" "){l=!0;break}return o>=3&&!l},nDe=(e,t,n,r)=>n==="\\"||e.includes("$")&&yk(e,t)?!0:n!=="*"&&r==="*"?(t<e.length-2?e[t+2]:"")!=="*":!!(n==="*"||n&&r&&Au(n)&&Au(r)||(!n||n===" "||n===" "||n===` 168`)&&(!r||r===" "||r===" "||r===` 169`)),hee=e=>{let t=0,n=!1,r=e.length;for(let a=0;a<r;a+=1){if(e[a]==="`"&&a+2<r&&e[a+1]==="`"&&e[a+2]==="`"){n=!n,a+=2;continue}if(n||e[a]!=="*")continue;let i=a>0?e[a-1]:"",o=a<r-1?e[a+1]:"";nDe(e,a,i,o)||(t+=1)}return t},rDe=(e,t,n,r)=>!!(n==="\\"||e.includes("$")&&yk(e,t)||dee(e,t)||sDe(e,t)||n==="_"||r==="_"||n&&r&&Au(n)&&Au(r)),aDe=e=>{let t=0,n=!1,r=e.length;for(let a=0;a<r;a+=1){if(e[a]==="`"&&a+2<r&&e[a+1]==="`"&&e[a+2]==="`"){n=!n,a+=2;continue}if(n||e[a]!=="_")continue;let i=a>0?e[a-1]:"",o=a<r-1?e[a+1]:"";rDe(e,a,i,o)||(t+=1)}return t},iDe=e=>{let t=0,n=0,r=!1;for(let a=0;a<e.length;a+=1){if(e[a]==="`"&&a+2<e.length&&e[a+1]==="`"&&e[a+2]==="`"){n>=3&&(t+=Math.floor(n/3)),n=0,r=!r,a+=2;continue}r||(e[a]==="*"?n+=1:(n>=3&&(t+=Math.floor(n/3)),n=0))}return n>=3&&(t+=Math.floor(n/3)),t},UI=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]==="`"&&r+2<e.length&&e[r+1]==="`"&&e[r+2]==="`"){n=!n,r+=2;continue}n||e[r]==="*"&&r+1<e.length&&e[r+1]==="*"&&(t+=1,r+=1)}return t},_F=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]==="`"&&r+2<e.length&&e[r+1]==="`"&&e[r+2]==="`"){n=!n,r+=2;continue}n||e[r]==="_"&&r+1<e.length&&e[r+1]==="_"&&(t+=1,r+=1)}return t},oDe=(e,t,n)=>{if(!t||Zh.test(t))return!0;let r=e.substring(0,n).lastIndexOf(` 170`),a=r===-1?0:r+1,i=e.substring(a,n);return cee.test(i)&&t.includes(` 171`)?!0:BI(e,n,"*")},lDe=e=>{let t=e.match(zMe);if(!t)return e;let n=t[2],r=e.lastIndexOf(t[1]);return Ua(e,r)||Tu(e,r)||oDe(e,n,r)?e:UI(e)%2===1?n.endsWith("*")?`${e}*`:`${e}**`:e},cDe=(e,t,n)=>{if(!t||Zh.test(t))return!0;let r=e.substring(0,n).lastIndexOf(` 172`),a=r===-1?0:r+1,i=e.substring(a,n);return cee.test(i)&&t.includes(` 173`)?!0:BI(e,n,"_")},uDe=e=>{let t=e.match(HMe);if(!t){let a=e.match(QMe);if(a){let i=e.lastIndexOf(a[1]);if(!(Ua(e,i)||Tu(e,i))&&_F(e)%2===1)return`${e}_`}return e}let n=t[2],r=e.lastIndexOf(t[1]);return Ua(e,r)||Tu(e,r)||cDe(e,n,r)?e:_F(e)%2===1?`${e}__`:e},dDe=e=>{let t=!1;for(let n=0;n<e.length;n+=1){if(e[n]==="`"&&n+2<e.length&&e[n+1]==="`"&&e[n+2]==="`"){t=!t,n+=2;continue}if(!t&&e[n]==="*"&&e[n-1]!=="*"&&e[n+1]!=="*"&&e[n-1]!=="\\"&&!yk(e,n)){let r=n>0?e[n-1]:"",a=n<e.length-1?e[n+1]:"";if((!r||r===" "||r===" "||r===` 174`)&&(!a||a===" "||a===" "||a===` 175`)||r&&a&&Au(r)&&Au(a))continue;return n}}return-1},hDe=e=>{if(!e.match(WMe))return e;let t=dDe(e);if(t===-1||Ua(e,t)||Tu(e,t))return e;let n=e.substring(t+1);return!n||Zh.test(n)?e:hee(e)%2===1?`${e}*`:e},pee=e=>{let t=!1;for(let n=0;n<e.length;n+=1){if(e[n]==="`"&&n+2<e.length&&e[n+1]==="`"&&e[n+2]==="`"){t=!t,n+=2;continue}if(!t&&e[n]==="_"&&e[n-1]!=="_"&&e[n+1]!=="_"&&e[n-1]!=="\\"&&!yk(e,n)&&!dee(e,n)){let r=n>0?e[n-1]:"",a=n<e.length-1?e[n+1]:"";if(r&&a&&Au(r)&&Au(a))continue;return n}}return-1},pDe=e=>{let t=e.length;for(;t>0&&e[t-1]===` 176`;)t-=1;if(t<e.length){let n=e.slice(0,t),r=e.slice(t);return`${n}_${r}`}return`${e}_`},mDe=e=>{if(!e.endsWith("**"))return null;let t=e.slice(0,-2);if(UI(t)%2!==1)return null;let n=t.indexOf("**"),r=pee(t);return n!==-1&&r!==-1&&n<r?`${t}_**`:null},fDe=e=>{if(!e.match(VMe))return e;let t=pee(e);
vendor: 5,374 bytes, lines 176-183
176if(t===-1)return e;let n=e.substring(t+1);if(!n||Zh.test(n)||Ua(e,t)||Tu(e,t))return e;if(aDe(e)%2===1){let r=mDe(e);return r!==null?r:pDe(e)}return e},gDe=e=>{let t=UI(e),n=hee(e);return t%2===0&&n%2===0},xDe=(e,t,n)=>!t||Zh.test(t)||Ua(e,n)||Tu(e,n)?!0:BI(e,n,"*"),bDe=e=>{if(JMe.test(e))return e;let t=e.match(qMe);if(!t)return e;let n=t[2],r=e.lastIndexOf(t[1]);return xDe(e,n,r)?e:iDe(e)%2===1?gDe(e)?e:`${e}***`:e},yDe=/<[a-zA-Z/][^>]*$/,vDe=e=>{let t=e.match(yDe);return!t||t.index===void 0||Ua(e,t.index)?e:e.substring(0,t.index).trimEnd()},wDe=e=>!e.match(XMe)||e.includes(` 177`)?null:e.endsWith("``")&&!e.endsWith("```")?`${e}\``:e,jDe=e=>(e.match(/```/g)||[]).length%2===1,_De=e=>{let t=wDe(e);if(t!==null)return t;let n=e.match(GMe);if(n&&!jDe(e)){let r=n[2];if(!r||Zh.test(r))return e;if(FMe(e)%2===1)return`${e}\``}return e},mee=(e,t)=>t>=2&&e.substring(t-2,t+1)==="```"||t>=1&&e.substring(t-1,t+2)==="```"||t<=e.length-3&&e.substring(t,t+3)==="```",kDe=e=>{let t=0,n=!1;for(let r=0;r<e.length-1;r+=1)e[r]==="`"&&!mee(e,r)&&(n=!n),!n&&e[r]==="$"&&e[r+1]==="$"&&(t+=1,r+=1);return t},NDe=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]==="\\"){r+=1;continue}if(e[r]==="`"&&!mee(e,r)){n=!n;continue}!n&&e[r]==="$"&&(r+1<e.length&&e[r+1]==="$"?r+=1:t+=1)}return t},EDe=e=>{if(e.endsWith("$")&&!e.endsWith("$$"))return`${e}$`;let t=e.indexOf("$$");return t!==-1&&e.indexOf(` 178`,t)!==-1&&!e.endsWith(` 179`)?`${e} 180$$`:`${e}$$`},SDe=e=>kDe(e)%2===0?e:EDe(e),CDe=e=>NDe(e)%2===1?`${e}$`:e,TDe=(e,t,n)=>{if(e.substring(t+2).includes(")"))return null;let r=eDe(e,t);if(r===-1||Ua(e,r))return null;let a=r>0&&e[r-1]==="!",i=a?r-1:r,o=e.substring(0,i);if(a)return o;let l=e.substring(r+1,t);return n==="text-only"?`${o}${l}`:`${o}[${l}](streamdown:incomplete-link)`},kF=(e,t)=>{for(let n=0;n<t;n++)if(e[n]==="["&&!Ua(e,n)){if(n>0&&e[n-1]==="!")continue;let r=uee(e,n);if(r===-1)return n;if(r+1<e.length&&e[r+1]==="("){let a=e.indexOf(")",r+2);a!==-1&&(n=a)}}return t},ADe=(e,t,n)=>{let r=t>0&&e[t-1]==="!",a=r?t-1:t;if(!e.substring(t+1).includes("]")){let i=e.substring(0,a);if(r)return i;if(n==="text-only"){let o=kF(e,t);return e.substring(0,o)+e.substring(o+1)}return`${e}](streamdown:incomplete-link)`}if(uee(e,t)===-1){let i=e.substring(0,a);if(r)return i;if(n==="text-only"){let o=kF(e,t);return e.substring(0,o)+e.substring(o+1)}return`${e}](streamdown:incomplete-link)`}return null},fee=(e,t="protocol")=>{let n=e.lastIndexOf("](");if(n!==-1&&!Ua(e,n)){let r=TDe(e,n,t);if(r!==null)return r}for(let r=e.length-1;r>=0;r-=1)if(e[r]==="["&&!Ua(e,r)){let a=ADe(e,r,t);if(a!==null)return a}return e},RDe=/^-{1,2}$/,IDe=/^[\s]*-{1,2}[\s]+$/,PDe=/^={1,2}$/,LDe=/^[\s]*={1,2}[\s]+$/,ODe=e=>{if(!e||typeof e!="string")return e;let t=e.lastIndexOf(` 181`);if(t===-1)return e;let n=e.substring(t+1),r=e.substring(0,t),a=n.trim();if(RDe.test(a)&&!n.match(IDe)){let i=r.split(` 182`).at(-1);if(i&&i.trim().length>0)return`${e}â`}if(PDe.test(a)&&!n.match(LDe)){let i=r.split(` 183`).at(-1);if(i&&i.trim().length>0)return`${e}â`}return e},MDe=new RegExp("(?<=[\\p{L}\\p{N}_])~(?!~)(?=[\\p{L}\\p{N}_])","gu"),DDe=e=>!e||typeof e!="string"||!e.includes("~")?e:e.replace(MDe,(t,n)=>Ua(e,n)?t:"\\~"),$De=e=>{var t,n;let r=e.match(YMe);if(r){let a=r[2];if(!a||Zh.test(a))return e;let i=e.lastIndexOf(r[1]);if(Ua(e,i)||Tu(e,i))return e;if(((t=e.match(jF))==null?void 0:t.length)%2===1)return`${e}~~`}else{let a=e.match(ZMe);if(a){let i=e.lastIndexOf(a[0].slice(0,2));if(Ua(e,i)||Tu(e,i))return e;if(((n=e.match(jF))==null?void 0:n.length)%2===1)return`${e}~`}}return e},oE=e=>e!==!1,FDe=e=>e===!0,Ca={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100},BDe=[{handler:{name:"singleTilde",handle:DDe,priority:Ca.SINGLE_TILDE},optionKey:"singleTilde"},{handler:{name:"comparisonOperators",handle:UMe,priority:Ca.COMPARISON_OPERATORS},optionKey:"comparisonOperators"},{handler:{name:"htmlTags",handle:vDe,priority:Ca.HTML_TAGS},optionKey:"htmlTags"},{handler:{name:"setextHeadings",handle:ODe,priority:Ca.SETEXT_HEADINGS},optionKey:"setextHeadings"},{handler:{name:"links",handle:fee,priority:Ca.LINKS},optionKey:"links",earlyReturn:e=>e.endsWith("](streamdown:incomplete-link)")},{handler:{name:"boldItalic",handle:bDe,priority:Ca.BOLD_ITALIC},optionKey:"boldItalic"},{handler:{name:"bold",handle:lDe,priority:Ca.BOLD},optionKey:"bold"},{handler:{name:"italicDoubleUnderscore",handle:uDe,priority:Ca.ITALIC_DOUBLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"italicSingleAsterisk",handle:hDe,priority:Ca.ITALIC_SINGLE_ASTERISK},optionKey:"italic"},{handler:{name:"italicSingleUnderscore",handle:fDe,priority:Ca.ITALIC_SINGLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"inlineCode",handle:_De,priority:Ca.INLINE_CODE},optionKey:"inlineCode"},{handler:{name:"strikethrough",handle:$De,priority:Ca.STRIKETHROUGH},optionKey:"strikethrough"},{handler:{name:"katex",handle:SDe,priority:Ca.KATEX},optionKey:"katex"},{handler:{name:"inlineKatex",handle:CDe,priority:Ca.INLINE_KATEX},optionKey:"inlineKatex"}],UDe=e=>{var t;let n=(t=e?.linkMode)!=null?t:"protocol";return BDe.filter(({handler:r,optionKey:a})=>r.name==="links"?oE(e?.links)||oE(e?.images):r.name==="inlineKatex"?FDe(e?.inlineK
vendor: 4,222 bytes, line 183
183atex):oE(e?.[a])).map(({handler:r,earlyReturn:a})=>r.name==="links"?{handler:lee(oee({},r),{handle:i=>fee(i,n)}),earlyReturn:n==="protocol"?a:void 0}:{handler:r,earlyReturn:a})},zDe=(e,t)=>{var n;if(!e||typeof e!="string")return e;let r=e.endsWith(" ")&&!e.endsWith(" ")?e.slice(0,-1):e,a=UDe(t),i=((n=t?.handlers)!=null?n:[]).map(l=>{var c;return{handler:lee(oee({},l),{priority:(c=l.priority)!=null?c:Ca.DEFAULT}),earlyReturn:void 0}}),o=[...a,...i].sort((l,c)=>{var u,d;return((u=l.handler.priority)!=null?u:0)-((d=c.handler.priority)!=null?d:0)});for(let{handler:l,earlyReturn:c}of o)if(r=l.handle(r),c!=null&&c(r))return r;return r},HDe=zDe;function gee(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=gee(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function xee(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=gee(e))&&(r&&(r+=" "),r+=t);return r}const qDe=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},WDe=(e,t)=>({classGroupId:e,validator:t}),bee=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),pj="-",NF=[],VDe="arbitrary..",GDe=e=>{const t=KDe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return YDe(o);const l=o.split(pj),c=l[0]===""&&l.length>1?1:0;return yee(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=r[o],u=n[o];return c?u?qDe(u,c):c:u||NF}return n[o]||NF}}},yee=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],i=n.nextPart.get(a);if(i){const u=yee(e,t+1,i);if(u)return u}const o=n.validators;if(o===null)return;const l=t===0?e.join(pj):e.slice(t).join(pj),c=o.length;for(let u=0;u<c;u++){const d=o[u];if(d.validator(l))return d.classGroupId}},YDe=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?VDe+r:void 0})(),KDe=e=>{const{theme:t,classGroups:n}=e;return XDe(n,t)},XDe=(e,t)=>{const n=bee();for(const r in e){const a=e[r];zI(a,n,r,t)}return n},zI=(e,t,n,r)=>{const a=e.length;for(let i=0;i<a;i++){const o=e[i];JDe(o,t,n,r)}},JDe=(e,t,n,r)=>{if(typeof e=="string"){QDe(e,t,n);return}if(typeof e=="function"){ZDe(e,t,n,r);return}e8e(e,t,n,r)},QDe=(e,t,n)=>{const r=e===""?t:vee(t,e);r.classGroupId=n},ZDe=(e,t,n,r)=>{if(t8e(e)){zI(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(WDe(n,e))},e8e=(e,t,n,r)=>{const a=Object.entries(e),i=a.length;for(let o=0;o<i;o++){const[l,c]=a[o];zI(c,vee(t,l),n,r)}},vee=(e,t)=>{let n=e;const r=t.split(pj),a=r.length;for(let i=0;i<a;i++){const o=r[i];let l=n.nextPart.get(o);l||(l=bee(),n.nextPart.set(o,l)),n=l}return n},t8e=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,s8e=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const a=(i,o)=>{n[i]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return a(i,o),o},set(i,o){i in n?n[i]=o:a(i,o)}}},d3="!",EF=":",n8e=[],SF=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),r8e=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const i=[];let o=0,l=0,c=0,u;const d=a.length;for(let x=0;x<d;x++){const b=a[x];if(o===0&&l===0){if(b===EF){i.push(a.slice(c,x)),c=x+1;continue}if(b==="/"){u=x;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const h=i.length===0?a:a.slice(c);let p=h,m=!1;h.endsWith(d3)?(p=h.slice(0,-1),m=!0):h.startsWith(d3)&&(p=h.slice(1),m=!0);const g=u&&u>c?u-c:void 0;return SF(i,m,p,g)};if(t){const a=t+EF,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):SF(n8e,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},a8e=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let i=0;i<n.length;i++){const o=n[i],l=o[0]==="[",c=t.has(o);l||c?(a.length>0&&(a.sort(),r.push(...a),a=[]),r.push(o)):a.push(o)}return a.length>0&&(a.sort(),r.push(...a)),r}},i8e=e=>
vendor: 5,248 bytes, line 183
183({cache:s8e(e.cacheSize),parseClassName:r8e(e),sortModifiers:a8e(e),...GDe(e)}),o8e=/\s+/,l8e=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(o8e);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:h,modifiers:p,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:x}=n(d);if(h){c=d+(c.length>0?" "+c:c);continue}let b=!!x,y=r(b?g.substring(0,x):g);if(!y){if(!b){c=d+(c.length>0?" "+c:c);continue}if(y=r(g),!y){c=d+(c.length>0?" "+c:c);continue}b=!1}const v=p.length===0?"":p.length===1?p[0]:i(p).join(":"),w=m?v+d3:v,j=w+y;if(o.indexOf(j)>-1)continue;o.push(j);const E=a(y,b);for(let S=0;S<E.length;++S){const _=E[S];o.push(w+_)}c=d+(c.length>0?" "+c:c)}return c},c8e=(...e)=>{let t=0,n,r,a="";for(;t<e.length;)(n=e[t++])&&(r=wee(n))&&(a&&(a+=" "),a+=r);return a},wee=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=wee(e[r]))&&(n&&(n+=" "),n+=t);return n},u8e=(e,...t)=>{let n,r,a,i;const o=c=>{const u=t.reduce((d,h)=>h(d),e());return n=i8e(u),r=n.cache.get,a=n.cache.set,i=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=l8e(c,n);return a(c,d),d};return i=o,(...c)=>i(c8e(...c))},d8e=[],jr=e=>{const t=n=>n[e]||d8e;return t.isThemeGetter=!0,t},jee=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,_ee=/^\((?:(\w[\w-]*):)?(.+)\)$/i,h8e=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,p8e=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,m8e=/\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$/,f8e=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,g8e=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,x8e=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rc=e=>h8e.test(e),Ss=e=>!!e&&!Number.isNaN(Number(e)),Ic=e=>!!e&&Number.isInteger(Number(e)),lE=e=>e.endsWith("%")&&Ss(e.slice(0,-1)),Al=e=>p8e.test(e),kee=()=>!0,b8e=e=>m8e.test(e)&&!f8e.test(e),HI=()=>!1,y8e=e=>g8e.test(e),v8e=e=>x8e.test(e),w8e=e=>!Ht(e)&&!Gt(e),j8e=e=>qu(e,See,HI),Ht=e=>jee.test(e),rd=e=>qu(e,Cee,b8e),CF=e=>qu(e,A8e,Ss),_8e=e=>qu(e,Aee,kee),k8e=e=>qu(e,Tee,HI),TF=e=>qu(e,Nee,HI),N8e=e=>qu(e,Eee,v8e),Wy=e=>qu(e,Ree,y8e),Gt=e=>_ee.test(e),Tg=e=>ep(e,Cee),E8e=e=>ep(e,Tee),AF=e=>ep(e,Nee),S8e=e=>ep(e,See),C8e=e=>ep(e,Eee),Vy=e=>ep(e,Ree,!0),T8e=e=>ep(e,Aee,!0),qu=(e,t,n)=>{const r=jee.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ep=(e,t,n=!1)=>{const r=_ee.exec(e);return r?r[1]?t(r[1]):n:!1},Nee=e=>e==="position"||e==="percentage",Eee=e=>e==="image"||e==="url",See=e=>e==="length"||e==="size"||e==="bg-size",Cee=e=>e==="length",A8e=e=>e==="number",Tee=e=>e==="family-name",Aee=e=>e==="number"||e==="weight",Ree=e=>e==="shadow",R8e=()=>{const e=jr("color"),t=jr("font"),n=jr("text"),r=jr("font-weight"),a=jr("tracking"),i=jr("leading"),o=jr("breakpoint"),l=jr("container"),c=jr("spacing"),u=jr("radius"),d=jr("shadow"),h=jr("inset-shadow"),p=jr("text-shadow"),m=jr("drop-shadow"),g=jr("blur"),x=jr("perspective"),b=jr("aspect"),y=jr("ease"),v=jr("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...j(),Gt,Ht],S=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],k=()=>[Gt,Ht,c],C=()=>[Rc,"full","auto",...k()],N=()=>[Ic,"none","subgrid",Gt,Ht],A=()=>["auto",{span:["full",Ic,Gt,Ht]},Ic,Gt,Ht],T=()=>[Ic,"auto",Gt,Ht],I=()=>["auto","min","max","fr",Gt,Ht],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],O=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...k()],F=()=>[Rc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],H=()=>[Rc,"screen","full","dvw","lvw","svw","min","max","fit",...k()],G=()=>[Rc,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],M=()=>[e,Gt,Ht],z=()=>[...j(),AF,TF,{position:[Gt,Ht]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",S8e,j8e,{size:[Gt,Ht]}],Z=()=>[lE,Tg,rd],V=()=>["","none","full",u,Gt,Ht],L=()=>["",Ss,Tg,rd],K=()=>["solid","dashed","dotted","double"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[Ss,lE,AF,TF],Y=()=>["","none",g,Gt,Ht],J=()=>["none",Ss,Gt,Ht],P=()=>["none",Ss,Gt,Ht],ee=()=>[Ss,Gt,Ht],X=()=>[Rc,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Al],breakpoint:[Al],color:[kee],container:[Al],"drop-shadow":[Al],ease:["in","out","in-out"],font:[w8e],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Al],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Al],shadow:[Al],spacing:["px",Ss],text:[Al],"text-shadow":[Al],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Rc,Ht,Gt,b]}
vendor: 6,096 bytes, line 183
183],container:["container"],columns:[{columns:[Ss,Ht,Gt,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:C()}],"inset-x":[{"inset-x":C()}],"inset-y":[{"inset-y":C()}],start:[{"inset-s":C(),start:C()}],end:[{"inset-e":C(),end:C()}],"inset-bs":[{"inset-bs":C()}],"inset-be":[{"inset-be":C()}],top:[{top:C()}],right:[{right:C()}],bottom:[{bottom:C()}],left:[{left:C()}],visibility:["visible","invisible","collapse"],z:[{z:[Ic,"auto",Gt,Ht]}],basis:[{basis:[Rc,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ss,Rc,"auto","initial","none",Ht]}],grow:[{grow:["",Ss,Gt,Ht]}],shrink:[{shrink:["",Ss,Gt,Ht]}],order:[{order:[Ic,"first","last","none",Gt,Ht]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...O(),"normal"]}],"justify-self":[{"justify-self":["auto",...O()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...O(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...O(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...O(),"baseline"]}],"place-self":[{"place-self":["auto",...O()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[l,"screen",...F()]}],"min-w":[{"min-w":[l,"screen","none",...F()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,Tg,rd]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,T8e,_8e]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",lE,Ht]}],"font-family":[{font:[E8e,k8e,t]}],"font-features":[{"font-features":[Ht]}],"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:[a,Gt,Ht]}],"line-clamp":[{"line-clamp":[Ss,"none",Gt,CF]}],leading:[{leading:[i,...k()]}],"list-image":[{"list-image":["none",Gt,Ht]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Gt,Ht]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ss,"from-font","auto",Gt,rd]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Ss,"auto",Gt,Ht]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Gt,Ht]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Gt,Ht]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:z()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ic,Gt,Ht],radial:["",Gt,Ht],conic:[Ic,Gt,Ht]},C8e,N8e]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:Z()}
183],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:L()}],"border-w-x":[{"border-x":L()}],"border-w-y":[{"border-y":L()}],"border-w-s":[{"border-s":L()}],"border-w-e":[{"border-e":L()}],"border-w-bs":[{"border-bs":L()}],"border-w-be":[{"border-be":L()}],"border-w-t":[{"border-t":L()}],"border-w-r":[{"border-r":L()}],"border-w-b":[{"border-b":L()}],"border-w-l":[{"border-l":L()}],"divide-x":[{"divide-x":L()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":L()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}
vendor: 5,720 bytes, line 183
183],"divide-color":[{divide:M()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ss,Gt,Ht]}],"outline-w":[{outline:["",Ss,Tg,rd]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",d,Vy,Wy]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",h,Vy,Wy]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Ss,rd]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":L()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",p,Vy,Wy]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Ss,Gt,Ht]}],"mix-blend":[{"mix-blend":[...te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ss]}],"mask-image-linear-from-pos":[{"mask-linear-from":Q()}],"mask-image-linear-to-pos":[{"mask-linear-to":Q()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":Q()}],"mask-image-t-to-pos":[{"mask-t-to":Q()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":Q()}],"mask-image-r-to-pos":[{"mask-r-to":Q()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":Q()}],"mask-image-b-to-pos":[{"mask-b-to":Q()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":Q()}],"mask-image-l-to-pos":[{"mask-l-to":Q()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":Q()}],"mask-image-x-to-pos":[{"mask-x-to":Q()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":Q()}],"mask-image-y-to-pos":[{"mask-y-to":Q()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Gt,Ht]}],"mask-image-radial-from-pos":[{"mask-radial-from":Q()}],"mask-image-radial-to-pos":[{"mask-radial-to":Q()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":j()}],"mask-image-conic-pos":[{"mask-conic":[Ss]}],"mask-image-conic-from-pos":[{"mask-conic-from":Q()}],"mask-image-conic-to-pos":[{"mask-conic-to":Q()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:z()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Gt,Ht]}],filter:[{filter:["","none",Gt,Ht]}],blur:[{blur:Y()}],brightness:[{brightness:[Ss,Gt,Ht]}],contrast:[{contrast:[Ss,Gt,Ht]}],"drop-shadow":[{"drop-shadow":["","none",m,Vy,Wy]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Ss,Gt,Ht]}],"hue-rotate":[{"hue-rotate":[Ss,Gt,Ht]}],invert:[{invert:["",Ss,Gt,Ht]}],saturate:[{saturate:[Ss,Gt,Ht]}],sepia:[{sepia:["",Ss,Gt,Ht]}],"backdrop-filter":[{"backdrop-filter":["","none",Gt,Ht]}],"backdrop-blur":[{"backdrop-blur":Y()}],"backdrop-brightness":[{"backdrop-brightness":[Ss,Gt,Ht]}],"backdrop-contrast":[{"backdrop-contrast":[Ss,Gt,Ht]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ss,Gt,Ht]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ss,Gt,Ht]}],"backdrop-invert":[{"backdrop-invert":["",Ss,Gt,Ht]}],"backdrop-opacity":[{"backdrop-opacity":[Ss,Gt,Ht]}],"backdrop-saturate":[{"backdrop-saturate":[Ss,Gt,Ht]}],"backdrop-sepia":[{"backdrop-sepia":["",Ss,Gt,Ht]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Gt,Ht]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ss,"initial",Gt,Ht]}],ease:[{ease:["linear","initial",y,Gt,Ht]}],delay:[{delay:[Ss,Gt,Ht]}],animate:[{animate:["none",v,Gt,Ht]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,Gt,Ht]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:J()}],"rotate-x":[{"rotate-x":J()}],"rotate-y":[{"rotate-y":J()}],"rotate-z":[{"rotate-z":J()}],scale:[{scale:P()}],"scale-x":[{"scale-x":P()}],"scale-y":[{"scale-y":P()}],"scale-z":[{"scale-z":P()}],"scale-3d":["scale-3d"],skew:[{skew:ee()}],"skew-x":[{"skew-x":ee()}],"skew-y":[{"skew-y":ee()}],transform:[{transform:[Gt,Ht,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:X()}],"translate-x":[{"translate-x":X()}],"translate-y":[{"translate-y":X()}],"translate-z":[{"translate-z":X()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}
vendor: 10,187 bytes, lines 183-184
183],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Gt,Ht]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Gt,Ht]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Ss,Tg,rd,CF]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","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-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Iee=u8e(R8e),I8e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,P8e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,L8e={};function RF(e,t){return(L8e.jsx?P8e:I8e).test(e)}const O8e=/[ \t\n\f\r]/g;function vk(e){return typeof e=="object"?e.type==="text"?IF(e.value):!1:IF(e)}function IF(e){return e.replace(O8e,"")===""}var Rp={},cE,PF;function M8e(){if(PF)return cE;PF=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,c=` 184`,u="/",d="*",h="",p="comment",m="declaration";function g(b,y){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];y=y||{};var v=1,w=1;function j($){var O=$.match(t);O&&(v+=O.length);var U=$.lastIndexOf(c);w=~U?$.length-U:w+$.length}function E(){var $={line:v,column:w};return function(O){return O.position=new S($),C(),O}}function S($){this.start=$,this.end={line:v,column:w},this.source=y.source}S.prototype.content=b;function _($){var O=new Error(y.source+":"+v+":"+w+": "+$);if(O.reason=$,O.filename=y.source,O.line=v,O.column=w,O.source=b,!y.silent)throw O}function k($){var O=$.exec(b);if(O){var U=O[0];return j(U),b=b.slice(U.length),O}}function C(){k(n)}function N($){var O;for($=$||[];O=A();)O!==!1&&$.push(O);return $}function A(){var $=E();if(!(u!=b.charAt(0)||d!=b.charAt(1))){for(var O=2;h!=b.charAt(O)&&(d!=b.charAt(O)||u!=b.charAt(O+1));)++O;if(O+=2,h===b.charAt(O-1))return _("End of comment missing");var U=b.slice(2,O-2);return w+=2,j(U),b=b.slice(O),w+=2,$({type:p,comment:U})}}function T(){var $=E(),O=k(r);if(O){if(A(),!k(a))return _("property missing ':'");var U=k(i),F=$({type:m,property:x(O[0].replace(e,h)),value:U?x(U[0].replace(e,h)):h});return k(o),F}}function I(){var $=[];N($);for(var O;O=T();)O!==!1&&($.push(O),N($));return $}return C(),I()}function x(b){return b?b.replace(l,h):h}return cE=g,cE}var LF;function D8e(){if(LF)return Rp;LF=1;var e=Rp&&Rp.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rp,"__esModule",{value:!0}),Rp.default=n;const t=e(M8e());function n(r,a){let i=null;if(!r||typeof r!="string")return i;const o=(0,t.default)(r),l=typeof a=="function";return o.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;l?a(u,d,c):d&&(i=i||{},i[u]=d)}),i}return Rp}var Ag={},OF;function $8e(){if(OF)return Ag;OF=1,Object.defineProperty(Ag,"__esModule",{value:!0}),Ag.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(u){return!u||n.test(u)||e.test(u)},o=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),i(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(a,l):u=u.replace(r,l),u.replace(t,o))};return Ag.camelCase=c,Ag}var Rg,MF;function F8e(){if(MF)return Rg;MF=1;var e=Rg&&Rg.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(D8e()),n=$8e();function r(a,i){var o={};return!a||typeof a!="string"||(0,t.default)(a,function(l,c){l&&c&&(o[(0,n.camelCase)(l,i)]=c)}),o}return r.default=r,Rg=r,Rg}var B8e=F8e();const U8e=xc(B8e);function Wx(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?DF(e.position):"start"in e||"end"in e?DF(e):"line"in e||"column"in e?h3(e):""}function h3(e){return $F(e&&e.line)+":"+$F(e&&e.column)}function DF(e){return h3(e&&e.start)+"-"+h3(e&&e.end)}function $F(e){return e&&typeof e=="number"?e:1}class Na extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(o=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=l?l.line:void 0,this.name=Wx(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Na.prototype.file="";Na.prototype.name="";Na.prototype.reason="";Na.prototype.message="";Na.prototype.stack="";Na.prototype.column=void 0;Na.prototype.line=void 0;Na.prototype.ancestors=void 0;Na.prototype.cause=void 0;Na.prototype.fatal=void 0;Na.prototype.place=void 0;Na.prototype.ruleId=void 0;Na.prototype.source=void 0;const qI={}.hasOwnProperty,z8e=new Map,H8e=/[A-Z]/g,q8e=new Set(["table","tbody","thead","tfoot","tr"]),W8e=new Set(["td","th"]),Pee="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function V8e(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=e$e(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");
vendor: 7,743 bytes, line 184
184if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Z8e(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?yl:Hf,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Lee(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function Lee(e,t,n){if(t.type==="element")return G8e(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Y8e(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return X8e(e,t,n);if(t.type==="mdxjsEsm")return K8e(e,t);if(t.type==="root")return J8e(e,t,n);if(t.type==="text")return Q8e(e,t)}function G8e(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=yl,e.schema=a),e.ancestors.push(t);const i=Mee(e,t.tagName,!1),o=t$e(e,t);let l=VI(e,t);return q8e.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!vk(c):!0})),Oee(e,o,i,t),WI(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function Y8e(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Fb(e,t.position)}function K8e(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Fb(e,t.position)}function X8e(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=yl,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:Mee(e,t.name,!0),o=s$e(e,t),l=VI(e,t);return Oee(e,o,i,t),WI(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function J8e(e,t,n){const r={};return WI(r,VI(e,t)),e.create(t,e.Fragment,r,n)}function Q8e(e,t){return t.value}function Oee(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function WI(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Z8e(e,t,n){return r;function r(a,i,o,l){const u=Array.isArray(o.children)?n:t;return l?u(i,o,l):u(i,o)}}function e$e(e,t){return n;function n(r,a,i,o){const l=Array.isArray(i.children),c=vl(r);return t(a,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function t$e(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&qI.call(t.properties,a)){const i=n$e(e,a,t.properties[a]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&W8e.has(t.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function s$e(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Fb(e,t.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else Fb(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function VI(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:z8e;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=a.get(c)||0;o=c+"-"+u,a.set(c,u+1)}}const l=Lee(e,i,o);l!==void 0&&n.push(l)}return n}function n$e(e,t,n){const r=I0(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?NI(n):EI(n)),r.property==="style"){let a=typeof n=="object"?n:r$e(e,String(n));return e.stylePropertyNameCase==="css"&&(a=a$e(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?T4e[r.property]||r.property:r.attribute,n]}}function r$e(e,t){try{return U8e(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Na("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Pee+"#cannot-parse-style-attribute",a}}function Mee(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,o;for(;++i<a.length;){const l=RF(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=o}else r=RF(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return qI.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Fb(e)}function Fb(e,t){const n=new Na("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Pee+"#cannot-handle-mdx-estrees-without-createevaluater",n}function a$e(e){const t={};let n;for(n in e)qI.call(e,n)&&(t[i$e(n)]=e[n]);return t}function i$e(e){let t=e.replace(H8e,o$e);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function o$e(e){return"-"+e.toLowerCase()}const uE={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},l$e={tokenize:c$e};function c$e(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Us(e,t,"linePrefix")}function a(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return rs(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const u$e={tokenize:d$e},FF={tokenize:h$e};function d$e(e){const t=this,n=[];let r=0,a,i,o;return l;function l(w){if(r<n.length){const j=n[r];return t.containerState=j[1],e.attempt(j[0].continuation,c,u)(w)}return u(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&v();const j=t.events.length;let E=j,S;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){S=t.events[E][1].end;break}y(r);let _=j;for(;_<t.events.length;)t.events[_][1].end={...S},_++;return Si(t.events,E+1,0,t.events.slice(j)),t.events.length=_,u(w)}return l(w)}function u(w){if(r===n.length){if(!a)return p(w);if(a.currentConstruct&&a.currentConstruct.concrete)return g(w);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(FF,d,h)(w)}function d(w){return a&&v(),y(r),p(w)}function h(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(w)}function p(w){return t.containerState={},e.attempt(FF,m,g)(w)}function m(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function g(w){if(w===null){a&&v(),y(0),e.consume(w);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),x(w)}function x(w){if(w===null){b(e.exit("chunkFlow"),!0),y(0),e.consume(w);return}return rs(w)?(e.consume(w),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(w),x)}function b(w,j){const E=t.sliceStream(w);
vendor: 18,086 bytes, lines 184-186
184if(j&&E.push(null),w.previous=i,i&&(i.next=w),i=w,a.defineSkip(w.start),a.write(E),t.parser.lazy[w.start.line]){let S=a.events.length;for(;S--;)if(a.events[S][1].start.offset<o&&(!a.events[S][1].end||a.events[S][1].end.offset>o))return;const _=t.events.length;let k=_,C,N;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(C){N=t.events[k][1].end;break}C=!0}for(y(r),S=_;S<t.events.length;)t.events[S][1].end={...N},S++;Si(t.events,k+1,0,t.events.slice(_)),t.events.length=S}}function y(w){let j=n.length;for(;j-- >w;){const E=n[j];t.containerState=E[1],E[0].exit.call(t,e)}n.length=w}function v(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function h$e(e,t,n){return Us(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}const p$e={tokenize:m$e};function m$e(e){const t=this,n=e.attempt(M0,r,e.attempt(this.parser.constructs.flowInitial,a,Us(e,e.attempt(this.parser.constructs.flow,a,e.attempt(gOe,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const f$e={resolveAll:$ee()},g$e=Dee("string"),x$e=Dee("text");function Dee(e){return{resolveAll:$ee(e==="text"?b$e:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,o,l);return o;function o(d){return u(d)?i(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=a[d];let p=-1;if(h)for(;++p<h.length;){const m=h[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function $ee(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function b$e(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,o=-1,l=0,c;for(;i--;){const u=a[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const y$e={42:Xa,43:Xa,45:Xa,48:Xa,49:Xa,50:Xa,51:Xa,52:Xa,53:Xa,54:Xa,55:Xa,56:Xa,57:Xa,62:eee},v$e={91:wOe},w$e={[-2]:aE,[-1]:aE,32:aE},j$e={35:SOe,42:E1,45:[bF,E1],60:ROe,61:bF,95:E1,96:gF,126:gF},_$e={38:see,92:tee},k$e={[-5]:iE,[-4]:iE,[-3]:iE,33:KOe,38:see,42:u3,60:[J6e,$Oe],91:JOe,92:[NOe,tee],93:FI,95:u3,96:uOe},N$e={null:[u3,f$e]},E$e={null:[42,95]},S$e={null:[]},C$e=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:E$e,contentInitial:v$e,disable:S$e,document:y$e,flow:j$e,flowInitial:w$e,insideSpan:N$e,string:_$e,text:k$e},Symbol.toStringTag,{value:"Module"}));function T$e(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let o=[],l=[];const c={attempt:_(E),check:_(S),consume:v,enter:w,exit:j,interrupt:_(S,{interrupt:!0})},u={code:null,containerState:{},defineSkip:x,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:m,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function h(A){return o=Bi(o,A),b(),o[o.length-1]!==null?[]:(k(t,0),u.events=bk(i,u.events,u),u.events)}function p(A,T){return R$e(m(A),T)}function m(A){return A$e(o,A)}function g(){const{_bufferIndex:A,_index:T,line:I,column:$,offset:O}=r;return{_bufferIndex:A,_index:T,line:I,column:$,offset:O}}function x(A){a[A.line]=A.column,N()}function b(){let A;for(;r._index<o.length;){const T=o[r._index];if(typeof T=="string")for(A=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===A&&r._bufferIndex<T.length;)y(T.charCodeAt(r._bufferIndex));else y(T)}}function y(A){d=d(A)}function v(A){rs(A)?(r.line++,r.column=1,r.offset+=A===-3?2:1,N()):A!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=A}function w(A,T){const I=T||{};return I.type=A,I.start=g(),u.events.push(["enter",I,u]),l.push(I),I}function j(A){const T=l.pop();return T.end=g(),u.events.push(["exit",T,u]),T}function E(A,T){k(A,T.from)}function S(A,T){T.restore()}function _(A,T){return I;function I($,O,U){let F,H,G,M;return Array.isArray($)?W($):"tokenize"in $?W([$]):z($);function z(L){return K;function K(te){const Q=te!==null&&L[te],Y=te!==null&&L.null,J=[...Array.isArray(Q)?Q:Q?[Q]:[],...Array.isArray(Y)?Y:Y?[Y]:[]];return W(J)(te)}}function W(L){return F=L,H=0,L.length===0?U:D(L[H])}function D(L){return K;function K(te){return M=C(),G=L,L.partial||(u.currentConstruct=L),L.name&&u.parser.constructs.disable.null.includes(L.name)?V():L.tokenize.call(T?Object.assign(Object.create(u),T):u,c,Z,V)(te)}}function Z(L){return A(G,M),O}function V(L){return M.restore(),++H<F.length?D(F[H]):U}}}function k(A,T){A.resolveAll&&!i.includes(A)&&i.push(A),A.resolve&&Si(u.events,T,u.events.length-T,A.resolve(u.events.slice(T),u)),A.resolveTo&&(u.events=A.resolveTo(u.events,u))}function C(){const A=g(),T=u.previous,I=u.currentConstruct,$=u.events.length,O=Array.from(l);return{from:$,restore:U};function U(){r=A,u.previous=T,u.currentConstruct=I,u.events.length=$,l=O,N()}}function N(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function A$e(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(r,i)];else{if(o=e.slice(n,a),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(e[a].slice(0,i))}return o}function R$e(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=` 185`;break}case-3:{o=`\r 186`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,r.push(o)}return r.join("")}function I$e(e){const r={constructs:WZ([C$e,...(e||{}).extensions||[]]),content:a(l$e),defined:[],document:a(u$e),flow:a(p$e),lazy:{},string:a(g$e),text:a(x$e)};return r;function a(i){return o;function o(l){return T$e(r,i,l)}}}function P$e(e){for(;!nee(e););return e}const BF=/[\0\t\n\r]/g;function L$e(){let e=1,t="",n=!0,r;return a;function a(i,o,l){const c=[];let u,d,h,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(BF.lastIndex=h,u=BF.exec(i),p=u&&u.index!==void 0?u.index:i.length,m=i.charCodeAt(p),!u){t=i.slice(h);break}if(m===10&&h===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),h<p&&(c.push(i.slice(h,p)),e+=p-h),m){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const Fee={}.hasOwnProperty;function O$e(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),M$e(n)(P$e(I$e(n).document().write(L$e()(e,t,!0))))}function M$e(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(se),autolinkProtocol:C,autolinkEmail:C,atxHeading:i(ae),blockQuote:i(Y),characterEscape:C,characterReference:C,codeFenced:i(J),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(J,o),codeText:i(P,o),codeTextData:C,data:C,codeFlowValue:C,definition:i(ee),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(X),hardBreakEscape:i(me),hardBreakTrailing:i(me),htmlFlow:i(q,o),htmlFlowData:C,htmlText:i(q,o),htmlTextData:C,image:i(he),label:o,link:i(se),listItem:i(ke),listItemValue:p,listOrdered:i(le,h),listUnordered:i(le),paragraph:i(oe),reference:D,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ae),strong:i(Oe),thematicBreak:i(Ie)},exit:{atxHeading:c(),atxHeadingSequence:E,autolink:c(),autolinkEmail:Q,autolinkProtocol:te,blockQuote:c(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:V,characterReferenceMarkerNumeric:V,characterReferenceValue:L,characterReference:K,codeFenced:c(b),codeFencedFence:x,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:N,codeIndented:c(y),codeText:c(O),codeTextData:N,data:N,definition:c(),definitionDestinationString:j,definitionLabelString:v,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(T),hardBreakTrailing:c(T),htmlFlow:c(I),htmlFlowData:N,htmlText:c($),htmlTextData:N,image:c(F),label:G,labelText:H,lineEnding:A,link:c(U),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Z,resourceDestinationString:M,resourceTitleString:z,resource:W,setextHeading:c(k),setextHeadingLineSequence:_,setextHeadingText:S,strong:c(),thematicBreak:c()}};Bee(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ue){let be={type:"root",children:[]};const Re={stack:[be],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:d,data:n},Ge=[];let it=-1;for(;++it<ue.length;)if(ue[it][1].type==="listOrdered"||ue[it][1].type==="listUnordered")if(ue[it][0]==="enter")Ge.push(it);else{const ut=Ge.pop();it=a(ue,ut,it)}for(it=-1;++it<ue.length;){const ut=t[ue[it][0]];Fee.call(ut,ue[it][1].type)&&ut[ue[it][1].type].call(Object.assign({sliceSerialize:ue[it][2].sliceSerialize},Re),ue[it][1])}if(Re.tokenStack.length>0){const ut=Re.tokenStack[Re.tokenStack.length-1];(ut[1]||UF).call(Re,void 0,ut[0])}for(be.position={start:Pc(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Pc(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},it=-1;++it<t.transforms.length;)be=t.transforms[it](be)||be;return be}function a(ue,be,Re){let Ge=be-1,it=-1,ut=!1,$t,tt,He,wt;for(;++Ge<=Re;){const St=ue[Ge];switch(St[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{St[0]==="enter"?it++:it--,wt=void 0;break}case"lineEndingBlank":{St[0]==="enter"&&($t&&!wt&&!it&&!He&&(He=Ge),wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:wt=void 0}if(!it&&St[0]==="enter"&&St[1].type==="listItemPrefix"||it===-1&&St[0]==="exit"&&(St[1].type==="listUnordered"||St[1].type==="listOrdered")){if($t){let Zt=Ge;for(tt=void 0;Zt--;){const Jt=ue[Zt];if(Jt[1].type==="lineEnding"||Jt[1].type==="lineEndingBlank"){if(Jt[0]==="exit")continue;tt&&(ue[tt][1].type="lineEndingBlank",ut=!0),Jt[1].type="lineEnding",tt=Zt}else if(!(Jt[1].type==="linePrefix"||Jt[1].type==="blockQuotePrefix"||Jt[1].type==="blockQuotePrefixWhitespace"||Jt[1].type==="blockQuoteMarker"||Jt[1].type==="listItemIndent"))break}He&&(!tt||He<tt)&&($t._spread=!0),$t.end=Object.assign({},tt?ue[tt][1].start:St[1].end),ue.splice(tt||Ge,0,["exit",$t,St[2]]),Ge++,Re++}if(St[1].type==="listItemPrefix"){const Zt={type:"listItem",_spread:!1,start:Object.assign({},St[1].start),end:void 0};$t=Zt,ue.splice(Ge,0,["enter",Zt,St[2]]),Ge++,Re++,He=void 0,wt=!0}}}return ue[be][1]._spread=ut,Re}function i(ue,be){return Re;function Re(Ge){l.call(this,ue(Ge),Ge),be&&be.call(this,Ge)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(ue,be,Re){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([be,Re||void 0]),ue.position={start:Pc(be.start),end:void 0}}function c(ue){return be;function be(Re){ue&&ue.call(this,Re),u.call(this,Re)}}function u(ue,be){const Re=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==ue.type&&(be?be.call(this,ue,Ge[0]):(Ge[1]||UF).call(this,ue,Ge[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Wx({start:ue.start,end:ue.end})+"): itâs not open");Re.position.end=Pc(ue.end)}function d(){return OI(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(ue){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function m(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.lang=ue}function g(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.meta=ue}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue.replace(/(\r?\n|\r)$/g,"")}function v(ue){const be=this.resume(),Re=this.stack[this.stack.length-1];Re.label=be,Re.identifier=ko(this.sliceSerialize(ue)).toLowerCase()}function w(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.title=ue}function j(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.url=ue}function E(ue){const be=this.stack[this.stack.length-1];if(!be.depth){const Re=this.sliceSerialize(ue).length;be.depth=Re}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function _(ue){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function C(ue){const Re=this.stack[this.stack.length-1].children;let Ge=Re[Re.length-1];(!Ge||Ge.type!=="text")&&(Ge=Je(),Ge.position={start:Pc(ue.start),end:void 0},Re.push(Ge)),this.stack.push(Ge)}function N(ue){const be=this.stack.pop();be.value+=this.sliceSerialize(ue),be.position.end=Pc(ue.end)}function A(ue){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Re=be.children[be.children.length-1];Re.position.end=Pc(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(C.call(this,ue),N.call(this,ue))}function T(){this.data.atHardBreak=!0}function I(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function $(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function O(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function U(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=be,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function F(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=be,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function H(ue){const be=this.sliceSerialize(ue),Re=this.stack[this.stack.length-2];Re.label=w6e(be),Re.identifier=ko(be).toLowerCase()}function G(){const ue=this.stack[this.stack.length-1],be=this.resume(),Re=this.stack[this.stack.length-1];if(this.data.inReference=!0,Re.type==="link"){const Ge=ue.children;Re.children=Ge}else Re.alt=be}function M(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.url=ue}function z(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.title=ue}function W(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function Z(ue){const be=this.resume(),Re=this.stack[this.stack.length-1];Re.label=be,Re.identifier=ko(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function V(ue){this.data.characterReferenceType=ue.type}function L(ue){const be=this.sliceSerialize(ue),Re=this.data.characterReferenceType;let Ge;Re?(Ge=qZ(be,Re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=DI(be);const it=this.stack[this.stack.length-1];it.value+=Ge}function K(ue){const be=this.stack.pop();be.position.end=Pc(ue.end)}function te(ue){N.call(this,ue);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(ue)}function Q(ue){N.call(this,ue);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(ue)}function Y(){return{type:"blockquote",children:[]}}function J(){return{type:"code",lang:null,meta:null,value:""}}function P(){return{type:"inlineCode",value:""}}function ee(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function X(){return{type:"emphasis",children:[]}}function ae(){return{type:"heading",depth:0,children:[]}}function me(){return{type:"break"}}function q(){return{type:"html",value:""}}function he(){return{type:"image",title:null,url:"",alt:null}}function se(){return{type:"link",title:null,url:"",children:[]}}function le(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function ke(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function oe(){return{type:"paragraph",children:[]}}function Oe(){return{type:"strong",children:[]}}function Je(){return{type:"text",value:""}}function Ie(){return{type:"thematicBreak"}}}function Pc(e){return{line:e.line,column:e.column,offset:e.offset}}function Bee(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Bee(e,r):D$e(e,r)}}function D$e(e,t){let n;for(n in t)if(Fee.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function UF(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Wx({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wx({start:t.start,end:t.end}
vendor: 4,537 bytes, lines 186-190
186)+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Wx({start:t.start,end:t.end})+") is still open")}function $$e(e){const t=this;t.parser=n;function n(r){return O$e(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function F$e(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function B$e(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:` 187`}]}function U$e(e,t){const n=t.value?t.value+` 188`:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function z$e(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function H$e(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function q$e(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=Gf(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function W$e(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function V$e(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Uee(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&o.type==="text"?o.value+=r:a.push({type:"text",value:r}),a}function G$e(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Uee(e,t);const a={src:Gf(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)}function Y$e(e,t){const n={src:Gf(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function K$e(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function X$e(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Uee(e,t);const a={href:Gf(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function J$e(e,t){const n={href:Gf(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Q$e(e,t,n){const r=e.all(t),a=n?Z$e(n):zee(t),i={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(a||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:` 189`}),d.type==="element"&&d.tagName==="p"&&!a?o.push(...d.children):o.push(d)}const c=r[r.length-1];c&&(a||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:` 190`});const u={type:"element",tagName:"li",properties:i,children:o};
vendor: 9,367 bytes, lines 190-196
190return e.patch(t,u),e.applyData(t,u)}function Z$e(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=zee(n[r])}return t}function zee(e){const t=e.spread;return t??e.children.length>1}function eFe(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const o=r[a];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function tFe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sFe(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function nFe(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rFe(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),a.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=vl(t.children[1]),c=gk(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),a.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)}function aFe(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const h=t.children[c],p={},m=o?o[c]:void 0;m&&(p.align=m);let g={type:"element",tagName:i,properties:p,children:[]};h&&(g.children=e.all(h),e.patch(h,g),g=e.applyData(h,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function iFe(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const zF=9,HF=32;function oFe(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const i=[];for(;r;)i.push(qF(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return i.push(qF(t.slice(a),a>0,!1)),i.join("")}function qF(e,t,n){let r=0,a=e.length;if(t){let i=e.codePointAt(r);for(;i===zF||i===HF;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(a-1);for(;i===zF||i===HF;)a--,i=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function lFe(e,t){const n={type:"text",value:oFe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function cFe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const uFe={blockquote:F$e,break:B$e,code:U$e,delete:z$e,emphasis:H$e,footnoteReference:q$e,heading:W$e,html:V$e,imageReference:G$e,image:Y$e,inlineCode:K$e,linkReference:X$e,link:J$e,listItem:Q$e,list:eFe,paragraph:tFe,root:sFe,strong:nFe,table:rFe,tableCell:iFe,tableRow:aFe,text:lFe,thematicBreak:cFe,toml:Gy,yaml:Gy,definition:Gy,footnoteDefinition:Gy};function Gy(){}function dFe(e,t){const n=[{type:"text",value:"â©"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function hFe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function pFe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||dFe,r=e.options.footnoteBackLabel||hFe,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),p=Gf(h.toLowerCase());let m=0;const g=[],x=e.footnoteCounts.get(h);for(;x!==void 0&&++m<=x;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,m);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,m),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const b=d[d.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const v=b.children[b.children.length-1];v&&v.type==="text"?v.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Oh(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:` 191`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` 192`}]}}const p3={}.hasOwnProperty,mFe={};function fFe(e,t){const n=t||mFe,r=new Map,a=new Map,i=new Map,o={...uFe,...n.handlers},l={all:u,applyData:xFe,definitionById:r,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:gFe,wrap:yFe};return hl(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:a,p=String(d.identifier).toUpperCase();h.has(p)||h.set(p,d)}}),l;function c(d,h){const p=d.type,m=l.handlers[p];if(p3.call(l.handlers,p)&&m)return m(l,d,h);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in d){const{children:x,...b}=d,y=Oh(b);return y.children=l.all(d),y}return Oh(d)}return(l.options.unknownHandler||bFe)(l,d,h)}function u(d){const h=[];if("children"in d){const p=d.children;let m=-1;for(;++m<p.length;){const g=l.one(p[m],d);if(g){if(m&&p[m-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=WF(g.value)),!Array.isArray(g)&&g.type==="element")){const x=g.children[0];x&&x.type==="text"&&(x.value=WF(x.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function gFe(e,t){e.position&&(t.position=yZ(e))}function xFe(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,Oh(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function bFe(e,t){const n=t.data||{},r="value"in t&&!(p3.call(n,"hProperties")||p3.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function yFe(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:` 193`});++r<e.length;)r&&n.push({type:"text",value:` 194`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:` 195`}),n}function WF(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function VF(e,t){const n=fFe(e,t),r=n.one(e,void 0),a=pFe(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&i.children.push({type:"text",value:` 196`},a),i}function vFe(e,t){return e&&"run"in e?async function(n,r){const a=VF(n,{file:r,...t});await e.run(a,r)}:function(n,r){return VF(n,{file:r,...e||t})}}function GF(e){if(e)throw e}var dE,YF;function wFe(){if(YF)return dE;YF=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},i=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),h=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!h)return!1;var p;for(p in u);return typeof p>"u"||e.call(u,p)},o=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return dE=function c(){var u,d,h,p,m,g,x=arguments[0],b=1,y=arguments.length,v=!1;for(typeof x=="boolean"&&(v=x,x=arguments[1]||{},b=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});b<y;++b)if(u=arguments[b],u!=null)for(d in u)h=l(x,d),p=l(u,d),x!==p&&(v&&p&&(i(p)||(m=a(p)))?(m?(m=!1,g=h&&a(h)?h:[]):g=h&&i(h)?h:{},o(x,{name:d,newValue:c(v,g,p)})):typeof p<"u"&&o(x,{name:d,newValue:p}));return x},dE}var jFe=wFe();const hE=xc(jFe);function m3(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function _Fe(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const o=a.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...a);function l(c,...u){const d=e[++i];let h=-1;if(c){o(c);return}for(;++h<a.length;)(u[h]===null||u[h]===void 0)&&(u[h]=a[h]);a=u,d?kFe(d,l)(...u):o(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function kFe(e,t){let n;return r;function r(...o){const l=e.length>
vendor: 4,264 bytes, line 196
196o.length;let c;l&&o.push(a);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&n)throw d;return a(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,a):c instanceof Error?a(c):i(c))}function a(o,...l){n||(n=!0,t(o,...l))}function i(o){a(null,o)}}const Vo={basename:NFe,dirname:EFe,extname:SFe,join:CFe,sep:"/"};function NFe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');D0(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else o<0&&(i=!0,o=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(r=a):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function EFe(e){if(D0(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function SFe(e){D0(e);let t=e.length,n=-1,r=0,a=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function CFe(...e){let t=-1,n;for(;++t<e.length;)D0(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":TFe(n)}function TFe(e){D0(e);const t=e.codePointAt(0)===47;let n=AFe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function AFe(e,t){let n="",r=0,a=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(a===o-1||i===1))if(a!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),a=o,i=0;continue}}else if(n.length>0){n="",r=0,a=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,o):n=e.slice(a+1,o),r=o-a-1;a=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function D0(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const RFe={cwd:IFe};function IFe(){return"/"}function f3(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function PFe(e){if(typeof e=="string")e=new URL(e);else if(!f3(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return LFe(e)}function LFe(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const pE=["history","path","basename","stem","extname","dirname"];class OFe{constructor(t){let n;t?f3(t)?n={path:t}:typeof t=="string"||MFe(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":RFe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<pE.length;){const i=pE[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)pE.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Vo.basename(this.path):void 0}set basename(t){fE(t,"basename"),mE(t,"basename"),this.path=Vo.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Vo.dirname(this.path):void 0}set dirname(t){KF(this.basename,"dirname"),this.path=Vo.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Vo.extname(this.path):void 0}set extname(t){if(mE(t,"extname"),KF(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");
vendor: 5,668 bytes, line 196
196if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Vo.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){f3(t)&&(t=PFe(t)),fE(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Vo.basename(this.path,this.extname):void 0}set stem(t){fE(t,"stem"),mE(t,"stem"),this.path=Vo.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new Na(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function mE(e,t){if(e&&e.includes(Vo.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Vo.sep+"`")}function fE(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function KF(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function MFe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const DFe=(function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),$Fe={}.hasOwnProperty;class GI extends DFe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=_Fe()}copy(){const t=new GI;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(hE(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(bE("data",this.frozen),this.namespace[t]=n,this):$Fe.call(this.namespace,t)&&this.namespace[t]||void 0:t?(bE("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Yy(t),r=this.parser||this.Parser;return gE("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),gE("process",this.parser||this.Parser),xE("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,o){const l=Yy(t),c=r.parse(l);r.run(c,l,function(d,h,p){if(d||!h||!p)return u(d);const m=h,g=r.stringify(m,p);UFe(g)?p.value=g:p.result=g,u(d,p)});function u(d,h){d||!h?o(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),gE("processSync",this.parser||this.Parser),xE("processSync",this.compiler||this.Compiler),this.process(t,a),JF("processSync","process",n),r;function a(i,o){n=!0,GF(i),r=o}}run(t,n,r){XF(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,l){const c=Yy(n);a.run(t,c,u);function u(d,h,p){const m=h||t;d?l(d):o?o(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),JF("runSync","run",r),a;function i(o,l){GF(o),a=l,r=!0}}stringify(t,n){this.freeze();const r=Yy(n),a=this.compiler||this.Compiler;return xE("stringify",a),XF(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(bE("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(a.settings=hE(!0,a.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[m,...g]=d;const x=r[p][1];m3(x)&&m3(m)&&(m=hE(!0,x,m)),r[p]=[u,m,...g]}}}}const FFe=new GI().freeze();function gE(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function xE(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function bE(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function XF(e){if(!m3(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function JF(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Yy(e){return BFe(e)?e:new OFe(e)}function BFe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function UFe(e){return typeof e=="string"||zFe(e)}function zFe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}function YI(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var tp=YI();function Hee(e){tp=e}var Md={exec:()=>null};function zs(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(a,i)=>{let o=typeof i=="string"?i:i.source;
vendor: 4,292 bytes, line 196
196return o=o.replace(Da.caret,"$1"),n=n.replace(a,o),r},getRegex:()=>new RegExp(n,t)};return r}var HFe=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Da={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},qFe=/^(?:[ \t]*(?:\n|$))+/,WFe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,VFe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,$0=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,GFe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,KI=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,qee=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wee=zs(qee).replace(/bull/g,KI).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),YFe=zs(qee).replace(/bull/g,KI).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),XI=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,KFe=/^[^\n]+/,JI=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,XFe=zs(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",JI).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),JFe=zs(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,KI).getRegex(),wk="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",QI=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,QFe=zs("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>
vendor: 10,094 bytes, lines 196-203
196)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",QI).replace("tag",wk).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Vee=zs(XI).replace("hr",$0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",wk).getRegex(),ZFe=zs(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Vee).getRegex(),ZI={blockquote:ZFe,code:WFe,def:XFe,fences:VFe,heading:GFe,hr:$0,html:QFe,lheading:Wee,list:JFe,newline:qFe,paragraph:Vee,table:Md,text:KFe},QF=zs("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",$0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",wk).getRegex(),e9e={...ZI,lheading:YFe,table:QF,paragraph:zs(XI).replace("hr",$0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",QF).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",wk).getRegex()},t9e={...ZI,html:zs(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",QI).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Md,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:zs(XI).replace("hr",$0).replace("heading",` *#{1,6} *[^ 197]`).replace("lheading",Wee).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},s9e=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,n9e=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gee=/^( {2,}|\\)\n(?!\s*$)/,r9e=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Yf=/[\p{P}\p{S}]/u,jk=/[\s\p{P}\p{S}]/u,eP=/[^\s\p{P}\p{S}]/u,a9e=zs(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,jk).getRegex(),Yee=/(?!~)[\p{P}\p{S}]/u,i9e=/(?!~)[\s\p{P}\p{S}]/u,o9e=/(?:[^\s\p{P}\p{S}]|~)/u,l9e=zs(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",HFe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Kee=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,c9e=zs(Kee,"u").replace(/punct/g,Yf).getRegex(),u9e=zs(Kee,"u").replace(/punct/g,Yee).getRegex(),Xee="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",d9e=zs(Xee,"gu").replace(/notPunctSpace/g,eP).replace(/punctSpace/g,jk).replace(/punct/g,Yf).getRegex(),h9e=zs(Xee,"gu").replace(/notPunctSpace/g,o9e).replace(/punctSpace/g,i9e).replace(/punct/g,Yee).getRegex(),p9e=zs("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,eP).replace(/punctSpace/g,jk).replace(/punct/g,Yf).getRegex(),m9e=zs(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Yf).getRegex(),f9e="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",g9e=zs(f9e,"gu").replace(/notPunctSpace/g,eP).replace(/punctSpace/g,jk).replace(/punct/g,Yf).getRegex(),x9e=zs(/\\(punct)/,"gu").replace(/punct/g,Yf).getRegex(),b9e=zs(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),y9e=zs(QI).replace("(?:-->|$)","-->").getRegex(),v9e=zs("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",y9e).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),mj=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,w9e=zs(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",mj).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Jee=zs(/^!?\[(label)\]\[(ref)\]/).replace("label",mj).replace("ref",JI).getRegex(),Qee=zs(/^!?\[(ref)\](?:\[\])?/).replace("ref",JI).getRegex(),j9e=zs("reflink|nolink(?!\\()","g").replace("reflink",Jee).replace("nolink",Qee).getRegex(),ZF=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,tP={_backpedal:Md,anyPunctuation:x9e,autolink:b9e,blockSkip:l9e,br:Gee,code:n9e,del:Md,delLDelim:Md,delRDelim:Md,emStrongLDelim:c9e,emStrongRDelimAst:d9e,emStrongRDelimUnd:p9e,escape:s9e,link:w9e,nolink:Qee,punctuation:a9e,reflink:Jee,reflinkSearch:j9e,tag:v9e,text:r9e,url:Md},_9e={...tP,link:zs(/^!?\[(label)\]\((.*?)\)/).replace("label",mj).getRegex(),reflink:zs(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",mj).getRegex()},g3={...tP,emStrongRDelimAst:h9e,emStrongLDelim:u9e,delLDelim:m9e,delRDelim:g9e,url:zs(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ZF).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:zs(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ZF).getRegex()},k9e={...g3,br:zs(Gee).replace("{2,}","*").getRegex(),text:zs(g3.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ky={normal:ZI,gfm:e9e,pedantic:t9e},Ig={normal:tP,gfm:g3,breaks:k9e,pedantic:_9e},N9e={"&":"&","<":"<",">":">",'"':""","'":"'"},e9=e=>N9e[e];function Uo(e,t){if(t){if(Da.escapeTest.test(e))return e.replace(Da.escapeReplace,e9)}else if(Da.escapeTestNoEncode.test(e))return e.replace(Da.escapeReplaceNoEncode,e9);return e}function t9(e){try{e=encodeURI(e).replace(Da.percentDecode,"%")}catch{return null}return e}function s9(e,t){let n=e.replace(Da.findPipe,(i,o,l)=>{let c=!1,u=o;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=n.split(Da.splitPipe),a=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;a<r.length;a++)r[a]=r[a].trim().replace(Da.slashPipe,"|");return r}function Pg(e,t,n){let r=e.length;if(r===0)return"";let a=0;for(;a<r&&e.charAt(r-a-1)===t;)a++;return e.slice(0,r-a)}function E9e(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function S9e(e,t=0){let n=t,r="";for(let a of e)if(a===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=a,n++;return r}function n9(e,t,n,r,a){let i=t.href,o=t.title||null,l=e[1].replace(a.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,c}function C9e(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let a=r[1];return t.split(` 198`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[l]=o;return l.length>=a.length?i.slice(a.length):i}).join(` 199`)}var fj=class{options;rules;lexer;constructor(t){this.options=t||tp}space(t){let n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){let n=this.rules.block.code.exec(t);if(n){let r=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Pg(r,` 200`)}}}fences(t){let n=this.rules.block.fences.exec(t);if(n){let r=n[0],a=C9e(r,n[3]||"",this.rules);return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:a}}}heading(t){let n=this.rules.block.heading.exec(t);if(n){let r=n[2].trim();if(this.rules.other.endingHash.test(r)){let a=Pg(r,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(r=a.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:Pg(n[0],` 201`)}}blockquote(t){let n=this.rules.block.blockquote.exec(t);if(n){let r=Pg(n[0],` 202`).split(` 203`),a="",i="",o=[];for(;r.length>0;){let l=!1,c=[],u;
vendor: 8,972 bytes, lines 203-221
203for(u=0;u<r.length;u++)if(this.rules.other.blockquoteStart.test(r[u]))c.push(r[u]),l=!0;else if(!l)c.push(r[u]);else break;r=r.slice(u);let d=c.join(` 204`),h=d.replace(this.rules.other.blockquoteSetextReplace,` 205 $1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a} 206${d}`:d,i=i?`${i} 207${h}`:h;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,o,!0),this.lexer.state.top=p,r.length===0)break;let m=o.at(-1);if(m?.type==="code")break;if(m?.type==="blockquote"){let g=m,x=g.raw+` 208`+r.join(` 209`),b=this.blockquote(x);o[o.length-1]=b,a=a.substring(0,a.length-g.raw.length)+b.raw,i=i.substring(0,i.length-g.text.length)+b.text;break}else if(m?.type==="list"){let g=m,x=g.raw+` 210`+r.join(` 211`),b=this.list(x);o[o.length-1]=b,a=a.substring(0,a.length-m.raw.length)+b.raw,i=i.substring(0,i.length-g.raw.length)+b.raw,r=x.substring(o.at(-1).raw.length).split(` 212`);continue}}return{type:"blockquote",raw:a,tokens:o,text:i}}}list(t){let n=this.rules.block.list.exec(t);if(n){let r=n[1].trim(),a=r.length>1,i={type:"list",raw:"",ordered:a,start:a?+r.slice(0,-1):"",loose:!1,items:[]};r=a?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=a?r:"[*+-]");let o=this.rules.other.listItemRegex(r),l=!1;for(;t;){let u=!1,d="",h="";if(!(n=o.exec(t))||this.rules.block.hr.test(t))break;d=n[0],t=t.substring(d.length);let p=S9e(n[2].split(` 213`,1)[0],n[1].length),m=t.split(` 214`,1)[0],g=!p.trim(),x=0;if(this.options.pedantic?(x=2,h=p.trimStart()):g?x=n[1].length+1:(x=p.search(this.rules.other.nonSpaceChar),x=x>4?1:x,h=p.slice(x),x+=n[1].length),g&&this.rules.other.blankLine.test(m)&&(d+=m+` 215`,t=t.substring(m.length+1),u=!0),!u){let b=this.rules.other.nextBulletRegex(x),y=this.rules.other.hrRegex(x),v=this.rules.other.fencesBeginRegex(x),w=this.rules.other.headingBeginRegex(x),j=this.rules.other.htmlBeginRegex(x),E=this.rules.other.blockquoteBeginRegex(x);for(;t;){let S=t.split(` 216`,1)[0],_;if(m=S,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),_=m):_=m.replace(this.rules.other.tabCharGlobal," "),v.test(m)||w.test(m)||j.test(m)||E.test(m)||b.test(m)||y.test(m))break;if(_.search(this.rules.other.nonSpaceChar)>=x||!m.trim())h+=` 217`+_.slice(x);else{if(g||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||v.test(p)||w.test(p)||y.test(p))break;h+=` 218`+m}g=!m.trim(),d+=S+` 219`,t=t.substring(S.length+1),p=_.slice(x)}}i.loose||(l?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(l=!0)),i.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),i.raw+=d}let c=i.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let u of i.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),u.tokens[0]?.type==="text"||u.tokens[0]?.type==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(u.raw);if(d){let h={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};u.checked=h.checked,i.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=h.raw+u.tokens[0].raw,u.tokens[0].text=h.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(h)):u.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):u.tokens.unshift(h)}}if(!i.loose){let d=u.tokens.filter(p=>p.type==="space"),h=d.length>0&&d.some(p=>this.rules.other.anyLine.test(p.raw));i.loose=h}}if(i.loose)for(let u of i.items){u.loose=!0;for(let d of u.tokens)d.type==="text"&&(d.type="paragraph")}return i}}html(t){let n=this.rules.block.html.exec(t);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(t){let n=this.rules.block.def.exec(t);if(n){let r=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:a,title:i}}}table(t){let n=this.rules.block.table.exec(t);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;let r=s9(n[1]),a=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=n[3]?.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(` 220`):[],o={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===a.length){for(let l of a)this.rules.other.tableAlignRight.test(l)?o.align.push("right"):this.rules.other.tableAlignCenter.test(l)?o.align.push("center"):this.rules.other.tableAlignLeft.test(l)?o.align.push("left"):o.align.push(null);for(let l=0;l<r.length;l++)o.header.push({text:r[l],tokens:this.lexer.inline(r[l]),header:!0,align:o.align[l]});for(let l of i)o.rows.push(s9(l,o.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:o.align[u]})));return o}}lheading(t){let n=this.rules.block.lheading.exec(t);if(n){let r=n[1].trim();return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(t){let n=this.rules.block.paragraph.exec(t);if(n){let r=n[1].charAt(n[1].length-1)===` 221`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){let n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(t){let n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(t){let n=this.rules.inline.link.exec(t);if(n){let r=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let o=Pg(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{let o=E9e(n[2],"()");if(o===-2)return;if(o>-1){let l=(n[0].indexOf("!")===0?5:4)+n[1].length+o;n[2]=n[2].substring(0,o),n[0]=n[0].substring(0,l).trim(),n[3]=""}}let a=n[2],i="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(a);o&&(a=o[1],i=o[3])}else i=n[3]?n[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?a=a.slice(1):a=a.slice(1,-1)),n9(n,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(t,n){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let a=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=n[a.toLowerCase()];if(!i){let o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return n9(r,i,r[0],this.lexer,this.rules)}}emStrong(t,n,r=""){let a=this.rules.inline.emStrongLDelim.exec(t);if(!(!a||!a[1]&&!a[2]&&!a[3]&&!a[4]||a[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[3])||!r||this.rules.inline.punctuation.exec(r))){let i=[...a[0]].length-1,o,l,c=i,u=0,d=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,n=n.slice(-1*t.length+i);(a=d.exec(n))!=null;){if(o=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!o)continue;if(l=[...o].length,a[3]||a[4]){c+=l;continue}else if((a[5]||a[6])&&i%3&&!((i+l)%3)){u+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+u);let h=[...a[0]][0].length,p=t.slice(0,i+a.index+h+l);if(Math.min(i,l)%2){let g=p.slice(1,-1);return{type:"em",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}let m=p.slice(2,-2);return{type:"strong",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(t){let n=this.rules.inline.code.exec(t);if(n){let r=n[2].replace(this.rules.other.newLineCharGlobal," "),a=this.rules.other.nonSpaceChar.test(r),i=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return a&&i&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:n[0],text:r}}}br(t){let n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t,n,r=""){let a=this.rules.inline.delLDelim.exec(t);
vendor: 1,929 bytes, lines 221-222
221if(a&&(!a[1]||!r||this.rules.inline.punctuation.exec(r))){let i=[...a[0]].length-1,o,l,c=i,u=this.rules.inline.delRDelim;for(u.lastIndex=0,n=n.slice(-1*t.length+i);(a=u.exec(n))!=null;){if(o=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!o||(l=[...o].length,l!==i))continue;if(a[3]||a[4]){c+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c);let d=[...a[0]][0].length,h=t.slice(0,i+a.index+d+l),p=h.slice(i,-i);return{type:"del",raw:h,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(t){let n=this.rules.inline.autolink.exec(t);if(n){let r,a;return n[2]==="@"?(r=n[1],a="mailto:"+r):(r=n[1],a=r),{type:"link",raw:n[0],text:r,href:a,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let n;if(n=this.rules.inline.url.exec(t)){let r,a;if(n[2]==="@")r=n[0],a="mailto:"+r;else{let i;do i=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"";while(i!==n[0]);r=n[0],n[1]==="www."?a="http://"+n[0]:a=n[0]}return{type:"link",raw:n[0],text:r,href:a,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let n=this.rules.inline.text.exec(t);if(n){let r=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:r}}}},Ui=class x3{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||tp,this.options.tokenizer=this.options.tokenizer||new fj,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Da,block:Ky.normal,inline:Ig.normal};this.options.pedantic?(n.block=Ky.pedantic,n.inline=Ig.pedantic):this.options.gfm&&(n.block=Ky.gfm,this.options.breaks?n.inline=Ig.breaks:n.inline=Ig.gfm),this.tokenizer.rules=n}static get rules(){return{block:Ky,inline:Ig}}static lex(t,n){return new x3(n).lex(t)}static lexInline(t,n){return new x3(n).inlineTokens(t)}lex(t){t=t.replace(Da.carriageReturn,` 222`),this.blockTokens(t,this.tokens);for(let n=0;
vendor: 17,402 bytes, lines 222-254
222n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(Da.tabCharGlobal," ").replace(Da.spaceLine,""));t;){let a;if(this.options.extensions?.block?.some(o=>(a=o.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);let o=n.at(-1);a.raw.length===1&&o!==void 0?o.raw+=` 223`:n.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` 224`)?"":` 225`)+a.raw,o.text+=` 226`+a.text,this.inlineQueue.at(-1).src=o.text):n.push(a);continue}if(a=this.tokenizer.fences(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.heading(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.hr(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.blockquote(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.list(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.html(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.def(t)){t=t.substring(a.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` 227`)?"":` 228`)+a.raw,o.text+=` 229`+a.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},n.push(a));continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),n.push(a);continue}let i=t;if(this.options.extensions?.startBlock){let o=1/0,l=t.slice(1),c;this.options.extensions.startBlock.forEach(u=>{c=u.call({lexer:this},l),typeof c=="number"&&c>=0&&(o=Math.min(o,c))}),o<1/0&&o>=0&&(i=t.substring(0,o+1))}if(this.state.top&&(a=this.tokenizer.paragraph(i))){let o=n.at(-1);r&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(` 230`)?"":` 231`)+a.raw,o.text+=` 232`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(a),r=i.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(` 233`)?"":` 234`)+a.raw,o.text+=` 235`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(a);continue}if(t){let o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){this.tokenizer.lexer=this;let r=t,a=null;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)c.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,a.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(a=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)i=a[2]?a[2].length:0,r=r.slice(0,a.index+i)+"["+"a".repeat(a[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let o=!1,l="";for(;t;){o||(l=""),o=!1;let c;if(this.options.extensions?.inline?.some(d=>(c=d.call({lexer:this},t,n))?(t=t.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(c.raw.length);let d=n.at(-1);c.type==="text"&&d?.type==="text"?(d.raw+=c.raw,d.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(t,r,l)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(t,r,l)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(t)){t=t.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(t))){t=t.substring(c.raw.length),n.push(c);continue}let u=t;if(this.options.extensions?.startInline){let d=1/0,h=t.slice(1),p;this.options.extensions.startInline.forEach(m=>{p=m.call({lexer:this},h),typeof p=="number"&&p>=0&&(d=Math.min(d,p))}),d<1/0&&d>=0&&(u=t.substring(0,d+1))}if(c=this.tokenizer.inlineText(u)){t=t.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(l=c.raw.slice(-1)),o=!0;let d=n.at(-1);d?.type==="text"?(d.raw+=c.raw,d.text+=c.text):n.push(c);continue}if(t){let d="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return n}},gj=class{options;parser;constructor(t){this.options=t||tp}space(t){return""}code({text:t,lang:n,escaped:r}){let a=(n||"").match(Da.notSpaceStart)?.[0],i=t.replace(Da.endingNewline,"")+` 236`;return a?'<pre><code class="language-'+Uo(a)+'">'+(r?i:Uo(i,!0))+`</code></pre> 237`:"<pre><code>"+(r?i:Uo(i,!0))+`</code></pre> 238`}blockquote({tokens:t}){return`<blockquote> 239${this.parser.parse(t)}</blockquote> 240`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:n}){return`<h${n}>${this.parser.parseInline(t)}</h${n}> 241`}hr(t){return`<hr> 242`}list(t){let n=t.ordered,r=t.start,a="";for(let l=0;l<t.items.length;l++){let c=t.items[l];a+=this.listitem(c)}let i=n?"ol":"ul",o=n&&r!==1?' start="'+r+'"':"";return"<"+i+o+`> 243`+a+"</"+i+`> 244`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li> 245`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p> 246`}table(t){let n="",r="";for(let i=0;i<t.header.length;i++)r+=this.tablecell(t.header[i]);n+=this.tablerow({text:r});let a="";for(let i=0;i<t.rows.length;i++){let o=t.rows[i];r="";for(let l=0;l<o.length;l++)r+=this.tablecell(o[l]);a+=this.tablerow({text:r})}return a&&(a=`<tbody>${a}</tbody>`),`<table> 247<thead> 248`+n+`</thead> 249`+a+`</table> 250`}tablerow({text:t}){return`<tr> 251${t}</tr> 252`}tablecell(t){let n=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+n+`</${r}> 253`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Uo(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:n,tokens:r}){let a=this.parser.parseInline(r),i=t9(t);if(i===null)return a;t=i;let o='<a href="'+t+'"';return n&&(o+=' title="'+Uo(n)+'"'),o+=">"+a+"</a>",o}image({href:t,title:n,text:r,tokens:a}){a&&(r=this.parser.parseInline(a,this.parser.textRenderer));let i=t9(t);if(i===null)return Uo(r);t=i;let o=`<img src="${t}" alt="${Uo(r)}"`;return n&&(o+=` title="${Uo(n)}"`),o+=">",o}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Uo(t.text)}},sP=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},mo=class b3{options;renderer;textRenderer;constructor(t){this.options=t||tp,this.options.renderer=this.options.renderer||new gj,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new sP}static parse(t,n){return new b3(n).parse(t)}static parseInline(t,n){return new b3(n).parseInline(t)}parse(t){this.renderer.parser=this;let n="";for(let r=0;r<t.length;r++){let a=t[r];if(this.options.extensions?.renderers?.[a.type]){let o=a,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=l||"";continue}}let i=a;switch(i.type){case"space":{n+=this.renderer.space(i);break}case"hr":{n+=this.renderer.hr(i);break}case"heading":{n+=this.renderer.heading(i);break}case"code":{n+=this.renderer.code(i);break}case"table":{n+=this.renderer.table(i);break}case"blockquote":{n+=this.renderer.blockquote(i);break}case"list":{n+=this.renderer.list(i);break}case"checkbox":{n+=this.renderer.checkbox(i);break}case"html":{n+=this.renderer.html(i);break}case"def":{n+=this.renderer.def(i);break}case"paragraph":{n+=this.renderer.paragraph(i);break}case"text":{n+=this.renderer.text(i);break}default:{let o='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(t,n=this.renderer){this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let i=t[a];if(this.options.extensions?.renderers?.[i.type]){let l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=l||"";continue}}let o=i;switch(o.type){case"escape":{r+=n.text(o);break}case"html":{r+=n.html(o);break}case"link":{r+=n.link(o);break}case"image":{r+=n.image(o);break}case"checkbox":{r+=n.checkbox(o);break}case"strong":{r+=n.strong(o);break}case"em":{r+=n.em(o);break}case"codespan":{r+=n.codespan(o);break}case"br":{r+=n.br(o);break}case"del":{r+=n.del(o);break}case"text":{r+=n.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}},cx=class{options;block;constructor(t){this.options=t||tp}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?Ui.lex:Ui.lexInline}provideParser(){return this.block?mo.parse:mo.parseInline}},T9e=class{defaults=YI();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=mo;Renderer=gj;TextRenderer=sP;Lexer=Ui;Tokenizer=fj;Hooks=cx;constructor(...t){this.use(...t)}walkTokens(t,n){let r=[];for(let a of t)switch(r=r.concat(n.call(this,a)),a.type){case"table":{let i=a;for(let o of i.header)r=r.concat(this.walkTokens(o.tokens,n));for(let o of i.rows)for(let l of o)r=r.concat(this.walkTokens(l.tokens,n));break}case"list":{let i=a;r=r.concat(this.walkTokens(i.items,n));break}default:{let i=a;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(o=>{let l=i[o].flat(1/0);r=r.concat(this.walkTokens(l,n))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,n)))}}return r}use(...t){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let a={...r};if(a.async=this.defaults.async||a.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let o=n.renderers[i.name];o?n.renderers[i.name]=function(...l){let c=i.renderer.apply(this,l);return c===!1&&(c=o.apply(this,l)),c}:n.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=n[i.level];o?o.unshift(i.tokenizer):n[i.level]=[i.tokenizer],i.start&&(i.level==="block"?n.startBlock?n.startBlock.push(i.start):n.startBlock=[i.start]:i.level==="inline"&&(n.startInline?n.startInline.push(i.start):n.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(n.childTokens[i.name]=i.childTokens)}),a.extensions=n),r.renderer){let i=this.defaults.renderer||new gj(this.defaults);for(let o in r.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let l=o,c=r.renderer[l],u=i[l];i[l]=(...d)=>{let h=c.apply(i,d);return h===!1&&(h=u.apply(i,d)),h||""}}a.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new fj(this.defaults);for(let o in r.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let l=o,c=r.tokenizer[l],u=i[l];i[l]=(...d)=>{let h=c.apply(i,d);return h===!1&&(h=u.apply(i,d)),h}}a.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new cx;for(let o in r.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let l=o,c=r.hooks[l],u=i[l];cx.passThroughHooks.has(o)?i[l]=d=>{if(this.defaults.async&&cx.passThroughHooksRespectAsync.has(o))return(async()=>{let p=await c.call(i,d);return u.call(i,p)})();let h=c.call(i,d);return u.call(i,h)}:i[l]=(...d)=>{if(this.defaults.async)return(async()=>{let p=await c.apply(i,d);return p===!1&&(p=await u.apply(i,d)),p})();let h=c.apply(i,d);return h===!1&&(h=u.apply(i,d)),h}}a.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,o=r.walkTokens;a.walkTokens=function(l){let c=[];return c.push(o.call(this,l)),i&&(c=c.concat(i.call(this,l))),c}}this.defaults={...this.defaults,...a}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return Ui.lex(t,n??this.defaults)}parser(t,n){return mo.parse(t,n??this.defaults)}parseMarkdown(t){return(n,r)=>{let a={...r},i={...this.defaults,...a},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&a.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let l=i.hooks?await i.hooks.preprocess(n):n,c=await(i.hooks?await i.hooks.provideLexer():t?Ui.lex:Ui.lexInline)(l,i),u=i.hooks?await i.hooks.processAllTokens(c):c;i.walkTokens&&await Promise.all(this.walkTokens(u,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser():t?mo.parse:mo.parseInline)(u,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(o);try{i.hooks&&(n=i.hooks.preprocess(n));let l=(i.hooks?i.hooks.provideLexer():t?Ui.lex:Ui.lexInline)(n,i);i.hooks&&(l=i.hooks.processAllTokens(l)),i.walkTokens&&this.walkTokens(l,i.walkTokens);let c=(i.hooks?i.hooks.provideParser():t?mo.parse:mo.parseInline)(l,i);return i.hooks&&(c=i.hooks.postprocess(c)),c}catch(l){return o(l)}}}onError(t,n){return r=>{if(r.message+=` 254Please report this to https://github.com/markedjs/marked.`,t){let a="<p>An error occurred:</p><pre>"+Uo(r.message+"",!0)+"</pre>";return n?Promise.resolve(a):a}if(n)return Promise.reject(r);throw r}}},Dh=new T9e;function dn(e,t){return Dh.parse(e,t)}dn.options=dn.setOptions=function(e){return Dh.setOptions(e),dn.defaults=Dh.defaults,Hee(dn.defaults),dn};dn.getDefaults=YI;dn.defaults=tp;dn.use=function(...e){return Dh.use(...e),dn.defaults=Dh.defaults,Hee(dn.defaults),dn};dn.walkTokens=function(e,t){return Dh.walkTokens(e,t)};dn.parseInline=Dh.parseInline;dn.Parser=mo;dn.parser=mo.parse;dn.Renderer=gj;dn.TextRenderer=sP;dn.Lexer=Ui;dn.lexer=Ui.lex;dn.Tokenizer=fj;dn.Hooks=cx;dn.parse=dn;dn.options;dn.setOptions;dn.use;dn.walkTokens;dn.parseInline;mo.parse;Ui.lex;var A9e=300,R9e="300px",I9e=500;function P9e(e={}){let{immediate:t=!1,debounceDelay:n=A9e,rootMargin:r=R9e,idleTimeout:a=I9e}=e,[i,o]=f.useState(!1),l=f.useRef(null),c=f.useRef(null),u=f.useRef(null),d=f.useMemo(()=>m=>{let g=Date.now();return window.setTimeout(()=>{m({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-g))})},1)},[]),h=f.useMemo(()=>typeof window<"u"&&window.requestIdleCallback?(m,g)=>window.requestIdleCallback(m,g):d,[d]),p=f.useMemo(()=>typeof window<"u"&&window.cancelIdleCallback?m=>window.cancelIdleCallback(m):m=>{clearTimeout(m)},[]);return f.useEffect(()=>{if(t){o(!0);return}let m=l.current;if(!m)return;c.current&&(clearTimeout(c.current),c.current=null),u.current&&(p(u.current),u.current=null);let g=()=>{c.current&&(clearTimeout(c.current),c.current=null),u.current&&(p(u.current),u.current=null)},x=w=>{u.current=h(j=>{j.timeRemaining()>0||j.didTimeout?(o(!0),w.disconnect()):u.current=h(()=>{o(!0),w.disconnect()},{timeout:a/2})},{timeout:a})},b=w=>{g(),c.current=window.setTimeout(()=>{var j,E;let S=w.takeRecords();(S.length===0||(E=(j=S.at(-1))==null?void 0:j.isIntersecting)!=null&&E)&&x(w)},n)},y=(w,j)=>{w.isIntersecting?b(j):g()},v=new IntersectionObserver(w=>{for(let j of w)y(j,v)},{rootMargin:r,threshold:0});return v.observe(m),()=>{c.current&&clearTimeout(c.current),u.current&&p(u.current),v.disconnect()}},[t,n,r,a,p,h]),{shouldRender:i,containerRef:l}}var Zee=/\s/,L9e=/^\s+$/,O9e=new Set(["code","pre","svg","math","annotation"]),M9e=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type==="element",D9e=e=>e.some(t=>M9e(t)&&O9e.has(t.tagName)),$9e=e=>{let t=[],n="",r=!1;for(let a of e){let i=Zee.test(a);i!==r&&n&&(t.push(n),n=""),n+=a,r=i}
254return n&&t.push(n),t},F9e=e=>{let t=[],n="";for(let r of e)Zee.test(r)?n+=r:(n&&(t.push(n),n=""),t.push(r));return n&&t.push(n),t},B9e=(e,t,n,r,a,i)=>{let o=`--sd-animation:sd-${t};--sd-duration:${a?0:n}ms;--sd-easing:${r}`;return i&&(o+=`;--sd-delay:${i}ms`),{type:"element",tagName:"span",properties:{"data-sd-animate":!0,style:o},children:[{type:"text",value:e}]}},U9e=(e,t,n,r,a)=>{let i=t.at(-1);if(!(i&&"children"in i))return;if(D9e(t))return bm;let o=i,l=o.children.indexOf(e);if(l===-1)return;let c=e.value;if(!c.trim()){a.count+=c.length;return}let u=n.sep==="char"?F9e(c):$9e(c),d=r.prevContentLength,h=u.map(p=>{let m=a.count;if(a.count+=p.length,L9e.test(p))return{type:"text",value:p};let g=d>0&&m<d,x=g?0:a.newIndex++*n.stagger;return B9e(p,n.animation,n.duration,n.easing,g,x)});return o.children.splice(l,1,...h),l+h.length},z9e=0;function y3(e){var t,n,r,a,i;let o={animation:(t=e?.animation)!=null?t:"fadeIn",duration:(n=e?.duration)!=null?n:150,easing:(r=e?.easing)!=null?r:"ease",sep:(a=e?.sep)!=null?a:"word",stagger:(i=e?.stagger)!=null?i:40},l={prevContentLength:0,lastRenderCharCount:0},c=z9e++,u=()=>d=>{let h={count:0,newIndex:0};yI(d,"text",(p,m)=>U9e(p,m,o,l,h)),l.lastRenderCharCount=h.count,l.prevContentLength=0};return Object.defineProperty(u,"name",{value:`rehypeAnimate$${c}`}),{name:"animate",type:"animate",rehypePlugin:u,setPrevContentLength(d){l.prevContentLength=d},getLastRenderCharCount(){let d=l.lastRenderCharCount;return l.lastRenderCharCount=0,d}}}y3();var ete=f.createContext(!1),H9e=()=>f.useContext(ete),nP=(...e)=>Iee(xee(e)),q9e=(e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(r=>r.startsWith(n)?r:`${e}:${r}`).join(" ")},W9e=e=>e?(...t)=>q9e(e,Iee(xee(t))):nP,Im=(e,t,n)=>{let r=typeof t=="string"&&n.startsWith("text/csv")?"\uFEFF":"",a=typeof t=="string"?new Blob([r+t],{type:n}):t,i=URL.createObjectURL(a),o=document.createElement("a");o.href=i,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)},v3=f.createContext(nP),Ls=()=>f.useContext(v3),V9e=nP("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),G9e=e=>{let t={};for(let n of e.split(";")){let r=n.indexOf(":");if(r>0){let a=n.slice(0,r).trim(),i=n.slice(r+1).trim();a&&i&&(t[a]=i)}}return t},Y9e=f.memo(({children:e,result:t,language:n,className:r,startLine:a,lineNumbers:i=!0,...o})=>{let l=Ls(),c=f.useMemo(()=>l(V9e),[l]),u=f.useMemo(()=>{let d={};return t.bg&&(d["--sdm-bg"]=t.bg),t.fg&&(d["--sdm-fg"]=t.fg),t.rootStyle&&Object.assign(d,G9e(t.rootStyle)),d},[t.bg,t.fg,t.rootStyle]);return s.jsx("div",{className:l(r,"overflow-x-auto rounded-md border border-border bg-background p-4 text-sm"),"data-language":n,"data-streamdown":"code-block-body",...o,children:s.jsx("pre",{className:l(r,"bg-[var(--sdm-bg,inherit]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]"),style:u,children:s.jsx("code",{className:i?l("[counter-increment:line_0] [counter-reset:line]"):void 0,style:i&&a&&a>1?{counterReset:`line ${a-1}`}:void 0,children:t.tokens.map((d,h)=>s.jsx("span",{className:i?c:void 0,children:d.length===0||d.length===1&&d[0].content===""?` 255`:d.map((p,m)=>{let g={},x=!!p.bgColor;if(p.color&&(g["--sdm-c"]=p.color),p.bgColor&&(g["--sdm-tbg"]=p.bgColor),p.htmlStyle)for(let[b,y]of Object.entries(p.htmlStyle))b==="color"?g["--sdm-c"]=y:b==="background-color"?(g["--sdm-tbg"]=y,x=!0):g[b]=y;return s.jsx("span",{className:l("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",x&&"bg-[var(--sdm-tbg)]",x&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:g,...p.htmlAttrs,children:p.content},m)})},h))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine&&e.lineNumbers===t.lineNumbers),K9e=({className:e,language:t,style:n,isIncomplete:r,...a})=>{let i=Ls();return s.jsx("div",{className:i("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...n},...a})},tte=f.createContext({code:""}),ste=()=>f.useContext(tte),X9e=({language:e})=>{let t=Ls();return s.jsx("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:s.jsx("span",{className:t("ml-1 font-mono lowercase"),children:e})})},J9e=e=>{let t=e.length;for(;t>0&&e[t-1]===` 256`;)t--;return e.slice(0,t)},Q9e=f.lazy(()=>re(()=>
256import("./highlighted-body-OFNGDK62-MrJO4lGb.js"),[]).then(e=>({default:e.HighlightedCodeBlockBody}))),Z9e=({code:e,language:t,className:n,children:r,isIncomplete:a=!1,startLine:i,lineNumbers:o,...l})=>{let c=Ls(),u=f.useMemo(()=>J9e(e),[e]),d=f.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:u.split(` 257`).map(h=>[{content:h,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[u]);return s.jsx(tte.Provider,{value:{code:e},children:s.jsxs(K9e,{isIncomplete:a,language:t,children:[s.jsx(X9e,{language:t}),r?s.jsx("div",{className:c("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:s.jsx("div",{className:c("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"code-block-actions",children:r})}):null,s.jsx(f.Suspense,{fallback:s.jsx(Y9e,{className:n,language:t,lineNumbers:o,result:d,startLine:i,...l}),children:s.jsx(Q9e,{className:n,code:u,language:t,lineNumbers:o,raw:d,startLine:i,...l})})]})})},e7e=e=>s.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:s.jsx("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),t7e=e=>s.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:s.jsx("path",{clipRule:"evenodd",d:"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z",fill:"currentColor",fillRule:"evenodd"})}),s7e=e=>s.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:s.jsx("path",{clipRule:"evenodd",d:"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z",fill:"currentColor",fillRule:"evenodd"})}),n7e=e=>s.jsxs("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[s.jsx("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),s.jsx("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),r7e=e=>s.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:s.jsx("path",{clipRule:"evenodd",d:"M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z",fill:"currentColor",fillRule:"evenodd"})}),a7e=e=>s.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:s.jsx("path",{clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.025
2577 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z",fill:"currentColor",fillRule:"evenodd"})}),i7e=e=>s.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:s.jsx("path",{clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z",fill:"currentColor",fillRule:"evenodd"})}),o7e=e=>s.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:s.jsx("path",{clipRule:"evenodd",d:"M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z",fill:"currentColor",fillRule:"evenodd"})}),l7e=e=>s.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:s.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),c7e=e=>s.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:s.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),ux={CheckIcon:e7e,CopyIcon:t7e,DownloadIcon:s7e,ExternalLinkIcon:o7e,Loader2Icon:n7e,Maximize2Icon:r7e,RotateCcwIcon:a7e,XIcon:i7e,ZoomInIcon:l7e,ZoomOutIcon:c7e},nte=f.createContext(ux),u7e=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(a=>e[a]===t[a])},r9=({icons:e,children:t})=>{let n=f.useRef(e),r=f.useRef(e?{...ux,...e}:ux);u7e(n.current,e)||(n.current=e,r.current=e?{...ux,...e}:ux);let a=r.current;return s.jsx(nte.Provider,{value:a,children:t})},Po=()=>f.useContext(nte),rte={copyCode:"Copy Code",downloadFile:"Download file",downloadDiagram:"Download diagram",downloadDiagramAsSvg:"Download diagram as SVG",downloadDiagramAsPng:"Download diagram as PNG",downloadDiagramAsMmd:"Download diagram as MMD",viewFullscreen:"View fullscreen",exitFullscreen:"Exit fullscreen",mermaidFormatSvg:"SVG",mermaidFormatPng:"PNG",mermaidFormatMmd:"MMD",copyTable:"Copy table",copyTableAsMarkdown:"Copy table as Markdown",copyTableAsCsv:"Copy table as CSV",copyTableAsTsv:"Copy table as TSV",downloadTable:"Download table",downloadTableAsCsv:"Download table as CSV",downloadTableAs
257Markdown:"Download table as Markdown",tableFormatMarkdown:"Markdown",tableFormatCsv:"CSV",tableFormatTsv:"TSV",imageNotAvailable:"Image not available",downloadImage:"Download image",openExternalLink:"Open external link?",externalLinkWarning:"You're about to visit an external website.",close:"Close",copyLink:"Copy link",copied:"Copied",openLink:"Open link"},w3=f.createContext(rte),kc=()=>f.useContext(w3),a9=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:a,code:i,...o})=>{let l=Ls(),[c,u]=f.useState(!1),d=f.useRef(0),{code:h}=ste(),{isAnimating:p}=f.useContext(Ti),m=kc(),g=i??h,x=async()=>{var v;if(typeof window>"u"||!((v=navigator?.clipboard)!=null&&v.writeText)){t?.(new Error("Clipboard API not available"));return}try{c||(await navigator.clipboard.writeText(g),u(!0),e?.(),d.current=window.setTimeout(()=>u(!1),n))}catch(w){t?.(w)}};f.useEffect(()=>()=>{window.clearTimeout(d.current)},[]);let b=Po(),y=c?b.CheckIcon:b.CopyIcon;return s.jsx("button",{className:l("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",a),"data-streamdown":"code-block-copy-button",disabled:p,onClick:x,title:m.copyCode,type:"button",...o,children:r??s.jsx(y,{size:14})})},i9={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",æè¨:"wy"},d7e=({onDownload:e,onError:t,language:n,children:r,className:a,code:i,...o})=>{let l=Ls(),{code:c}=ste(),{isAnimating:u}=f.useContext(Ti),d=kc(),h=Po(),p=i??c,m=`file.${n&&n in i9?i9[n]:"txt"}`,g="text/plain",x=()=>{try{Im(m,p,g),e?.()}catch(b){t?.(b)}};return s.jsx("button",{className:l("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",a),"data-streamdown":"code-block-download-button",disabled:u,onClick:x,title:d.downloadFile,type:"button",...o,children:r??s.jsx(h.DownloadIcon,{size:14})})},o9=()=>{let{Loader2Icon:e}=Po(),t=Ls();return s.jsxs("div",{className:t("w-full divide-y divide-border overflow-hidden rounded-xl border border-border"),children:[s.jsx("div",{className:t("h-[46px] w-full bg-muted/80")}),s.jsx("div",{className:t("flex w-full items-center justify-center p-4"),children:s.jsx(e,{className:t("size-4 animate-spin")})})]})}
257,h7e=/\.[^/.]+$/,p7e=({node:e,className:t,src:n,alt:r,onLoad:a,onError:i,...o})=>{let{DownloadIcon:l}=Po(),c=Ls(),u=f.useRef(null),[d,h]=f.useState(!1),[p,m]=f.useState(!1),g=kc(),x=o.width!=null||o.height!=null,b=(d||x)&&!p,y=p&&!x;f.useEffect(()=>{let E=u.current;if(E!=null&&E.complete){let S=E.naturalWidth>0;h(S),m(!S)}},[]);let v=f.useCallback(E=>{h(!0),m(!1),a?.(E)},[a]),w=f.useCallback(E=>{h(!1),m(!0),i?.(E)},[i]),j=async()=>{if(n)try{let E=await(await fetch(n)).blob(),S=new URL(n,window.location.origin).pathname.split("/").pop()||"",_=S.split(".").pop(),k=S.includes(".")&&_!==void 0&&_.length<=4,C="";if(k)C=S;else{let N=E.type,A="png";N.includes("jpeg")||N.includes("jpg")?A="jpg":N.includes("png")?A="png":N.includes("svg")?A="svg":N.includes("gif")?A="gif":N.includes("webp")&&(A="webp"),C=`${(r||S||"image").replace(h7e,"")}.${A}`}Im(C,E,E.type)}catch{window.open(n,"_blank")}};return n?s.jsxs("div",{className:c("group relative my-4 inline-block"),"data-streamdown":"image-wrapper",children:[s.jsx("img",{alt:r,className:c("max-w-full rounded-lg",y&&"hidden",t),"data-streamdown":"image",onError:w,onLoad:v,ref:u,src:n,...o}),y&&s.jsx("span",{className:c("text-muted-foreground text-xs italic"),"data-streamdown":"image-fallback",children:g.imageNotAvailable}),s.jsx("div",{className:c("pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block")}),b&&s.jsx("button",{className:c("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:j,title:g.downloadImage,type:"button",children:s.jsx(l,{size:14})})]}):null},Vx=0,rP=()=>{Vx+=1,Vx===1&&(document.body.style.overflow="hidden")},aP=()=>{Vx=Math.max(0,Vx-1),Vx===0&&(document.body.style.overflow="")},m7e=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:a,CopyIcon:i,ExternalLinkIcon:o,XIcon:l}=Po(),c=Ls(),[u,d]=f.useState(!1),h=kc(),p=f.useCallback(async()=>{try{await navigator.clipboard.writeText(e),d(!0),setTimeout(()=>d(!1),2e3)}catch{}},[e]),m=f.useCallback(()=>{r(),n()},[r,n]);return f.useEffect(()=>{if(t){rP();let g=x=>{x.key==="Escape"&&n()};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g),aP()}}},[t,n]),t?s.jsx("div",{className:c("fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm"),"data-streamdown":"link-safety-modal",onClick:n,onKeyDown:g=>{g.key==="Escape"&&n()},role:"button",tabIndex:0,children:s.jsxs("div",{className:c("relative mx-4 flex w-full max-w-md flex-col gap-4 roun
257ded-xl border bg-background p-6 shadow-lg"),onClick:g=>g.stopPropagation(),onKeyDown:g=>g.stopPropagation(),role:"presentation",children:[s.jsx("button",{className:c("absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:n,title:h.close,type:"button",children:s.jsx(l,{size:16})}),s.jsxs("div",{className:c("flex flex-col gap-2"),children:[s.jsxs("div",{className:c("flex items-center gap-2 font-semibold text-lg"),children:[s.jsx(o,{size:20}),s.jsx("span",{children:h.openExternalLink})]}),s.jsx("p",{className:c("text-muted-foreground text-sm"),children:h.externalLinkWarning})]}),s.jsx("div",{className:c("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),s.jsxs("div",{className:c("flex gap-2"),children:[s.jsx("button",{className:c("flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted"),onClick:p,type:"button",children:u?s.jsxs(s.Fragment,{children:[s.jsx(a,{size:14}),s.jsx("span",{children:h.copied})]}):s.jsxs(s.Fragment,{children:[s.jsx(i,{size:14}),s.jsx("span",{children:h.copyLink})]})}),s.jsxs("button",{className:c("flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90"),onClick:m,type:"button",children:[s.jsx(o,{size:14}),s.jsx("span",{children:h.openLink})]})]})]})}):null},j3=f.createContext(null),iP=()=>f.useContext(j3),Ppt=()=>{var e;let t=iP();return(e=t?.code)!=null?e:null},oP=()=>{var e;let t=iP();return(e=t?.mermaid)!=null?e:null},f7e=e=>{var t;let n=iP();return n!=null&&n.renderers&&e&&(t=n.renderers.find(r=>Array.isArray(r.language)?r.language.includes(e):r.language===e))!=null?t:null},g7e=(e,t)=>{var n;let r=(n=void 0)!=null?n:5;return new Promise((a,i)=>{let o="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),l=new Image;l.crossOrigin="anonymous",l.onload=()=>{let c=document.createElement("canvas"),u=l.width*r,d=l.height*r;c.width=u,c.height=d;let h=c.getContext("2d");if(!h){i(new Error("Failed to create 2D canvas context for PNG export"));return}h.drawImage(l,0,0,u,d),c.toBlob(p=>{if(!p){i(new Error("Failed to create PNG blob"));return}a(p)},"image/png")},l.onerror=()=>i(new Error("Failed to load SVG image")),l.src=o})},x7e=({chart:e,children:t,className:n,onDownload:r,config:a,onError:i})=>{let o=Ls(),[l,c]=f.useState(!1),u=f.useRef(null),{isAnimating:d}=f.useContext(Ti),h=Po(),p=oP(),m=kc(),g=async x=>{try{if(x==="mmd"){Im("diagram.mmd",e,"text/plain"),c(!1),r?.(x);return}if(!p){i?.(new Error("Mermaid plugin not available"));return}let b=p.getMermaid(a),y=e.split("").reduce((j,E)=>(j<<5)-j+E.charCodeAt(0)|0,0),v=`mermaid-${Math.abs(y)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:w}=await b.render(v,e);if(!w){i?.(new Error("SVG not found. Please wait for the diagram to render."));return}if(x==="svg"){Im("diagram.svg",w,"image/svg+xml"),c(!1),r?.(x);return}if(x==="png"){let j=await g7e(w);Im("diagram.png",j,"image/png"),r?.(x),c(!1);return}}catch(b){i?.(b)}};return f.useEffect(()=>{let x=b=>{let y=b.composedPath();u.current&&!y.includes(u.current)&&c(!1)};return document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[]),s.jsxs("div",{className:o("relative"),ref:u,children:[s.jsx("button",{className:o("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",n),disabled:d,onClick:()=>c(!l),title:m.downloadDiagram,type:"button",children:t??s.jsx(h.DownloadIcon,{size:14})}),l?s.jsxs("div",{className:o("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[s.jsx("button",{className:o("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("svg"),title:m.downloadDiagramAsSvg,type:"button",children:m.mermaidFormatSvg}),s.jsx("button",{className:o("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("png"),title:m.downloadDiagramAsPng,type:"button",children:m.mermaidFormatPng}),s.jsx("button",{className:o("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("mmd"),title:m.downloadDiagramAsMmd,type:"button",children:m.mermaidFormatMmd})]}):null]})},b7e=({chart:e,config:t,onFullscreen:n,onExit:r,className:a,...i})=>{let{Maximize2Icon:o,XIcon:l}=Po(),c=Ls(),[u,d]=f.useState(!1),{isAnimating:h,controls:p}=f.useContext(Ti),m=kc(),g=(()=>
257{if(typeof p=="boolean")return p;let b=p.mermaid;return b===!1?!1:b===!0||b===void 0?!0:b.panZoom!==!1})(),x=()=>{d(!u)};return f.useEffect(()=>{if(u){rP();let b=y=>{y.key==="Escape"&&d(!1)};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b),aP()}}},[u]),f.useEffect(()=>{u?n?.():r&&r()},[u,n,r]),s.jsxs(s.Fragment,{children:[s.jsx("button",{className:c("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",a),disabled:h,onClick:x,title:m.viewFullscreen,type:"button",...i,children:s.jsx(o,{size:14})}),u?Mn.createPortal(s.jsxs("div",{className:c("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),onClick:x,onKeyDown:b=>{b.key==="Escape"&&x()},role:"button",tabIndex:0,children:[s.jsx("button",{className:c("absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:x,title:m.exitFullscreen,type:"button",children:s.jsx(l,{size:20})}),s.jsx("div",{className:c("flex size-full items-center justify-center p-4"),onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),role:"presentation",children:s.jsx(Fte,{chart:e,className:c("size-full [&_svg]:h-auto [&_svg]:w-auto"),config:t,fullscreen:!0,showControls:g})})]}),document.body):null]})},ate=e=>{var t,n;let r=[],a=[],i=e.querySelectorAll("thead th");for(let l of i)r.push(((t=l.textContent)==null?void 0:t.trim())||"");let o=e.querySelectorAll("tbody tr");for(let l of o){let c=[],u=l.querySelectorAll("td");for(let d of u)c.push(((n=d.textContent)==null?void 0:n.trim())||"");a.push(c)}return{headers:r,rows:a}},ite=e=>{let{headers:t,rows:n}=e,r=l=>{let c=!1,u=!1;for(let d of l){if(d==='"'){c=!0,u=!0;break}(d===","||d===` 258`)&&(c=!0)}return c?u?`"${l.replace(/"/g,'""')}"`:`"${l}"`:l},a=t.length>0?n.length+1:n.length,i=new Array(a),o=0;t.length>0&&(i[o]=t.map(r).join(","),o+=1);for(let l of n)i[o]=l.map(r).join(","),o+=1;return i.join(` 259`)},y7e=e=>{let{headers:t,rows:n}=e,r=l=>{let c=!1;for(let d of l)if(d===" "||d===` 260`||d==="\r"){c=!0;break}if(!c)return l;let u=[];for(let d of l)d===" "?u.push("\\t"):d===` 261`?u.push("\\n"):d==="\r"?u.push("\\r"):u.push(d);return u.join("")},a=t.length>0?n.length+1:n.length,i=new Array(a),o=0;t.length>0&&(i[o]=t.map(r).join(" "),o+=1);for(let l of n)i[o]=l.map(r).join(" "),o+=1;return i.join(` 262`)},yE=e=>{let t=!1;for(let r of e)if(r==="\\"||r==="|"){t=!0;break}if(!t)return e;let n=[];for(let r of e)r==="\\"?n.push("\\\\"):r==="|"?n.push("\\|"):n.push(r);return n.join("")},_3=e=>{let{headers:t,rows:n}=e;if(t.length===0)return"";let r=new Array(n.length+2),a=0,i=t.map(l=>yE(l));r[a]=`| ${i.join(" | ")} |`,a+=1;let o=new Array(t.length);for(let l=0;l<t.length;l+=1)o[l]="---";r[a]=`| ${o.join(" | ")} |`,a+=1;for(let l of n)if(l.length<t.length){let c=new Array(t.length);for(let u=0;u<t.length;u+=1)c[u]=u<l.length?yE(l[u]):"";r[a]=`| ${c.join(" | ")} |`,a+=1}else{let c=l.map(u=>yE(u));r[a]=`| ${c.join(" | ")} |`,a+=1}return r.join(` 263`)},ote=({children:e,className:t,onCopy:n,onError:r,timeout:a=2e3})=>{let i=Ls(),[o,l]=f.useState(!1),[c,u]=f.useState(!1),d=f.useRef(null),h=f.useRef(0),{isAnimating:p}=f.useContext(Ti),m=kc(),g=async y=>{var v,w;if(typeof window>"u"||!((v=navigator?.clipboard)!=null&&v.write)){r?.(new Error("Clipboard API not available"));return}try{let j=(w=d.current)==null?void 0:w.closest('[data-streamdown="table-wrapper"]'),E=j?.querySelector("table");if(!E){r?.(new Error("Table not found"));return}let S=ate(E),_=({csv:ite,tsv:y7e,md:_3}[y]||_3)(S),k=new ClipboardItem({"text/plain":new Blob([_],{type:"text/plain"}),"text/html":new Blob([E.outerHTML],{type:"text/html"})});await navigator.clipboard.write([k]),u(!0),l(!1),n?.(y),h.current=window.setTimeout(()=>u(!1),a)}catch(j){r?.(j)}};f.useEffect(()=>{let y=v=>{let w=v.composedPath();d.current&&!w.includes(d.current)&&l(!1)};return document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y),window.clearTimeout(h.current)}},[]);let x=Po(),b=c?x.CheckIcon:x.CopyIcon;return s.jsxs("div",{className:i("relative"),ref:d,children:[s.jsx("button",{className:i("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:p,onClick:()=>l(!o),title:m.copyTable,type:"button",children:e??s.jsx(b,{height:14,width:14})}),o?s.jsxs("div",{className:i("absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[s.jsx("button",{className:i("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("md"),title:m.copyTableAsMarkdown,type:"button",children:m.tableFormatMarkdown}),s.jsx("button",{className:i("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("csv"),title:m.copyTableAsCsv,type:"button",children:m.tableFormatCsv}),s.jsx("button",{className:i("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("tsv"),title:m.copyTableAsTsv,type:"button",children:m.tableFormatTsv})]}):null]})},lte=({children:e,className:t,onDownload:n,onError:r})=>{let a=Ls(),[i,o]=f.useState(!1),l=f.useRef(null),{isAnimating:c}=f.useContext(Ti),u=kc(),d=Po(),h=p=>{var m;try{let g=(m=l.current)==null?void 0:m.closest('[data-streamdown="table-wrapper"]'),x=g?.querySelector("table");if(!x){r?.(new Error("Table not found"));return}let b=ate(x),y=p==="csv"?ite(b):_3(b);Im(`table.${p==="csv"?"csv":"md"}`,y,p==="csv"?"text/csv":"text/markdown"),o(!1),n?.(p)}catch(g){r?.(g)}};return f.useEffect(()=>{let p=m=>{let g=m.composedPath();l.current&&!g.includes(l.current)&&o(!1)};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[]),s.jsxs("div",{className:a("relative"),ref:l,children:[s.jsx("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:c,onClick:()=>o(!i),title:u.downloadTable,type:"button",children:e??s.jsx(d.DownloadIcon,{size:14})}),i?s.jsxs("div",{className:a("absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[s.jsx("button",{className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>h("csv"),title:u.downloadTableAsCsv,type:"button",children:u.tableFormatCsv}),s.jsx("button",{className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>
263h("markdown"),title:u.downloadTableAsMarkdown,type:"button",children:u.tableFormatMarkdown})]}):null]})},v7e=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:a,XIcon:i}=Po(),o=Ls(),[l,c]=f.useState(!1),{isAnimating:u}=f.useContext(Ti),d=kc(),h=()=>{c(!0)},p=()=>{c(!1)};return f.useEffect(()=>{if(l){rP();let m=g=>{g.key==="Escape"&&c(!1)};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m),aP()}}},[l]),s.jsxs(s.Fragment,{children:[s.jsx("button",{className:o("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:u,onClick:h,title:d.viewFullscreen,type:"button",children:s.jsx(a,{size:14})}),l?Mn.createPortal(s.jsx("div",{"aria-label":d.viewFullscreen,"aria-modal":"true",className:o("fixed inset-0 z-50 flex flex-col bg-background"),"data-streamdown":"table-fullscreen",onClick:p,onKeyDown:m=>{m.key==="Escape"&&p()},role:"dialog",children:s.jsxs("div",{className:o("flex h-full flex-col"),onClick:m=>m.stopPropagation(),onKeyDown:m=>m.stopPropagation(),role:"presentation",children:[s.jsxs("div",{className:o("flex items-center justify-end gap-1 p-4"),children:[n?s.jsx(ote,{}):null,r?s.jsx(lte,{}):null,s.jsx("button",{className:o("rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:p,title:d.exitFullscreen,type:"button",children:s.jsx(i,{size:20})})]}),s.jsx("div",{className:o("flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10"),children:s.jsx("table",{className:o("w-full border-collapse border border-border"),"data-streamdown":"table",children:e})})]})}),document.body):null]})},w7e=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:a=!0,showFullscreen:i=!0,...o})=>{let l=Ls(),c=n&&r,u=n&&a,d=n&&i,h=c||u||d;return s.jsxs("div",{className:l("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"),"data-streamdown":"table-wrapper",children:[h?s.jsxs("div",{className:l("flex items-center justify-end gap-1"),children:[c?s.jsx(ote,{}):null,u?s.jsx(lte,{}):null,d?s.jsx(v7e,{showCopy:c,showDownload:u,children:e}):null]}):null,s.jsx("div",{className:l("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"),children:s.jsx("table",{className:l("w-full divide-y divide-border",t),"data-streamdown":"table",...o,children:e})})]})},j7e=/startLine=(\d+)/,_7e=/\bnoLineNumbers\b/,k7e=f.lazy(()=>re(()=>Promise.resolve().then(()=>Yht),void 0).then(e=>({default:e.Mermaid}))),N7e=/language-([^\s]+)/;function _k(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,a=e.position.end,i=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&a?.line===i?.line&&a?.column===i?.column}function Zn(e,t){return e.className===t.className&&_k(e.node,t.node)}var k3=(e,t)=>typeof e=="boolean"?e:e[t]!==!1,vE=(e,t)=>{if(typeof e=="boolean")return e;let n=e.table;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},l9=(e,t)=>{if(typeof e=="boolean")return e;let n=e.code;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},Xy=(e,t)=>{if(typeof e=="boolean")return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},lP=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("ol",{className:a("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...r,children:e})},(e,t)=>Zn(e,t));lP.displayName="MarkdownOl";var cte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("li",{className:a("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...r,children:e})},(e,t)=>e.className===t.className&&_k(e.node,t.node));cte.displayName="MarkdownLi";var ute=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("ul",{className:a("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...r,children:e})},(e,t)=>Zn(e,t));ute.displayName="MarkdownUl";var dte=f.memo(({className:e,node:t,...n})=>{let r=Ls();return s.jsx("hr",{className:r("my-6 border-border",e),"data-streamdown":"horizontal-rule",...n})},(e,t)=>Zn(e,t));dte.displayName="MarkdownHr";var hte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("span",{className:a("font-semibold",t),"data-streamdown":"strong",...r,children:e})},(e,t)=>Zn(e,t));hte.displayName="MarkdownStrong";var E7e=({children:e,className:t,href:n,node:r,...a})=>{let i=Ls(),{linkSafety:o}=f.useContext(Ti),[l,c]=f.useState(!1),u=n==="streamdown:incomplete-link",d=f.useCallback(async g=>{if(!(!(o!=null&&o.enabled&&n)||u)){if(g.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,"_blank","noreferrer");return}c(!0)}},[o,n,u]),h=f.useCallback(()=>{n&&window.open(n,"_blank","noreferrer")},[n]),p=f.useCallback(()=>{c(!1)},[]),m={url:n??"",isOpen:l,onClose:p,onConfirm:h};return o!=null&&o.enabled&&n?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:i("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":u,"data-streamdown":"link",onClick:d,type:"button",children:e}),o.renderModal?o.renderModal(m):s.jsx(m7e,{...m})]}):s.jsx("a",{className:i("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":u,"data-streamdown":"link",href:n,rel:"noreferrer",target:"_blank",...a,children:e})},pte=f.memo(E7e,(e,t)=>Zn(e,t)&&e.href===t.href);pte.displayName="MarkdownA";var mte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("h1",{className:a("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...r,children:e})},(e,t)=>Zn(e,t));mte.displayName="MarkdownH1";var fte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("h2",{className:a("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...r,children:e})},(e,t)=>Zn(e,t));fte.displayName="MarkdownH2";var gte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("h3",{className:a("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...r,children:e})},(e,t)=>Zn(e,t));gte.displayName="MarkdownH3";var xte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("h4",{className:a("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...r,children:e})},(e,t)=>Zn(e,t));xte.displayName="MarkdownH4";var bte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("h5",{className:a("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...r,children:e})},(e,t)=>Zn(e,t));bte.displayName="MarkdownH5";var yte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("h6",{className:a("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...r,children:e})},(e,t)=>Zn(e,t));yte.displayName="MarkdownH6";var vte=f.memo(({children:e,className:t,node:n,...r})=>{let{controls:a}=f.useContext(Ti),i=k3(a,"table"),o=vE(a,"copy"),l=vE(a,"download"),c=vE(a,"fullscreen");return s.jsx(w7e,{className:t,showControls:i,showCopy:o,showDownload:l,showFullscreen:c,...r,children:e})},(e,t)=>Zn(e,t));vte.displayName="MarkdownTable";var wte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("thead",{className:a("bg-muted/80",t),"data-streamdown":"table-header",...r,children:e})},(e,t)=>Zn(e,t));wte.displayName="MarkdownThead";var jte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("tbody",{className:a("divide-y divide-border",t),"data-streamdown":"table-body",...r,children:e})},(e,t)=>Zn(e,t));jte.displayName="MarkdownTbody";var _te=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("tr",{className:a("border-border",t),"data-streamdown":"table-row",...r,children:e})},(e,t)=>Zn(e,t));_te.displayName="MarkdownTr";var kte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("th",{className:a("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...r,children:e})},(e,t)=>Zn(e,t));kte.displayName="MarkdownTh";var Nte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("td",{className:a("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...r,children:e})},(e,t)=>Zn(e,t));Nte.displayName="MarkdownTd";var Ete=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("blockquote",{className:a("my-4 border-muted-foreground
263/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...r,children:e})},(e,t)=>Zn(e,t));Ete.displayName="MarkdownBlockquote";var Ste=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("sup",{className:a("text-sm",t),"data-streamdown":"superscript",...r,children:e})},(e,t)=>Zn(e,t));Ste.displayName="MarkdownSup";var Cte=f.memo(({children:e,className:t,node:n,...r})=>{let a=Ls();return s.jsx("sub",{className:a("text-sm",t),"data-streamdown":"subscript",...r,children:e})},(e,t)=>Zn(e,t));Cte.displayName="MarkdownSub";var Tte=f.memo(({children:e,className:t,node:n,...r})=>{if("data-footnotes"in r){let a=o=>{var l,c;if(!f.isValidElement(o))return!1;let u=Array.isArray(o.props.children)?o.props.children:[o.props.children],d=!1,h=!1;for(let p of u)if(p){if(typeof p=="string")p.trim()!==""&&(d=!0);else if(f.isValidElement(p))if(((l=p.props)==null?void 0:l["data-footnote-backref"])!==void 0)h=!0;else{let m=Array.isArray(p.props.children)?p.props.children:[p.props.children];for(let g of m){if(typeof g=="string"&&g.trim()!==""){d=!0;break}if(f.isValidElement(g)&&((c=g.props)==null?void 0:c["data-footnote-backref"])===void 0){d=!0;break}}}}return h&&!d},i=Array.isArray(e)?e.map(o=>{if(!f.isValidElement(o))return o;if(o.type===lP){let l=(Array.isArray(o.props.children)?o.props.children:[o.props.children]).filter(c=>!a(c));return l.length===0?null:{...o,props:{...o.props,children:l}}}return o}):e;return(Array.isArray(i)?i.some(o=>o!==null):i!==null)?s.jsx("section",{className:t,...r,children:i}):null}return s.jsx("section",{className:t,...r,children:e})},(e,t)=>Zn(e,t));Tte.displayName="MarkdownSection";var S7e=({node:e,className:t,children:n,...r})=>{var a,i;let o=Ls(),l=!("data-block"in r),{mermaid:c,controls:u,lineNumbers:d}=f.useContext(Ti),h=oP(),p=H9e(),m=t?.match(N7e),g=(a=m?.at(1))!=null?a:"",x=f7e(g);if(l)return s.jsx("code",{className:o("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...r,children:n});let b=(i=e?.properties)==null?void 0:i.metastring,y=b?.match(j7e),v=y?Number.parseInt(y[1],10):void 0,w=v!==void 0&&v>=1?v:void 0,j=!(b&&_7e.test(b))&&d!==!1,E="";if(f.isValidElement(n)&&n.props&&typeof n.props=="object"&&"children"in n.props&&typeof n.props.children=="string"?E=n.props.children:typeof n=="string"&&(E=n),x){let C=x.component;return s.jsx(f.Suspense,{fallback:s.jsx(o9,{}),children:s.jsx(C,{code:E,isIncomplete:p,language:g,meta:b})})}if(g==="mermaid"&&h){let C=k3(u,"mermaid"),N=Xy(u,"download"),A=Xy(u,"copy"),T=Xy(u,"fullscreen"),I=Xy(u,"panZoom"),$=C&&(N||A||T);return s.jsx(f.Suspense,{fallback:s.jsx(o9,{}),children:s.jsxs("div",{className:o("group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",t),"data-streamdown":"mermaid-block",children:[s.jsx("div",{className:o("flex h-8 items-center text-muted-foreground text-xs"),children:s.jsx("span",{className:o("ml-1 font-mono lowercase"),children:"mermaid"})}),$?s.jsx("div",{className:o("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:s.jsxs("div",{className:o("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"mermaid-block-actions",children:[N?s.jsx(x7e,{chart:E,config:c?.config}):null,A?s.jsx(a9,{code:E}):null,T?s.jsx(b7e,{chart:E,config:c?.config}):null]})}):null,s.jsx("div",{className:o("rounded-md border border-border bg-background"),children:s.jsx(k7e,{chart:E,config:c?.config,showControls:I})})]})})}let S=k3(u,"code"),_=l9(u,"download"),k=l9(u,"copy");return s.jsx(Z9e,{className:t,code:E,isIncomplete:p,language:g,lineNumbers:j,startLine:w,children:S?s.jsxs(s.Fragment,{children:[_?s.jsx(d7e,{code:E,language:g}):null,k?s.jsx(a9,{}):null]}):null})},Ate=f.memo(S7e,(e,t)=>e.className===t.className&&_k(e.node,t.node));Ate.displayName="MarkdownCode";var Rte=f.memo(p7e,(e,t)=>e.className===t.className&&_k(e.node,t.node));Rte.displayName="MarkdownImg";var Ite=f.memo(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(a=>a!=null&&a!=="");if(r.length===1&&f.isValidElement(r[0])){let a=r[0].props.node,i=a?.tagName;if(i==="img")return s.jsx(s.Fragment,{children:e});if(i==="code"&&"data-block"in r[0].props)return s.jsx(s.Fragment,{children:e})}return s.jsx("p",{...n,children:e})},(e,t)=>Zn(e,t));Ite.displayName="MarkdownParagraph";var C7e={ol:lP,li:cte,ul:ute,hr:dte,strong:hte,a:pte,h1:mte,h2:fte,h3:gte,h4:xte,h5:bte,h6:yte,table:vte,thead:wte,tbody:jte,tr:_te,th:kte,td:Nte,blockquote:Ete,code:Ate,img:Rte,pre:({children:e})=>f.isValidElement(e)?f.cloneElement(e,{"data-block":"true"}):e,sup:Ste,sub:Cte,p:Ite,section:Tte},T7e=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,A7e=new RegExp("\\p{L}","u");function c9(e){let t=e.replace(/^#{1,6}\s+/gm,"").replace(/(\*{1,3}|_{1,3})/g,"").replace(/`[^`]*`/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[\s>*\-+\d.]+/gm,"");for(let n of t){if(T7e.test(n))return"rtl";if(A7e.test(n))return"ltr"}return"ltr"}var R7e=/^[ \t]{0,3}(`{3,}|~{3,})/,I7e=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,u9=e=>{let t=e.split(` 264`),n=null,r=0;for(let a of t){let i=R7e.exec(a);if(n===null){if(i){let o=i[1];n=o[0],r=o.length}}else if(i){let o=i[1],l=o[0],c=o.length;l===n&&c>=r&&(n=null,r=0)}}return n!==null},P7e=e=>{let t=e.split(` 265`);for(let n of t){let r=n.trim();if(r.length>0&&r.includes("|")&&I7e.test(r))return!0}return!1},L7e=()=>e=>{hl(e,"html",(t,n,r)=>{!r||typeof n!="number"||(r.children[n]={type:"text",value:t.value})})},d9=[],h9={allowDangerousHtml:!0},Jy=new WeakMap,O7e=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(t){let n=this.keyCache.get(t);if(n)return n;let r=t.rehypePlugins,a=t.remarkPlugins,i=t.remarkRehypeOptions;if(!(r||a||i)){let h="default";return this.keyCache.set(t,h),h}let o=h=>{if(!h||h.length===0)return"";let p="";for(let m=0;m<h.length;m+=1){let g=h[m];if(m>0&&(p+=","),Array.isArray(g)){let[x,b]=g;if(typeof x=="function"){let y=Jy.get(x);y||(y=x.name,Jy.set(x,y)),p+=y}else p+=String(x);p+=":",p+=JSON.stringify(b)}else if(typeof g=="function"){let x=Jy.get(g);x||(x=g.name,Jy.set(g,x)),p+=x}else p+=String(g)}return p},l=o(r),c=o(a),u=i?JSON.stringify(i):"",d=`${c}::${l}::${u}`;return this.keyCache.set(t,d),d}get(t){let n=this.generateCacheKey(t),r=this.cache.get(n);return r&&(this.cache.delete(n),this.cache.set(n,r)),r}set(t,n){let r=this.generateCacheKey(t);if(this.cache.size>=this.maxSize){let a=this.cache.keys().next().value;a&&this.cache.delete(a)}this.cache.set(r,n)}clear(){this.cache.clear()}},p9=new O7e,Pte=e=>{let t=M7e(e),n=e.children||"",r=t.runSync(t.parse(n),n);return H7e(r,e)},M7e=e=>{let t=p9.get(e);if(t)return t;let n=$7e(e);return p9.set(e,n),n},D7e=e=>e.some(t=>Array.isArray(t)?t[0]===o3:t===o3),$7e=e=>{let t=e.rehypePlugins||d9,n=e.remarkPlugins||d9,r=D7e(t)?n:[...n,L7e],a=e.remarkRehypeOptions?{...h9,...e.remarkRehypeOptions}:h9;return FFe().use($$e).use(r).use(vFe,a).use(t)},F7e=e=>e,B7e=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:"text",value:r}},U7e=(e,t)=>{var n;for(let r in uE)if(Object.hasOwn(uE,r)&&Object.hasOwn(e.properties,r)){let a=e.properties[r],i=uE[r];(i===null||i.includes(e.tagName))&&(e.properties[r]=(n=t(String(a||""),r,e))!=null?n:void 0)}},z7e=(e,t,n,r,a,i)=>{let o=!1;return r?o=!r.includes(e.tagName):a&&(o=a.includes(e.tagName)),!o&&i&&typeof t=="number"&&(o=!i(e,t,n)),o},H7e=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:a,skipHtml:i,unwrapDisallowed:o,urlTransform:l}=t;if(n||r||a||i||l){let c=l||F7e;hl(e,(u,d,h)=>{if(u.type==="raw"&&h&&typeof d=="number")return B7e(h,d,i,u.value),d;
265if(u.type==="element"&&(U7e(u,c),z7e(u,d,h,r,a,n)&&h&&typeof d=="number"))return o&&u.children?h.children.splice(d,1,...u.children):h.children.splice(d,1),d})}return V8e(e,{Fragment:s.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0})},q7e=/\[\^[\w-]{1,200}\](?!:)/,W7e=/\[\^[\w-]{1,200}\]:/,V7e=/<(\w+)[\s>]/,G7e=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),m9=new Map,f9=new Map,Y7e=e=>{let t=e.toLowerCase(),n=m9.get(t);if(n)return n;let r=new RegExp(`<${t}(?=[\\s>/])[^>]*>`,"gi");return m9.set(t,r),r},K7e=e=>{let t=e.toLowerCase(),n=f9.get(t);if(n)return n;let r=new RegExp(`</${t}(?=[\\s>])[^>]*>`,"gi");return f9.set(t,r),r},g9=(e,t)=>{if(G7e.has(t.toLowerCase()))return 0;let n=e.match(Y7e(t));if(!n)return 0;let r=0;for(let a of n)a.trimEnd().endsWith("/>")||(r+=1);return r},x9=(e,t)=>{let n=e.match(K7e(t));return n?n.length:0},X7e=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]==="$"&&e[n+1]==="$"&&(t+=1,n+=1);return t},J7e=e=>{let t=q7e.test(e),n=W7e.test(e);if(t||n)return[e];let r=Ui.lex(e,{gfm:!0}),a=[],i=[],o=!1;for(let l of r){let c=l.raw,u=a.length;if(i.length>0){a[u-1]+=c;let d=i.at(-1),h=g9(c,d),p=x9(c,d);for(let m=0;m<h;m+=1)i.push(d);for(let m=0;m<p;m+=1)i.length>0&&i.at(-1)===d&&i.pop();continue}if(l.type==="html"&&l.block){let d=c.match(V7e);if(d){let h=d[1],p=g9(c,h),m=x9(c,h);p>m&&i.push(h)}}if(u>0&&!o){let d=a[u-1];if(X7e(d)%2===1){a[u-1]=d+c;continue}}a.push(c),l.type!=="space"&&(o=l.type==="code")}return a},Q7e=(e,t)=>{if(!t.length)return e;let n=e;for(let r of t){let a=new RegExp(`(<${r}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${r}\\s*>)`,"gi");n=n.replace(a,(i,o,l,c)=>{if(!l.includes(` 266 267`))return o+l+c;let u=l.replace(/\n\n/g,` 268<!----> 269`),d=(u.startsWith(` 270`)?"":` 271`)+u+(u.endsWith(` 272`)?"":` 273`);return`${o}${d}${c} 274 275`})}return n},Z7e=/([\\`*_~[\]|])/g,eBe=e=>e.replace(Z7e,"\\$1"),tBe=(e,t)=>{if(!t.length)return e;let n=e;for(let r of t){let a=new RegExp(`(<${r}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${r}\\s*>)`,"gi");n=n.replace(a,(i,o,l,c)=>{let u=eBe(l).replace(/\n\n/g," ");return o+u+c})}return n},Lte=e=>e.type==="text"?e.value:"children"in e&&Array.isArray(e.children)?e.children.map(Lte).join(""):"",sBe=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(r=>r.toLowerCase()));hl(t,"element",r=>{if(n.has(r.tagName.toLowerCase())){let a=Lte(r);r.children=a?[{type:"text",value:a}]:[]}})},nBe=()=>e=>{hl(e,"code",t=>{var n,r;t.meta&&(t.data=(n=t.data)!=null?n:{},t.data.hProperties={...(r=t.data.hProperties)!=null?r:{},metastring:t.meta})})},rBe=/^[ \t]*<[\w!/?-]/,aBe=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,iBe=e=>typeof e!="string"||e.length===0||!rBe.test(e)?e:e.replace(aBe,"$1"),b9,y9,v9,w9,S1={...Od,protocols:{...Od.protocols,href:[...(y9=(b9=Od.protocols)==null?void 0:b9.href)!=null?y9:[],"tel"]},attributes:{...Od.attributes,code:[...(w9=(v9=Od.attributes)==null?void 0:v9.code)!=null?w9:[],"metastring"]}},N3={raw:o3,sanitize:[SZ,S1],harden:[f4e,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},oBe={gfm:[IMe,{}],codeMeta:nBe},j9=Object.values(N3),lBe=Object.values(oBe),cBe={block:" â",circle:" â"},Ote=["github-light","github-dark"],Mte={enabled:!0},uBe={shikiTheme:Ote,controls:!0,isAnimating:!1,lineNumbers:!0,mode:"streaming",mermaid:void 0,linkSafety:Mte},Ti=f.createContext(uBe),Dte=f.memo(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:a,dir:i,animatePlugin:o,...l})=>{if(o){let d=o.getLastRenderCharCount();o.setPrevContentLength(d)}let c=typeof e=="string"&&n?iBe(e):e,u=s.jsx(Pte,{...l,children:c});return s.jsx(ete.Provider,{value:a,children:i?s.jsx("div",{dir:i,style:{display:"contents"},children:u}):u})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(a=>{var i,o;return((i=e.components)==null?void 0:i[a])!==((o=t.components)==null?void 0:o[a])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});Dte.displayName="Block";var $te=f.memo(({children:e,mode:t="streaming",dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:a=!1,components:i,rehypePlugins:o=j9,remarkPlugins:l=lBe,className:c,shikiTheme:u=Ote,mermaid:d,controls:h=!0,isAnimating:p=!1,animated:m,BlockComponent:g=Dte,parseMarkdownIntoBlocksFn:x=J7e,caret:b,plugins:y,remend:v,linkSafety:w=Mte,lineNumbers:j=!0,allowedTags:E,literalTagContent:S,translations:_,icons:k,prefix:C,onAnimationStart:N,onAnimationEnd:A,...T})=>{let I=f.useId(),[$,O]=f.useTransition(),U=f.useMemo(()=>W9e(C),[C]),F=f.useRef(null),H=f.useRef(N),G=f.useRef(A);H.current=N,G.current=A,f.useEffect(()=>{var he,se,le;if(t==="static")return;let ke=F.current;if(F.current=p,ke===null){p&&((he=H.current)==null||he.call(H));return}p&&!ke?(se=H.current)==null||se.call(H):!p&&ke&&((le=G.current)==null||le.call(G))},[p,t]);let M=f.useMemo(()=>E?Object.keys(E):[],[E]),z=f.useMemo(()=>
275{if(typeof e!="string")return"";let he=t==="streaming"&&r?HDe(e,v):e;return S&&S.length>0&&(he=tBe(he,S)),M.length>0&&(he=Q7e(he,M)),he},[e,t,r,v,M,S]),W=f.useMemo(()=>x(z),[z,x]),[D,Z]=f.useState(W);f.useEffect(()=>{t==="streaming"&&!Q?O(()=>{Z(W)}):Z(W)},[W,t]);let V=t==="streaming"?D:W,L=f.useMemo(()=>n==="auto"?V.map(c9):void 0,[V,n]),K=f.useMemo(()=>V.map((he,se)=>`${I}-${se}`),[V.length,I]),te=f.useMemo(()=>m===!0?"true":m?JSON.stringify(m):"",[m]),Q=f.useMemo(()=>te?te==="true"?y3():y3(m):null,[te]),Y=f.useMemo(()=>{var he,se;return{shikiTheme:(se=(he=y?.code)==null?void 0:he.getThemes())!=null?se:u,controls:h,isAnimating:p,lineNumbers:j,mode:t,mermaid:d,linkSafety:w}},[u,h,p,j,t,d,w,y?.code]),J=f.useMemo(()=>_?JSON.stringify(_):"",[_]),P=f.useMemo(()=>({...rte,..._}),[J]),ee=f.useMemo(()=>{let{inlineCode:he,...se}=i??{},le={...C7e,...se};if(he){let ke=le.code;le.code=oe=>"data-block"in oe?ke?f.createElement(ke,oe):null:f.createElement(he,oe)}return le},[i]),X=f.useMemo(()=>{let he=[];return y!=null&&y.cjk&&(he=[...he,...y.cjk.remarkPluginsBefore]),he=[...he,...l],y!=null&&y.cjk&&(he=[...he,...y.cjk.remarkPluginsAfter]),y!=null&&y.math&&(he=[...he,y.math.remarkPlugin]),he},[l,y?.math,y?.cjk]),ae=f.useMemo(()=>{var he;let se=o;if(E&&Object.keys(E).length>0&&o===j9){let le={...S1,tagNames:[...(he=S1.tagNames)!=null?he:[],...Object.keys(E)],attributes:{...S1.attributes,...E}};se=[N3.raw,[SZ,le],N3.harden]}return S&&S.length>0&&(se=[...se,[sBe,S]]),y!=null&&y.math&&(se=[...se,y.math.rehypePlugin]),Q&&p&&(se=[...se,Q.rehypePlugin]),se},[o,y?.math,Q,p,E,S]),me=f.useMemo(()=>{if(!p||V.length===0)return!1;let he=V.at(-1);return u9(he)||P7e(he)},[p,V]),q=f.useMemo(()=>b&&p&&!me?{"--streamdown-caret":`"${cBe[b]}"`}:void 0,[b,p,me]);return t==="static"?s.jsx(w3.Provider,{value:P,children:s.jsx(j3.Provider,{value:y??null,children:s.jsx(Ti.Provider,{value:Y,children:s.jsx(r9,{icons:k,children:s.jsx(v3.Provider,{value:U,children:s.jsx("div",{className:U("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",c),dir:n==="auto"?c9(z):n,children:s.jsx(Pte,{components:ee,rehypePlugins:ae,remarkPlugins:X,...T,children:z})})})})})})}):s.jsx(w3.Provider,{value:P,children:s.jsx(j3.Provider,{value:y??null,children:s.jsx(Ti.Provider,{value:Y,children:s.jsx(r9,{icons:k,children:s.jsx(v3.Provider,{value:U,children:s.jsxs("div",{className:U("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",b&&!me?"[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]":null,c),style:q,children:[V.length===0&&b&&p&&s.jsx("span",{}),V.map((he,se)=>{var le;let ke=se===V.length-1,oe=p&&ke&&u9(he);return s.jsx(g,{animatePlugin:Q,components:ee,content:he,dir:(le=L?.[se])!=null?le:n!=="auto"?n:void 0,index:se,isIncomplete:oe,rehypePlugins:ae,remarkPlugins:X,shouldNormalizeHtmlIndentation:a,shouldParseIncompleteMarkdown:r,...T},K[se])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);$te.displayName="Streamdown";var dBe=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:a=.1,showControls:i=!0,initialZoom:o=1,fullscreen:l=!1})=>{let{RotateCcwIcon:c,ZoomInIcon:u,ZoomOutIcon:d}=Po(),h=Ls(),p=f.useRef(null),m=f.useRef(null),[g,x]=f.useState(o),[b,y]=f.useState({x:0,y:0}),[v,w]=f.useState(!1),[j,E]=f.useState({x:0,y:0}),[S,_]=f.useState({x:0,y:0}),k=f.useCallback(U=>{x(F=>Math.max(n,Math.min(r,F+U)))},[n,r]),C=f.useCallback(()=>{k(a)},[k,a]),N=f.useCallback(()=>{k(-a)},[k,a]),A=f.useCallback(()=>{x(o),y({x:0,y:0})},[o]),T=f.useCallback(U=>{U.preventDefault();let F=U.deltaY>0?-a:a;k(F)},[k,a]),I=f.useCallback(U=>{if(U.button!==0||U.isPrimary===!1)return;w(!0),E({x:U.clientX,y:U.clientY}),_(b);let F=U.currentTarget;F instanceof HTMLElement&&F.setPointerCapture(U.pointerId)},[b]),$=f.useCallback(U=>{if(!v)return;U.preventDefault();let F=U.clientX-j.x,H=U.clientY-j.y;y({x:S.x+F,y:S.y+H})},[v,j,S]),O=f.useCallback(U=>{w(!1);let F=U.currentTarget;F instanceof HTMLElement&&F.releasePointerCapture(U.pointerId)},[]);return f.useEffect(()=>{let U=p.current;if(U)return U.addEventListener("wheel",T,{passive:!1}),()=>{U.removeEventListener("wheel",T)}},[T]),f.useEffect(()=>{let U=m.current;if(U&&v)return document.body.style.userSelect="none",U.addEventListener("pointermove",$,{passive:!1}),U.addEventListener("pointerup",O),U.addEventListener("pointercancel",O),()=>{document.body.style.userSelect="",U.removeEventListener("pointermove",$),U.removeEventListener("pointerup",O),U.removeEventListener("pointercancel",O)}},[v,$,O]),s.jsxs("div",{className:h("relative flex flex-col",l?"h-full w-full":"min-h-28 w-full",t),ref:p,style:{cursor:v?"grabbing":"grab"},children:[i?s.jsxs("div",{className:h("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supp
275orts-[backdrop-filter]:backdrop-blur-sm",l?"bottom-4 left-4":"bottom-2 left-2"),children:[s.jsx("button",{className:h("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"),disabled:g>=r,onClick:C,title:"Zoom in",type:"button",children:s.jsx(u,{size:16})}),s.jsx("button",{className:h("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"),disabled:g<=n,onClick:N,title:"Zoom out",type:"button",children:s.jsx(d,{size:16})}),s.jsx("button",{className:h("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"),onClick:A,title:"Reset zoom and pan",type:"button",children:s.jsx(c,{size:16})})]}):null,s.jsx("div",{className:h("flex-1 origin-center transition-transform duration-150 ease-out",l?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:I,ref:m,role:"application",style:{transform:`translate(${b.x}px, ${b.y}px) scale(${g})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},Fte=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:a=!0})=>{let i=Ls(),[o,l]=f.useState(null),[c,u]=f.useState(!1),[d,h]=f.useState(""),[p,m]=f.useState(""),[g,x]=f.useState(0),{mermaid:b}=f.useContext(Ti),y=oP(),v=b?.errorComponent,{shouldRender:w,containerRef:j}=P9e({immediate:r});if(f.useEffect(()=>{if(w){if(!y){l("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{l(null),u(!0);let S=y.getMermaid(n),_=e.split("").reduce((N,A)=>(N<<5)-N+A.charCodeAt(0)|0,0),k=`mermaid-${Math.abs(_)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:C}=await S.render(k,e);h(C),m(C)}catch(S){if(!(p||d)){let _=S instanceof Error?S.message:"Failed to render Mermaid chart";l(_)}}finally{u(!1)}})()}},[e,n,g,w,y]),!(w||d||p))return s.jsx("div",{className:i("my-4 min-h-[200px]",t),ref:j});if(c&&!d&&!p)return s.jsx("div",{className:i("my-4 flex justify-center p-4",t),ref:j,children:s.jsxs("div",{className:i("flex items-center space-x-2 text-muted-foreground"),children:[s.jsx("div",{className:i("h-4 w-4 animate-spin rounded-full border-current border-b-2")}),s.jsx("span",{className:i("text-sm"),children:"Loading diagram..."})]})});if(o&&!d&&!p){let S=()=>x(_=>_+1);return v?s.jsx("div",{ref:j,children:s.jsx(v,{chart:e,error:o,retry:S})}):s.jsxs("div",{className:i("rounded-md bg-red-50 p-4",t),ref:j,children:[s.jsxs("p",{className:i("font-mono text-red-700 text-sm"),children:["Mermaid Error: ",o]}),s.jsxs("details",{className:i("mt-2"),children:[s.jsx("summary",{className:i("cursor-pointer text-red-600 text-xs"),children:"Show Code"}),s.jsx("pre",{className:i("mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs"),children:e})]})]})}let E=d||p;return s.jsx("div",{className:i("size-full",t),"data-streamdown":"mermaid",ref:j,children:s.jsx(dBe,{className:i(r?"size-full overflow-hidden":"overflow-hidden",t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:a,zoomStep:.1,children:s.jsx("div",{"aria-label":"Mermaid chart",className:i("flex justify-center",r?"size-full items-center":null),dangerouslySetInnerHTML:{__html:E},role:"img"})})})};let fr=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function hBe(e){return cP(e)}function cP(e){return Array.isArray(e)?pBe(e):e instanceof RegExp?e:typeof e=="object"?mBe(e):e}function pBe(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=cP(e[n]);return t}function mBe(e){let t={};for(let n in e)t[n]=cP(e[n]);return t}function Bte(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function Ute(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Ute(e.substring(0,e.length-1)):e.substr(~t+1)}var wE=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Qy=class{static hasCaptures(e){return e===null?!1:(wE.lastIndex=0,wE.test(e))}
vendor: 43,681 bytes, lines 275-277
275static replaceCaptures(e,t,n){return e.replace(wE,(r,a,i,o)=>{let l=n[parseInt(a||i,10)];if(l){let c=t.substring(l.start,l.end);for(;c[0]===".";)c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function zte(e,t){return e<t?-1:e>t?1:0}function Hte(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let a=0;a<n;a++){let i=zte(e[a],t[a]);if(i!==0)return i}return 0}return n-r}function _9(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function qte(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Wte=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},xj=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(xBe(e),t)}static createFromParsedTheme(e,t){return yBe(e,t)}_cachedMatchRoot=new Wte(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(a=>fBe(e.parent,a.parentScopes));return r?new Vte(r.fontStyle,r.foreground,r.background):null}},jE=class C1{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new C1(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new C1(n,t[r]);return n}push(t){return new C1(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function fBe(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],a=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],a=!0}for(;e&&!gBe(e.scopeName,r);){if(a)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function gBe(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Vte=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function xBe(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let a=0,i=t.length;a<i;a++){let o=t[a];if(!o.settings)continue;let l;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),l=h.split(",")}else Array.isArray(o.scope)?l=o.scope:l=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let p=0,m=h.length;p<m;p++)switch(h[p]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let u=null;typeof o.settings.foreground=="string"&&_9(o.settings.foreground)&&(u=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&_9(o.settings.background)&&(d=o.settings.background);for(let h=0,p=l.length;h<p;h++){let g=l[h].trim().split(" "),x=g[g.length-1],b=null;g.length>1&&(b=g.slice(0,g.length-1),b.reverse()),n[r++]=new bBe(x,b,a,c,u,d)}}return n}var bBe=class{constructor(e,t,n,r,a,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=a,this.background=i}},ga=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(ga||{});function yBe(e,t){e.sort((c,u)=>{let d=zte(c.scope,u.scope);return d!==0||(d=Hte(c.parentScopes,u.parentScopes),d!==0)?d:c.index-u.index});let n=0,r="#000000",a="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(a=c.background)}let i=new vBe(t),o=new Vte(n,i.getId(r),i.getId(a)),l=new jBe(new E3(0,null,-1,0,0),[]);for(let c=0,u=e.length;c<u;c++){let d=e[c];l.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new xj(i,o,l)}var vBe=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},wBe=Object.freeze([]),E3=class Gte{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,r,a,i){this.scopeDepth=t,this.parentScopes=n||wBe,this.fontStyle=r,this.foreground=a,this.background=i}clone(){return new Gte(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,a=t.length;r<a;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,a){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),a!==0&&(this.background=a)}},jBe=class S3{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,a=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[a]===">"&&a++,!(r>=t.parentScopes.length||a>=n.parentScopes.length);){const i=n.parentScopes[a].length-t.parentScopes[r].length;if(i!==0)return i;r++,a++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),a,i;if(r===-1?(a=t,i=""):(a=t.substring(0,r),i=t.substring(r+1)),this._children.hasOwnProperty(a))return this._children[a].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(S3._cmpBySpecificity),n}insert(t,n,r,a,i,o){if(n===""){this._doInsertHere(t,r,a,i,o);return}let l=n.indexOf("."),c,u;l===-1?(c=n,u=""):(c=n.substring(0,l),u=n.substring(l+1));let d;this._children.hasOwnProperty(c)?d=this._children[c]:(d=new S3(this._mainRule.clone(),E3.cloneArr(this._rulesWithParentScopes)),this._children[c]=d),d.insert(t+1,u,r,a,i,o)}_doInsertHere(t,n,r,a,i){if(n===null){this._mainRule.acceptOverwrite(t,r,a,i);return}for(let o=0,l=this._rulesWithParentScopes.length;o<l;o++){let c=this._rulesWithParentScopes[o];if(Hte(c.parentScopes,n)===0){c.acceptOverwrite(t,r,a,i);return}}r===-1&&(r=this._mainRule.fontStyle),a===0&&(a=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new E3(t,n,r,a,i))}},pf=class Di{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Di.getLanguageId(t),r=Di.getTokenType(t),a=Di.getFontStyle(t),i=Di.getForeground(t),o=Di.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:a,foreground:i,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,a,i,o,l){let c=Di.getLanguageId(t),u=Di.getTokenType(t),d=Di.containsBalancedBrackets(t)?1:0,h=Di.getFontStyle(t),p=Di.getForeground(t),m=Di.getBackground(t);return n!==0&&(c=n),r!==8&&(u=r),a!==null&&(d=a?1:0),i!==-1&&(h=i),o!==0&&(p=o),l!==0&&(m=l),(c<<0|u<<8|d<<10|h<<11|p<<15|m<<24)>>>0}};function bj(e,t){const n=[],r=_Be(e);let a=r.next();for(;a!==null;){let c=0;if(a.length===2&&a.charAt(1)===":"){switch(a.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${a} in scope selector`)}a=r.next()}let u=o();if(n.push({matcher:u,priority:c}),a!==",")break;a=r.next()}return n;function i(){if(a==="-"){a=r.next();const c=i();return u=>!!c&&!c(u)}if(a==="("){a=r.next();const c=l();return a===")"&&(a=r.next()),c}if(k9(a)){const c=[];do c.push(a),a=r.next();while(k9(a));return u=>t(c,u)}return null}function o(){const c=[];let u=i();for(;u;)c.push(u),u=i();return d=>c.every(h=>h(d))}function l(){const c=[];let u=o();for(;u&&(c.push(u),a==="|"||a===",");){do a=r.next();while(a==="|"||a===",");u=o()}return d=>c.some(h=>h(d))}}function k9(e){return!!e&&!!e.match(/[\w\.:]+/)}function _Be(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Yte(e){typeof e.dispose=="function"&&e.dispose()}var Bb=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},kBe=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},NBe=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},EBe=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Bb(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new NBe;for(const n of e)SBe(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Bb){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function SBe(e,t,n,r){const a=n.lookup(e.scopeName);if(!a){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof Bb?T1({baseGrammar:i,selfGrammar:a},r):C3(e.ruleName,{baseGrammar:i,selfGrammar:a,repository:a.repository},r);const o=n.injections(e.scopeName);if(o)for(const l of o)r.add(new Bb(l))}function C3(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];yj([r],t,n)}}function T1(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&yj(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&yj(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function yj(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const a=r.repository?Bte({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&yj(r.patterns,{...t,repository:a},n);const i=r.include;if(!i)continue;const o=Kte(i);switch(o.kind){case 0:T1({...t,selfGrammar:t.baseGrammar},n);break;case 1:T1(t,n);break;case 2:C3(o.ruleName,{...t,repository:a},n);break;case 3:case 4:const l=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){const c={baseGrammar:t.baseGrammar,selfGrammar:l,repository:a};o.kind===4?C3(o.ruleName,c,n):T1(c,n)}else o.kind===4?n.add(new kBe(o.scopeName,o.ruleName)):n.add(new Bb(o.scopeName));break}}}var CBe=class{kind=0},TBe=class{kind=1},ABe=class{constructor(e){this.ruleName=e}kind=2},RBe=class{constructor(e){this.scopeName=e}kind=3},IBe=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Kte(e){if(e==="$base")return new CBe;if(e==="$self")return new TBe;const t=e.indexOf("#");if(t===-1)return new RBe(e);if(t===0)return new ABe(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new IBe(n,r)}}var PBe=/\\(\d+)/,N9=/\\(\d+)/g,LBe=-1,Xte=-2;var F0=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Qy.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Qy.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Ute(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Qy.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Qy.replaceCaptures(this._contentName,e,t)}},OBe=class extends F0{retokenizeCapturedWithRuleId;constructor(e,t,n,r,a){super(e,t,n,r),this.retokenizeCapturedWithRuleId=a}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},MBe=class extends F0{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,a){super(e,t,n,null),this._match=new Ub(r,this.id),this.captures=a,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new zb,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},E9=class extends F0{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,a){super(e,t,n,r),this.patterns=a.patterns,this.hasMissingPatterns=a.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new zb,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},T3=class extends F0{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,a,i,o,l,c,u){super(e,t,n,r),this._begin=new Ub(a,this.id),this.beginCaptures=i,this._end=new Ub(o||"ï¿¿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=c||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new zb;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},vj=class extends F0{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,a,i,o,l,c){super(e,t,n,r),this._begin=new Ub(a,this.id),this.beginCaptures=i,this.whileCaptures=l,this._while=new Ub(o,Xte),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new zb;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new zb,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"ï¿¿"),this._cachedCompiledWhilePatterns}},Jte=class la{static createCaptureRule(t,n,r,a,i){return t.registerRule(o=>new OBe(n,o,r,a,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(a=>{if(t.id=a,t.match)return new MBe(t.$vscodeTextmateLocation,t.id,t.name,t.match,la._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Bte({},r,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new E9(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,la._compilePatterns(i,n,r))}return t.while?new vj(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,la._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,la._compileCaptures(t.whileCaptures||t.captures,n,r),la._compilePatterns(t.patterns,n,r)):new T3(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,la._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,la._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,la._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let a=[];if(t){let i=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);l>i&&(i=l)}for(let o=0;o<=i;o++)a[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);let c=0;t[o].patterns&&(c=la.getCompiledRuleId(t[o],n,r)),a[l]=la.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,c)}}return a}static _compilePatterns(t,n,r){let a=[];if(t)for(let i=0,o=t.length;i<o;i++){const l=t[i];let c=-1;if(l.include){const u=Kte(l.include);switch(u.kind){case 0:case 1:c=la.getCompiledRuleId(r[l.include],n,r);break;case 2:let d=r[u.ruleName];d&&(c=la.getCompiledRuleId(d,n,r));break;case 3:case 4:const h=u.scopeName,p=u.kind===4?u.ruleName:null,m=n.getExternalGrammar(h,r);if(m)if(p){let g=m.repository[p];g&&(c=la.getCompiledRuleId(g,n,m.repository))}else c=la.getCompiledRuleId(m.repository.$self,n,m.repository);break}}else c=la.getCompiledRuleId(l,n,r);if(c!==-1){const u=n.getRule(c);let d=!1;if((u instanceof E9||u instanceof T3||u instanceof vj)&&u.hasMissingPatterns&&u.patterns.length===0&&(d=!0),d)continue;a.push(c)}}return{patterns:a,hasMissingPatterns:(t?t.length:0)!==a.length}}},Ub=class Qte{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,n){if(t&&typeof t=="string"){const r=t.length;let a=0,i=[],o=!1;for(let l=0;l<r;l++)if(t.charAt(l)==="\\"&&l+1<r){const u=t.charAt(l+1);u==="z"?(i.push(t.substring(a,l)),i.push("$(?!\\n)(?<!\\n)"),a=l+2):(u==="A"||u==="G")&&(o=!0),l++}this.hasAnchor=o,a===0?this.source=t:(i.push(t.substring(a,r)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=PBe.test(this.source):this.hasBackReferences=!1}clone(){return new Qte(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(a=>t.substring(a.start,a.end));return N9.lastIndex=0,this.source.replace(N9,(a,i)=>qte(r[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],a=[],i,o,l,c;for(i=0,o=this.source.length;i<o;i++)l=this.source.charAt(i),t[i]=l,n[i]=l,r[i]=l,a[i]=l,l==="\\"&&i+1<o&&(c=this.source.charAt(i+1),c==="A"?(t[i+1]="ï¿¿",n[i+1]="ï¿¿",r[i+1]="A",a[i+1]="A"):c==="G"?(t[i+1]="ï¿¿",n[i+1]="G",r[i+1]="ï¿¿",a[i+1]="G"):(t[i+1]=c,n[i+1]=c,r[i+1]=c,a[i+1]=c),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:a.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},zb=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new S9(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(a=>a.resolveAnchors(t,n));return new S9(e,r,this._items.map(a=>a.ruleId))}},S9=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(` 276`)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},_E=class{constructor(e,t){this.languageId=e,this.tokenType=t}},DBe=class A3{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,n){this._defaultAttributes=new _E(t,8),this._embeddedLanguagesMatcher=new $Be(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?A3._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new _E(0,0);_getBasicScopeAttributes=new Wte(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new _E(n,r)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(A3.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},$Be=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>qte(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},C9=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Zte(e,t,n,r,a,i,o,l){const c=t.content.length;let u=!1,d=-1;if(o){const m=FBe(e,t,n,r,a,i);a=m.stack,r=m.linePos,n=m.isFirstLine,d=m.anchorPosition}const h=Date.now();for(;!u;){if(l!==0&&Date.now()-h>l)return new C9(a,!0);p()}return new C9(a,!1);function p(){const m=BBe(e,t,n,r,a,d);if(!m){i.produce(a,c),u=!0;return}const g=m.captureIndices,x=m.matchedRuleId,b=g&&g.length>0?g[0].end>r:!1;if(x===LBe){const y=a.getRule(e);i.produce(a,g[0].start),a=a.withContentNameScopesList(a.nameScopesList),dx(e,t,n,a,i,y.endCaptures,g),i.produce(a,g[0].end);const v=a;if(a=a.parent,d=v.getAnchorPos(),!b&&v.getEnterPos()===r){a=v,i.produce(a,c),u=!0;return}}else{const y=e.getRule(x);i.produce(a,g[0].start);const v=a,w=y.getName(t.content,g),j=a.contentNameScopesList.pushAttributed(w,e);if(a=a.push(x,r,d,g[0].end===c,null,j,j),y instanceof T3){const E=y;dx(e,t,n,a,i,E.beginCaptures,g),i.produce(a,g[0].end),d=g[0].end;const S=E.getContentName(t.content,g),_=j.pushAttributed(S,e);if(a=a.withContentNameScopesList(_),E.endHasBackReferences&&(a=a.withEndRule(E.getEndWithResolvedBackReferences(t.content,g))),!b&&v.hasSameRuleAs(a)){a=a.pop(),i.produce(a,c),u=!0;return}}else if(y instanceof vj){const E=y;dx(e,t,n,a,i,E.beginCaptures,g),i.produce(a,g[0].end),d=g[0].end;const S=E.getContentName(t.content,g),_=j.pushAttributed(S,e);if(a=a.withContentNameScopesList(_),E.whileHasBackReferences&&(a=a.withEndRule(E.getWhileWithResolvedBackReferences(t.content,g))),!b&&v.hasSameRuleAs(a)){a=a.pop(),i.produce(a,c),u=!0;return}}else if(dx(e,t,n,a,i,y.captures,g),i.produce(a,g[0].end),a=a.pop(),!b){a=a.safePop(),i.produce(a,c),u=!0;return}}g[0].end>r&&(r=g[0].end,n=!1)}}function FBe(e,t,n,r,a,i){let o=a.beginRuleCapturedEOL?0:-1;const l=[];for(let c=a;c;c=c.pop()){const u=c.getRule(e);u instanceof vj&&l.push({rule:u,stack:c})}for(let c=l.pop();c;c=l.pop()){const{ruleScanner:u,findOptions:d}=HBe(c.rule,e,c.stack.endRule,n,r===o),h=u.findNextMatchSync(t,r,d);if(h){if(h.ruleId!==Xte){a=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(c.stack,h.captureIndices[0].start),dx(e,t,n,c.stack,i,c.rule.whileCaptures,h.captureIndices),i.produce(c.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>r&&(r=h.captureIndices[0].end,n=!1))}else{a=c.stack.pop();break}}return{stack:a,linePos:r,anchorPosition:o,isFirstLine:n}}function BBe(e,t,n,r,a,i){const o=UBe(e,t,n,r,a,i),l=e.getInjections();if(l.length===0)return o;const c=zBe(l,e,t,n,r,a,i);if(!c)return o;if(!o)return c;const u=o.captureIndices[0].start,d=c.captureIndices[0].start;return d<u||c.priorityMatch&&d===u?c:o}function UBe(e,t,n,r,a,i){const o=a.getRule(e),{ruleScanner:l,findOptions:c}=ese(o,e,a.endRule,n,r===i),u=l.findNextMatchSync(t,r,c);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function zBe(e,t,n,r,a,i,o){let l=Number.MAX_VALUE,c=null,u,d=0;const h=i.contentNameScopesList.getScopeNames();for(let p=0,m=e.length;p<m;p++){const g=e[p];if(!g.matcher(h))continue;const x=t.getRule(g.ruleId),{ruleScanner:b,findOptions:y}=ese(x,t,null,r,a===o),v=b.findNextMatchSync(n,a,y);if(!v)continue;const w=v.captureIndices[0].start;if(!(w>=l)&&(l=w,c=v.captureIndices,u=v.ruleId,d=g.priority,l===a))break}return c?{priorityMatch:d===-1,captureIndices:c,matchedRuleId:u}:null}function ese(e,t,n,r,a){return{ruleScanner:e.compileAG(t,n,r,a),findOptions:0}}function HBe(e,t,n,r,a){return{ruleScanner:e.compileWhileAG(t,n,r,a),findOptions:0}}function dx(e,t,n,r,a,i,o){if(i.length===0)return;const l=t.content,c=Math.min(i.length,o.length),u=[],d=o[0].end;for(let h=0;h<c;h++){const p=i[h];if(p===null)continue;const m=o[h];if(m.length===0)continue;if(m.start>d)break;for(;u.length>0&&u[u.length-1].endPos<=m.start;)a.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?a.produceFromScopes(u[u.length-1].scopes,m.start):a.produce(r,m.start),p.retokenizeCapturedWithRuleId){const x=p.getName(l,o),b=r.contentNameScopesList.pushAttributed(x,e),y=p.getContentName(l,o),v=b.pushAttributed(y,e),w=r.push(p.retokenizeCapturedWithRuleId,m.start,-1,!1,null,b,v),j=e.createOnigString(l.substring(0,m.end));Zte(e,j,n&&m.start===0,m.start,w,a,!1,0),Yte(j);continue}const g=p.getName(l,o);if(g!==null){const b=(u.length>0?u[u.length-1].scopes:r.contentNameScopesList).pushAttributed(g,e);u.push(new qBe(b,m.end))}}for(;u.length>0;)a.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var qBe=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function WBe(e,t,n,r,a,i,o,l){return new GBe(e,t,n,r,a,i,o,l)}function T9(e,t,n,r,a){const i=bj(t,wj),o=Jte.getCompiledRuleId(n,r,a.repository);for(const l of i)e.push({debugSelector:t,matcher:l.matcher,ruleId:o,grammar:a,priority:l.priority})}function wj(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let a=n;a<t.length;a++)if(VBe(t[a],r))return n=a+1,!0;return!1})}function VBe(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var GBe=class{constructor(e,t,n,r,a,i,o,l){if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=l,this._basicScopeAttributesProvider=new DBe(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=A9(t,null),this._injections=null,this._tokenTypeMatchers=[],a)for(const c of Object.keys(a)){const u=bj(c,wj);for(const d of u)this._tokenTypeMatchers.push({matcher:d.matcher,type:a[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:a=>a===this._rootScopeName?this._grammar:this.getExternalGrammar(a),injections:a=>this._grammarRepository.injections(a)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const a=r.injections;if(a)for(let o in a)T9(t,o,a[o],this,r);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const l=this.getExternalGrammar(o);if(l){const c=l.injectionSelector;c&&T9(t,c,l,this,l)}})}return t.sort((a,i)=>a.priority-i.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=A9(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Jte.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let a;if(!t||t===R3.NULL){a=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),h=pf.set(0,u.languageId,u.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),p=this.getRule(this._rootId).getName(null,null);let m;p?m=Gx.createRootAndLookUpScopeName(p,h,this):m=Gx.createRoot("unknown",h),t=new R3(null,this._rootId,-1,-1,!1,null,m,m)}else a=!1,t.reset();e=e+` 277`;const i=this.createOnigString(e),o=i.content.length,l=new KBe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Zte(this,i,a,0,t,l,!0,r);return Yte(i),{lineLength:o,lineTokens:l,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function A9(e,t){return e=hBe(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Gx=class zo{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,a=t?.scopePath??null;for(const i of n)a=jE.push(a,i.scopeNames),r=new zo(r,a,i.encodedTokenAttributes);return r}static createRoot(t,n){return new zo(null,new jE(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const a=r.getMetadataForScope(t),i=new jE(null,t),o=r.themeProvider.themeMatch(i),l=zo.mergeAttributes(n,a,o);return new zo(null,i,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return zo.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let a=-1,i=0,o=0;return r!==null&&(a=r.fontStyle,i=r.foregroundId,o=r.backgroundId),pf.set(t,n.languageId,n.tokenType,null,a,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return zo._pushAttributed(this,t,n);const r=t.split(/ /g);let a=this;for(const i of r)a=zo._pushAttributed(a,i,n);return a}static _pushAttributed(t,n,r){const a=r.getMetadataForScope(n),i=t.scopePath.push(n),o=r.themeProvider.themeMatch(i),l=zo.mergeAttributes(t.tokenAttributes,a,o);return new zo(t,i,l)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===t?n.reverse():void 0}},R3=class Sd{constructor(t,n,r,a,i,o,l,c){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=l,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=a}_stackElementBrand=void 0;static NULL=new Sd(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:Sd._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Gx.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){Sd._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,a,i,o,l){return new Sd(this,t,n,r,a,i,o,l)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new Sd(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){const r=Gx.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new Sd(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Gx.fromExtension(r,n.contentNameScopesList))}},YBe=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):bj(n,wj).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>bj(n,wj).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},KBe=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,a=!1;if(this.balancedBracketSelectors?.matchesAlways&&(a=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=e?.getScopeNames()??[];for(const o of this._tokenTypeOverrides)o.matcher(i)&&(r=pf.set(r,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(a=this.balancedBracketSelectors.match(i))}if(a&&(r=pf.set(r,0,8,a,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,a=this._binaryTokens.length;r<a;r++)n[r]=this._binaryTokens[r];return n}},XBe=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,a){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,WBe(e,i,t,n,r,a,this,this._onigLib))}return this._grammars.get(e)}},JBe=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new XBe(xj.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(xj.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new YBe(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,a,i){const o=new EBe(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(l=>this._loadSingleGrammar(l.scopeName)),o.processQueue();return this._grammarForScopeName(t,n,r,a,i)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,a=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,a)}_grammarForScopeName(t,n=0,r=null,a=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,r,a,i)}},I3=R3.NULL;const QBe=/["&'<>`]/g,ZBe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,eUe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,tUe=/[|\\{}()[\]^$+*?.]/g,R9=new WeakMap;function sUe(e,t){if(e=e.replace(t.subset?nUe(t.subset):QBe,r),t.subset||t.escapeOnly)return e;return e.replace(ZBe,n).replace(eUe,r);function n(a,i,o){return t.format((a.charCodeAt(0)-55296)*1024+a.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function r(a,i,o){return t.format(a.charCodeAt(0),o.charCodeAt(i+1),t)}}function nUe(e){let t=R9.get(e);return t||(t=rUe(e),R9.set(e,t)),t}function rUe(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(tUe,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const aUe=/[\dA-Fa-f]/;function iUe(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!aUe.test(String.fromCharCode(t))?r:r+";"}const oUe=/\d/;function lUe(e,t,n){const r="&#"+String(e);return n&&t&&!oUe.test(String.fromCharCode(t))?r:r+";"}const cUe=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslas
277h","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],kE={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"Â¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"Â",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"Ã",Aacute:"Ã",Acirc:"Ã",Atilde:"Ã",Auml:"Ã",Aring:"Ã
",AElig:"Ã",Ccedil:"Ã",Egrave:"Ã",Eacute:"Ã",Ecirc:"Ã",Euml:"Ã",Igrave:"Ã",Iacute:"Ã",Icirc:"Ã",Iuml:"Ã",ETH:"Ã",Ntilde:"Ã",Ograve:"Ã",Oacute:"Ã",Ocirc:"Ã",Otilde:"Ã",Ouml:"Ã",times:"Ã",Oslash:"Ã",Ugrave:"Ã",Uacute:"Ã",Ucirc:"Ã",Uuml:"Ã",Yacute:"Ã",THORN:"Ã",szlig:"Ã",agrave:"à ",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"Ã¥",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"Ã",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"Æ",Alpha:"Î",Beta:"Î",Gamma:"Î",Delta:"Î",Epsilon:"Î",Zeta:"Î",Eta:"Î",Theta:"Î",Iota:"Î",Kappa:"Î",Lambda:"Î",Mu:"Î",Nu:"Î",Xi:"Î",Omicron:"Î",Pi:"Î ",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Î¥",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"Ï",rho:"Ï",sigmaf:"Ï",sigma:"Ï",tau:"Ï",upsilon:"Ï
",phi:"Ï",chi:"Ï",psi:"Ï",omega:"Ï",thetasym:"Ï",upsih:"Ï",piv:"Ï",bull:"â¢",hellip:"â¦",prime:"â²",Prime:"â³",oline:"â¾",frasl:"â",weierp:"â",image:"â",real:"â",trade:"â¢",alefsym:"âµ",larr:"â",uarr:"â",rarr:"â",darr:"â",harr:"â",crarr:"âµ",lArr:"â",uArr:"â",rArr:"â",dArr:"â",hArr:"â",forall:"â",part:"â",exist:"â",empty:"â
",nabla:"â",isin:"â",notin:"â",ni:"â",prod:"â",sum:"â",minus:"â",lowast:"â",radic:"â",prop:"â",infin:"â",ang:"â ",and:"â§",or:"â¨",cap:"â©",cup:"âª",int:"â«",there4:"â´",sim:"â¼",cong:"â
",asymp:"â",ne:"â ",equiv:"â¡",le:"â¤",ge:"â¥",sub:"â",sup:"â",nsub
vendor: 61,187 bytes, lines 277-286
277:"â",sube:"â",supe:"â",oplus:"â",otimes:"â",perp:"â¥",sdot:"â ",lceil:"â",rceil:"â",lfloor:"â",rfloor:"â",lang:"â©",rang:"âª",loz:"â",spades:"â ",clubs:"â£",hearts:"â¥",diams:"â¦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Å",oelig:"Å",Scaron:"Å ",scaron:"Å¡",Yuml:"Ÿ",circ:"Ë",tilde:"Ë",ensp:"â",emsp:"â",thinsp:"â",zwnj:"â",zwj:"â",lrm:"â",rlm:"â",ndash:"â",mdash:"â",lsquo:"â",rsquo:"â",sbquo:"â",ldquo:"â",rdquo:"â",bdquo:"â",dagger:"â ",Dagger:"â¡",permil:"â°",lsaquo:"â¹",rsaquo:"âº",euro:"â¬"},uUe=["cent","copy","divide","gt","lt","not","para","times"],tse={}.hasOwnProperty,P3={};let Zy;for(Zy in kE)tse.call(kE,Zy)&&(P3[kE[Zy]]=Zy);const dUe=/[^\dA-Za-z]/;function hUe(e,t,n,r){const a=String.fromCharCode(e);if(tse.call(P3,a)){const i=P3[a],o="&"+i;return n&&cUe.includes(i)&&!uUe.includes(i)&&(!r||t&&t!==61&&dUe.test(String.fromCharCode(t)))?o:o+";"}return""}function pUe(e,t,n){let r=iUe(e,t,n.omitOptionalSemicolons),a;if((n.useNamedReferences||n.useShortestReferences)&&(a=hUe(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!a)&&n.useShortestReferences){const i=lUe(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return a&&(!n.useShortestReferences||a.length<r.length)?a:r}function Pm(e,t){return sUe(e,Object.assign({format:pUe},t))}const mUe=/^>|^->|<!--|-->|--!>|<!-$/g,fUe=[">"],gUe=["<",">"];function xUe(e,t,n,r){return r.settings.bogusComments?"<?"+Pm(e.value,Object.assign({},r.settings.characterReferences,{subset:fUe}))+">":"<!--"+e.value.replace(mUe,a)+"-->";function a(i){return Pm(i,Object.assign({},r.settings.characterReferences,{subset:gUe}))}}function bUe(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const Ar=nse(1),sse=nse(-1),yUe=[];function nse(e){return t;function t(n,r,a){const i=n?n.children:yUe;let o=(r||0)+e,l=i[o];if(!a)for(;l&&vk(l);)o+=e,l=i[o];return l}}const vUe={}.hasOwnProperty;function rse(e){return t;function t(n,r,a){return vUe.call(e,n.tagName)&&e[n.tagName](n,r,a)}}const uP=rse({body:jUe,caption:NE,colgroup:NE,dd:EUe,dt:NUe,head:NE,html:wUe,li:kUe,optgroup:SUe,option:CUe,p:_Ue,rp:I9,rt:I9,tbody:AUe,td:P9,tfoot:RUe,th:P9,thead:TUe,tr:IUe});function NE(e,t,n){const r=Ar(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&vk(r.value.charAt(0)))}function wUe(e,t,n){const r=Ar(n,t);return!r||r.type!=="comment"}function jUe(e,t,n){const r=Ar(n,t);return!r||r.type!=="comment"}function _Ue(e,t,n){const r=Ar(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function kUe(e,t,n){const r=Ar(n,t);return!r||r.type==="element"&&r.tagName==="li"}function NUe(e,t,n){const r=Ar(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function EUe(e,t,n){const r=Ar(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function I9(e,t,n){const r=Ar(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function SUe(e,t,n){const r=Ar(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function CUe(e,t,n){const r=Ar(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function TUe(e,t,n){const r=Ar(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function AUe(e,t,n){const r=Ar(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function RUe(e,t,n){return!Ar(n,t)}function IUe(e,t,n){const r=Ar(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function P9(e,t,n){const r=Ar(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const PUe=rse({body:MUe,colgroup:DUe,head:OUe,html:LUe,tbody:$Ue});function LUe(e){const t=Ar(e,-1);return!t||t.type!=="comment"}function OUe(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function MUe(e){const t=Ar(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&vk(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function DUe(e,t,n){const r=sse(n,t),a=Ar(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&uP(r,n.children.indexOf(r),n)?!1:!!(a&&a.type==="element"&&a.tagName==="col")}function $Ue(e,t,n){const r=sse(n,t),a=Ar(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&uP(r,n.children.indexOf(r),n)?!1:!!(a&&a.type==="element"&&a.tagName==="tr")}const ev={name:[[` 278\f\r &/=>`.split(""),` 279\f\r "&'/=>\``.split("")],[`\0 280\f\r "&'/<=>`.split(""),`\0 281\f\r "&'/<=>\``.split("")]],unquoted:[[` 282\f\r &>`.split(""),`\0 283\f\r "&'<=>\``.split("")],[`\0 284\f\r "&'<=>\``.split(""),`\0 285\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function FUe(e,t,n,r){const a=r.schema,i=a.space==="svg"?!1:r.settings.omitOptionalTags;let o=a.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const l=[];let c;a.space==="html"&&e.tagName==="svg"&&(r.schema=yl);const u=BUe(r,e.properties),d=r.all(a.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=a,d&&(o=!1),(u||!i||!PUe(e,t,n))&&(l.push("<",e.tagName,u?" "+u:""),o&&(a.space==="svg"||r.settings.closeSelfClosing)&&(c=u.charAt(u.length-1),(!r.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&l.push(" "),l.push("/")),l.push(">")),l.push(d),!o&&(!i||!uP(e,t,n))&&l.push("</"+e.tagName+">"),l.join("")}function BUe(e,t){const n=[];let r=-1,a;if(t){for(a in t)if(t[a]!==null&&t[a]!==void 0){const i=UUe(e,a,t[a]);i&&n.push(i)}}for(;++r<n.length;){const i=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function UUe(e,t,n){const r=I0(e.schema,t),a=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let o=e.quote,l;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const c=Pm(r.attribute,Object.assign({},e.settings.characterReferences,{subset:ev.name[a][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?NI:EI)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(l=Pm(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:ev.unquoted[a][i]}))),l!==n&&(e.settings.quoteSmart&&uj(n,o)>uj(n,e.alternative)&&(o=e.alternative),l=o+Pm(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?ev.single:ev.double)[a][i],attribute:!0}))+o),c+(l&&"="+l))}const zUe=["<","&"];function ase(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Pm(e.value,Object.assign({},r.settings.characterReferences,{subset:zUe}))}function HUe(e,t,n,r){return r.settings.allowDangerousHtml?e.value:ase(e,t,n,r)}function qUe(e,t,n,r){return r.all(e)}const WUe=CI("type",{invalid:VUe,unknown:GUe,handlers:{comment:xUe,doctype:bUe,element:FUe,raw:HUe,root:qUe,text:ase}});function VUe(e){throw new Error("Expected node, not `"+e+"`")}function GUe(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const YUe={},KUe={},XUe=[];function JUe(e,t){const n=t||YUe,r=n.quote||'"',a=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:QUe,all:ZUe,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||qQ,characterReferences:n.characterReferences||KUe,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?yl:Hf,quote:r,alternative:a}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function QUe(e,t,n){return WUe(e,t,n,this)}function ZUe(e){const t=[],n=e&&e.children||XUe;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function jj(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[a,i]of Object.entries(t?.colorReplacements||{}))typeof i=="string"?n[a]=i:a===r&&Object.assign(n,i);return n}function gu(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function eze(e){return Array.isArray(e)?e:[e]}async function ise(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function dP(e){return!e||["plaintext","txt","text","plain"].includes(e)}function ose(e){return e==="ansi"||dP(e)}function hP(e){return e==="none"}function lse(e){return hP(e)}function cse(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const r of n)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function kk(e,t=!1){if(e.length===0)return[["",0]];const n=e.split(/(\r?\n)/g);let r=0;const a=[];for(let i=0;i<n.length;i+=2){const o=t?n[i]+(n[i+1]||""):n[i];a.push([o,r]),r+=n[i].length,r+=n[i+1]?.length||0}return a}function tze(e){const t=kk(e,!0).map(([a])=>a);function n(a){if(a===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=a,o=0;for(const l of t){if(i<l.length)break;i-=l.length,o++}return{line:o,character:i}}function r(a,i){let o=0;for(let l=0;l<a;l++)o+=t[l].length;return o+=i,o}return{lines:t,indexToPos:n,posToIndex:r}}const pP="light-dark()",sze=["color","background-color"];function nze(e,t){let n=0;const r=[];for(const a of t)a>n&&r.push({...e,content:e.content.slice(n,a),offset:e.offset+n}),n=a;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function rze(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((r,a)=>r-a);return n.length?e.map(r=>r.flatMap(a=>{const i=n.filter(o=>a.offset<o&&o<a.offset+a.content.length).map(o=>o-a.offset).sort((o,l)=>o-l);return i.length?nze(a,i):a})):e}function aze(e,t,n,r,a="css-vars"){const i={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(d=>_j(e.variants[d])),l=new Set(o.flatMap(d=>Object.keys(d))),c={},u=(d,h)=>{const p=h==="color"?"":h==="background-color"?"-bg":`-${h}`;return n+t[d]+(h==="color"?"":p)};return o.forEach((d,h)=>{for(const p of l){const m=d[p]||"inherit";if(h===0&&r&&sze.includes(p))if(r===pP&&o.length>1){const g=t.findIndex(v=>v==="light"),x=t.findIndex(v=>v==="dark");if(g===-1||x===-1)throw new fr('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const b=o[g][p]||"inherit",y=o[x][p]||"inherit";c[p]=`light-dark(${b}, ${y})`,a==="css-vars"&&(c[u(h,p)]=m)}else c[p]=m;else a==="css-vars"&&(c[u(h,p)]=m)}}),i.htmlStyle=c,i}function _j(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&ga.Italic&&(t["font-style"]="italic"),e.fontStyle&ga.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&ga.Underline&&n.push("underline"),e.fontStyle&ga.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function L3(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}const use=new WeakMap;function Nk(e,t){use.set(e,t)}function Hb(e){return use.get(e)}class Kf{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new Kf(Object.fromEntries(eze(n).map(r=>[r,I3])),t)}constructor(...t){if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,a]=t;this.lang=r,this._stacks={[a]:n}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return ize(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function ize(e){const t=[],n=new Set;function r(a){if(n.has(a))return;n.add(a);const i=a?.nameScopesList?.scopeName;i&&t.push(i),a.parent&&r(a.parent)}return r(e),t}function oze(e,t){if(!(e instanceof Kf))throw new fr("Invalid grammar state");return e.getInternalStack(t)}function lze(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let r=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new fr(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...a.indexToPos(o),offset:o}}else{const l=a.lines[o.line];if(l===void 0)throw new fr(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${a.lines.length}`);let c=o.character;if(c<0&&(c=l.length+c),c<0||c>l.length)throw new fr(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${l.length}`);return{...o,character:c,offset:a.posToIndex(o.line,c)}}};const a=tze(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:r(o.start),end:r(o.end)}));cze(i),e.set(n.meta,{decorations:i,converter:a,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const a=t(this).decorations.flatMap(o=>[o.start.offset,o.end.offset]);return rze(n,a)},code(n){if(!this.options.decorations?.length)return;const r=t(this),a=Array.from(n.children).filter(d=>d.type==="element"&&d.tagName==="span");if(a.length!==r.converter.lines.length)throw new fr(`Number of lines in code element (${a.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(d,h,p,m){const g=a[d];let x="",b=-1,y=-1;if(h===0&&(b=0),p===0&&(y=0),p===Number.POSITIVE_INFINITY&&(y=g.children.length),b===-1||y===-1)for(let w=0;w<g.children.length;w++)x+=dse(g.children[w]),b===-1&&x.length===h&&(b=w+1),y===-1&&x.length===p&&(y=w+1);if(b===-1)throw new fr(`Failed to find start index for decoration ${JSON.stringify(m.start)}`);if(y===-1)throw new fr(`Failed to find end index for decoration ${JSON.stringify(m.end)}`);const v=g.children.slice(b,y);if(!m.alwaysWrap&&v.length===g.children.length)l(g,m,"line");else if(!m.alwaysWrap&&v.length===1&&v[0].type==="element")l(v[0],m,"token");else{const w={type:"element",tagName:"span",properties:{},children:v};l(w,m,"wrapper"),g.children.splice(b,v.length,w)}}function o(d,h){a[d]=l(a[d],h,"line")}function l(d,h,p){const m=h.properties||{},g=h.transform||(x=>x);return d.tagName=h.tagName||"span",d.properties={...d.properties,...m,class:d.properties.class},h.properties?.class&&cse(d,h.properties.class),d=g(d,p)||d,d}const c=[],u=r.decorations.sort((d,h)=>h.start.offset-d.start.offset||d.end.offset-h.end.offset);for(const d of u){const{start:h,end:p}=d;if(h.line===p.line)i(h.line,h.character,p.character,d);else if(h.line<p.line){i(h.line,h.character,Number.POSITIVE_INFINITY,d);for(let m=h.line+1;m<p.line;m++)c.unshift(()=>o(m,d));i(p.line,0,p.character,d)}}c.forEach(d=>d())}}}function cze(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new fr(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const a=e[r],i=n.start.offset<=a.start.offset&&a.start.offset<n.end.offset,o=n.start.offset<a.end.offset&&a.end.offset<=n.end.offset,l=a.start.offset<=n.start.offset&&n.start.offset<a.end.offset,c=a.start.offset<n.end.offset&&n.end.offset<=a.end.offset;if(i||o||l||c){if(i&&o||l&&c||l&&n.start.offset===n.end.offset||o&&a.start.offset===a.end.offset)continue;throw new fr(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(a.start)} intersect.`)}}}}function dse(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(dse).join(""):""}const uze=[lze()];function kj(e){const t=dze(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...uze]}function dze(e){const t=[],n=[],r=[];for(const a of e)switch(a.enforce){case"pre":t.push(a);break;case"post":n.push(a);break;default:r.push(a)}return{pre:t,post:n,normal:r}}var Xd=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],EE={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function hze(e,t){const n=e.indexOf("\x1B",t);if(n!==-1&&e[n+1]==="["){const r=e.indexOf("m",n);if(r!==-1)return{sequence:e.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:e.length}}function L9(e){const t=e.shift();if(t==="2"){const n=e.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(t==="5"){const n=e.shift();if(n)return{type:"table",index:Number(n)}}}function pze(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:"resetAll"});else if(r<=9)EE[r]&&t.push({type:"setDecoration",value:EE[r]});else if(r<=29){const a=EE[r-20];a&&(t.push({type:"resetDecoration",value:a}),a==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Xd[r-30]}});else if(r===38){const a=L9(e);a&&t.push({type:"setForegroundColor",value:a})}else if(r===39)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Xd[r-40]}});else if(r===48){const a=L9(e);a&&t.push({type:"setBackgroundColor",value:a})}else r===49?t.push({type:"resetBackgroundColor"}):r===53?t.push({type:"setDecoration",value:"overline"}):r===55?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Xd[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Xd[r-100+8]}})}return t}function mze(){let e=null,t=null,n=new Set;return{parse(r){const a=[];let i=0;do{const o=hze(r,i),l=o.sequence?r.substring(i,o.startPosition):r.substring(i);if(l.length>0&&a.push({value:l,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const c=pze(o.sequence);for(const u of c)u.type==="resetAll"?(e=null,t=null,n.clear()):u.type==="resetForegroundColor"?e=null:u.type==="resetBackgroundColor"?t=null:u.type==="resetDecoration"&&n.delete(u.value);for(const u of c)u.type==="setForegroundColor"?e=u.value:u.type==="setBackgroundColor"?t=u.value:u.type==="setDecoration"&&n.add(u.value)}i=o.position}while(i<r.length);return a}}}var fze={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function gze(e=fze){function t(l){return e[l]}function n(l){return`#${l.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let r;function a(){if(r)return r;r=[];for(let u=0;u<Xd.length;u++)r.push(t(Xd[u]));let l=[0,95,135,175,215,255];for(let u=0;u<6;u++)for(let d=0;d<6;d++)for(let h=0;h<6;h++)r.push(n([l[u],l[d],l[h]]));let c=8;for(let u=0;u<24;u++,c+=10)r.push(n([c,c,c]));return r}function i(l){return a()[l]}function o(l){switch(l.type){case"named":return t(l.name);case"rgb":return n(l.rgb);case"table":return i(l.index)}}return{value:o}}const xze={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function bze(e,t,n){const r=jj(e,n),a=kk(t),i=Object.fromEntries(Xd.map(c=>{const u=`terminal.ansi${c[0].toUpperCase()}${c.substring(1)}`,d=e.colors?.[u];return[c,d||xze[c]]})),o=gze(i),l=mze();return a.map(c=>l.parse(c[0]).map(u=>{let d,h;u.decorations.has("reverse")?(d=u.background?o.value(u.background):e.bg,h=u.foreground?o.value(u.foreground):e.fg):(d=u.foreground?o.value(u.foreground):e.fg,h=u.background?o.value(u.background):void 0),d=gu(d,r),h=gu(h,r),u.decorations.has("dim")&&(d=yze(d));let p=ga.None;return u.decorations.has("bold")&&(p|=ga.Bold),u.decorations.has("italic")&&(p|=ga.Italic),u.decorations.has("underline")&&(p|=ga.Underline),u.decorations.has("strikethrough")&&(p|=ga.Strikethrough),{content:u.value,offset:c[1],color:d,bgColor:h,fontStyle:p}}))}function yze(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const r=t[1];if(r.length===8){const a=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${a}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const a=r[0],i=r[1],o=r[2],l=r[3],c=Math.round(Number.parseInt(`${l}${l}`,16)/2).toString(16).padStart(2,"0");return`#${a}${a}${i}${i}${o}${o}${c}`}else if(r.length===3){const a=r[0],i=r[1],o=r[2];return`#${a}${a}${i}${i}${o}${o}80`}}}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function mP(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n,a=e.resolveLangAlias(n.lang||"text");if(dP(a)||hP(r))return kk(t).map(c=>[{content:c[0],offset:c[1]}]);const{theme:i,colorMap:o}=e.setTheme(r);if(a==="ansi")return bze(i,t,n);const l=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==l.name)throw new fr(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${l.name}"`);if(!n.grammarState.themes.includes(i.name))throw new fr(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return wze(t,l,i,o,n)}function vze(...e){if(e.length===2)return Hb(e[1]);const[t,n,r={}]=e,{lang:a="text",theme:i=t.getLoadedThemes()[0]}=r;if(dP(a)||hP(i))throw new fr("Plain language does not have grammar state");if(a==="ansi")throw new fr("ANSI language does not have grammar state");const{theme:o,colorMap:l}=t.setTheme(i),c=t.getLanguage(a);return new Kf(fP(n,c,o,l,r).stateStack,c.name,o.name)}function wze(e,t,n,r,a){const i=fP(e,t,n,r,a),o=new Kf(i.stateStack,t.name,n.name);return Nk(i.tokens,o),i.tokens}function fP(e,t,n,r,a){const i=jj(n,a),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:l=500}=a,c=kk(e);let u=a.grammarState?oze(a.grammarState,n.name)??I3:a.grammarContextCode!=null?fP(a.grammarContextCode,t,n,r,{...a,grammarState:void 0,grammarContextCode:void 0}).stateStack:I3,d=[];const h=[];for(let p=0,m=c.length;p<m;p++){const[g,x]=c[p];if(g===""){d=[],h.push([]);continue}if(o>0&&g.length>=o){d=[],h.push([{content:g,offset:x,color:"",fontStyle:0}]);continue}let b,y,v;a.includeExplanation&&(b=t.tokenizeLine(g,u,l),y=b.tokens,v=0);const w=t.tokenizeLine2(g,u,l),j=w.tokens.length/2;for(let E=0;E<j;E++){const S=w.tokens[2*E],_=E+1<j?w.tokens[2*E+2]:g.length;if(S===_)continue;const k=w.tokens[2*E+1],C=gu(r[pf.getForeground(k)],i),N=pf.getFontStyle(k),A={content:g.substring(S,_),offset:x+S,color:C,fontStyle:N};if(a.includeExplanation){const T=[];if(a.includeExplanation!=="scopeName")for(const $ of n.settings){let O;switch(typeof $.scope){case"string":O=$.scope.split(/,/).map(U=>U.trim());break;case"object":O=$.scope;break;default:continue}T.push({settings:$,selectors:O.map(U=>U.split(/ /))})}A.explanation=[];let I=0;for(;S+I<_;){const $=y[v],O=g.substring($.startIndex,$.endIndex);I+=O.length,A.explanation.push({content:O,scopes:a.includeExplanation==="scopeName"?jze($.scopes):_ze(T,$.scopes)}),v+=1}}d.push(A)}h.push(d),d=[],u=w.ruleStack}return{tokens:h,stateStack:u}}function jze(e){return e.map(t=>({scopeName:t}))}function _ze(e,t){const n=[];for(let r=0,a=t.length;r<a;r++){const i=t[r];n[r]={scopeName:i,themeMatches:Nze(e,i,t.slice(0,r))}}return n}function O9(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function kze(e,t,n){if(!O9(e[e.length-1],t))return!1;let r=e.length-2,a=n.length-1;for(;r>=0&&a>=0;)O9(e[r],n[a])&&(r-=1),a-=1;return r===-1}function Nze(e,t,n){const r=[];for(const{selectors:a,settings:i}of e)for(const o of a)if(kze(o,t,n)){r.push(i);break}return r}function hse(e,t,n){const r=Object.entries(n.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),a=r.map(c=>{const u=mP(e,t,{...n,theme:c.theme}),d=Hb(u),h=typeof c.theme=="string"?c.theme:c.theme.name;return{tokens:u,state:d,theme:h}}),i=Eze(...a.map(c=>c.tokens)),o=i[0].map((c,u)=>c.map((d,h)=>{const p={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(p.explanation=d.explanation),i.forEach((m,g)=>{const{content:x,explanation:b,offset:y,...v}=m[u][h];p.variants[r[g].color]=v}),p})),l=a[0].state?new Kf(Object.fromEntries(a.map(c=>[c.theme,c.state?.getInternalStack(c.theme)])),a[0].state.lang):void 0;return l&&Nk(o,l),o}function Eze(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const a=e.map(c=>c[r]),i=t.map(()=>[]);t.forEach((c,u)=>c.push(i[u]));const o=a.map(()=>0),l=a.map(c=>c[0]);for(;l.every(c=>c);){const c=Math.min(...l.map(u=>u.content.length));for(let u=0;u<n;u++){const d=l[u];d.content.length===c?(i[u].push(d),o[u]+=1,l[u]=a[u][o[u]]):(i[u].push({...d,content:d.content.slice(0,c)}),l[u]={...d,content:d.content.slice(c),offset:d.offset+c})}}}return t}function Nj(e,t,n){let r,a,i,o,l,c;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:d="--shiki-",colorsRendering:h="css-vars"}=n,p=Object.entries(n.themes).filter(y=>y[1]).map(y=>({color:y[0],theme:y[1]})).sort((y,v)=>y.color===u?-1:v.color===u?1:0);if(p.length===0)throw new fr("`themes` option must not be empty");const m=hse(e,t,n);if(c=Hb(m),u&&pP!==u&&!p.find(y=>y.color===u))throw new fr(`\`themes\` option must contain the defaultColor key \`${u}\``);const g=p.map(y=>e.getTheme(y.theme)),x=p.map(y=>y.color);i=m.map(y=>y.map(v=>aze(v,x,d,u,h))),c&&Nk(i,c);const b=p.map(y=>jj(y.theme,n));a=M9(p,g,b,d,u,"fg",h),r=M9(p,g,b,d,u,"bg",h),o=`shiki-themes ${g.map(y=>y.name).join(" ")}`,l=u?void 0:[a,r].join(";")}else if("theme"in n){const u=jj(n.theme,n);i=mP(e,t,n);const d=e.getTheme(n.theme);r=gu(d.bg,u),a=gu(d.fg,u),o=d.name,c=Hb(i)}else throw new fr("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:a,bg:r,themeName:o,rootStyle:l,grammarState:c}}function M9(e,t,n,r,a,i,o){return e.map((l,c)=>{const u=gu(t[c][i],n[c])||"inherit",d=`${r+l.color}${i==="bg"?"-bg":""}:${u}`;if(c===0&&a){if(a===pP&&e.length>1){const h=e.findIndex(x=>x.color==="light"),p=e.findIndex(x=>x.color==="dark");if(h===-1||p===-1)throw new fr('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const m=gu(t[h][i],n[h])||"inherit",g=gu(t[p][i],n[p])||"inherit";return`light-dark(${m}, ${g});${d}`}return u}return o==="css-vars"?d:null}).filter(l=>!!l).join(";")}function Ej(e,t,n,r={meta:{},options:n,codeToHast:(a,i)=>Ej(e,a,i),codeToTokens:(a,i)=>Nj(e,a,i)}){let a=t;for(const g of kj(n))a=g.preprocess?.call(r,a,n)||a;let{tokens:i,fg:o,bg:l,themeName:c,rootStyle:u,grammarState:d}=Nj(e,a,n);const{mergeWhitespaces:h=!0,mergeSameStyleTokens:p=!1}=n;h===!0?i=Cze(i):h==="never"&&(i=Tze(i)),p&&(i=Aze(i));const m={...r,get source(){return a}};for(const g of kj(n))i=g.tokens?.call(m,i)||i;return Sze(i,{...n,fg:o,bg:l,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??u},m,d)}function Sze(e,t,n,r=Hb(e)){const a=kj(t),i=[],o={type:"root",children:[]},{structure:l="classic",tabindex:c="0"}=t,u={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?u.style=t.rootStyle:u.style=`background-color:${t.bg};color:${t.fg}`),c!==!1&&c!=null&&(u.tabindex=c.toString());for(const[x,b]of Object.entries(t.meta||{}))x.startsWith("_")||(u[x]=b);let d={type:"element",tagName:"pre",properties:u,children:[],data:t.data},h={type:"element",tagName:"code",properties:{},children:i};const p=[],m={...n,structure:l,addClassToHast:cse,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return d},get code(){return h},get lines(){return p}};if(e.forEach((x,b)=>{b&&(l==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):l==="classic"&&i.push({type:"text",value:` 286`}));let y={type:"element",tagName:"span",properties:{class:"line"},children:[]},v=0;for(const w of x){let j={type:"element",tagName:"span",properties:{...w.htmlAttrs},children:[{type:"text",value:w.content}]};const E=L3(w.htmlStyle||_j(w));E&&(j.properties.style=E);for(const S of a)j=S?.span?.call(m,j,b+1,v,y,w)||j;l==="inline"?o.children.push(j):l==="classic"&&y.children.push(j),v+=w.content.length}if(l==="classic"){for(const w of a)y=w?.line?.call(m,y,b+1)||y;p.push(y),i.push(y)}else l==="inline"&&p.push(y)}),l==="classic"){for(const x of a)h=x?.code?.call(m,h)||h;d.children.push(h);for(const x of a)d=x?.pre?.call(m,d)||d;o.children.push(d)}else if(l==="inline"){const x=[];let b={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const w of o.children)w.type==="element"&&w.tagName==="br"?(x.push(b),b={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(w.type==="element"||w.type==="text")&&b.children.push(w);x.push(b);let v={type:"element",tagName:"code",properties:{},children:x};for(const w of a)v=w?.code?.call(m,v)||v;o.children=[];for(let w=0;w<v.children.length;w++){w>0&&o.children.push({type:"element",tagName:"br",properties:{},children:[]});const j=v.children[w];j.type==="element"&&o.children.push(...j.children)}}let g=o;for(const x of a)g=x?.root?.call(m,g)||g;return r&&Nk(g,r),g}function Cze(e){return e.map(t=>{const n=[];let r="",a;return t.forEach((i,o)=>{const c=!(i.fontStyle&&(i.fontStyle&ga.Underline||i.fontStyle&ga.Strikethrough));c&&i.content.match(/^\s+$/)&&t[o+1]?(a===void 0&&(a=i.offset),r+=i.content):r?(c?n.push({...i,offset:a,content:r+i.content}):n.push({content:r,offset:a},i),a=void 0,r=""):n.push(i)}),n})}function Tze(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,a,i,o]=r;if(!a&&!o)return n;const l=[{...n,offset:n.offset+a.length,content:i}];return a&&l.unshift({content:a,offset:n.offset}),o&&l.push({content:o,offset:n.offset+a.length+i.length}),l}))}function Aze(e){return e.map(t=>{const n=[];for(const r of t){if(n.length===0){n.push({...r});continue}const a=n[n.length-1],i=L3(a.htmlStyle||_j(a)),o=L3(r.htmlStyle||_j(r)),l=a.fontStyle&&(a.fontStyle&ga.Underline||a.fontStyle&ga.Strikethrough),c=r.fontStyle&&(r.fontStyle&ga.Underline||r.fontStyle&ga.Strikethrough);!l&&!c&&i===o?a.content+=r.content:n.push({...r})}return n})}const Rze=JUe;function Ize(e,t,n){const r={meta:{},options:n,codeToHast:(i,o)=>Ej(e,i,o),codeToTokens:(i,o)=>Nj(e,i,o)};let a=Rze(Ej(e,t,n,r));for(const i of kj(n))a=i.postprocess?.call(r,a,n)||a;return a}const D9={light:"#333333",dark:"#bbbbbb"},$9={light:"#fffffe",dark:"#1e1e1e"},F9="__shiki_resolved";function gP(e){if(e?.[F9])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){const l=t.settings?t.settings.find(c=>!c.name&&!c.scope):void 0;l?.settings?.foreground&&(r=l.settings.foreground),l?.settings?.background&&(n=l.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?D9.light:D9.dark),n||(n=t.type==="light"?$9.light:$9.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let a=0;const i=new Map;function o(l){if(i.has(l))return i.get(l);a+=1;const c=`#${a.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${c}`]?o(l):(i.set(l,c),c)}t.settings=t.settings.map(l=>{const c=l.settings?.foreground&&!l.settings.foreground.startsWith("#"),u=l.settings?.background&&!l.settings.background.startsWith("#");if(!c&&!u)return l;const d={...l,settings:{...l.settings}};if(c){const h=o(l.settings.foreground);t.colorReplacements[h]=l.settings.foreground,d.settings.foreground=h}if(u){const h=o(l.settings.background);t.colorReplacements[h]=l.settings.background,d.settings.background=h}return d});for(const l of Object.keys(t.colors||{}))if((l==="editor.foreground"||l==="editor.background"||l.startsWith("terminal.ansi"))&&!t.colors[l]?.startsWith("#")){const c=o(t.colors[l]);t.colorReplacements[c]=t.colors[l],t.colors[l]=c}return Object.defineProperty(t,F9,{enumerable:!1,writable:!1,value:!0}),t}async function pse(e){return Array.from(new Set((await Promise.all(e.filter(t=>!ose(t)).map(async t=>await ise(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function mse(e){return(await Promise.all(e.map(async n=>lse(n)?null:gP(await ise(n))))).filter(n=>!!n)}let Pze=3;function Lze(e,t=3){t>Pze||console.trace(`[SHIKI DEPRECATE]: ${e}`)}let vm=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function fse(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new vm(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class Oze extends JBe{constructor(t,n,r,a={}){super(t),this._resolver=t,this._themes=n,this._langs=r,this._alias=a,this._themes.map(i=>this.loadTheme(i)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(t){return typeof t=="string"?this._resolvedThemes.get(t):this.loadTheme(t)}loadTheme(t){const n=gP(t);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(t){let n=this._textmateThemeCache.get(t);n||(n=xj.createFromRawTheme(t),this._textmateThemeCache.set(t,n)),this._syncRegistry.setTheme(n)}getGrammar(t){return t=fse(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){if(this.getGrammar(t.name))return;const n=new Set([...this._langMap.values()].filter(i=>i.embeddedLangsLazy?.includes(t.name)));this._resolver.addLanguage(t);const r={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);const a=this.loadGrammarWithConfiguration(t.scopeName,1,r);if(a.name=t.name,this._resolvedGrammars.set(t.name,a),t.aliases&&t.aliases.forEach(i=>{this._alias[i]=t.name}),this._loadedLanguagesCache=null,n.size)for(const i of n)this._resolvedGrammars.delete(i.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(i.scopeName),this._syncRegistry?._grammars?.delete(i.scopeName),this.loadLanguage(this._langMap.get(i.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(const a of t)this.resolveEmbeddedLanguages(a);const n=Array.from(this._langGraph.entries()),r=n.filter(([a,i])=>!i);if(r.length){const a=n.filter(([i,o])=>o?(o.embeddedLanguages||o.embeddedLangs)?.some(c=>r.map(([u])=>u).includes(c)):!1).filter(i=>!r.includes(i));throw new vm(`Missing languages ${r.map(([i])=>`\`${i}\``).join(", ")}, required by ${a.map(([i])=>`\`${i}\``).join(", ")}`)}for(const[a,i]of n)this._resolver.addLanguage(i);for(const[a,i]of n)this.loadLanguage(i)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);const n=t.embeddedLanguages??t.embeddedLangs;if(n)for(const r of n)this._langGraph.set(r,this._langMap.get(r))}}class Mze{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(t,n){this._onigLib={createOnigScanner:r=>t.createScanner(r),createOnigString:r=>t.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(n=>{this._langs.set(n,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(t.scopeName)})}getInjections(t){const n=t.split(".");let r=[];for(let a=1;a<=n.length;a++){const i=n.slice(0,a).join(".");r=[...r,...this._injections.get(i)||[]]}return r}}let Lg=0;function Dze(e){Lg+=1,e.warnings!==!1&&Lg>=10&&Lg%10===0&&console.warn(`[Shiki] ${Lg} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new vm("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(gP),a=new Mze(e.engine,n),i=new Oze(a,r,n,e.langAlias);let o;function l(w){return fse(w,e.langAlias)}function c(w){y();const j=i.getGrammar(typeof w=="string"?w:w.name);if(!j)throw new vm(`Language \`${w}\` not found, you may need to load it first`);return j}function u(w){if(w==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};y();const j=i.getTheme(w);if(!j)throw new vm(`Theme \`${w}\` not found, you may need to load it first`);return j}function d(w){y();const j=u(w);o!==w&&(i.setTheme(j),o=w);const E=i.getColorMap();return{theme:j,colorMap:E}}function h(){return y(),i.getLoadedThemes()}function p(){return y(),i.getLoadedLanguages()}function m(...w){y(),i.loadLanguages(w.flat(1))}async function g(...w){return m(await pse(w))}function x(...w){y();for(const j of w.flat(1))i.loadTheme(j)}async function b(...w){return y(),x(await mse(w))}function y(){if(t)throw new vm("Shiki instance has been disposed")}function v(){t||(t=!0,i.dispose(),Lg-=1)}return{setTheme:d,getTheme:u,getLanguage:c,getLoadedThemes:h,getLoadedLanguages:p,resolveLangAlias:l,loadLanguage:g,loadLanguageSync:m,loadTheme:b,loadThemeSync:x,dispose:v,[Symbol.dispose]:v}}async function $ze(e){e.engine||Lze("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([mse(e.themes||[]),pse(e.langs||[]),e.engine]);return Dze({...e,themes:t,langs:n,engine:r})}async function Fze(e){const t=await $ze(e);return{getLastGrammarState:(...n)=>vze(t,...n),codeToTokensBase:(n,r)=>mP(t,n,r),codeToTokensWithThemes:(n,r)=>hse(t,n,r),codeToTokens:(n,r)=>Nj(t,n,r),codeToHast:(n,r)=>Ej(t,n,r),codeToHtml:(n,r)=>Ize(t,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function Bze(e){const t=e.langs,n=e.themes,r=e.engine;async function a(i){function o(h){if(typeof h=="string"){if(h=i.langAlias?.[h]||h,ose(h))return[];const p=t[h];if(!p)throw new fr(`Language \`${h}\` is not included in this bundle. You may want to load it from external source.`);return p}return h}function l(h){if(lse(h))return"none";if(typeof h=="string"){const p=n[h];if(!p)throw new fr(`Theme \`${h}\` is not included in this bundle. You may want to load it from external source.`);return p}return h}const c=(i.themes??[]).map(h=>l(h)),u=(i.langs??[]).map(h=>o(h)),d=await Fze({engine:i.engine??r(),...i,themes:c,langs:u});return{...d,loadLanguage(...h){return d.loadLanguage(...h.map(o))},loadTheme(...h){return d.loadTheme(...h.map(l))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return a}const xP=[{id:"abap",name:"ABAP",import:(()=>re(()=>import("./abap-BdImnpbu.js"),[]))},{id:"actionscript-3",name:"ActionScript",import:(()=>re(()=>import("./actionscript-3-CoDkCxhg.js"),[]))},{id:"ada",name:"Ada",import:(()=>re(()=>import("./ada-bCR0ucgS.js"),[]))},{id:"angular-html",name:"Angular HTML",import:(()=>re(()=>import("./angular-html-CU67Zn6k.js").then(e=>e.f),__vite__mapDeps([0,1,2,3])))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>re(()=>import("./angular-ts-BwZT4LLn.js"),__vite__mapDeps([4,0,1,2,3,5])))},{id:"apache",name:"Apache Conf",import:(()=>re(()=>import("./apache-Pmp26Uib.js"),[]))},{id:"apex",name:"Apex",import:(()=>re(()=>import("./apex-D8_7TLub.js"),[]))},{id:"apl",name:"APL",import:(()=>re(()=>import("./apl-dKokRX4l.js"),__vite__mapDeps([6,1,2,3,7,8,9])))},{id:"applescript",name:"AppleScript",import:(()=>re(()=>import("./applescript-Co6uUVPk.js"),[]))},{id:"ara",name:"Ara",import:(()=>re(()=>import("./ara-BRHolxvo.js"),[]))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>re(()=>import("./asciidoc-Ve4PFQV2.js"),[]))},{id:"asm",name:"Assembly",import:(()=>re(()=>import("./asm-D_Q5rh1f.js"),[]))},{id:"astro",name:"Astro",import:(()=>re(()=>import("./astro-CbQHKStN.js"),__vite__mapDeps([10,9,2,11,3,12,13])))},{id:"awk",name:"AWK",import:(()=>re(()=>import("./awk-DMzUqQB5.js"),[]))},{id:"ballerina",name:"Ballerina",import:(()=>re(()=>import("./ballerina-BFfxhgS-.js"),[]))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>re(()=>import("./bat-BkioyH1T.js"),[]))},{id:"beancount",name:"Beancount",import:(()=>re(()=>import("./beancount-k_qm7-4y.js"),[]))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>re(()=>import("./berry-uYugtg8r.js"),[]))},{id:"bibtex",name:"BibTeX",import:(()=>re(()=>import("./bibtex-CHM0blh-.js"),[]))},{id:"bicep",name:"Bicep",import:(()=>re(()=>import("./bicep-Bmn6On1c.js"),[]))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:(()=>re(()=>import("./bird2-DPOp833l.js"),[]))},{id:"blade",name:"Blade",import:(()=>re(()=>import("./blade-D4QpJJKB.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9])))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>re(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18])))},{id:"c",name:"C",import:(()=>re(()=>import("./c-BIGW1oBm.js"),[]))},{id:"c3",name:"C3",import:(()=>re(()=>import("./c3-eo99z4R2.js"),[]))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>re(()=>import("./cadence-Bv_4Rxtq.js"),[]))},{id:"cairo",name:"Cairo",import:(()=>re(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20])))},{id:"clarity",name:"Clarity",import:(()=>re(()=>import("./clarity-D53aC0YG.js"),[]))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>re(()=>import("./clojure-P80f7IUj.js"),[]))},{id:"cmake",name:"CMake",import:(()=>re(()=>import("./cmake-D1j8_8rp.js"),[]))},{id:"cobol",name:"COBOL",import:(()=>re(()=>import("./cobol-nwyudZeR.js"),__vite__mapDeps([21,1,2,3,8])))},{id:"codeowners",name:"CODEOWNERS",import:(()=>re(()=>import("./codeowners-Bp6g37R7.js"),[]))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>re(()=>import("./codeql-DsOJ9woJ.js"),[]))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>re(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2])))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>re(()=>import("./common-lisp-Cg-RD9OK.js"),[]))},{id:"coq",name:"Coq",import:(()=>re(()=>import("./coq-DkFqJrB1.js"),[]))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>re(()=>import("./cpp-CofmeUqb.js"),__vite__mapDeps([23,24,25,26,16])))},{id:"crystal",name:"Crystal",import:(()=>re(()=>import("./crystal-tKQVLTB8.js"),__vite__mapDeps([27,1,2,3,16,26,28])))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>re(()=>import("./csharp-COcwbKMJ.js"),[]))},{id:"css",name:"CSS",import:(()=>re(()=>import("./css-DPfMkruS.js"),[]))},{id:"csv",name:"CSV",import:(()=>re(()=>import("./csv-fuZLfV_i.js"),[]))},{id:"cue",name:"CUE",import:(()=>re(()=>import("./cue-D82EKSYY.js"),[]))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>re(()=>import("./cypher-COkxafJQ.js"),[]))},{id:"d",name:"D",import:(()=>re(()=>import("./d-85-TOEBH.js"),[]))},{id:"dart",name:"Dart",import:(()=>re(()=>import("./dart-CF10PKvl.js"),[]))},{id:"dax",name:"DAX",import:(()=>re(()=>import("./dax-CEL-wOlO.js"),[]))},{id:"desktop",name:"Desktop",import:(()=>re(()=>import("./desktop-BmXAJ9_W.js"),[]))},{id:"diff",name:"Diff",import:(()=>re(()=>import("./diff-D97Zzqfu.js"),[]))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>re(()=>import("./docker-BcOcwvcX.js"),[]))},{id:"dotenv",name:"dotEnv",import:(()=>re(()=>import("./dotenv-Da5cRb03.js"),[]))},{id:"dream-maker",name:"Dream Maker",import:(()=>re(()=>import("./dream-maker-BtqSS_iP.js"),[]))},{id:"edge",name:"Edge",import:(()=>re(()=>import("./edge-BkV0erSs.js"),__vite__mapDeps([29,11,1,2,3,15])))},{id:"elixir",name:"Elixir",import:(()=>re(()=>import("./elixir-CDX3lj18.js"),__vite__mapDeps([30,1,2,3])))},{id:"elm",name:"Elm",import:(()=>re(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26])))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>re(()=>import("./emacs-lisp-C9XAeP06.js"),[]))},{id:"erb",name:"ERB",import:(()=>re(()=>import("./erb-B12qg9BL.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>re(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40])))},{id:"fennel",name:"Fennel",import:(()=>re(()=>import("./fennel-BYunw83y.js"),[]))},{id:"fish",name:"Fish",import:(()=>re(()=>import("./fish-BvzEVeQv.js"),[]))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>re(()=>import("./fluent-C4IJs8-o.js"),[]))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>re(()=>import("./fortran-fixed-form-CkoXwp7k.js"),__vite__mapDeps([41,42])))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>re(()=>import("./fortran-free-form-BxgE0vQu.js"),[]))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>re(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40])))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>re(()=>import("./gdresource-BOOCDP_w.js"),__vite__mapDeps([44,45,46])))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>re(()=>import("./gdscript-C5YyOfLZ.js"),[]))},{id:"gdshader",name:"GDShader",import:(()=>re(()=>import("./gdshader-DkwncUOv.js"),[]))},{id:"genie",name:"Genie",import:(()=>re(()=>import("./genie-D0YGMca9.js"),[]))},{id:"gherkin",name:"Gherkin",import:(()=>re(()=>import("./gherkin-DyxjwDmM.js"),[]))},{id:"git-commit",name:"Git Commit Message",import:(()=>re(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48])))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>re(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28])))},{id:"gleam",name:"Gleam",import:(()=>re(()=>import("./gleam-BspZqrRM.js"),[]))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>re(()=>import("./glimmer-js-Rg0-pVw9.js"),__vite__mapDeps([50,2,11,3,1])))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>re(()=>import("./glimmer-ts-U6CK756n.js"),__vite__mapDeps([51,11,3,2,1])))},{id:"glsl",name:"GLSL",import:(()=>re(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26])))},{id:"gn",name:"GN",import:(()=>re(()=>import("./gn-n2N0HUVH.js"),[]))},{id:"gnuplot",name:"Gnuplot",import:(()=>re(()=>import("./gnuplot-DdkO51Og.js"),[]))},{id:"go",name:"Go",import:(()=>re(()=>import("./go-CxLEBnE3.js"),[]))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>re(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13])))},{id:"groovy",name:"Groovy",import:(()=>re(()=>import("./groovy-gcz8RCvz.js"),[]))},{id:"hack",name:"Hack",import:(()=>re(()=>import("./hack-CaT9iCJl.js"),__vite__mapDeps([52,1,2,3,16])))},{id:"haml",name:"Ruby Haml",import:(()=>re(()=>import("./haml-B8DHNrY2.js"),__vite__mapDeps([34,2,3])))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>re(()=>import("./handlebars-BL8al0AC.js"),__vite__mapDeps([53,1,2,3,38])))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>re(()=>import("./haskell-Df6bDoY_.js"),[]))},{id:"haxe",name:"Haxe",import:(()=>re(()=>import("./haxe-CzTSHFRz.js"),[]))},{id:"hcl",name:"HashiCorp HCL",import:(()=>re(()=>import("./hcl-BWvSN4gD.js"),[]))},{id:"hjson",name:"Hjson",import:(()=>re(()=>import("./hjson-D5-asLiD.js"),[]))},{id:"hlsl",name:"HLSL",import:(()=>re(()=>import("./hlsl-D3lLCCz7.js"),[]))},{id:"html",name:"HTML",import:(()=>re(()=>import("./html-GMplVEZG.js"),__vite__mapDeps([1,2,3])))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>re(()=>import("./html-derivative-BFtXZ54Q.js"),__vite__mapDeps([15,1,2,3])))},{id:"http",name:"HTTP",import:(()=>re(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13])))},{id:"hurl",name:"Hurl",import:(()=>re(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56])))},{id:"hxml",name:"HXML",import:(()=>re(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58])))},{id:"hy",name:"Hy",import:(()=>re(()=>import("./hy-DFXneXwc.js"),[]))},{id:"imba",name:"Imba",import:(()=>re(()=>import("./imba-DGztddWO.js"),[]))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>re(()=>import("./ini-BEwlwnbL.js"),[]))},{id:"java",name:"Java",import:(()=>re(()=>import("./java-CylS5w8V.js"),[]))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>re(()=>import("./javascript-wDzz0qaB.js"),[]))},{id:"jinja",name:"Jinja",import:(()=>re(()=>import("./jinja-4LBKfQ-Z.js"),__vite__mapDeps([59,1,2,3])))},{id:"jison",name:"Jison",import:(()=>re(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2])))},{id:"json",name:"JSON",import:(()=>re(()=>import("./json-Cp-IABpG.js"),[]))},{id:"json5",name:"JSON5",import:(()=>re(()=>import("./json5-C9tS-k6U.js"),[]))},{id:"jsonc",name:"JSON with Comments",import:(()=>re(()=>import("./jsonc-Des-eS-w.js"),[]))},{id:"jsonl",name:"JSON Lines",import:(()=>re(()=>import("./jsonl-DcaNXYhu.js"),[]))},{id:"jsonnet",name:"Jsonnet",import:(()=>re(()=>import("./jsonnet-DFQXde-d.js"),[]))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>re(()=>import("./jssm-C2t-YnRu.js"),[]))},{id:"jsx",name:"JSX",import:(()=>re(()=>import("./jsx-g9-lgVsj.js"),[]))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>re(()=>import("./julia-CxzCAyBv.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62])))},{id:"just",name:"Just",import:(()=>re(()=>import("./just-Cw27pwNe.js"),__vite__mapDeps([63,28,2,11,64,1,3,7,8,16,20,33,34,35,36,13,23,24,25,26,37,38])))},{id:"kdl",name:"KDL",import:(()=>re(()=>import("./kdl-DV7GczEv.js"),[]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>re(()=>import("./kotlin-BdnUsdx6.js"),[]))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>re(()=>import("./kusto-DZf3V79B.js"),[]))},{id:"latex",name:"LaTeX",import:(()=>re(()=>import("./latex-CWtU0Tv5.js"),__vite__mapDeps([65,66,62])))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>re(()=>import("./lean-BZvkOJ9d.js"),[]))},{id:"less",name:"Less",import:(()=>re(()=>import("./less-B1dDrJ26.js"),[]))},{id:"liquid",name:"Liquid",import:(()=>re(()=>import("./liquid-DYVedYrR.js"),__vite__mapDeps([67,1,2,3,9])))},{id:"llvm",name:"LLVM IR",import:(()=>re(()=>import("./llvm-DjAJT7YJ.js"),[]))},{id:"log",name:"Log file",import:(()=>re(()=>import("./log-2UxHyX5q.js"),[]))},{id:"logo",name:"Logo",import:(()=>re(()=>import("./logo-BtOb2qkB.js"),[]))},{id:"lua",name:"Lua",import:(()=>re(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([37,26])))},{id:"luau",name:"Luau",import:(()=>re(()=>import("./luau-C-HG3fhB.js"),[]))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>re(()=>import("./make-CHLpvVh8.js"),[]))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>re(()=>import("./markdown-Cvjx9yec.js"),[]))},{id:"marko",name:"Marko",import:(()=>re(()=>import("./marko-CnJfTvn9.js"),__vite__mapDeps([68,3,69,5,11])))},{id:"matlab",name:"MATLAB",import:(()=>re(()=>import("./matlab-D7o27uSR.js"),[]))},{id:"mdc",name:"MDC",import:(()=>re(()=>import("./mdc-BMNejdWA.js"),__vite__mapDeps([70,40,38,15,1,2,3])))},{id:"mdx",name:"MDX",import:(()=>re(()=>import("./mdx-Cmh6b_Ma.js"),[]))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>re(()=>import("./mermaid-mWjccvbQ.js"),[]))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>re(()=>import("./mipsasm-CKIfxQSi.js"),[]))},{id:"mojo",name:"Mojo",import:(()=>re(()=>import("./mojo-rZm6bMo-.js"),[]))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>re(()=>import("./moonbit-_H4v1dQx.js"),[]))},{id:"move",name:"Move",import:(()=>re(()=>import("./move-IF9eRakj.js"),[]))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>re(()=>import("./narrat-DRg8JJMk.js"),[]))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>re(()=>import("./nextflow-Zz6hmt5N.js"),__vite__mapDeps([71,72])))},{id:"nextflow-groovy",name:"nextflow-groovy",import:(()=>re(()=>import("./nextflow-groovy-BeH2EWoN.js"),[]))},{id:"nginx",name:"Nginx",import:(()=>re(()=>import("./nginx-BpAMiNFr.js"),__vite__mapDeps([73,37,26])))},{id:"nim",name:"Nim",import:(()=>re(()=>import("./nim-CVrawwO9.js"),__vite__mapDeps([74,26,1,2,3,7,8,25,40])))},{id:"nix",name:"Nix",import:(()=>re(()=>import("./nix-CwoSXNpI.js"),[]))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>re(()=>import("./nushell-Cz2AlsmD.js"),[]))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>re(()=>import("./objective-c-DXmwc3jG.js"),[]))},{id:"objective-cpp",name:"Objective-C++",import:(()=>re(()=>import("./objective-cpp-CLxacb5B.js"),[]))},{id:"ocaml",name:"OCaml",import:(()=>re(()=>import("./ocaml-C0hk2d4L.js"),[]))},{id:"odin",name:"Odin",import:(()=>re(()=>import("./odin-BBf5iR-q.js"),[]))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>re(()=>import("./openscad-C4EeE6gA.js"),[]))},{id:"pascal",name:"Pascal",import:(()=>re(()=>import("./pascal-D93ZcfNL.js"),[]))},{id:"perl",name:"Perl",import:(()=>re(()=>import("./perl-C0TMdlhV.js"),__vite__mapDeps([64,1,2,3,7,8,16])))},{id:"php",name:"PHP",import:(()=>re(()=>import("./php-Dhbhpdrm.js"),__vite__mapDeps([75,1,2,3,7,8,16,9])))},{id:"pkl",name:"Pkl",import:(()=>re(()=>import("./pkl-u5AG7uiY.js"),[]))},{id:"plsql",name:"PL/SQL",import:(()=>re(()=>import("./plsql-ChMvpjG-.js"),[]))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>re(()=>import("./po-BTJTHyun.js"),[]))},{id:"polar",name:"Polar",import:(()=>re(()=>import("./polar-C0HS_06l.js"),[]))},{id:"postcss",name:"PostCSS",import:(()=>re(()=>import("./postcss-CXtECtnM.js"),[]))},{id:"powerquery",name:"PowerQuery",import:(()=>re(()=>import("./powerquery-CEu0bR-o.js"),[]))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>re(()=>import("./powershell-Dpen1YoG.js"),[]))},{id:"prisma",name:"Prisma",import:(()=>re(()=>import("./prisma-Dd19v3D-.js"),[]))},{id:"prolog",name:"Prolog",import:(()=>re(()=>import("./prolog-CbFg5uaA.js"),[]))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>re(()=>import("./proto-C7zT0LnQ.js"),[]))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>re(()=>import("./pug-CGlum2m_.js"),__vite__mapDeps([76,2,3,1])))},{id:"puppet",name:"Puppet",import:(()=>re(()=>import("./puppet-BMWR74SV.js"),[]))},{id:"purescript",name:"PureScript",import:(()=>re(()=>import("./purescript-CklMAg4u.js"),[]))},{id:"python",name:"Python",aliases:["py"],import:(()=>re(()=>import("./python-B6aJPvgy.js"),[]))},{id:"qml",name:"QML",import:(()=>re(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([77,2])))},{id:"qmldir",name:"QML Directory",import:(()=>re(()=>import("./qmldir-C8lEn-DE.js"),[]))},{id:"qss",name:"Qt Style Sheets",import:(()=>re(()=>import("./qss-IeuSbFQv.js"),[]))},{id:"r",name:"R",import:(()=>re(()=>import("./r-Dspwwk_N.js"),[]))},{id:"racket",name:"Racket",import:(()=>re(()=>import("./racket-BqYA7rlc.js"),[]))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>re(()=>import("./raku-DXvB9xmW.js"),[]))},{id:"razor",name:"ASP.NET Razor",import:(()=>re(()=>import("./razor-Uh8Bk_45.js"),__vite__mapDeps([78,1,2,3,79])))},{id:"reg",name:"Windows Registry Script",import:(()=>re(()=>import("./reg-C-SQnVFl.js"),[]))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>re(()=>import("./regexp-CDVJQ6XC.js"),[]))},{id:"rel",name:"Rel",import:(()=>re(()=>import("./rel-C3B-1QV4.js"),[]))},{id:"riscv",name:"RISC-V",import:(()=>re(()=>import("./riscv-BM1_JUlF.js"),[]))},{id:"ron",name:"RON",import:(()=>re(()=>import("./ron-D8l8udqQ.js"),[]))},{id:"rosmsg",name:"ROS Interface",import:(()=>re(()=>import("./rosmsg-BJDFO7_C.js"),[]))},{id:"rst",name:"reStructuredText",import:(()=>re(()=>import("./rst-BrH8l1NY.js"),__vite__mapDeps([80,15,1,2,3,23,24,25,26,16,20,28,38,81,33,34,7,8,35,11,36,13,37])))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>re(()=>import("./ruby-Dw2BHqvy.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>re(()=>import("./rust-B1yitclQ.js"),[]))},{id:"sas",name:"SAS",import:(()=>re(()=>import("./sas-cz2c8ADy.js"),__vite__mapDeps([82,16])))},{id:"sass",name:"Sass",import:(()=>re(()=>import("./sass-Cj5Yp3dK.js"),[]))},{id:"scala",name:"Scala",import:(()=>re(()=>import("./scala-C151Ov-r.js"),[]))},{id:"scheme",name:"Scheme",import:(()=>re(()=>import("./scheme-C98Dy4si.js"),[]))},{id:"scss",name:"SCSS",import:(()=>re(()=>import("./scss-OYdSNvt2.js"),__vite__mapDeps([5,3])))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>re(()=>import("./sdbl-DVxCFoDh.js"),[]))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>re(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([83,84])))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>re(()=>import("./shellscript-Yzrsuije.js"),[]))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>re(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([85,28])))},{id:"smalltalk",name:"Smalltalk",import:(()=>re(()=>import("./smalltalk-BERRCDM3.js"),[]))},{id:"solidity",name:"Solidity",import:(()=>re(()=>import("./solidity-rGO070M0.js"),[]))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>re(()=>import("./soy-Brmx7dQM.js"),__vite__mapDeps([86,1,2,3])))},{id:"sparql",name:"SPARQL",import:(()=>re(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([87,88])))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>re(()=>import("./splunk-BtCnVYZw.js"),[]))},{id:"sql",name:"SQL",import:(()=>re(()=>import("./sql-BLtJtn59.js"),[]))},{id:"ssh-config",name:"SSH Config",import:(()=>re(()=>import("./ssh-config-_ykCGR6B.js"),[]))},{id:"stata",name:"Stata",import:(()=>re(()=>import("./stata-BH5u7GGu.js"),__vite__mapDeps([89,16])))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>re(()=>import("./stylus-BEDo0Tqx.js"),[]))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>re(()=>import("./surrealql-Bq5Q-fJD.js"),__vite__mapDeps([90,2])))},{id:"svelte",name:"Svelte",import:(()=>re(()=>import("./svelte-C_ipcX3V.js"),__vite__mapDeps([91,2,11,3,12])))},{id:"swift",name:"Swift",import:(()=>re(()=>import("./swift-D82vCrfD.js"),[]))},{id:"system-verilog",name:"SystemVerilog",import:(()=>re(()=>import("./system-verilog-CnnmHF94.js"),[]))},{id:"systemd",name:"Systemd Units",import:(()=>re(()=>import("./systemd-4A_iFExJ.js"),[]))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>re(()=>import("./talonscript-CkByrt1z.js"),[]))},{id:"tasl",name:"Tasl",import:(()=>re(()=>import("./tasl-QIJgUcNo.js"),[]))},{id:"tcl",name:"Tcl",import:(()=>re(()=>import("./tcl-dwOrl1Do.js"),[]))},{id:"templ",name:"Templ",import:(()=>re(()=>import("./templ-P3uqSqPl.js"),__vite__mapDeps([92,93,2,3])))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>re(()=>import("./terraform-BETggiCN.js"),[]))}
286,{id:"tex",name:"TeX",import:(()=>re(()=>import("./tex-idrVyKtj.js"),__vite__mapDeps([66,62])))},{id:"toml",name:"TOML",import:(()=>re(()=>import("./toml-vGWfd6FD.js"),[]))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>re(()=>import("./ts-tags-zn1MmPIZ.js"),__vite__mapDeps([94,11,3,2,25,26,1,16,7,8])))},{id:"tsv",name:"TSV",import:(()=>re(()=>import("./tsv-B_m7g4N7.js"),[]))},{id:"tsx",name:"TSX",import:(()=>re(()=>import("./tsx-COt5Ahok.js"),[]))},{id:"turtle",name:"Turtle",import:(()=>re(()=>import("./turtle-BsS91CYL.js"),[]))},{id:"twig",name:"Twig",import:(()=>re(()=>import("./twig-DNn4PbVi.js"),__vite__mapDeps([95,3,2,5,75,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38])))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>re(()=>import("./typescript-BPQ3VLAy.js"),[]))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>re(()=>import("./typespec-BGHnOYBU.js"),[]))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>re(()=>import("./typst-DHCkPAjA.js"),[]))}
vendor: 5,731 bytes, line 286
286,{id:"v",name:"V",import:(()=>re(()=>import("./v-BcVCzyr7.js"),[]))},{id:"vala",name:"Vala",import:(()=>re(()=>import("./vala-CsfeWuGM.js"),[]))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>re(()=>import("./vb-D17OF-Vu.js"),[]))},{id:"verilog",name:"Verilog",import:(()=>re(()=>import("./verilog-BQ8w6xss.js"),[]))},{id:"vhdl",name:"VHDL",import:(()=>re(()=>import("./vhdl-CeAyd5Ju.js"),[]))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>re(()=>import("./viml-CJc9bBzg.js"),[]))},{id:"vue",name:"Vue",import:(()=>re(()=>import("./vue-DN_0RTcg.js"),__vite__mapDeps([96,3,2,11,9,1,15])))},{id:"vue-html",name:"Vue HTML",import:(()=>re(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([97,2])))},{id:"vue-vine",name:"Vue Vine",import:(()=>re(()=>import("./vue-vine-CQOfvN7w.js"),__vite__mapDeps([98,3,5,69,99,12,2])))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>re(()=>import("./vyper-CDx5xZoG.js"),[]))},{id:"wasm",name:"WebAssembly",import:(()=>re(()=>import("./wasm-MzD3tlZU.js"),[]))},{id:"wenyan",name:"Wenyan",aliases:["æè¨"],import:(()=>re(()=>import("./wenyan-BV7otONQ.js"),[]))},{id:"wgsl",name:"WGSL",import:(()=>re(()=>import("./wgsl-Dx-B1_4e.js"),[]))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>re(()=>import("./wikitext-BhOHFoWU.js"),[]))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>re(()=>import("./wit-5i3qLPDT.js"),[]))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>re(()=>import("./wolfram-lXgVvXCa.js"),[]))},{id:"xml",name:"XML",import:(()=>re(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8])))},{id:"xsl",name:"XSL",import:(()=>re(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([100,7,8])))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>re(()=>import("./yaml-Buea-lGh.js"),[]))},{id:"zenscript",name:"ZenScript",import:(()=>re(()=>import("./zenscript-DVFEvuxE.js"),[]))},{id:"zig",name:"Zig",import:(()=>re(()=>import("./zig-VOosw3JB.js"),[]))}],Uze=Object.fromEntries(xP.map(e=>[e.id,e.import])),zze=Object.fromEntries(xP.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),gse={...Uze,...zze},Hze=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>re(()=>import("./andromeeda-C4gqWexZ.js"),[]))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>re(()=>import("./aurora-x-D-2ljcwZ.js"),[]))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>re(()=>import("./ayu-dark-DYE7WIF3.js"),[]))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>re(()=>import("./ayu-light-BA47KaF1.js"),[]))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>re(()=>import("./ayu-mirage-32ctXXKs.js"),[]))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:(()=>re(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>re(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>re(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>re(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>re(()=>import("./dark-plus-C3mMm8J8.js"),[]))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>re(()=>import("./dracula-BzJJZx-M.js"),[]))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>re(()=>import("./dracula-soft-BXkSAIEj.js"),[]))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>re(()=>import("./everforest-dark-BgDCqdQA.js"),[]))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>re(()=>import("./everforest-light-C8M2exoo.js"),[]))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>re(()=>import("./github-dark-DHJKELXO.js"),[]))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>re(()=>import("./github-dark-default-Cuk6v7N8.js"),[]))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>re(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>re(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>re(()=>import("./github-light-DAi9KRSo.js"),[]))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>re(()=>import("./github-light-default-D7oLnXFd.js"),[]))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>re(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>re(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>re(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>re(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>re(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>re(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>re(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>re(()=>
286import("./horizon-BUw7H-hv.js"),[]))},{id:"horizon-bright",displayName:"Horizon Bright",type:"dark",import:(()=>re(()=>import("./horizon-bright-Cn-bp-IR.js"),[]))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>re(()=>import("./houston-DnULxvSX.js"),[]))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>re(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>re(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>re(()=>import("./kanagawa-wave-DWedfzmr.js"),[]))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>re(()=>import("./laserwave-DUszq2jm.js"),[]))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>re(()=>import("./light-plus-B7mTdjB0.js"),[]))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>re(()=>import("./material-theme-D5KoaKCx.js"),[]))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>re(()=>import("./material-theme-darker-BfHTSMKl.js"),[]))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>re(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>re(()=>import("./material-theme-ocean-CyktbL80.js"),[]))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>re(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>re(()=>import("./min-dark-CafNBF8u.js"),[]))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>re(()=>import("./min-light-CTRr51gU.js"),[]))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>re(()=>import("./monokai-D4h5O-jR.js"),[]))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>re(()=>import("./night-owl-C39BiMTA.js"),[]))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>re(()=>import("./night-owl-light-CMTm3GFP.js"),[]))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>re(()=>import("./nord-Ddv68eIx.js"),[]))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>re(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>re(()=>import("./one-light-C3Wv6jpd.js"),[]))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>re(()=>import("./plastic-3e1v2bzS.js"),[]))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>re(()=>import("./poimandres-CS3Unz2-.js"),[]))},{id:"red",displayName:"Red",type:"dark",import:(()=>re(()=>import("./red-bN70gL4F.js"),[]))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:(()=>re(()=>import("./rose-pine-qdsjHGoJ.js"),[]))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:(()=>re(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:(()=>re(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>re(()=>import("./slack-dark-BthQWCQV.js"),[]))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>re(()=>import("./slack-ochin-DqwNpetd.js"),[]))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>re(()=>import("./snazzy-light-Bw305WKR.js"),[]))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>re(()=>import("./solarized-dark-DXbdFlpD.js"),[]))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>re(()=>import("./solarized-light-L9t79GZl.js"),[]))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>re(()=>import("./synthwave-84-CbfX1IO0.js"),[]))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>re(()=>import("./tokyo-night-hegEt444.js"),[]))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>re(()=>import("./vesper-DU1UobuO.js"),[]))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>re(()=>import("./vitesse-black-Bkuqu6BP.js"),[]))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>re(()=>import("./vitesse-dark-D0r3Knsf.js"),[]))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>re(()=>import("./vitesse-light-CVO1_9PV.js"),[]))}],qze=Object.fromEntries(Hze.map(e=>[e.id,e.import]));
vendor: 20,529 bytes, lines 286-318
286class bP extends Error{constructor(t){super(t),this.name="ShikiError"}}function Wze(){return 2147483648}function Vze(){return typeof performance<"u"?performance.now():Date.now()}const Gze=(e,t)=>e+(t-e%t)%t;async function Yze(e){let t,n;const r={};function a(m){n=m,r.HEAPU8=new Uint8Array(m),r.HEAPU32=new Uint32Array(m)}function i(m,g,x){r.HEAPU8.copyWithin(m,g,g+x)}function o(m){try{return t.grow(m-n.byteLength+65535>>>16),a(t.buffer),1}catch{}}function l(m){const g=r.HEAPU8.length;m=m>>>0;const x=Wze();if(m>x)return!1;for(let b=1;b<=4;b*=2){let y=g*(1+.2/b);y=Math.min(y,m+100663296);const v=Math.min(x,Gze(Math.max(m,y),65536));if(o(v))return!0}return!1}const c=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(m,g,x=1024){const b=g+x;let y=g;for(;m[y]&&!(y>=b);)++y;if(y-g>16&&m.buffer&&c)return c.decode(m.subarray(g,y));let v="";for(;g<y;){let w=m[g++];if(!(w&128)){v+=String.fromCharCode(w);continue}const j=m[g++]&63;if((w&224)===192){v+=String.fromCharCode((w&31)<<6|j);continue}const E=m[g++]&63;if((w&240)===224?w=(w&15)<<12|j<<6|E:w=(w&7)<<18|j<<12|E<<6|m[g++]&63,w<65536)v+=String.fromCharCode(w);else{const S=w-65536;v+=String.fromCharCode(55296|S>>10,56320|S&1023)}}return v}function d(m,g){return m?u(r.HEAPU8,m,g):""}const h={emscripten_get_now:Vze,emscripten_memcpy_big:i,emscripten_resize_heap:l,fd_write:()=>0};async function p(){const g=await e({env:h,wasi_snapshot_preview1:h});t=g.memory,a(t.buffer),Object.assign(r,g),r.UTF8ToString=d}return await p(),r}var Kze=Object.defineProperty,Xze=(e,t,n)=>t in e?Kze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nr=(e,t,n)=>Xze(e,typeof t!="symbol"?t+"":t,n);let Dr=null;function Jze(e){throw new bP(e.UTF8ToString(e.getLastOnigError()))}class Ek{constructor(t){Nr(this,"utf16Length"),Nr(this,"utf8Length"),Nr(this,"utf16Value"),Nr(this,"utf8Value"),Nr(this,"utf16OffsetToUtf8"),Nr(this,"utf8OffsetToUtf16");const n=t.length,r=Ek._utf8ByteLength(t),a=r!==n,i=a?new Uint32Array(n+1):null;a&&(i[n]=r);const o=a?new Uint32Array(r+1):null;a&&(o[r]=n);const l=new Uint8Array(r);let c=0;for(let u=0;u<n;u++){const d=t.charCodeAt(u);let h=d,p=!1;if(d>=55296&&d<=56319&&u+1<n){const m=t.charCodeAt(u+1);m>=56320&&m<=57343&&(h=(d-55296<<10)+65536|m-56320,p=!0)}a&&(i[u]=c,p&&(i[u+1]=c),h<=127?o[c+0]=u:h<=2047?(o[c+0]=u,o[c+1]=u):h<=65535?(o[c+0]=u,o[c+1]=u,o[c+2]=u):(o[c+0]=u,o[c+1]=u,o[c+2]=u,o[c+3]=u)),h<=127?l[c++]=h:h<=2047?(l[c++]=192|(h&1984)>>>6,l[c++]=128|(h&63)>>>0):h<=65535?(l[c++]=224|(h&61440)>>>12,l[c++]=128|(h&4032)>>>6,l[c++]=128|(h&63)>>>0):(l[c++]=240|(h&1835008)>>>18,l[c++]=128|(h&258048)>>>12,l[c++]=128|(h&4032)>>>6,l[c++]=128|(h&63)>>>0),p&&u++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=l,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=o}static _utf8ByteLength(t){let n=0;for(let r=0,a=t.length;r<a;r++){const i=t.charCodeAt(r);let o=i,l=!1;if(i>=55296&&i<=56319&&r+1<a){const c=t.charCodeAt(r+1);c>=56320&&c<=57343&&(o=(i-55296<<10)+65536|c-56320,l=!0)}o<=127?n+=1:o<=2047?n+=2:o<=65535?n+=3:n+=4,l&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const Sk=class Ho{constructor(t){if(Nr(this,"id",++Ho.LAST_ID),Nr(this,"_onigBinding"),Nr(this,"content"),Nr(this,"utf16Length"),Nr(this,"utf8Length"),Nr(this,"utf16OffsetToUtf8"),Nr(this,"utf8OffsetToUtf16"),Nr(this,"ptr"),!Dr)throw new bP("Must invoke loadWasm first.");this._onigBinding=Dr,this.content=t;const n=new Ek(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!Ho._sharedPtrInUse?(Ho._sharedPtr||(Ho._sharedPtr=Dr.omalloc(1e4)),Ho._sharedPtrInUse=!0,Dr.HEAPU8.set(n.utf8Value,Ho._sharedPtr),this.ptr=Ho._sharedPtr):this.ptr=n.createString(Dr)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===Ho._sharedPtr?Ho._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Nr(Sk,"LAST_ID",0);Nr(Sk,"_sharedPtr",0);Nr(Sk,"_sharedPtrInUse",!1);let xse=Sk;class Qze{constructor(t){if(Nr(this,"_onigBinding"),Nr(this,"_ptr"),!Dr)throw new bP("Must invoke loadWasm first.");const n=[],r=[];for(let l=0,c=t.length;l<c;l++){const u=new Ek(t[l]);n[l]=u.createString(Dr),r[l]=u.utf8Length}const a=Dr.omalloc(4*t.length);Dr.HEAPU32.set(n,a/4);const i=Dr.omalloc(4*t.length);Dr.HEAPU32.set(r,i/4);const o=Dr.createOnigScanner(a,i,t.length);for(let l=0,c=t.length;l<c;l++)Dr.ofree(n[l]);Dr.ofree(i),Dr.ofree(a),o===0&&Jze(Dr),this._onigBinding=Dr,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let a=0;if(typeof r=="number"&&(a=r),typeof t=="string"){t=new xse(t);const i=this._findNextMatchSync(t,n,!1,a);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,a)}_findNextMatchSync(t,n,r,a){const i=this._onigBinding,o=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),a);if(o===0)return null;const l=i.HEAPU32;let c=o/4;const u=l[c++],d=l[c++],h=[];for(let p=0;p<d;p++){const m=t.convertUtf8OffsetToUtf16(l[c++]),g=t.convertUtf8OffsetToUtf16(l[c++]);h[p]={start:m,end:g,length:g-m}}return{index:u,captureIndices:h}}}function Zze(e){return typeof e.instantiator=="function"}function eHe(e){return typeof e.default=="function"}function tHe(e){return typeof e.data<"u"}function sHe(e){return typeof Response<"u"&&e instanceof Response}function nHe(e){return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let tv;function rHe(e){if(tv)return tv;async function t(){Dr=await Yze(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),Zze(r)?r=await r.instantiator(n):eHe(r)?r=await r.default(n):(tHe(r)&&(r=r.data),sHe(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await aHe(r)(n):r=await iHe(r)(n):nHe(r)?r=await SE(r)(n):r instanceof WebAssembly.Module?r=await SE(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await SE(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return tv=t(),tv}function SE(e){return t=>WebAssembly.instantiate(e,t)}function aHe(e){return t=>WebAssembly.instantiateStreaming(e,t)}function iHe(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function oHe(e){return e&&await rHe(e),{createScanner(t){return new Qze(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new xse(t)}}}const lHe=Bze({langs:gse,themes:qze,engine:()=>oHe(re(()=>import("./wasm-CG6Dc4jp.js"),[]))});function Xf(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function cHe(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}const yP=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),Ur=String.raw;function Jf(e,t){if(e==null)throw new Error(t??"Value expected");return e}const bse=Ur`\[\^?`,yse=`c.? | C(?:-.?)?|${Ur`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Ur`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Ur`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Ur`o\{[^\}]*\}?`}|${Ur`\d{1,3}`}`,vP=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,sv=new RegExp(Ur` 287 \\ (?: 288 ${yse} 289 | [gk]<[^>]*>? 290 | [gk]'[^']*'? 291 | . 292 ) 293 | \( (?: 294 \? (?: 295 [:=!>({] 296 | <[=!] 297 | <[^>]*> 298 | '[^']*' 299 | ~\|? 300 | #(?:[^)\\]|\\.?)* 301 | [^:)]*[:)] 302 )? 303 | \*[^\)]*\)? 304 )? 305 | (?:${vP.source})+ 306 | ${bse} 307 | . 308`.replace(/\s+/g,""),"gsu"),CE=new RegExp(Ur` 309 \\ (?: 310 ${yse} 311 | . 312 ) 313 | \[:(?:\^?\p{Alpha}+|\^):\] 314 | ${bse} 315 | && 316 | . 317`.replace(/\s+/g,""),"gsu");function uHe(e,t={}){const n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!="string")throw new Error("String expected as pattern");const r=THe(n.flags),a=[r.extended],i={captureGroup:n.rules.captureGroup,getCurrentModX(){return a.at(-1)},numOpenGroups:0,popModX(){a.pop()},pushModX(h){a.push(h)},replaceCurrentModX(h){a[a.length-1]=h},singleline:n.rules.singleline};let o=[],l;for(sv.lastIndex=0;l=sv.exec(e);){const h=dHe(i,e,l[0],sv.lastIndex);h.tokens?o.push(...h.tokens):h.token&&o.push(h.token),h.lastIndex!==void 0&&(sv.lastIndex=h.lastIndex)}const c=[];let u=0;o.filter(h=>h.type==="GroupOpen").forEach(h=>{h.kind==="capturing"?h.number=++u:h.raw==="("&&c.push(h)}),u||c.forEach((h,p)=>{h.kind="capturing",h.number=p+1});const d=u||c.length;return{tokens:o.map(h=>h.type==="EscapedNumber"?RHe(h,d):h).flat(),flags:r}}function dHe(e,t,n,r){const[a,i]=n;if(n==="["||n==="[^"){const o=hHe(t,n,r);return{tokens:o.tokens,lastIndex:o.lastIndex}}if(a==="\\"){if("AbBGyYzZ".includes(i))return{token:B9(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:jHe(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:wse(n)}}if(i==="K")return{token:jse("keep",n)};if(i==="N"||i==="R")return{token:Jd("newline",n,{negate:i==="N"})};if(i==="O")return{token:Jd("any",n)};if(i==="X")return{token:Jd("text_segment",n)};const o=vse(n,{inCharClass:!1});return Array.isArray(o)?{tokens:o}:{token:o}}if(a==="("){if(i==="*")return{token:EHe(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(t[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:NHe(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n==="("&&!e.captureGroup||n==="(?:")return{token:sm("group",n)};if(n==="(?>")return{token:sm("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:sm(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:sm("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:sm("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:yHe(n)}}if(e.getCurrentModX()){if(n==="#"){const o=t.indexOf(` 318`,r);return{lastIndex:o===-1?t.length:o}}if(/^\s$/.test(n)){const o=/\s+/y;return o.lastIndex=r,{lastIndex:o.exec(t)?o.lastIndex:r}}}if(n===".")return{token:Jd("dot",n)};if(n==="^"||n==="$"){const o=e.singleline?{"^":Ur`\A`,$:Ur`\Z`}[n]:n;return{token:B9(o,n)}}return n==="|"?{token:mHe(n)}:vP.test(n)?{tokens:IHe(n)}:{token:tc(Xf(n),n)}}function hHe(e,t,n){const r=[U9(t[1]==="^",t)];let a=1,i;for(CE.lastIndex=n;i=CE.exec(e);){const o=i[0];if(o[0]==="["&&o[1]!==":")a++,r.push(U9(o[1]==="^",o));else if(o==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push(tc(93,o));else if(a--,r.push(fHe(o)),!a)break}else{const l=pHe(o);Array.isArray(l)?r.push(...l):r.push(l)}}return{tokens:r,lastIndex:CE.lastIndex||e.length}}function pHe(e){if(e[0]==="\\")return vse(e,{inCharClass:!0});if(e[0]==="["){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!yP.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return Jd("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return e==="-"?gHe(e):e==="&&"?xHe(e):tc(Xf(e),e)}function vse(e,{inCharClass:t}){const n=e[1];if(n==="c"||n==="C")return kHe(e);if("dDhHsSwW".includes(n))return SHe(e);if(e.startsWith(Ur`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return CHe(e)}if(new RegExp("^\\\\x[89A-Fa-f]\\p{AHex}","u").test(e))try{const r=e.split(/\\x/).slice(1).map(o=>parseInt(o,16)),a=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(r)),i=new TextEncoder;return[...a].map(o=>{const l=[...i.encode(o)].map(c=>`\\x${c.toString(16)}`).join("");return tc(Xf(o),l)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return tc(AHe(e),e);if(z9.has(n))return tc(z9.get(n),e);if(/\d/.test(n))return bHe(t,e);if(e==="\\")throw new Error(Ur`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return tc(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function mHe(e){return{type:"Alternator",raw:e}}function B9(e,t){return{type:"Assertion",kind:e,raw:t}}function wse(e){return{type:"Backreference",raw:e}}function tc(e,t){return{type:"Character",value:e,raw:t}}function fHe(e){return{type:"CharacterClassClose",raw:e}}function gHe(e){return{type:"CharacterClassHyphen",raw:e}}function xHe(e){return{type:"CharacterClassIntersector",raw:e}}function U9(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function Jd(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function jse(e,t,n={}){return e==="keep"?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:Jf(n.flags),raw:t}}function bHe(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}function yHe(e){return{type:"GroupClose",raw:e}}function sm(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function vHe(e,t,n,r){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:r}}function wHe(e,t,n,r){return{type:"Quantifier",kind:e,min:t,max:n,raw:r}}function jHe(e){return{type:"Subroutine",raw:e}}const _He=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),z9=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function kHe(e){const t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return tc(Xf(t.toUpperCase())-64,e)}function NHe(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??="";const a=(t.getCurrentModX()||n.includes("x"))&&!r.includes("x"),i=q9(n),o=q9(r),l={};if(i&&(l.enable=i),o&&(l.disable=o),e.endsWith(")"))return t.replaceCurrentModX(a),jse("flags",e,{flags:l});if(e.endsWith(":"))return t.pushModX(a),t.numOpenGroups++,sm("group",e,{...(i||o)&&{flags:l}});throw new Error(`Unexpected flag modifier "${e}"`)}function EHe(e){const t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:n,tag:r,args:a}=t.groups;if(!n)throw new Error(`Invalid named callout "${e}"`);if(r==="")throw new Error(`Named callout tag with empty value not allowed "${e}"`);const i=a?a.split(",").filter(d=>d!=="").map(d=>/^[+-]?\d+$/.test(d)?+d:d):[],[o,l,c]=i,u=_He.has(n)?n.toLowerCase():"custom";switch(u){case"fail":case"mismatch":case"skip":if(i.length>0)throw new Error(`Named callout arguments not allowed "${i}"`);break;case"error":if(i.length>1)throw new Error(`Named callout allows only one argument "${i}"`);if(typeof o=="string")throw new Error(`Named callout argument must be a number "${o}"`);break;case"max":if(!i.length||i.length>2)throw new Error(`Named callout must have one or two arguments "${i}"`);if(typeof o=="string"&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if(i.length===2&&(typeof l=="number"||!/^[<>X]$/.test(l)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${l}"`);break;case"count":case"total_count":if(i.length>1)throw new Error(`Named callout allows only one argument "${i}"`);if(i.length===1&&(typeof o=="number"||!/^[<>X]$/.test(o)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case"cmp":if(i.length!==3)throw new Error(`Named callout must have three arguments "${i}"`);if(typeof o=="string"&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof l=="number"||!/^(?:[<>!=]=|[<>])$/.test(l))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${l}"`);if(typeof c=="string"&&!/^[A-Za-z_]\w*$/.test(c))throw new Error(`Named callout argument three must be a tag or number "${c}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${u}"`)}return vHe(u,r??null,a?.split(",")??null,e)}function H9(e){let t=null,n,r;if(e[0]==="{"){const{minStr:a,maxStr:i}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+a>o||i&&+i>o)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+a,r=i===void 0?+a:i===""?1/0:+i,n>r&&(t="possessive",[n,r]=[r,n]),e.endsWith("?")){if(t==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else n=e[0]==="+"?1:0,r=e[0]==="?"?1:1/0,t=e[1]==="+"?"possessive":e[1]==="?"?"lazy":"greedy";return wHe(t,n,r,e)}function SHe(e){const t=e[1].toLowerCase();return Jd({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}function CHe(e){const{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return Jd("property",e,{value:r,negate:t==="P"&&!n||t==="p"&&!!n})}function q9(e){const t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function THe(e){const t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){const r=e[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if(r==="y"){if(!/^y{[gw]}/.test(e.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode=e[n+2]==="g"?"grapheme":"word",n+=3;continue}t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0}return t}function AHe(e){if(new RegExp("^(?:\\\\u(?!\\p{AHex}{4})|\\\\x(?!\\p{AHex}{1,2}|\\{\\p{AHex}{1,8}\\}))","u").test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t=e[2]==="{"?new RegExp("^\\\\x\\{\\s*(?<hex>\\p{AHex}+)","u").exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function RHe(e,t){const{raw:n,inCharClass:r}=e,a=n.slice(1);if(!r&&(a!=="0"&&a.length===1||a[0]!=="0"&&+a<=t))return[wse(n)];const i=[],o=a.match(/^[0-7]+|\d/g);for(let l=0;l<o.length;l++){const c=o[l];let u;if(l===0&&c!=="8"&&c!=="9"){if(u=parseInt(c,8),u>127)throw new Error(Ur`Octal encoded byte above 177 unsupported "${n}"`)}else u=Xf(c);i.push(tc(u,(l===0?"\\":"")+c))}return i}function IHe(e){const t=[],n=new RegExp(vP,"gy");let r;for(;r=n.exec(e);){const a=r[0];if(a[0]==="{"){const i=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(a);if(i){const{min:o,max:l}=i.groups;if(+o>+l&&a.endsWith("?")){n.lastIndex--,t.push(H9(a.slice(0,-1)));continue}}}t.push(H9(a))}return t}function _se(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(e.body.length!==1)return!1;const n=e.body[0];return!t||Object.keys(t).every(r=>t[r]===n[r])}function PHe(e){return LHe.has(e.type)}const LHe=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function kse(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=uHe(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),a=(p,m)=>{const g=r.tokens[i.nextIndex];switch(i.parent=p,i.nextIndex++,g.type){case"Alternator":return $h();case"Assertion":return OHe(g);case"Backreference":return MHe(g,i);case"Character":return Ck(g.value,{useLastValid:!!m.isCheckingRangeEnd});case"CharacterClassHyphen":return DHe(g,i,m);case"CharacterClassOpen":return $He(g,i,m);case"CharacterSet":return FHe(g,i);case"Directive":return WHe(g.kind,{flags:g.flags});case"GroupOpen":return BHe(g,i,m);case"NamedCallout":return GHe(g.kind,g.tag,g.arguments);case"Quantifier":return UHe(g,i);
vendor: 2,018 bytes, line 318
318case"Subroutine":return zHe(g,i);default:throw new Error(`Unexpected token type "${g.type}"`)}},i={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:a},o=KHe(VHe(r.flags));let l=o.body[0];for(;i.nextIndex<r.tokens.length;){const p=a(l,{});p.type==="Alternative"?(o.body.push(p),l=p):l.body.push(p)}const{capturingGroups:c,hasNumberedRef:u,namedGroupsByName:d,subroutines:h}=i;if(u&&d.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:p}of h)if(typeof p=="number"){if(p>c.length)throw new Error("Subroutine uses a group number that's not defined");p&&(c[p-1].isSubroutined=!0)}else if(d.has(p)){if(d.get(p).length>1)throw new Error(Ur`Subroutine uses a duplicate group name "\g<${p}>"`);d.get(p)[0].isSubroutined=!0}else throw new Error(Ur`Subroutine uses a group name that's not defined "\g<${p}>"`);return o}function OHe({kind:e}){return O3(Jf({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===Ur`\B`||e===Ur`\Y`})}function MHe({raw:e},t){const n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),a=(i,o=!1)=>{const l=t.capturingGroups.length;let c=!1;if(i>l)if(t.skipBackrefValidation)c=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,M3(o?l+1-i:i,{orphan:c})};if(n){const i=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(i)return a(+i.groups.num,!!i.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${e}"`);
vendor: 8,046 bytes, line 318
318if(!t.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${e}"`);return M3(r)}return a(+r)}function DHe(e,t,n){const{tokens:r,walk:a}=t,i=t.parent,o=i.body.at(-1),l=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!=="CharacterClass"&&o.type!=="CharacterClassRange"&&l&&l.type!=="CharacterClassOpen"&&l.type!=="CharacterClassClose"&&l.type!=="CharacterClassIntersector"){const c=a(i,{...n,isCheckingRangeEnd:!0});if(o.type==="Character"&&c.type==="Character")return i.body.pop(),qHe(o,c);throw new Error("Invalid character class range")}return Ck(Xf("-"))}function $He({negate:e},t,n){const{tokens:r,walk:a}=t,i=r[t.nextIndex],o=[A1()];let l=G9(i);for(;l.type!=="CharacterClassClose";){if(l.type==="CharacterClassIntersector")o.push(A1()),t.nextIndex++;else{const u=o.at(-1);u.body.push(a(u,n))}l=G9(r[t.nextIndex],i)}const c=A1({negate:e});return o.length===1?c.body=o[0].body:(c.kind="intersection",c.body=o.map(u=>u.body.length===1?u.body[0]:u)),t.nextIndex++,c}function FHe({kind:e,negate:t,value:n},r){const{normalizeUnknownPropertyNames:a,skipPropertyNameValidation:i,unicodePropertyMap:o}=r;if(e==="property"){const l=Tk(n);if(yP.has(l)&&!o?.has(l))e="posix",n=l;else return nm(n,{negate:t,normalizeUnknownPropertyNames:a,skipPropertyNameValidation:i,unicodePropertyMap:o})}return e==="posix"?YHe(n,{negate:t}):D3(e,{negate:t})}function BHe(e,t,n){const{tokens:r,capturingGroups:a,namedGroupsByName:i,skipLookbehindValidation:o,walk:l}=t,c=XHe(e),u=c.type==="AbsenceFunction",d=V9(c),h=d&&c.negate;if(c.type==="CapturingGroup"&&(a.push(c),c.name&&cHe(i,c.name,[]).push(c)),u&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let p=Y9(r[t.nextIndex]);for(;p.type!=="GroupClose";){if(p.type==="Alternator")c.body.push($h()),t.nextIndex++;else{const m=c.body.at(-1),g=l(m,{...n,isInAbsenceFunction:n.isInAbsenceFunction||u,isInLookbehind:n.isInLookbehind||d,isInNegLookbehind:n.isInNegLookbehind||h});if(m.body.push(g),(d||n.isInLookbehind)&&!o){const x="Lookbehind includes a pattern not allowed by Oniguruma";if(h||n.isInNegLookbehind){if(W9(g)||g.type==="CapturingGroup")throw new Error(x)}else if(W9(g)||V9(g)&&g.negate)throw new Error(x)}}p=Y9(r[t.nextIndex])}return t.nextIndex++,c}function UHe({kind:e,min:t,max:n},r){const a=r.parent,i=a.body.at(-1);if(!i||!PHe(i))throw new Error("Quantifier requires a repeatable token");const o=Ese(e,t,n,i);return a.body.pop(),o}function zHe({raw:e},t){const{capturingGroups:n,subroutines:r}=t;let a=e.slice(3,-1);const i=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(a);if(i){const l=+i.groups.num,c=n.length;if(t.hasNumberedRef=!0,a={"":l,"+":c+l,"-":c+1-l}[i.groups.sign],a<1)throw new Error("Invalid subroutine number")}else a==="0"&&(a=0);const o=Sse(a);return r.push(o),o}function HHe(e,t){return{type:"AbsenceFunction",kind:e,body:B0(t?.body)}}function $h(e){return{type:"Alternative",body:Cse(e?.body)}}function O3(e,t){const n={type:"Assertion",kind:e};return(e==="word_boundary"||e==="text_segment_boundary")&&(n.negate=!!t?.negate),n}function M3(e,t){const n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function Nse(e,t){const n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!JHe(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:B0(t?.body)}}function Ck(e,t){const n={useLastValid:!1,...t};if(e>1114111){const r=e.toString(16);if(n.useLastValid)e=1114111;else throw e>1310719?new Error(`Invalid code point out of range "\\x{${r}}"`):new Error(`Invalid code point out of range in JS "\\x{${r}}"`)}return{type:"Character",value:e}}function A1(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:Cse(e?.body)}}function qHe(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}function D3(e,t){const n=!!t?.negate,r={type:"CharacterSet",kind:e};return(e==="digit"||e==="hex"||e==="newline"||e==="space"||e==="word")&&(r.negate=n),(e==="text_segment"||e==="newline"&&!n)&&(r.variableLength=!0),r}function WHe(e,t={}){if(e==="keep")return{type:"Directive",kind:e};if(e==="flags")return{type:"Directive",kind:e,flags:Jf(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function VHe(e){return{type:"Flags",...e}}function wo(e){const t=e?.atomic,n=e?.flags;if(t&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:B0(e?.body)}}function Dd(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:B0(e?.body)}}function GHe(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}function YHe(e,t){const n=!!t?.negate;if(!yP.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}function Ese(e,t,n,r){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:r}}function KHe(e,t){return{type:"Regex",body:B0(t?.body),flags:e}}function Sse(e){return{type:"Subroutine",ref:e}}function nm(e,t){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let r=n.unicodePropertyMap?.get(Tk(e));if(!r){if(n.normalizeUnknownPropertyNames)r=QHe(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(Ur`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:r??e,negate:n.negate}}function XHe({flags:e,kind:t,name:n,negate:r,number:a}){switch(t){case"absence_repeater":return HHe("repeater");case"atomic":return wo({atomic:!0});case"capturing":return Nse(a,{name:n});case"group":return wo({flags:e});case"lookahead":case"lookbehind":return Dd({behind:t==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${t}"`)}}function B0(e){if(e===void 0)e=[$h()];else if(!Array.isArray(e)||!e.length||!e.every(t=>t.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function Cse(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(t=>!!t.type))throw new Error("Invalid body; expected array of nodes");return e}function W9(e){return e.type==="LookaroundAssertion"&&e.kind==="lookahead"}function V9(e){return e.type==="LookaroundAssertion"&&e.kind==="lookbehind"}function JHe(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function QHe(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}function Tk(e){return e.replace(/[- _]+/g,"").toLowerCase()}function G9(e,t){return Jf(e,`${t?.type==="Character"&&t.value===93?"Empty":"Unclosed"} character class`)}function Y9(e){return Jf(e,"Unclosed group")}function Yx(e,t,n=null){function r(i,o){for(let l=0;l<i.length;l++){const c=a(i[l],o,l,i);l=Math.max(-1,l+c)}}function a(i,o=null,l=null,c=null){let u=0,d=!1;const h={node:i,parent:o,key:l,container:c,root:e,remove(){nv(c).splice(Math.max(0,Ip(l)+u),1),u--,d=!0},removeAllNextSiblings(){return nv(c).splice(Ip(l)+1)},removeAllPrevSiblings(){const y=Ip(l)+u;return u-=y,nv(c).splice(0,Math.max(0,y))},replaceWith(y,v={}){const w=!!v.traverse;c?c[Math.max(0,Ip(l)+u)]=y:Jf(o,"Can't replace root node")[l]=y,w&&a(y,o,l,c),d=!0},replaceWithMultiple(y,v={}){const w=!!v.traverse;if(nv(c).splice(Math.max(0,Ip(l)+u),1,...y),u+=y.length-1,w){let j=0;for(let E=0;E<y.length;E++)j+=a(y[E],o,Ip(l)+E+j,c)}d=!0},skip(){d=!0}},{type:p}=i,m=t["*"],g=t[p],x=typeof m=="function"?m:m?.enter,b=typeof g=="function"?g:g?.enter;if(x?.(h,n),b?.(h,n),!d)switch(p){case"AbsenceFunction":case"CapturingGroup":case"Group":r(i.body,i);break;case"Alternative":case"CharacterClass":r(i.body,i);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subrout
318ine":break;case"CharacterClassRange":a(i.min,i,"min"),a(i.max,i,"max");break;case"LookaroundAssertion":r(i.body,i);break;case"Quantifier":a(i.body,i,"body");break;case"Regex":r(i.body,i),a(i.flags,i,"flags");break;default:throw new Error(`Unexpected node type "${p}"`)}return g?.exit?.(h,n),m?.exit?.(h,n),u}return a(e),e}function nv(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function Ip(e){if(typeof e!="number")throw new Error("Numeric key expected");return e}const ZHe=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function eqe(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function tqe(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}const Yi=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function wP(e,t,n,r){const a=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),i=[!1];let o=0,l="";for(const c of e.matchAll(a)){const{0:u,groups:{$skip:d}}=c;if(!d&&(!r||r===Yi.DEFAULT==!o)){n instanceof Function?l+=n(c,{context:o?Yi.CHAR_CLASS:Yi.DEFAULT,negated:i[i.length-1]}):l+=n;continue}u[0]==="["?(o++,i.push(u[1]==="^")):u==="]"&&o&&(o--,i.pop()),l+=u}return l}function Tse(e,t,n,r){wP(e,t,n,r)}function sqe(e,t,n=0,r){if(!new RegExp(t,"su").test(e))return null;const a=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");a.lastIndex=n;let i=0,o;for(;o=a.exec(e);){const{0:l,groups:{$skip:c}}=o;if(!c&&(!r||r===Yi.DEFAULT==!i))return o;l==="["?i++:l==="]"&&i&&i--,a.lastIndex==o.index&&a.lastIndex++}return null}function rv(e,t,n){return!!sqe(e,t,0,n)}function nqe(e,t){const n=/\\?./gsu;n.lastIndex=t;let r=e.length,a=0,i=1,o;for(;o=n.exec(e);){const[l]=o;if(l==="[")a++;else if(a)l==="]"&&a--;else if(l==="(")i++;else if(l===")"&&(i--,!i)){r=o.index;break}}return e.slice(t,r)}const K9=new RegExp(String.raw`(?<noncapturingStart>${ZHe})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function rqe(e,t){const n=t?.hiddenCaptures??[];let r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};const a="(?>",i="(?:(?=(",o=[0],l=[];let c=0,u=0,d=NaN,h;do{h=!1;let p=0,m=0,g=!1,x;for(K9.lastIndex=Number.isNaN(d)?0:d+i.length;x=K9.exec(e);){const{0:b,index:y,groups:{capturingStart:v,noncapturingStart:w}}=x;if(b==="[")p++;else if(p)b==="]"&&p--;else if(b===a&&!g)d=y,g=!0;else if(g&&w)m++;else if(v)g?m++:(c++,o.push(c+u));else if(b===")"&&g){if(!m){u++;const j=c+u;if(e=`${e.slice(0,d)}${i}${e.slice(d+a.length,y)}))<$$${j}>)${e.slice(y+1)}`,h=!0,l.push(j),eqe(n,j),r.size){const E=new Map;r.forEach((S,_)=>{E.set(_>=j?_+1:_,S.map(k=>k>=j?k+1:k))}),r=E}break}m--}}}while(h);
vendor: 7,931 bytes, lines 318-415
318return n.push(...l),e=wP(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:p,groups:{backrefNum:m,wrappedBackrefNum:g}})=>{if(m){const x=+m;if(x>o.length-1)throw new Error(`Backref "${p}" greater than number of captures`);return`\\${o[x]}`}return`\\${g}`},Yi.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}const Ase=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,TE=new RegExp(String.raw` 319\\(?: \d+ 320 | c[A-Za-z] 321 | [gk]<[^>]+> 322 | [pPu]\{[^\}]+\} 323 | u[A-Fa-f\d]{4} 324 | x[A-Fa-f\d]{2} 325 ) 326| \((?: \? (?: [:=!>] 327 | <(?:[=!]|[^>]+>) 328 | [A-Za-z\-]+: 329 | \(DEFINE\) 330 ))? 331| (?<qBase>${Ase})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?) 332| \\?. 333`.replace(/\s+/g,""),"gsu");function aqe(e){if(!new RegExp(`${Ase}\\+`).test(e))return{pattern:e};const t=[];let n=null,r=null,a="",i=0,o;for(TE.lastIndex=0;o=TE.exec(e);){const{0:l,index:c,groups:{qBase:u,qMod:d,invalidQ:h}}=o;if(l==="[")i||(r=c),i++;else if(l==="]")i?i--:r=null;else if(!i)if(d==="+"&&a&&!a.startsWith("(")){if(h)throw new Error(`Invalid quantifier "${l}"`);let p=-1;if(/^\{\d+\}$/.test(u))e=tqe(e,c+u.length,d,"");else{if(a===")"||a==="]"){const m=a===")"?n:r;if(m===null)throw new Error(`Invalid unmatched "${a}"`);e=`${e.slice(0,m)}(?>${e.slice(m,c)}${u})${e.slice(c+l.length)}`}else e=`${e.slice(0,c-a.length)}(?>${a}${u})${e.slice(c+l.length)}`;p+=4}TE.lastIndex+=p}else l[0]==="("?t.push(c):l===")"&&(n=t.length?t.pop():null);a=l}return{pattern:e}}const qi=String.raw,iqe=qi`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,$3=qi`\(\?R=(?<rDepth>[^\)]+)\)|${iqe}`,Ak=qi`\(\?<(?![=!])(?<captureName>[^>]+)>`,Rse=qi`${Ak}|(?<unnamed>\()(?!\?)`,ad=new RegExp(qi`${Ak}|${$3}|\(\?|\\?.`,"gsu"),AE="Cannot use multiple overlapping recursions";function oqe(e,t){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...t};let a=t?.captureTransfers??new Map;if(!new RegExp($3,"su").test(e))return{pattern:e,captureTransfers:a,hiddenCaptures:n};if(r==="plugin"&&rv(e,qi`\(\?\(DEFINE\)`,Yi.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const i=[],o=rv(e,qi`\\[1-9]`,Yi.DEFAULT),l=new Map,c=[];let u=!1,d=0,h=0,p;for(ad.lastIndex=0;p=ad.exec(e);){const{0:m,groups:{captureName:g,rDepth:x,gRNameOrNum:b,gRDepth:y}}=p;if(m==="[")d++;else if(d)m==="]"&&d--;else if(x){if(X9(x),u)throw new Error(AE);if(o)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const v=e.slice(0,p.index),w=e.slice(ad.lastIndex);if(rv(w,$3,Yi.DEFAULT))throw new Error(AE);const j=+x-1;e=J9(v,w,j,!1,n,i,h),a=Z9(a,v,j,i.length,0,h);break}else if(b){X9(y);let v=!1;for(const T of c)if(T.name===b||T.num===+b){if(v=!0,T.hasRecursedWithin)throw new Error(AE);break}if(!v)throw new Error(qi`Recursive \g cannot be used outside the referenced group "${r==="external"?b:qi`\g<${b}&R=${y}>`}"`);const w=l.get(b),j=nqe(e,w);if(o&&rv(j,qi`${Ak}|\((?!\?)`,Yi.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const E=e.slice(w,p.index),S=j.slice(E.length+m.length),_=i.length,k=+y-1,C=J9(E,S,k,!0,n,i,h);a=Z9(a,E,k,i.length-_,_,h);const N=e.slice(0,w),A=e.slice(w+j.length);e=`${N}${C}${A}`,ad.lastIndex+=C.length-m.length-E.length-S.length,c.forEach(T=>T.hasRecursedWithin=!0),u=!0}else if(g)h++,l.set(String(h),ad.lastIndex),l.set(g,ad.lastIndex),c.push({num:h,name:g});else if(m[0]==="("){const v=m==="(";v&&(h++,l.set(String(h),ad.lastIndex)),c.push(v?{num:h}:{})}else m===")"&&c.pop()}return n.push(...i),{pattern:e,captureTransfers:a,hiddenCaptures:n}}function X9(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if(e=+e,e<2||e>100)throw new Error(t)}function J9(e,t,n,r,a,i,o){const l=new Set;r&&Tse(e+t,Ak,({groups:{captureName:u}})=>{l.add(u)},Yi.DEFAULT);const c=[n,r?l:null,a,i,o];return`${e}${Q9(`(?:${e}`,"forward",...c)}(?:)${Q9(`${t})`,"backward",...c)}${t}`}function Q9(e,t,n,r,a,i,o){const c=d=>t==="forward"?d+2:n-d+2-1;let u="";for(let d=0;d<n;d++){const h=c(d);u+=wP(e,qi`${Rse}|\\k<(?<backref>[^>]+)>`,({0:p,groups:{captureName:m,unnamed:g,backref:x}})=>{if(x&&r&&!r.has(x))return p;const b=`_$${h}`;if(g||m){const y=o+i.length+1;return i.push(y),lqe(a,y),g?p:`(?<${m}${b}>`}return qi`\k<${x}${b}>`},Yi.DEFAULT)}return u}function lqe(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Z9(e,t,n,r,a,i){if(e.size&&r){let o=0;Tse(t,Rse,()=>o++,Yi.DEFAULT);const l=i-o+a,c=new Map;return e.forEach((u,d)=>{const h=(r-o*n)/n,p=o*n,m=d>l+o?d+r:d,g=[];for(const x of u)if(x<=l)g.push(x);else if(x>l+o+h)g.push(x+r);else if(x<=l+o)for(let b=0;b<=n;b++)g.push(x+o*b);else for(let b=0;b<=n;b++)g.push(x+p+h*b);c.set(m,g)}),c}return e}var Er=String.fromCodePoint,xs=String.raw,No={},Rk=globalThis.RegExp;No.flagGroups=(()=>{try{new Rk("(?i:)")}catch{return!1}return!0})();No.unicodeSets=(()=>{try{new Rk("[[]]","v")}catch{return!1}return!0})();No.bugFlagVLiteralHyphenIsRange=No.unicodeSets?(()=>{try{new Rk(xs`[\d\-a]`,"v")}catch{return!0}return!1})():!1;No.bugNestedClassIgnoresNegation=No.unicodeSets&&new Rk("[[^a]]","v").test("a");function Sj(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function qb(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function F3(e,t){return e7[e]>=e7[t]}function cqe(e,t){if(e==null)throw new Error(t??"Value expected");return e}var e7={ES2025:2025,ES2024:2024,ES2018:2018},uqe={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Ise(e={}){if({}.toString.call(e)!=="[object Object]")throw new Error("Unexpected options");if(e.target!==void 0&&!uqe[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target==="auto"&&(t.target=No.flagGroups?"ES2025":No.unicodeSets?"ES2024":"ES2018"),t}var dqe="[ -\r ]",hqe=new Set([Er(304),Er(305)]),Rl=xs`[\p{L}\p{M}\p{N}\p{Pc}]`;function Pse(e){if(hqe.has(e))return[e];const t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),a=fqe.get(n),i=pqe.get(n),o=mqe.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),a&&t.add(a),t.add(n),i&&t.add(i),[...t]}var jP=new Map(`C Other 334Cc Control cntrl 335Cf Format 336Cn Unassigned 337Co Private_Use 338Cs Surrogate 339L Letter 340LC Cased_Letter 341Ll Lowercase_Letter 342Lm Modifier_Letter 343Lo Other_Letter 344Lt Titlecase_Letter 345Lu Uppercase_Letter 346M Mark Combining_Mark 347Mc Spacing_Mark 348Me Enclosing_Mark 349Mn Nonspacing_Mark 350N Number 351Nd Decimal_Number digit 352Nl Letter_Number 353No Other_Number 354P Punctuation punct 355Pc Connector_Punctuation 356Pd Dash_Punctuation 357Pe Close_Punctuation 358Pf Final_Punctuation 359Pi Initial_Punctuation 360Po Other_Punctuation 361Ps Open_Punctuation 362S Symbol 363Sc Currency_Symbol 364Sk Modifier_Symbol 365Sm Math_Symbol 366So Other_Symbol 367Z Separator 368Zl Line_Separator 369Zp Paragraph_Separator 370Zs Space_Separator 371ASCII 372ASCII_Hex_Digit AHex 373Alphabetic Alpha 374Any 375Assigned 376Bidi_Control Bidi_C 377Bidi_Mirrored Bidi_M 378Case_Ignorable CI 379Cased 380Changes_When_Casefolded CWCF 381Changes_When_Casemapped CWCM 382Changes_When_Lowercased CWL 383Changes_When_NFKC_Casefolded CWKCF 384Changes_When_Titlecased CWT 385Changes_When_Uppercased CWU 386Dash 387Default_Ignorable_Code_Point DI 388Deprecated Dep 389Diacritic Dia 390Emoji 391Emoji_Component EComp 392Emoji_Modifier EMod 393Emoji_Modifier_Base EBase 394Emoji_Presentation EPres 395Extended_Pictographic ExtPict 396Extender Ext 397Grapheme_Base Gr_Base 398Grapheme_Extend Gr_Ext 399Hex_Digit Hex 400IDS_Binary_Operator IDSB 401IDS_Trinary_Operator IDST 402ID_Continue IDC 403ID_Start IDS 404Ideographic Ideo 405Join_Control Join_C 406Logical_Order_Exception LOE 407Lowercase Lower 408Math 409Noncharacter_Code_Point NChar 410Pattern_Syntax Pat_Syn 411Pattern_White_Space Pat_WS 412Quotation_Mark QMark 413Radical 414Regional_Indicator RI 415Sentence_Terminal STerm
416Soft_Dotted SD 417Terminal_Punctuation Term 418Unified_Ideograph UIdeo 419Uppercase Upper 420Variation_Selector VS 421White_Space space 422XID_Continue XIDC 423XID_Start XIDS`.split(/\s/).map(e=>[Tk(e),e])),pqe=new Map([["s",Er(383)],[Er(383),"s"]]),mqe=new Map([[Er(223),Er(7838)],[Er(107),Er(8490)],[Er(229),Er(8491)],[Er(969),Er(8486)]]),fqe=new Map([Wc(453),Wc(456),Wc(459),Wc(498),...RE(8072,8079),...RE(8088,8095),...RE(8104,8111),Wc(8124),Wc(8140),Wc(8188)]),gqe=new Map([["alnum",xs`[\p{Alpha}\p{Nd}]`],["alpha",xs`\p{Alpha}`],["ascii",xs`\p{ASCII}`],["blank",xs`[\p{Zs}\t]`],["cntrl",xs`\p{Cc}`],["digit",xs`\p{Nd}`],["graph",xs`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",xs`\p{Lower}`],["print",xs`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",xs`[\p{P}\p{S}]`],["space",xs`\p{space}`],["upper",xs`\p{Upper}`],["word",xs`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",xs`\p{AHex}`]]);function xqe(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Wc(e){const t=Er(e);return[t.toLowerCase(),t]}function RE(e,t){return xqe(e,t).map(n=>Wc(n))}var Lse=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function bqe(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};Ose(e);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:F3(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Yx(e,yqe,r);const a={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},i={currentFlags:a,prevFlags:null,globalFlags:a,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};Yx(e,vqe,i);const o={groupsByName:i.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:i.reffedNodesByReferencer};return Yx(e,wqe,o),e._originMap=i.groupOriginByCopy,e._strategy=r.strategy,e}var yqe={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:r,kind:a}=e;if(a==="repeater"){const i=wo();i.body[0].body.push(Dd({negate:!0,body:r}),nm("Any"));const o=wo();o.body[0].body.push(Ese("greedy",0,1/0,i)),n(sr(o,t),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){const a=e.body.filter(i=>i.kind==="flags");for(let i=n+1;i<t.body.length;i++){const o=t.body[i];qb(r,o,[]).push(...a)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){const n=Dse(t.get(e));if(n){const r=wo({flags:n});r.body[0].body=e.body,e.body=[sr(r,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:a,remove:i,replaceWith:o},l){const{kind:c,negate:u}=e,{asciiWordBoundaries:d,avoidSubclass:h,supportedGNodes:p,wordIsAscii:m}=l;if(c==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${u?"Y":"y"}"`);if(c==="line_end")o(sr(Dd({body:[$h({body:[O3("string_end")]}),$h({body:[Ck(10)]})]}),t));else if(c==="line_start")o(sr(Il(xs`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c==="search_start")if(p.has(e))a.flags.sticky=!0,i();else{const g=r[n-1];if(g&&Sqe(g))o(sr(Dd({negate:!0}),t));else{if(h)throw new Error(xs`Uses "\G" in a way that requires a subclass`);o(Vc(O3("string_start"),t)),l.strategy="clip_search"}}else if(!(c==="string_end"||c==="string_start"))if(c==="string_end_newline")o(sr(Il(xs`(?=\n?\z)`),t));else if(c==="word_boundary"){if(!m&&!d){const g=`(?:(?<=${Rl})(?!${Rl})|(?<!${Rl})(?=${Rl}))`,x=`(?:(?<=${Rl})(?=${Rl})|(?<!${Rl})(?!${Rl}))`;o(sr(Il(u?x:g),t))}}else throw new Error(`Unexpected assertion kind "${c}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!PE(n)&&(n=IE(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!PE(r)&&(r=IE(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){if(t.kind==="intersection"){const r=A1({body:[e]});n(sr(r,t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:a,digitIsAscii:i,spaceIsAscii:o,wordIsAscii:l}){const{kind:c,negate:u,value:d}=e;if(i&&(c==="digit"||d==="digit")){n(Vc(D3("digit",{negate:u}),t));return}if(o&&(c==="space"||d==="space")){n(sr(LE(Il(dqe),u),t));return}if(l&&(c==="word"||d==="word")){n(Vc(D3("word",{negate:u}),t));return}if(c==="any")n(Vc(nm("Any"),t));else if(c==="digit")n(Vc(nm("Nd",{negate:u}),t));else if(c!=="dot")if(c==="text_segment"){if(r==="strict")throw new Error(xs`Use of "\X" requires non-strict accuracy`);const h="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",p=xs`\p{RI}{2}|${h}(?:\u200D${h})*`;n(sr(Il(xs`(?>\r\n|${a?xs`\p{RGI_Emoji}`:p}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}
vendor: 13,599 bytes, lines 423-426
423),t))}else if(c==="hex")n(Vc(nm("AHex",{negate:u}),t));else if(c==="newline")n(sr(Il(u?`[^ 424]`:`(?>\r 425?|[ 426\v\f \u2028\u2029])`),t));else if(c==="posix")if(!a&&(d==="graph"||d==="print")){if(r==="strict")throw new Error(`POSIX class "${d}" requires min target ES2024 or non-strict accuracy`);let h={graph:"!-~",print:" -~"}[d];u&&(h=`\0-${Er(h.codePointAt(0)-1)}${Er(h.codePointAt(2)+1)}-ô¿¿`),n(sr(Il(`[${h}]`),t))}else n(sr(LE(Il(gqe.get(d)),u),t));else if(c==="property")jP.has(Tk(d))||(e.key="sc");else if(c==="space")n(Vc(nm("space",{negate:u}),t));else if(c==="word")n(sr(LE(Il(Rl),u),t));else throw new Error(`Unexpected character set kind "${c}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:a,removeAllPrevSiblings:i,removeAllNextSiblings:o}){const{kind:l,flags:c}=e;if(l==="flags")if(!c.enable&&!c.disable)r();else{const u=wo({flags:c});u.body[0].body=o(),a(sr(u,t),{traverse:!0})}else if(l==="keep"){const u=n.body[0],h=n.body.length===1&&_se(u,{type:"Group"})&&u.body[0].body.length===1?u.body[0]:n;if(t.parent!==h||h.body.length>1)throw new Error(xs`Uses "\K" in a way that's unsupported`);const p=Dd({behind:!0});p.body[0].body=i(),a(sr(p,t))}else throw new Error(`Unexpected directive kind "${l}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete e[n]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;n==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:r}=e;if(r==="fail")n(sr(Dd({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=wo();t.body[0].body.push(e.body),e.body=sr(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let r=!1,a=!1;for(const i of e.body)if(i.body.length===1&&i.body[0].kind==="search_start")i.body.pop();else{const o=Fse(i.body);o?(r=!0,Array.isArray(o)?n.push(...o):n.push(o)):a=!0}r&&!a&&n.forEach(i=>t.add(i))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t==="strict"&&n&&r)throw new Error(xs`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!PE(n)&&(n=IE(n,t),e.ref=n)}},vqe={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:r,ref:a}=e;r||n.set(e,[...t.get(a).map(({node:i})=>i)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:a,groupsByName:i,multiplexCapturesToLeftByRef:o,openRefs:l,reffedNodesByReferencer:c}){const u=a.get(e);if(u&&l.has(e.number)){const h=Vc(t7(e.number),t);c.set(h,l.get(e.number)),n(h);return}l.set(e.number,e),o.set(e.number,[]),e.name&&qb(o,e.name,[]);const d=o.get(e.name??e.number);for(let h=0;h<d.length;h++){const p=d[h];if(u===p.node||u&&u===p.origin||e===p.origin){d.splice(h,1);break}}if(o.get(e.number).push({node:e,origin:u}),e.name&&o.get(e.name).push({node:e,origin:u}),e.name){const h=qb(i,e.name,new Map);let p=!1;if(u)p=!0;else for(const m of h.values())if(!m.hasDuplicateNameToRemove){p=!0;break}i.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:p})}},exit({node:e},{openRefs:t}){t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=Sj(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){const{isRecursive:a,ref:i}=e;if(a){let d=t;for(;(d=d.parent)&&!(d.type==="CapturingGroup"&&(d.name===i||d.number===i)););r.reffedNodesByReferencer.set(e,d);return}const o=r.subroutineRefMap.get(i),l=i===0,c=l?t7(0):Mse(o,r.groupOriginByCopy,null);let u=c;if(!l){const d=Dse(kqe(o,p=>p.type==="Group"&&!!p.flags)),h=d?Sj(r.globalFlags,d):r.globalFlags;jqe(h,r.currentFlags)||(u=wo({flags:Nqe(h)}),u.body[0].body.push(c))}n(sr(u,t),{traverse:!l})}},wqe={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}const i=r.reffedNodesByReferencer.get(e).filter(o=>_qe(o,e));if(!i.length)n(sr(Dd({negate:!0}),t));else if(i.length>1){const o=wo({atomic:!0,body:i.reverse().map(l=>$h({body:[M3(l.number)]}))});n(sr(o,t))}else e.ref=i[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let r=0;r<n;r++){const a=Nse();e.body.at(-1).body.push(a)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Ose(e){Yx(e,{"*"({node:t,parent:n}){t.parent=n}})}function jqe(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function _qe(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;const r=$se(n.parent);for(const a of r){if(a===n)break;if(a===e||Bse(a,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Mse(e,t,n,r){const a=Array.isArray(e)?[]:{};for(const[i,o]of Object.entries(e))i==="parent"?a.parent=Array.isArray(n)?r:n:o&&typeof o=="object"?a[i]=Mse(o,t,a,n):(i==="type"&&o==="CapturingGroup"&&t.set(a,t.get(e)??e),a[i]=o);return a}function t7(e){const t=Sse(e);return t.isRecursive=!0,t}function kqe(e,t){const n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function IE(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function Dse(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:r})=>{t.forEach(a=>{r.enable?.[a]&&(delete n.disable[a],n.enable[a]=!0),r.disable?.[a]&&(n.disable[a]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Nqe({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function $se(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Fse(e){const t=e.find(n=>n.kind==="search_start"||Cqe(n,{negate:!1})||!Eqe(n));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){const n=[];for(const r of t.body){const a=Fse(r.body);if(!a)return null;Array.isArray(a)?n.push(...a):n.push(a)}return n}return null}function Bse(e,t){const n=$se(e)??[];for(const r of n)if(r===t||Bse(r,t))return!0;return!1}function Eqe({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function Sqe(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function Cqe(e,t){const n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&_se(e.body[0],{type:"Assertion",kind:"search_start"})}function PE(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Il(e,t){const r=kse(e,{...t,unicodePropertyMap:jP}).body;return r.length>1||r[0].body.length>1?wo({body:r}):r[0].body[0]}function LE(e,t){return e.negate=t,e}function Vc(e,t){return e.parent=t,e}function sr(e,t){return Ose(e),e.parent=t,e}function Tqe(e,t){const n=Ise(t),r=F3(n.target,"ES2024"),a=F3(n.target,"ES2025"),i=n.rules.recursionLimit;if(!Number.isInteger(i)||i<2||i>20)throw new Error("Invalid recursionLimit; use 2-20");let o=null,l=null;if(!a){const m=[e.flags.ignoreCase];Yx(e,Aqe,{getCurrentModI:()=>m.at(-1),popModI(){m.pop()},pushModI(g){m.push(g)},setHasCasedChar(){m.at(-1)?o=!0:l=!0}})}const c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!l)};let u=e;const d={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:u,originMap:e._originMap,recursionLimit:i,useAppliedIgnoreCase:!!(!a&&o&&l),useFlagMods:a,useFlagV:r,verbose:n.verbose};function h(m){return d.lastNode=u,u=m,cqe(Rqe[m.type],`Unexpected node type "${m.type}"`)(m,d,h)}const p={pattern:e.body.map(h).join("|"),flags:h(e.flags),options:{...e.options}};return r||(delete p.options.force.v,p.options.disable.v=!0,p.options.unicodeSetsPlugin=null),p._captureTransfers=new Map,p._hiddenCaptures=[],d.captureMap.forEach((m,g)=>{m.hidden&&p._hiddenCaptures.push(g),m.transferTo&&qb(p._captureTransfers,m.transferTo,[]).push(g)}),p}var Aqe={"*":{enter({node:e},t){if(n7(e)){const n=t.getCurrentModI();t.pushModI(e.flags?Sj({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){n7(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){_P(Er(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Use(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&Lse.has(e.value)&&t.setHasCasedChar()}},Rqe={Alternative({body:e},t,n){return e.map(n).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?xs`\B`:xs`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:r,name:a,number:i}=e,o={ignoreCase:t.currentFlags.ignoreCase},l=t.originMap.get(e);return l&&(o.hidden=!0,i>l.number&&(o.transferTo=l.number)),t.captureMap.set(i,o),`(${a?`?<${a}>`:""}${r.map(n).join("|")})`},Character({value:e},t){const n=Er(e),r=Pp(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&_P(n)){const a=Pse(n);return t.inCharClass?a.join(""):a.length>1?`[${a.join("")}]`:a[0]}return n},CharacterClass(e,t,n){const{kind:r,negate:a,parent:i}=e;let{body:o}=e;if(r==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");No.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(r7)&&(o=[Ck(45),...o.filter(u=>!r7(u))]);const l=()=>`[${a?"^":""}${o.map(n).join(r==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||No.bugNestedClassIgnoresNegation)&&!a){const d=o.filter(h=>h.type==="CharacterClass"&&h.kind==="union"&&h.negate);if(d.length){const h=wo(),p=h.body[0];return h.parent=i,p.parent=h,o=o.filter(m=>!d.includes(m)),e.body=o,o.length?(e.parent=p,p.body.push(e)):h.body.pop(),d.forEach(m=>{const g=$h({body:[m]});m.parent=g,g.parent=h,h.body.push(g)}),n(h)}}t.inCharClass=!0;const u=l();return t.inCharClass=!1,u}const c=o[0];if(r==="union"&&!a&&c&&((!t.useFlagV||!t.verbose)&&i.kind==="union"&&!(No.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&i.kind==="intersection"&&o.length===1&&c.type!=="CharacterClassRange"))return o.map(n).join("");if(!t.useFlagV&&i.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return l()},CharacterClassRange(e,t){const n=e.min.value,r=e.max.value,a={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},i=Pp(n,a),o=Pp(r,a),l=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const c=Use(e);Mqe(c).forEach(d=>{l.add(Array.isArray(d)?`${Pp(d[0],a)}-${Pp(d[1],a)}`:Pp(d,a))})}return`${i}-${o}${[...l].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},a){if(e==="dot")return a.currentFlags.dotAll?a.appliedGlobalFlags.dotAll||a.useFlagMods?".":"[^]":xs`[^\n]`;if(e==="digit")return t?xs`\D`:xs`\d`;if(e==="property"){if(a.useAppliedIgnoreCase&&a.currentFlags.ignoreCase&&Lse.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?xs`\P`:xs`\p`}{${r?`${r}=`:""}${n}}`}if(e==="word")return t?xs`\W`:xs`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:n,parent:r},a,i){const o=a.currentFlags;n&&(a.currentFlags=Sj(o,n));const l=t.map(i).join("|"),c=!a.verbose&&t.length===1&&r.type!=="Quantifier"&&!e&&(!a.useFlagMods||!n)?l:`(?${Dqe(e,n,a.useFlagMods)}${l})`;return a.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,a){return`(?${`${t==="lookahead"?"":"<"}${n?"!":"="}`}${e.map(a).join("|")})`},Quantifier(e,t,n){return n(e.body)+$qe(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return t===0?`(?R=${r})`:xs`\g<${t}&R=${r}>`}},Iqe=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}
426"]),Pqe=new Set(["-","\\","]","^","["]),Lqe=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),s7=new Map([[9,xs`\t`],[10,xs`\n`],[11,xs`\v`],[12,xs`\f`],[13,xs`\r`],[8232,xs`\u2028`],[8233,xs`\u2029`],[65279,xs`\uFEFF`]]),Oqe=new RegExp("^\\p{Cased}$","u");function _P(e){return Oqe.test(e)}function Use(e,t){const n=!!t?.firstOnly,r=e.min.value,a=e.max.value,i=[];if(r<65&&(a===65535||a>=131071)||r===65536&&a>=131071)return i;for(let o=r;o<=a;o++){const l=Er(o);if(!_P(l))continue;const c=Pse(l).filter(u=>{const d=u.codePointAt(0);return d<r||d>a});if(c.length&&(i.push(...c),n))break}return i}function Pp(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(s7.has(e))return s7.get(e);if(e<32||e>126&&e<160||e>262143||t&&Fqe(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const a=n?r?Lqe:Pqe:Iqe,i=Er(e);return(a.has(i)?"\\":"")+i}function Mqe(e){const t=e.map(a=>a.codePointAt(0)).sort((a,i)=>a-i),n=[];let r=null;for(let a=0;a<t.length;a++)t[a+1]===t[a]+1?r??=t[a]:r===null?n.push(t[a]):(n.push([r,t[a]]),r=null);return n}function Dqe(e,t,n){if(e)return">";let r="";if(t&&n){const{enable:a,disable:i}=t;r=(a?.ignoreCase?"i":"")+(a?.dotAll?"s":"")+(i?"-":"")+(i?.ignoreCase?"i":"")+(i?.dotAll?"s":"")}return`${r}:`}function $qe({kind:e,max:t,min:n}){let r;return!n&&t===1?r="?":!n&&t===1/0?r="*":n===1&&t===1/0?r="+":n===t?r=`{${n}}`:r=`{${n},${t===1/0?"":t}}`,r+{greedy:"",lazy:"?",possessive:"+"}[e]}function n7({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function Fqe(e){return e>47&&e<58}function r7({type:e,value:t}){return e==="Character"&&t===45}var Bqe=class B3 extends RegExp{#t=new Map;#e=null;#n;#s=null;#r=null;rawOptions={};get source(){return this.#n||"(?:)"}constructor(t,n,r){const a=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const i=t;super(i,n),this.#n=i.source,i instanceof B3&&(this.#t=i.#t,this.#s=i.#s,this.#r=i.#r,this.rawOptions=i.rawOptions)}else{const i={hiddenCaptures:[],strategy:null,transfers:[],...r};super(a?"":t,n),this.#n=t,this.#t=zqe(i.hiddenCaptures,i.transfers),this.#r=i.strategy,this.rawOptions=r??{}}a||(this.#e=this)}exec(t){if(!this.#e){const{lazyCompile:a,...i}=this.rawOptions;this.#e=new B3(this.#n,this.flags,i)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#r==="clip_search"&&n&&r){this.lastIndex=0;const a=this.#a(t.slice(r));return a&&(Uqe(a,r,t,this.hasIndices),this.lastIndex+=r),a}return this.#a(t)}#a(t){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,t);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let a;this.hasIndices&&(a=[...n.indices],n.indices.length=1);const i=[0];for(let o=1;o<r.length;o++){const{hidden:l,transferTo:c}=this.#t.get(o)??{};if(l?i.push(null):(i.push(n.length),n.push(r[o]),this.hasIndices&&n.indices.push(a[o])),c&&r[o]!==void 0){const u=i[c];if(!u)throw new Error(`Invalid capture transfer to "${u}"`);if(n[u]=r[o],this.hasIndices&&(n.indices[u]=a[o]),n.groups){this.#s||(this.#s=Hqe(this.source));const d=this.#s.get(c);d&&(n.groups[d]=r[o],this.hasIndices&&(n.indices.groups[d]=a[o]))}}}return n}};function Uqe(e,t,n,r){if(e.index+=t,e.input=n,r){const a=e.indices;for(let o=0;o<a.length;o++){const l=a[o];l&&(a[o]=[l[0]+t,l[1]+t])}const i=a.groups;
426i&&Object.keys(i).forEach(o=>{const l=i[o];l&&(i[o]=[l[0]+t,l[1]+t])})}}function zqe(e,t){const n=new Map;for(const r of e)n.set(r,{hidden:!0});for(const[r,a]of t)for(const i of a)qb(n,i,{}).transferTo=r;return n}function Hqe(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,a=0,i;for(;i=t.exec(e);){const{0:o,groups:{capture:l,name:c}}=i;o==="["?r++:r?o==="]"&&r--:l&&(a++,c&&n.set(a,c))}return n}function qqe(e,t){const n=Wqe(e,t);return n.options?new Bqe(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Wqe(e,t){const n=Ise(t),r=kse(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:jP}),a=bqe(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=Tqe(a,n),o=oqe(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:"external"}),l=aqe(o.pattern),c=rqe(l.pattern,{captureTransfers:o.captureTransfers,hiddenCaptures:o.hiddenCaptures}),u={pattern:c.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${i.flags}${i.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const d=c.hiddenCaptures.sort((g,x)=>g-x),h=Array.from(c.captureTransfers),p=a._strategy,m=u.pattern.length>=n.lazyCompileLength;(d.length||h.length||p||m)&&(u.options={...d.length&&{hiddenCaptures:d},...h.length&&{transfers:h},...p&&{strategy:p},...m&&{lazyCompile:m}})}return u}const a7=4294967295;class Vqe{constructor(t,n={}){this.patterns=t,this.options=n;const{forgiving:r=!1,cache:a,regexConstructor:i}=n;if(!i)throw new Error("Option `regexConstructor` is not provided");this.regexps=t.map(o=>{if(typeof o!="string")return o;const l=a?.get(o);if(l){if(l instanceof RegExp)return l;if(r)return null;throw l}try{const c=i(o);return a?.set(o,c),c}catch(c){if(a?.set(o,c),r)return null;throw c}})}regexps;findNextMatchSync(t,n,r){const a=typeof t=="string"?t:t.content,i=[];function o(l,c,u=0){return{index:l,captureIndices:c.indices.map(d=>d==null?{start:a7,end:a7,length:0}:{start:d[0]+u,end:d[1]+u,length:d[1]-d[0]})}}for(let l=0;l<this.regexps.length;l++){const c=this.regexps[l];if(c)try{c.lastIndex=n;const u=c.exec(a);if(!u)continue;if(u.index===n)return o(l,u,0);i.push([l,u,0])}catch(u){if(this.options.forgiving)continue;throw u}}if(i.length){const l=Math.min(...i.map(c=>c[1].index));for(const[c,u,d]of i)if(u.index===l)return o(c,u,d)}return null}}function Gqe(e,t){return qqe(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function Yqe(e={}){const t=Object.assign({target:"auto",cache:new Map},e);return t.regexConstructor||=n=>Gqe(n,{target:t.target}),{createScanner(n){return new Vqe(n,t)},createString(n){return{content:n}}}}var Kqe=Yqe({forgiving:!0}),Xqe=Object.fromEntries(xP.flatMap(e=>{var t;return((t=e.aliases)!=null?t:[]).map(n=>[n,e.id])})),R1=new Set(Object.keys(gse)),i7=e=>{let t=e.trim().toLowerCase();return Xqe[t]||(R1.has(t),t)},OE=new Map,ME=new Map,Lp=new Map,Cj=e=>{var t;return typeof e=="string"?e:(t=e.name)!=null?t:"custom"},Jqe=(e,t)=>`${e}-${Cj(t[0])}-${Cj(t[1])}`,Qqe=(e,t,n)=>{let r=e.slice(0,100),a=e.length>100?e.slice(-100):"";return`${t}:${n[0]}:${n[1]}:${e.length}:${r}:${a}`},Zqe=(e,t)=>{let n=Jqe(e,t);if(OE.has(n))return OE.get(n);let r=lHe({themes:t,langs:[e],engine:Kqe});return OE.set(n,r),r};function eWe(e={}){var t;let n=(t=e.themes)!=null?t:["github-light","github-dark"];return{name:"shiki",type:"code-highlighter",supportsLanguage(r){let a=i7(r);return R1.has(a)},getSupportedLanguages(){return Array.from(R1)},getThemes(){return n},highlight({code:r,language:a,themes:i},o){let l=i7(a),c=[Cj(i[0]),Cj(i[1])],u=Qqe(r,l,c);if(ME.has(u))return ME.get(u);o&&(Lp.has(u)||Lp.set(u,new Set),Lp.get(u).add(o));let d=R1.has(l)?l:"text";return Zqe(d,i).then(h=>{let p=h.getLoadedLanguages().includes(l)?l:"text",m=h.codeToTokens(r,{lang:p,themes:{light:c[0],dark:c[1]}});ME.set(u,m);let g=Lp.get(u);if(g){for(let x of g)x(m);Lp.delete(u)}}).catch(h=>{console.error("[Streamdown Code] Failed to highlight code:",h),Lp.delete(u)}),null}}}var tWe=eWe();const sWe={code:tWe},nWe={code:{copy:!0,download:!1}},rWe=["github-light","github-dark"],aWe={animation:"fadeIn",sep:"word",duration:320},iWe=new Set(["www.youtube.com","youtube.com","m.youtube.com","youtu.be"]),oWe={enabled:!0,onLinkCheck:e=>{try{const{protocol:t,hostname:n}=new URL(e);return t==="https:"&&iWe.has(n)}catch{return!1}}},o7={table:({children:e})=>s.jsx("div",{className:"markdown-body__table-wrap",children:s.jsx("table",{children:e})})};function lWe({content:e,isStreaming:t=!1,extraComponents:n}
426){const r=n?{...o7,...n}:o7;return s.jsx("div",{className:"markdown-body min-w-0 max-w-full [overflow-wrap:anywhere]",children:s.jsx($te,{mode:t?"streaming":"static",plugins:sWe,shikiTheme:rWe,isAnimating:t,animated:t?aWe:!1,controls:nWe,components:r,linkSafety:oWe,children:e})})}const Qf=f.memo(lWe);function zse({name:e}){return s.jsx("p",{className:"mb-1 max-w-[24ch] truncate text-[11px] font-semibold leading-tight text-ink-mid",title:e,children:e})}const l7=e=>String(e||"").toLowerCase().replace(/[_/]/g," ");function xu({value:e,options:t,onChange:n,label:r,className:a="",disabled:i=!1,fixed:o=!1,search:l=!1,placeholder:c=""}){const[u,d]=f.useState(!1),[h,p]=f.useState(void 0),[m,g]=f.useState(""),x=f.useRef(null),b=f.useRef(null),y=f.useRef(null),v=f.useRef(null),w=t.find(k=>k.value===e)||(c?null:t[0]),j=l7(m).split(/\s+/).filter(Boolean),E=j.length?t.filter(k=>{const C=l7(`${k.label} ${k.keywords||""}`);return j.every(N=>C.includes(N))}):t;f.useEffect(()=>{if(!u)return;const k=N=>{N.key==="Escape"?(d(!1),b.current?.focus()):N.type==="mousedown"&&!x.current?.contains(N.target)&&d(!1)};document.addEventListener("keydown",k),document.addEventListener("mousedown",k);const C=N=>{N?.type==="scroll"&&y.current?.contains(N.target)||document.activeElement!==v.current&&d(!1)};if(o){const N=b.current.getBoundingClientRect();p({position:"fixed",top:N.bottom+6,left:N.left,right:"auto",width:N.width}),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C)}return requestAnimationFrame(()=>{const N=y.current,A=N?.querySelector('[aria-selected="true"]')||N?.querySelector('[role="option"]');A&&(N.scrollTop=A.offsetTop-(N.clientHeight-A.offsetHeight)/2,(v.current||A).focus({preventScroll:!0}))}),()=>{document.removeEventListener("keydown",k),document.removeEventListener("mousedown",k),window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[u,o]);const S=k=>{n(k),d(!1),b.current?.focus()},_=k=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(k.key)||k.target===v.current&&k.key!=="ArrowDown")return;k.preventDefault();const C=[...y.current.querySelectorAll('[role="option"]')],N=C.indexOf(document.activeElement);if(k.key==="ArrowUp"&&N===0&&v.current){v.current.focus();return}const A=k.key==="Home"?0:k.key==="End"?C.length-1:Math.max(0,Math.min(C.length-1,N+(k.key==="ArrowDown"?1:-1)));C[A]?.focus()};return s.jsxs("div",{ref:x,className:`lead-select ${a}`,children:[s.jsxs("button",{ref:b,type:"button",className:"lead-select-trigger","aria-label":r,"aria-haspopup":"listbox","aria-expanded":u,disabled:i,onClick:()=>{g(""),d(k=>!k)},onKeyDown:k=>{(k.key==="ArrowDown"||k.key==="ArrowUp")&&(k.preventDefault(),g(""),d(!0))},children:[s.jsx("span",{className:`truncate${w?"":" lead-select-placeholder"}`,children:w?w.label:c}),s.jsx(Is,{"aria-hidden":"true"})]}),u&&s.jsxs("ul",{ref:y,role:"listbox","aria-label":r,className:"lead-select-menu",style:o?h:void 0,onKeyDown:_,children:[l&&s.jsx("li",{role:"presentation",className:"lead-select-search",children:s.jsx("input",{ref:v,type:"text",value:m,placeholder:"Search","aria-label":`Search ${r||"options"}`,autoComplete:"off",spellCheck:!1,onChange:k=>{g(k.target.value),y.current.scrollTop=0},onKeyDown:k=>{k.key==="Enter"&&E[0]&&(k.preventDefault(),S(E[0].value))}})}),l&&E.length===0&&s.jsx("li",{className:"lead-select-empty",children:"No matches"}),E.map(k=>s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":k.value===e,className:"lead-select-option",onClick:()=>S(k.value),children:[s.jsx("span",{className:"truncate",children:k.label}),k.value===e&&s.jsx(ft,{"aria-hidden":"true"})]})},k.value))]})]})}const kP=f.createContext(null);function sp(){const e=f.useContext(kP);return t=>pa({pageText:e},t)}const Hse="w-full rounded-2xl",cWe=`${Hse} h-14 text-[15px]`,c7="pf-contact-field border px-4 text-ink placeholder:text-ink-muted transition-colors pf-accent-focus-within focus:outline-none";function uWe(){return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"pf-accent-text","aria-hidden":"true",children:" *"}),s.jsx("span",{className:"sr-only",children:" (required)"})]})}function dWe({field:e,value:t,onChange:n,idPrefix:r}){const a=sp(),i=`${r}-${e.id}`,o=t??JJ(e),l=s.jsxs(s.Fragment,{children:[e.label,e.required&&s.jsx(uWe,{})]}),c="block px-1 pb-1.5 text-[13px] font-medium leading-snug text-ink-mid";if(e.type==="checkbox")return s.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-lg px-1 pb-1 text-[13px] leading-5 text-ink-mid",children:[s.jsx("input",{type:"checkbox",checked:o===!0,onChange:d=>n(d.target.checked),"aria-required":e.required||void 0,className:"pf-contact-consent-input peer sr-only"}),s.jsx("span",{className:"pf-contact-consent-box grid h-5 w-5 shrink-0 place-items-center","aria-hidden":"true",children:s.jsx(ft,{className:"h-3.5 w-3.5",
426strokeWidth:2.5})}),s.jsx("span",{children:l})]});if(e.type==="radio"||e.type==="multi"){const d=e.type==="multi",h=d?Array.isArray(o)?o:[]:o,p=m=>n(d?h.includes(m)?h.filter(g=>g!==m):[...h,m]:m);return s.jsxs("fieldset",{children:[s.jsxs("legend",{className:c,children:[l,d&&s.jsxs("span",{className:"font-normal text-ink-muted",children:[" · ",a("contactPickAny")]})]}),s.jsx("div",{className:e.layout==="chips"?"flex flex-wrap gap-2":"flex flex-col gap-2",children:e.options.map(m=>s.jsxs("label",{className:"cursor-pointer",children:[s.jsx("input",{type:d?"checkbox":"radio",name:i,value:m,checked:d?h.includes(m):h===m,onChange:()=>p(m),className:"pf-contact-choice-input peer sr-only"}),s.jsxs("span",{className:`pf-contact-choice ${e.layout==="chips"?"inline-flex":"flex w-full"} min-h-11 items-center gap-2 rounded-2xl border px-4 py-2 text-[14px] leading-snug text-ink`,children:[s.jsx("span",{className:`pf-contact-choice-tick grid h-4 w-4 shrink-0 place-items-center ${d?"rounded":"rounded-full"}`,"aria-hidden":"true",children:s.jsx(ft,{className:"h-3 w-3",strokeWidth:2.75})}),m]})]},m))})]})}if(e.type==="select"){const d=e.placeholder||a("contactChooseOne"),h=[...e.required?[]:[{value:"",label:d}],...e.options.map(p=>({value:p,label:p}))];return s.jsxs("div",{children:[s.jsx("p",{className:c,children:l}),s.jsx(xu,{className:"pf-contact-select",label:e.label,value:o,options:h,placeholder:d,onChange:n})]})}const u=e.type==="textarea";return s.jsxs("div",{children:[s.jsx("label",{htmlFor:i,className:c,children:l}),u?s.jsx("textarea",{id:i,rows:3,value:o,onChange:d=>n(d.target.value),maxLength:h$.textarea,placeholder:e.placeholder,"aria-required":e.required||void 0,className:`${Hse} ${c7} min-h-24 resize-y py-4 text-[15px] leading-relaxed`}):s.jsx("input",{id:i,type:e.accept==="phone"?"tel":"text",inputMode:{number:"numeric",phone:"tel"}[e.accept],autoComplete:e.accept==="phone"?"tel":void 0,value:o,onChange:d=>n(d3e(e.accept,d.target.value)),maxLength:h$.text,placeholder:e.placeholder,"aria-required":e.required||void 0,className:`${cWe} ${c7}`})]})}const qse="w-full rounded-2xl",DE=`${qse} h-14 text-[15px]`,$E=()=>{},hWe=[{id:"phone"},{id:"message"}];function Wse({email:e,onEmailChange:t,phone:n="",onPhoneChange:r=$E,message:a="",onMessageChange:i=$E,showPhone:o=!1,showMessage:l=!1,fields:c=hWe,answers:u={},onAnswerChange:d=$E,divided:h=!1,gap:p=Xw.default,consent:m,onConsentChange:g,creatorName:x,error:b,canSubmit:y,isSending:v,cta:w,onSubmit:j,emailId:E="contact-email",notice:S=""}){const _=sp(),k=[s.jsxs("div",{className:"relative",children:[s.jsx(qr,{className:"pointer-events-none absolute left-4 top-1/2 z-10 h-4 w-4 -translate-y-1/2 text-ink-muted","aria-hidden":"true"}),s.jsx("input",{id:E,type:"email",inputMode:"email",autoComplete:"email",required:!0,value:e,onChange:C=>t(C.target.value),placeholder:_("contactEmail"),"aria-label":_("contactEmail"),className:`${DE} pf-contact-field border pl-11 pr-4 text-ink placeholder:text-ink-muted transition-colors pf-accent-focus-within focus:outline-none`})]},"email"),...c.map(C=>Cu(C)?C.id==="phone"?o?s.jsxs("div",{className:"relative",children:[s.jsx(Ts,{className:"pointer-events-none absolute left-4 top-1/2 z-10 h-4 w-4 -translate-y-1/2 text-ink-muted","aria-hidden":"true"}),s.jsx("input",{id:`${E}-phone`,type:"tel",inputMode:"tel",autoComplete:"tel",value:n,onChange:N=>r(N.target.value),maxLength:100,placeholder:_("contactPhone"),"aria-label":_("contactPhone"),className:`${DE} pf-contact-field border pl-11 pr-4 text-ink placeholder:text-ink-muted transition-colors pf-accent-focus-within focus:outline-none`})]},"phone"):null:l?s.jsxs("div",{className:"relative",children:[s.jsx(ea,{className:"pointer-events-none absolute left-4 top-5 z-10 h-4 w-4 text-ink-muted","aria-hidden":"true"}),s.jsx("textarea",{id:`${E}-message`,rows:4,value:a,onChange:N=>i(N.target.value),maxLength:5e3,placeholder:_("contactMessage"),"aria-label":"Message",className:`${qse} pf-contact-field min-h-28 resize-y border py-4 pl-11 pr-4 text-[15px] leading-relaxed text-ink placeholder:text-ink-muted transition-colors pf-accent-focus-within focus:outline-none`})]},"message"):null:s.jsx(dWe,{field:C,value:u[C.id],onChange:N=>d(C.id,N),idPrefix:E},C.id)),s.jsxs("label",{className:"flex min-h-11 cursor-pointer items-start gap-3 rounded-lg px-1 py-2 text-[13px] leading-5 text-ink-mid",children:[s.jsx("input",{type:"checkbox",checked:m,onChange:C=>g(C.target.checked),className:"pf-contact-consent-input peer sr-only"}),s.jsx("span",{className:"pf-contact-consent-box grid h-5 w-5 shrink-0 place-items-center","aria-hidden":"true",children:s.jsx(ft,{className:"h-3.5 w-3.5",
426strokeWidth:2.5})}),s.jsxs("span",{children:["I am 18+ and agree to the"," ",s.jsx(Le,{to:Me.TERMS,className:"underline hover:text-indigo",children:"Terms"})," ","and"," ",s.jsx(Le,{to:Me.PRIVACY,className:"underline hover:text-indigo",children:"Privacy Policy"}),", and to share my contact details and conversation with ",x||"the creator","."]})]},"consent")].filter(Boolean);return s.jsxs("form",{onSubmit:j,noValidate:!0,className:"flex flex-col gap-3",children:[S&&s.jsx("p",{className:"rounded-md border border-rule bg-cream px-3 py-2 text-xs text-ink-mid",children:S}),s.jsx("div",{className:"flex flex-col",style:{gap:p},children:k.map((C,N)=>h&&N>0?[s.jsx("hr",{className:"pf-contact-divider","aria-hidden":"true"},`divider-${C.key}`),C]:C)}),b&&s.jsx("p",{className:"text-sm text-destructive",role:"alert",children:b}),s.jsxs("button",{type:"submit",disabled:!y,className:`pf-accent-bg pf-accent-focus ${DE} inline-flex items-center justify-center gap-2 font-medium hover:opacity-90 active:scale-[0.99] transition-all focus-visible:outline-none disabled:opacity-50 disabled:pointer-events-none disabled:active:scale-100`,children:[v&&s.jsx(vt,{className:"w-4 h-4 animate-spin","aria-hidden":"true"}),w]})]})}function Vse({isOpen:e,onClose:t,expert:n,config:r,messages:a,creatorId:i,creatorName:o,source:l,widgetKey:c,prefillMessage:u="",notice:d="",themeStyle:h=null}){const{user:p}=Ut(),m=f.useMemo(()=>(a||[]).filter(te=>
426(te.role==="user"||te.role==="assistant")&&typeof te.content=="string"&&te.content.trim()).slice(-40).map(te=>({role:te.role==="user"?"user":"exp",text:te.content.trim().slice(0,600)})),[a]),g=m.length>0,[x,b]=f.useState(()=>p?.email||""),[y,v]=f.useState(()=>p?.contact||""),[w,j]=f.useState(""),[E,S]=f.useState(!1),[_,k]=f.useState({}),[C,N]=f.useState(""),[A,T]=f.useState(!1),[I,$]=f.useState(!1),[O,U]=f.useState(()=>crypto.randomUUID()),F=f.useRef(null),[H,G]=f.useState(!1),M=f.useRef(null);f.useEffect(()=>{const te=M.current;if(!e||!te)return;const Q=new IntersectionObserver(([Y])=>G(!Y.isIntersecting),{root:te.closest('[role="dialog"]')});return Q.observe(te),()=>Q.disconnect()},[e,I]),f.useEffect(()=>{e&&F.current&&clearTimeout(F.current)},[e]),f.useEffect(()=>()=>{F.current&&clearTimeout(F.current)},[]);const[z,W]=f.useState(!1);e!==z&&(W(e),e&&(!x&&p?.email&&b(p.email),!y&&p?.contact&&v(p.contact),!w&&u&&j(u)));const D=r.contactFields||[],Z=!D.some(te=>QJ(te,_[te.id])),V=E&&Z&&ec(x.trim())&&!A;async function L(te){if(te.preventDefault(),!V)return;N(""),T(!0);const Q=n?Y=>uke(n.id,Y):Y=>uK(i,Y);try{const Y={submissionId:O,contactConsent:!0,name:oQ(p?.full_name,x),email:x.trim(),phone:r.collect?.phone&&y.trim()||null,message:r.collect?.message?w.trim()||null:(u||"").trim()||null,isBusiness:!1,answers:ZJ(D,_),source:l,...c?{widgetKey:c}:{},consent:n&&g?"summary":"none",convo:n&&g?m:void 0};await Q(Y),$(!0)}catch(Y){N(Y.response?.data?.detail?.message||pa(r,"contactError"))}finally{T(!1)}}function K(){t(),F.current=setTimeout(()=>{b(p?.email||""),v(p?.contact||""),j(""),$(!1),N(""),S(!1),k({}),U(crypto.randomUUID())},250)}return s.jsx(en,{isOpen:e,onClose:K,maxWidth:"max-w-md",title:I?pa(r,"contactSentTitle"):pa(r,"contactTitle"),hideTitle:!0,className:"relative max-h-[min(44rem,100%)] overflow-y-auto overscroll-contain",children:s.jsxs(kP.Provider,{value:r.pageText,children:[s.jsxs("div",{className:`sticky top-0 z-10 flex items-center justify-between gap-3 bg-paper pb-3 pl-6 pr-3 pt-4 transition-shadow${H?" shadow-[0_1px_0_rgb(20_20_19/0.08)]":""}`,children:[!I&&s.jsx("h2",{className:"font-heading text-xl font-medium tracking-tight text-ink",children:pa(r,"contactTitle")}),s.jsx("button",{type:"button",onClick:K,className:"ml-auto grid h-9 w-9 shrink-0 place-items-center rounded-lg text-ink-muted transition-colors hover:bg-cream-deep hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo/40","aria-label":"Close",children:s.jsx(as,{className:"h-5 w-5","aria-hidden":"true"})})]}),s.jsx("div",{ref:M,"aria-hidden":"true"}),s.jsx("div",{className:"px-6 pb-6 pt-1",style:h||void 0,children:I?s.jsxs("div",{children:[s.jsx("div",{className:"w-10 h-10 rounded-pill bg-sage-tint text-sage flex items-center justify-center mb-3",children:s.jsx(ft,{className:"w-5 h-5","aria-hidden":"true"})}),s.jsx("h3",{className:"font-heading text-lg font-medium text-ink tracking-tight mb-1.5",children:pa(r,"contactSentTitle")}),s.jsxs("p",{className:"text-sm text-ink-mid leading-relaxed",children:[r.confirm,r.rtime?` ${r.rtime}`:""]}),s.jsxs("p",{className:"text-[13px] text-ink-muted mt-2",children:[pa(r,"contactReplyTo")," ",s.jsx("b",{className:"text-ink-mid font-medium",children:x.trim()}),"."]}),s.jsx("div",{className:"flex justify-end mt-5",children:s.jsx(yt,{onClick:K,children:pa(r,"contactDone")})})]}):s.jsx(Wse,{email:x,onEmailChange:b,phone:y,onPhoneChange:v,message:w,onMessageChange:j,showPhone:r.collect?.phone===!0,showMessage:r.collect?.message===!0,fields:r.contactFields,divided:r.contactDividers===!0,gap:YJ(r),answers:_,onAnswerChange:(te,Q)=>k(Y=>({...Y,[te]:Q})),consent:E,onConsentChange:S,creatorName:o||(n?`${n.name}'s creator`:"the creator"),error:C,canSubmit:V,isSending:A,cta:nk(r),onSubmit:L,emailId:"crq-email",notice:d})})]})})}const pWe="flex shrink-0 items-center gap-1.5 px-2.5 sm:px-3 py-1.5 ml-1 text-xs font-medium rounded-md bg-cream-tint border border-rule text-ink hover:bg-cream-deep transition-colors",mWe="hidden sm:block max-w-32 truncate",U3="ge:open-contact",Tj="ge:contact-form",Aj=[];function fWe(e,t){const n={expertId:e,handle:t,ready:!1};return Aj.push(n),n}function gWe(e){const t=Aj.indexOf(e);t>=0&&Aj.splice(t,1)}function xWe(e,t){const n=Aj.filter(a=>a.expertId===e),r=n.filter(a=>a.ready);return(r.length?r:n)[0]?.handle===t}function U0(e,{notice:t=""}={}){!e||typeof window>"u"||window.dispatchEvent(new CustomEvent(U3,{detail:{expertId:e,notice:t}}))}function Ik({expert:e,messages:t,source:n,widgetKey:r,className:a=pWe,labelClassName:i=mWe,iconClassName:o="h-3 w-3 text-indigo",silent:l=!1}){const[c,u]=f.useState(null),[d,h]=f.useState(!1),[p,m]=f.useState(!1),[g,x]=f.useState(null),[b,y]=f.useState(""),v=f.useRef(null);f.useEffect(()=>{let k=!1;if(e?.id)return v.current&&v.current!==e.id&&(u(null),h(!1),m(!1)),v.current=e.id,cK(e.id).then(C=>{k||C?.enabled&&u({expertId:e.id,config:C})}).catch(()=>{}).finally(()=>{k||x(e.id)}),()=>{k=!0}},[e?.id]);const w=g===e?.id,j=f.useRef(null),E=f.useRef(null);f.useEffect(()=>
426{if(!e?.id)return;const k=fWe(e.id,j);E.current=k;const C=N=>{if(N.detail?.expertId&&N.detail.expertId!==e.id)return;const A=xWe(e.id,j);console.info("[contact] open requested",{expertId:e.id,owner:A,ready:k.ready}),A&&(y(N.detail?.notice||""),m(!0))};return window.addEventListener(U3,C),()=>{window.removeEventListener(U3,C),gWe(k),E.current=null}},[e?.id]),f.useEffect(()=>{if(e?.id)return window.dispatchEvent(new CustomEvent(Tj,{detail:{expertId:e.id,open:d}})),()=>{d&&window.dispatchEvent(new CustomEvent(Tj,{detail:{expertId:e.id,open:!1}}))}},[e?.id,d]);const S=c?.expertId===e?.id?c.config:null;if(f.useEffect(()=>{E.current&&(E.current.ready=!!S)},[S]),f.useEffect(()=>{!p||!w||(S&&h(!0),m(!1))},[p,w,S]),!S)return null;const _=S.handover||"Contact";return s.jsxs(s.Fragment,{children:[!l&&s.jsxs("button",{type:"button",onClick:()=>{y(""),h(!0)},className:a,"aria-label":_,title:_,children:[s.jsx(I_,{className:`fill-current ${o}`,"aria-hidden":"true"}),s.jsx("span",{className:i,children:_})]}),s.jsx(Vse,{isOpen:d,onClose:()=>h(!1),expert:e,config:S,messages:t,source:n,widgetKey:r,notice:b})]})}const bWe=/^[A-Za-z0-9_-]{11}$/;function Rj(e){try{const t=new URL(String(e||"").trim());return["http:","https:"].includes(t.protocol)?t:null}catch{return null}}function NP(e){const t=Rj(e);if(!t)return"";const n=t.hostname.toLowerCase().replace(/^www\./,"");let r="";if(n==="youtu.be")[r]=t.pathname.split("/").filter(Boolean);else if(n==="youtube.com"||n==="m.youtube.com"||n==="music.youtube.com")if(t.pathname==="/watch")r=t.searchParams.get("v")||"";else{const[a,i]=t.pathname.split("/").filter(Boolean);["embed","shorts","live","v"].includes(a)&&(r=i||"")}return bWe.test(r)?r:""}function u7(e){const t=NP(e);return t?`https://i.ytimg.com/vi/${t}/hqdefault.jpg`:""}const yWe=/^(https:\/\/i\.ytimg\.com\/vi\/[A-Za-z0-9_-]{11})\/(?:hq|sd|)default\.jpg(\?.*)?$/;function np(e,t=""){const n=String(e||""),r=Rj(t),a=Rj(n),i=["tiktok.com","www.tiktok.com","m.tiktok.com"],o=["tiktokcdn.com","tiktokcdn-us.com","tiktokcdn-eu.com","ibytedtos.com","byteoversea.com","muscdn.com"];if(r&&i.includes(r.hostname)&&/^\/@[\w.-]+\/video\/\d{10,25}\/?$/.test(r.pathname)&&a&&o.some(c=>a.hostname===c||a.hostname.endsWith(`.${c}`)))return`${"https://gsexperts-backend.up.railway.app/api".replace(/\/$/,"")}/users/tiktok-thumbnail?url=${encodeURIComponent(r.href)}`;const l=n.match(yWe);return l?`${l[1]}/maxresdefault.jpg`:n}function rp(e){const t=e.currentTarget;if(!t)return!1;const n=t.src.replace("/maxresdefault.jpg","/mqdefault.jpg");return t.dataset.thumbFallback||n===t.src?(t.style.visibility="hidden",!1):(t.dataset.thumbFallback="1",t.src=n,!0)}function FE(e){const t=Rj(e);if(!t)return!1;const n=t.hostname.toLowerCase().replace(/^www\./,"");return["youtu.be","youtube.com","m.youtube.com","music.youtube.com","vimeo.com","loom.com","tiktok.com","spotify.com","instagram.com","instagr.am"].some(r=>n===r||n.endsWith(`.${r}`))}const BE="text-[rgb(var(--pf-accent-deep-rgb,45_45_204))]",vWe="group-hover:text-[rgb(var(--pf-accent-deep-rgb,45_45_204))]",wWe="bg-[rgb(var(--pf-accent-rgb,61_61_245))]",Gse="focus-visible:ring-[rgb(var(--pf-accent-stroke-rgb,61_61_245)/0.5)]",mf={product:{label:"Product",icon:Mf,action:"View product"},service:{label:"Service",icon:I4,action:"View service"},media:{label:"Resource",icon:sY,action:"Open resource"},custom_link:{label:"Profile link",icon:$a,action:"Open link"},expert:{label:"Expert",icon:Ci,action:"Start chat"}};function EP(e){try{const t=new URL(String(e||""));return["http:","https:"].includes(t.protocol)?t.href:""}catch{return""}}function jWe(e,t=3){return Array.isArray(e)?e.filter(n=>n?.type==="profile_elements"&&n?.version===1).flatMap(n=>Array.isArray(n.elements)?n.elements:[]).filter(n=>n&&typeof n=="object").slice(0,t):[]}function Ij(e){return e.availability==="unavailable"?"No longer available":e.availability==="temporarily_unavailable"?"Check back shortly":""}function Yse(e,t,n){if(Ij(e))return null;const r=e.action;if(!r?.kind)return null;const a=mf[e.kind]||mf.custom_link,i=typeof r.label=="string"&&r.label.trim()?r.label.trim():a.action;if(r.kind==="contact")return{label:i,external:!1,Tag:"button",props:{type:"button",onClick:()=>U0(t)}};if(r.kind==="expert_chat"&&r.slug)return{label:i,external:n==="_blank",Tag:"a",props:{href:`/expert
426s/${encodeURIComponent(r.slug)}/chat`,target:n,rel:n==="_blank"?"noopener noreferrer":void 0}};const o=r.kind==="link"?EP(r.url):"";return o?{label:i,external:!0,Tag:"a",props:{href:o,target:"_blank",rel:"noopener noreferrer"}}:null}function Kse(e,{expertId:t,messageId:n,surface:r}){sR(aK({expertId:t,messageId:n,elementRef:e.ref,title:e.title,surface:r}))}function _We({element:e,index:t,count:n,expertId:r,messageId:a,surface:i,linkTarget:o="_top"}){const[l,c]=f.useState(!1),[u,d]=f.useState(!1),h=mf[e.kind]||mf.custom_link,p=h.icon,m=l?"":EP(e.image_url),g=e.price?.label?S0(e.price.label,e.price.currency):"",x=Ij(e),b=Yse(e,r,o),y=e.title||h.label,v=e.kind==="product",{Tag:w,props:j,label:E,external:S}=b||{},_=b?{...j,onClick:k=>{Kse(e,{expertId:r,messageId:a,surface:i}),j.onClick?.(k)}}:{};return s.jsx("li",{className:"w-[min(74vw,15.5rem)] shrink-0 snap-start sm:w-[16rem]",children:s.jsxs("article",{"aria-label":`${t+1} of ${n}: ${e.title||h.label}`,className:"group relative flex h-full flex-col overflow-hidden rounded-xl border border-rule bg-paper shadow-subtle",children:[b&&s.jsx(w,{..._,"aria-label":`${E}: ${y}${S?" (opens in a new tab)":""}`,className:`absolute inset-0 z-10 cursor-pointer rounded-xl border-0 bg-transparent p-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset ${Gse}`,children:s.jsxs("span",{className:"sr-only",children:[E,": ",y]})}),s.jsxs("div",{className:"relative aspect-[5/4] overflow-hidden border-b border-rule/70 bg-cream-deep",children:[m&&s.jsx("img",{src:np(m),alt:"",loading:"lazy",className:"absolute inset-0 h-full w-full object-cover transition-transform duration-300 motion-safe:group-hover:scale-[1.02]",onLoad:()=>d(!0),onError:k=>{rp(k)||(c(!0),d(!1))}}),(!m||!u)&&s.jsx("div",{className:"absolute inset-0 grid place-items-center","aria-hidden":"true",children:s.jsx("span",{className:v?`grid h-24 w-24 place-items-center rounded-3xl bg-[rgb(var(--pf-accent-rgb,61_61_245)/0.1)] ${BE}`:`grid h-10 w-10 place-items-center rounded-full bg-paper/85 backdrop-blur-sm ${BE}`,children:s.jsx(p,{className:v?"h-12 w-12":"h-4 w-4",strokeWidth:v?1.8:1.6})})})]}),s.jsxs("div",{className:`flex flex-1 flex-col px-3 pb-2 pt-2.5 ${v?"pf-product-bar":""}`,children:[s.jsx("h3",{className:`font-display text-[15px] font-semibold leading-tight ${v?"text-current":"text-ink"}`,children:e.title||h.label}),s.jsxs("div",{className:"mt-auto flex items-center justify-between gap-3 pt-2",children:[s.jsxs("div",{className:"min-w-0",children:[g?s.jsx("p",{className:`text-sm font-semibold tabular-nums leading-none ${v?"text-current":"text-ink"}`,children:g}):s.jsx("p",{className:"text-xs text-ink-light",children:"Details on profile"}),x&&s.jsx("p",{className:`mt-0.5 text-[11px] font-medium ${e.availability==="unavailable"?"text-destructive":"text-ink-muted"}`,children:e.availability==="unavailable"?"Archived":"Check back shortly"})]}),x?s.jsx("span",{className:"inline-flex min-h-10 items-center text-[11px] font-medium text-ink-muted",children:Ij(e)}):b?s.jsxs("span",{className:`inline-flex min-h-10 items-center justify-center gap-1 text-xs font-semibold transition-opacity group-hover:underline group-hover:underline-offset-4 ${v?"text-current":BE} group-hover:opacity-75`,children:[E,s.jsx(Af,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}):null]})]})]})})}function kWe({element:e,index:t,count:n,expertId:r,messageId:a,surface:i,linkTarget:o="_top",large:l=!1}){const[c,u]=f.useState(!1),d=mf[e.kind]||mf.custom_link,h=d.icon,p=c?"":EP(e.image_url),m=e.price?.label?S0(e.price.label,e.price.currency):"",g=Ij(e),x=Yse(e,r,o),b=e.title||d.label,y=e.category||d.label,{Tag:v="div",props:w={}}=x||{},j=x?{...w,onClick:S=>{Kse(e,{expertId:r,messageId:a,surface:i}),w.onClick?.(S)}}:w,E=x?.external?Af:xn;return s.jsx("li",{className:"motion-safe:animate-slide-up",children:s.jsxs(v,{...j,"aria-label":x?`${x.label}: ${b}`:`${t+1} of ${n}: ${b}`,className:`group flex w-full items-center text-left transition-colors duration-fast ease-standard ${l?"gap-3.5 px-4 py-3.5":"gap-3 px-3 py-2.5"} ${x?`hover:bg-paper focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset ${Gse}`:""}`,children:[s.jsx("span",{className:`relative grid shrink-0 place-items-center overflow-hidden rounded-lg border border-rule bg-paper ${l?"h-[4.5rem] w-[4.5rem]":"h-14 w-14"} ${g?"opacity-45":""}`,children:p?s.jsx("img",{src:np(p),alt:"",loading:"lazy",className:"h-full w-full object-cover transition-transform duration-base ease-out motion-safe:group-hover:scale-[1.06]",onError:S=>{rp(S)||u(!0)}}):s.jsx(h,{className:"h-5 w-5 text-ink-muted",strokeWidth:1.6,"aria-hidden":"true"})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:`line-clamp-2 font-semibold leading-snug text-ink ${l?"text-[15px]":"text-[13.5px]"}`,children:b}),s.jsx("span",{className:`mt-1 flex min-w-0 items-baseline gap-1.5 ${l?"text-[12.5px]":"text-[11.5px]"}`,children:g?s.jsx("span",{className:"font-medium text-ink-mid",children:g}):s.jsxs(s.Fragment,{children:[m&&s.jsx("span",{className:"font-semibold tabular-nums text-ink-soft",children:m}),m&&y&&s.jsx("span",{className:"text-ink-light","aria-hidden":"true",children:"·"}),s.jsx("span",{className:"truncate text-ink-mid",children:y})]})})]}),x&&s.jsx(E,{className:`${l?"h-[18px] w-[18px]":"h-4 w-4"} shrink-0 text-ink-muted transition-colors duration-fast ${vWe}`,"aria-hidden":"true"})]})})}function Wb({blocks:e,expertId:t,messageId:n,surface:r,className:a="",linkTarget:i="_top",maxElements:o=3,stacked:l=!1,large:c=!1}){const u=f.useMemo(()=>jWe(e,o),[e,o]),d=f.useRef(null),[h,p]=f.useState(0);if(!u.length)return null;const m=()=>{const g=d.current;if(!g?.children?.length)return;const x=g.getBoundingClientRect().left;let b=0,y=Number.POSITIVE_INFINITY;
426Array.from(g.children).forEach((v,w)=>{const j=Math.abs(v.getBoundingClientRect().left-x);j<y&&(y=j,b=w)}),p(b)};return l?s.jsx("section",{className:`min-w-0 ${a}`,"aria-label":"Profile recommendations",children:s.jsx("ul",{className:"flex flex-col divide-y divide-rule/70",children:u.map((g,x)=>s.jsx(kWe,{element:g,index:x,count:u.length,expertId:t,messageId:n,surface:r,linkTarget:i,large:c},g.ref||`${g.kind}-${x}`))})}):s.jsxs("section",{className:`mt-2.5 min-w-0 ${a}`,"aria-label":"Profile recommendations","aria-roledescription":u.length>1?"carousel":void 0,children:[s.jsx("ul",{ref:d,onScroll:m,className:"-mx-1 flex snap-x snap-mandatory gap-2.5 overflow-x-auto px-1 pb-1.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:u.map((g,x)=>s.jsx(_We,{element:g,index:x,count:u.length,expertId:t,messageId:n,surface:r,linkTarget:i},g.ref||`${g.kind}-${x}`))}),u.length>1&&s.jsx("div",{className:"mt-1 flex justify-center gap-1.5 sm:hidden","aria-hidden":"true",children:u.map((g,x)=>s.jsx("span",{className:`h-1.5 rounded-full transition-all ${x===h?`w-4 ${wWe}`:"w-1.5 bg-rule"}`},g.ref||x))})]})}function UE(e,t,n){return e+(t-e)*n}function Xse(e){return e-Math.floor(e)}function zE(e,t){const n=Math.floor(e),r=Math.floor(t);let a=e-n,i=t-r;a=a*a*(3-2*a),i=i*i*(3-2*i);const o=Ki(n,r),l=Ki(n+1,r),c=Ki(n,r+1),u=Ki(n+1,r+1);return o+(l-o)*a+(c-o)*i+(o-l-c+u)*a*i}function Ki(e,t){const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)}function SP(e,t){const n=Math.PI*(3-Math.sqrt(5)),r=1-2*(e+.5)/t,a=Math.sqrt(1-r*r),i=e*n;return[a*Math.cos(i),r,a*Math.sin(i)]}function NWe(e,t){return Math.atan2(Math.sin(e-t),Math.cos(e-t))}function ap(e,t,n,r,a){const i=Math.sin(t),o=Math.cos(t),l=Math.sin(e),c=Math.cos(e);return(u,d,h)=>{const p=u*c+h*l,m=-u*l+h*c,g=d*o-m*i,x=d*i+m*o;return[n+p*a,r-g*a,x]}}function EWe(e,t,n,r=.3){for(const a of t){const i=a.a??1,o=Math.min(1,Math.max(0,a.white)),l=Math.round((n?1-o:o)*255);e.fillStyle=`rgba(${l},${l},${l},${i})`,e.beginPath(),e.arc(a.x,a.y,a.r,0,Math.PI*2),e.fill()}}function SWe(e,t,n){for(const r of t){const a=r.a??1,i=Math.min(1,Math.max(0,r.white)),o=Math.round((n?1-i:i)*255);e.strokeStyle=`rgba(${o},${o},${o},${a})`,e.lineWidth=r.w,e.beginPath(),e.moveTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.stroke()}}function Wu(e,t,n=.3){const r=[];for(const a of e)(a.a??1)<.02||(a.r=Math.max(n,a.r),r.push(a));return r.sort((a,i)=>a.z-i.z),{dots:r,lines:t.filter(a=>(a.a??1)>=.02)}}function CWe(e,t,n){t.lines.length&&SWe(e,t.lines,n),EWe(e,t.dots,n)}function ip(e,t){return(e/300)**t}const TWe=(e,t,n)=>{const r=e/2,a=e/2,i=e/2*.76,o=ap(t*.4,.3,r,a,1),l=ip(e,n.rsPow??.6),c=[],u=n.ghostN??150;for(let p=0;p<u;p++){const m=SP(p,u),[g,x,b]=o(m[0]*i,m[1]*i,m[2]*i),y=(b/i+1)/2;c.push({x:g,y:x,z:b,r:.8*l,white:.78,a:.1+.22*y})}const d=n.strandN??52,h=n.turns??3;for(let p=0;p<3;p++){const m=p/3*2*Math.PI;for(let g=0;g<d;g++){const x=(Xse(g/d+t*.045)*2-1)*.96,b=Math.sqrt(Math.max(0,1-x*x)),y=Math.min(1,(1-Math.abs(x))/.1),v=x*Math.PI*h+m,w=1+.075*Math.sin(x*Math.PI*h*2+m*2+t*.8),j=b*i*w,[E,S,_]=o(Math.cos(v)*j,x*i*w,Math.sin(v)*j),k=(_/i+1)/2;c.push({x:E,y:S,z:_,r:((n.rBase??1.2)+(n.rDepth??1.8)*k)*l,white:.55-.45*k,a:y*(.45+.55*k)})}}return Wu(c,[],n.rMin)};function AWe(e,t,n,r){const a=2*t*n+r,i=e%a,o=new Array(t).fill(0);let l=-1;if(i<2*t*n){const c=Math.floor(i/n),u=(i-c*n)/n,d=1-(1-Math.min(1,u/.7))**3;if(c<t){for(let h=0;h<c;h++)o[h]=1;o[c]=d,l=c}else{const h=2*t-1-c;for(let p=0;p<h;p++)o[p]=1;o[h]=1-d,l=h}}return{amount:o,active:l}}function RWe(e,t,n){let[r,a,i]=e,o=!1;for(let l=0;l<t.length;l++){if(n.amount[l]<=0)continue;const c=t[l],u=c.axis===0?r:c.axis===1?a:i;if(u<c.lo||u>=c.hi)continue;l===n.active&&(o=!0);const d=c.ang*n.amount[l],h=Math.cos(d),p=Math.sin(d);if(c.axis===0){const m=a*h-i*p;i=a*p+i*h,a=m}else if(c.axis===1){const m=r*h+i*p;i=-r*p+i*h,r=m}else{const m=r*h-a*p;a=r*p+a*h,r=m}}return[r,a,i,o]}function IWe(e){const t=[];for(let n=0;n<e;n++){const r=Math.min(2,Math.floor(Ki(n,2.3)*3)),a=-1+.5*Math.min(3,Math.floor(Ki(n,5.9)*4)),i=Ki(n,7.7)<.5?1:-1;t.push({axis:r,lo:a,hi:a+.5,ang:i*Math.PI/2})}return t}
426const PWe=(e,t,n)=>{const r=e/2,a=e/2,i=e/2*.82,o=.4+.06*Math.sin(t*.35),l=ap(t*.5,o,r,a,i),c=t*(.5+(1.7-.5)*(n.scanMul??1)),u=ip(e,n.rsPow??.6),d=n.dimBase??1,h=[],p=n.latRings??17,m=n.lonDensity??44;for(let g=0;g<=p;g++){const x=-Math.PI/2+g/p*Math.PI,b=Math.cos(x),y=Math.sin(x),v=Math.max(1,Math.round(Math.abs(b)*m));for(let w=0;w<v;w++){const j=w/v*2*Math.PI,[E,S,_]=l(b*Math.cos(j),y,b*Math.sin(j)),k=(_+1)/2,C=NWe(j+t*.5,c),N=Math.exp(-(C*C)/.18)*Math.max(0,_);h.push({x:E,y:S,z:_,r:((n.rBase??.6)+(n.rDepth??1.7)*k+(n.rBoost??1)*N)*u,white:(n.inkFar??.62)-(n.inkSpan??.54)*k,a:d+(1-d)*Math.min(1,N)})}}return Wu(h,[],n.rMin)},LWe=(e,t,n)=>{const r=e/2,a=e/2,i=e/2*.82,o=ap(t*.55,.35+.1*Math.sin(t*.9),r,a,i),l=ip(e,n.rsPow??.6),c=n.moveCount??14,u=IWe(c),d=AWe(t,c,.42,1.2),h=[],p=n.latRings??15,m=n.lonDensity??40;for(let g=0;g<=p;g++){const x=-Math.PI/2+g/p*Math.PI,b=Math.cos(x),y=Math.sin(x),v=Math.max(1,Math.round(Math.abs(b)*m));for(let w=0;w<v;w++){const j=w/v*2*Math.PI,[E,S,_,k]=RWe([b*Math.cos(j),y,b*Math.sin(j)],u,d),[C,N,A]=o(E,S,_),T=(A+1)/2;h.push({x:C,y:N,z:A,r:((n.rBase??.6)+(n.rDepth??1.7)*T+(k?n.rActive??.3:0))*l,white:(n.inkFar??.62)-(n.inkSpan??.54)*T-(k?.14:0)})}}return Wu(h,[],n.rMin)},OWe=(e,t,n)=>{const r=e/2,a=e/2,i=e/2*.874,o=ap(t*.18,.38,r,a,1),l=ip(e,n.rsPow??.6),c=[],u=n.rings??15,d=n.lonDensity??40;for(let h=0;h<=u;h++){const p=-Math.PI/2+h/u*Math.PI,m=Math.cos(p),g=Math.sin(p),x=.62*Math.sin(t*2.1-h*.52)+.38*Math.sin(t*1.27+h*.83),b=i*(.88+.105*x),y=Math.max(1,Math.round(Math.abs(m)*d));for(let v=0;v<y;v++){const w=v/y*2*Math.PI,[j,E,S]=o(m*Math.cos(w)*b,g*b,m*Math.sin(w)*b),_=(S/i+1)/2,k=Math.max(0,x);c.push({x:j,y:E,z:S,r:((n.rBase??.6)+(n.rDepth??1.7)*_)*(1+.4*k)*l,white:.66-.56*_-.1*k})}}return Wu(c,[],n.rMin)};function MWe(e){return e*e*(3-2*e)}function Jse(e){const t=e.length,n=[];let r=0;for(let a=0;a<t;a++){const i=e[a],o=e[(a+1)%t],l=Math.hypot(o[0]-i[0],o[1]-i[1]);n.push(l),r+=l}return a=>{let i=a*r,o=0;for(;i>n[o]&&o<t-1;)i-=n[o],o++;const l=e[o],c=e[(o+1)%t],u=n[o]?Math.min(1,i/n[o]):0;return[l[0]+(c[0]-l[0])*u,l[1]+(c[1]-l[1])*u]}}const DWe=e=>{const t=-Math.PI/2+e*2*Math.PI;return[Math.cos(t)*.24,Math.sin(t)*.24]},$We=Jse([[0,-.26],[.24,.16],[-.24,.16]]),FWe=Jse([[0,-.2],[.2,-.2],[.2,.2],[-.2,.2],[-.2,-.2]]),HE=[DWe,$We,FWe];function BWe(e){return Math.max(6,Math.round(34*e))}const z3=1.4,Qse=.9,qE=z3+Qse,UWe=(e,t,n)=>{const r=HE.length,a=t%(qE*r),i=Math.floor(a/qE),o=a-i*qE,l=o>z3?MWe((o-z3)/Qse):0,c=n.spread??1,u=HE[i],d=HE[(i+1)%r],h=160,p=[];for(let S=0;S<h;S++){const _=S/h,k=u(_),C=d(_);p.push([(k[0]+(C[0]-k[0])*l)*c,(k[1]+(C[1]-k[1])*l)*c])}const m=[];let g=0;for(let S=0;S<h;S++){const _=p[S],k=p[(S+1)%h],C=Math.hypot(k[0]-_[0],k[1]-_[1]);m.push(C),g+=C}const x=BWe(n.iconD??1),b=(n.rDot??.021)*1.35*c,y=1+.02*Math.sin(o*3.1),v=[],w=e/2;let j=0,E=0;for(let S=0;S<x;S++){const _=S/x*g;for(;E+m[j]<_&&j<h-1;)E+=m[j],j++;const k=p[j],C=p[(j+1)%h],N=m[j]?Math.min(1,(_-E)/m[j]):0,A=(k[0]+(C[0]-k[0])*N)*y,T=(k[1]+(C[1]-k[1])*N)*y;v.push({x:w+A*e,y:w+T*e,z:0,r:Math.max(.35,b*e),white:.1})}return Wu(v,[],n.rMin)},zWe=(e,t,n)=>{const r=e/2,a=e/2,i=e/2*.82,o=ap(t*.12,.3,r,a,1),l=ip(e,n.rsPow??.6),c=[],u=n.orbitN??12,d=n.ghostN??40,h=n.particles??3;for(let p=0;p<u;p++){const m=Ki(p,1.7),g=Ki(p,5.2),x=Ki(p,8.9),b=i*(.45+.52*m),y=m*2*Math.PI,v=Math.acos(2*g-1),w=Math.sin(v)*Math.cos(y),j=Math.cos(v),E=Math.sin(v)*Math.sin(y);let S=-j,_=w;const k=0,C=Math.max(1e-6,Math.sqrt(S*S+_*_));S/=C,_/=C;const N=j*k-E*_,A=E*S-w*k,T=w*_-j*S,I=(.25+.55*x)*(x>.5?1:-1);for(let $=0;$<d;
426$++){const O=$/d*2*Math.PI,[U,F,H]=o((S*Math.cos(O)+N*Math.sin(O))*b,(_*Math.cos(O)+A*Math.sin(O))*b,(k*Math.cos(O)+T*Math.sin(O))*b),G=(H/b+1)/2;c.push({x:U,y:F,z:H,r:(n.ghostR??.9)*l,white:.72,a:(n.ghostA??.5)*(.4+.6*G)})}for(let $=0;$<h;$++){const O=t*I+$/h*2*Math.PI+g*6,[U,F,H]=o((S*Math.cos(O)+N*Math.sin(O))*b,(_*Math.cos(O)+A*Math.sin(O))*b,(k*Math.cos(O)+T*Math.sin(O))*b),G=(H/b+1)/2;c.push({x:U,y:F,z:H,r:((n.partR??1.2)+(n.partRDepth??1.6)*G)*l,white:.3-.22*G})}}return Wu(c,[],n.rMin)},d7=(e,t,n)=>{const r=e/2,a=e/2,i=e/2*.78,o=n.spin??1,l=.3,c=ap(t*.1*o,l,r,a,1),u=ip(e,n.rsPow??.6),d=[],h=n.ghostN??150;for(let T=0;T<h;T++){const I=SP(T,h),[$,O,U]=c(I[0]*i,I[1]*i,I[2]*i),F=(U/i+1)/2;d.push({x:$,y:O,z:U,r:.8*u,white:.78,a:.1+.22*F})}const p=t*.24*o,m=n.faceOn?-l:.55+.3*Math.sin(t*.18)*o,g=Math.cos(p),x=0,b=Math.sin(p),y=-b*Math.sin(m),v=Math.cos(m),w=g*Math.sin(m),j=x*w-b*v,E=b*y-g*w,S=g*v-x*y,_=.23*(n.wobMul??1),k=n.faceOn?i/(1+.85*_):i,C=n.lanes??5,N=n.segs??88,A=Math.max(1,Math.round(C*(n.bandMul??1)));for(let T=0;T<A;T++){const I=(T-(A-1)/2)*.075,$=Math.abs(T-(A-1)/2)/Math.max(1,(A-1)/2);for(let O=0;O<N;O++){const U=O/N*2*Math.PI,F=(.16*Math.sin(U*3-t*1.7+T*.22)+.07*Math.sin(U*5+t*1.1))*(n.wobMul??1),H=n.faceOn?1+F:1,G=n.faceOn?I:I+F,M=g*Math.cos(U)+y*Math.sin(U)+j*G,z=x*Math.cos(U)+v*Math.sin(U)+E*G,W=b*Math.cos(U)+w*Math.sin(U)+S*G,D=Math.sqrt(M*M+z*z+W*W),Z=k*H,[V,L,K]=c(M/D*Z,z/D*Z,W/D*Z),te=(K/i+1)/2;d.push({x:V,y:L,z:K,r:((n.rBase??1.1)+(n.rDepth??1.7)*te)*(1-.25*$)*u,white:.52-.44*te+.18*$,a:.4+.6*te})}}return Wu(d,[],n.rMin)},HWe=(e,t,n)=>{const r=e/2,a=e/2,i=e/2*.8*(n.spread??1),o=ap(t*.12,.32,r,a,i),l=ip(e,n.rsPow??.6),c=n.nodeN??30,u=n.thr??.72,d=n.nodeR??1.4,h=n.nodeRDepth??1.8,p=[];for(let b=0;b<c;b++){const y=SP(b,c),v=y[0]+.3*(zE(b*.31+9,t*.24)-.5)*2,w=y[1]+.3*(zE(b*.53+27,t*.21)-.5)*2,j=y[2]+.3*(zE(b*.77+55,t*.27)-.5)*2,E=Math.sqrt(v*v+w*w+j*j);p.push([v/E,w/E,j/E])}const m=[],g=[];for(let b=0;b<c;b++)for(let y=b+1;y<c;y++){const v=p[b][0]-p[y][0],w=p[b][1]-p[y][1],j=p[b][2]-p[y][2],E=Math.sqrt(v*v+w*w+j*j);if(E>=u)continue;const[S,_,k]=o(p[b][0],p[b][1],p[b][2]),[C,N,A]=o(p[y][0],p[y][1],p[y][2]),T=((k+A)/2+1)/2;m.push({x1:S,y1:_,x2:C,y2:N,white:.42,a:(1-E/u)*(.3+.55*T),w:Math.max(.6,(n.lineW??.8)*l)})}for(let b=0;b<c;b++){const[y,v,w]=o(p[b][0],p[b][1],p[b][2]),j=(w+1)/2,E=1+.25*Math.sin(t*1.4+b*2.7);g.push({x:y,y:v,z:w,r:(d+h*j)*E*l,white:.55-.45*j})}const x=n.signals??5;for(let b=0;b<x;b++){const y=Math.floor(t*.55+b*7.31),v=Math.floor(Ki(y,b*3.1+1.7)*c),w=Math.floor(Ki(y,b*5.7+4.2)*c);if(v===w)continue;const j=Xse(t*.55+b*7.31),E=UE(p[v][0],p[w][0],j),S=UE(p[v][1],p[w][1],j),_=UE(p[v][2],p[w][2],j),k=Math.max(1e-6,Math.sqrt(E*E+S*S+_*_)),[C,N,A]=o(E/k,S/k,_/k),T=(A+1)/2;g.push({x:C,y:N,z:A,r:(d*1.5+h*T)*l,white:.05,a:.5+.5*T})}return Wu(g,m,n.rMin)},qWe={orbits:zWe,globe:PWe,rubik:LWe,wave:OWe,web:HWe,braid:TWe,ribbon:d7,ring:d7,morph:UWe},WWe=Object.fromEntries(Object.entries(qWe).map(([e,t])=>[e,(n,r,a,i,o)=>CWe(n,t(r,a,o),i)])),VWe=[["latRings","lonDensity"],["rings","lonDensity"],["lanes","segs"]],GWe=["orbitN","ghostN","nodeN","strandN","signals"],YWe=["iconD"],KWe=["rBase","rDepth","rActive","rDot","ghostR","partR","partRDepth","nodeR","nodeRDepth"];function XWe(e,t){const n={...e},r=new Set,a=Math.sqrt(t);for(const[i,o]of VWe){const l=n[i],c=n[o];l!=null&&c!=null&&!r.has(i)&&!r.has(o)&&(n[i]=Math.max(2,Math.round(l*a)),n[o]=Math.max(2,Math.round(c*a)),r.add(i),r.add(o))}for(const i of GWe){const o=n[i];o!=null&&o!==0&&!r.has(i)&&(n[i]=Math.max(1,Math.round(o*t)))}for(const i of YWe){const o=n[i];o!=null&&(n[i]=Math.max(.02,o*t))}return n}function JWe(e,t){const n={...e};for(const r of KWe){const a=n[r];a!=null&&(n[r]=a*t)}return n.rSizeMul=(n.rSizeMul??1)*t,n}const QWe={globe:{latRings:17,lonDensity:44,rBase:.6,rDepth:1.7,rBoost:1,inkFar:.62,inkSpan:.54,rsPow:.6,rMin:.3},orbits:{orbitN:12,ghostN:40,ghostR:.9,ghostA:.5,particles:3,partR:1.2,partRDepth:1.6,rsPow:.6,rMin:.3},rubik:{latRings:15,lonDensity:40,moveCount:14,rBase:.6,rDepth:1.7,rActive:.3,inkFar:.62,inkSpan:.54,rsPow:.6,rMin:.3},wave:{rings:15,lonDensity:40,rBase:.6,rDepth:1.7,rsPow:.6,rMin:.3},web:{nodeN:30,thr:.72,signals:5,nodeR:1.4,nodeRDepth:1.8,lineW:.8,rsPow:.6,rMin:.3},braid:{strandN:52,turns:3,ghostN:150,rBase:1.2,rDepth:1.8,rsPow:.6,rMin:.3},ribbon:{lanes:5,segs:88,ghostN:150,rBase:1.1,rDepth:1.7,rsPow:.6,rMin:.3},ring:{lanes:5,segs:88,ghostN:0,faceOn:1,rBase:1.1,rDepth:1.7,rsPow:.6,rMin:.3},morph:{rDot:.021,iconD:1,rMin:.25}},ZWe={working:"orbits",searching:"globe",solving:"rubik",listening:"wave",connecting:"web",weaving:"braid",composing:"ribbon",breathing:"ring",shaping:"morph"},eVe={orbits:{64:{speed:1.885,count:1,size:1},20:{speed:3.9,count:.238,size:2.4}},globe:{64:{speed:2.015,count:.42,size:1.15,extra:{scanMul:4.08,dimBase:.45}},20:{speed:2.665,count:.105,size:1.75,extra:{scanMul:4.335,dimBase:.45}}},rubik:{64:{speed:1.82,count:.35,size:1.05},20:{speed:1.95,count:.088,size:1.9}},wave:{64:{speed:4.388,count:.341,size:1},20:{speed:3.998,count:.105,size:1.6}},web:{64:{speed:3.315,count:1.35,size:.95},20:{speed:6.63,count:.25,size:1.52}},braid:{64:{speed:1.625,count:.5,size:1},20:{speed:2.75,count:.1125,size:1.36}},ribbon:{64:{speed:2.34,count:.25,size:.85,extra:{spin:0,bandMul:3.9,wobMul:1}},20:{speed:3.12,count:.051,size:1.073,extra:{spin:0,bandMul:4.94,wobMul:1}}},ring:{64:{speed:3.24,count:.25,size:.956,extra:{spin:0,bandMul:3.627,wobMul:.368}},20:{speed:3.78,count:.028,size:1.622,extra:{spin:0,bandMul:3.968,wobMul:.565}}},morph:{64:{speed:2.405,count:.702,size:.395,extra:{spread:1.45}},20:{speed:2.08,count:.53,size:1.011,extra:{spread:1.45}}}}
426,h7=new Map;function tVe(e,t){const n=`${e}-${t}`,r=h7.get(n);if(r)return r;const a=ZWe[e],i=eVe[a][t];let o={...QWe[a]};i.count!==1&&(o=XWe(o,i.count)),i.size!==1&&(o=JWe(o,i.size)),i.extra&&(o={...o,...i.extra});const l={mode:a,speed:i.speed,opts:o};return h7.set(n,l),l}function sVe(e){let t=e;for(;t;){const n=t.getAttribute("data-theme");if(n==="dark")return!0;if(n==="light")return!1;if(t.classList.contains("dark"))return!0;if(t.classList.contains("light"))return!1;t=t.parentElement}return null}function nVe(){return typeof matchMedia>"u"||matchMedia("(prefers-color-scheme: dark)").matches}function rVe(e,t){const[n,r]=f.useState(!0);return f.useEffect(()=>{if(e==="dark"){r(!0);return}if(e==="light"){r(!1);return}const a=()=>{const c=sVe(t.current);r(c??nVe())};a();const i=typeof matchMedia<"u"?matchMedia("(prefers-color-scheme: dark)"):null,o=()=>a();i?.addEventListener("change",o);let l=null;return typeof MutationObserver<"u"&&t.current&&(l=new MutationObserver(a),l.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"],subtree:!0})),()=>{i?.removeEventListener("change",o),l?.disconnect()}},[e,t]),n}function aVe(){const[e,t]=f.useState(!1);return f.useEffect(()=>{if(typeof matchMedia>"u")return;const n=matchMedia("(prefers-reduced-motion: reduce)");t(n.matches);const r=a=>t(a.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const iVe={working:"Workingâ¦",searching:"Searchingâ¦",solving:"Solvingâ¦",listening:"Listeningâ¦",connecting:"Connectingâ¦",weaving:"Weavingâ¦",composing:"Composingâ¦",breathing:"Thinkingâ¦",shaping:"Shapingâ¦"};function oVe({state:e="working",size:t=64,theme:n="auto",speed:r=1,paused:a=!1,style:i,"aria-label":o,...l}){const c=f.useRef(null),u=rVe(n,c),d=aVe();return f.useEffect(()=>{const h=c.current;if(!h)return;const p=Math.min(2,typeof devicePixelRatio<"u"&&devicePixelRatio||1);h.width=Math.round(t*p),h.height=Math.round(t*p);const m=h.getContext("2d");if(!m)return;const{mode:g,speed:x,opts:b}=tVe(e,t),y=WWe[g],v=x*r,w=T=>{m.setTransform(p,0,0,p,0,0),m.clearRect(0,0,t,t),y(m,t,T,u,b)};if(d){w(.6);return}let j=0,E=!1;const S=()=>{w(performance.now()/1e3*v),E&&(j=requestAnimationFrame(S))},_=()=>{E||a||(E=!0,j=requestAnimationFrame(S))},k=()=>{E=!1,cancelAnimationFrame(j)};w(performance.now()/1e3*v);let C=!0;const N=typeof IntersectionObserver<"u"?new IntersectionObserver(([T])=>{C=T.isIntersecting,C&&document.visibilityState!=="hidden"?_():k()}):null;N?.observe(h);const A=()=>{document.visibilityState==="hidden"?k():C&&_()};return document.addEventListener("visibilitychange",A),N||_(),()=>{k(),N?.disconnect(),document.removeEventListener("visibilitychange",A)}},[e,t,u,r,a,d]),s.jsx("canvas",{ref:c,role:"img","aria-label":o??iVe[e],style:{width:t,height:t,display:"block",...i},...l})}const p7=[20,64];function lVe(e){return p7.reduce((t,n)=>Math.abs(n-e)<Math.abs(t-e)?n:t,p7[0])}function Pk({size:e=64,label:t="Thinkingâ¦",className:n=""}){const r=lVe(e);return s.jsxs("span",{className:`inline-flex items-center gap-3 ${n}`,role:"status","aria-live":"polite",children:[s.jsx(oVe,{state:"working",size:r,theme:"light","aria-label":"Thinking"}),s.jsx("span",{className:"font-mono text-[11px] font-medium uppercase tracking-eyebrow text-ink-mid",children:t})]})}const H3=f.memo(function({message:t,accentStyle:n,expertId:r,creatorName:a=""}){if(t.role==="user")return s.jsx("div",{"data-message-id":t.id,className:`flex min-w-0 justify-end${t._pending?" opacity-60":""}`,children:s.jsx("div",{className:"min-w-0 max-w-[86%] rounded-2xl rounded-br-sm bg-indigo px-3.5 py-2.5 text-sm leading-relaxed text-cream",style:n,children:s.jsx("p",{className:"whitespace-pre-wrap break-words",children:t.content})})});if(t.role==="creator")return s.jsx("div",{className:"flex min-w-0 justify-start",children:s.jsxs("div",{className:"w-full min-w-0",children:[s.jsx(zse,{name:a}),s.jsx("div",{className:"w-fit min-w-0 max-w-[86%] rounded-2xl rounded-bl-sm border border-rule bg-paper px-3.5 py-2.5 text-sm leading-relaxed text-ink",children:s.jsx("p",{className:"whitespace-pre-wrap break-words",children:t.content})})]})});const i=t._isStreaming&&!t.content;return s.jsx("div",{className:"flex min-w-0 justify-start",children:s.jsxs("div",{className:"w-full min-w-0",children:[s.jsx("div",{className:i?"min-w-0":`w-fit min-w-0 max-w-[86%] rounded-2xl rounded-bl-sm border px-3.5 py-2.5 text-sm leading-relaxed ${t._isError?"border-red-200 bg-white text-red-700":"border-rule bg-paper text-ink"}`,children:i?s.jsx(Pk,{size:20}):s.jsx(Qf,{content:t.content,isStreaming:!!t._isStreaming})}),s.jsx(Wb,{blocks:t.blocks,expertId:r,messageId:t.id,surface:"embed"})]})})},(e,t)=>e.message===t.message&&e.expertId===t.expertId&&e.creatorName===t.creatorName&&e.accentStyle?.backgroundColor===t.accentStyle?.backgroundColor);
426function Zse({value:e,onChange:t,onSend:n,onStop:r,disabled:a,isStreaming:i,accentStyle:o,inputRef:l,onStartCall:c,placeholder:u="Ask a questionâ¦"}){const d=m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),n())},h=!!e.trim(),p=!h&&!!c&&!a&&!i;return s.jsx("div",{className:"shrink-0 bg-cream px-3 pb-2 pt-3",children:s.jsxs("div",{className:"flex items-end gap-2 rounded-full border border-rule bg-paper p-2 shadow-sm focus-within:border-indigo focus-within:shadow-focus",children:[s.jsx("textarea",{ref:l,value:e,onChange:m=>t(m.target.value.slice(0,2e3)),onKeyDown:d,rows:1,disabled:a,placeholder:u,"aria-label":"Message",maxLength:2e3,className:"min-h-10 max-h-28 flex-1 resize-none bg-transparent px-2 py-2 text-base leading-6 text-ink outline-none placeholder:font-display placeholder:italic placeholder:text-ink-muted disabled:cursor-not-allowed disabled:opacity-60"}),i&&r?s.jsx("button",{type:"button",onClick:r,className:"grid h-10 w-10 shrink-0 place-items-center rounded-full bg-indigo text-cream transition-colors hover:bg-indigo-deep","aria-label":"Stop generating",children:s.jsx(ku,{className:"h-3.5 w-3.5",fill:"currentColor",strokeWidth:0})}):p?s.jsxs("button",{type:"button",onClick:c,className:"inline-flex h-10 shrink-0 items-center gap-2 rounded-full bg-sage px-4 text-sm font-semibold text-cream transition-colors hover:bg-sage-deep active:scale-[0.98]","aria-label":"Start a voice call with this AI expert",title:"Talk to this AI expert",children:[s.jsx(Ts,{size:17,strokeWidth:1.85,"aria-hidden":"true"}),s.jsx("span",{children:"Call"})]}):s.jsx("button",{type:"button",onClick:n,disabled:!h||a,className:"grid h-10 w-10 shrink-0 place-items-center rounded-full bg-indigo text-cream transition-colors hover:bg-indigo-deep disabled:cursor-not-allowed disabled:bg-cream-deep disabled:text-ink-light",style:h&&!a?o:void 0,"aria-label":"Send message",children:s.jsx(rl,{size:18,"aria-hidden":"true"})})]})})}function Lk({onLogin:e}){return s.jsxs("footer",{className:"shrink-0 bg-cream px-3 pb-2 text-center text-[10px] leading-4 text-ink-muted",children:[s.jsxs("p",{children:["AI Chat. Messages and AI replies may be reviewed by this expertâs owner for audience insights. Donât share sensitive personal information."," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-ink",children:"Privacy"})," · ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-ink",children:"Terms"})]}),e?s.jsxs("p",{className:"mt-0.5",children:["Have an account?"," ",s.jsx("button",{type:"button",onClick:e,className:"rounded-sm font-medium text-indigo underline underline-offset-2 transition-colors hover:text-indigo-deep focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo/40",children:"Log in"})]}):null]})}function ene({className:e="block truncate text-xs leading-tight text-ink-muted"}){return s.jsxs("span",{className:e,children:["Powered by"," ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",className:"underline decoration-ink-light underline-offset-2 hover:text-ink",children:"Great Experts"})]})}function tne({name:e,avatarUrl:t,accent:n,showBadge:r=!0,fallbackInitial:a}){const i=a!==void 0&&!t;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("div",{className:"grid h-[52px] w-[52px] place-items-center overflow-hidden rounded-full bg-indigo-wash ring-1 ring-rule",style:i?{backgroundColor:n||"#3d3df5"}:n?{backgroundColor:`${n}22`}:void 0,children:i?s.jsx("span",{className:"text-[22px] font-semibold leading-none text-white","aria-hidden":"true",children:a}):t?s.jsx("img",{src:t,alt:e||"Expert",className:"h-full w-full object-cover",onError:o=>{o.currentTarget.style.display="none"}}):s.jsx(Ms,{size:22,className:"text-indigo","aria-hidden":"true"})}),s.jsx("span",{className:"absolute bottom-0 right-0 h-3 w-3 rounded-full bg-sage ring-2 ring-cream",role:"img","aria-label":"Online",title:"Online"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-[17px] font-semibold leading-tight tracking-[-0.01em] text-ink",children:e}),s.jsx("p",{className:"mt-1 text-[clamp(10px,3.1vw,12px)] leading-none text-ink-muted",children:r&&s.jsx(ene,{className:"whitespace-nowrap"})})]})]})}function sne({starters:e,onAsk:t,disabled:n,accent:r}){return s.jsx("div",{className:"flex flex-col items-end gap-2 pt-1",children:e.map(a=>s.jsx("button",{type:"button",onClick:()=>t(a),disabled:n,className:"max-w-[86%] rounded-2xl border border-indigo/30 bg-indigo-wash px-3.5 py-2.5 text-left text-sm font-medium leading-relaxed text-indigo transition-colors duration-base ease-out hover:border-indigo/50 hover:bg-indigo/10 disabled:opacity-55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo/40",style:r?{borderColor:`${r}66`,backgroundColor:`${r}22`,color:r}:void 0,children:a},a))})}const cVe=["What do you offer?","How can I contact you?"],uVe="No answer came back yet. Try again in a moment.",dVe=/^\[(DONE|THINKING|ANSWER_START|THINKING_START|THINKING_DONE|THINKING_TOKEN|STATUS)/;function hVe({expertId:e=null,previewMode:t=!1,name:n="",greeting:r="",avatarSrc:a="",accent:i=""}){const[o,l]=f.useState([]),[c,u]=f.useState(""),[d,h]=f.useState(!1),[p,m]=f.useState(cVe),g=f.useRef(null),x=f.useRef(null),b=f.useRef(null),y=f.useRef(!0);f.useEffect(()=>(y.current=!0,()=>{y.current=!1,x.current?.abort(),clearTimeout(b.current)}),[]),f.useEffect(()=>{const k=g.current;k&&(k.scrollTop=k.scrollHeight)},[o]),f.useEffect(()=>{if(t||!e)return;let k=!1;return kh(e).then(C=>{const N=C?.data?.starters;!k&&Array.isArray(N)&&N.length&&m(N.slice(0,3))}).catch(()=>{}),()=>{k=!0}},[e,t]);const v=k=>{y.current&&l(C=>{if(!C.length)return C;const N=[...C],A=N[N.length-1];return N[N.length-1]=typeof k=="function"?k(A):{...A,...k},N})},w=()=>{x.current=null,y.current&&h(!1)},j=async k=>{const C=String(k||"").trim();if(!C||d)return;u(""),h(!0);const N={role:"user",content:C},A=[...o,N].slice(-20).map(({role:I,content:$})=>({role:I,content:$}));if(l(I=>[...I,N,{role:"assistant",content:"",streaming:!0}]),t){b.current=setTimeout(()=>{v({streaming:!1,content:`Great question. Once you sign up, I answer â${C}â from your website and the knowledge you added, in your voice.`}),w()},700);return}if(!e){v({streaming:!1,content:"Your chat is still getting ready. Try again in a moment."}),w();return}const T=new AbortController;x.current=T;try{const $=(await D_e(e,C,A,[],T.signal)).getReader(),O=new TextDecoder;let U="";for(;;){const{done:F,value:H}=await $.read();U+=O.decode(H,{stream:!F});const G=U.split(` 427`);U=F?"":G.pop();for(const M of G){if(!M.startsWith("data: "))continue;const z=M.slice(6);if(dVe.test(z))continue;
427const W=z.replace(/\\n/g,` 428`);v(D=>({...D,content:D.content+W}))}if(F||!y.current)break}v(F=>({...F,streaming:!1,content:F.content||uVe}))}catch(I){if(I?.name==="AbortError")return;v($=>({...$,streaming:!1,content:$.content||"Could not get a response. Please try again."}))}finally{w()}},E=o.some(k=>k.role==="user"),S=i?{backgroundColor:i}:void 0,_=[{id:"greeting",role:"assistant",content:r.trim()||v0},...o.map((k,C)=>({id:C,role:k.role,content:k.content,_isStreaming:!!k.streaming}))];return s.jsxs("div",{className:"ce-bl-widget flex h-full min-h-0 flex-col overflow-hidden bg-cream text-ink",children:[s.jsx("header",{className:"flex shrink-0 items-center gap-3 border-b border-rule px-4 py-3",children:s.jsx(tne,{name:n.trim()||"Your business",avatarUrl:a,accent:i,fallbackInitial:n.trim().charAt(0).toUpperCase()})}),s.jsxs("div",{ref:g,className:"min-h-0 flex-1 space-y-3 overflow-y-auto overflow-x-hidden bg-cream px-4 py-4","aria-live":"polite",children:[_.map(k=>s.jsx(H3,{message:k,accentStyle:S,expertId:e},k.id)),E?null:s.jsx(sne,{starters:p,onAsk:j,disabled:d,accent:i})]}),s.jsx(Zse,{value:c,onChange:u,onSend:()=>j(c),disabled:d,isStreaming:!1,accentStyle:S}),s.jsx(Lk,{})]})}const m7=[{value:"#4f46e5",label:"Indigo"},{value:"#0d0d0d",label:"Black"},{value:"#2563eb",label:"Blue"},{value:"#0f9d58",label:"Green"},{value:"#ea580c",label:"Orange"},{value:"#db2777",label:"Pink"}],WE="#d9d7d0",pVe="#2b2b2b",mVe={photo:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"20",cy:"16",r:"11",fill:"var(--bb-accent)"}),s.jsx("circle",{cx:"20",cy:"13",r:"4",fill:"#fff"}),s.jsx("path",{d:"M12.5 24.5c1.2-4 4-5.5 7.5-5.5s6.3 1.5 7.5 5.5",fill:"#fff"})]}),call:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"23",cy:"19",r:"9.5",fill:"var(--bb-accent)"}),s.jsx("path",{d:"M19.5 16.2h7a1.6 1.6 0 0 1 1.6 1.6v3a1.6 1.6 0 0 1-1.6 1.6h-4l-2.2 1.9v-1.9h-.8a1.6 1.6 0 0 1-1.6-1.6v-3a1.6 1.6 0 0 1 1.6-1.6z",fill:"#fff"}),s.jsx("circle",{cx:"12",cy:"9",r:"5.5",fill:"#407f57",stroke:"#fff",strokeWidth:"1.6"}),s.jsx("path",{d:"M10.1 7.6c.3 1.2 1.2 2.4 2.4 3l.7-.7c.2-.2.4-.2.6-.1l.8.4c.2.1.3.3.2.5-.2.7-.8 1.1-1.5 1-2-.3-3.7-2-4-4-.1-.7.3-1.3 1-1.5.2 0 .4 0 .5.2l.4.8c.1.2.1.4-.1.6z",fill:"#fff"})]}),attention:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"3",width:"26",height:"12",rx:"4",fill:"#fff",stroke:WE}),s.jsx("path",{d:"M24 15l3 4 1-4z",fill:"#fff",stroke:WE,strokeLinejoin:"round"}),s.jsx("rect",{x:"7",y:"7",width:"14",height:"2.4",rx:"1.2",fill:pVe}),s.jsx("rect",{x:"7",y:"11",width:"9",height:"2",rx:"1",fill:WE}),s.jsx("circle",{cx:"31",cy:"24",r:"6.5",fill:"var(--bb-accent)"})]})};function VE({kind:e}){return s.jsx("svg",{className:"ce-bc-art",viewBox:"0 0 40 32","aria-hidden":"true",children:mVe[e]})}function I1({id:e,checked:t,onChange:n,label:r,disabled:a=!1}){return s.jsx("button",{id:e,type:"button",role:"switch","aria-checked":t,"aria-label":r,disabled:a,className:"ce-bc-switch",onClick:()=>n(!t),children:s.jsx("span",{})})}function nne({mode:e,website:t="",widget:n,onUpdate:r,expertId:a=null,previewMode:i=!1,avatarSrc:o="",addToast:l,onAvatar:c,leadingRows:u=null,trailingRows:d=null}){const h=f.useRef(null),[p,m]=f.useState(""),g=!m7.some(y=>y.value===n.color);f.useEffect(()=>()=>{p&&URL.revokeObjectURL(p)},[p]);const x=async y=>{const v=y.target.files?.[0];if(y.target.value="",!!v){if(!["image/png","image/jpeg","image/webp"].includes(v.type)||v.size>Ph){l?.(`Use a PNG, JPEG or WebP image under ${Lh}.`,"error");return}try{m(URL.createObjectURL(await A0(v)))}catch{l?.("We could not prepare that image. Try another one.","error")}}},b=y=>{m(""),c?.(y,URL.createObjectURL(y))};return s.jsxs("div",{className:"ce-bc-layout",children:[s.jsx("div",{className:"ce-bc-preview",children:s.jsx(l4e,{embedMode:e,website:t,color:n.color,name:n.name,greeting:n.greeting,showAvatar:!!o&&n.showAvatar,showCallBadge:n.showCallBadge,showTeaser:e==="bubble"&&n.showTeaser,teaserText:n.teaserText,avatarSrc:o,liveChat:s.jsx(hVe,{expertId:a,previewMode:i,name:n.name,greeting:n.greeting,avatarSrc:o,accent:n.color})})}),s.jsxs("form",{className:"ce-bc-panel",style:{"--bb-accent":n.color},onSubmit:y=>y.preventDefault(),children:[u,s.jsxs("div",{className:"ce-bc-row is-field",children:[s.jsx("label",{className:"ce-bc-label",htmlFor:"ce-bc-name",children:"Name"}),s.jsxs("div",{className:"ce-bc-identity",children:[s.jsxs("button",{type:"button",className:"ce-bc-avatar","aria-label":o?"Change avatar":"Add avatar",title:o?"Change avatar":"Add avatar",style:{"--bb-accent":n.color},onClick:()=>h.current?.click(),children:[s.jsx(EQ,{name:n.name,src:o}),s.jsx("span",{"aria-hidden":"true",children:s.jsx(Nh,{size:11,strokeWidth:2.4})})]}),s.jsx("input",{ref:h,type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",tabIndex:-1,onChange:x}),s.jsx("input",{id:"ce-bc-name",className:"ce-bc-input",value:n.name,maxLength:60,placeholder:"Your business",autoComplete:"organization",onChange:y=>r({name:y.target.value})})]})]}),s.jsxs("div",{className:"ce-bc-row is-field",children:[s.jsx("label",{className:"ce-bc-label",htmlFor:"ce-bc-greeting",children:"Greeting"}),s.jsx("input",{id:"ce-bc-greeting",className:"ce-bc-input",value:n.greeting,maxLength:160,placeholder:v0,autoComplete:"off",onChange:y=>r({greeting:y.target.value})})]}),s.jsxs("div",{className:"ce-bc-row",children:[s.jsx("span",{className:"ce-bc-label",id:"ce-bc-color-label",children:"Color"}),s.jsxs("div",{className:"ce-bc-swatches",role:"radiogroup","aria-labelledby":"
428ce-bc-color-label",children:[m7.map(y=>{const v=n.color===y.value;return s.jsx("button",{type:"button",role:"radio","aria-checked":v,"aria-label":y.label,className:`ce-bc-swatch${v?" is-on":""}`,style:{"--swatch":y.value},onClick:()=>r({color:y.value}),children:v?s.jsx(ft,{size:13,strokeWidth:3,"aria-hidden":"true"}):null},y.value)}),s.jsxs("label",{className:`ce-bc-swatch is-custom${g?" is-on":""}`,style:g?{"--swatch":n.color}:void 0,title:"Custom color",children:[s.jsx("input",{type:"color",value:n.color,"aria-label":"Custom color",onChange:y=>r({color:y.target.value.toLowerCase()})}),g?s.jsx(ft,{size:13,strokeWidth:3,"aria-hidden":"true"}):s.jsx(Es,{size:14,strokeWidth:2.4,"aria-hidden":"true"})]})]})]}),e==="bubble"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ce-bc-row",children:[s.jsx("label",{className:"ce-bc-label",htmlFor:"ce-bc-photo",children:"Photo on bubble"}),s.jsxs("span",{className:"ce-bc-trail",children:[s.jsx(VE,{kind:"photo"}),s.jsx(I1,{id:"ce-bc-photo",checked:!!o&&n.showAvatar,label:"Show your photo on the bubble",disabled:!o,onChange:y=>r({showAvatar:y})})]})]}),s.jsxs("div",{className:"ce-bc-row",children:[s.jsx("label",{className:"ce-bc-label",htmlFor:"ce-bc-call",children:"Call badge"}),s.jsxs("span",{className:"ce-bc-trail",children:[s.jsx(VE,{kind:"call"}),s.jsx(I1,{id:"ce-bc-call",checked:n.showCallBadge,label:"Show the call badge on the bubble",onChange:y=>r({showCallBadge:y})})]})]}),s.jsxs("div",{className:"ce-bc-row",children:[s.jsx("label",{className:"ce-bc-label",htmlFor:"ce-bc-teaser",children:"Attention message"}),s.jsxs("span",{className:"ce-bc-trail",children:[s.jsx(VE,{kind:"attention"}),s.jsx(I1,{id:"ce-bc-teaser",checked:n.showTeaser,label:"Attention message",onChange:y=>r({showTeaser:y})})]})]}),n.showTeaser?s.jsx("input",{className:"ce-bc-input ce-bc-teaser-input",value:n.teaserText,maxLength:80,placeholder:B_,"aria-label":"Attention message text",autoComplete:"off",onChange:y=>r({teaserText:y.target.value})}):null]}):null,d]}),s.jsx(T0,{isOpen:!!p,imageSrc:p,onCancel:()=>m(""),onSave:b})]})}function rne(e){const t=window.location.origin,n=/^https?:\/\//.test(Hr)?` api-base="${Hr}"`:"";return[`<great-experts-chat widget-key="${e}"${n}></great-experts-chat>`,`<script async src="${t}/widget/widget.js"><\/script>`].join(` 429`)}const f7="https://assets.calendly.com/assets/external/widget.js",g7="https://assets.calendly.com/assets/external/widget.css",fVe=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;
429function gVe(){if(window.Calendly)return Promise.resolve(window.Calendly);if(!document.querySelector(`link[href="${g7}"]`)){const e=document.createElement("link");e.rel="stylesheet",e.href=g7,document.head.appendChild(e)}return new Promise((e,t)=>{const n=document.querySelector(`script[src="${f7}"]`),r=n||document.createElement("script");r.addEventListener("load",()=>e(window.Calendly),{once:!0}),r.addEventListener("error",t,{once:!0}),n||(r.src=f7,r.async=!0,document.body.appendChild(r))})}function xVe({to:e,domain:t,snippet:n,mode:r}){const a=r==="inline"?"where the chat should appear on the page":"just before the closing </body> tag on every page",i=`Add our chat to ${t}`,o=["Hi,","",`Could you add our chat assistant to ${t}? Paste this code ${a}:`,"",n,"","Thanks!"].join(` 430`);return`mailto:${encodeURIComponent(e)}?subject=${encodeURIComponent(i)}&body=${encodeURIComponent(o)}`}const bVe=/<(\/?)([\w-]+)([^>]*)>/g,yVe=/([\w-]+)(?:="([^"]*)")?/g;function vVe({slash:e,name:t,attrs:n}){return s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"tok-punct",children:["<",e]}),s.jsx("span",{className:"tok-tag",children:t}),n.map(([,r,a])=>s.jsxs("span",{children:[" ",s.jsx("span",{className:"tok-attr",children:r}),a!==void 0?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"tok-punct",children:"="}),s.jsxs("span",{className:"tok-string",children:['"',a,'"']})]}):null]},r)),s.jsx("span",{className:"tok-punct",children:">"})]})}function wVe({snippet:e}){const t=[];let n=0;for(const r of e.matchAll(bVe)){const[a,i,o,l]=r;r.index>n&&t.push(e.slice(n,r.index)),t.push(s.jsx(vVe,{slash:i,name:o,attrs:[...l.matchAll(yVe)]},r.index)),n=r.index+a.length}return n<e.length&&t.push(e.slice(n)),t}function ane({embed:e=null,mode:t="bubble",domain:n=""}){const r=!!e?.keyId,a=rne(r?e.keyId:"your-widget-key"),[i,o]=f.useState(!1),[l,c]=f.useState(""),[u,d]=f.useState(!1),h=f.useRef(null),p=fVe.test(l.trim());f.useEffect(()=>()=>clearTimeout(h.current),[]);const m=async()=>{try{await navigator.clipboard.writeText(a),o(!0),clearTimeout(h.current),h.current=setTimeout(()=>o(!1),1800)}catch{o(!1)}},g=async()=>{d(!0);try{(await gVe()).initPopupWidget({url:`${Qm}?hide_gdpr_banner=1`})}catch{window.open(Qm,"_blank","noopener,noreferrer")}finally{d(!1)}};return s.jsxs("div",{className:"ce-bg-panel",children:[s.jsxs("div",{className:"ce-bg-section",children:[s.jsxs("div",{className:"ce-bg-section-head",children:[s.jsx("h2",{children:"Your code"}),s.jsx("span",{children:t==="inline"?"Paste where the chat goes":"Paste before </body>"})]}),e?.error&&!r?s.jsx("p",{className:"ce-bg-error",role:"alert",children:e.error}):s.jsxs("div",{className:"ce-bg-code",children:[s.jsx("pre",{children:s.jsx("code",{children:s.jsx(wVe,{snippet:a})})}),s.jsxs("button",{type:"button",onClick:m,"aria-label":i?"Copied":"Copy code",children:[i?s.jsx(ft,{size:13,strokeWidth:2.6,"aria-hidden":"true"}):s.jsx(ju,{size:13,strokeWidth:2.2,"aria-hidden":"true"}),s.jsx("span",{children:i?"Copied":"Copy"})]})]}),r&&!e.serving?s.jsxs("p",{className:"ce-bg-note",children:["Goes live on ",n," once your plan starts."]}):null]}),s.jsxs("form",{className:"ce-bg-section",onSubmit:x=>{x.preventDefault(),p&&(window.location.href=xVe({to:l.trim(),domain:n,snippet:a,mode:t}))},children:[s.jsx("label",{className:"ce-bg-section-head",htmlFor:"ce-bg-dev-email",children:s.jsx("h2",{children:"Email your developer"})}),s.jsxs("div",{className:"ce-bg-email",children:[s.jsx("input",{id:"ce-bg-dev-email",type:"email",value:l,placeholder:"[email protected]",autoComplete:"email",onChange:x=>c(x.target.value)}),s.jsxs("button",{type:"submit",disabled:!p,children:[s.jsx($u,{size:14,strokeWidth:2.2,"aria-hidden":"true"}),"Send"]})]})]}),s.jsxs("div",{className:"ce-bg-section ce-bg-help",children:[s.jsxs("div",{children:[s.jsx("h2",{children:"Still stuck?"}),s.jsx("span",{children:"We will set it up with you."})]}),s.jsxs("button",{type:"button",onClick:g,disabled:u,children:[s.jsx(Ex,{size:15,strokeWidth:2.2,"aria-hidden":"true"}),"Book a call"]})]})]})}function Lo({onBack:e,onContinue:t,onSkip:n,continueDisabled:r=!1,continueLabel:a="Continue",skipLabel:i="Skip"}){return s.jsxs("div",{className:"ce-split-nav",role:"group","aria-label":"Step navigation",children:[s.jsx("button",{type:"button",className:"ce-split-nav-back",onClick:e,"aria-label":"Back to previous step",title:"Back",children:s.jsx(ja,{size:20,strokeWidth:2.2,"aria-hidden":"true"})}),s.jsx("button",{type:"button",className:"ce-split-nav-continue",onClick:t,disabled:r,children:a}),n?s.jsx("button",{type:"button",className:"ce-split-nav-skip",onClick:n,children:i}):null]})}const ine="/business/install-guide.mp4",jVe=["#3d3df5","#ffb961","#f77ea5","#56bfad","#6b57e9"];function one({src:e=ine,autoPlay:t=!1}){const n=f.useRef(null),[r,a]=f.useState(!1),[i,o]=f.useState(t),[l,c]=f.useState(0),u=()=>{const h=n.current;h&&(h.paused?h.play().catch(()=>{}):h.pause())},d=h=>{const p=n.current;
430if(!p?.duration)return;const{left:m,width:g}=h.currentTarget.getBoundingClientRect();p.currentTime=Math.min(Math.max((h.clientX-m)/g,0),1)*p.duration};return s.jsxs("div",{className:`ce-bg-video${r?" is-playing":""}`,children:[s.jsx("video",{ref:n,src:e,autoPlay:t,muted:i,playsInline:!0,preload:"metadata","aria-label":"How to add the chat to your website",onClick:u,onPlay:()=>a(!0),onPause:()=>a(!1),onEnded:()=>a(!1),onTimeUpdate:h=>{const{currentTime:p,duration:m}=h.currentTarget;c(m?p/m:0)}}),r?null:s.jsx("button",{type:"button",className:"ce-bg-video-play",onClick:u,"aria-label":"Play video",children:s.jsx(Tr,{size:20,strokeWidth:2.4,fill:"currentColor","aria-hidden":"true"})}),s.jsxs("div",{className:"ce-bg-video-bar",children:[s.jsx("button",{type:"button",onClick:u,"aria-label":r?"Pause video":"Play video",children:r?s.jsx(Lf,{size:14,strokeWidth:2.4,fill:"currentColor","aria-hidden":"true"}):s.jsx(Tr,{size:14,strokeWidth:2.4,fill:"currentColor","aria-hidden":"true"})}),s.jsx("span",{className:"ce-bg-video-track",onClick:d,"aria-hidden":"true",children:s.jsx("span",{style:{transform:`scaleX(${l})`}})}),s.jsx("button",{type:"button",onClick:()=>o(h=>!h),"aria-label":i?"Unmute video":"Mute video","aria-pressed":!i,children:i?s.jsx(U4,{size:15,strokeWidth:2.2,"aria-hidden":"true"}):s.jsx(uu,{size:15,strokeWidth:2.2,"aria-hidden":"true"})})]})]})}function _Ve(e){const t=zu();f.useEffect(()=>{if(t||!e.current)return;let n=!1,r=0,a=null;return re(async()=>{const{default:i}=await import("./confetti.module-5PKC4vm3.js");return{default:i}},[]).then(({default:i})=>{if(n||!e.current)return;a=i.create(e.current,{resize:!0,useWorker:!0,disableForReducedMotion:!0});const o=performance.now()+2400,l=(u,d,h)=>a({particleCount:2,angle:u,spread:58,startVelocity:42,decay:.93,gravity:.9,drift:h,ticks:280,scalar:.95,colors:jVe,shapes:["square","circle"],origin:{x:d,y:.76}}),c=u=>{l(62,.02,.08),l(118,.98,-.08),u<o&&(r=requestAnimationFrame(c))};r=requestAnimationFrame(c)}),()=>{n=!0,cancelAnimationFrame(r),a?.reset()}},[e,t])}function lne({embedMode:e="",website:t="",embed:n=null,videoSrc:r=ine,onBack:a,onContinue:i}){const o=mc(e)||"bubble",l=n?.domain||Q4(t),c=f.useRef(null);return _Ve(c),s.jsxs("section",{className:"ce-pre-journey ce-onboarding-screen ce-business-chat-screen ce-business-congrats-screen",children:[typeof document<"u"?Mn.createPortal(s.jsx("canvas",{ref:c,className:"ce-bg-confetti","aria-hidden":"true"}),document.body):null,s.jsx("div",{className:"ce-onboarding-header ce-business-chat-header",children:s.jsx("div",{className:"ce-business-chat-head",children:s.jsxs("h1",{children:["Add it to your ",s.jsx("em",{className:"ge-em",children:"website"})]})})}),s.jsx("div",{className:"ce-onboarding-content ce-bg-body",children:s.jsxs("div",{className:"ce-bg-layout",children:[s.jsx(one,{src:r,autoPlay:!0}),s.jsx(ane,{embed:n,mode:o,domain:l})]})}),s.jsx("div",{className:"ce-onboarding-footer ce-business-chat-footer",children:s.jsx(Lo,{onBack:a,onContinue:i,continueLabel:"Go to dashboard"})})]})}function ui(e,t="Something went wrong. Please try again."){const n=e?.response?.data?.detail,r=a=>{if(typeof a=="string"&&a.trim())return a.trim();if(a&&typeof a=="object"){const i=a.message||a.msg;if(typeof i=="string"&&i.trim())return i.trim()}return""};if(typeof n=="string"&&n.trim())return n.trim();if(Array.isArray(n)){const a=r(n[0]);if(a)return a}else{const a=r(n);if(a)return a}return typeof e?.message=="string"&&e.message.trim()?e.message.trim():t}const kVe=new RegExp("^(?=.{4,253}$)(?!-)[a-z0-9-]{1,63}(?<!-)(\\.(?!-)[a-z0-9-]{1,63}(?<!-))+$");function Vb(e){let t=String(e??"").trim().toLowerCase();return t=t.replace(/^[a-z][a-z0-9+.-]*:\/\//,""),t=t.split("/")[0].split("?")[0].split("#")[0],t=t.split("@").pop(),t=t.split(":")[0],t=t.replace(/^www\./,""),t.replace(/^\.+|\.+$/g,"").trim()}function NVe(e){if(!String(e??"").trim())return"Enter the website this expert lives on, like acme.com.";const n=Vb(e);return n?kVe.test(n)?null:n.includes(".")?/[^a-z0-9.-]/.test(n)?"Websites can only contain letters, numbers and hyphens â like acme.com.":n.split(".").some(r=>r.startsWith("-")||r.endsWith("-"))?"A website can't start or end a part with a hyphen â like my-clinic.com.":"That doesn't look like a website. Enter just the domain, like acme.com.":`Add the ending too â for example â${n}.comâ or â${n}.aiâ.`:"That doesn't look like a website. Enter just the domain, like acme.com."}function Pj(e){return{domain:Vb(e),error:NVe(e)}}function EVe(e,t){const n=t?.config||{};return{mode:n.mode==="inline"?"inline":"bubble",domain:t?.domain||"",widget:Df({name:e?.name||"",greeting:e?.greeting||"",color:n.bubble_color||J4,showTeaser:n.show_teaser===!0,teaserText:n.teaser_text||"",showAvatar:n.show_avatar_on_bubble!==!1,showCallBadge:n.show_call_badge!==!1})}}function SVe(){const{addToast:e}=f.useContext(Zs),{updateExpert:t}
430=jc(),n=an(),{expertId:r,expert:a,embed:i,loading:o,failed:l,reload:c}=zJ(),[u,d]=f.useState(null),[h,p]=f.useState(null),[m,g]=f.useState({file:null,preview:""}),[x,b]=f.useState(!1),y=f.useRef(null);f.useEffect(()=>{if(!a)return;const N=EVe(a,i);d(N),p(N)},[a,i]),f.useEffect(()=>()=>{m.preview&&URL.revokeObjectURL(m.preview)},[m.preview]),f.useEffect(()=>{n.hash!=="#install"||!u||y.current?.scrollIntoView({block:"start"})},[n.hash,u]);const v=f.useMemo(()=>!!m.file||u&&h&&JSON.stringify(u)!==JSON.stringify(h),[m.file,h,u]),w=u?Pj(u.domain):{domain:"",error:null},j=u?.domain.trim()?w.error:null,E=HJ(i),S=m.preview||a?.avatar_url||"",_=N=>d(A=>({...A,widget:{...A.widget,...N}})),k=async()=>{if(!(!u||x||!r)){if(!u.domain.trim()||j){e(j||"Add the website your chat lives on.","error");return}b(!0);try{let N=a?.avatar_url||"";if(m.file){const I=await T4(r,m.file);N=I.data?.avatar_url||I.data?.expert?.avatar_url||N}const{widget:A}=u;await t(r,{name:A.name.trim()||a?.name,greeting:A.greeting.trim()||v0});const T={...i?.config||{},mode:u.mode,bubble_color:A.color,show_avatar_on_bubble:!!N&&A.showAvatar,show_teaser:A.showTeaser,teaser_text:A.teaserText.trim()||B_,show_call_badge:A.showCallBadge};w.domain!==i?.domain?await x0(r,w.domain,T):await JG(r,T),g({file:null,preview:""}),c(),e("Saved. Your website shows the new look right away.","success")}catch(N){const A=N?.response?.data?.detail;e(A?.message||ui(N,"We could not save your chat. Please try again."),"error")}finally{b(!1)}}},C=s.jsxs("header",{className:"ge-surface bd-page-head",children:[s.jsx(Le,{to:"/dashboard",className:"bd-back","aria-label":"Back to dashboard",children:s.jsx(ja,{size:18,"aria-hidden":"true"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h1",{className:"bd-title",children:"Customize my embed"}),s.jsxs("p",{className:`bd-status is-${E.tone}`,children:[s.jsx("span",{"aria-hidden":"true"}),E.label]})]}),u?s.jsxs("button",{type:"button",className:"bd-primary",onClick:k,disabled:!v||x,children:[x?s.jsx(vt,{size:16,className:"animate-spin","aria-hidden":"true"}):null,x?"Savingâ¦":v?"Save changes":"Saved"]}):null]});return u?s.jsxs("div",{className:"bd-page",children:[s.jsx(vs,{title:"Customize my embed | Great Experts",path:"/dashboard/embed",noIndex:!0}),C,s.jsx("section",{className:"ge-surface bd-chat-scope bd-editor","aria-label":"Chat appearance",children:s.jsx(nne,{mode:u.mode,website:w.domain||u.domain,widget:u.widget,onUpdate:_,expertId:r,avatarSrc:S,addToast:e,onAvatar:(N,A)=>g({file:N,preview:A}),leadingRows:s.jsxs("div",{className:"ce-bc-row",children:[s.jsx("span",{className:"ce-bc-label",id:"bd-style-label",children:"Style"}),s.jsx("div",{className:"bd-segment",role:"radiogroup","aria-labelledby":"bd-style-label",children:[["bubble","Bubble"],["inline","Inline"]].map(([N,A])=>s.jsx("button",{type:"button",role:"radio","aria-checked":u.mode===N,onClick:()=>d(T=>({...T,mode:N})),children:A},N))})]}),trailingRows:s.jsxs("div",{className:"ce-bc-row is-field",children:[s.jsx("label",{className:"ce-bc-label",htmlFor:"bd-domain",children:"Website"}),s.jsx("input",{id:"bd-domain",className:"ce-bc-input",value:u.domain,placeholder:"yourwebsite.com",autoComplete:"url","aria-invalid":!!j,"aria-describedby":j?"bd-domain-error":void 0,onChange:N=>d(A=>({...A,domain:N.target.value}))}),j?s.jsx("p",{id:"bd-domain-error",className:"bd-field-error",children:j}):null]})})}),s.jsxs("section",{ref:y,id:"install",className:"ge-surface bd-install","aria-labelledby":"bd-install-title",children:[s.jsx("h2",{id:"bd-install-title",className:"bd-section-title",children:"Add it to your website"}),s.jsxs("div",{className:"ce-bg-layout",children:[s.jsx(one,{}),s.jsx(ane,{embed:i?.key_id?{keyId:i.key_id,serving:!!i.serving}:null,mode:h?.mode||u.mode,domain:i?.domain||w.domain})]})]})]}):s.jsxs("div",{className:"bd-page",children:[s.jsx(vs,{title:"Customize my embed | Great Experts",path:"/dashboard/embed",noIndex:!0}),C,s.jsx("section",{className:"ge-surface bd-empty",children:l?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"We could not load your chat."}),s.jsx("button",{type:"button",className:"ge-surface-btn",onClick:c,children:"Try again"})]}):o?s.jsx(vt,{size:22,className:"animate-spin text-ink-light","aria-label":"Loading your chat"}):s.jsx("p",{children:"You do not have a chat yet."})})]})}const cne=f.createContext(null);function ai(){const e=f.useContext(cne);if(!e)throw new Error("useEditorConfirm must be used inside EditorConfirmProvider");return e}function CP({children:e}){const[t,n]=f.useState(null),r=f.useRef(null),a=f.useCallback(o=>{r.current?.(o),r.current=null,n(null)},[]),i=f.useCallback(o=>(r.current&&r.current(!1),n({title:o.title||"Remove this item?",description:o.description||"This will remove it from your public page.",confirmLabel:o.confirmLabel||"Remove"}),new Promise(l=>{r.current=l})),[]);return s.jsxs(cne.Provider,{value:i,children:[e,s.jsxs(en,{isOpen:!!t,onClose:()=>a(!1),title:t?.title||"",maxWidth:"max-w-sm",backdropZ:"z-[10020]",contentZ:"z-[10030]",children:[s.jsx("p",{className:"mb-6 text-sm leading-relaxed text-ink-mid",children:t?.description}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(yt,{variant:"secondary",onClick:()=>a(!1),children:"Cancel"}),s.jsx(yt,{variant:"danger",onClick:()=>a(!0),children:t?.confirmLabel||"Remove"})]})]})]})}function kn({id:e,label:t,optional:n,hint:r,icon:a,trailing:i,layout:o="stack",children:l}){const c=o==="row",u=s.jsxs("span",{className:"ppb-f-title",children:[a?s.jsx(a,{className:"ppb-f-ico",strokeWidth:2.1,"aria-hidden":"true"}):null,t,n&&s.jsx("span",{className:"opt",children:n})]});return s.jsxs("div",{className:`ppb-f${c?" is-row":""}`,children:[t||i?s.jsxs("div",{className:"ppb-f-head",children:[e?s.jsx("label",{htmlFor:e,children:u}):s.jsx("p",{className:"lab",children:u}),!c&&i]}
430):null,s.jsxs("div",{className:"ppb-f-body",children:[c&&i?s.jsx("div",{className:"ppb-f-trailing",children:i}):null,l,r&&s.jsx("p",{className:"hint",children:r})]})]})}function une(e,t=E0){let n=String(e??"").trim();const r=/^from\s+/i.test(n)?"From ":"";n=n.replace(/^from\s+/i,"");const a=Rh.find(({code:l})=>new RegExp(`\\b${l}\\b`,"i").test(n)),i=[...Rh].sort((l,c)=>c.symbol.length-l.symbol.length).find(({symbol:l})=>n.includes(l)),o=a||i;return o&&(n=n.replace(a?new RegExp(`\\b${a.code}\\b`,"i"):o.symbol,"").trim()),{amount:n,currency:o?.code||t,prefix:r}}function x7(e,t,n=""){const r=String(e??"").trim();return r?/^free$/i.test(r)?"Free":`${n}${t} ${r}`:""}function Zr(e){try{const t=new URL(String(e||"").trim());return["http:","https:"].includes(t.protocol)?t.toString():""}catch{return""}}function CVe(e){const t=Zr(e);if(!t)return"";const n=i=>{try{return decodeURIComponent(i)}catch{return i}},r=new URL(t).pathname.split("/").filter(Boolean).map(i=>n(i).replace(/\.[a-z0-9]{2,5}$/i,""));let a=r.at(-1)||"";for(;a&&(a.length<=2||!/[a-z]/i.test(a)||/^[a-z]{0,2}\d[a-z0-9]*$/i.test(a));)if(r.pop(),a=r.at(-1)||"",!/-/.test(a)&&r.length<=1)return"";return a.replace(/[-_+]+/g," ").trim().replace(/\s+/g," ").replace(/\b\w/g,i=>i.toUpperCase()).slice(0,120)}function TVe(e){const t=e?.action==="contact"?"":Zr(e?.link),n={id:e?.id||Kh("service"),name:String(e?.name||"").trim(),desc:String(e?.description||"").trim().slice(0,500),price:String(e?.price||"").trim(),url:t,img:Zr(e?.image),...e?.buttonLabel?{buttonLabel:String(e.buttonLabel).slice(0,60)}:{}};return n.action=t?"buy":"contact",n}function AVe(e){return{id:e?.id||Kh("item"),type:"product",kind:["course","ebook"].includes(e?.kind)?e.kind:"product",title:String(e?.name||"").trim(),meta:String(e?.description||"").trim().slice(0,300),img:Zr(e?.image),...e?.buttonLabel?{buttonLabel:String(e.buttonLabel).slice(0,60)}:{},price:String(e?.price||"").trim(),url:Zr(e?.link)}}function q3(e){return!e||e.kind==="none"?{services:[],items:[]}:{services:(Array.isArray(e.services)?e.services:[]).filter(t=>String(t?.name||"").trim()).map(TVe),items:(Array.isArray(e.products)?e.products:[]).filter(t=>String(t?.name||"").trim()).map(AVe)}}function P1(e){const t=Zr(e);if(!t)return"";const n=new URL(t);return n.hash="",n.pathname=n.pathname.replace(/^\/collections\/[^/]+(\/products\/)/,"$1").replace(/\/$/,"")||"/",[...n.searchParams.keys()].forEach(r=>{(/^utm_/i.test(r)||["fbclid","gclid","mc_cid","mc_eid","_ga"].includes(r.toLowerCase()))&&n.searchParams.delete(r)}),n.toString()}function b7(e,t){const n=P1(t?.url),r=String(t?.name||t?.title||"").trim().toLowerCase();return n?`${n}|${e==="service"?r:""}`:r?`${e}:${r}`:""}function RVe(e,t){const n={...e};return Object.entries(t).forEach(([r,a])=>{r!=="id"&&a!==""&&a!==null&&a!==void 0&&(n[r]=a)}),t.action==="contact"&&(n.url=""),n}function y7(e=[],t=[],n){const r=Array.isArray(e)?[...e]:[],a=Array.isArray(t)?[...t]:[],i=q3(n),o={service:r,item:a},l=(u,d)=>{for(const h of Object.keys(o)){const p=o[h].findIndex(m=>m.id===d.id);if(p>=0)return{kind:h,index:p}}for(const h of Object.keys(o)){const p=o[h].findIndex(m=>b7(h,m)===u||P1(m.url)&&P1(m.url)===P1(d.url)&&String(m.name||m.title).trim().toLowerCase()===String(d.name||d.title).trim().toLowerCase());if(p>=0)return{kind:h,index:p}}return null},c=(u,d)=>{const h=b7(u,d),p=h?l(h,d):null;if(!p){o[u].push(d);return}const m=o[p.kind][p.index];if(p.kind===u){o[u][p.index]=RVe(m,d);return}o[p.kind].splice(p.index,1),o[u].push({...d,id:m.id})};return i.services.forEach(u=>c("service",u)),i.items.forEach(u=>c("item",u)),{services:r,items:a}}const IVe=typeof Intl.DisplayNames=="function"?new Intl.DisplayNames(["en"],{type:"currency"}):null;function TP(e){try{const t=IVe?.of(e);return t&&t!==e?t:""}catch{return""}}function PVe(e){const t=String(e||"").trim().toLowerCase();return t?Rh.filter(({code:n,symbol:r})=>n.toLowerCase().includes(t)||r.toLowerCase().includes(t)||TP(n).toLowerCase().includes(t)):Rh}function dne({currency:e,onChange:t,label:n}){const[r,a]=f.useState(!1),[i,o]=f.useState(""),l=f.useRef(null),c=PVe(i);f.useEffect(()=>{if(!r)return;const d=h=>{l.current?.contains(h.target)||a(!1)};return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[r]);const u=d=>{t(d),a(!1),o("")};return s.jsxs("div",{ref:l,className:`ppb-price-currency${r?" is-open":""}`,title:`Change currency (${e})`,onKeyDown:d=>{d.key==="Escape"&&r&&(d.stopPropagation(),a(!1))},children:[s.jsxs("button",{type:"button",className:"ppb-price-currency-trigger","aria-label":n,"aria-haspopup":"listbox","aria-expanded":r,onClick:()=>a(d=>!d),children:[s.jsx("span",{"aria-hidden":"true",children:sQ(e)}),s.jsx(Is,{size:12,strokeWidth:2,"aria-hidden":"true"})]}),r&&s.jsxs("div",{className:"ppb-currency-pop",children:[s.jsxs("label",{className:"ppb-currency-search",children:[s.jsx(Fa,{"aria-hidden":"true"}
430),s.jsx("input",{type:"search",autoFocus:!0,value:i,placeholder:"Search currency","aria-label":"Search currency",onChange:d=>o(d.target.value),onKeyDown:d=>{d.key==="Enter"&&c[0]&&(d.preventDefault(),u(c[0].code))}})]}),s.jsxs("ul",{role:"listbox","aria-label":n,children:[c.length===0&&s.jsx("li",{className:"ppb-currency-none",children:"No currency matches"}),c.map(({code:d,symbol:h})=>s.jsx("li",{role:"option","aria-selected":d===e,children:s.jsxs("button",{type:"button",className:d===e?"is-current":void 0,onClick:()=>u(d),children:[s.jsx("b",{children:h}),s.jsx("span",{children:d}),s.jsx("small",{children:TP(d)})]})},d))]})]})]})}const hne=152,LVe=352,OVe=["track","episode","album","playlist","show","artist"],MVe=/^[A-Za-z0-9]{22}$/,DVe=/^\d{10,25}$/;function z0(e){try{const t=new URL(String(e||"").trim());return["http:","https:"].includes(t.protocol)?t:null}catch{return null}}function Ok(e){return e.hostname.toLowerCase().replace(/^www\./,"")}function $Ve(e){const t=e.searchParams.get("t")||e.searchParams.get("start")||"";if(!t)return 0;if(/^\d+$/.test(t))return Number(t);const n=t.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);if(!n)return 0;const[,r=0,a=0,i=0]=n;return Number(r)*3600+Number(a)*60+Number(i)}function FVe(e){const t=z0(e),n=NP(e);if(!t||!n)return"";const r=new URLSearchParams({autoplay:"1",playsinline:"1",rel:"0"}),a=$Ve(t);return a>0&&r.set("start",String(a)),`https://www.youtube-nocookie.com/embed/${n}?${r.toString()}`}function BVe(e){const t=z0(e);if(!t||!["spotify.com","open.spotify.com","play.spotify.com"].includes(Ok(t)))return null;const n=t.pathname.split("/").filter(Boolean);n[0]?.startsWith("intl-")&&n.shift(),n[0]==="embed"&&n.shift();const[r,a]=n;if(!OVe.includes(r)||!MVe.test(a||""))return null;const i=r==="track"||r==="episode";return{kind:r,id:a,uri:`spotify:${r}:${a}`,src:`https://open.spotify.com/embed/${r}/${a}?utm_source=generator`,height:i?hne:LVe}}function pne(e){const t=z0(e);if(!t)return"";const n=Ok(t);if(!["tiktok.com","m.tiktok.com"].includes(n))return"";const r=t.pathname.split("/").filter(Boolean);let a="";if(r[0]==="embed"&&r[1]==="v2")a=r[2]||"";else if(r[0]==="embed")a=r[1]||"";else{const i=r.indexOf("video");i>0&&r[i-1].startsWith("@")&&(a=r[i+1]||"")}return DVe.test(a)?a:""}function UVe(e){const t=pne(e);return t?`https://www.tiktok.com/embed/v2/${t}`:""}const zVe=["p","reel","reels","tv"],HVe=/^[A-Za-z0-9_-]{5,32}$/;function mne(e){const t=z0(e);if(!t||!["instagram.com","m.instagram.com","instagr.am"].includes(Ok(t)))return null;const n=t.pathname.split("/").filter(Boolean),r=n.findIndex(o=>zVe.includes(o));if(r<0||r>1)return null;const a=n[r+1]||"";if(!HVe.test(a)||a==="embed")return null;const i=n[r]==="p"?"p":"reel";return{kind:i,code:a,src:`https://www.instagram.com/${i}/${a}/embed/`}}function qVe(e){return!!e&&e.embed!==!1}function AP(e){if(!qVe(e)||!e.url)return null;const t=String(e.url),n=FVe(t);if(n)return{provider:"youtube",mode:"inline",src:n};const r=BVe(t);if(r)return{provider:"spotify",mode:"inline",src:r.src,uri:r.uri,height:r.height};const a=UVe(t);if(a)return{provider:"tiktok",mode:"popup",src:a};const i=mne(t);return i?{provider:"instagram",mode:"popup",src:i.src}:null}function v7(e){return AP({url:e,embed:!0})?.provider||""}function WVe(e){const t=z0(e);if(!t)return"";const n=Ok(t);if(!["youtube.com","m.youtube.com"].includes(n))return"";const[r,a]=t.pathname.split("/").filter(Boolean);return r==="shorts"&&a===NP(e)?a:""}function ff(e){const t=String(e?.url||"");return t?!!(pne(t)||mne(t)||WVe(t)):!1}function VVe(e){return e?.ref||e?.id||e?.url||""}function GVe(e){return AP({...e,embed:!0})!==null}function Lj({options:e,value:t,onChange:n,label:r}){return s.jsx("div",{className:"ppb-choice",role:"group","aria-label":r,children:e.map(a=>s.jsx("button",{type:"button","aria-pressed":t===a.value,onClick:()=>n(a.value),children:a.label},String(a.value)))})}const YVe=140,RP=8,pl={header:{name:"Design",blurb:"Photo, name, link, what you do",heading:"",group:"yours",icon:vye,pinned:!0,layouts:["Centered","Side","Portrait","Hero","Banner","Shape"]},expert:{name:"AI expert",blurb:"The chat visitors came for",heading:WA,group:"yours",icon:Ms,layouts:["Open chat","Compact cards"]}
430,services:{name:"Services",blurb:"What you sell or take enquiries for",heading:"Work with me",group:"yours",icon:fve,layouts:["Rows","Cards","Swipe rail","Storefront"]},media:{name:"Content",blurb:"Talks, posts and free resources",heading:"Watch and read",group:"yours",icon:nY,layouts:["Featured + grid","Compact list","Storefront"]},products:{name:"Shop",blurb:"Paid downloads and courses",heading:"Shop",group:"yours",icon:Mf,layouts:["List","Shop grid","Swipe rail","Storefront"]},contact:{name:"Contact request",blurb:"Let them reach you directly",heading:"Work together",group:"reach",icon:$u,layouts:["Button","Form on the page"]},custom:{name:"Custom section",blurb:"Instagram, press, your own links",heading:"New section",group:"reach",icon:_1e,repeatable:!0,layouts:["Text","Link buttons"]}},KVe=[["yours","What you put on it"],["reach","Ways to reach you"]],gf=e=>pl[mn(e)]||pl.custom;function fne(e,t){const n=mn(t)==="products";return e.items.map((r,a)=>({it:r,index:a})).filter(({it:r})=>ik(r)===n)}function gne(e,t){const n=gf(t);return mn(t)==="custom"?af(e,t,n.heading):n.name}function XVe(e,t){return t==="header"?!1:pl[t]?.repeatable?JVe(e)<lQ:!e.includes(t)}const JVe=e=>e.filter(t=>mn(t)==="custom").length;function QVe(e){const t=e.filter(n=>mn(n)==="custom").map(n=>Number(n.split("#")[1])||0);return`custom#${Math.max(0,...t)+1}`}function ZVe(e,t,n){if(t<1||n<1||n>=e.length||t>=e.length)return e;const r=[...e],[a]=r.splice(t,1);return r.splice(n,0,a),r}function eGe(e,t,n){return{...e,headings:{...e.headings,[t]:n}}}function GE(e,t,n){const r={...e.headingColors},a=hh(n);return a?r[t]=a:delete r[t],{...e,headingColors:r}}function tGe(e,t,n){return{...e,layouts:{...e.layouts,[t]:rk(n,t)}}}function jn(e,t){return{...e,headerStyle:Ba({headerStyle:{...Ba(e),...t}})}}function sGe(e,t){return{...e,callStyle:Uf({callStyle:t})}}function nGe(e,t){return{...e,callColor:ph({callColor:t})}}function rGe(e,t){return{...e,callLabel:String(t??"").slice(0,oI)}}function aGe(e,t){return{...e,floatingAsk:t!==!1}}function xne(e,t){return{...e,floatingAskText:String(t??"").slice(0,sk)}}function iGe(e,t){return{...e,floatingAskCall:t!==!1}}function IP(e,t){return pl[t]?.repeatable?QVe(e.order):t}function bne(e,t){const n=pl[t];if(!n)return e;const r=IP(e,t),a={...e,order:[...e.order,r]};return n.repeatable&&(a.customs={...e.customs,[r]:{text:"",links:[]}}),a}function oGe(e,t){if(pl[mn(t)]?.pinned)return e;const n={...e.customs};return delete n[t],{...e,order:e.order.filter(r=>r!==t),customs:n}}function lGe(e,t){const n=String(t),r=dl(e.profileExperts),i=r.includes(n)?r.filter(l=>l!==n):[...r,n],o=i.includes(String(e.featuredExpertId??""))?e.featuredExpertId:"";return{...e,profileExperts:i,profileExpertsOff:[],featuredExpertId:o}}function PP(e,t){const n=String(t||"");if(!n)return e;const r=dl(e.profileExperts),a=Array.isArray(e.order)?e.order:[],i=a.some(d=>mn(d)==="expert"),o=r.includes(n);if(o&&i)return e;const l=i?a:[a[0]||"header","expert",...a.slice(a[0]?1:0)].filter(Boolean),c=o?r:[...r,n],u=String(e.featuredExpertId??"");return{...e,order:l,profileExperts:c,profileExpertsOff:dl(e.profileExpertsOff).filter(d=>d!==n),featuredExpertId:u||c[0]||""}}function cGe(e,t,n){const r=String(n??"");return!Xh(t,e).map(i=>String(i.id)).includes(r)||String(e.featuredExpertId??"")===r?e:{...e,featuredExpertId:r}}function uGe(e,t){const n=(Array.isArray(t)?t:[]).map(i=>String(i)).filter(Boolean);if(!n.length)return e;const r=dl(e.profileExperts)[0],a=String(e.featuredExpertId??"");return{...e,profileExperts:n,profileExpertsOff:[],featuredExpertId:n[0]!==r?n[0]:a&&n.includes(a)?e.featuredExpertId:n[0]}}function w7(e,t){const n={...e||{}};return delete n[t],n}const dGe={header:"Your photo, logo, banner and links stay.",expert:"Your experts stay.",services:"Your services stay.",media:"Your videos and posts stay.",products:"Your products stay.",contact:"Contact requests stay on, and so do your questions.",custom:"Your words and links stay."};function hGe(e){const t=mn(e);return{title:`Restore ${(pl[t]||pl.custom).name} defaults?`,description:`This section goes back to how it shipped. ${dGe[t]||"Your content stays."}`}}function pGe(e,t){const n=mn(t),r=w7(e.headings,t),a=Object.fromEntries(Object.entries(e.headingColors||{}).filter(([o])=>o!==t&&!o.startsWith(`${t}:`))),i=w7(e.layouts,t);if(n==="header"){const o=Ba(e);return{...e,layouts:i,roles:[],trim:Gs.trim,callStyle:Gs.callStyle,callColor:Gs.callColor,headerStyle:Ba({headerStyle:{...Gs.headerStyle,photoUrl:o.photoUrl,logoUrl:o.logoUrl,bannerUrl:o.bannerUrl,pageBgUrl:o.pageBgUrl,heroSurfaceUrl:o.heroSurfaceUrl,heroSurfaceOn:o.heroSurfaceOn}})}}return n==="expert"?{...e,headings:r,headingColors:a,layouts:i,floatingAsk:Gs.floatingAsk,floatingAskText:Gs.floatingAskText,floatingAskCall:Gs.floatingAskCall}:n==="contact"?{...e,headings:r,headingColors:a,layouts:i,desc:Gs.desc,contactCta:Gs.contactCta,collect:{...Gs.collect}}:{...e,headings:r,headingColors:a,layouts:i}}function yne(e,t){return{...e,currency:t}}function mGe(e,t){return{...e,roles:t.trim()?[t]:[]}}function j7(e){return e.socials.length>=RP?e:{...e,socials:[...e.socials,""]}}function _7(e,t,n){return{...e,socials:e.socials.map((r,a)=>a===t?n:r)}}function fGe(e,t){return{...e,socials:e.socials.filter((n,r)=>r!==t)}}function gGe(e,t=""){return{...e,services:[...e.services,{id:Kh("service"),name:"",desc:"",price:"",action:"contact",url:"",img:"",...t?{categoryId:t}:{}}]}}function co(e,t,n){return{...e,services:e.services.map((r,a)=>a===t?{...r,...n}:r)}}function xGe(e,t){return{...e,services:e.services.filter((n,r)=>r!==t)}}function bGe(e,t,n=""){const r=mn(t)==="products";return{...e,items:[...e.items,{id:Kh("item"),type:r?"product":"resource",kind:"product",title:"",meta:"",url:"",img:"",thumbnailMode:"auto",thumbnailLink:"",embed:!0,price:"",...n?{categoryId:n}:{}}]}}function ma(e,t,n){return{...e,items:e.items.map((r,a)=>a===t?{...r,...n}:r)}}function yGe(e,t){return{...e,items:e.items.filter((n,r)=>r!==t)}}function LP(e,t,n,r){const a=t.length-1;if(n===r||n<0||r<0||n>a||r>a)return e;const i=t.slice();i.splice(r,0,i.splice(n,1)[0]);const o=e.slice();return t.forEach((l,c)=>{o[l]=e[i[c]]}),o}function vGe(e,t,n,r){const a=LP(e.items,t,n,r);return a===e.items?e:{...e,items:a}}function wGe(e,t,n,r){const a=LP(e.services,t,n,r);return a===e.services?e:{...e,services:a}}function jGe(e,t){const n=new Set(nl(e,t).map(a=>a.id));let r="";do r=`cat_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`;while(n.has(r));return r}function _Ge(e,t){const n=mn(t),r=nl(e,n);return!["services","media","products"].includes(n)||r.length>=sI?e:{...e,categories:{...e.categories,[n]:[...r,{id:jGe(e,n),name:"",img:""}]}}}function W3(e,t,n,r){const a=mn(t);
430return{...e,categories:{...e.categories,[a]:nl(e,a).map(i=>i.id===n?{...i,...r}:i)}}}function kGe(e,t,n){const r=mn(t),a={...e,categories:{...e.categories,[r]:nl(e,r).filter(i=>i.id!==n)}};return r==="services"?a.services=e.services.map(i=>{if(i.categoryId!==n)return i;const o={...i};return delete o.categoryId,o}):a.items=e.items.map(i=>{if(i.categoryId!==n)return i;const o={...i};return delete o.categoryId,o}),a}const H0=(e,t)=>e.customs[t]||{text:"",links:[]};function q0(e,t,n){return{...e,customs:{...e.customs,[t]:{...H0(e,t),...n}}}}function NGe(e,t){const{links:n}=H0(e,t);return n.length>=Lb?e:q0(e,t,{links:[...n,{id:Kh("link"),label:"",url:""}]})}function YE(e,t,n,r){const{links:a}=H0(e,t);return q0(e,t,{links:a.map((i,o)=>o===n?{...i,...r}:i)})}function EGe(e,t,n){const{links:r}=H0(e,t);return q0(e,t,{links:r.filter((a,i)=>i!==n)})}function SGe(e,t,n,r){const{links:a}=H0(e,t),i=LP(a,a.map((o,l)=>l),n,r);return i===a?e:q0(e,t,{links:i})}function CGe(e){if(!e)return;const t=e.closest(".ppb-edit-body");if(!t)return;const n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=t.scrollTop+n.top-r.top-Math.max(16,(t.clientHeight-n.height)/2),o=Math.max(0,t.scrollHeight-t.clientHeight),l=Math.min(o,Math.max(0,i)),c=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;t.scrollTo({top:l,behavior:c?"auto":"smooth"})}function Mk({value:e,currency:t,onChange:n,label:r="Product"}){const[a,i]=f.useState(null),o=une(e,a||t);return s.jsxs("div",{className:"ppb-product-price",children:[s.jsx(dne,{currency:o.currency,label:`${r} currency`,onChange:l=>{i(l),n(x7(o.amount,l,o.prefix))}}),s.jsx("input",{type:"text",inputMode:"decimal","aria-label":`${r} price`,placeholder:"Price",value:o.amount,maxLength:30,onChange:l=>n(x7(l.target.value,o.currency,o.prefix))})]})}function W0(){const[e,t]=f.useState(null);return f.useEffect(()=>()=>{e&&URL.revokeObjectURL(e)},[e]),{cropSrc:e,beginCrop:async a=>{e&&URL.revokeObjectURL(e),t(URL.createObjectURL(await A0(a)))},endCrop:()=>{e&&URL.revokeObjectURL(e),t(null)}}}function V0({cropSrc:e,onCancel:t,onSave:n,title:r,aspect:a=1}){return s.jsx(T0,{isOpen:!!e,imageSrc:e,onCancel:t,onSave:n,cropShape:"rect",aspect:a,outputWidth:1024,outputFormat:"webp",title:r,backdropZ:"z-[10040]",contentZ:"z-[10050]"})}const Xi="__other__",k7={id:Xi,name:"Other",img:""};function vne(e,t){return!t.some(n=>n.id===e.categoryId)}function wne(e,t,n){return t===Xi?vne(e,n):e.categoryId===t}const N7={services:{placeholder:"e.g. Photoshoot",add:"Add a service",one:"service",many:"services",empty:"No services in this category yet.",hint:"A category groups related offers â for example Photoshoot, with Wedding and Personal as services. Set the price on each service."},products:{placeholder:"e.g. Courses",add:"Add a product",one:"product",many:"products",empty:"No products in this category yet.",hint:"A category groups related products. Set the price on each product, not on the category."},media:{placeholder:"e.g. Talks",add:"Add a link",one:"item",many:"items",empty:"No items in this category yet.",hint:"A category groups related links. Add YouTube videos, posts, or guides inside it."}};function TGe(e,t){return t==="services"?e.services.map((n,r)=>({entry:n,index:r})):fne(e,t).map(({it:n,index:r})=>({entry:n,index:r}))}function jne({category:e,entries:t,categories:n=[],className:r=""}){const a=t.filter(({entry:i})=>wne(i,e.id,n)&&i.img).map(({entry:i})=>i.img).filter((i,o,l)=>l.indexOf(i)===o).slice(0,4);return e.img?s.jsx("img",{src:e.img,alt:"",className:`ppb-category-cover-img ${r}`}):a.length?s.jsx("span",{className:`ppb-category-mosaic has-${a.length} ${r}`,"aria-hidden":"true",children:a.map(i=>s.jsx("img",{src:i,alt:""},i))}):s.jsx("span",{className:`ppb-category-cover-empty ${r}`,"aria-hidden":"true",children:s.jsx(cY,{})})}function AGe({category:e,entries:t,sectionKey:n,onCfg:r}){const a=ai(),i=f.useRef(null),{cropSrc:o,beginCrop:l,endCrop:c}=W0(),[u,d]=f.useState(!1),[h,p]=f.useState(""),m=x=>{const b=x.target.files?.[0];x.target.value="",b&&(p(""),l(b))},g=async x=>{c(),d(!0),p("");try{const b=await aR(x),y=b?.url||b?.data?.url;if(!y)throw new Error("No URL returned");r(v=>W3(v,n,e.id,{img:y}))}catch(b){p(b.response?.data?.detail?.message||b.message||"Upload failed.")}finally{d(!1)}};return s.jsxs("div",{className:"ppb-category-cover-editor",children:[s.jsxs("button",{type:"button",className:"ppb-category-cover",onClick:()=>i.current?.click(),disabled:u,"aria-label":e.img?"Change category cover":"Upload a category cover",children:[s.jsx(jne,{category:e,entries:t}),s.jsx("span",{className:"ppb-category-cover-action","aria-hidden":"true",children:u?s.jsx(vt,{className:"ppb-spin"}):s.jsx(y0,{})})]}),e.img&&s.jsx("button",{type:"button",className:"ppb-category-cover-reset","aria-label":"Use automatic category cover",title:"Use automatic cover",onClick:async()=>{await a({title:"Use the automatic cover?",description:"The custom image will be removed and the category will use its item p
430hotos."})&&r(x=>W3(x,n,e.id,{img:""}))},children:s.jsx(as,{"aria-hidden":"true"})}),h&&s.jsx("p",{className:"ppb-state is-error",role:"status",children:h}),s.jsx("input",{ref:i,type:"file",accept:"image/png,image/jpeg,image/webp",className:"ppb-vh",onChange:m}),s.jsx(V0,{cropSrc:o,onCancel:c,onSave:g,title:"Position the category cover"})]})}function _ne({cfg:e,sectionKey:t,value:n="",index:r,label:a,onCfg:i}){const o=mn(t),l=nl(e,o).filter(u=>u.name.trim());if(!l.length)return null;const c=u=>{const d=u.target.value,h=d?{categoryId:d}:{categoryId:""};i(p=>o==="services"?co(p,r,h):ma(p,r,h))};return s.jsxs("label",{className:"ppb-category-select",children:[s.jsx("span",{children:"Category"}),s.jsxs("select",{value:n,onChange:c,"aria-label":a,children:[s.jsx("option",{value:"",children:"No category"}),l.map(u=>s.jsx("option",{value:u.id,children:u.name},u.id))]})]})}function kne({cfg:e,sectionKey:t,onCfg:n,renderEntries:r=null,onAddEntry:a=null,openRequest:i=null,renderFooter:o=null}){const l=ai(),c=mn(t),u=N7[c]||N7.media,d=nl(e,c),h=TGe(e,c),p=f.useRef(null),m=f.useRef(null),g=f.useRef(null),x=f.useRef(!1),[b,y]=f.useState({id:"",quiet:!1}),v=b.id,w=D=>y({id:D,quiet:!1}),[j,E]=f.useState(0),[S,_]=f.useState(""),k=h.filter(({entry:D})=>vne(D,d)),C=d.length>0&&k.length>0,N=d.find(D=>D.id===v)||(C&&v===Xi?k7:null),A=N?.id||"",T=N?.id===Xi,I=D=>h.filter(({entry:Z})=>wne(Z,D,d)).length;i?.id&&i.token!==j&&(E(i.token),_(""),y({id:i.id,quiet:!0}));const $=b.quiet;f.useEffect(()=>{if(!A){g.current?.focus();return}$||(x.current&&p.current||m.current)?.focus(),x.current=!1;const D=Z=>{Z.key==="Escape"&&!Z.target.closest?.('[role="dialog"]')&&(Z.stopPropagation(),w(""),_(""))};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[A]);const O=(D,Z)=>{g.current=Z||null,_(""),w(D)},U=()=>{let D="";n(Z=>{const V=_Ge(Z,c),L=new Set(nl(Z,c).map(K=>K.id));return D=nl(V,c).find(K=>
430!L.has(K.id))?.id||"",V}),D&&(x.current=!0,O(D))},F=async(D,Z)=>{await l({title:`Remove ${D.name.trim()||"this category"}?`,description:Z?`Its ${Z} ${Z===1?u.one:u.many} will stay on the page without a category.`:"The category will be removed from your page."})&&(n(V=>kGe(V,c,D.id)),v===D.id&&w("")),_("")},H=(D,Z)=>s.jsxs("div",{className:"ppb-category-actions",children:[s.jsx("button",{type:"button",className:"ppb-category-remove","aria-label":`Options for ${D.name.trim()||"this category"}`,"aria-expanded":S===D.id,onClick:()=>_(V=>V===D.id?"":D.id),children:s.jsx(Iw,{"aria-hidden":"true"})}),S===D.id&&s.jsx("div",{className:"ppb-category-menu",children:s.jsxs("button",{type:"button",onClick:()=>F(D,Z),children:[s.jsx(Qs,{"aria-hidden":"true"}),"Remove category"]})})]}),G=D=>s.jsx(AGe,{category:D,entries:h,sectionKey:c,onCfg:n}),M=s.jsx("span",{className:"ppb-category-cover is-static",children:s.jsx(jne,{category:k7,entries:h,categories:d})}),z=N?I(N.id):0,W=`${z} ${z===1?u.one:u.many}`;return s.jsxs("section",{className:`ppb-category-manager${N?" is-open":""}`,"aria-label":N?N.name.trim()||"Category":void 0,"aria-labelledby":N?void 0:`${c}-categories-title`,children:[N?s.jsxs("div",{className:"ppb-category-pane",children:[s.jsx("div",{className:"ppb-category-manager-head",children:s.jsxs("button",{type:"button",ref:m,className:"ppb-category-back",onClick:()=>{w(""),_("")},children:[s.jsx(ja,{"aria-hidden":"true"}),"Categories"]})}),s.jsx("article",{className:"ppb-category-editor is-open",children:s.jsxs("div",{className:"ppb-category-summary",children:[T?M:G(N),s.jsxs("div",{className:"ppb-category-editor-body",children:[T?s.jsx("strong",{children:"Other"}):s.jsx("input",{ref:p,type:"text",value:N.name,maxLength:nI,placeholder:u.placeholder,"aria-label":"Category name",onChange:D=>n(Z=>W3(Z,c,N.id,{name:D.target.value}))}),s.jsx("span",{children:W})]}),!T&&H(N,z)]})}),r&&s.jsxs("div",{id:`${c}-${N.id}-entries`,className:"ppb-category-entries is-pane",children:[s.jsxs("div",{className:"ppb-category-entries-head",children:[s.jsx("span",{children:W}),a&&s.jsxs("button",{type:"button",className:"ppb-category-add-entry",onClick:()=>a(T?"":N.id),children:[s.jsx(Es,{"aria-hidden":"true"}),u.add]})]}),z>0?s.jsx("div",{className:"ppb-category-entry-list",children:r(N.id,Number.POSITIVE_INFINITY)}):s.jsx("p",{className:"ppb-category-empty",children:u.empty})]})]},N.id):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ppb-category-manager-head",children:[s.jsx("h4",{id:`${c}-categories-title`,children:"Categories"}),s.jsxs("button",{type:"button",className:"ppb-btn sec ppb-add-category",onClick:U,disabled:d.length>=sI,children:[s.jsx(Es,{"aria-hidden":"true"}),"Add category"]})]}),s.jsx("p",{className:"ppb-category-hint",children:u.hint}),d.length>0&&s.jsxs("div",{className:"ppb-category-list",children:[d.map((D,Z)=>{const V=I(D.id),L=D.name.trim()||`Category ${Z+1}`;return s.jsx("article",{className:"ppb-category-editor",children:s.jsxs("div",{className:"ppb-category-summary",children:[G(D),s.jsx("button",{type:"button",className:"ppb-category-open","aria-label":`Open ${L}`,onClick:K=>O(D.id,K.currentTarget),children:s.jsxs("span",{className:"ppb-category-editor-body",children:[s.jsx("strong",{className:D.name.trim()?void 0:"is-placeholder",children:D.name.trim()||u.placeholder}),s.jsxs("span",{children:[V," ",V===1?u.one:u.many]})]})}),s.jsxs("div",{className:"ppb-category-actions",children:[s.jsx("button",{type:"button",className:"ppb-category-toggle","aria-label":`Open ${L}`,onClick:K=>O(D.id,K.currentTarget),children:s.jsx(hn,{"aria-hidden":"true"})}),s.jsx("button",{type:"button",className:"ppb-category-remove","aria-label":`Options for ${L}`,"aria-expanded":S===D.id,onClick:()=>_(K=>K===D.id?"":D.id),children:s.jsx(Iw,{"aria-hidden":"true"})}),S===D.id&&s.jsx("div",{className:"ppb-category-menu",children:s.jsxs("button",{type:"button",onClick:()=>F(D,V),children:[s.jsx(Qs,{"aria-hidden":"true"}),"Remove category"]})})]})]})},D.id)}),C&&s.jsx("article",{className:"ppb-category-editor",children:s.jsxs("div",{className:"ppb-category-summary",children:[M,s.jsx("button",{type:"button",className:"ppb-category-open","aria-label":"Open Other",onClick:D=>O(Xi,D.currentTarget),children:s.jsxs("span",{className:"ppb-category-editor-body",children:[s.jsx("strong",{children:"Other"}),s.jsxs("span",{children:[k.length," ",k.length===1?u.one:u.many]})]})}),s.jsx("div",{className:"ppb-category-actions",children:s.jsx("button",{type:"button",className:"ppb-category-toggle","aria-label":"Open Other",onClick:D=>O(Xi,D.currentTarget),children:s.jsx(hn,{"aria-hidden":"true"})})})]})})]})]}),o?.(A)]})}
430const E7={media:{add:"Add a link",search:"Search content",none:"No items match that name."},products:{add:"Add a product",search:"Search shop",none:"No products match that name."}},KE={blocked:"That site blocks automated readers, we tried a browser too.","no-product":"That page has no product data we can read."};async function RGe(e){const t=await eke(e);if(t.product)return q3({kind:"products",products:[t.product]}).items[0]||null;let n;try{n=await iK([e])}catch(i){throw new Error(KE[t.reason]||i.response?.data?.detail?.message||i.message)}if(!n.products.length)throw new Error(KE[t.reason]||KE["no-product"]);const r=await oK({...n,services:[]}),[a]=q3({...r,kind:"products"}).items;return a||null}function IGe(e,t){const n={};return["title","meta","img","price","url","buttonLabel"].forEach(r=>{!e[r]&&t[r]&&(n[r]=t[r])}),!e.title&&t.kind&&t.kind!=="product"&&(n.kind=t.kind),n}function PGe(e,t){if(!t||/^free$/i.test(t))return e;const{currency:n}=une(t,e.currency);return n===e.currency?e:yne(e,n)}function LGe({index:e,onCfg:t}){const[n,r]=f.useState(""),[a,i]=f.useState(!1),[o,l]=f.useState(""),c=async()=>{const u=Zr(n);if(!u){l("Paste a full product link, starting with https://");return}i(!0),l("");try{const d=await RGe(u);if(!d)throw new Error("We could not find a product on that page.");t(h=>{const p=h.items[e]||{},m=IGe(p,d);return!m.url&&!p.url&&(m.url=u),PGe(ma(h,e,m),d.price)}),r("")}catch(d){const h=CVe(u);t(m=>{const g=m.items[e]||{},x={};return g.url||(x.url=u),!g.title&&h&&(x.title=h),Object.keys(x).length?ma(m,e,x):m});const p=d.response?.data?.detail?.message||d.message||"Import failed.";l(h?`${p} We set the title and link from the address; add the price and photo.`:p)}finally{i(!1)}};return s.jsxs("div",{className:"ppb-product-import",children:[s.jsxs("label",{children:[s.jsx("span",{children:"Import from link"}),s.jsxs("div",{className:"ppb-product-import-row",children:[s.jsx("input",{type:"url",value:n,placeholder:"Paste a product page link","aria-label":"Product page link to import",maxLength:2e3,disabled:a,onChange:u=>r(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),c())}}),s.jsxs("button",{type:"button",className:"ppb-btn sec sm",disabled:a||!n.trim(),onClick:c,children:[a?s.jsx(vt,{className:"ico ico-14 animate-spin","aria-hidden":"true"}):s.jsx(wb,{className:"ico ico-14","aria-hidden":"true"}),a?"Importingâ¦":"Import"]})]})]}),s.jsx("p",{className:`ppb-product-import-note${o?" is-error":""}`,role:o?"alert":void 0,children:o||"We fill the title, price, photo and link from the page. Edit anything after."})]})}function S7(e,t){return{...e,items:dQ(e.items.map((n,r)=>({...n,featured:r===t&&!n.featured})))}}function Nne({img:e,index:t,onCfg:n,onBusyChange:r}){const a=ai(),i=f.useRef(null),{cropSrc:o,beginCrop:l,endCrop:c}=W0(),[u,d]=f.useState(!1);f.useEffect(()=>{r?.(u)},[u,r]);const[h,p]=f.useState(""),m=()=>i.current?.click(),g=b=>{const y=b.target.files?.[0];b.target.value="",y&&(p(""),l(y))},x=async b=>{c(),d(!0),p("");try{const y=await rR(b),v=y?.url||y?.data?.url;if(!v)throw new Error("No URL returned");n(w=>ma(w,t,{img:v}))}catch(y){p(y.response?.data?.detail?.message||y.message||"Upload failed.")}finally{d(!1)}};return s.jsxs("div",{className:"ppb-prod-photo",children:[s.jsxs("div",{className:`ppb-prod-photo-frame${e?" has-img":""}`,children:[s.jsx("button",{type:"button",className:`ppb-prod-photo-btn${e?" has-img":""}`,onClick:m,disabled:u,"aria-label":e?"Change product photo":"Add product photo",children:e?s.jsx("img",{src:e,alt:"",className:"ppb-prod-photo-img"}):s.jsxs("span",{className:"ppb-prod-photo-empty",children:[s.jsx(rc,{className:"ico ico-18","aria-hidden":"true"}),s.jsx("span",{children:u?"Uploadingâ¦":"Add photo"})]})}),e&&s.jsxs("div",{className:"ppb-prod-photo-actions",children:[s.jsx("button",{type:"button",onClick:m,disabled:u,"aria-label":"Change product photo",title:"Change photo",children:s.jsx(y0,{className:"ico ico-14","aria-hidden":"true"})}),s.jsx("button",{type:"button",onClick:async()=>{await a({title:"Remove product photo?",description:"The product will remain, but its photo will be removed."})&&n(b=>ma(b,t,{img:""}))},disabled:u,"aria-label":"Remove product photo",title:"Remove photo",children:s.jsx(Qs,{className:"ico ico-14","aria-hidden":"true"})})]})]}),h&&s.jsx("p",{className:"ppb-state is-error",role:"status",children:h}),s.jsx("input",{ref:i,type:"file",accept:"image/png,image/jpeg,image/webp",className:"ppb-vh",onChange:g}),s.jsx(V0,{cropSrc:o,onCancel:c,onSave:x,title:"Position the product photo"})]})}function C7({item:e,index:t,onCfg:n,backgroundOnly:r=!1}){const a=f.useRef(null),i=f.useRef(0),o=f.useRef(""),{cropSrc:l,beginCrop:c,endCrop:u}=W0(),[d,h]=f.useState(!1),[p,m]=f.useState(""),g=e.url.trim(),x=FE(g),b=e.thumbnailMode||(e.img?"custom"
430:"auto"),y=!!e.img&&(b==="custom"||e.thumbnailLink===g),v=f.useCallback(async()=>{const E=e.url.trim();if(!FE(E))return;const S=i.current+1;i.current=S,h(!0),m("");try{const _=await Xke(E);if(i.current!==S)return;const k=_?.url||_?.data?.url||u7(E);if(!k)throw new Error("No thumbnail returned");const C=_?.data||_;n(N=>{const A=N.items[t]||{},T=A.thumbnailMode||(A.img?"custom":"auto"),I={type:C?.type||"video",provider:C?.provider||"",duration:C?.duration||""};return T==="auto"&&(I.img=k,I.thumbnailMode="auto",I.thumbnailLink=E),!String(A.title||"").trim()&&C?.title&&(I.title=C.title),ma(N,t,I)})}catch(_){if(i.current!==S)return;const k=u7(E);if(k){n(C=>{const N=C.items[t]||{};return(N.thumbnailMode||(N.img?"custom":"auto"))!=="auto"?C:ma(C,t,{img:k,thumbnailMode:"auto",thumbnailLink:E,type:"video",provider:"youtube"})}),m("");return}m(_.response?.data?.detail?.message||"We could not retrieve this thumbnail. Upload one instead.")}finally{i.current===S&&h(!1)}},[t,e.url,n]);f.useEffect(()=>{const E=e.url.trim(),S=e.thumbnailMode||(e.img?"custom":"auto"),_=e.img&&e.thumbnailLink===E;if(!FE(E)||S!=="auto"&&e.title.trim()&&e.meta.trim()||_&&e.title.trim()&&e.provider||o.current===E)return;const k=window.setTimeout(()=>{o.current=E,v()},250);return()=>window.clearTimeout(k)},[e.img,e.meta,e.provider,e.thumbnailLink,e.thumbnailMode,e.title,e.url,v]),f.useEffect(()=>{v7(e.url.trim())!=="instagram"||e.provider==="instagram"||n(S=>ma(S,t,{provider:"instagram",type:"post"}))},[t,e.provider,e.url,n]),f.useEffect(()=>()=>{i.current+=1},[]);const w=E=>{const S=E.target.files?.[0];E.target.value="",S&&(m(""),c(S))},j=async E=>{u(),i.current+=1,h(!0),m("");try{const S=await aR(E),_=S?.url||S?.data?.url;if(!_)throw new Error("No URL returned");n(k=>ma(k,t,{img:_,thumbnailMode:"custom",thumbnailLink:""}))}catch(S){m(S.response?.data?.detail?.message||S.message||"Upload failed.")}finally{h(!1)}};if(r)return null;if(x&&!y&&!p){const E=v7(g)==="instagram";return s.jsxs("div",{className:"ppb-media-pending",role:"status","aria-live":"polite",children:[s.jsx(vt,{className:"ico ppb-spin","aria-hidden":"true"}),s.jsx("span",{children:E?"Fetching Instagram coverâ¦":"Finding link detailsâ¦"})]})}return s.jsxs("div",{className:"ppb-prod-photo is-media",children:[s.jsxs("div",{className:`ppb-media-thumb${e.img?" has-img":""}${d?" is-busy":""}`,children:[e.img&&s.jsx("img",{src:np(e.img,e.url),onError:rp,onLoad:E=>{E.currentTarget.style.visibility=""},referrerPolicy:"no-referrer",alt:"",className:"ppb-prod-photo-img"}),s.jsx("button",{type:"button",className:"ppb-media-thumb-edit",onClick:()=>a.current?.click(),disabled:d,"aria-label":e.img?"Upload a different thumbnail":"Upload thumbnail",children:s.jsxs("span",{className:"ppb-media-thumb-upload","aria-hidden":"true",children:[s.jsx(Lw,{className:"ico ico-14"}),s.jsx("span",{children:d?"Workingâ¦":e.img?"Change thumbnail":"Upload thumbnail"})]})})]}),p&&s.jsx("p",{className:"ppb-state is-error",role:"status",children:p}),s.jsx("input",{ref:a,type:"file",accept:"image/png,image/jpeg,image/webp",className:"ppb-vh",onChange:w}),s.jsx(V0,{cropSrc:l,onCancel:u,onSave:j,aspect:16/9,title:"Position the thumbnail"})]})}function Ene({cfg:e,sectionKey:t,onCfg:n}){const r=ai(),a=f.useRef(!1),[i,o]=f.useState(""),[l,c]=f.useState(null),u=f.useRef(""),[d,h]=f.useState(null),[p,m]=f.useState(null),[g,x]=f.useState(null),[b,y]=f.useState(null),v=mn(t)==="products",w=v?E7.products:E7.media,j=fne(e,t).map((H,G)=>({...H,ordinal:G+1})),E=d===null?null:j.find(({it:H,index:G})=>(H.id||G)===d),S=nl(e,t),_=S.length>0,k=i.trim().toLowerCase(),C=k?j.filter(({it:H})=>[H.title,H.meta,H.url,H.price].some(G=>String(G||"").toLowerCase().includes(k))):j,N=C.filter(({it:H})=>!H.categoryId),A=f.useCallback(H=>{!H||!a.current||(a.current=!1,requestAnimationFrame(()=>{H.isConnected&&(CGe(H),H.querySelector("input")?.focus({preventScroll:!0}))}))},[]);f.useEffect(()=>{if(p===null)return;const H=()=>m(null);return window.addEventListener("pointerup",H),()=>window.removeEventListener("pointerup",H)},[p]);const T=(H="")=>{a.current=!0,o(""),_&&c(M=>({id:H||Xi,token:(M?.token||0)+1})),u.current=H;const G=bGe(e,t,H);n(G),h(G.items.at(-1).id)},I=(H="")=>{if(H===Xi)return T("");
430if(H)return T(H);const G=u.current;return T(S.some(M=>M.id===G)?G:"")},$=(H="")=>s.jsxs("button",{type:"button",className:`ppb-btn sec${v?" ppb-add-product":" ppb-add-media"}`,onClick:()=>I(H),children:[s.jsx(Es,{className:"ico","aria-hidden":"true"}),w.add]}),O=()=>{m(null),x(null),y(null)},U=(H,G,M)=>{if(!g||g.groupKey!==H.key)return;const z=H.indices.indexOf(g.index);let W=H.indices.indexOf(G)+(M?1:0);z<W&&(W-=1),O(),z!==W&&n(D=>vGe(D,H.indices,z,W))},F=({it:H,index:G,ordinal:M},z=null,W=!1)=>{const D=!v||!!z||W,Z=z||{key:"visible",indices:C.map(({index:se})=>se)},V=v?"product":"item",L=async()=>{const se=H.title.trim()||`${V} ${M}`;await r({title:`Remove ${se}?`,description:`This ${V} and its details will be removed from your page.`})&&(W&&h(null),n(le=>yGe(le,G)))},K=s.jsx(_ne,{cfg:e,sectionKey:t,value:H.categoryId,index:G,label:`Category for ${V} ${M}`,onCfg:n}),te=s.jsx("input",{type:"text","aria-label":`Title of ${V} ${M}`,placeholder:"Title",value:H.title,maxLength:200,onChange:se=>n(le=>ma(le,G,{title:se.target.value}))}),Q=s.jsx("input",{type:"url","aria-label":`Link of ${V} ${M}`,placeholder:v?"https://â¦":"Paste a YouTube, Spotify, or other supported link",value:H.url,maxLength:2e3,onChange:se=>n(le=>ma(le,G,{url:se.target.value}))}),Y=s.jsx(C7,{item:H,index:G,onCfg:n}),J=s.jsx("input",{type:"text","aria-label":`Description of item ${M}`,placeholder:"Description",value:H.meta,maxLength:300,onChange:se=>n(le=>ma(le,G,{meta:se.target.value}))}),P=!D&&!W&&g?.index===G,ee=!D&&!W&&b?.index===G?b.after?" is-over-after":" is-over":"",X=D||W?{}:{draggable:p===G,onDragStart:se=>{x({index:G,groupKey:Z.key}),se.dataTransfer.effectAllowed="move",se.dataTransfer.setData("text/plain",String(G))},onDragEnd:O,onDragOver:se=>{if(!g||g.groupKey!==Z.key||g.index===G)return;se.preventDefault();const le=se.currentTarget.getBoundingClientRect();y({index:G,after:se.clientY>le.top+le.height/2})},onDrop:se=>{!g||!b||(se.preventDefault(),U(Z,b.index,b.after))}},ae=s.jsxs("div",{ref:!D&&M===j.length?A:null,className:`ppb-rowcard${v?" ppb-product-rowcard":""}${P?" is-dragging":""}${ee}`,...X,children:[!D&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"hd",children:[s.jsx("span",{className:"ppb-category-entry-grip",title:"Drag to reorder","aria-hidden":"true",onMouseDown:()=>m(G),onTouchStart:()=>m(G),onClick:se=>{se.preventDefault(),se.stopPropagation()},children:s.jsx(_u,{"aria-hidden":"true"})}),s.jsx("span",{className:"n",children:`${v?"Product":"Item"} ${M}`}),s.jsxs("span",{className:"ppb-rowcard-tools",children:[s.jsx("button",{type:"button",className:`feat${H.featured?" is-featured":""}`,"aria-label":H.featured?"Remove from featured":"Set as featured","aria-pressed":!!H.featured,title:H.featured?"Remove from featured":"Set as featured",onClick:()=>n(se=>S7(se,G)),children:s.jsx(kb,{className:"ico ico-14","aria-hidden":"true",fill:H.featured?"currentColor":"none"})}),s.jsx("button",{type:"button",className:"x","aria-label":`Remove ${H.title.trim()||`${V} ${M}`}`,onClick:L,children:s.jsx(Qs,{className:"ico ico-14","aria-hidden":"true"})})]})]}),K]}),v&&W&&s.jsx(LGe,{index:G,onCfg:n}),v&&s.jsxs("div",{className:"ppb-product-editor",children:[s.jsx("div",{className:W?"ppb-product-dialog-photo":void 0,children:s.jsx(Nne,{img:H.img,index:G,onCfg:n})}),s.jsxs("div",{className:"ppb-product-fields",children:[W?s.jsxs("label",{className:"ppb-product-dialog-title",children:["Title",te]}):te,s.jsxs("div",{className:W?"ppb-product-dialog-price":void 0,children:[W&&s.jsx("span",{children:"Price"}),s.jsx(Mk,{value:H.price,currency:e.currency,label:`Product ${M}`,onChange:se=>n(le=>ma(le,G,{price:se}))})]}),W?s.jsxs("label",{className:"ppb-product-dialog-link",children:["Link",Q]}):Q,s.jsx("input",{className:W?"ppb-product-dialog-button-text":void 0,type:"text","aria-label":`Product ${M} button text`,placeholder:"Buy",value:H.buttonLabel||"",maxLength:rf,onChange:se=>n(le=>ma(le,G,{buttonLabel:se.target.value}))}),D&&K]})]}),!v&&W&&s.jsxs("div",{className:"ppb-product-editor",children:[s.jsx("div",{className:"ppb-product-dialog-photo",children:Y}),s.jsxs("div",{className:"ppb-product-fields",children:[s.jsxs("label",{className:"ppb-product-dialog-title",children:["Title",te]}),s.jsxs("label",{className:"ppb-entry-dialog-description",children:["Description",J]}),s.jsxs("label",{className:"ppb-product-dialog-link",children:["Link",Q]}),K,GVe(H)&&s.jsxs("div",{className:"ppb-entry-dialog-embed",children:[s.jsx("span",{children:"When tapped"}),s.jsx(Lj,{label:`When item ${M} is tapped`,value:H.embed!==!1,onChange:se=>n(le=>ma(le,G,{embed:se})),options:[{value:!0,label:"Play on page"},{value:!1,label:"Open link"}]})]})]})]}),D&&s.jsxs("div",{className:W?"ppb-product-dialog-footer":void 0,children:[s.jsxs("button",{type:"button",className:"ppb-rowcard-remove",onClick:L,children:[s.jsx(Qs,{"aria-hidden":"true"}),"Remove"]}),W&&s.jsx("button",{type:"button",className:"ppb-product-dialog-done",onClick:()=>h(null),children:"Done"})]})]},G);
430if(!D||W)return ae;const me=H.title.trim()||(v?"Untitled product":"Untitled entry"),q=g?.index===G,he=b?.index===G?b.after?" is-over-after":" is-over":"";return s.jsxs("div",{ref:d===null&&M===j.length?A:null,className:`ppb-category-entry-card${q?" is-dragging":""}${he}`,draggable:p===G,onDragStart:se=>{x({index:G,groupKey:Z.key}),se.dataTransfer.effectAllowed="move",se.dataTransfer.setData("text/plain",String(G))},onDragEnd:O,onDragOver:se=>{if(!g||g.groupKey!==Z.key||g.index===G)return;se.preventDefault();const le=se.currentTarget.getBoundingClientRect();y({index:G,after:se.clientY>le.top+le.height/2})},onDrop:se=>{!g||!b||(se.preventDefault(),U(Z,b.index,b.after))},children:[s.jsxs("div",{className:"ppb-category-entry-head",children:[s.jsx("span",{className:"ppb-category-entry-grip",title:"Drag to reorder","aria-hidden":"true",onMouseDown:()=>m(G),onTouchStart:()=>m(G),onClick:se=>{se.preventDefault(),se.stopPropagation()},children:s.jsx(_u,{"aria-hidden":"true"})}),s.jsx("span",{className:"ppb-category-entry-thumb",children:H.img?s.jsx("img",{src:np(H.img,H.url),onError:rp,onLoad:se=>{se.currentTarget.style.visibility=""},referrerPolicy:"no-referrer",alt:""}):s.jsx(rc,{"aria-hidden":"true"})}),s.jsxs("span",{className:"ppb-category-entry-copy",children:[s.jsx("strong",{children:me}),s.jsx("input",{type:"url",className:"ppb-category-entry-link","aria-label":`Link of ${v?"product":"item"} ${M}`,placeholder:v?"https://â¦":"Paste a YouTube, Spotify or other link",value:H.url,maxLength:2e3,onPointerDown:se=>se.stopPropagation(),onClick:se=>{se.preventDefault(),se.stopPropagation()},onChange:se=>n(le=>ma(le,G,{url:se.target.value}))}),H.featured&&s.jsx("em",{children:"Featured"})]}),s.jsx("button",{type:"button",className:`ppb-category-entry-star${H.featured?" is-featured":""}`,"aria-label":H.featured?"Remove from featured":"Set as featured","aria-pressed":!!H.featured,title:H.featured?"Remove from featured":"Set as featured",onPointerDown:se=>se.stopPropagation(),onClick:se=>{se.preventDefault(),se.stopPropagation(),n(le=>S7(le,G))},children:s.jsx(kb,{"aria-hidden":"true",fill:H.featured?"currentColor":"none"})}),s.jsx("button",{type:"button",className:"ppb-category-entry-edit","aria-label":`Edit ${me}`,"aria-haspopup":"dialog",onClick:()=>h(H.id||G),children:s.jsx(Iw,{className:"ppb-category-entry-more","aria-hidden":"true"})})]}),!v&&d!==(H.id||G)&&s.jsx(C7,{item:H,index:G,onCfg:n,backgroundOnly:!0})]},H.id||`row-${G}`)};return s.jsxs(s.Fragment,{children:[s.jsxs(kn,{children:[v&&s.jsxs("div",{className:"ppb-shop-currency",children:[s.jsx("span",{children:"Shop currency"}),s.jsxs("div",{className:"ppb-product-price",children:[s.jsx(dne,{currency:e.currency,label:"Shop currency",onChange:H=>n(G=>yne(G,H))}),s.jsxs("output",{"aria-live":"polite",children:[s.jsx("b",{children:e.currency})," ",TP(e.currency)]})]})]}),(j.length>0||_)&&s.jsxs("label",{className:"ppb-row-search",children:[s.jsx(Fa,{"aria-hidden":"true"}),s.jsx("input",{type:"search",value:i,placeholder:w.search,"aria-label":`${w.search} by name`,onChange:H=>o(H.target.value)})]}),k?s.jsx("div",{className:"ppb-rowlist",children:C.length===0?s.jsx("p",{className:"ppb-empty",children:w.none}):C.map(H=>F(H))}):s.jsxs(s.Fragment,{children:[s.jsx(kne,{cfg:e,sectionKey:t,onCfg:n,openRequest:l,onAddEntry:H=>T(H),renderFooter:v&&_?$:null,renderEntries:(H,G)=>{const M=j.filter(({it:W})=>H===Xi?!S.some(D=>D.id===W.categoryId):W.categoryId===H),z={key:H,indices:M.map(({index:W})=>W)};return M.slice(0,G).map(W=>F(W,z))}}),!_&&(j.length===0||N.length>0)&&s.jsxs("div",{className:"ppb-rowlist",children:[j.length===0&&s.jsx("p",{className:"ppb-empty",children:"Nothing here yet."}),!_&&N.map(H=>F(H))]})]}),(!v||!_||k)&&$()]}),s.jsxs(en,{isOpen:!!E,onClose:()=>h(null),title:v?"Edit product":"Edit content",maxWidth:"max-w-lg",hideTitle:!0,className:`ppb ppb-product-dialog${v?"":" ppb-content-dialog"}`,backdropZ:"z-[10012]",contentZ:"z-[10013]",children:[s.jsxs("div",{className:"ppb-product-dialog-header",children:[s.jsxs("div",{children:[s.jsx("h2",{children:v?"Edit product":"Edit content"}),s.jsx("p",{children:"Changes save automatically"})]}),s.jsx("button",{type:"button","aria-label":v?"Close product editor":"Close content editor",onClick:()=>h(null),children:s.jsx(as,{"aria-hidden":"true"})})]}),E&&F(E,null,!0)]})]})}const OGe=[[/instagram\.com/i,"instagram","Instagram"],[/youtube\.com|youtu\.be/i,"youtube","YouTube"],[/tiktok\.com/i,"tiktok","TikTok"],[/twitter\.com|(^|\/\/|\.)x\.com/i,"x","X"],[/linkedin\.com/i,"linkedin","LinkedIn"],[/facebook\.com|fb\.com/i,"facebook","Facebook"],[/wa\.me|whatsapp\.com/i,"whatsapp","WhatsApp"],[/open\.spotify\.com/i,"spotify","Spotify"],[/github\.com/i,"github","GitHub"],[/calendly\.com/i,"calendly","Calendly"],[/(^|\/\/|\.)cal\.com/i,"calendly","Calendly"]];function Gb(e){for(const[n,r,a]of OGe)if(n.test(e))return{key:r,label:a};let t=e;try{t=new URL(e).hostname.replace(/^www\./,"")}catch{}return{key:"web",label:t}}const MGe=[{key:"instagram",label:"Instagram",Icon:__,placeholder:"https://instagram.com/you"},{key:"youtube",label:"YouTube",Icon:j_,placeholder:"https://youtube.com/@you"},{key:"tiktok",label:"TikTok",Icon:_4,placeholder:"https://tiktok.com/@you"},{key:"x",label:"X",Icon:g0,placeholder:"https://x.com/you"},{key:"linkedin",label:"LinkedIn",Icon:k4,placeholder:"https://linkedin.com/in/you"},{key:"facebook",label:"Facebook",Icon:N4,placeholder:"https://facebook.com/you"},{key:"github",label:"GitHub",Icon:TG,placeholder:"https://github.com/you"},{key:"calendly",label:"Calendly",Icon:N_,placeholder:"https://calendly.com/you"}],av={key:"web",placeholder:"https://yoursite.com"},DGe={instagram:__,youtube:j_,tiktok:_4,x:g0,linkedin:k4,facebook:N4,whatsapp:k_,spotify:E4,github:TG,calendly:N_,web:DT};function Sne({links:e,onCfg:t}){const n=ai(),r=f.useRef([]),a=f.useRef(!1),[i,o]=f.useState({}),l=e.length>=RP;f.useEffect(()=>{a.current&&(a.current=!1,r.current[e.length-1]?.focus())},[e.length]);const c=g=>e.findIndex((x,b)=>{const y=_1(x)||Aa(x);return y?Gb(y).key===g:!x.trim()&&i[b]?.key===g}),u=g=>{const x=r.current[g];x&&(x.focus(),x.scrollIntoView({block:"nearest",behavior:"smooth"}))},d=g=>{const x=c(g.key);if(x>=0){u(x);return}l||(o(b=>({...b,[e.length]:{key:g.key,placeholder:g.placeholder}})),a.current=!0,t(b=>j7(b)))},h=g=>{o(x=>{const b={};for(const[y,v]of Object.entries(x)){const w=Number(y);w<g?b[w]=v:w>g&&(b[w-1]=v)}return b}),t(x=>fGe(x,g))},p=c(av.key)>=0,m=()=>{const g=e.findIndex((x,b)=>!x.trim()&&i[b]?.key===av.key);if(g>=0){u(g);return}l||(o(x=>({...x,[e.length]:{key:av.key,placeholder:av.placeholder}})),a.current=!0,t(x=>j7(x)))};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"ppb-link-tray",role:"group","aria-label":"Add a link",children:MGe.map(g=>{const x=c(g.key)>=0;return s.jsxs("button",{type:"button",className:`ppb-link-chip${x?" is-added":""}`,disabled:l&&!x,title:x?`${g.label} is linked â show it`:`Add ${g.label}`,"aria-label":x?`${g.label} is already linked, show its address`:`Add a ${g.label} link`,"aria-pressed":x,onClick:()=>d(g),children:[s.jsx(g.Icon,{size:28,color:g.key==="calendly"?"#006BFF":void 0}),x&&s.jsx("span",{className:"ppb-link-chip-check","aria-hidden":"true",children:s.jsx(ft,{size:9,strokeWidth:3})})]},g.key)})}),s.jsxs("button",{type:"button",className:`ppb-link-website${p?" is-added":""}`,disabled:l,onClick:m,children:[s.jsx(DT,{size:18}),s.jsx("span",{children:l?"Website link":"Add website link"}),p&&s.jsx("span",{className:"ppb-link-website-check","aria-hidden":"true",children:s.jsx(ft,{size:10,strokeWidth:3})})]}),e.length>0&&s.jsx("div",{className:"ppb-link-rows",children:e.map((g,x)=>{const b=_1(g)||Aa(g),y=!!b,{key:v,label:w}=y?Gb(b):{key:null,label:""}
430,j=y?DGe[v]||DT:$a;return s.jsxs("div",{className:"ppb-link-row",children:[s.jsx("span",{className:`ppb-link-row-ico${y?" is-live":""}`,"aria-hidden":"true",children:s.jsx(j,{size:17,color:v==="calendly"?"#006BFF":void 0})}),s.jsx("input",{ref:E=>{r.current[x]=E},type:"text",inputMode:"url",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,"aria-label":`Address of link ${x+1}`,placeholder:i[x]?.placeholder||"instagram.com/you",value:g,maxLength:2e3,onChange:E=>t(S=>_7(S,x,E.target.value)),onBlur:E=>{const S=_1(E.target.value);S&&S!==E.target.value.trim()&&t(_=>_7(_,x,S))}}),s.jsx("button",{type:"button",className:"ppb-link-row-x","aria-label":w?`Remove the ${w} link`:`Remove link ${x+1}`,onClick:async()=>{const E=w||`link ${x+1}`;await n({title:`Remove ${E}?`,description:"This link will no longer appear on your public page."})&&h(x)},children:s.jsx(Qs,{className:"ico ico-14","aria-hidden":"true"})})]},x)})})]})}function OP(e){const[t,n]=f.useState(null),[r,a]=f.useState(null),[i,o]=f.useState(null);f.useEffect(()=>{if(t===null)return;const h=()=>n(null);return window.addEventListener("pointerup",h),()=>window.removeEventListener("pointerup",h)},[t]);const l=()=>{n(null),a(null),o(null)},c=(h,p,m)=>{if(!r||r.groupKey!==h.key)return;const g=h.indices.indexOf(r.index);let x=h.indices.indexOf(p)+(m?1:0);g<x&&(x-=1),l(),g!==x&&e(h,g,x)};return{gripProps:h=>({className:"ppb-category-entry-grip",title:"Drag to reorder","aria-hidden":"true",onMouseDown:()=>n(h),onTouchStart:()=>n(h),onClick:p=>{p.preventDefault(),p.stopPropagation()}}),rowProps:(h,p)=>{const m=r?.index===h,g=i?.index===h?i.after?" is-over-after":" is-over":"";return{className:`${m?" is-dragging":""}${g}`,draggable:t===h,onDragStart:x=>{a({index:h,groupKey:p.key}),x.dataTransfer.effectAllowed="move",x.dataTransfer.setData("text/plain",String(h))},onDragEnd:l,onDragOver:x=>{if(!r||r.groupKey!==p.key||r.index===h)return;x.preventDefault();const b=x.currentTarget.getBoundingClientRect();o({index:h,after:x.clientY>b.top+b.height/2})},onDrop:x=>{!r||!i||(x.preventDefault(),c(p,i.index,i.after))}}}}}function $Ge({img:e,index:t,onCfg:n}){const r=ai(),a=f.useRef(null),{cropSrc:i,beginCrop:o,endCrop:l}=W0(),[c,u]=f.useState(!1),[d,h]=f.useState(""),p=()=>a.current?.click(),m=x=>{const b=x.target.files?.[0];x.target.value="",b&&(h(""),o(b))},g=async x=>{l(),u(!0),h("");try{const b=await rR(x),y=b?.url||b?.data?.url;if(!y)throw new Error("No URL returned");n(v=>co(v,t,{img:y}))}catch(b){h(b.response?.data?.detail?.message||b.message||"Upload failed.")}finally{u(!1)}};return s.jsxs("div",{className:"ppb-prod-photo",children:[s.jsxs("div",{className:`ppb-prod-photo-frame${e?" has-img":""}`,children:[s.jsx("button",{type:"button",className:`ppb-prod-photo-btn${e?" has-img":""}`,onClick:p,disabled:c,"aria-label":e?"Change service photo":"Add service photo",children:e?s.jsx("img",{src:e,alt:"",className:"ppb-prod-photo-img"}):s.jsxs("span",{className:"ppb-prod-photo-empty",children:[s.jsx(rc,{className:"ico ico-18","aria-hidden":"true"}),s.jsx("span",{children:c?"Uploadingâ¦":"Add photo"})]})}),e&&s.jsxs("div",{className:"ppb-prod-photo-actions",children:[s.jsx("button",{type:"button",onClick:p,disabled:c,"aria-label":"Change service photo",title:"Change photo",children:s.jsx(y0,{className:"ico ico-14","aria-hidden":"true"})}),s.jsx("button",{type:"button",onClick:async()=>{await r({title:"Remove service photo?",description:"The service will remain, but its photo will be removed."})&&n(x=>co(x,t,{img:""}))},disabled:c,"aria-label":"Remove service photo",title:"Remove photo",children:s.jsx(Qs,{className:"ico ico-14","aria-hidden":"true"})})]})]}),d&&s.jsx("p",{className:"ppb-state is-error",role:"status",children:d}),s.jsx("input",{ref:a,type:"file",accept:"image/png,image/jpeg,image/webp",className:"ppb-vh",onChange:m}),s.jsx(V0,{cropSrc:i,onCancel:l,onSave:g,title:"Position the service photo"})]})}function Cne({cfg:e,onCfg:t}){const n=ai(),[r,a]=f.useState(""),[i,o]=f.useState(null),[l,c]=f.useState(null),{gripProps:u,rowProps:d}=OP((_,k,C)=>t(N=>wGe(N,_.indices,k,C))),h=e.services.map((_,k)=>({service:_,index:k,ordinal:k+1})),p=l===null?null:h.find(({service:_,index:k})=>(_.id||k)===l),m=nl(e,"services"),g=m.length>0,x=r.trim().toLowerCase(),b=x?h.filter(({service:_})=>(_.name||"").toLowerCase().includes(x)):h,y=b.filter(({service:_})=>!_.categoryId),v=(_="")=>{a(""),g&&o(C=>({id:_||Xi,token:(C?.token||0)+1}));const k=gGe(e,_);t(k),c(k.services.at(-1).id)},w=(_="")=>s.jsxs("button",{type:"button",className:"ppb-btn sec ppb-add-service",onClick:()=>v(_),children:[s.jsx(Es,{className:"ico","aria-hidden":"true"}),"Add a service"]}),j=async({service:_,index:k,ordinal:C})=>{await n({title:`Remove ${_.name.trim()||`service ${C}`}?`,description:"This service and its details will be removed from your page."})&&(c(null),t(N=>xGe(N,k)))},E=({service:_,index:k,ordinal:C},N=null)=>{const A=N||{key:"visible",indices:b.map(I=>I.index)},T=d(k,A);return f.createElement("div",{...T,className:`ppb-category-entry-card ppb-service-entry${T.className}`,key:_.id||k},s.jsxs("div",{className:"ppb-category-entry-head",children:[s.jsx("span",{...u(k),children:s.jsx(_u,{"aria-hidden":"true"})}),s.jsx("span",{className:"ppb-category-entry-thumb",children:_.img?s.jsx("img",{src:_.img,alt:""}):s.jsx(I4,{"aria-hidden":"true"})}),s.jsxs("span",{className:"ppb-category-entry-copy",children:[s.jsx("strong",{children:_.name.trim()||"Untitled service"}),s.jsx("input",{type:"url",className:"ppb-category-entry-link","aria-label":`Service ${C} link (optional)`,placeholder:"Link https://⦠(optional)",value:_.url||"",maxLength:500,onChange:I=>{const $=I.target.value.trim();t(O=>co(O,k,{url:$,action:$?"buy":"contact"}))},onBlur:I=>{const $=I.target.value.trim();$&&!/^https?:\/\//i.test($)&&t(O=>co(O,k,{url:`https://${$}`}))}})]}),s.jsx("button",{type:"button",className:"ppb-category-entry-edit","aria-label":`Edit ${_.name.trim()||`service ${C}`}`,"aria-haspopup":"dialog",onClick:()=>c(_.id||k),children:s.jsx(Iw,{className:"ppb-category-entry-more","aria-hidden":"true"})})]}))},S=({service:_,index:k,ordinal:C})=>s.jsxs("div",{className:"ppb-rowcard ppb-product-rowcard",children:[s.jsxs("div",{className:"ppb-product-editor",children:[s.jsx("div",{className:"ppb-product-dialog-photo",children:s.jsx($Ge,{img:_.img,index:k,onCfg:t})}),s.jsxs("div",{className:"ppb-product-fields",children:[s.jsxs("label",{className:"ppb-product-dialog-title",children:["Name",s.jsx("input",{type:"text","aria-label":`Service ${C} name`,placeholder:"e.g. Wedding photoshoot",value:_.name,maxLength:120,onChange:N=>t(A=>co(A,k,{name:N.target.value}))})]}),s.jsxs("label",{className:"ppb-entry-dialog-description",children:["Description",s.jsx("input",{type:"text","aria-label":`Service ${C} short description`,placeholder:"Short description",value:_.desc,maxLength:500,onChange:N=>t(A=>co(A,k,{desc:N.target.value}))})]}),s.jsxs("div",{className:"ppb-product-dialog-price",children:[s.jsx("span",{children:"Price"}),s.jsx(Mk,{value:_.price,currency:e.currency,label:`Service ${C}
430`,onChange:N=>t(A=>co(A,k,{price:N}))})]}),s.jsxs("label",{className:"ppb-product-dialog-link",children:["Link",s.jsx("input",{type:"url","aria-label":`Service ${C} link (optional)`,placeholder:"Link https://⦠(optional)",value:_.url||"",maxLength:500,onChange:N=>{const A=N.target.value.trim();t(T=>co(T,k,{url:A,action:A?"buy":"contact"}))},onBlur:N=>{const A=N.target.value.trim();A&&!/^https?:\/\//i.test(A)&&t(T=>co(T,k,{url:`https://${A}`}))}})]}),s.jsxs("label",{className:"ppb-product-dialog-button-text ppb-service-button-label",children:[s.jsx("span",{children:"Button text"}),s.jsx("input",{type:"text","aria-label":`Service ${C} button text`,placeholder:"Book",value:_.buttonLabel||"",maxLength:YR,onChange:N=>t(A=>co(A,k,{buttonLabel:N.target.value}))})]}),s.jsx(_ne,{cfg:e,sectionKey:"services",value:_.categoryId,index:k,label:`Category for service ${C}`,onCfg:t})]})]}),s.jsxs("div",{className:"ppb-product-dialog-footer",children:[s.jsxs("button",{type:"button",className:"ppb-rowcard-remove",onClick:()=>j({service:_,index:k,ordinal:C}),children:[s.jsx(Qs,{"aria-hidden":"true"}),"Remove"]}),s.jsx("button",{type:"button",className:"ppb-product-dialog-done",onClick:()=>c(null),children:"Done"})]})]});return s.jsxs(s.Fragment,{children:[s.jsxs(kn,{children:[h.length>0&&s.jsxs("label",{className:"ppb-row-search",children:[s.jsx(Fa,{"aria-hidden":"true"}),s.jsx("input",{type:"search",value:r,placeholder:"Search services","aria-label":"Search services by name",onChange:_=>a(_.target.value)})]}),x?s.jsx("div",{className:"ppb-rowlist",children:b.length===0?s.jsx("p",{className:"ppb-empty",children:"No services match that name."}):b.map(_=>E(_))}):s.jsxs(s.Fragment,{children:[s.jsx(kne,{cfg:e,sectionKey:"services",onCfg:t,openRequest:i,onAddEntry:_=>v(_),renderFooter:_=>w(_===Xi?"":_),renderEntries:(_,k)=>{const C=h.filter(({service:A})=>_===Xi?!m.some(T=>T.id===A.categoryId):A.categoryId===_),N={key:_,indices:C.map(({index:A})=>A)};return C.slice(0,k).map(A=>E(A,N))}}),(e.services.length===0||!g&&y.length>0)&&s.jsxs("div",{className:"ppb-rowlist",children:[e.services.length===0&&s.jsx("p",{className:"ppb-empty",children:"Nothing here yet."}),!g&&y.map(_=>E(_))]})]}),x&&w()]}),s.jsxs(en,{isOpen:!!p,onClose:()=>c(null),title:"Edit service",maxWidth:"max-w-lg",hideTitle:!0,className:"ppb ppb-product-dialog ppb-service-dialog",backdropZ:"z-[10012]",contentZ:"z-[10013]",children:[s.jsxs("div",{className:"ppb-product-dialog-header",children:[s.jsxs("div",{children:[s.jsx("h2",{children:"Edit service"}),s.jsx("p",{children:"Changes save automatically"})]}),s.jsx("button",{type:"button","aria-label":"Close service editor",onClick:()=>c(null),children:s.jsx(as,{"aria-hidden":"true"})})]}),p&&S(p)]})]})}const MP=[{key:"booking",label:"Calendly",hint:"Or any booking page",icon:Zxe,brand:!0,type:"url",prompt:"Calendly link",placeholder:"calendly.com/yourbusiness",autoComplete:"url",primary:!0},{key:"whatsapp",label:"WhatsApp",icon:k_,brand:!0,type:"tel",prompt:"WhatsApp number",placeholder:"+1 555 010 2030",autoComplete:"tel",primary:!0},{key:"email",label:"Business email",icon:qr,type:"email",prompt:"Business email",placeholder:"[email protected]",autoComplete:"email",primary:!0},{key:"phone",label:"Phone",icon:Ts,type:"tel",prompt:"Phone",placeholder:"+1 555 010 2030",autoComplete:"tel"},{key:"address",label:"Address",icon:gY,multiline:!0,prompt:"Address",placeholder:"Street, city"},{key:"hours",label:"Opening hours",icon:ah,multiline:!0,prompt:"Opening hours",placeholder:"MonâFri 9:00â18:00"}],Yb={booking:2e3,whatsapp:40,email:320,phone:40,address:300,hours:300};function Kb(e){const t=e?.businessContact&&typeof e.businessContact=="object"?e.businessContact:{};return Object.fromEntries(Object.entries(Yb).map(([n,r])=>[n,String(t[n]??"").slice(0,r)]))}function Tne(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,String(n).trim()]))}function FGe({contact:e,onChange:t,idPrefix:n,renderField:r}){return MP.map(a=>{const i=`${n}-${a.key}`,o={id:i,value:e[a.key]||"",placeholder:a.placeholder,maxLength:Yb[a.key],onChange:c=>t(a.key,c.target.value.slice(0,Yb[a.key]))},l=a.multiline?s.jsx("textarea",{rows:2,...o}):s.jsx("input",{type:a.type,autoComplete:a.autoComplete,...o}
430);return r({field:a,id:i,control:l})})}const XE=[{id:"shop",label:"Shop"},{id:"services",label:"Services"},{id:"contact",label:"Contact"}],BGe=["services","products","contact"],UGe=700;function zGe(e){const t=wa(e),n=BGe.filter(r=>!t.includes(r));return n.length?{...e,order:[...t,...n]}:{...e,order:t}}function T7(e,t){return JSON.stringify({...mQ(e,t),businessContact:Tne(Kb(e))})}function HGe({state:e}){return s.jsx("span",{className:`ppb-state bd-save-state${e==="error"?" is-error":""}`,role:"status","aria-live":"polite",children:e==="saving"?s.jsxs(s.Fragment,{children:[s.jsx(Rf,{className:"ico ico-13","aria-hidden":"true"}),"Saving"]}):e==="error"?s.jsxs(s.Fragment,{children:[s.jsx(xr,{className:"ico ico-13","aria-hidden":"true"}),"Not saved, retrying on your next edit"]}):s.jsxs(s.Fragment,{children:[s.jsx(ft,{className:"ico ico-13","aria-hidden":"true"}),"Saved"]})})}function qGe({cfg:e,enabled:t,onCfg:n,onEnabled:r}){const a=Kb(e),i=(l,c)=>n(u=>({...u,businessContact:{...Kb(u),[l]:c}})),o=l=>n(c=>({...c,collect:{...c.collect,[l]:!c.collect[l]}}));return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"bd-inv-group","aria-labelledby":"bd-contact-direct",children:[s.jsxs("div",{className:"bd-inv-group-head",children:[s.jsx("h2",{id:"bd-contact-direct",children:"How to reach you"}),s.jsx("p",{children:"Your chat recommends these when a visitor wants to book or get in touch."})]}),s.jsx(FGe,{contact:a,onChange:i,idPrefix:"bd-contact",renderField:({field:l,id:c,control:u})=>s.jsx(kn,{id:c,label:l.label,hint:l.hint,icon:l.icon,layout:"row",children:u},l.key)})]}),s.jsxs("section",{className:"bd-inv-group","aria-labelledby":"bd-contact-form",children:[s.jsxs("div",{className:"bd-inv-group-head",children:[s.jsx("h2",{id:"bd-contact-form",children:"Leave your details"}),s.jsx("p",{children:"Visitors can send you their name and email from the chat. They show up in Leads."})]}),s.jsxs("div",{className:"bd-inv-switch bd-chat-scope",children:[s.jsx("span",{"aria-hidden":"true",children:"Let visitors leave their details"}),s.jsx(I1,{checked:t,onChange:r,label:"Let visitors leave their details"})]}),t?s.jsx(kn,{label:"Also ask for",layout:"row",children:s.jsx("div",{className:"ppb-ask-toggles",role:"group","aria-label":"Optional contact fields",children:[["phone","Phone",Ts],["message","Message",ea]].map(([l,c,u])=>s.jsxs("button",{type:"button",className:"ppb-ask-toggle","aria-pressed":e.collect[l],onClick:()=>o(l),children:[s.jsx(u,{className:"ppb-ask-toggle-ico",strokeWidth:1.9,"aria-hidden":"true"}),s.jsx("span",{className:"ppb-ask-toggle-check","aria-hidden":"true",children:s.jsx(ft,{strokeWidth:2.4})}),s.jsx("span",{className:"ppb-ask-toggle-label",children:c})]},l))})}):null]}),s.jsxs("section",{className:"bd-inv-group","aria-labelledby":"bd-contact-links",children:[s.jsxs("div",{className:"bd-inv-group-head",children:[s.jsxs("h2",{id:"bd-contact-links",children:[s.jsx($a,{size:16,"aria-hidden":"true"})," Links"]}),s.jsx("p",{children:"Social profiles, a booking page, or anywhere else your chat can send people."})]}),s.jsx(Sne,{links:e.socials,onCfg:n})]})]})}function WGe(){const[e,t]=gl(),n=XE.some(S=>S.id===e.get("tab"))?e.get("tab"):"shop",[r,a]=f.useState(null),[i,o]=f.useState(!0),[l,c]=f.useState(null),[u,d]=f.useState(!1),[h,p]=f.useState(!1),[m,g]=f.useState(!1),[x,b]=f.useState(0),y=f.useRef(!1);f.useEffect(()=>{let S=!1;return $r().then(_=>{if(S)return;const k=ar(_?.config??{}),C=_?.enabled??!0;c(T7({...k,order:wa(k)},C)),o(C),a(zGe(k)),g(!1)}).catch(()=>{S||g(!0)}),()=>{S=!0}},[x]);const v=f.useMemo(()=>r?T7(r,i):null,[r,i]),w=!!v&&l!==null&&v!==l,j=f.useCallback(async S=>{if(!y.current){y.current=!0,d(!0);try{await Xl({enabled:i,config:JSON.parse(S)}),c(S),p(!1)}catch{p(!0)}finally{y.current=!1,d(!1)}}},[i]);f.useEffect(()=>{if(!w||u)return;const S=setTimeout(()=>j(v),UGe);return()=>clearTimeout(S)},[w,v,j,u]),f.useEffect(()=>{if(!w)return;const S=_=>{_.preventDefault(),_.returnValue=""};return window.addEventListener("beforeunload",S),()=>window.removeEventListener("beforeunload",S)},[w]);const E=h&&!u?"error":u||w?"saving":"saved";return s.jsxs("div",{className:"bd-page",children:[s.jsx(vs,{title:"Inventory | Great Experts",path:"/dashboard/inventory",noIndex:!0}),s.jsxs("header",{className:"ge-surface bd-page-head",children:[s.jsx(Le,{to:"/dashboard",className:"bd-back","aria-label":"Back to dashboard",children:s.jsx(ja,{size:18,"aria-hidden":"true"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h1",{className:"bd-title",children:"Inventory"}),s.jsx("p",{className:"bd-subtitle",children:"What your chat can offer, link to and quote prices for."})]}),r?s.jsx(HGe,{state:E}):null]}),s.jsx("nav",{className:"bd-tabs","aria-label":"Inventory",children:XE.map(S=>s.jsx("button",{type:"button","aria-current":n===S.id?"page":void 0,onClick:()=>t({tab:S.id},{replace:!0}),children:S.label},S.id))}),r?s.jsx(CP,{children:s.jsxs("section",{className:"ge-surface ppb is-embedded bd-inv","aria-label":XE.find(S=>
430S.id===n).label,children:[n==="shop"&&s.jsx(Ene,{cfg:r,sectionKey:"products",onCfg:a}),n==="services"&&s.jsx(Cne,{cfg:r,onCfg:a}),n==="contact"&&s.jsx(qGe,{cfg:r,enabled:i,onCfg:a,onEnabled:o})]})}):s.jsx("section",{className:"ge-surface bd-empty",children:m?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"We could not load your inventory."}),s.jsx("button",{type:"button",className:"ge-surface-btn",onClick:()=>b(S=>S+1),children:"Try again"})]}):s.jsx(vt,{size:22,className:"animate-spin text-ink-light","aria-label":"Loading your inventory"})})]})}function Ane(){nf(),Z_(),sf(),Pt({screen:"business-chat",journey:"business"})}function Rne(e){e&&(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||typeof e.button=="number"&&e.button!==0)||Ane()}function VGe(e){const t=U_(e),n=Su(),r=n.journey==="business";return t&&!r?(nf(),Z_(),sf(),Pt({screen:"business-chat",journey:"business"})):!t&&r?(sf(),Su()):n}const GGe=[{label:"For Business",to:gr.business},{label:"Pricing",to:gr.pricing}],A7="whitespace-nowrap rounded-pill border border-rule px-4 py-2.5 text-[15px] font-medium text-ink-soft transition-colors duration-base ease-standard hover:border-indigo/35 hover:bg-indigo/[0.07] hover:text-indigo sm:px-5 sm:py-[11px]",R7="whitespace-nowrap rounded-pill border border-indigo/40 bg-indigo/[0.09] px-4 py-2.5 text-[15px] font-semibold text-indigo sm:px-5 sm:py-[11px]",I7="whitespace-nowrap rounded-pill bg-indigo px-6 py-3.5 text-center text-[15px] font-semibold tracking-[-0.01em] text-cream shadow-[inset_0_1px_0_rgba(255,255,255,0.42),0_16px_32px_-16px_rgba(61,61,245,0.85)] transition-colors duration-base ease-standard hover:bg-indigo-deep",P7="block rounded-xl px-4 py-3 text-base font-medium text-ink-soft transition-colors active:bg-indigo-wash active:text-indigo";function Ine({items:e=GGe,journey:t}){const{user:n,isLoading:r}=Ut(),{status:a,entry:i}=N0(),{pathname:o}=an(),[l,c]=f.useState(!1),u=()=>c(!1),d=j=>j.to===o,h=({item:j,className:E,onClick:S})=>j.to?s.jsx(Le,{to:j.to,"aria-current":d(j)?"page":void 0,className:E,onClick:S,children:j.label}):s.jsx("a",{href:j.href,className:E,onClick:S,children:j.label});f.useEffect(()=>{if(!l)return;const j=E=>{E.key==="Escape"&&u()};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[l]);const p=n?a==="dashboard"?"Dashboard":"Continue":"Log in",m=t==="business",g=m?nK(i):i?.to||gr.builder,x=n?a==="dashboard"?"/dashboard":g:gr.login,b=m?ol:gr.signup,y={from:m?ol:oc},v=m?Rne:void 0,w=r||!!n&&a==="loading";return s.jsxs("div",{className:"relative mx-auto max-w-[1340px]",children:[s.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-[26px] border border-rule/95 bg-[#F4F4FD]/80 px-4 py-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.95),0_20px_44px_-24px_rgba(60,50,120,0.40)] backdrop-blur-xl backdrop-saturate-150 sm:gap-6 sm:px-[14px] sm:py-3 sm:pl-[26px]",children:[s.jsx(Le,{to:gr.home,className:"inline-flex shrink-0 items-center",onClick:u,children:s.jsx(bn,{height:26})}),s.jsxs("div",{className:"hidden items-center gap-1.5 lg:flex",children:[e.map(j=>s.jsx(h,{item:j,className:d(j)?R7:A7},j.label)),!w&&s.jsx(Le,{to:x,className:a==="dashboard"||!n?A7:R7,children:p}),!r&&!n&&s.jsx(Le,{to:b,state:y,onClick:v,className:`${I7} ml-2 sm:px-7 sm:py-[15px]`,children:"Sign up for free"})]}),s.jsx("button",{type:"button",onClick:()=>c(j=>!j),"aria-expanded":l,"aria-controls":"home-nav-sheet","aria-label":l?"Close menu":"Open menu",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-pill border border-rule bg-paper text-ink transition-colors active:bg-cream-deep lg:hidden",children:l?s.jsx(as,{className:"h-5 w-5 text-indigo",strokeWidth:2,"aria-hidden":"true"}):s.jsx(xl,{className:"h-5 w-5",strokeWidth:2,"aria-hidden":"true"})})]}),l&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 z-40 lg:hidden",onClick:u,"aria-hidden":"true"}),s.jsxs("nav",{id:"home-nav-sheet","aria-label":"Main navigation",className:"absolute inset-x-0 top-full z-50 mt-2 rounded-[22px] border border-rule bg-paper p-2 shadow-overlay lg:hidden",children:[e.map(j=>s.jsx(h,{item:j,className:P7,onClick:u},j.label)),!w&&s.jsx(Le,{to:x,className:P7,onClick:u,children:p}),!r&&!n&&s.jsx(Le,{to:b,state:y,onClick:j=>{v?.(j),u()},className:`${I7} mt-2 block w-full`,children:"Sign up for free"})]})]})]})}const YGe=[{id:"template-1",version:1,thumbnail:"/create-expert/templates/template-1.png",design:{headerLayout:3,callStyle:2,callColor:"#984B32",order:["header","media","products","expert","services","contact"],layouts:{media:2,products:0,expert:0,services:1,contact:0},headerStyle:{font:"unbounded",nameSize:"lg",bioSize:"lg",pageBg:"color",pageBgColor:"#E1C3BC",pageBgUrl:null,autoColor:!1,heroSurfaceColor:"#E2CFCA",heroSurfaceUrl:"/create-expert/templates/template-1-ground.webp",heroSurfaceOn:!0,nameColor:"#23271F",bioColor:"#1C1917",shape:"rounded",shapeColor:"#8DA2FB",componentColorMode:"custom",componentColor:"#000000"}}},{id:"template-2",version:1,thumbnail:"/create-expert/templates/template-2.png",design:{headerLayout:3,callStyle:0,callColor:"#000000",order:["header","expert","media","services","products","contact"],layouts:{expert:0,media:0,services:0,products:3,contact:1},headerStyle:{font:"bricolage",nameSize:"lg",bioSize:"md",pageBg:"match",pageBgColor:"#E9EEEA",pageBgUrl:null,autoColor:!1,heroSurfaceColor:"#215F71",heroSurfaceUrl:null,heroSurfaceOn:!1,nameColor:"#FFFFFF",bioColor:"#FFFFFF",shape:"rounded",shapeColor:"#8DA2FB",componentColorMode:"custom",componentColor:"#1C1917"}}},{id:"template-3",version:1,thumbnail:"/create-expert/templates/template-3.png",design:{headerLayout:1,callStyle:5,callColor:"#5F4F7D",order:["header","products","services","expert","media","contact"],layouts:{products:3,services:2,expert
430:0,media:0,contact:1},headerStyle:{font:"plus-jakarta",nameSize:"lg",bioSize:"lg",pageBg:"color",pageBgColor:"#EBE0FF",pageBgUrl:null,autoColor:!1,heroSurfaceColor:"#C3B2E0",heroSurfaceUrl:null,heroSurfaceOn:!1,nameColor:"#141413",bioColor:"#1C1917",shape:"rounded",shapeColor:"#8DA2FB",componentColorMode:"custom",componentColor:"#5F4F7D"}}},{id:"template-4",version:1,thumbnail:"/create-expert/templates/template-4.png",design:{headerLayout:0,callStyle:0,callColor:"#981514",order:["header","products","media","expert","contact"],layouts:{products:3,media:0,expert:0,contact:1},headerStyle:{font:"mono",nameSize:"lg",bioSize:"lg",pageBg:"color",pageBgColor:"#000000",pageBgUrl:null,autoColor:!1,heroSurfaceColor:"#2B2727",heroSurfaceUrl:null,heroSurfaceOn:!1,nameColor:"#959595",bioColor:"#B5B0B0",shape:"rounded",shapeColor:"#991414",componentColorMode:"custom",componentColor:"#981514"}}},{id:"template-5",version:1,thumbnail:"/create-expert/templates/template-5.png",design:{headerLayout:4,callStyle:1,callColor:"#FFFAFA",order:["header","products","media","expert","contact"],layouts:{products:3,media:1,expert:0,contact:0},headerStyle:{font:"work-sans",nameSize:"lg",bioSize:"lg",pageBg:"image",pageBgColor:"#25894B",pageBgUrl:"/create-expert/templates/template-5-page-bg.webp",autoColor:!1,heroSurfaceColor:"#2B390F",heroSurfaceUrl:null,heroSurfaceOn:!1,nameColor:"#E6C31A",bioColor:"#FFFFFF",bannerUrl:"/create-expert/templates/template-5-banner.webp",shape:"rounded",shapeColor:"#8DA2FB",componentColorMode:"custom",componentColor:"#E6C419"}}},{id:"template-6",version:1,kind:"custom",label:"Make Yours"}],KGe={templates:YGe};function XGe(e){if(!e||typeof e!="object")return null;const t=typeof e.id=="string"?e.id.trim():"";if(!t)return null;const n=e.kind==="custom"?"custom":"preset",r=e.design&&typeof e.design=="object"&&!Array.isArray(e.design)?e.design:{};return{id:t,version:Number.isInteger(e.version)?e.version:1,kind:n,label:typeof e.label=="string"&&e.label.trim()?e.label.trim():void 0,thumbnail:typeof e.thumbnail=="string"?e.thumbnail.trim():"",design:r}}function JGe(e,t=[]){const n=Array.isArray(e?.templates)?e.templates:[],r=new Set,a=n.reduce((i,o)=>{const l=XGe(o);return!l||l.kind==="custom"||r.has(l.id)||(r.add(l.id),i.push(l)),i},[]);return a.length===0?{templates:[...t],defaultId:t[0]?.id||""}:{templates:a,defaultId:a[0].id}}const QGe=["template-4","template-1","template-5","template-2","template-3"],L7=new Map(QGe.map((e,t)=>[e,t])),lc=Object.freeze(KGe.templates.filter(e=>e.kind!=="custom").sort((e,t)=>(L7.get(e.id)??Number.MAX_SAFE_INTEGER)-(L7.get(t.id)??Number.MAX_SAFE_INTEGER))),Kx=lc[0]?.id||"";function ZGe(e,t=lc){return JGe(e,t)}function eYe(e,t=lc){return t.find(n=>n.id===e)||null}let L1=null,iv=null;async function tYe(){const{data:e,error:t}=await Rt.rpc("get_profile_look_presets");if(t)throw new Error(t.message||"Could not load profile looks.");return ZGe(e)}function Oj(){return L1}function G0(){return L1?Promise.resolve(L1):(iv||(iv=tYe().then(e=>(L1=e,e)).catch(e=>{throw iv=null,e})),iv)}const V3="create-profile",sYe=`/#${V3}`;async function DP(e,t){lh("create_expert_start","ge_create_expert_start"),lh("handle_claimed","ge_handle_claimed"),nf(),Z_(),sf(),Pt({screen:"templates",username:e,templateId:"",completed:!1,knowledgeCompleted:!1,publicationConsentAccepted:!1,voiceCompleted:!1,profileBuilt:!1,testCompleted:!1});try{await G0()}catch{}t(Me.CREATE_EXPERT)}function Nc({journey:e}={}){const t=Ps(),{isAuthenticated:n,isLoading:r}=Ut(),{entry:a}=N0(),i=f.useRef(!1),o=e==="business",l=o&&(r||n&&!a),c=n?nK(a):ol;return f.useEffect(()=>{!o||l||!i.current||(i.current=!1,n||Ane(),t(c))},[o,l,n,c,t]),o?l?{to:ol,onClick:u=>{u.preventDefault(),i.current=!0}}:n?{to:c}:{to:c,onClick:Rne}:n?{to:a?.to||gr.builder}:{to:sYe}}const O1={spread:196,tilt:7,drop:20,w:258,h:500,r:30},nYe={spread:88,tilt:9,drop:13,w:156,h:302,r:20},O7=.45,$P="w-[var(--fan-w)] h-[var(--fan-h)] rounded-[var(--fan-r)]",M7=e=>e<640?nYe:O1;function rYe({profile:e,journey:t}){const n=Nc({journey:t});return s.jsxs(Le,{...n,className:`ge-flip relative block ${$P} [perspective:1500px]`,"aria-label":"Create your own profile and AI Expert",children:[s.jsx("span",{className:"ge-face absolute inset-0 overflow-hidden rounded-[var(--fan-r)] border border-rule bg-cream-deep shadow-[0_22px_48px_rgba(20,20,19,0.14),0_4px_10px_rgba(20,20,19,0.06)]",children:s.jsx("img",{src:e.image_url,alt:e.name,loading:"eager",decoding:"sync",draggable:!1,
430className:"pointer-events-none h-full w-full select-none object-cover object-top"})}),s.jsxs("span",{className:"ge-face ge-face-back absolute inset-0 flex flex-col items-center justify-between overflow-hidden rounded-[var(--fan-r)] border border-white/30 bg-gradient-to-b from-indigo via-indigo to-[#6E6EF8] p-3 sm:p-[22px]",children:[s.jsx("span",{className:"pointer-events-none absolute inset-[8px] rounded-[13px] border border-white/40 sm:inset-[14px] sm:rounded-[22px]"}),s.jsx("span",{}),s.jsx(bn,{height:34,variant:"white",className:"relative !h-[21px] w-auto sm:!h-[34px]"}),s.jsx("span",{className:"relative whitespace-nowrap pb-2 text-center text-[8.5px] font-semibold uppercase tracking-[0.16em] text-white sm:pb-3.5 sm:text-xs sm:tracking-[0.2em]",children:"Create yours"})]})]})}function aYe(){return s.jsx("div",{"aria-hidden":"true",className:`block overflow-hidden ${$P} border border-rule bg-gradient-to-b from-cream-deep to-cream-tint shadow-[0_22px_48px_rgba(20,20,19,0.10)]`})}function iYe({profile:e}){const t=s.jsx("img",{src:e.image_url,alt:e.name,loading:"eager",decoding:"sync",width:"258",height:"500",draggable:!1,className:"pointer-events-none h-full w-full select-none object-cover object-top"}),n=`block overflow-hidden ${$P} border border-rule bg-cream-deep shadow-[0_22px_48px_rgba(20,20,19,0.14),0_4px_10px_rgba(20,20,19,0.06)]`;return e.profile_url?s.jsx("a",{href:e.profile_url,className:n,draggable:!1,children:t}):s.jsx("div",{className:n,children:t})}function oYe({profiles:e,topClass:t="top-[272px] sm:top-[224px]",journey:n}){const r=f.useRef(null),a=f.useRef({drag:0,vel:0,dragging:!1,pointerX:0,visible:!0,moved:0});f.useEffect(()=>{const c=r.current;if(!c)return;const u=a.current,d=window.matchMedia?.("(prefers-reduced-motion: reduce)"),h=()=>c.querySelectorAll("[data-fan]");let p=M7(window.innerWidth);const m=()=>{p=M7(window.innerWidth),c.style.setProperty("--fan-w",`${p.w}px`),c.style.setProperty("--fan-h",`${p.h}px`),c.style.setProperty("--fan-r",`${p.r}px`)};m();const g=k=>{const C=h(),N=(C.length-1)/2;C.forEach((A,T)=>{const I=T-N+k,$=I*p.spread,O=Math.abs(I)**1.65*p.drop;A.style.transform=`translate(-50%,0) translate(${$.toFixed(2)}px,${O.toFixed(2)}px) rotate(${(I*p.tilt).toFixed(2)}deg)`,A.style.zIndex=A.hasAttribute("data-fan-top")?"200":String(100-Math.round(Math.abs(I)*10))})};let x;const b=()=>{clearTimeout(x),x=setTimeout(()=>{m(),g(0)},120)};if(window.addEventListener("resize",b),g(0),d?.matches)return()=>{clearTimeout(x),window.removeEventListener("resize",b)};const y=k=>{k.preventDefault(),u.dragging=!0,u.moved=0,u.pointerX=k.clientX,u.vel=0,c.style.cursor="grabbing"},v=k=>{if(!u.dragging)return;const C=k.clientX-u.pointerX;u.moved+=Math.abs(C);const N=C/p.spread;u.pointerX=k.clientX,u.drag=Math.max(-2.2,Math.min(2.2,u.drag+N)),u.vel=N},w=()=>{u.dragging&&(u.dragging=!1,c.style.cursor="grab")},j=k=>{u.moved>6&&(k.preventDefault(),k.stopPropagation()),u.moved=0};c.addEventListener("pointerdown",y),c.addEventListener("dragstart",k=>k.preventDefault()),c.addEventListener("click",j,!0),window.addEventListener("pointermove",v),window.addEventListener("pointerup",w);let E;"IntersectionObserver"in window&&(E=new IntersectionObserver(([k])=>{u.visible=k.isIntersecting},{rootMargin:"120px"}),E.observe(c));let S;const _=k=>{S=requestAnimationFrame(_),!(!u.visible||document.hidden)&&(u.dragging||(u.drag+=u.vel,u.vel*=.93,u.drag*=.955,Math.abs(u.vel)<4e-4&&(u.vel=0)),g(Math.sin(k/1700)*O7+Math.sin(k/2600)*O7*.35+u.drag))};return S=requestAnimationFrame(_),()=>{cancelAnimationFrame(S),clearTimeout(x),E?.disconnect(),c.removeEventListener("pointerdown",y),c.removeEventListener("click",j,!0),window.removeEventListener("resize",b),window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w)}},[e]);const i=e.length?e:Array.from({length:Cke},(c,u)=>({id:`ph-${u}`})),o=Math.floor(i.length/2),l=i.map((c,u)=>c.image_url?u===o?{key:c.id,node:s.jsx(rYe,{profile:c,journey:n}),top:!0}:{key:c.id,node:s.jsx(iYe,{profile:c})}:{key:c.id,node:s.jsx(aYe,{})});return s.jsx("div",{ref:r,style:{"--fan-w":`${O1.w}px`,"--fan-h":`${O1.h}px`,"--fan-r":`${O1.r}px`},className:`absolute inset-x-0 bottom-0 ${t}
430 z-[2] cursor-grab touch-pan-y select-none [&_*]:select-none [&_img]:[-webkit-user-drag:none]`,children:l.map(c=>s.jsx("div",{"data-fan":"",...c.top?{"data-fan-top":""}:{},className:"absolute left-1/2 top-0 h-[var(--fan-h)] w-[var(--fan-w)] will-change-transform",children:c.node},c.key))})}const D7=3,Xb=40;function Jb(e){const t=String(e??"").trim();return t?t.length<D7||t.length>Xb?`Use between ${D7} and ${Xb} characters.`:/^[a-z0-9-]+$/.test(t)?t.startsWith("-")||t.endsWith("-")?"It cannot start or end with a hyphen.":t.includes("--")?"It cannot have two hyphens in a row.":/[a-z]/.test(t)?"":"Include at least one letter.":"Use lowercase letters, numbers and hyphens only.":"Pick a link for your page."}function Mj(e){return String(e??"").trim().toLowerCase().replace(/\s+/g,"-")}const lYe=[e=>`${e}-official`,e=>e.includes("-")?"":`the${e}`,e=>`${e}-ai`,e=>e.includes("-")?"":`${e}hq`,e=>`${e}-studio`,e=>`${e}1`];function cYe(e){const t=String(e||"").trim().toLowerCase(),n=t.replace(/[-0-9]+$/,"");if(!n)return[];const r=new Set([t]),a=[];return lYe.forEach(i=>{const o=i(n);!o||o.length>Xb||r.has(o)||Jb(o)||(r.add(o),a.push(o))}),a}async function uYe(e,{limit:t=3}={}){const n=cYe(e);return n.length?(await Promise.all(n.map(async a=>{try{return(await nR(a)).data?.available?a:""}catch{return""}}))).filter(Boolean).slice(0,t):[]}const dYe="greatexperts.ai/",hYe=["greatexperts.ai","www.greatexperts.ai"];function pYe(e){const t=(e||"").trim();if(!t)return"";const n=t.includes("://")?t:`https://${t}`;try{const r=new URL(n),a=r.hostname.replace(/^www\./,"");if(hYe.includes(a)||a.includes("localhost"))return Mj(r.pathname.replace(/^\/+|\/+$/g,"").split("/")[0]||"")}catch{}return Mj(t.replace(/^@/,"").replace(/^\/+/,"").split(/[/?#\s]/)[0])}function Pne({initialUsername:e="",deferProfileSave:t=!1,previewMode:n=!1,checkAvailability:r=!0,takenUsername:a="",onContinue:i,ctaLabel:o="Continue",variant:l="entry",idPrefix:c="ce-handle"}){const{user:u,updateUser:d}=Ut(),[h,p]=f.useState(e),[m,g]=f.useState(""),[x,b]=f.useState(null),[y,v]=f.useState(!1),[w,j]=f.useState(""),[E,S]=f.useState(""),[_,k]=f.useState([]),[C,N]=f.useState(e),A=l==="home";f.useEffect(()=>{if(t)return;let P=!1;return q_().then(ee=>{if(P)return;const X=ee.data?.user?.username||ee.data?.user?.slug||u?.username||u?.slug||"";g(X),p(ae=>ae||X)}).catch(()=>{!P&&(u?.username||u?.slug)&&(g(u.username||u.slug),p(ee=>ee||u.username||u.slug))}),()=>{P=!0}},[t,u?.username,u?.slug]),f.useEffect(()=>{const P=setTimeout(()=>N(h),500);return()=>clearTimeout(P)},[h]);const T=h?Jb(h):"",I=T&&C===h,O=r&&!n&&!!h&&!T&&!(!!h&&h===m);f.useEffect(()=>{if(!O){b(null);return}let P=!1;const ee=setTimeout(async()=>{try{const X=await nR(h);if(P)return;b({slug:h,available:!!X.data?.available,reason:X.data?.reason||"This username is already taken."})}catch{P||b({slug:h,available:null,reason:""})}},400);return()=>{P=!0,clearTimeout(ee)}},[h,O]);const U=a&&h===a||x&&x.slug===h&&x.available===!1?h:"";f.useEffect(()=>{if(!U){k([]);return}let P=!1;return uYe(U).then(ee=>{P||k(ee)}),()=>{P=!0}},[U]);const F=x&&x.slug===h?x:null,H=!!a&&h===a,G=F?.available===!1||H,M=F?.reason||(H?`greatexperts.ai/${a} was claimed while you were signing up.`:""),z=F?.available===!1&&!u&&!!e&&h===e,D=r&&(!!h&&C!==h||O&&!F),Z=!!h&&!T&&!G&&!D&&!y,V=D||!!T||G,L=P=>{S(""),j(""),p(P),N(P),b({slug:P,available:!0,reason:""}),document.getElementById(c)?.focus()},K=async P=>{if(P.preventDefault(),!Z){A&&!y&&(N(h),S(h?"":"Pick a username to continue."),document.getElementById(c)?.focus());return}S(""),v(!0),j("");try{if(!t&&h!==m){const ee=await ch({username:h}),X=ee.data?.user?.username||ee.data?.user?.slug||h;g(X),p(X),d?.({username:X})}await i?.({username:h})}catch(ee){j(ee.response?.data?.detail?.message||ee.message||"Could not save that link. Please try again.")}finally{v(!1)}},te=s.jsxs("label",{className:`ce-link-field${I||G?" is-error":""}`,htmlFor:c,children:[s.jsx("img",{className:"ce-link-mark-img",src:"/brand/greatexperts-mark-indigo.png",alt:""}),s.jsx("span",{className:"ce-link-prefix",children:dYe}
430),s.jsx("input",{id:c,type:"text",name:"profile-handle",autoComplete:"off","data-1p-ignore":"true","data-lpignore":"true","data-bwignore":"true",spellCheck:!1,autoCapitalize:"none",inputMode:"text",maxLength:Xb,placeholder:"username",value:h,onChange:P=>{S(""),p(pYe(P.target.value))},onBlur:()=>N(h),"aria-label":"Great Experts username","aria-invalid":I||G||void 0,"aria-describedby":`${c}-status`})]}),Q=s.jsx("div",{id:`${c}-status`,className:"ce-link-status",role:"status","aria-live":"polite",children:I?s.jsx("span",{className:"is-error",children:T}):z?s.jsxs("span",{className:"is-error",children:["This username was just claimed. If that was you,"," ",s.jsx(Le,{to:"/login",state:{from:"/experts/new?start=platforms"},children:"log in to continue"}),"."]}):G?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"is-error",children:M}),!u&&s.jsxs("span",{className:"ml-2 text-indigo font-medium",children:["Already yours?"," ",s.jsx(Le,{to:"/login",className:"font-semibold underline hover:text-indigo-deep",children:"Log in"})]})]}):w?s.jsx("span",{className:"is-error",children:w}):E?s.jsx("span",{className:"is-hint",children:E}):null}),Y=G&&_.length?s.jsx("div",{className:"ce-link-suggestions",children:_.map(P=>s.jsxs("button",{type:"button",className:"ce-link-suggestion",onClick:()=>L(P),children:[s.jsx("span",{className:"ce-link-suggestion-prefix",children:"/"}),P]},P))}):null,J=D?s.jsxs("span",{className:"ce-continue-dots",role:"status","aria-label":"Checking availability",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}):o;return A?s.jsxs("form",{autoComplete:"off",id:"create-profile",className:"ge-claim ge-claim-row w-full max-w-[540px]",onSubmit:K,children:[s.jsxs("div",{className:"ge-claim-controls",children:[te,s.jsxs("button",{type:"submit",disabled:y,"aria-disabled":V||void 0,className:"ge-cta ge-claim-submit relative isolate flex items-center justify-center overflow-hidden rounded-pill bg-indigo text-center font-semibold text-cream disabled:pointer-events-none disabled:opacity-60",children:[s.jsx("span",{className:"relative z-[2]",children:y?"Getting started":o}),s.jsx("span",{"aria-hidden":"true",className:"ge-sheen pointer-events-none absolute -bottom-[20%] -top-[20%] left-[-60%] z-[1] w-[38%] -skew-x-[18deg] bg-gradient-to-r from-transparent via-white/40 to-transparent"})]})]}),Q]}):s.jsxs("form",{autoComplete:"off",className:"ce-entry-actions",onSubmit:K,children:[s.jsx("h2",{children:"Claim your smart profile now"}),te,Q,Y,s.jsx(yt,{type:"submit",className:"ce-entry-continue w-full !rounded-pill min-h-[60px]",disabled:!Z,isLoading:y,children:J}),s.jsxs("p",{className:"ce-entry-legal",children:["By signing up, you agree to our ",s.jsx(Le,{to:"/terms",children:"Terms of Service"})," ","and ",s.jsx(Le,{to:"/privacy",children:"Privacy Policy"}),"."]})]})}function mYe({profiles:e,title:t=s.jsxs(s.Fragment,{children:["A link in bio that answers, ",s.jsx("span",{className:"text-indigo",children:"and sells."})]}),subtitle:n=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"font-medium text-ink",children:"Everything you sell in one place,"})," with an AI Expert that talks to your audience, recommends the right thing, and answers at 2am."]}),twoLineTitle:r=!1,claimHandle:a=!1,journey:i}){const{isAuthenticated:o,isLoading:l}=Ut(),c=Ps(),u=a&&!o&&!l;f.useEffect(()=>{u&&G0().catch(()=>{})},[u]),f.useEffect(()=>{u&&window.location.hash===`#${V3}`&&document.getElementById(V3)?.scrollIntoView({behavior:"smooth",block:"center"})},[u]);const d=u?"h-[800px] sm:h-[896px]":`h-[640px] ${r?"sm:h-[824px]":"sm:h-[760px]"}`,h=u?"top-[390px] sm:top-[360px]":r?"top-[272px] sm:top-[288px]":void 0;return s.jsx("div",{className:"relative z-[1] overflow-hidden",children:s.jsxs("div",{className:`relative ${d}`,children:[s.jsxs("div",{className:"relative z-[3] flex flex-col items-center gap-5 px-5 pt-10 text-center sm:gap-6 sm:px-14 sm:pt-[46px]",children:[s.jsx("h1",{className:"m-0 max-w-[1080px] text-balance font-heading text-[36px] font-medium leading-[1.08] tracking-[-0.02em] text-ink sm:text-[clamp(30px,7.2vw,58px)] xl:whitespace-nowrap",children:t}),s.jsx("p",{className:"m-0 w-full max-w-[540px] text-[15.5px] font-normal leading-[1.45] tracking-[-0.012em] text-ink-muted sm:max-w-[700px] sm:text-[18px] sm:leading-[1.5]",children:n}),u?s.jsx(Pne,{variant:"home",deferProfileSave:!0,checkAvailability:!1,idPrefix:"home-handle",ctaLabel:"Get started for free",onContinue:({username:p})=>DP(p,c)}):null]}),s.jsx(oYe,{profiles:e,topClass:h,journey:i}),s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 z-[3] h-[90px] bg-gradient-to-b from-transparent via-cream/50 to-cream sm:h-[120px]"})]})})}function fYe({lead:e=s.jsx(s.Fragment,{children:"It knows everything you have published. It answers in your voice, in any language, and recommends the right session or product."}),ctaLabel:t="Create my profile with AI Expert for free",reassurance:n="Built only from your own material. Nothing is trained on it. Delete it any time.",journey:r}){const a=Nc({journey:r});return s.jsxs("div",{className:"px-5 sm:px-8",children:[s.jsxs("div",{className:"mx-auto mb-3.5 mt-9 flex max-w-[1000px] flex-col items-center gap-9 text-center sm:gap-[52px]",children:[s.jsx("p",{className:"m-0 text-pretty text-lg leading-[1.5] text-ink-mid sm:text-[25px]",children:e}),s.jsxs(Le,{...a,className:"ge-cta relative isolate flex w-full max-w-[620px] items-center justify-center overflow-hidden rounded-pill border border-white/40 bg-indigo px-8 py-5 text-center text-[15px] font-bold uppercase tracking-[0.12em] text-cream transition-transform duration-base ease-standard hover:-translate-y-0.5 active:translate-y-0 sm:px-10 sm:py-[26px] sm:text-[17px]",children:[s.jsx("span",{className:"relative z-[2]",children:t}),s.jsx("span",{"aria-hidden":"true",className:"ge-sheen pointer-events-none absolute -bottom-[20%] -top-[20%] left-[-60%] z-[1] w-[38%] -skew-x-[18deg] bg-gradient-to-r from-transparent via-white/40 to-transparent"})]})]}),s.jsx("p",{className:"mx-auto mb-12 max-w-[620px] text-center text-[15px] font-normal leading-[1.6] text-ink-mid sm:mb-[54px] sm:text-[17px]",children:n})]})}const gYe={clock:Rf,phone:Ts,mic:Qr,bag:Mf,link:$a,target:SY,inbox:A_,check:pc,download:Eh,layers:Pve,chart:yb,calendar:D0e,languages:P4,reply:a1e,shield:Vh,upload:Lw,help:bye,tag:bwe,globe:vc,palette:Pf,zap:oje},xYe="bg-indigo-wash text-indigo";function bYe({points:e}){return s.jsx("ul",{className:"m-0 mt-1 hidden list-none flex-col gap-3 p-0 lg:flex",children:e.map(t=>{const n=gYe[t.icon];return s.jsxs("li",{className:"flex items-center gap-3",children:[s.jsx("span",{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-pill ${xYe}`,children:n&&s.jsx(n,{className:"h-[18px] w-[18px]",strokeWidth:2,"aria-hidden":"true"})}),s.jsx("span",{className:"text-[15px] font-medium leading-[1.4] text-ink",children:t.label})]},t.label)})})}const yYe="block h-auto w-full max-w-none";function vYe({n:e,phone:t,imgDir:n,shot:r}){return s.jsxs("div",{className:"relative px-6 pb-7 lg:py-8 lg:pl-0 lg:pr-8",children:[s.jsx("img",{src:`${n}/job-${e}.webp`,alt:"",width:r.width,height:r.height,loading:"lazy",decoding:"async",className:yYe}),t&&s.jsx("div",{className:"absolute bottom-0 left-3 hidden aspect-[2/3] w-[18%] translate-y-[38%] overflow-hidden rounded-[22px] bg-gradient-to-br from-indigo/80 via-indigo-wash to-peach-deep/70 p-[3px] shadow-[0_22px_50px_-16px_rgba(61,61,245,0.45)] sm:block lg:-left-6",children:s.jsx("img",{src:t,alt:"",width:"670",height:"877",loading:"lazy",decoding:"async",className:"block h-full w-full rounded-[19px] bg-paper object-cover object-top"})})]})}function wYe({job:e,index:t,imgDir:n,shot:r}){return s.jsx("article",{className:"ge-stackrow",style:{"--i":t},children:s.jsxs("div",{className:"grid grid-cols-1 items-start gap-6 lg:items-center overflow-hidden rounded-[20px] border-[1.5px] border-cream-tint bg-paper shadow-[0_-8px_20px_-12px_rgba(20,20,19,0.10)] lg:grid-cols-[minmax(0,0.82fr)_minmax(0,1.18fr)] lg:gap-8",children:[s.jsxs("div",{className:"flex flex-col gap-3.5 px-6 pt-7 lg:py-10 lg:pl-11 lg:pr-0",children:[s.jsx("span",{className:"flex h-[38px] w-[38px] items-center justify-center rounded-pill bg-indigo font-mono text-[13px] font-medium tracking-[0.04em] text-white shadow-[0_8px_18px_-8px_rgba(61,61,245,0.75)]",children:e.n}),s.jsx("h3",{className:"m-0 text-balance font-heading text-[clamp(23px,2vw,32px)] font-medium leading-[1.13] tracking-[-0.018em] text-ink",children:e.title}),s.jsx("p",{className:"m-0 max-w-[38ch] text-pretty text-[15px] font-normal leading-[1.6] text-ink-mid lg:text-base",children:e.detail}),e.points&&s.jsx(bYe,{points:e.points})]}),s.jsx(vYe,{n:e.n,phone:e.phone,imgDir:n,shot:r})]})})}const jYe={title:s.jsxs(s.Fragment,{children:["Are you ready to ",s.jsx("em",{className:"not-italic text-indigo",children:"create?"})]}),text:"Set it up once. It keeps working every hour you are not.",label:"Create my profile + AI Expert",note:"Free to start. No card needed."},_Ye={width:1600,height:783};
430function kYe({jobs:e=Tke,imgDir:t="/home/jobs",shot:n=_Ye,closing:r=jYe,journey:a}){const i=Nc({journey:a});return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"mb-7 w-full rounded-[28px] border border-rule bg-cream-deep p-6 pt-8 sm:p-10 sm:pt-11 lg:p-14 lg:pt-12",children:[s.jsx("div",{className:"ge-stackhead mb-8 sm:mb-[34px]",children:s.jsxs("h2",{className:"m-0 max-w-[22ch] font-heading text-[clamp(28px,4vw,56px)] font-medium leading-[1.06] tracking-[-0.02em] text-ink",children:["It does six jobs. ",s.jsx("em",{className:"not-italic text-indigo",children:"All at once."})]})}),s.jsx("div",{className:"ge-stack",children:e.map((o,l)=>s.jsx(wYe,{job:o,index:l,imgDir:t,shot:n},o.n))})]}),s.jsxs("div",{className:"mb-7 flex flex-col items-center gap-5 rounded-[28px] border-[1.5px] border-indigo/25 bg-indigo-wash/70 px-6 py-10 text-center sm:px-10 sm:py-12",children:[s.jsx("h3",{className:"m-0 max-w-[24ch] text-balance font-heading text-[clamp(26px,3vw,40px)] font-medium leading-[1.1] tracking-[-0.02em] text-ink",children:r.title}),s.jsx("p",{className:"m-0 max-w-[62ch] text-pretty text-[15px] leading-[1.6] text-ink-mid sm:text-base",children:r.text}),s.jsxs(Le,{...i,className:"ge-cta relative isolate flex w-full max-w-[440px] items-center justify-center overflow-hidden whitespace-nowrap rounded-pill border border-white/40 bg-indigo px-5 py-[18px] text-center text-[11.5px] font-bold uppercase tracking-[0.07em] text-cream transition-transform duration-base ease-standard hover:-translate-y-0.5 active:translate-y-0 sm:px-8 sm:text-[13.5px] sm:tracking-[0.11em]",children:[s.jsx("span",{className:"relative z-[2]",children:r.label}),s.jsx("span",{"aria-hidden":"true",className:"ge-sheen pointer-events-none absolute -bottom-[20%] -top-[20%] left-[-60%] z-[1] w-[38%] -skew-x-[18deg] bg-gradient-to-r from-transparent via-white/40 to-transparent"})]}),s.jsx("p",{className:"m-0 text-[13.5px] leading-[1.5] text-ink-muted",children:r.note})]})]})}const Y0={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function NYe(e){return s.jsx("svg",{...Y0,...e,children:s.jsx("path",{d:"M4.98 3.5a2 2 0 1 1-.01 4 2 2 0 0 1 .01-4zM3.4 8.9h3.15V21H3.4zM9.3 8.9h3.02v1.65h.04c.42-.8 1.45-1.65 2.99-1.65 3.2 0 3.79 2.1 3.79 4.84V21h-3.15v-6.16c0-1.47-.03-3.36-2.05-3.36-2.05 0-2.36 1.6-2.36 3.25V21H9.3z",fill:"currentColor",stroke:"none"})})}function EYe(e){return s.jsxs("svg",{...Y0,...e,children:[s.jsx("rect",{x:"3.2",y:"3.2",width:"17.6",height:"17.6",rx:"5"}),s.jsx("circle",{cx:"12",cy:"12",r:"4"}),s.jsx("path",{d:"M17.2 6.9h.01"})]})}function SYe(e){return s.jsx("svg",{...Y0,...e,children:s.jsx("path",{d:"M13.5 21v-7.4h2.6l.4-3h-3V8.7c0-.87.24-1.46 1.5-1.46h1.6V4.56A21 21 0 0 0 14.3 4.4c-2.3 0-3.9 1.4-3.9 4v2.2H7.9v3h2.5V21z",fill:"currentColor",stroke:"none"})})}function CYe(e){return s.jsx("svg",{...Y0,...e,children:s.jsx("path",{d:"M14.2 3h2.5c.2 1.6 1.1 2.9 2.9 3.2v2.6a6.3 6.3 0 0 1-2.9-.9v5.9a5.6 5.6 0 1 1-5.6-5.6c.3 0 .6 0 .9.1v2.7a2.9 2.9 0 1 0 2 2.8z",fill:"currentColor",stroke:"none"})})}function TYe(e){return s.jsxs("svg",{...Y0,...e,children:[s.jsx("rect",{x:"2.8",y:"5.6",width:"18.4",height:"12.8",rx:"4"}),s.jsx("path",{d:"M10.6 9.6l5 2.4-5 2.4z",fill:"currentColor",stroke:"none"})]})}const AYe={linkedin:NYe,instagram:EYe,facebook:SYe,tiktok:CYe,youtube:TYe};function RYe({sources:e}){return s.jsx("div",{className:"mt-2 grid w-full min-w-0 max-w-[230px] grid-cols-5 items-center gap-2",children:e.map(t=>{const n=AYe[t];return s.jsx("span",{title:t,className:"flex aspect-square w-full items-center justify-center rounded-pill border border-rule bg-paper text-indigo",children:s.jsx(n,{className:"h-[55%] w-[55%]"})},t)})})}function IYe({steps:e=Ake}){return s.jsxs("section",{className:"w-full rounded-[28px] border border-rule bg-paper p-6 sm:p-10 lg:p-14",children:[s.jsxs("h2",{className:"m-0 max-w-[20ch] font-heading text-[clamp(28px,4vw,56px)] font-medium leading-[1.06] tracking-[-0.02em] text-ink",children:["See how ",s.jsx("em",{className:"not-italic text-indigo",children:"simple"})," it is."]}),s.jsxs("div",{className:"relative mt-9 sm:mt-11",children:[s.jsx("div",{"aria-hidden":"true",className:"absolute left-7 right-0 top-[26px] hidden h-[5px] rounded-pill bg-rule xl:block"}),s.jsx("div",{"aria-hidden":"true",className:"ge-flowfill absolute left-7 right-0 top-[26px] hidden h-[5px] rounded-pill bg-indigo xl:block"}),s.jsx("ol",{className:"relative m-0 grid list-none grid-cols-1 items-stretch gap-x-6 gap-y-11 p-0 sm:grid-cols-2 xl:grid-cols-4",children:e.map(t=>s.jsxs("li",{className:"flex min-w-0 flex-col gap-5",children:[s.jsx("span",{className:"hidden h-14 w-14 items-center justify-center rounded-pill bg-indigo font-mono text-sm font-medium tracking-[0.04em] text-white shadow-[0_12px_26px_-12px_rgba(61,61,245,0.75)] xl:flex",children:t.n}),s.jsxs("div",{className:"flex flex-1 flex-col gap-3 rounded-2xl border-[1.5px] border-indigo/20 bg-white/70 px-6 py-6 shadow-[0_18px_40px_-22px_rgba(20,20,19,0.26),inset_0_1px_0_rgba(255,255,255,0.85)] backdrop-blur-lg backdrop-saturate-150",children:[s.jsxs("div",{className:"font-mono text-[13px] font-medium uppercase tracking-eyebrow text-indigo",children:["Step ",t.n]}),s.jsx("h3",{className:"m-0 text-pretty font-heading text-[22px] font-medium leading-[1.2] tracking-[-0.015em] text-ink",children:t.title}),s.jsx("p",{className:"m-0 text-pretty text-base font-normal leading-[1.6] text-ink-mid",children:t.text}),t.sources&&s.jsx(RYe,{sources:t.sources})]})]},t.n))})]})]})}const Lne="mt-auto rounded-pill border-[1.5px] px-4 py-4 text-center text-xs font-semibold uppercase tracking-[0.1em] transition-colors duration-base ease-standard",$7=`${Lne} border-indigo bg-paper text-indigo hover:bg-indigo hover:text-cream`,PYe=["lite","starter","pro"];
430function One({billing:e,onChange:t}){const n=r=>`rounded-pill px-5 py-[11px] text-[13px] font-semibold tracking-[0.04em] transition-colors duration-base ease-standard ${e===r?"bg-indigo text-cream":"text-ink-mid hover:text-ink"}`;return s.jsx("div",{className:"flex justify-center",children:s.jsxs("div",{role:"group","aria-label":"Billing period",className:"inline-flex items-center gap-1 rounded-pill border border-cream-tint bg-paper p-[5px] shadow-subtle",children:[s.jsx("button",{type:"button",onClick:()=>t("monthly"),className:n("monthly"),"aria-pressed":e==="monthly",children:"Monthly"}),s.jsx("button",{type:"button",onClick:()=>t("annual"),className:n("annual"),"aria-pressed":e==="annual",children:"Annual"})]})})}function LYe({plan:e,billing:t,ctaProps:n}){const r=t==="annual"?e.annual:e.monthly,a=t==="annual"&&e.annual!==e.monthly;return s.jsxs("div",{className:`ge-plan relative mx-auto flex w-full max-w-[430px] flex-col rounded-[24px] p-5 transition-[border-color,box-shadow] duration-base ease-standard hover:border-indigo hover:shadow-[0_34px_66px_-30px_rgba(61,61,245,0.45)] min-[900px]:max-w-none min-[1180px]:p-[26px] ${e.featured?"border-[1.5px] border-indigo bg-paper shadow-[0_26px_56px_-28px_rgba(61,61,245,0.55)]":"border-[1.5px] border-cream-tint bg-paper"}`,children:[s.jsxs("div",{className:"flex items-center justify-between gap-2.5",children:[s.jsx("h3",{className:"m-0 font-heading text-[22px] font-medium leading-[1.2] tracking-[-0.015em] text-ink",children:e.name}),e.badge&&s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-pill border border-indigo/25 bg-indigo/[0.09] px-2.5 py-[5px] font-mono text-[9.5px] font-bold uppercase tracking-[0.11em] text-indigo",children:[s.jsx(kb,{className:"h-[11px] w-[11px] fill-indigo stroke-none","aria-hidden":"true"}),e.badge]})]}),s.jsx("p",{className:"mb-4 mt-1 min-h-[42px] text-sm leading-[1.5] text-ink-mid",children:e.blurb}),s.jsxs("div",{className:"mb-1 flex items-baseline gap-1",children:[s.jsx("span",{className:"font-heading text-[38px] font-medium tracking-[-0.02em] text-ink",children:r}),e.period&&s.jsx("span",{className:"text-[13px] text-ink-muted",children:e.period})]}),s.jsx("div",{className:"mb-[18px] min-h-[36px] border-b border-rule pb-[18px] text-[12.5px] text-ink-muted",children:a?s.jsxs(s.Fragment,{children:["Billed annually, or ",e.monthly," monthly"]}):e.note}),s.jsx("ul",{className:"m-0 mb-6 flex list-none flex-col gap-2.5 p-0",children:e.features.map(i=>s.jsxs("li",{className:"flex items-start gap-2.5 text-[14.5px] leading-[1.5] text-ink-soft",children:[s.jsx(ft,{className:"mt-[3px] h-3.5 w-3.5 shrink-0 text-indigo",strokeWidth:2.6,"aria-hidden":"true"}),i]},i))}),e.contact?s.jsx("a",{href:Qm,target:"_blank",rel:"noopener noreferrer",className:$7,children:e.cta}):s.jsx(Le,{...n,className:e.featured?`${Lne} border-indigo bg-indigo text-cream hover:border-indigo-deep hover:bg-indigo-deep`:$7,children:e.cta})]})}function F7({plan:e,ctaProps:t,highlight:n=!1}){const r=e.contact?s.jsxs("a",{href:Qm,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center justify-center gap-2 rounded-pill border-[1.5px] border-ink bg-paper px-6 py-[15px] text-xs font-semibold uppercase tracking-[0.1em] text-ink transition-colors duration-base ease-standard hover:bg-ink hover:text-cream",children:[e.cta,s.jsx(xn,{className:"h-4 w-4",strokeWidth:2.2,"aria-hidden":"true"})]}):s.jsx(Le,{...t,className:`inline-flex shrink-0 items-center justify-center rounded-pill border-[1.5px] px-7 py-[15px] text-xs font-semibold uppercase tracking-[0.1em] transition-colors duration-base ease-standard ${n?"border-indigo bg-indigo text-cream hover:border-indigo-deep hover:bg-indigo-deep":"border-indigo bg-paper text-indigo hover:bg-indigo hover:text-cream"}`,children:e.cta});return s.jsxs("div",{className:"flex flex-col gap-5 rounded-[20px] border-[1.5px] border-cream-tint bg-paper p-6 sm:flex-row sm:items-center sm:justify-between sm:gap-8 sm:p-7",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1.5",children:[s.jsx("h3",{className:"m-0 font-heading text-[26px] font-medium tracking-[-0.018em] text-ink",children:e.name}),s.jsx("span",{className:"text-[14.5px] leading-[1.5] text-ink-mid",children:e.rowBlurb||e.blurb})]}),s.jsx("ul",{className:"m-0 mt-3 flex list-none flex-col gap-2 p-0 sm:flex-row sm:flex-wrap sm:gap-x-6 sm:gap-y-2",children:e.features.map(a=>s.jsxs("li",{className:"flex items-start gap-2 text-[14px] leading-[1.5] text-ink-soft",children:[s.jsx(ft,{className:"mt-[3px] h-3.5 w-3.5 shrink-0 text-indigo",strokeWidth:2.6,"aria-hidden":"true"}),a]},a))})]}),r]})}function Mne({billing:e,ctaProps:t}){const n=Tm.filter(i=>PYe.includes(i.id)),r=Tm.find(i=>i.id==="free"),a=Tm.find(i=>i.id==="enterprise");return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-1 gap-3.5 min-[900px]:grid-cols-3",children:n.map(i=>s.jsx(LYe,{plan:i,billing:e,ctaProps:t},i.id))}),s.jsxs("div",{className:"mt-3.5 flex flex-col gap-3.5",children:[r&&s.jsx(F7,{plan:r,ctaProps:t,highlight:!0}),a&&s.jsx(F7,{plan:a,ctaProps:t})]})]})}function OYe({tagline:e=s.jsxs(s.Fragment,{children:[s.jsx("strong",{className:"font-semibold text-ink",children:"0% commission, always."})," You keep 100% of what you earn."]}),checkoutNote:t=s.jsxs(s.Fragment,{children:[s.jsx("strong",{className:"font-semibold text-ink",children:"Secure checkout by Stripe."})," The free trial needs no card at all, and we never store your card details. Want people to pay for access instead? You set the price, we handle the payments, and you keep 70%."]}),journey:n}){const r=Nc({journey:n}),[a,i]=f.useState("annual");return s.jsxs("section",{id:"pricing",className:"mx-auto mb-7 max-w-[1340px] scroll-mt-24 rounded-[28px] border-[1.5px] border-indigo/20 bg-indigo-wash/55 p-6 shadow-[0_22px_50px_-28px_rgba(20,20,19,0.24),inset_0_1px_0_rgba(255,255,255,0.8)] backdrop-blur-xl backdrop-saturate-150 sm:p-10 min-[1180px]:p-8 min-[1440px]:p-14",children:[s.jsxs("div",{className:"mb-8 flex flex-col items-center gap-4 text-center sm:mb-10",children:[s.jsxs("h2",{className:"m-0 max-w-[26ch] font-heading text-[clamp(28px,4vw,56px)] font-medium leading-[1.1] tracking-[-0.02em] text-ink",children:["Pick your ",s.jsx("em",{className:"not-italic text-indigo",children:"plan."})]}),s.jsx("p",{className:"m-0 text-[17px] font-normal leading-[1.55] text-ink-mid sm:text-lg",children:e}),s.jsx(One,{billing:a,onChange:i})]}),s.jsx(Mne,{billing:a,ctaProps:r}),s.jsxs("div",{className:"mt-8 flex flex-col items-center gap-4 border-t border-rule pt-7 text-center",children:[s.jsxs(Le,{to:gr.pricing,className:"inline-flex items-center gap-2 font-heading text-lg font-medium text-indigo underline decoration-indigo/30 decoration-1 underline-offset-[5px] transition-colors duration-base ease-standard hover:text-indigo-deep hover:decoration-indigo",children:["Compare every plan and limit",s.jsx(xn,{className:"h-[18px] w-[18px]",strokeWidth:2.2,"aria-hidden":"true"})]}),s.jsx("p",{className:"m-0 max-w-[100ch] text-pretty text-[14.5px] font-normal leading-[1.6] text-ink-mid",children:t})]})]})}function B7({images:e,direction:t,framed:n}){return s.jsx("div",{className:"relative overflow-hidden",children:s.jsx("div",{className:`absolute inset-x-0 top-0 ${t==="up"?"ge-vtrack-up":"ge-vtrack"}`,children:[...e,...e].map((r,a)=>s.jsx("div",{className:n?"pb-[18px]":"pb-4",children:s.jsx("img",{src:r,alt:"","aria-hidden":"true",loading:"lazy",draggable:!1,
430className:`pointer-events-none w-full select-none object-cover object-top ${n?"aspect-[0.545] rounded-[22px] border-[1.5px] border-cream-tint bg-paper shadow-[0_18px_40px_-26px_rgba(20,20,19,0.35)]":"aspect-[258/500] rounded-xl"}`})},`${r}-${a}`))})})}function MYe(e){const t=[],n=[],r=[];return e.forEach(a=>{const i=a.gender?.toLowerCase();i==="female"?t.push(a.image_url):i==="male"?n.push(a.image_url):r.push(a.image_url)}),r.forEach((a,i)=>(i%2?n:t).push(a)),{left:t,right:n}}function Dne({profiles:e,framed:t=!1}){const{left:n,right:r}=MYe(e);return n.length===0&&r.length===0?null:s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none relative h-[260px] select-none overflow-hidden lg:h-auto",style:{maskImage:"linear-gradient(to bottom, rgba(0,0,0,0) 0%, #000 12%, #000 88%, rgba(0,0,0,0) 100%)",WebkitMaskImage:"linear-gradient(to bottom, rgba(0,0,0,0) 0%, #000 12%, #000 88%, rgba(0,0,0,0) 100%)"},children:s.jsxs("div",{className:"absolute bottom-0 left-5 right-5 top-0 grid grid-cols-[repeat(2,minmax(0,124px))] justify-center gap-3 lg:left-0 lg:right-5 lg:justify-end xl:right-7 xl:grid-cols-[repeat(2,minmax(0,158px))] xl:gap-4",children:[s.jsx(B7,{images:n,direction:"down",framed:t}),s.jsx(B7,{images:r,direction:"up",framed:t})]})})}function DYe({profiles:e,title:t="Your whole world, in one page.",accent:n="With an AI Expert answering in your voice.",ctaLabel:r="Iâm ready to create",journey:a}){const i=Nc({journey:a});return s.jsxs("section",{className:"relative mx-auto mb-7 grid max-w-[1340px] grid-cols-1 overflow-hidden rounded-[28px] border-[1.5px] border-cream-tint bg-[#F4F4FD]/90 lg:min-h-[320px] lg:grid-cols-[minmax(0,1.35fr)_minmax(200px,420px)] xl:min-h-[340px] xl:grid-cols-[minmax(0,1.4fr)_minmax(230px,420px)]",children:[s.jsxs("div",{className:"flex flex-col items-center justify-center gap-7 p-6 text-center sm:p-10 lg:items-start lg:p-14 lg:text-left",children:[s.jsxs("h2",{className:"m-0 font-heading font-medium tracking-[-0.02em] text-ink",children:[s.jsx("span",{className:"block text-balance text-[clamp(26px,3.4vw,46px)] leading-[1.08]",children:t}),s.jsx("em",{className:"mt-1.5 block text-balance text-[clamp(17px,2.3vw,32px)] xl:whitespace-nowrap italic leading-[1.15] text-indigo",children:n})]}),s.jsxs("div",{className:"flex w-full flex-col items-stretch justify-center gap-3 sm:w-auto sm:flex-row sm:flex-wrap sm:items-center lg:justify-start",children:[s.jsxs(Le,{...i,className:"ge-cta relative isolate flex items-center justify-center overflow-hidden rounded-pill border border-white/40 bg-indigo whitespace-nowrap px-6 py-4 text-center text-[11.5px] font-bold uppercase tracking-[0.08em] sm:px-8 sm:text-xs lg:tracking-[0.12em] xl:px-[38px] xl:py-[23px] xl:text-sm xl:tracking-[0.14em] text-cream transition-transform duration-base ease-standard hover:-translate-y-0.5 active:translate-y-0",children:[s.jsx("span",{className:"relative z-[2]",children:r}),s.jsx("span",{"aria-hidden":"true",className:"ge-sheen pointer-events-none absolute -bottom-[20%] -top-[20%] left-[-60%] z-[1] w-[38%] -skew-x-[18deg] bg-gradient-to-r from-transparent via-white/40 to-transparent"})]}),s.jsx("a",{href:Qm,target:"_blank",rel:"noopener noreferrer",className:"rounded-pill border-[1.5px] border-ink bg-white whitespace-nowrap px-6 py-4 text-center text-[11.5px] font-bold uppercase tracking-[0.08em] sm:px-8 sm:text-xs lg:tracking-[0.12em] xl:px-[38px] xl:py-[23px] xl:text-sm xl:tracking-[0.14em] text-ink transition-colors duration-base ease-standard hover:bg-ink hover:text-cream",children:"Not sure yet? Let's talk"})]})]}),s.jsx(Dne,{profiles:e})]})}function $Ye({items:e=Ike}){return s.jsxs("section",{id:"faq",className:"mx-auto mb-7 flex max-w-[1080px] scroll-mt-24 flex-col gap-6 px-5 py-10 sm:px-0",children:[s.jsxs("h2",{className:"m-0 font-heading text-[clamp(28px,4vw,52px)] font-medium leading-[1.08] tracking-[-0.02em] text-ink",children:["Questions people ask ",s.jsx("em",{className:"not-italic text-indigo",children:"before they start."})]}),s.jsx("div",{className:"flex flex-col gap-3",children:e.map(t=>s.jsxs("details",{className:"ge-acc rounded-2xl border border-rule bg-paper/70 transition-colors duration-base ease-standard hover:border-indigo/30 open:border-indigo/40 open:bg-[#F4F4FD]",children:[s.jsxs("summary",{className:"flex items-center gap-4 px-5 py-5 sm:px-7",children:[s.jsx("span",{className:"font-mono text-[11px] font-semibold tracking-[0.12em] text-ink-light",children:t.n}),s.jsx("span",{className:"flex-1 font-heading text-[17px] font-medium leading-[1.3] tracking-[-0.01em] text-ink sm:text-xl",children:t.q}),s.jsx("span",{className:"ge-acc-sign flex h-8 w-8 shrink-0 items-center justify-center rounded-pill border border-rule text-ink-mid",children:s.jsx(Es,{className:"h-4 w-4","aria-hidden":"true"})})]}),s.jsx("div",{className:"ge-acc-body px-5 pb-6 sm:px-7 sm:pl-[68px]",children:s.jsx("p",{className:"m-0 max-w-[86ch] text-[15px] leading-[1.65] text-ink-mid sm:text-base",children:t.a})})]},t.n))})]})}
430function $ne({eyebrow:e="For business",sentence:t=s.jsxs(s.Fragment,{children:["Running a company? Great Experts works on"," ",s.jsx("em",{className:"italic text-indigo",children:"your website"})," too."]}),to:n=gr.business,ctaLabel:r="See how"}){return s.jsxs("section",{id:"business",className:"mx-auto mb-7 flex max-w-[1340px] scroll-mt-24 flex-col items-start gap-6 rounded-[26px] border border-rule/95 bg-[#F4F4FD]/80 px-6 py-8 shadow-[inset_0_1px_0_rgba(255,255,255,0.95),0_20px_44px_-24px_rgba(60,50,120,0.40)] backdrop-blur-lg backdrop-saturate-150 sm:px-8 xl:flex-row xl:items-center xl:gap-4 xl:px-6 xl:py-5",children:[s.jsx("span",{className:"inline-flex shrink-0 items-center whitespace-nowrap rounded-pill border border-indigo/35 bg-indigo/[0.07] px-4 py-2 font-mono text-[11px] font-medium uppercase tracking-eyebrow text-indigo",children:e}),s.jsxs("div",{className:"flex w-full min-w-0 flex-col items-start gap-6 sm:flex-row sm:items-center sm:justify-between sm:gap-6",children:[s.jsx("p",{className:"m-0 min-w-0 font-heading text-[19px] font-medium leading-[1.26] tracking-[-0.015em] text-ink sm:text-[23px]",children:t}),s.jsxs(Le,{to:n,className:"inline-flex shrink-0 items-center justify-center gap-[9px] rounded-pill bg-indigo px-[26px] py-3.5 text-[12.5px] font-bold uppercase tracking-[0.12em] text-cream transition-colors duration-base ease-standard hover:bg-indigo-deep",children:[r,s.jsx("span",{"aria-hidden":"true",className:"text-sm",children:"â"})]})]})]})}const JE="inline-flex min-h-11 items-center text-[15px] text-ink-mid transition-colors duration-base ease-standard hover:text-indigo";function FYe(){return s.jsxs("svg",{viewBox:"0 0 12 8",className:"h-3 w-[18px] rounded-[2px] ring-1 ring-ink/10","aria-hidden":"true",children:[s.jsx("rect",{width:"12",height:"8",fill:"#fff"}),s.jsx("rect",{width:"12",height:"2.67",fill:"#00732F"}),s.jsx("rect",{y:"5.33",width:"12",height:"2.67",fill:"#000"}),s.jsx("rect",{width:"3",height:"8",fill:"#FF0000"})]})}function Fne(){return s.jsx("footer",{className:"px-5 pb-10 pt-12 sm:px-8 lg:px-14",children:s.jsxs("div",{className:"mx-auto flex max-w-[1340px] flex-col items-start gap-6 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{className:"flex flex-col items-start gap-2.5 sm:flex-row sm:items-center sm:gap-4",children:[s.jsx(Le,{to:gr.home,className:"inline-flex","aria-label":"Great Experts home",children:s.jsx(bn,{height:34})}),s.jsx("span",{className:"hidden h-4 w-px bg-rule sm:block","aria-hidden":"true"}),s.jsxs("span",{className:"group inline-flex items-center text-[13px] font-medium text-ink-muted",children:[s.jsx("span",{className:"sr-only",children:"Proudly made in UAE with love"}),s.jsxs("span",{className:"inline-flex items-center gap-1.5","aria-hidden":"true",children:["Proudly made in UAE",s.jsx(FYe,{}),s.jsx(xve,{className:"h-3.5 w-3.5 fill-indigo text-indigo transition-transform duration-base ease-standard group-hover:-rotate-12 group-hover:scale-125 motion-reduce:transform-none motion-reduce:transition-none",strokeWidth:2})]})]})]}),s.jsxs("nav",{className:"flex flex-wrap items-center gap-x-7 gap-y-2","aria-label":"Footer",children:[s.jsx(Le,{to:gr.home,className:JE,children:"Home"}),s.jsx(Le,{to:gr.terms,className:JE,children:"Terms & Conditions"}),s.jsx(Le,{to:gr.privacy,className:JE,children:"Privacy Policy"})]})]})})}const U7="/widget/widget.js";function FP(){return f.useEffect(()=>{if(document.querySelector(`script[src="${U7}"]`))return;const e=document.createElement("script");e.src=U7,e.async=!0,e.addEventListener("error",()=>e.remove(),{once:!0}),document.body.appendChild(e)},[]),s.jsx(s.Fragment,{children:s.jsx("great-experts-chat",{"widget-key":"ge_0f1eea0401","api-base":Hr})})}const Bne="landing_profiles";function Une(){try{return JSON.parse(localStorage.getItem(Bne))||[]}catch{return[]}}async function zne(){const{data:e,error:t}=await Rt.from("landing_profiles").select("id, name, image_url, profile_url, priority, gender").eq("is_active",!0).order("priority");if(t)throw new Error(t.message);const n=e||[];try{localStorage.setItem(Bne,JSON.stringify(n))}catch{}return n}function BYe(){const[e,t]=f.useState([]);return f.useEffect(()=>{const n=Une();n.length&&t(n),zne().then(r=>{r.length&&t(r)}).catch(r=>console.error("Landing profiles failed to load:",r))},[]),s.jsxs("div",{className:"relative -mx-4 -mb-4 bg-cream text-ink lg:-mx-6 lg:-mb-6",children:[s.jsx(vs,{path:"/"}),s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 top-0 z-0 h-[1100px] bg-[radial-gradient(900px_620px_at_8%_-6%,rgba(61,61,245,0.10)_0%,rgba(61,61,245,0)_62%),radial-gradient(820px_560px_at_96%_2%,rgba(230,195,179,0.30)_0%,rgba(230,195,179,0)_64%)]"}),s.jsx("div",{className:"sticky top-0 z-30 px-4 pt-3 sm:px-6 sm:pt-4 lg:px-10",children:s.jsx(Ine,{})}),s.jsx(mYe,{profiles:e,claimHandle:!0}),s.jsxs("div",{className:"px-4 sm:px-6 lg:px-10",children:[s.jsx(fYe,{}),s.jsxs("div",{className:"mx-auto mb-7 max-w-[1340px]",children:[s.jsx(kYe,{}),s.jsx(IYe,{})]}),s.jsx(OYe,{}),s.jsx(DYe,{profiles:e}),s.jsx($Ye,{}),s.jsx($ne,{})]}),s.jsx(Fne,{}),s.jsx(FP,{})]})}
430const UYe=[{n:"01",q:"How is this different from a standard link in bio?",a:"A link in bio is a list of links. This is one page with everything you have, and an AI Expert that answers questions based only on your knowledge. It recommends the right product, session or course, and shares the details."},{n:"02",q:"What if I have no materials yet?",a:"You do not need to write anything new. Connect your socials and it learns from what you have already published. You can add files, links or notes later, whenever you want."},{n:"03",q:"Is my cloned voice protected?",a:"Yes. Your cloned voice works only on your own profile and only through your AI Expert. Nobody else can use it, and you can delete it at any time."},{n:"04",q:"How does it help me sell?",a:"People tell your AI Expert what they are dealing with, and it recommends the option that actually fits, with the link to it. Your booking calendar, your shop, your course, your ebook, wherever it already lives."},{n:"05",q:"Where do I put the link?",a:"In your bio on Instagram, TikTok, YouTube or LinkedIn. In your newsletter, in your email signature, or straight into a DM when someone asks what you do."}],G3=[{name:"Mohammed Ahsan Rahim",role:"Supply Chain & Procurement Leader",avatar:"/welcome/assets/reviews/mohammed.png",quote:"My AI Expert is designed to provide instant, practical, and professional guidance. It has been trained on my decades of practical experience, strategic frameworks and industry best practices."},{name:"Rebecca Ingram",role:"Rapid Transformational Therapist",avatar:"/welcome/assets/reviews/rebecca.avif",quote:"My AI Expert has been built using everything thatâs in my brain. Sheâs there whenever you need her, completely anonymously, whether thatâs at 2 p.m. or 2 a.m."},{name:"Soniyaa Kiran Punjabi",role:"Founder of Illuminations",avatar:"/welcome/assets/reviews/soniyaa.png",quote:"The experts who win the next decade wonât be the busiest. Theyâll be the ones who turn what they know into something that scales, and earns, far beyond the hours in their day."},{name:"Vanda do Nascimento",role:"Behavioral Management Therapist & Mindfulness Teacher",avatar:"/welcome/assets/reviews/vanda.png",quote:"By the end of the week I already knew: this is the thing I wished Iâd had when I started. A way to share my knowledge with clients, in their language, even when Iâm not there."},{name:"Shahnaz Hassan",role:"Human Behavior & Emotional Dynamics",avatar:"/welcome/assets/reviews/shahnaz.png",quote:"What impressed me most is how human the experience can feel when experts are trained with depth, intention, and real healing frameworks."}],Hne=[["/forbusiness","For Business"],["/pricing","Pricing"]],zYe=[...Hne,["#how-it-works","How it works"]];function Dk({links:e=Hne,mobileLinks:t=zYe,cta:n="Sign up for free",ctaLink:r=null,ctaHref:a=null,onCta:i=null,login:o=!0}){const[l,c]=B.useState(!1),[u,d]=B.useState(!1),h=B.useRef(null),p=B.useRef(null);B.useEffect(()=>{const g=()=>d(window.scrollY>24);return g(),window.addEventListener("scroll",g,{passive:!0}),()=>window.removeEventListener("scroll",g)},[]),B.useEffect(()=>{const g=v=>{v.key==="Escape"&&l&&(c(!1),h.current?.focus())},x=v=>{p.current&&!p.current.contains(v.target)&&c(!1)},b=matchMedia("(min-width:900px)"),y=()=>{b.matches&&c(!1)};return document.addEventListener("keydown",g),document.addEventListener("pointerdown",x),b.addEventListener("change",y),()=>{document.removeEventListener("keydown",g),document.removeEventListener("pointerdown",x),b.removeEventListener("change",y)}},[l]);const m=(g,x)=>a?s.jsx("a",{className:g,href:a,target:"_blank",rel:"noopener noreferrer",onClick:i||void 0,children:x}):r?s.jsx(Le,{className:g,to:r.to,onClick:r.onClick,children:x}):s.jsx("a",{className:g,href:"/experts/new",children:x});return s.jsxs("nav",{ref:p,className:`ge-nav-bar${l?" ge-menu-open":""}${u?" ge-scrolled":""}`,"aria-label":"Main navigation",children:[s.jsx("a",{className:"ge-brand",href:"/welcome",onClick:()=>c(!1),children:s.jsx("img",{src:"/welcome/assets/brand/logo-flat.svg",alt:"great experts"})}),s.jsx("div",{className:"ge-nav-links",children:e.map(([g,x])=>s.jsx("a",{href:g,children:x},g))}),s.jsxs("div",{className:"ge-nav-actions",children:[o&&s.jsx("a",{href:"/login",children:"Log in"}),m("ge-nav-cta",n)]}),s.jsxs("button",{ref:h,className:"ge-menu-toggle",type:"button","aria-label":l?"Close menu":"Open menu","aria-expanded":l,"aria-controls":"landing-mobile-menu",onClick:()=>c(g=>!g),children:[s.jsx("span",{}),s.jsx("span",{}),s.jsx("span",{})]}),l&&s.jsxs("div",{className:"ge-mobile-menu",id:"landing-mobile-menu",onClick:()=>c(!1),children:[t.map(([g,x])=>s.jsx("a",{href:g,children:x},g)),m("ge-mobile-signup",s.jsxs(s.Fragment,{children:[n," ",s.jsx("span",{"aria-hidden":"true",children:"â"})]}))]})]})}function BP(e,{reveal:t,demos:n,fitScenes:r=".ef-scene, .ld-stage"}){f.useEffect(()=>{const a=e.current,i=x=>x instanceof Element?x.closest(n):null,o=x=>{a.querySelectorAll(".ge-demo-active").forEach(b=>b!==x&&b.classList.remove("ge-demo-active")),x?.classList.add("ge-demo-active"),document.dispatchEvent(new CustomEvent("ge-demo-change",{detail:x}))},l=x=>{const b=i(x);return b&&!b.classList.contains("ge-demo-active")},c=x=>window.scrollBy({top:x,behavior:"instant"}),u=x=>{l(x.target)&&(x.preventDefault(),c(x.deltaMode===1?x.deltaY*16:x.deltaY))};let d=0;const h=x=>{d=x.touches[0].clientY},p=x=>{l(x.target)&&(x.preventDefault(),c(d-x.touches[0].clientY),d=x.touches[0].clientY)},m=x=>o(i(x.target)),g=x=>o(i(x.detail));return a.addEventListener("wheel",u,{passive:!1,capture:!0}),a.addEventListener("touchstart",h,{passive:!0,capture:!0}),a.addEventListener("touchmove",p,{passive:!1,capture:!0}),document.addEventListener("click",m,!0),document.addEventListener("ge-demo-tap",g),()=>{a.removeEventListener("wheel",u,!0),a.removeEventListener("touchstart",h,!0),a.removeEventListener("touchmove",p,!0),document.removeEventListener("click",m,!0),document.removeEventListener("ge-demo-tap",g)}},[e,n]),f.useLayoutEffect(()=>{const a=e.current;if(!("IntersectionObserver"in window))return;const i=(l,c=0)=>{l.style.setProperty("--reveal-delay",`${Math.min(c,6)*60}ms`),l.dataset.visible=""},o=new IntersectionObserver(l=>{l.filter(c=>c.isIntersecting).forEach((c,u)=>{i(c.target,u),o.unobserve(c.target)})},{rootMargin:"0px 0px -12% 0px"});return a.querySelectorAll(t).forEach(l=>{l.dataset.reveal="",!l.hasAttribute("data-visible")&&(l.getBoundingClientRect().top<window.innerHeight?l.dataset.visible="":o.observe(l))}),a.classList.add("ge-reveal-ready"),()=>o.disconnect()},[e,t]),f.useEffect(()=>{const a=e.current.querySelectorAll(r),i=new ResizeObserver(o=>
430o.forEach(l=>l.target.style.setProperty("--fit",String(l.contentRect.width/1e3))));return a.forEach(o=>i.observe(o)),()=>i.disconnect()},[e,r])}const HYe=[...G3,...G3],qYe={fontStyle:"italic",color:"#3D3DF5"};function qne(){return s.jsxs("section",{id:"testimonials",style:{position:"relative",zIndex:"1",padding:"96px 0 0",scrollMarginTop:"96px"},children:[s.jsx("div",{style:{margin:"0 auto",maxWidth:"1180px",padding:"0 40px 32px",display:"flex",flexDirection:"column",gap:"10px"},children:s.jsxs("h2",{style:{margin:"0",textAlign:"center",fontFamily:"'Fraunces', Georgia, serif",fontSize:"clamp(32px,3.6vw,50px)",fontWeight:"500",lineHeight:"1.06",letterSpacing:"-0.02em",color:"#141413"},children:["Trusted by ",s.jsx("em",{style:{fontStyle:"italic",color:"#3D3DF5"},children:"many"})]})}),s.jsx("div",{className:"ge-marquee-wrap",style:{overflow:"hidden",maskImage:"linear-gradient(to right, transparent, #000 8%, #000 92%, transparent)",WebkitMaskImage:"linear-gradient(to right, transparent, #000 8%, #000 92%, transparent)"},children:s.jsx("div",{className:"ge-marquee",style:{display:"flex",gap:"16px",width:"max-content",padding:"8px 0 24px"},children:HYe.map((e,t)=>s.jsx(f.Fragment,{children:s.jsxs("figure",{style:{margin:"0",width:"380px",display:"flex",flexDirection:"column",gap:"18px",borderRadius:"24px",border:"1px solid #E8E6DC",background:"#FDFCF8",padding:"26px",boxShadow:"0 2px 6px rgba(20,20,19,0.05)"},children:[s.jsx("blockquote",{style:{margin:"0",fontFamily:"'Fraunces', Georgia, serif",fontSize:"17px",lineHeight:"1.45",letterSpacing:"-0.01em",color:"#141413",display:"-webkit-box",WebkitLineClamp:"5",WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.quote}),s.jsxs("figcaption",{style:{display:"flex",alignItems:"center",gap:"12px",marginTop:"auto"},children:[s.jsx("img",{src:e.avatar,alt:"",style:{width:"40px",height:"40px",borderRadius:"999px",objectFit:"cover"}}),s.jsxs("span",{style:{display:"flex",flexDirection:"column",minWidth:"0"},children:[s.jsx("span",{style:{fontSize:"14px",fontWeight:"600",color:"#141413"},children:e.name}),s.jsx("span",{style:{fontSize:"12.5px",color:"#86847B",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.role})]})]})]})},t))})})]})}function UP({items:e,title:t=s.jsxs(s.Fragment,{children:["Questions people ask ",s.jsx("em",{style:qYe,children:"before they start."})]})}){return s.jsxs("section",{id:"faq",style:{position:"relative",zIndex:"1",margin:"0 auto",maxWidth:"1080px",padding:"120px 40px 0",display:"flex",flexDirection:"column",gap:"24px",scrollMarginTop:"96px"},children:[s.jsx("h2",{style:{margin:"0",fontFamily:"'Fraunces', Georgia, serif",fontSize:"clamp(30px,3.4vw,46px)",fontWeight:"500",lineHeight:"1.08",letterSpacing:"-0.02em",color:"#141413"},children:t}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:e.map((n,r)=>s.jsx(f.Fragment,{children:s.jsxs("details",{className:"ge-acc",style:{borderRadius:"16px",border:"1px solid #E8E6DC",background:"rgba(253,252,248,0.7)",transition:"border-color 200ms, background 200ms"},children:[s.jsxs("summary",{style:{display:"flex",alignItems:"center",gap:"16px",padding:"20px 28px"},children:[s.jsx("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:"600",letterSpacing:"0.12em",color:"#B0AEA5"},children:n.n}),s.jsx("span",{style:{flex:"1",fontFamily:"'Fraunces', Georgia, serif",fontSize:"20px",fontWeight:"500",lineHeight:"1.3",letterSpacing:"-0.01em",color:"#141413"},children:n.q}),s.jsx("span",{className:"ge-acc-sign",style:{display:"flex",height:"32px",width:"32px",flexShrink:"0",alignItems:"center",justifyContent:"center",borderRadius:"999px",border:"1px solid #E8E6DC",color:"#54524C"},children:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",style:{height:"16px",width:"16px"},children:[s.jsx("path",{d:"M5 12h14"}),s.jsx("path",{d:"M12 5v14"})]})})]}),s.jsx("div",{className:"ge-acc-body",style:{padding:"0 28px 24px 68px"},children:s.jsx("p",{style:{margin:"0",maxWidth:"86ch",fontSize:"16px",lineHeight:"1.65",color:"#54524C"},children:n.a})})]})},r))})]})}function zP({homeHref:e="/welcome"}){return s.jsx("footer",{style:{position:"relative",zIndex:"1",padding:"72px 56px 40px"},children:s.jsxs("div",{style:{margin:"0 auto",display:"flex",maxWidth:"1180px",alignItems:"center",justifyContent:"space-between",gap:"24px"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[s.jsx("a",{href:e,"aria-label":"Great Experts home",style:{display:"inline-flex"},children:s.jsx("img",{src:"/welcome/assets/brand/logo-flat.svg",alt:"great experts",style:{height:"34px",width:"auto",display:"block"}})}),s.jsx("span",{"aria-hidden":"true",style:{display:"block",height:"16px",width:"1px",background:"#E8E6DC"}}),s.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"6px",fontSize:"13px",fontWeight:"500",color:"#86847B"},children:["Proudly made in UAE ",s.jsxs("svg",{viewBox:"0 0 12 8","aria-hidden":"true",style:{height:"12px",width:"18px",borderRadius:"2px",boxShadow:"0 0 0 1px rgba(20,20,19,0.1)"},children:[s.jsx("rect",{width:"12",height:"8",fill:"#fff"}),s.jsx("rect",{width:"12",height:"2.67",fill:"#00732F"}),s.jsx("rect",{y:"5.33",width:"12",height:"2.67",fill:"#000"}),s.jsx("rect",{width:"3",height:"8",fill:"#FF0000"})]}),s.jsx("svg",{viewBox:"0 0 24 24",fill:"#3D3DF5",stroke:"#3D3DF5",strokeWidth:"2",strokeLinejoin:"round","aria-hidden":"true",style:{height:"14px",width:"14px"},children:s.jsx("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})})]})]}),s.jsxs("nav",{"aria-label":"Footer",style:{display:"flex",flexWrap:"wrap",alignItems:"center",columnGap:"28px",rowGap:"8px"},children:[s.jsx("a",{href:e,style:{display:"inline-flex",minHeight:"44px",alignItems:"center",fontSize:"15px",color:"#54524C"},className:"welcome-interaction-7",children:"Home"}),s.jsx("a",{href:"/terms",style:{display:"inline-flex",minHeight:"44px",alignItems:"center",fontSize:"15px",color:"#54524C"},className:"welcome-interaction-7",children:"Terms & Conditions"}),s.jsx("a",{href:"/privacy",style:{display:"inline-flex",minHeight:"44px",alignItems:"center",fontSize:"15px",color:"#54524C"},className:"welcome-interaction-7",children:"Privacy Policy"})]})]})})}function Gc({name:e,size:t=20}){const n={phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"}),mic:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),s.jsx("path",{d:"M5 10v2a7 7 0 0 0 14 0v-2M12 19v3M8 22h8"})]}),micOff:s.jsx(s.Fragment,{children:s.jsx("path",{d:"m2 2 20 20M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V5a3 3 0 0 0-5.94-.6M5 10v2a7 7 0 0 0 12 4.9M19 10v2c0 .67-.09 1.32-.27 1.94M12 19v3M8 22h8"})}),arrow:s.jsx("path",{d:"M4 12h16m-6-6 6 6-6 6"}),external:s.jsx("path",{d:"M7 7h10v10M7 17 17 7"}),chevronRight:s.jsx("path",{d:"m9 6 6 6-6 6"}),chevronLeft:s.jsx("path",{d:"m15 6-6 6 6 6"}),chevronUp:s.jsx("path",{d:"m6 15 6-6 6 6"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.65",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]})}const Cd=1e4,WYe="What camera and light should I take on a photo walk?",VYe=["Iâd take the Fujifilm X100VI.","For video, try the Sony ZV-E10 II.","Add an amaran Ace 25c for light.","Iâve shared all three here for you."],GYe=[{at:2400,title:"Fujifilm X100VI",category:"Compact camera",image:"fujifilm-x100vi.jpg",url:"https://eshop.fujifilm-x.com/uk/fujifilm-x100vi.html"},{at:4e3,title:"Sony ZV-E10 II",category:"Mirrorless camera",image:"sony-zv-e10-ii.jpg",url:"https://www.sony.co.uk/electronics/interchangeable-lens-cameras/zv-e10m2"},{at:5500,title:"amaran Ace 25c",category:"Pocket LED light",image:"amaran-ace-25c.png",url:"https://amarancreators.com/products/amaran-ace-25c-charcoal"}],z7=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function YYe(e,t,n,r=1){const[a,i]=B.useState(0),[o,l]=B.useState(!1),c=B.useRef(0);return B.useEffect(()=>{const u=window.matchMedia("(prefers-reduced-motion: reduce)"),d=()=>l(u.matches);return d(),u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[]),B.useEffect(()=>{c.current=0,i(0)},[n]),B.useEffect(()=>{if(o){c.current=Cd,i(Cd);return}if(!e||t||c.current>=Cd)return;let u,d=null,h=c.current;const p=g=>{document.hidden?d=null:(d!==null&&(c.current=Math.min(Cd,c.current+(g-d)*r)),d=g,(c.current-h>=80||c.current===Cd)&&(h=c.current,i(h))),c.current<Cd&&(u=requestAnimationFrame(p))},m=()=>{d=null};return document.addEventListener("visibilitychange",m),u=requestAnimationFrame(p),()=>{cancelAnimationFrame(u),document.removeEventListener("visibilitychange",m)}},[e,t,n,o,r]),a}function H7({products:e,large:t=!1}){return s.jsx("section",{className:`cf-recommendations ${t?"cf-recommendations-large":""}`,"aria-label":"Profile recommendations",children:e.map(n=>s.jsxs("a",{className:"cf-product-row",href:n.url,target:"_blank",rel:"noopener noreferrer","aria-label":`View product: ${n.title}`,children:[s.jsx("span",{className:"cf-product-image",children:s.jsx("img",{src:`/welcome/assets/creator/shop/${n.image}`,alt:""})}),s.jsxs("span",{className:"cf-product-info",children:[s.jsx("strong",{children:n.title}),s.jsx("span",{children:n.category})]}),s.jsx(Gc,{name:"external",size:t?18:16})]},n.title))})}function q7({device:e,active:t,onComplete:n,onEnd:r,playbackRate:a=1}){const[i,o]=B.useState(!1),[l,c]=B.useState(!1),[u,d]=B.useState(0),[h,p]=B.useState(null),[m,g]=B.use
430State(!0),x=YYe(t,l,u,a),b=B.useRef(!1);B.useEffect(()=>{b.current=!1},[u]),B.useEffect(()=>{x>=Cd&&n&&!b.current&&(b.current=!0,n())},[x,n]);const y=x>=1750&&x<8200,v=x>=1200&&x<1750,w=l?[]:GYe.filter(T=>x>=T.at),j=w.length>0,E=j&&(h===null?x>=5e3:h),S=x<3200?0:x<4800?1:x<6500?2:3,_=WYe.split(" ").slice(0,Math.max(1,Math.floor(x/100))).join(" "),k=258-Math.floor(x/1e3),C=B.useRef(null),N=e==="phone";B.useEffect(()=>{const T=C.current,I=()=>T.style.setProperty("--call-scale",T.clientWidth/(N?390:1040));I();const $=new ResizeObserver(I);return $.observe(T),()=>$.disconnect()},[N]);const A=()=>{c(!1),o(!1),p(null),g(!0),d(T=>T+1)};return s.jsx("div",{className:`cf-device-screen ${N?"cf-screen-phone":"cf-screen-laptop"}`,ref:C,children:s.jsxs("div",{className:`cf-call-ui ${l?"cf-ended":""} ${i?"cf-muted":""} ${j?"cf-has-offers":""} ${y?"cf-speaking":v?"cf-thinking":"cf-listening"}`,role:"group","aria-label":`AI voice call preview on ${e}`,children:[s.jsxs("div",{className:"cf-call-main",children:[s.jsxs("header",{className:"cf-call-header",children:[s.jsxs("div",{className:"cf-identity",children:[s.jsxs("span",{children:[s.jsx("img",{src:"/welcome/assets/creator/photographer-profile.webp",alt:""}),s.jsx("i",{"aria-hidden":"true"})]}),s.jsx("strong",{children:"Oliver Hayes"})]}),s.jsxs("div",{className:"cf-time",children:[s.jsx(Gc,{name:"phone",size:14}),!l&&s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",children:[s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"#e8e6dc",strokeWidth:"2.5"}),s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"#3d3df5",strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${k/300*40.8} 40.8`,transform:"rotate(-90 8 8)"})]}),s.jsx("span",{children:l?z7(42+Math.floor(x/1e3)):`${z7(k)} remaining`})]})]}),s.jsxs("div",{className:"cf-call-stage",children:[s.jsxs("div",{className:"cf-avatar-stage",children:[s.jsxs("div",{className:"cf-aura","aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("div",{className:"cf-avatar",children:[s.jsx("i",{className:"cf-avatar-halo","aria-hidden":"true"}),s.jsx("i",{className:"cf-avatar-ring","aria-hidden":"true"}),s.jsx("i",{className:"cf-avatar-ripple","aria-hidden":"true"}),s.jsx("img",{src:"/welcome/assets/creator/photographer-profile.webp",alt:"Oliver Hayes"})]})]}),s.jsx("p",{className:"cf-call-status",role:"status",children:l?"Call ended":i?"Microphone off":y?"Speaking":v?"Thinking":"Listening"}),s.jsx("div",{className:"cf-transcript",children:!l&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"cf-question",children:["You · ",_]}),x>=1750&&s.jsx("div",{className:"cf-captions","aria-label":"Call transcript",children:s.jsx("div",{className:"cf-caption-track",style:{transform:`translateY(${(1-S)*32.8}px)`},children:VYe.map((T,I)=>s.jsx("span",{className:I===S?"is-current":"","aria-current":I===S?"true":void 0,children:T},T))})})]})})]}),N&&j&&s.jsxs("button",{className:"cf-offers-bar",onClick:()=>p(!0),"aria-expanded":E,children:[s.jsx("span",{className:"cf-offer-thumbs",children:w.map(T=>s.jsx("span",{children:s.jsx("img",{src:`/welcome/assets/creator/shop/${T.image}`,alt:""})},T.title))}),s.jsxs("strong",{children:[w.length," mentioned in this call"]}),s.jsx(Gc,{name:"chevronUp",size:16})]}),s.jsx("footer",{className:"cf-call-controls",children:l?s.jsxs("button",{className:"cf-call-again",onClick:A,children:[s.jsx(Gc,{name:"phone",size:16}),"Call again"]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`cf-mute ${i?"is-muted":""}`,onClick:()=>o(!i),"aria-pressed":i,"aria-label":i?"Unmute microphone":"Mute microphone",children:s.jsx(Gc,{name:i?"micOff":"mic"})}),s.jsxs("button",{className:"cf-end",onClick:()=>r?r():c(!0),children:[s.jsx(Gc,{name:"phone",size:16}),"End call"]})]})})]}),!N&&j&&(m?s.jsxs("aside",{className:"cf-offers-panel","aria-label":"Mentioned during this call",children:[s.jsxs("div",{className:"cf-offers-heading",children:[s.jsx("h3",{children:"Mentioned in this call"}),s.jsx("span",{children:w.length}),s.jsx("button",{onClick:()=>g(!1),"aria-label":"Collapse recommendations",children:s.jsx(Gc,{name:"chevronRight",size:16})})]}),s.jsx(H7,{products:w,large:!0})]}):s.jsxs("button",{className:"cf-offers-tab",onClick:()=>g(!0),"aria-label":`Show ${w.length} mentioned in this call`,"aria-expanded":!1,children:[s.jsx(Gc,{name:"chevronLeft",size:16}),w.slice(-2).map(T=>s.jsx("img",{src:`/welcome/assets/creator/shop/${T.image}`,alt:""}
430,T.title)),s.jsx("span",{children:w.length})]})),N&&E&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"cf-offers-backdrop",onClick:()=>p(!1),"aria-label":"Back to the call"}),s.jsxs("div",{className:"cf-offers-sheet",role:"dialog","aria-modal":"false","aria-label":"Mentioned in this call",onKeyDown:T=>{T.key==="Escape"&&p(!1)},children:[s.jsx("button",{className:"cf-sheet-handle",onClick:()=>p(!1),"aria-label":"Close recommendations",children:s.jsx("span",{})}),s.jsxs("div",{className:"cf-offers-heading",children:[s.jsx("h3",{children:"Mentioned in this call"}),s.jsx("span",{children:w.length})]}),s.jsx(H7,{products:w})]})]})]})})}function KYe(){const e=B.useRef(null),t=B.useRef(null),[n,r]=B.useState(!1);return B.useEffect(()=>{const a=new IntersectionObserver(([c])=>r(c.isIntersecting&&c.intersectionRatio>=.4),{threshold:[0,.4],rootMargin:"-90px 0px 0px"});e.current&&a.observe(e.current);const i=t.current,o=()=>i.style.setProperty("--phone-scale",i.clientWidth/356);o();const l=new ResizeObserver(o);return l.observe(i),()=>{a.disconnect(),l.disconnect()}},[]),s.jsx("div",{className:"cf-showcase",children:s.jsx("div",{className:`cf-scene ${n?"cf-visible":""}`,ref:e,"aria-label":"Voice calls on laptop and phone",children:s.jsxs("div",{className:"cf-devices",children:[s.jsxs("div",{className:"cf-laptop",children:[s.jsx("div",{className:"cf-laptop-display",children:s.jsx(q7,{device:"laptop",active:n})}),s.jsx("img",{className:"cf-laptop-frame",src:"/welcome/assets/device-frames/macbook-pro-14-space-black.png",alt:"","aria-hidden":"true",draggable:"false"})]}),s.jsx("div",{className:"cf-phone",ref:t,children:s.jsxs("div",{className:"cf-phone-device",children:[s.jsx("span",{className:"cf-phone-side cf-phone-silent","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-volume-up","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-volume-down","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-power","aria-hidden":"true"}),s.jsxs("div",{className:"cf-phone-display",children:[s.jsx(q7,{device:"phone",active:n}),s.jsx("div",{className:"cf-phone-home","aria-hidden":"true",children:s.jsx("span",{})})]})]})})]})})})}function $k({src:e="/welcome/product-profile/index.html",title:t="Customize Oliverâs page in the Great Experts editor"}){const n=B.useRef(null);return B.useEffect(()=>{const r=n.current,a=()=>{const o=r.getBoundingClientRect();r.style.setProperty("--pf-scale",Math.min(o.width*.86/1120,o.height*.86/860))},i=new ResizeObserver(a);return i.observe(r),a(),()=>i.disconnect()},[]),s.jsxs("article",{className:"ge-feature-row pf-feature",children:[s.jsx("div",{className:"pf-scene",ref:n,children:s.jsx("iframe",{className:"pf-product-frame",title:t,src:e,loading:"lazy"})}),s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["One page. ",s.jsx("em",{children:"All yours."})]}),s.jsx("p",{children:"Showcase your content, services and shop. Make it yours with custom layouts, colours and fonts."}),s.jsxs("a",{href:"/experts/new",children:["Create your page ",s.jsx("svg",{width:"19",height:"19",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})})]})]})]})}const Dj=[{id:1,name:"Emily Parker",time:"12 min ago",status:"New",ready:"Ready to book",source:"Instagram",topic:"London photo walk",email:"[email protected]",summary:"Wants to join London After Hours with a friend. Asked about dates, experience level and what camera to bring.",message:"Hi Oliver, weâd love to join your next evening walk. Do you have two places available?",question:"Iâd love to join your next London photo walk.",answer:"London After Hours is a great fit. Send a contact request and Oliver can follow up with you.",offering:"London After Hours",price:"£149 · Small-group photo walk"},{id:2,name:"James Wilson",time:"38 min ago",status:"New",ready:"Exploring options",source:"YouTube",topic:"Camera advice",email:"[email protected]",summary:"Looking for a compact camera for street photography. Interested in the Fujifilm X100VI and wants advice before choosing.",message:"Could you help me decide whether a fixed lens is right for me?",question:"What c
430ompact camera would you recommend for street photography?",answer:"The Fujifilm X100VI is a great fit for a light, everyday setup. Its fixed lens encourages you to move and be intentional with your framing.",offering:"Fujifilm X100VI",price:"Compact camera · Shop"},{id:3,name:"Sophie Bennett",time:"2 hours ago",status:"Contacted",ready:"Ready to book",source:"Profile page",topic:"Photo critique",email:"[email protected]",summary:"Building a street photography portfolio and looking for personal feedback on a selection of 12 images.",message:"Iâm putting together my first portfolio. Could we look at the edit together?",question:"Can Oliver review my portfolio?",answer:"Yes. A 1:1 photo critique gives you 45 minutes with Oliver to review your pictures, discuss the edit and work out your next steps.",offering:"1:1 photo critique",price:"£95 · 45 minutes"},{id:4,name:"Alex Morgan",time:"8 days ago",status:"New",ready:"Ready to talk",source:"Instagram",topic:"Brand campaign",email:"[email protected]",summary:"A streetwear brand is planning a London campaign and wants to discuss editorial photography.",message:"Weâre launching a small streetwear collection. Are you available for a London shoot?",question:"Does Oliver work with clothing brands?",answer:"Oliver works on editorial, streetwear and brand campaigns. Send a contact request with your brief so he can discuss the shoot with you.",offering:"Editorial & brand campaigns",price:"Work together"},{id:5,name:"Daniel Reed",time:"12 days ago",status:"Closed",ready:"Exploring options",source:"YouTube",topic:"Lighting setup",email:"[email protected]",summary:"Asked about a portable lighting setup for portraits and explored the lights in Oliverâs shop.",message:"Thanks for the lighting recommendations. Iâve found the right setup.",question:"Is there a small light I can take on location?",answer:"The amaran Ace 25c is a portable LED light you can use to add a little controlled light to a portrait. Youâll find it in Oliverâs shop.",offering:"amaran Ace 25c",price:"Pocket LED light · Shop"}];function XYe({phase:e,onPause:t,onCapture:n,onPreviewNote:r}){const[a,i]=B.useState(!1),[o,l]=B.useState(null),[c,u]=B.useState("[email protected]"),[d,h]=B.useState(!0),[p,m]=B.useState(""),[g,x]=B.useState([]),[b,y]=B.useState(!0),[v,w]=B.useState(!1),j=B.useRef(null),E=B.useRef(null);B.useEffect(()=>{l(null),i(!1),e===0&&(u("[email protected]"),h(!0),m(""),x([]))},[e]);const S=o||(e===2?"form":e===3?"sent":"chat");B.useEffect(()=>{j.current&&j.current.scrollTo({top:j.current.scrollHeight,behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"})},[e,g]);const _=(T,I=20)=>{const $={menu:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),plus:s.jsx("path",{d:"M12 5v14M5 12h14"}),close:s.jsx("path",{d:"m6 6 12 12M6 18 18 6"}),check:s.jsx("path",{d:"m20 6-11 11-5-5"}),mail:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),s.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),up:s.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})};return s.jsx("svg",{width:I,height:I,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:T==="menu"?1.35:1.85,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:$[T]})},k=()=>{t(),i(!1),h(!1),l("form")},C=()=>{t(),l("chat")},N=()=>{p.trim()&&(t(),x(T=>[...T,{role:"user",text:p.trim()},{role:"ai",text:"To ask Oliver about a photo walk, use Contact in the menu to send your details and conversation."}]),m(""))},A=d&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c);return s.jsxs("aside",{ref:E,className:`lc-shell ${v?"lc-expanded":""}`,"aria-label":"Chat with Oliver Hayes â demonstration",onPointerDownCapture:t,onFocusCapture:t,children:[s.jsxs("header",{className:"lc-header",inert:S!=="chat"?"":void 0,children:[s.jsx("img",{src:"/welcome/assets/creator/photographer-profile.webp",alt:"Oliver Hayes"}),s.jsxs("div",{className:"lc-name",children:[s.jsx("strong",{children:"Oliver Hayes"}),s.jsxs("small",{children:["Powered by ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",children:"Great Experts"})]})]}),s.jsx("button",{className:"lc-icon",type:"button","aria-label":"Conversation menu","aria-expanded":a,onClick:()=>i(!a),children:_("menu",26)})]}),s.jsxs("div",{className:"lc-body",inert:S!=="chat"?"":void 0,children:[s.jsxs("div",{className:"lc-thread",ref:j,children:[s.jsx("div",{className:"lc-message lc-ai",children:"Hi, Iâm Oliverâs AI. Ask me about street photography, my camera kit or a London photo walk."}),b&&e>=0&&s.jsx("div",{className:"lc-message lc-user",children:"Iâd love to join your next London photo walk."}),b&&e>=1&&s.jsx("div",{className:"lc-message lc-ai",children:"London After Hours is a great fit. Send a contact request and Oliver can follow up with you."}),g.map((T,I)=>s.jsx("div",{className:`lc-message lc-${T.role}`,children:T.text},I))]}),s.jsx("div",{className:"lc-compose",children:s.jsxs("div",{className:"lc-composer",children:[s.jsx("button",{className:"lc-icon",type:"button","aria-label":"Attach files",onClick:()=>r("Attachments are available in the full product."),children:_("plus")}),s.jsx("textarea",{rows:"1","aria-label":"Demo message",placeholder:"Ask anything...",maxLength:"2000",value:p,onChange:T=>m(T.target.value),onKeyDown:T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),N())}}),p.trim()?s.jsx("button",{type:"button",className:"lc-send","aria-label":"Send demo message",onClick:N,children:_("up",18)}):s.jsxs("button",{type:"button",className:"lc-call","aria-label":"Start a voice call with this AI expert",onClick:()=>r("Voice calls are available in the full product."),children:[_("phone",17),"Call"]})]})}),a&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"lc-menu-scrim",type:"button","aria-label":"Close conversation menu",onClick:()=>i(!1)}),s.jsxs("aside",{className:"lc-menu","aria-label":"Conversations",children:[s.jsx("button",{className:"lc-menu-action",onClick:k,children:"Contact"}),s.jsx("button",{className:"lc-menu-action",onClick:()=>{w(!v),i(!1)},children:v?"Exit full screen":"Expand"}),s.jsx("h4",{children:"Conversations"}),s.jsxs("button",{className:"lc-menu-new",onClick:()=>{i(!1),y(!1),x([]),m("")},children:[_("plus",17),"New conversation"]}),s.jsx("button",{className:"lc-history-item",onClick:()=>{i(!1),y(!0)},children:"London photo walk"})]})]})]}),(S==="form"||S==="sent")&&s.jsxs("div",{className:"lc-modal-wrap",children:[s.jsx("button",{className:"lc-modal-shade",type:"button","aria-label":"Close contact request",onClick:C}),s.jsxs("section",{className:"lc-modal",role:"dialog","aria-label":S==="sent"?"Request sent":"Send a contact request",onKeyDown:T=>{T.key==="Escape"&&C()},children:[s.jsx("button",{className:"lc-modal-close","aria-label":"Close contact form",type:"button",onClick:C,children:_("close")}),S==="form"?s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"Send a contact request"}),s.jsxs("form",{onSubmit:T=>{T.preventDefault(),A&&(n(c),l("sent"))},children:[s.jsxs("label",{className:"lc-email",children:[_("mail",16),s.jsx("input",{"aria-label":"Contact request email",type:"email",autoComplete:"off",placeholder:"Email",value:c,onChange:T=>u(T.target.value),required:!0})]}),s.jsxs("label",{className:"lc-consent",children:[s.jsx("input",{type:"checkbox",checked:d,onChange:T=>h(T.target.checked)}),s.jsx("span",{className:"lc-check-box","aria-hidden":"true",children:_("check",14)}),s.jsxs("span",{children:["I am 18+ and agree to the ",s.jsx("a",{href:"https://greatexperts.ai/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"})," and ",s.jsx("a",{href:"https://greatexperts.ai/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),", and to share my contact details and conversation with Oliver Hayesâs creator."]})]}),s.jsx("button",{className:"lc-contact-submit",type:"submit",disabled:!A,children:"Send a contact request"})]})]}):s.jsxs("div",{className:"lc-sent",children:[s.jsx("span",{className:"lc-sent-check",children:_("check")}),s.jsx("h3",{children:"Request sent"}),s.jsx("p",{children:"Thanks for reaching out. Oliver will get back to you soon."}),s.jsxs("p",{className:"lc-reply-email",children:["The reply will go to ",s.jsx("strong",{children:c.trim()}),"."]}),s.jsx("div",{children:s.jsx("button",{type:"button",className:"lc-done",onClick:C,children:"Done"})})]})]})]})]})}const Wne=["New","Contacted","Replied","Not replied","Booked a call","Not relevant"],JYe=[["1","Today"],["7","7 days"],["30","30 days"],["all","All time"]],QE=[["insights","Insights"],["conversations","Conversations"],["leads","Leads"]];function xi({name:e,size:t=16}){const n={search:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"10",cy:"10",r:"6"}),s.jsx("path",{d:"m15 15 5 5"})]}),download:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),chevron:s.jsx("path",{d:"m9 5 7 7-7 7"}),down:s.jsx("path",{d:"m6 9 6 6 6-6"}),spark:s.jsx("path",{d:"m12 3 2.5 6.5L21 12l-6.5 2.5L12 21l-2.5-6.5L3 12l6.5-2.5Z"}),mail:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),s.jsx("path",{d:"m3 7 9 6 9-6"})]}),clock:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 7v5l3 2"})]}
430),message:s.jsx("path",{d:"M21 11.5a8.4 8.4 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.4 8.4 0 0 1-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.4 8.4 0 0 1 3.8-.9h.5a8.5 8.5 0 0 1 8 8v.5Z"}),bot:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"4",y:"7",width:"16",height:"13",rx:"3"}),s.jsx("path",{d:"M12 3v4M9 12v2m6-2v2M2 12h2m16 0h2"})]}),source:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"m16 8-3 5-5 3 3-5Z"})]}),file:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),s.jsx("path",{d:"M14 2v6h6M8 13h8m-8 4h8"})]}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72l.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45l2.81.7A2 2 0 0 1 22 16.92z"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]||n.message})}function Vne({value:e,onChange:t,label:n}){return s.jsxs("label",{className:"lp-search",children:[s.jsx(xi,{name:"search"}),s.jsx("input",{type:"search","aria-label":n,placeholder:n,value:e,onChange:r=>t(r.target.value)})]})}function QYe({value:e,onChange:t,options:n,label:r}){const[a,i]=B.useState(!1),o=B.useRef(null);return B.useEffect(()=>{if(!a)return;const l=c=>{o.current?.contains(c.target)||i(!1)};return document.addEventListener("pointerdown",l),()=>document.removeEventListener("pointerdown",l)},[a]),s.jsxs("div",{className:"lp-select",ref:o,onKeyDown:l=>{l.key==="Escape"&&i(!1)},children:[s.jsxs("button",{type:"button","aria-label":r,"aria-expanded":a,"aria-haspopup":"listbox",onClick:()=>i(!a),children:[n.find(l=>l[0]===e)?.[1],s.jsx(xi,{name:"down"})]}),a&&s.jsx("div",{className:"lp-options",role:"listbox","aria-label":r,children:n.map(([l,c])=>s.jsxs("button",{type:"button",role:"option","aria-selected":l===e,onClick:()=>{t(l),i(!1)},children:[c,l===e&&s.jsx("span",{children:"â"})]},l))})]})}function ZYe({captured:e,selected:t,setSelected:n,query:r,setQuery:a,expert:i,setExpert:o}){const[l,c]=B.useState(!1),[u,d]=B.useState([]),[h,p]=B.useState(!1),m=Dj.filter(b=>`${b.question} ${b.summary} Oliver Hayes`.toLowerCase().includes(r.toLowerCase())),g=m.find(b=>b.id===t)||m[0],x=g&&s.jsxs("article",{className:"lp-conversation-detail",children:[s.jsxs("header",{className:"lp-card-header",children:[s.jsxs("div",{children:[s.jsx("h4",{children:g.question}),s.jsxs("p",{children:["Oliver Hayes · ",g.id===1?"Today":g.time]})]}),h&&s.jsx("button",{className:"lp-close","aria-label":"Close conversation",onClick:()=>p(!1),children:"Ã"})]}),s.jsxs("div",{className:"lp-card-body",children:[s.jsxs("dl",{className:"lp-chat-counts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Visitor messages"}),s.jsx("dd",{children:"2"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Total messages"}),s.jsx("dd",{children:"4"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Source"}),s.jsx("dd",{children:"Public profile"})]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Conversation summary"}),s.jsxs("div",{className:"lp-summary",children:[s.jsx(xi,{name:"spark"}),s.jsxs("div",{children:[s.jsx("p",{children:g.summary}),l&&s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:"Recommended offering"}),s.jsxs("p",{children:[g.offering,". ",g.id===1&&e?"The visitor shared their email and asked Oliver to follow up.":"The visitor explored this recommendation with Oliverâs AI."]})]})]}),s.jsx("button",{"aria-label":l?"Collapse summary":"Expand summary","aria-expanded":l,onClick:()=>c(!l),children:s.jsx(xi,{name:"down"})})]})]}),s.jsxs("section",{className:"lp-transcript",children:[s.jsx("span",{className:"lp-eyebrow",children:"Transcript"}),s.jsx("ol",{children:[{role:"Visitor",text:g.question},{role:"AI expert",text:g.answer},{role:"Visitor",text:g.message},{role:"AI expert",text:"You can send a contact request and Oliver can follow up with you."}].map((b,y)=>s.jsxs("li",{className:b.role==="AI expert"?"is-assistant":"",children:[s.jsx("span",{children:b.role}),s.jsx("p",{children:b.text})]},y))})]})]})]});return s.jsxs("section",{className:"lp-view",children:[s.jsxs("div",{className:"lp-intro lp-conversation-intro",children:[s.jsxs("div",{children:[s.jsxs("h4",{children:["What your audience is ",s.jsx("em",{children:"asking"})]}),s.jsx("p",{children:"See what visitors asked and how your AI responded across every audience conversation."})]}),s.jsxs("div",{className:"lp-chat-filters",children:[s.jsx(Vne,{label:"Search conversations",value:r,onChange:a}),s.jsx(QYe,{label:"Filter conversations by expert",value:i,onChange:o,options:[["all","All experts"],["oliver","Oliver Hayes"]]})]})]}),m.length?s.jsxs("div",{className:"lp-split",children:[s.jsxs("div",{className:"lp-card lp-list",children:[s.jsxs("div",{className:"lp-card-header",children:[s.jsx("strong",{children:"Chat inbox"}),s.jsxs("span",{children:[m.length," ",m.length===1?"conversation":"conversations"]})]}),m.map(b=>s.jsxs("button",{className:`lp-list-row ${g.id===b.id?"selected":""}`,"aria-current":g.id===b.id?"true":void 0,onClick:()=>{n(b.id),c(!1),d(y=>[...y,b.id]),window.matchMedia("(max-width: 960px)").matches&&p(!0)},children:[s.jsxs("span",{className:"lp-row-top",children:[s.jsx("strong",{children:b.question}),s.jsx("small",{children:b.id===1?"Just now":b.time})]}),s.jsxs("span",{className:"lp-row-meta",children:[s.jsxs("span",{children:[b.id!==g.id&&!u.includes(b.id)&&s.jsx("b",{className:"lp-new",children:"New"}),"Oliver Hayes"]}),s.jsx("small",{children:"4 messages"}),s.jsx("i",{children:s.jsx(xi,{name:"chevron",size:14})})]})]},b.id))]}),s.jsx("div",{className:"lp-card lp-chat-desktop",children:x}),h&&s.jsx("div",{className:"lp-mobile-modal",role:"dialog","aria-label":"Conversation detail",children:x})]}):s.jsxs("div",{className:"lp-card lp-empty",children:[s.jsx("h4",{children:"No matching conversations"}),s.jsx("p",{children:"Try another search or expert."})]})]})}function W7({lead:e,onStatus:t,onNote:n}){const[r,a]=B.useState(!0),[i,o]=B.useState(e.note||""),[l,c]=B.useState(!1),[u,d]=B.useState(!1),h=(p,m,g)=>s.jsxs("div",{className:"lp-context-row",children:[s.jsx(xi,{name:p}),s.jsx("span",{children:m}),s.jsx("strong",{children:g})]});return s.jsxs("article",{className:"lp-card lp-lead-detail",children:[s.jsxs("header",{className:"lp-card-header",children:[s.jsxs("div",{children:[s.jsx("h4",{children:e.name}),s.jsx("small",{children:e.time})]}),s.jsx("span",{className:"lp-ready",children:e.id===1||e.id===3?"Ready now":"Exploring"}),s.jsx("select",{"aria-label":"Request status",value:e.status,onChange:p=>t(p.target.value),children:Wne.map(p=>s.jsx("option",{children:p},p))})]}),s.jsxs("div",{className:"lp-card-body",children:[s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Request context"}),s.jsxs("div",{className:"lp-inset",children:[h("source","Source","Public profile"),h("bot","Expert","Oliver Hayes"),s.jsxs("div",{className:"lp-context-row is-stack",children:[s.jsx(xi,{name:"file"}),s.jsxs("div",{children:[s.jsx("span",{children:"Summary"}),s.jsx("p",{children:e.summary})]})]}),h("clock","Received",e.time)]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Contact & details"}),s.jsxs("div",{className:"lp-inset",children:[s.jsxs("div",{className:"lp-context-row",children:[s.jsx(xi,{name:"mail"}),s.jsx("span",{children:"Email"}),s.jsx("strong",{children:e.email}),s.jsx("button",{className:"lp-text-button",onClick:async()=>{try{await navigator.clipboard.writeText(e.email),d(!0)}catch{d(!1)}},children:u?"Copied":"Copy"})]}),h("phone","Phone","Not shared"),s.jsxs("div",{className:"lp-context-row is-stack",children:[s.jsx(xi,{name:"message"}),s.jsxs("div",{children:[s.jsx("span",{children:"Message they left"}),s.jsx("p",{children:e.message})]})]}),s.jsxs("div",{className:"lp-context-row",children:[s.jsx(xi,{name:"message"}),s.jsx("span",{children:"Chat history"}),s.jsxs("button",{className:"lp-show-chat","aria-expanded":r,onClick:()=>a(!r),children:[r?"Hide":"Show",s.jsx(xi,{name:"down"})]})]}),r&&s.jsxs("div",{className:"lp-lead-transcript",children:[s.jsx("p",{children:e.question}),s.jsx("p",{children:e.answer})]})]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Internal note"}),s.jsxs("div",{className:"lp-inset lp-note",children:[s.jsx("textarea",{"aria-label":"Internal note",placeholder:"Only visible to you",value:i,onChange:p=>{o(p.target.value),c(!1)}}),s.jsxs("div",{children:[l&&s.jsx("span",{role:"status",children:"Note saved"}),s.jsx("button",{onClick:()=>{n(i),c(!0)},children:"Save"})]})]})]})]})]})}function id({title:e,children:t,id:n}){return s.jsxs("section",{className:"lp-card lp-insight-card",id:n,children:[s.jsx("div",{className:"lp-card-header",children:s.jsx("strong",{children:e})}),s.jsx("div",{className:"lp-card-body",children:t})]})}function eKe({period:e,captured:t,newCount:n,onConversations:r,onLeads:a,onNewLeads:i}
430){const o=t?1:0,l=e==="1"?{c:11+o,p:9,v:47,l:o,r:6+o,k:3,voice:2}:e==="7"?{c:46+o,p:32,v:218,l:2+o,r:21+o,k:9,voice:8}:e==="all"?{c:342+o,p:228,v:1430,l:4+o,r:174+o,k:64,voice:57}:{c:184+o,p:126,v:842,l:4+o,r:86+o,k:31,voice:29},c=B.useRef(null),u=[["London After Hours",39,16,21],["Fujifilm X100VI",29,10,17],["1:1 photo critique",19,5,12]],d=()=>c.current?.scrollIntoView({behavior:"smooth",block:"nearest"}),h=[["Conversations",l.c,s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lp-voice-bar",children:s.jsx("i",{style:{width:`${l.voice/l.c*100}%`}})}),"Voice ",l.voice," · Text ",l.c-l.voice]}),"conversations","View"],["People who chatted",l.p,`Different people · ${Math.round(l.p*.4)} not signed in`],["Profile visitors",l.v,"People who opened your profile page"],["Leads",l.l,"People who asked you to get in touch","leads","Open"],["Recommendations",l.r,"Times your AI suggested one of your offerings","breakdown","Breakdown"],["Offering clicks",l.k,`${Math.round(l.k/l.r*100)}% of recommendations led to a click`,"breakdown","Breakdown"]];return s.jsxs("section",{className:"lp-view",children:[s.jsx("div",{className:"lp-intro",children:s.jsxs("div",{children:[s.jsxs("h4",{children:["Find out what your audience ",s.jsx("em",{children:"actually wants"})]}),s.jsxs("p",{children:["Insights are ",s.jsx("strong",{children:"fully anonymous"}),". They show what people need, not who they are."]})]})}),s.jsx("div",{className:"lp-metrics",children:h.map(([p,m,g,x,b],y)=>{const v=x?"button":"div";return s.jsxs(v,{type:x?"button":void 0,className:`lp-metric ${y===0?"accent":""} ${y===1?"indigo-value":""}`,onClick:x?()=>{x==="breakdown"?d():x==="conversations"?r():x==="leads"&&a()}:void 0,"aria-label":x?`${p}, ${b}`:void 0,children:[s.jsx("span",{className:"lp-eyebrow",children:p}),s.jsx("strong",{children:m},m),s.jsxs("div",{children:[s.jsx("small",{children:g}),b&&s.jsxs("b",{children:[b," â"]})]})]},p)})}),s.jsxs("div",{className:"lp-card lp-next",children:[s.jsx("h5",{children:"What to do next"}),s.jsxs("button",{onClick:i,children:[s.jsxs("span",{children:[s.jsxs("strong",{children:[n," new requests waiting"]}),s.jsx("small",{children:"Reply while the conversation is still fresh."})]}),s.jsx("b",{children:"View new requests â"})]})]}),s.jsxs(id,{title:"How conversations progress",children:[[["Conversations",l.c],["Kept talking (5+ messages)",Math.round(l.c*.63)],["Asked to connect",l.l]].map(([p,m],g)=>s.jsxs("div",{className:"lp-bar-row",children:[s.jsx("span",{children:p}),s.jsx("i",{children:s.jsx("b",{style:{width:`${Math.max(3,m/l.c*100)}%`}})}),s.jsx("strong",{children:m}),s.jsx("small",{children:g>0?`${Math.round(m/l.c*100)}%`:""})]},p)),s.jsxs("p",{className:"lp-foot",children:[s.jsxs("strong",{children:[Math.round(l.p*.18)," people came back"]})," for a second conversation in this period. Returning visitors are your warmest audience."]})]}),s.jsx("div",{ref:c,children:s.jsxs(id,{title:"Your AI sales agent at work",children:[s.jsx("p",{className:"lp-foot",children:"What your AI recommended, and what people did about it."}),s.jsx("div",{className:"lp-ranking-grid",children:[["Most clicked",2],["Most recommended",1],["Most asked for",3]].map(([p,m])=>s.jsxs("div",{children:[s.jsx("h5",{children:p}),u.map((g,x)=>s.jsxs("div",{className:"lp-ranking",children:[s.jsxs("span",{children:["0",x+1]}),s.jsx("strong",{children:g[0]}),s.jsx("b",{children:e==="7"?Math.max(1,Math.round(g[m]/4)):e==="1"?Math.max(1,Math.round(g[m]/15)):e==="all"?g[m]*2:g[m]})]},g[0]))]},p))})]})}),s.jsx(id,{title:"What people ask about",children:[["Street photography",68],["Camera recommendations",51],["Photo walks",39],["Portfolio feedback",26]].map(([p,m])=>s.jsxs("div",{className:"lp-bar-row",children:[s.jsx("span",{children:p}),s.jsx("i",{children:s.jsx("b",{style:{width:`${m/68*100}%`}})}),s.jsx("strong",{children:m})]},p))}),s.jsx("div",{className:"lp-two-up",children:[["Busiest days",["M","T","W","T","F","S","S"],[18,21,24,20,32,39,31]],["Busiest hours",["6am","9am","12pm","3pm","6pm","9pm"],[9,18,31,35,54,38]]].map(([p,m,g])=>s.jsx(id,{title:p,children:s.jsx("div",{className:"lp-columns",children:m.map((x,b)=>s.jsxs("div",{children:[s.jsx("span",{children:Math.round(g[b]*l.c/185)}),s.jsx("i",{style:{height:`${g[b]*1.4}px`}}),s.jsx("small",{children:x})]},b))})},p))}),s.jsxs("div",{className:"lp-two-up",children:[s.jsx(id,{title:"Your experts",children:s.jsxs("table",{className:"lp-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Expert"}),s.jsx("th",{children:"Chats"}),s.jsx("th",{children:"Requests"})]})}),s.jsx("tbody",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Oliver Hayes"}),s.jsx("td",{children:l.c}),s.jsx("td",{children:l.l})]})})]})}),s.jsxs(id,{title:"Knowledge gaps",children:[s.jsx("h5",{children:"Night photography settings"}),s.jsx("p",{className:"lp-foot",children:"People asked for more detail about camera settings for night photography."})]})]}),s.jsx(id,{title:"Where people find you",children:s.jsxs("table",{className:"lp-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Source"}),s.jsx("th",{children:"Chats"}),s.jsx("th",{children:"Requests"})]})}),s.jsxs("tbody",{children:[s.jsxs("tr",{children:[s.jsx("th",{children:"Public profile"}),s.jsx("td",{children:Math.round(l.c*.8)}),s.jsx("td",{children:l.l})]}),s.jsxs("tr",{children:[s.jsx("th",{children:"Website embed"}),s.jsx("td",{children:l.c-Math.round(l.c*.8)}),s.jsx("td",{children:"0"})]})]})]})})]})}const V7=e=>(e?Dj:Dj.slice(1)).map(t=>({...t,status:t.status==="Closed"?"Replied":t.status,time:t.id===1?"Just now":t.time}));
430function tKe(){const[e,t]=B.useState("insights"),[n,r]=B.useState(()=>V7(!1)),[a,i]=B.useState(2),[o,l]=B.useState("All"),[c,u]=B.useState(""),[d,h]=B.useState("30"),[p,m]=B.useState(1),[g,x]=B.useState(""),[b,y]=B.useState("all"),[v,w]=B.useState(""),[j,E]=B.useState([]),[S,_]=B.useState(!1),[k,C]=B.useState("chat"),N=B.useRef(null),A=B.useRef(null),T=B.useRef({}),I=B.useRef(0),$=B.useRef(!1),O=B.useRef(!1),U=B.useRef(-1),[F,H]=B.useState(!1),[G,M]=B.useState(-1),z=G>=3,W=()=>{O.current=!0,H(!1)},D=B.useCallback(P=>{t(P),A.current&&(A.current.scrollTop=0)},[]),Z=B.useCallback((P,ee=!1)=>{const X=P<700?0:P<1500?1:P<2800?2:P<4800?3:4;X===U.current&&!ee||(U.current=X,M(X),(X===0||ee)&&(w(""),r(V7(X>=3)),i(X>=3?1:2),l("All"),u(""),x(""),y("all"),m(1),E([]),_(!1),C("chat"),D(X===3?"leads":"insights"),h("30")),X===3&&(r(ae=>ae.some(me=>me.id===1)?ae:[{...Dj[0],time:"Just now"},...ae]),i(1),D("leads"),w("Emily Parker shared her details. New lead added to your inbox.")),X===4&&(m(1),D("conversations")))},[D]);B.useEffect(()=>{const P=window.matchMedia("(prefers-reduced-motion: reduce)"),ee=new IntersectionObserver(([me])=>{$.current=me.isIntersecting&&me.intersectionRatio>=.5,$.current&&!O.current&&!P.matches&&(O.current=!0,Z(0,!0),H(!0))},{threshold:.5,rootMargin:"-88px 0px 0px"}),X=N.current?.querySelector(".lc-shell");X&&ee.observe(X);const ae=()=>{P.matches&&(O.current=!0,H(!1),I.current=2800,Z(2800,!0))};return ae(),P.addEventListener("change",ae),()=>{ee.disconnect(),P.removeEventListener("change",ae)}},[Z]),B.useEffect(()=>{if(!F)return;let P=performance.now();const ee=setInterval(()=>{const X=performance.now(),ae=Math.min(X-P,200);P=X,!(!$.current||document.hidden)&&(I.current=Math.min(I.current+ae,9e3),Z(I.current),I.current===9e3&&H(!1))},100);return()=>clearInterval(ee)},[F,Z]);const V=n.filter(P=>(o==="All"||P.status===o)&&`${P.name} ${P.topic} ${P.email}`.toLowerCase().includes(c.toLowerCase())),L=V.find(P=>P.id===a)||V[0],K=n.filter(P=>P.status==="New").length,te=P=>{r(ee=>ee.map(X=>X.id===L.id?{...X,status:P}:X)),w(`${L.name} marked ${P.toLowerCase()}.`)},Q=P=>r(ee=>ee.map(X=>X.id===L.id?{...X,note:P}:X)),Y=P=>{if(!["ArrowLeft","ArrowRight"].includes(P.key))return;P.preventDefault();const ee=QE.findIndex(ae=>ae[0]===e),X=QE[(ee+(P.key==="ArrowRight"?1:2))%3][0];D(X),T.current[X]?.focus()},J=P=>{P.target.closest(".ld-export")||(W(),C("dashboard"))};return s.jsx("div",{className:"ld-showcase",ref:N,children:s.jsxs("div",{className:"ld-stage",children:[s.jsx("div",{className:"ld-demo lp-product",style:{zIndex:k==="dashboard"?4:1},onPointerDownCapture:J,onFocusCapture:J,children:s.jsxs("div",{className:"ld-app",ref:A,children:[s.jsxs("header",{className:"ld-header",children:[s.jsxs("h3",{children:["Insights & ",s.jsx("em",{children:"Leads"})]}),s.jsxs("button",{type:"button",className:"ld-reset ld-export",children:[s.jsx(xi,{name:"download"}),e==="conversations"?"Export chats":"Export CSV"]})]}),s.jsxs("div",{className:"ld-toolbar",children:[s.jsx("div",{className:"ld-tabs",role:"tablist","aria-label":"Leads views",onKeyDown:Y,children:QE.map(([P,ee])=>s.jsxs("button",{type:"button",ref:X=>T.current[P]=X,role:"tab",id:`demo-tab-${P}`,"aria-controls":`demo-panel-${P}`,"aria-selected":e===P,tabIndex:e===P?0:-1,onClick:()=>D(P),children:[s.jsx("span",{className:"lp-full-label",children:ee}),s.jsx("span",{className:"lp-short-label",children:P==="conversations"?"Chats":ee}),P==="leads"&&K>0&&s.jsx("span",{className:"lp-tab-count",children:K})]},P))}),e==="insights"&&s.jsx("div",{className:"ld-filters",role:"group","aria-label":"Period",children:JYe.map(([P,ee])=>s.jsx("button",{"aria-pressed":d===P,onClick:()=>h(P),children:ee},P))}),e==="leads"&&s.jsx("div",{className:"ld-filters",role:"group","aria-label":"Filter by status",children:["All",...Wne].map(P=>s.jsxs("button",{"aria-pressed":o===P,onClick:()=>l(P),children:[P,s.jsx("span",{children:P==="All"?n.length:n.filter(ee=>ee.status===P).length})]},P))})]}),s.jsxs("div",{role:"tabpanel",id:`demo-panel-${e}`,"aria-labelledby":`demo-tab-${e}`,children:[e==="insights"&&s.jsx(eKe,{period:d,captured:z,newCount:K,onConversations:()=>D("conversations"),onLeads:()=>{l("All"),u(""),D("leads")},onNewLeads:()=>{l("New"),u(""),D("leads")}}),e==="conversations"&&s.jsx(ZYe,{captured:z,selected:p,setSelected:m,query:g,setQuery:x,expert:b,setExpert:y}),e==="leads"&&s.jsxs("section",{className:"lp-view",children:[s.jsxs("div",{className:"lp-intro",children:[s.jsxs("div",{children:[s.jsxs("h4",{children:["Someone is waiting for your ",s.jsx("em",{children:"reply"})]}),s.jsx("p",{children:"People who asked you to get in touch after talking with your AI Experts. You only see what they agreed to share."})]}),s.jsx(Vne,{label:"Search leads",value:c,onChange:u})]}),s.jsxs("div",{className:"lp-split lp-leads-split",children:[s.jsxs("div",{className:"lp-card lp-list",children:[s.jsxs("div",{className:"lp-card-header",children:[s.jsx("strong",{children:"Inbox"}),s.jsxs("span",{children:[V.length," ",V.length===1?"lead":"leads"]})]}),V.map(P=>s.jsxs("button",{className:`lp-list-row ${P.id===L?.id?"selected":""} ${P.id===1&&z?"ld-arrived":""}`,"aria-current":P.id===L?.id?"true":void 0,onClick:()=>{i(P.id),E(ee=>[...ee,P.id]),window.matchMedia("(max-width: 960px)").matches&&_(!0)},children:[s.jsxs("span",{className:"lp-row-top",children:[s.jsx("strong",{children:P.name}),s.jsx("small",{children:P.time})]}),s.jsxs("span",{className:"lp-row-meta",children:[(P.status!=="New"||!(j.includes(P.id)||P.id===L?.id))&&s.jsx("b",{className:`lp-status lp-${P.status.toLowerCase().replaceAll(" ","-")}`,children:P.status}),s.jsx("span",{children:"Expert: Oliver Hayes"}),s.jsx("i",{children:s.jsx(xi,{name:"chevron",size:14})})]})]},P.id)),!V.length&&s.jsx("div",{className:"lp-empty",children:"No requests with this status."})]}),s.jsx("div",{className:"lp-lead-desktop",children:L&&s.jsx(W7,{lead:L,onStatus:te,onNote:Q},L.id)})]}),S&&L&&s.jsxs("div",{className:"lp-mobile-modal",role:"dialog","aria-label":"Lead detail",children:[s.jsx("button",{className:"lp-close","aria-label":"Close request",onClick:()=>_(!1),children:"Ã"}),s.jsx(W7,{lead:L,onStatus:te,onNote:Q},L.id)]})]})]}),s.jsx("div",{className:"ld-sr",role:"status","aria-live":"polite",children:v})]})}
430),s.jsx(XYe,{phase:G,onPause:()=>{W(),C("chat")},onPreviewNote:w,onCapture:P=>{W(),I.current=2800,Z(2800,!0),r(ee=>ee.map(X=>X.id===1?{...X,email:P}:X))}})]})})}function sKe(){return s.jsxs("article",{className:"ge-feature-row lf-feature",children:[s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["More interest. ",s.jsx("em",{children:"More leads."})]}),s.jsx("p",{children:"See what your audience asks about. Capture contact details and turn conversations into your next opportunity."}),s.jsxs("a",{href:"/experts/new",children:["Start capturing leads ",s.jsx("svg",{width:"19",height:"19",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})})]})]}),s.jsx(tKe,{})]})}const nKe=[{name:"Oliver Hayes",initials:"OH",avatar:"/welcome/assets/creator/photographer-profile.webp",earned:1599.65,subscribers:6,mrr:89.94,rating:94},{name:"Marcus Webb",initials:"MW",avatar:"/welcome/assets/creator/marcus-natural.jpg",avatarClass:"ef-avatar-candid",earned:1056.8,subscribers:4,mrr:59.96,rating:90},{name:"Sofia Reyes",initials:"SR",avatar:"/welcome/assets/creator/sofia-natural.jpg",earned:765.76,subscribers:2,mrr:29.98,rating:92}],Ul=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e),xf=1499,Gne=xf-Math.round(xf*.3),G7=300,Y7=850,K7=1550,rKe=1900,Y3=3100,aKe=3650,ZE=3650,X7=4200,K3=5800,ov=7500,iKe="Start at 1/250s and f/2.8 with Auto ISO. Find a pool of light and wait for someone to step into it.";function oKe(e){const[t,n]=B.useState(0),r=B.useRef(0);return B.useEffect(()=>{const o=window.matchMedia("(prefers-reduced-motion: reduce)");let l=!1,c=null,u=null;const d=g=>{r.current=g,n(g)},h=g=>{if(c=null,!l||document.hidden||r.current>=ov){u=null;return}u!==null&&d(Math.min(ov,r.current+g-u)),u=g,c=requestAnimationFrame(h)},p=()=>{if(c!==null&&cancelAnimationFrame(c),c=null,u=null,o.matches){d(ov);return}l&&!document.hidden&&r.current<ov&&(c=requestAnimationFrame(h))},m=new IntersectionObserver(([g])=>{l=g.isIntersecting&&g.intersectionRatio>=.45,p()},{threshold:[0,.45],rootMargin:"-90px 0px 0px 0px"});return m.observe(e.current),document.addEventListener("visibilitychange",p),o.addEventListener("change",p),p(),()=>{m.disconnect(),c!==null&&cancelAnimationFrame(c),document.removeEventListener("visibilitychange",p),o.removeEventListener("change",p)}},[e]),[t,()=>{r.current=Math.max(r.current,Y3),n(r.current)},()=>{r.current=Math.max(r.current,K3),n(r.current)}]}function fo({name:e,size:t=18}){const n={arrow:s.jsx("path",{d:"M4 12h16m-6-6 6 6-6 6"}),download:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M12 3v12m-5-5 5 5 5-5M4 15v5h16v-5"})}),check:s.jsx("path",{d:"m5 12 4 4L19 6"}),plus:s.jsx("path",{d:"M12 5v14M5 12h14"}),up:s.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),menu:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"}),loader:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M12 3a9 9 0 1 1-9 9"})}),sparkles:s.jsx(s.Fragment,{children:s.jsx("path",{d:"m12 3 2.7 6.3L21 12l-6.3 2.7L12 21l-2.7-6.3L3 12l6.3-2.7L12 3Z"})}),thumb:s.jsx("path",{d:"M7 10v11H3V10h4Zm0 0 5-8a3 3 0 0 1 2 4l-1 4h6a2 2 0 0 1 2 2l-2 7a2 2 0 0 1-2 2H7"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]})}function od({label:e,value:t,note:n,accent:r=!1,small:a=!1,credited:i=!1}){return s.jsxs("div",{className:`ef-stat ef-surface ${r?"ef-stat-accent":""} ${a?"ef-stat-small":""} ${i?"ef-stat-credited":""}`,children:[s.jsx("span",{className:"ef-eyebrow",children:e}),s.jsx("strong",{children:t}),s.jsx("span",{className:"ef-stat-note",children:i?s.jsxs("span",{className:"ef-credit-note",children:[s.jsx(fo,{name:"check",size:12}),"+",Ul(Gne/100)," added"]}):n})]})}function lKe({elapsed:e}){const[t,n]=B.useState({key:"earned",dir:-1}),r=e>=ZE,a=Math.max(0,Math.min(1,(e-ZE)/(X7-ZE))),i=Math.round(Gne*(1-Math.pow(1-a,3))),o=(342221+i)/100,l=nKe.map((h,p)=>p===0?{...h,earned:(159965+i)/100,subscribers:h.subscribers+Number(r),mrr:(8994+(r?xf:0))/100}:h).sort((h,p)=>t.dir*(t.key==="name"?h.name.localeCompare(p.name):h[t.key]-p[t.key])),c=[["name","By expert"],["earned","Earned"],["subscribers","Subscriptions"],["mrr","MRR"],["rating","Rating"]],u=[0,0,120,480,890,o].map((h,p)=>({value:h,label:new Date(new Date().getFullYear(),new Date().getMonth()-5+p,1).toLocaleStr
430ing("en-US",{month:"short"})})),d=h=>n(p=>({key:h,dir:p.key===h?-p.dir:h==="name"?1:-1}));return s.jsxs("div",{className:"ef-dashboard",role:"group","aria-label":"Earnings dashboard preview",children:[s.jsxs("header",{className:"ef-dashboard-header ef-surface",children:[s.jsxs("h3",{children:["Your ",s.jsx("em",{children:"earnings"})]}),s.jsxs("div",{className:"ef-dashboard-actions",children:[s.jsxs("button",{type:"button",className:"ef-export","aria-label":"Export sample earnings CSV",onClick:()=>{},children:[s.jsx(fo,{name:"download",size:16}),"Export CSV"]}),s.jsx("button",{type:"button",className:"ef-payout",disabled:!0,title:"Payouts are available in your creator dashboard",children:"Request payout"})]})]}),s.jsx("p",{className:"ef-sample",children:"Sample data · This month"}),s.jsxs("div",{className:"ef-stats",children:[s.jsx(od,{label:"Pending payout",value:Ul(o),note:"Payout from $50.00",accent:!0,credited:r}),s.jsx(od,{label:"Total earned",value:Ul(o),note:"Your 70% share, after fees"}),s.jsx(od,{label:"Active subscribers",value:r?"13":"12",note:`${r?5:4} new, 1 cancelled`}),s.jsx(od,{label:"Subscriptions total",value:Ul((488887+(r?xf:0))/100),note:"What subscribers paid. You keep 70%"})]}),s.jsx("div",{className:"ef-table-wrap ef-surface",children:s.jsxs("table",{children:[s.jsx("caption",{className:"ef-sr-only",children:"Earnings, subscriptions and rating for each of your experts"}),s.jsx("thead",{children:s.jsx("tr",{children:c.map(([h,p])=>s.jsx("th",{scope:"col","aria-sort":t.key===h?t.dir===1?"ascending":"descending":"none",children:s.jsxs("button",{type:"button",onClick:()=>d(h),children:[p,s.jsx("span",{"aria-hidden":"true",children:t.key===h?t.dir===1?"â":"â":""})]})},h))})}),s.jsx("tbody",{children:l.map(h=>s.jsxs("tr",{children:[s.jsx("th",{scope:"row",children:s.jsxs("span",{className:"ef-expert",children:[s.jsx("span",{className:"ef-avatar","aria-hidden":"true",children:h.avatar?s.jsx("img",{src:h.avatar,alt:"",className:h.avatarClass}):h.initials}),h.name]})}),s.jsx("td",{children:Ul(h.earned)}),s.jsx("td",{children:h.subscribers}),s.jsx("td",{children:Ul(h.mrr)}),s.jsx("td",{children:s.jsxs("span",{className:"ef-rating",children:[s.jsx(fo,{name:"thumb",size:13}),h.rating,"%"]})})]},h.name))})]})}),s.jsxs("div",{className:"ef-history",children:[s.jsxs("div",{className:"ef-months ef-surface",children:[s.jsx("h4",{className:"ef-eyebrow",children:"Last 6 months"}),u.map((h,p)=>s.jsxs("div",{className:`ef-month ${p===5?"ef-current":""}`,children:[s.jsx("span",{children:h.label}),s.jsx("span",{className:"ef-bar",children:s.jsx("i",{style:{width:h.value?`${Math.max(5,h.value/o*100)}%`:"0%"}})}),s.jsx("strong",{children:Ul(h.value)})]},h.label))]}),s.jsxs("div",{className:"ef-feedback ef-surface",children:[s.jsx("h4",{className:"ef-eyebrow",children:"Answer feedback"}),s.jsx("div",{className:"ef-ring",role:"img","aria-label":"92% of 142 rated answers were helpful",children:s.jsxs("span",{children:[s.jsx(fo,{name:"thumb",size:17}),s.jsx("strong",{children:"92%"})]})}),s.jsx("p",{children:"From 142 rated answers"})]})]}),s.jsxs("div",{className:"ef-activity",children:[s.jsx(od,{small:!0,label:"Questions answered",value:"487",note:"In the selected period"}),s.jsx(od,{small:!0,label:"Active experts",value:"3",note:"Published and answering"}),s.jsx(od,{small:!0,label:"Drafts",value:"1",note:"Not published yet"})]}),s.jsx("span",{className:"ef-sr-only",role:"status","aria-live":"polite",children:e>=X7?"Oliver Hayes received a subscription payment. $10.49 added to earnings. Pending payout is now $3,432.70.":""})]})}function cKe({elapsed:e,onSubscribe:t,onContinue:n}){const r=e>=aKe,a=e>=rKe&&!r,i=e>=Y3&&!r,o=e>=K3,l=e>=Y3&&!o,c=o?iKe.split(" ").slice(0,Math.max(1,Math.floor((e-K3)/48))).join(" "):"",u=B.useRef(null),d=B.useRef(!0),h=B.useRef(null),p=B.useRef(!1),m=()=>{p.current=!0,t()};B.useEffect(()=>{p.current&&(l?h.current?.focus({preventScroll:!0}):(u.current?.closest(".ef-subscription").querySelector("textarea")?.focus({preventScroll:!0}),p.current=!1))},[l]);const g=e>=G7,x=e>=Y7,b=e>=K7;return B.useEffect(()=>{const y=u.current;d.current&&(y.scrollTop=y.scrollHeight)},[g,x,b,r,c]),s.jsxs("section",{className:`ef-subscription ${a?"ef-chat-gated":""} ${r?"ef-payment-paid":""}`,"aria-label":"Paid expert conversation preview",children:[s.jsxs("div",{className:"ef-chat-content",inert:l?"":void 0,children:[s.jsxs("header",{className:"ef-chat-header",children:[s.jsx("img",{className:"ef-chat-avatar",src:"/welcome/assets/creator/photographer-profile.webp",alt:"Oliver Hayes"}),s.jsxs("div",{children:[s.jsx("strong",{children:"Oliver Hayes"}),s.jsxs("span",{children:["Powered by ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",children:"Great Experts"})]})]}),s.jsx("span",{className:"ef-chat-menu","aria-hidden":"true",children:s.jsx(fo,{name:"menu",size:26})})]}),s.jsxs("div",{className:"ef-chat-thread",ref:u,onScroll:y=>{const v=y.currentTarget;d.current=v.scrollHeight-v.scrollTop-v.clientHeight<40},"aria-label":"Example conversation",children:[s.jsx("div",{className:"ef-chat-message ef-chat-assistant",children:"Hi, Iâm Oliverâs AI. Ask me about street photography, my camera kit or a London photo walk."}),e>=G7&&s.jsx("div",{className:"ef-chat-message ef-chat-user",children:"How do I get better street photos at night?"}),e>=Y7&&s.jsx("div",{className:"ef-chat-message ef-chat-assistant",children:"Look for shop windows and street lights. Let the light guide your composition."}),e>=K7&&s.jsx("div",{className:"ef-chat-message ef-chat-user",children:"Which settings should I start with?"}),o&&s.jsx("div",{className:"ef-chat-message ef-chat-assistant ef-chat-continued","aria-label":"Answer after subscribing",children:c})]}),s.jsx("div",{className:"ef-chat-input-area",children:a?s.jsxs("div",{className:"ef-chat-paywall",role:"status",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Free messages used."})," ",Ul(xf/100),"/mo to keep chatting."]}
430),s.jsxs("button",{type:"button",className:"ef-subscribe",onClick:m,disabled:i,"aria-label":i?"Redirecting to subscription checkout":"Preview a paid subscription",children:[i&&s.jsx(fo,{name:"loader",size:12})," ",i?"Redirectingâ¦":"Subscribe"]})]}):s.jsxs("div",{className:"ef-chat-composer",children:[s.jsx("span",{"aria-hidden":"true",children:s.jsx(fo,{name:"plus",size:20})}),s.jsx("textarea",{rows:"1",readOnly:!0,"aria-label":"Example message",placeholder:"Ask anything..."}),s.jsxs("span",{className:"ef-chat-call","aria-hidden":"true",children:[s.jsx(fo,{name:"phone",size:17}),"Call"]})]})}),s.jsx("footer",{className:"ef-chat-footer",children:s.jsxs("p",{children:["AI Chat. Messages and AI replies may be reviewed by this expertâs owner for audience insights. Donât share sensitive personal information. ",s.jsx("a",{href:"https://greatexperts.ai/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})," · ",s.jsx("a",{href:"https://greatexperts.ai/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"})]})})]}),l&&s.jsx("div",{className:"ef-confirmation-overlay",children:s.jsxs("section",{ref:h,tabIndex:-1,className:"ef-confirmation",role:"dialog","aria-label":"Subscription confirmation preview",onKeyDown:y=>{y.key==="Escape"&&r&&n()},children:[s.jsx("span",{className:`ef-confirmation-icon ${r?"is-paid":""}`,children:s.jsx(fo,{name:r?"check":"loader",size:26})}),s.jsx("span",{className:"ef-confirmation-label",children:r?"Subscription active":"Confirming subscription"}),s.jsx("h3",{children:r?"Youâre subscribed":"Almost there"}),s.jsx("p",{children:r?"You now have unlimited 1-on-1 chat with Oliver Hayes for the next 30 days.":"Confirming your subscription to Oliver Hayes."}),s.jsxs("div",{className:"ef-confirmation-payment",children:[s.jsxs("span",{children:["Monthly subscription",s.jsx("strong",{children:Ul(xf/100)})]}),s.jsx("b",{children:r?"Paid":"Processingâ¦"})]}),s.jsx("p",{className:"ef-confirmation-renewal",children:"Renews monthly until you cancel."}),s.jsxs("button",{type:"button",onClick:n,disabled:!r,children:["Continue chatting ",s.jsx(fo,{name:"arrow",size:16})]})]})}),s.jsx("span",{className:"ef-sr-only",role:"status","aria-live":"polite",children:r?"Your subscription to Oliver Hayes is active. You can continue chatting.":""})]})}function uKe(){const e=B.useRef(null),t=B.useRef(null),n=B.useRef(null),[r,a]=B.useState("payment"),[i,o,l]=oKe(t);return B.useEffect(()=>{const c=e.current,u=()=>{c.style.setProperty("--ef-dashboard-scale",Math.min(c.clientWidth*.9/1040,c.clientHeight*.86/940)),c.style.setProperty("--ef-payment-scale",c.clientWidth*.38/440)};u();const d=new ResizeObserver(u);return d.observe(c),()=>d.disconnect()},[]),s.jsxs("div",{className:"ge-feature-row ef-feature",children:[s.jsxs("div",{className:"ef-scene",ref:e,children:[s.jsx("div",{ref:n,className:`ef-dashboard-window ${r==="dashboard"?"ef-front":""}`,onPointerDown:()=>a("dashboard"),onFocusCapture:()=>
430a("dashboard"),children:s.jsx(lKe,{elapsed:i})}),s.jsx("div",{ref:t,className:`ef-payment-window ${r==="payment"?"ef-front":""}`,onPointerDown:()=>a("payment"),onFocusCapture:()=>a("payment"),children:s.jsx(cKe,{elapsed:i,onSubscribe:o,onContinue:l})})]}),s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["Earn from ",s.jsx("em",{children:"your expertise."})]}),s.jsx("p",{children:"Offer paid access to your AI expert. Track subscriptions and earnings in one place."}),s.jsxs("a",{href:"/experts/new",children:["Start earning ",s.jsx(fo,{name:"arrow",size:18})]})]})]})}function Fk({src:e="/welcome/product-profile/knowledge.html"}){const t=B.useRef(null),n=B.useRef(null),r=B.useRef(!1),[a,i]=B.useState("overview"),o=l=>n.current?.contentWindow?.postMessage(l,location.origin);return B.useEffect(()=>{const l=t.current,c=()=>{const p=l.getBoundingClientRect();l.style.setProperty("--kf-scale",Math.min((p.width-48)/1200,(p.height-64)/1e3))},u=new ResizeObserver(c);u.observe(l),c();const d=new IntersectionObserver(([p])=>{r.current=p.isIntersecting&&p.intersectionRatio>=.45,o({type:"knowledge-demo-visibility",visible:r.current})},{threshold:.45});d.observe(l);const h=p=>{p.origin!==location.origin||p.source!==n.current?.contentWindow||(p.data?.type==="knowledge-demo-ready"&&o({type:"knowledge-demo-visibility",visible:r.current}),p.data?.type==="knowledge-demo-step"&&i(p.data.step))};return window.addEventListener("message",h),()=>{u.disconnect(),d.disconnect(),window.removeEventListener("message",h)}},[]),s.jsxs("article",{className:"ge-feature-row kf-feature","data-step":a,children:[s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["Your content. ",s.jsx("em",{children:"Connected."})]}),s.jsx("p",{children:"Showcase your socials and shop. Give your AI expert the files and links to answer your audience."}),s.jsxs("a",{href:"/experts/new",children:["Connect your content ",s.jsx("svg",{width:"19",height:"19",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})})]})]}),s.jsx("div",{className:"kf-scene",ref:t,children:s.jsx("iframe",{ref:n,className:"kf-product-frame",title:"See social channels and knowledge power your expert and profile",src:e,loading:"lazy"})})]})}function lv(e){const t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0;return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function Yne({src:e,poster:t="/welcome/assets/walkthrough-poster.webp",label:n="How to create your Great Experts profile",width:r=3316,height:a=2160}){const i=f.useRef(null),o=f.useRef(null),l=f.useRef(null),[c,u]=f.useState(!1),d=f.useCallback(L=>{l.current=L,u(!!L)},[]),[h,p]=f.useState(!1),[m,g]=f.useState(!0),[x,b]=f.useState(0),[y,v]=f.useState(0),[w,j]=f.useState(1),[E,S]=f.useState(!1),[_,k]=f.useState(!1),[C,N]=f.useState(!1),[A,T]=f.useState(!1),[I,$]=f.useState(""),[O,U]=f.useState(r/a);f.useEffect(()=>{const L=()=>T(document.fullscreenElement===i.current);return document.addEventListener("fullscreenchange",L),()=>{document.removeEventListener("fullscreenchange",L),window.clearTimeout(o.current)}},[]);const F=()=>{const L=l.current;g(!0),window.clearTimeout(o.current),L&&!L.paused&&(o.current=window.setTimeout(()=>g(!1),2200))},H=async()=>{const L=l.current;if(L){if(!L.paused){L.pause();return}try{$(""),L.ended&&(L.currentTime=0),await L.play(),F()}catch{N(!1),$("The video could not play. Please try again or open it directly.")}}},G=L=>{const K=l.current;!K||!y||(K.currentTime=Math.max(0,Math.min(y,L)),b(K.currentTime),F())},M=()=>{const L=l.current;L&&(L.volume===0?(L.volume=1,L.muted=!1):L.muted=!L.muted,F())},z=async()=>{const L=l.current;try{document.fullscreenElement===i.current?await document.exitFullscreen():i.current?.requestFullscreen?await i.current.requestFullscreen():L?.webkitEnterFullscreen&&L.webkitEnterFullscreen()}catch{$("Fullscreen is unavailable in this browser. You can still watch inline.")}F()},W=L=>{const K=L.currentTarget;v(Number.isFinite(K.duration)?K.duration:0),K.videoWidth&&K.videoHeight&&U(K.videoWidth/K.videoHeight)},D=()=>{N(!1),p(!1),$("The video is unavailable right now. Try opening it directly.")},Z=E||w===0,V=y?x/y*100:0;return s.jsxs("div",{className:"bf-player",ref:i,role:"region","aria-label":"Profile setup walkthrough",tabIndex:0,"data-enhanced":c,"data-playing":h,"data-controls-visible":m||!h,style:{"--walkthrough-ratio":O},onPointerMove:F,onPointerDown:F,onFocusCapture:F,onKeyDown:L=>{L.target===L.currentTarget&&([" ","k","ArrowLeft","ArrowRight","m","f"].includes(L.key)&&L.preventDefault(),(L.key===" "||L.key==="k")&&H(),L.key==="ArrowLeft"&&G(x-
4305),L.key==="ArrowRight"&&G(x+5),L.key==="m"&&M(),L.key==="f"&&z())},children:[s.jsxs("video",{ref:d,className:"bf-video",width:r,height:a,controls:!c,playsInline:!0,preload:"metadata",poster:t,"aria-label":n,onLoadedMetadata:W,onDurationChange:W,onTimeUpdate:L=>b(L.currentTarget.currentTime),onVolumeChange:L=>{S(L.currentTarget.muted),j(L.currentTarget.volume)},onPlay:()=>{p(!0),k(!1)},onPlaying:()=>{N(!1),F()},onPause:()=>{p(!1),N(!1),g(!0)},onEnded:()=>{k(!0),p(!1),g(!0)},onWaiting:()=>N(!0),onSeeked:()=>N(!1),onError:D,children:[s.jsx("source",{src:e,type:"video/mp4",onError:D}),"Your browser does not support embedded video. ",s.jsx("a",{href:e,children:"Open video directly"})]}),c&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"bf-player-surface",type:"button","aria-label":"Toggle video playback",tabIndex:-1,onClick:()=>{H()}}),!h&&!I&&s.jsx("button",{className:"bf-player-center",type:"button","aria-label":_?"Replay walkthrough":"Play walkthrough",onClick:()=>{H()},children:_?s.jsx(Du,{"aria-hidden":"true"}):s.jsx(Tr,{fill:"currentColor","aria-hidden":"true"})}),C&&h&&s.jsxs("span",{className:"bf-player-loading",role:"status",children:[s.jsx(vt,{"aria-hidden":"true"}),s.jsx("span",{className:"sr-only",children:"Loading video"})]}),s.jsxs("div",{className:"bf-player-controls",children:[s.jsx("button",{type:"button","aria-label":h?"Pause":"Play",onClick:()=>{H()},children:h?s.jsx(Lf,{fill:"currentColor","aria-hidden":"true"}):s.jsx(Tr,{fill:"currentColor","aria-hidden":"true"})}),s.jsx("input",{className:"bf-player-seek",type:"range","aria-label":"Seek video","aria-valuetext":`${lv(x)} of ${lv(y)}`,min:"0",max:y||1,step:"0.1",value:x,disabled:!y,onChange:L=>G(Number(L.target.value)),style:{"--range-progress":`${V}%`}}),s.jsxs("span",{className:"bf-player-time","aria-hidden":"true",children:[lv(x),s.jsxs("span",{children:[" / ",lv(y)]})]}),s.jsxs("div",{className:"bf-player-audio",children:[s.jsx("button",{type:"button","aria-label":Z?"Unmute":"Mute",onClick:M,children:Z?s.jsx(U4,{"aria-hidden":"true"}):s.jsx(uu,{"aria-hidden":"true"})}),s.jsx("input",{className:"bf-player-volume",type:"range","aria-label":"Volume",min:"0",max:"1",step:"0.05",value:Z?0:w,onChange:L=>{const K=l.current;K.volume=Number(L.target.value),K.muted=!1,F()},style:{"--range-progress":`${(Z?0:w)*100}%`}})]}),s.jsx("button",{type:"button","aria-label":A?"Exit fullscreen":"Enter fullscreen",onClick:()=>{z()},children:A?s.jsx(qT,{"aria-hidden":"true"}):s.jsx(Dye,{"aria-hidden":"true"})})]}),I&&s.jsxs("div",{className:"bf-player-error",role:"alert",children:[s.jsx("p",{children:I}),s.jsx("a",{href:e,target:"_blank",rel:"noreferrer",children:"Open video directly"})]})]})]})}const dKe="https://auth.greatexperts.ai/storage/v1/object/public/public-web-videos/walkthrough.mp4";function hKe(){return s.jsxs("div",{className:"bf-content",children:[s.jsxs("header",{className:"bf-heading",children:[s.jsxs("h2",{children:["Your profile is just ",s.jsx("em",{children:"a few clicks away."})]}),s.jsx("p",{children:"Put your content, sessions, and products in one place. Itâs easier than you think."})]}),s.jsx("div",{className:"bf-scene",id:"profile-building-preview",children:s.jsx(Yne,{src:dKe})})]})}const pKe=".ge-features > *, #testimonials > *, .bf-heading, .bf-scene, .ge-bottom-claim > form, .ge-world-banner, #faq > h2, #faq .ge-acc, #business > div",mKe=".ge-hero-phone, .pf-scene, .kf-scene, .ld-showcase, .ef-scene";function Bk({canonicalPath:e="/welcome",heroProfileSrc:t="/welcome/HeroPhone.dc.html?autoscroll=true",features:n={},pageClassName:r=""}){const{CallsFeature:a=KYe,ProfileFeature:i=$k,LeadsFeature:o=sKe,EarningsFeature:l=uKe,KnowledgeFeature:c=Fk}=n,u=Ps(),d=f.useRef(null),h=f.useRef(null),[p,m]=f.useState(""),[g,x]=f.useState(!1),b=UYe,y=!!p,v=E=>{const S=E.currentTarget,_=()=>S.parentElement?.classList.add("is-loaded"),k=()=>{const C=S.contentDocument?.querySelector("iframe");if(!C){setTimeout(k,100);return}C.addEventListener("load",_,{once:!0}),C.contentDocument?.readyState==="complete"&&C.contentDocument.body?.children.length&&_()};k()},w=()=>m(""),j=async E=>{if(E.preventDefault(),g)return;const S=E.currentTarget.elements.namedItem("profile-handle"),_=Mj(S.value.trim().replace(/^@/,"")),
430k=_?Jb(_):"Pick a username to continue.";if(k){m(k),S.focus();return}m(""),x(!0),window.scrollTo(0,0);try{await DP(_,u)}catch{m("Something went wrong. Please try again.")}finally{x(!1)}};return BP(h,{reveal:pKe,demos:mKe}),f.useEffect(()=>{const E=()=>{const S=window.innerWidth<=760,_=Math.max(240,window.innerWidth-48),k=S?.9:Math.max(.68,(window.innerHeight-200)/724);d.current?.style.setProperty("--hero-phone-scale",String(Math.min(S?.9:.82,_/356,k)))};return E(),window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)},[]),s.jsxs("div",{ref:h,className:r?`welcome-page ${r}`:"welcome-page",children:[s.jsx(vs,{path:e,title:"Great Experts | One page. Everything you offer.",description:"Give your audience one place to get answers, explore your offers, and work with you. Create your Great Experts profile."}),s.jsx(l0,{children:s.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..600;1,9..144,300..600&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&family=Manrope:wght@400;500;600;700&display=swap",rel:"stylesheet"})}),s.jsxs("div",{className:"ge-home",style:{position:"relative",background:"#F7F7F4",color:"#141413",fontFamily:"'Inter', system-ui, sans-serif",overflowX:"clip"},children:[s.jsx("div",{className:"ge-nav",style:{position:"sticky",top:"0",zIndex:"30",padding:"16px 40px 0"},children:s.jsx("div",{style:{position:"relative",margin:"0 auto",maxWidth:"1340px"},children:s.jsx(Dk,{})})}),s.jsxs("section",{className:"ge-hero",style:{position:"relative",zIndex:"1",margin:"0 auto",maxWidth:"1180px",padding:"64px 40px 40px",display:"flex",flexWrap:"wrap",gap:"40px 48px",alignItems:"center",justifyContent:"space-between"},children:[s.jsxs("div",{className:"ge-hero-copy",style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"28px",minWidth:"0",flex:"1 1 380px",maxWidth:"640px",containerType:"inline-size"},children:[s.jsxs("h1",{style:{margin:"0",width:"100%",fontFamily:"'Fraunces', Georgia, serif",fontSize:"clamp(18px,7.5cqw,48px)",fontWeight:"500",lineHeight:"1.1",letterSpacing:"-0.025em",color:"#141413"},children:[s.jsx("span",{style:{display:"block",whiteSpace:"nowrap"},children:"The all-in-one sales tool."}),s.jsxs("span",{className:"ge-hero-benefits",children:["Understand audience. Capture leads. Grow sales. Save time. ",s.jsx("span",{className:"ge-hero-endless",children:"And much more."})]}),s.jsx("span",{className:"ge-hero-rotator","aria-hidden":"true",children:s.jsxs("span",{className:"ge-hero-phrase-track",children:[s.jsx("span",{children:"Understand audience."}),s.jsx("span",{children:"Capture leads."}),s.jsx("span",{children:"Grow sales."}),s.jsx("span",{children:"Save time."}),s.jsx("span",{className:"ge-hero-endless",children:"And much more."}),s.jsx("span",{children:"Understand audience."})]})})]}),s.jsx("p",{style:{margin:"0",maxWidth:"520px",fontSize:"19px",lineHeight:"1.5",letterSpacing:"-0.01em",color:"#54524C"},children:"Give your audience one place to get answers, explore your offers, and work with you."}),s.jsxs("form",{id:"create-profile",autoComplete:"off",onSubmit:j,style:{width:"100%",maxWidth:"560px",scrollMarginTop:"132px"},children:[s.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"10px",width:"100%"},children:[s.jsxs("label",{htmlFor:"home-handle",style:{minWidth:"0",flex:"1 1 290px",minHeight:"58px",display:"flex",alignItems:"center",border:"2px solid #000",borderRadius:"999px",padding:"0 18px 0 14px",background:"#FDFCF8",cursor:"text",transition:"box-shadow 160ms ease"},className:"welcome-interaction-0",children:[s.jsx("img",{src:"/welcome/assets/brand/greatexperts-mark-indigo.png",alt:"",style:{width:"26px",height:"26px",flex:"none",marginRight:"8px",objectFit:"contain"}}),s.jsx("span",{style:{flex:"none",marginRight:"9px",color:"#141413",fontSize:"16px",fontWeight:"700",letterSpacing:"-0.02em",lineHeight:"1"},children:"greatexperts.ai/"}),s.jsx("input",{id:"home-handle",type:"text",name:"profile-handle",autoComplete:"off",spellCheck:"false",placeholder:"username",maxLength:"30",onChange:w,"aria-label":"Great Experts username",style:{minWidth:"0",flex:"1",border:"0",background:"transparent",color:"#141413",font:"inherit",fontSize:"16px",outline:"none",caretColor:"#141413"}})]}),s.jsxs("button",{type:"submit",disabled:g,"aria-busy":g,className:"ge-claim-submit welcome-interaction-1 welcome-interaction-2",style:{position:"relative",isolation:"isolate",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",flex:"none",height:"58px",padding:"0 26px",border:"0",borderRadius:"999px",background:"#3D3DF5",color:"#FAF9F5",fontFamily:"inherit",fontSize:"16px",fontWeight:"600",letterSpacing:"0.01em",whiteSpace:"nowrap",cursor:"pointer",transition:"background-color 160ms, transform 160ms var(--ge-ease-out)"},children:[s.jsx("span",{style:{position:"relative",zIndex:"2"},children:"Get started for free"}),s.jsx("span",{"aria-hidden":"true",className:"ge-sheen",style:{pointerEvents:"none",position:"absolute",top:"-20%",bottom:"-20%",left:"-60%",zIndex:"1",width:"38%",transform:"skewX(-18deg)",background:"linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent)"}})]})]}),y&&s.jsx(s.Fragment,{children:s.jsx("div",{role:"status",style:{marginTop:"8px",color:"#86847B",fontSize:"13px",fontWeight:"500"},children:p})})]}),s.jsx("p",{style:{margin:"-8px 0 0",fontSize:"13.5px",color:"#86847B"},children:"Start free. No credit card required."})]}),s.jsx("div",{className:"ge-hero-phone",ref:d,style:{position:"relative",flex:"0 0 auto",margin:"0 auto"},children:s.jsx("iframe",{className:"ge-phone-device",title:"Interactive Great Experts profile preview",src:t,style:{border:0},onLoad:v})})]}),s.jsx("section",{id:"voice-calls",className:"ge-features","aria-label":"AI voice calls",children:s.jsx(a,{})}),s.jsx(qne,{}),s.jsx("section",{id:"your-page",className:"ge-features","aria-label":"Your profile and customization",children:s.jsx(i,{})}),s.jsx("section",{className:"ge-features",id:"leads-demo","aria-label":"Audience insights and leads",children:s.jsx(o,{})}),s.jsx("section",{id:"paid-experts",className:"ge-features","aria-label":"Paid experts and earnings",children:s.jsx(l,{})}),s.jsx("section",{id:"connected-knowledge",className:"ge-features","aria-label":"Connect your content, shop and knowledge",children:s.jsx(c,{})}),s.jsx("section",{id:"how-it-works",className:"ge-build-section","aria-label":"How to build your profile",children:s.jsx(hKe,{})}),s.jsx("section",{className:"ge-bottom-claim","aria-label":"Choose your Great Experts username",children:s.jsxs("form",{id:"create-profile-bottom",autoComplete:"off",onSubmit:j,style:{width:"100%",maxWidth:"640px",scrollMarginTop:"132px"},children:[s.jsxs("div",{className:"ge-bottom-signup-bar",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"10px",width:"100%"},children:[s.jsxs("label",{htmlFor:"home-handle-2",style:{minWidth:"0",flex:"1 1 290px",minHeight:"58px",display:"flex",alignItems:"center",border:"2px s
430olid #000",borderRadius:"999px",padding:"0 18px 0 14px",background:"#FDFCF8",cursor:"text",transition:"box-shadow 160ms ease"},className:"welcome-interaction-0",children:[s.jsx("img",{src:"/welcome/assets/brand/greatexperts-mark-indigo.png",alt:"",style:{width:"26px",height:"26px",flex:"none",marginRight:"8px",objectFit:"contain"}}),s.jsx("span",{style:{flex:"none",marginRight:"9px",color:"#141413",fontSize:"16px",fontWeight:"700",letterSpacing:"-0.02em",lineHeight:"1"},children:"greatexperts.ai/"}),s.jsx("input",{id:"home-handle-2",type:"text",name:"profile-handle",autoComplete:"off",spellCheck:"false",placeholder:"username",maxLength:"30",onChange:w,"aria-label":"Great Experts username",style:{minWidth:"0",flex:"1",border:"0",background:"transparent",color:"#141413",font:"inherit",fontSize:"16px",outline:"none",caretColor:"#141413"}})]}),s.jsxs("button",{type:"submit",disabled:g,"aria-busy":g,className:"ge-claim-submit welcome-interaction-1 welcome-interaction-2",style:{position:"relative",isolation:"isolate",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",flex:"none",height:"58px",padding:"0 26px",border:"0",borderRadius:"999px",background:"#3D3DF5",color:"#FAF9F5",fontFamily:"inherit",fontSize:"16px",fontWeight:"600",letterSpacing:"0.01em",whiteSpace:"nowrap",cursor:"pointer",transition:"background-color 160ms, transform 160ms var(--ge-ease-out)"},children:[s.jsx("span",{style:{position:"relative",zIndex:"2"},children:"Get started for free"}),s.jsx("span",{"aria-hidden":"true",className:"ge-sheen",style:{pointerEvents:"none",position:"absolute",top:"-20%",bottom:"-20%",left:"-60%",zIndex:"1",width:"38%",transform:"skewX(-18deg)",background:"linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent)"}})]}),s.jsx("p",{className:"welcome-claim-note",children:"Start free. No credit card required."})]}),y&&s.jsx(s.Fragment,{children:s.jsx("div",{role:"status",style:{marginTop:"8px",color:"#86847B",fontSize:"13px",fontWeight:"500"},children:p})})]})}),s.jsx("section",{className:"ge-world-section","aria-label":"Create your Great Experts page",children:s.jsxs("div",{className:"ge-world-banner",children:[s.jsxs("div",{className:"ge-world-copy",children:[s.jsxs("h2",{children:[s.jsx("span",{children:"Your whole world, in one page."}),s.jsx("em",{children:"With an AI Expert answering in your voice."})]}),s.jsxs("div",{className:"ge-world-actions",children:[s.jsx("a",{className:"ge-world-primary",href:"/experts/new",children:"Create profile"}),s.jsx("a",{href:"https://calendly.com/anna-greatspire/strategy-call",target:"_blank",rel:"noopener noreferrer",children:"Book a call"})]})]}),s.jsxs("div",{className:"ge-world-profiles","aria-hidden":"true",children:[s.jsxs("div",{className:"ge-world-track",children:[s.jsx("img",{src:"/welcome/assets/profiles/elena.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/priya.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/elena.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/priya.jpg",alt:"",loading:"lazy"})]}),s.jsxs("div",{className:"ge-world-track",children:[s.jsx("img",{src:"/welcome/assets/profiles/tercera.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/lukas.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/tercera.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/lukas.jpg",alt:"",loading:"lazy"})]})]})]})}),s.jsx(UP,{items:b}),s.jsx("section",{id:"business",style:{position:"relative",zIndex:"1",margin:"120px auto 0",maxWidth:"1180px",padding:"0 40px",scrollMarginTop:"96px"},children:s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",borderRadius:"26px",border:"1px solid rgba(232,230,220,0.95)",background:"rgba(244,244,253,0.8)",padding:"20px 24px",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.95), 0 20px 44px -24px rgba(60,50,120,0.40)"},children:[s.jsx("span",{style:{display:"inline-flex",flexShrink:"0",alignItems:"center",whiteSpace:"nowrap",borderRadius:"999px",border:"1px solid rgba(61,61,245,0.35)",background:"rgba(61,61,245,0.07)",padding:"8px 16px",fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:"500",textTransform:"uppercase",letterSpacing:"0.18em",color:"#3D3DF5"},children:"For business"}),s.jsxs("div",{style:{display:"flex",width:"100%",minWidth:"0",alignItems:"center",justifyContent:"space-between",gap:"24px"},children:[s.jsxs("p",{style:{margin:"0",minWidth:"0",fontFamily:"'Fraunces', Georgia, serif",fontSize:"23px",fontWeight:"500",lineHeight:"1.26",letterSpacing:"-0.015em",color:"#141413"},children:["Running a company? Great Experts works on ",s.jsx("em",{style:{fontStyle:"italic",color:"#3D3DF5"},children:"your website"})," too."]}),s.jsxs("a",{href:"/forbusiness",style:{display:"inline-flex",flexShrink:"0",alignItems:"center",justifyContent:"center",gap:"9px",borderRadius:"999px",background:"#3D3DF5",padding:"14px 26px",fontSize:"12.5px",fontWeight:"700",textTransform:"uppercase",letterSpacing:"0.12em",color:"#FAF9F5",transition:"background 200ms, transform 160ms var(--ge-ease-out)"},className:"welcome-interaction-6",children:["See how ",s.jsx("span",{"aria-hidden":"true",style:{fontSize:"14px"},children:"â"})]})]})]})}),s.jsx(zP,{})]})]})}function fKe(){return s.jsx(Bk,{})}function Yc({name:e,size:t=20}){const n={phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"}),mic:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),s.jsx("path",{d:"M5 10v2a7 7 0 0 0 14 0v-2M12 19v3M8 22h8"})]}),micOff:s.jsx(s.Fragment,{children:s.jsx("path",{d:"m2 2 20 20M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V5a3 3 0 0 0-5.94-.6M5 10v2a7 7 0 0 0 12 4.9M19 10v2c0 .67-.09 1.32-.27 1.94M12 19v3M8 22h8"})}),arrow:s.jsx("path",{d:"M4 12h16m-6-6 6 6-6 6"}),external:s.jsx("path",{d:"M7 7h10v10M7 17 17 7"}),chevronRight:s.jsx("path",{d:"m9 6 6 6-6 6"}),chevronLeft:s.jsx("path",{d:"m15 6-6 6 6 6"}),chevronUp:s.jsx("path",{d:"m6 15 6-6 6 6"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.65",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]})}const Td=1e4,gKe="What Friday Club merch should I check out first?",xKe=["Try the Friday Club Hoodie Ultra.","Or the Off Script Tee Black.","Add a Friday Club Cup too.","Iâve shared all three here for you."],bKe=[{at:2400,title:"Friday Club Hoodie Ultra",category:"EUR97",image:"hoodie.webp",url:"https://greatexperts.ai/fun"},{at:4e3,title:"Off Script Tee Black",category:"EUR60",image:"tee.webp",url:"https://greatexperts.ai/fun"},{at:5500,title:"Friday Club Cup",category:"EUR25",image:"cup.webp",url:"https://greatexperts.ai/fun"}],J7=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function yKe(e,t,n,r=1){const[a,i]=B.useState(0),[o,l]=B.useState(!1),c=B.useRef(0);return B.useEffect(()=>{const u=window.matchMedia("(prefers-reduced-motion: reduce)"),d=()=>l(u.matches);return d(),u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[]),B.useEffect(()=>{c.current=0,i(0)},[n]),B.useEffect(()=>{if(o){c.current=Td,i(Td);return}if(!e||t||c.current>=Td)return;let u,d=null,h=c.current;const p=g=>{document.hidden?d=null:(d!==null&&(c.current=Math.min(Td,c.current+(g-d)*r)),d=g,(c.current-h>=80||c.current===Td)&&(h=c.current,i(h))),c.current<Td&&(u=requestAnimationFrame(p))},m=()=>{d=null};return document.addEventListener("visibilitychange",m),u=requestAnimationFrame(p),()=>{cancelAnimationFrame(u),document.removeEventListener("visibilitychange",m)}},[e,t,n,o,r]),a}function Q7({products:e,large:t=!1}){return s.jsx("section",{className:`cf-recommendations ${t?"cf-recommendations-large":""}`,"aria-label":"Profile recommendations",children:e.map(n=>s.jsxs("a",{className:"cf-product-row",href:n.url,target:"_blank",rel:"noopener noreferrer","aria-label":`View product: ${n.title}`,children:[s.jsx("span",{className:"cf-product-image",children:s.jsx("img",{src:`/welcome/creator/assets/${n.image}`,alt:""})}),s.jsxs("span",{className:"cf-product-info",children:[s.jsx("strong",{children:n.title}),s.jsx("span",{children:n.category})]}),s.jsx(Yc,{name:"external",size:t?18:16})]},n.title))})}function Z7({device:e,active:t,onComplete:n,onEnd:r,playbackRate:a=1}){const[i,o]=B.useState(!1),[l,c]=B.useState(!1),[u,d]=B.useState(0),[h,p]=B.useState(null),[m,g]=B.use
430State(!0),x=yKe(t,l,u,a),b=B.useRef(!1);B.useEffect(()=>{b.current=!1},[u]),B.useEffect(()=>{x>=Td&&n&&!b.current&&(b.current=!0,n())},[x,n]);const y=x>=1750&&x<8200,v=x>=1200&&x<1750,w=l?[]:bKe.filter(T=>x>=T.at),j=w.length>0,E=j&&(h===null?x>=5e3:h),S=x<3200?0:x<4800?1:x<6500?2:3,_=gKe.split(" ").slice(0,Math.max(1,Math.floor(x/100))).join(" "),k=258-Math.floor(x/1e3),C=B.useRef(null),N=e==="phone";B.useEffect(()=>{const T=C.current,I=()=>T.style.setProperty("--call-scale",T.clientWidth/(N?390:1040));I();const $=new ResizeObserver(I);return $.observe(T),()=>$.disconnect()},[N]);const A=()=>{c(!1),o(!1),p(null),g(!0),d(T=>T+1)};return s.jsx("div",{className:`cf-device-screen ${N?"cf-screen-phone":"cf-screen-laptop"}`,ref:C,children:s.jsxs("div",{className:`cf-call-ui ${l?"cf-ended":""} ${i?"cf-muted":""} ${j?"cf-has-offers":""} ${y?"cf-speaking":v?"cf-thinking":"cf-listening"}`,role:"group","aria-label":`AI voice call preview on ${e}`,children:[s.jsxs("div",{className:"cf-call-main",children:[s.jsxs("header",{className:"cf-call-header",children:[s.jsxs("div",{className:"cf-identity",children:[s.jsxs("span",{children:[s.jsx("img",{src:"/welcome/creator/assets/avatar.webp",alt:""}),s.jsx("i",{"aria-hidden":"true"})]}),s.jsx("strong",{children:"AI Maxxx"})]}),s.jsxs("div",{className:"cf-time",children:[s.jsx(Yc,{name:"phone",size:14}),!l&&s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",children:[s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"#e8e6dc",strokeWidth:"2.5"}),s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"#3d3df5",strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${k/300*40.8} 40.8`,transform:"rotate(-90 8 8)"})]}),s.jsx("span",{children:l?J7(42+Math.floor(x/1e3)):`${J7(k)} remaining`})]})]}),s.jsxs("div",{className:"cf-call-stage",children:[s.jsxs("div",{className:"cf-avatar-stage",children:[s.jsxs("div",{className:"cf-aura","aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("div",{className:"cf-avatar",children:[s.jsx("i",{className:"cf-avatar-halo","aria-hidden":"true"}),s.jsx("i",{className:"cf-avatar-ring","aria-hidden":"true"}),s.jsx("i",{className:"cf-avatar-ripple","aria-hidden":"true"}),s.jsx("img",{src:"/welcome/creator/assets/avatar.webp",alt:"Max Carter"})]})]}),s.jsx("p",{className:"cf-call-status",role:"status",children:l?"Call ended":i?"Microphone off":y?"Speaking":v?"Thinking":"Listening"}),s.jsx("div",{className:"cf-transcript",children:!l&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"cf-question",children:["You · ",_]}),x>=1750&&s.jsx("div",{className:"cf-captions","aria-label":"Call transcript",children:s.jsx("div",{className:"cf-caption-track",style:{transform:`translateY(${(1-S)*32.8}px)`},children:xKe.map((T,I)=>s.jsx("span",{className:I===S?"is-current":"","aria-current":I===S?"true":void 0,children:T},T))})})]})})]}),N&&j&&s.jsxs("button",{className:"cf-offers-bar",onClick:()=>p(!0),"aria-expanded":E,children:[s.jsx("span",{className:"cf-offer-thumbs",children:w.map(T=>s.jsx("span",{children:s.jsx("img",{src:`/welcome/creator/assets/${T.image}`,alt:""})},T.title))}),s.jsxs("strong",{children:[w.length," mentioned in this call"]}),s.jsx(Yc,{name:"chevronUp",size:16})]}),s.jsx("footer",{className:"cf-call-controls",children:l?s.jsxs("button",{className:"cf-call-again",onClick:A,children:[s.jsx(Yc,{name:"phone",size:16}),"Call again"]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`cf-mute ${i?"is-muted":""}`,onClick:()=>o(!i),"aria-pressed":i,"aria-label":i?"Unmute microphone":"Mute microphone",children:s.jsx(Yc,{name:i?"micOff":"mic"})}),s.jsxs("button",{className:"cf-end",onClick:()=>r?r():c(!0),children:[s.jsx(Yc,{name:"phone",size:16}),"End call"]})]})})]}),!N&&j&&(m?s.jsxs("aside",{className:"cf-offers-panel","aria-label":"Mentioned during this call",children:[s.jsxs("div",{className:"cf-offers-heading",children:[s.jsx("h3",{children:"Mentioned in this call"}),s.jsx("span",{children:w.length}),s.jsx("button",{onClick:()=>g(!1),"aria-label":"Collapse recommendations",children:s.jsx(Yc,{name:"chevronRight",size:16})})]}),s.jsx(Q7,{products:w,large:!0})]}):s.jsxs("button",{className:"cf-offers-tab",onClick:()=>g(!0),"aria-label":`Show ${w.length} mentioned in this call`,"aria-expanded":!1,children:[s.jsx(Yc,{name:"chevronLeft",size:16}),w.slice(-2).map(T=>
430s.jsx("img",{src:`/welcome/creator/assets/${T.image}`,alt:""},T.title)),s.jsx("span",{children:w.length})]})),N&&E&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"cf-offers-backdrop",onClick:()=>p(!1),"aria-label":"Back to the call"}),s.jsxs("div",{className:"cf-offers-sheet",role:"dialog","aria-modal":"false","aria-label":"Mentioned in this call",onKeyDown:T=>{T.key==="Escape"&&p(!1)},children:[s.jsx("button",{className:"cf-sheet-handle",onClick:()=>p(!1),"aria-label":"Close recommendations",children:s.jsx("span",{})}),s.jsxs("div",{className:"cf-offers-heading",children:[s.jsx("h3",{children:"Mentioned in this call"}),s.jsx("span",{children:w.length})]}),s.jsx(Q7,{products:w})]})]})]})})}function vKe(){const e=B.useRef(null),t=B.useRef(null),[n,r]=B.useState(!1);return B.useEffect(()=>{const a=new IntersectionObserver(([c])=>r(c.isIntersecting&&c.intersectionRatio>=.4),{threshold:[0,.4],rootMargin:"-90px 0px 0px"});e.current&&a.observe(e.current);const i=t.current,o=()=>i.style.setProperty("--phone-scale",i.clientWidth/356);o();const l=new ResizeObserver(o);return l.observe(i),()=>{a.disconnect(),l.disconnect()}},[]),s.jsx("div",{className:"cf-showcase",children:s.jsx("div",{className:`cf-scene ${n?"cf-visible":""}`,ref:e,"aria-label":"Voice calls on laptop and phone",children:s.jsxs("div",{className:"cf-devices",children:[s.jsxs("div",{className:"cf-laptop",children:[s.jsx("div",{className:"cf-laptop-display",children:s.jsx(Z7,{device:"laptop",active:n})}),s.jsx("img",{className:"cf-laptop-frame",src:"/welcome/assets/device-frames/macbook-pro-14-space-black.png",alt:"","aria-hidden":"true",draggable:"false"})]}),s.jsx("div",{className:"cf-phone",ref:t,children:s.jsxs("div",{className:"cf-phone-device",children:[s.jsx("span",{className:"cf-phone-side cf-phone-silent","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-volume-up","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-volume-down","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-power","aria-hidden":"true"}),s.jsxs("div",{className:"cf-phone-display",children:[s.jsx(Z7,{device:"phone",active:n}),s.jsx("div",{className:"cf-phone-home","aria-hidden":"true",children:s.jsx("span",{})})]})]})})]})})})}const $j=[{id:1,name:"Emily Parker",time:"12 min ago",status:"New",ready:"Ready to book",source:"Instagram",topic:"Birthday shoutout",email:"[email protected]",summary:"Wants a birthday shoutout for a friend. Asked about timing, the message and how to send a request.",message:"Hi Max, weâd love two birthday shoutouts for our friends. Can we send the details?",question:"Iâd love a birthday shoutout for my friend.",answer:"A birthday shoutout is a great fit. Send a contact request and Max can follow up with you.",offering:"Birthday shoutout",price:"EUR149 · Personal shoutout"},{id:2,name:"James Wilson",time:"38 min ago",status:"New",ready:"Exploring options",source:"YouTube",topic:"Friday Club merch",email:"[email protected]",summary:"Looking for Friday Club merch. Interested in the Friday Club Hoodie Ultra and wants advice before choosing.",message:"Could you help me decide which Friday Club piece is right for me?",question:"What Friday Club merch would you recommend?",answer:"The Friday Club Hoodie Ultra is a cozy everyday pick for EUR97. The Off Script Tee Black is another option at EUR60.",offering:"Friday Club Hoodie Ultra",price:"EUR97 · Shop"},{id:3,name:"Sophie Bennett",time:"2 hours ago",status:"Contacted",ready:"Ready to book",source:"Profile page",topic:"Challenge ideas",email:"[email protected]",summary:"Planning a fan challenge video and looking for personal feedback on a selection of 12 ideas.",message:"Iâm putting together my first challenge video. Could we look at the ideas together?",question:"Can Max review my challenge ideas?",answer:"Send a request for a 45 minute challenge brainstorm with Max to review your ideas, discuss the video and work out your next steps.",offering:"Challenge brainstorm",price:"EUR95 · 45 minutes"},{id:4,name:"Alex Morgan",time:"8 days ago",status:"New",ready:"Ready to talk",source:"Instagram",topic:"Brand campaign",email:"[email protected]",summary:"A streetwear brand is planning a creator campaign and wants to discu
430ss a video collaboration.",message:"Weâre launching a small streetwear collection. Are you available for a video collaboration?",question:"Does Max work with clothing brands?",answer:"Pitch a video collaboration with Max. Send a contact request with your brief so he can discuss your ideas with you.",offering:"Videos & brand campaigns",price:"Work together"},{id:5,name:"Daniel Reed",time:"12 days ago",status:"Closed",ready:"Exploring options",source:"YouTube",topic:"Friday Club gifts",email:"[email protected]",summary:"Asked about Friday Club gifts and explored the cup and tour poster in Maxâs shop.",message:"Thanks for the gift recommendations. Iâve found the right merch.",question:"Is there a small Friday Club gift I can pick up?",answer:"The Friday Club Cup is EUR25 and the Tour Poster is EUR17. Youâll find both in Maxâs shop.",offering:"Friday Club Cup",price:"EUR25 · Shop"}];function wKe({phase:e,onPause:t,onCapture:n,onPreviewNote:r}){const[a,i]=B.useState(!1),[o,l]=B.useState(null),[c,u]=B.useState("[email protected]"),[d,h]=B.useState(!0),[p,m]=B.useState(""),[g,x]=B.useState([]),[b,y]=B.useState(!0),[v,w]=B.useState(!1),j=B.useRef(null),E=B.useRef(null);B.useEffect(()=>{l(null),i(!1),e===0&&(u("[email protected]"),h(!0),m(""),x([]))},[e]);const S=o||(e===2?"form":e===3?"sent":"chat");B.useEffect(()=>{j.current&&j.current.scrollTo({top:j.current.scrollHeight,behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"})},[e,g]);const _=(T,I=20)=>{const $={menu:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),plus:s.jsx("path",{d:"M12 5v14M5 12h14"}),close:s.jsx("path",{d:"m6 6 12 12M6 18 18 6"}),check:s.jsx("path",{d:"m20 6-11 11-5-5"}),mail:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),s.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),up:s.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})};return s.jsx("svg",{width:I,height:I,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:T==="menu"?1.35:1.85,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:$[T]})},k=()=>{t(),i(!1),h(!1),l("form")},C=()=>{t(),l("chat")},N=()=>{p.trim()&&(t(),x(T=>[...T,{role:"user",text:p.trim()},{role:"ai",text:"To ask Max about a shoutout, use Contact in the menu to send your details and conversation."}]),m(""))},A=d&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c);return s.jsxs("aside",{ref:E,className:`lc-shell ${v?"lc-expanded":""}`,"aria-label":"Chat with AI Maxxx · demonstration",onPointerDownCapture:t,onFocusCapture:t,children:[s.jsxs("header",{className:"lc-header",inert:S!=="chat"?"":void 0,children:[s.jsx("img",{src:"/welcome/creator/assets/avatar.webp",alt:"Max Carter"}),s.jsxs("div",{className:"lc-name",children:[s.jsx("strong",{children:"AI Maxxx"}),s.jsxs("small",{children:["Powered by ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",children:"Great Experts"})]})]}),s.jsx("button",{className:"lc-icon",type:"button","aria-label":"Conversation menu","aria-expanded":a,onClick:()=>i(!a),children:_("menu",26)})]}),s.jsxs("div",{className:"lc-body",inert:S!=="chat"?"":void 0,children:[s.jsxs("div",{className:"lc-thread",ref:j,children:[s.jsx("div",{className:"lc-message lc-ai",children:"Yo! Ask me about the videos, Friday Club or pitch me a challenge idea."}),b&&e>=0&&s.jsx("div",{className:"lc-message lc-user",children:"Iâd love a birthday shoutout for my friend."}),b&&e>=1&&s.jsx("div",{className:"lc-message lc-ai",children:"A birthday shoutout is a great fit. Send a contact request and Max can follow up with you."}),g.map((T,I)=>s.jsx("div",{className:`lc-message lc-${T.role}`,children:T.text},I))]}),s.jsx("div",{className:"lc-compose",children:s.jsxs("div",{className:"lc-composer",children:[s.jsx("button",{className:"lc-icon",type:"button","aria-label":"Attach files",onClick:()=>r("Attachments are available in the full product."),children:_("plus")}),s.jsx("textarea",{rows:"1","aria-label":"Demo message",placeholder:"Ask anything...",maxLength:"2000",value:p,onChange:T=>m(T.target.value),onKeyDown:T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),N())}}),p.trim()?s.jsx("button",{type:"button",className:"lc-send","aria-label":"Send demo message",onClick:N,children:_("up",18)}):s.jsxs("button",{type:"button",className:"lc-call","aria-label":"Start a voice call with this AI expert",onClick:()=>r("Voice calls are available in the full product."),children:[_("phone",17),"Call"]})]})}),a&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"lc-menu-scrim",type:"button","aria-label":"Close conversation menu",onClick:()=>i(!1)}),s.jsxs("aside",{className:"lc-menu","aria-label":"Conversations",children:[s.jsx("button",{className:"lc-menu-action",onClick:k,children:"Contact"}),s.jsx("button",{className:"lc-menu-action",onClick:()=>{w(!v),i(!1)},children:v?"Exit full screen":"Expand"}),s.jsx("h4",{children:"Conversations"}),s.jsxs("button",{className:"lc-menu-new",onClick:()=>{i(!1),y(!1),x([]),m("")},children:[_("plus",17),"New conversation"]}),s.jsx("button",{className:"lc-history-item",onClick:()=>{i(!1),y(!0)},children:"Birthday shoutout"})]})]})]}),(S==="form"||S==="sent")&&s.jsxs("div",{className:"lc-modal-wrap",children:[s.jsx("button",{className:"lc-modal-shade",type:"button","aria-label":"Close contact request",onClick:C}),s.jsxs("section",{className:"lc-modal",role:"dialog","aria-label":S==="sent"?"Request sent":"Send a contact request",onKeyDown:T=>{T.key==="Escape"&&C()},children:[s.jsx("button",{className:"lc-modal-close","aria-label":"Close contact form",type:"button",onClick:C,children:_("close")}),S==="form"?s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"Send a contact request"}),s.jsxs("form",{onSubmit:T=>{T.preventDefault(),A&&(n(c),l("sent"))},children:[s.jsxs("label",{className:"lc-email",children:[_("mail",16),s.jsx("input",{"aria-label":"Contact request email",type:"email",autoComplete:"off",placeholder:"Email",value:c,onChange:T=>u(T.target.value),required:!0})]}),s.jsxs("label",{className:"lc-consent",children:[s.jsx("input",{type:"checkbox",checked:d,onChange:T=>h(T.target.checked)}),s.jsx("span",{className:"lc-check-box","aria-hidden":"true",children:_("check",14)}),s.jsxs("span",{children:["I am 18+ and agree to the ",s.jsx("a",{href:"https://greatexperts.ai/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"})," and ",s.jsx("a",{href:"https://greatexperts.ai/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),", and to share my contact details and conversation with Max Carter."]})]}),s.jsx("button",{className:"lc-contact-submit",type:"submit",disabled:!A,children:"Send a contact request"})]})]}):s.jsxs("div",{className:"lc-sent",children:[s.jsx("span",{className:"lc-sent-check",children:_("check")}),s.jsx("h3",{children:"Request sent"}),s.jsx("p",{children:"Thanks for reaching out. Max will get back to you soon."}),s.jsxs("p",{className:"lc-reply-email",children:["The reply will go to ",s.jsx("strong",{children:c.trim()}),"."]}),s.jsx("div",{children:s.jsx("button",{type:"button",className:"lc-done",onClick:C,children:"Done"})})]})]})]})]})}const Kne=["New","Contacted","Replied","Not replied","Booked a call","Not relevant"],jKe=[["1","Today"],["7","7 days"],["30","30 days"],["all","All time"]],eS=[["insights","Insights"],["conversations","Conversations"],["leads","Leads"]];function bi({name:e,size:t=16}){const n={search:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"10",cy:"10",r:"6"}),s.jsx("path",{d:"m15 15 5 5"})]}),download:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),chevron:s.jsx("path",{d:"m9 5 7 7-7 7"}),down:s.jsx("path",{d:"m6 9 6 6 6-6"}),spark:s.jsx("path",{d:"m12 3 2.5 6.5L21 12l-6.5 2.5L12 21l-2.5-6.5L3 12l6.5-2.5Z"}),mail:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),s.jsx("path",{d:"m3 7 9 6 9-6"})]}),clock:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 7v5l3 2"})]}
430),message:s.jsx("path",{d:"M21 11.5a8.4 8.4 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.4 8.4 0 0 1-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.4 8.4 0 0 1 3.8-.9h.5a8.5 8.5 0 0 1 8 8v.5Z"}),bot:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"4",y:"7",width:"16",height:"13",rx:"3"}),s.jsx("path",{d:"M12 3v4M9 12v2m6-2v2M2 12h2m16 0h2"})]}),source:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"m16 8-3 5-5 3 3-5Z"})]}),file:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),s.jsx("path",{d:"M14 2v6h6M8 13h8m-8 4h8"})]}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72l.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45l2.81.7A2 2 0 0 1 22 16.92z"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]||n.message})}function Xne({value:e,onChange:t,label:n}){return s.jsxs("label",{className:"lp-search",children:[s.jsx(bi,{name:"search"}),s.jsx("input",{type:"search","aria-label":n,placeholder:n,value:e,onChange:r=>t(r.target.value)})]})}function _Ke({value:e,onChange:t,options:n,label:r}){const[a,i]=B.useState(!1),o=B.useRef(null);return B.useEffect(()=>{if(!a)return;const l=c=>{o.current?.contains(c.target)||i(!1)};return document.addEventListener("pointerdown",l),()=>document.removeEventListener("pointerdown",l)},[a]),s.jsxs("div",{className:"lp-select",ref:o,onKeyDown:l=>{l.key==="Escape"&&i(!1)},children:[s.jsxs("button",{type:"button","aria-label":r,"aria-expanded":a,"aria-haspopup":"listbox",onClick:()=>i(!a),children:[n.find(l=>l[0]===e)?.[1],s.jsx(bi,{name:"down"})]}),a&&s.jsx("div",{className:"lp-options",role:"listbox","aria-label":r,children:n.map(([l,c])=>s.jsxs("button",{type:"button",role:"option","aria-selected":l===e,onClick:()=>{t(l),i(!1)},children:[c,l===e&&s.jsx("span",{children:"â"})]},l))})]})}function kKe({captured:e,selected:t,setSelected:n,query:r,setQuery:a,expert:i,setExpert:o}){const[l,c]=B.useState(!1),[u,d]=B.useState([]),[h,p]=B.useState(!1),m=$j.filter(b=>`${b.question} ${b.summary} Max Carter`.toLowerCase().includes(r.toLowerCase())),g=m.find(b=>b.id===t)||m[0],x=g&&s.jsxs("article",{className:"lp-conversation-detail",children:[s.jsxs("header",{className:"lp-card-header",children:[s.jsxs("div",{children:[s.jsx("h4",{children:g.question}),s.jsxs("p",{children:["Max Carter · ",g.id===1?"Today":g.time]})]}),h&&s.jsx("button",{className:"lp-close","aria-label":"Close conversation",onClick:()=>p(!1),children:"Ã"})]}),s.jsxs("div",{className:"lp-card-body",children:[s.jsxs("dl",{className:"lp-chat-counts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Visitor messages"}),s.jsx("dd",{children:"2"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Total messages"}),s.jsx("dd",{children:"4"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Source"}),s.jsx("dd",{children:"Public profile"})]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Conversation summary"}),s.jsxs("div",{className:"lp-summary",children:[s.jsx(bi,{name:"spark"}),s.jsxs("div",{children:[s.jsx("p",{children:g.summary}),l&&s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:"Recommended offering"}),s.jsxs("p",{children:[g.offering,". ",g.id===1&&e?"The visitor shared their email and asked Max to follow up.":"The visitor explored this recommendation with AI Maxxx."]})]})]}),s.jsx("button",{"aria-label":l?"Collapse summary":"Expand summary","aria-expanded":l,onClick:()=>c(!l),children:s.jsx(bi,{name:"down"})})]})]}),s.jsxs("section",{className:"lp-transcript",children:[s.jsx("span",{className:"lp-eyebrow",children:"Transcript"}),s.jsx("ol",{children:[{role:"Visitor",text:g.question},{role:"AI expert",text:g.answer},{role:"Visitor",text:g.message},{role:"AI expert",text:"You can send a contact request and Max can follow up with you."}].map((b,y)=>s.jsxs("li",{className:b.role==="AI expert"?"is-assistant":"",children:[s.jsx("span",{children:b.role}),s.jsx("p",{children:b.text})]},y))})]})]})]});return s.jsxs("section",{className:"lp-view",children:[s.jsxs("div",{className:"lp-intro lp-conversation-intro",children:[s.jsxs("div",{children:[s.jsxs("h4",{children:["What your audience is ",s.jsx("em",{children:"asking"})]}),s.jsx("p",{children:"See what visitors asked and how your AI responded across every audience conversation."})]}),s.jsxs("div",{className:"lp-chat-filters",children:[s.jsx(Xne,{label:"Search conversations",value:r,onChange:a}),s.jsx(_Ke,{label:"Filter conversations by expert",value:i,onChange:o,options:[["all","All experts"],["max","Max Carter"]]})]})]}),m.length?s.jsxs("div",{className:"lp-split",children:[s.jsxs("div",{className:"lp-card lp-list",children:[s.jsxs("div",{className:"lp-card-header",children:[s.jsx("strong",{children:"Chat inbox"}),s.jsxs("span",{children:[m.length," ",m.length===1?"conversation":"conversations"]})]}),m.map(b=>s.jsxs("button",{className:`lp-list-row ${g.id===b.id?"selected":""}`,"aria-current":g.id===b.id?"true":void 0,onClick:()=>{n(b.id),c(!1),d(y=>[...y,b.id]),window.matchMedia("(max-width: 960px)").matches&&p(!0)},children:[s.jsxs("span",{className:"lp-row-top",children:[s.jsx("strong",{children:b.question}),s.jsx("small",{children:b.id===1?"Just now":b.time})]}),s.jsxs("span",{className:"lp-row-meta",children:[s.jsxs("span",{children:[b.id!==g.id&&!u.includes(b.id)&&s.jsx("b",{className:"lp-new",children:"New"}),"Max Carter"]}),s.jsx("small",{children:"4 messages"}),s.jsx("i",{children:s.jsx(bi,{name:"chevron",size:14})})]})]},b.id))]}),s.jsx("div",{className:"lp-card lp-chat-desktop",children:x}),h&&s.jsx("div",{className:"lp-mobile-modal",role:"dialog","aria-label":"Conversation detail",children:x})]}):s.jsxs("div",{className:"lp-card lp-empty",children:[s.jsx("h4",{children:"No matching conversations"}),s.jsx("p",{children:"Try another search or expert."})]})]})}function eB({lead:e,onStatus:t,onNote:n}){const[r,a]=B.useState(!0),[i,o]=B.useState(e.note||""),[l,c]=B.useState(!1),[u,d]=B.useState(!1),h=(p,m,g)=>s.jsxs("div",{className:"lp-context-row",children:[s.jsx(bi,{name:p}),s.jsx("span",{children:m}),s.jsx("strong",{children:g})]});return s.jsxs("article",{className:"lp-card lp-lead-detail",children:[s.jsxs("header",{className:"lp-card-header",children:[s.jsxs("div",{children:[s.jsx("h4",{children:e.name}),s.jsx("small",{children:e.time})]}),s.jsx("span",{className:"lp-ready",children:e.id===1||e.id===3?"Ready now":"Exploring"}),s.jsx("select",{"aria-label":"Request status",value:e.status,onChange:p=>t(p.target.value),children:Kne.map(p=>s.jsx("option",{children:p},p))})]}),s.jsxs("div",{className:"lp-card-body",children:[s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Request context"}),s.jsxs("div",{className:"lp-inset",children:[h("source","Source","Public profile"),h("bot","Expert","Max Carter"),s.jsxs("div",{className:"lp-context-row is-stack",children:[s.jsx(bi,{name:"file"}),s.jsxs("div",{children:[s.jsx("span",{children:"Summary"}),s.jsx("p",{children:e.summary})]})]}),h("clock","Received",e.time)]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Contact & details"}),s.jsxs("div",{className:"lp-inset",children:[s.jsxs("div",{className:"lp-context-row",children:[s.jsx(bi,{name:"mail"}),s.jsx("span",{children:"Email"}),s.jsx("strong",{children:e.email}),s.jsx("button",{className:"lp-text-button",onClick:async()=>{try{await navigator.clipboard.writeText(e.email),d(!0)}catch{d(!1)}},children:u?"Copied":"Copy"})]}),h("phone","Phone","Not shared"),s.jsxs("div",{className:"lp-context-row is-stack",children:[s.jsx(bi,{name:"message"}),s.jsxs("div",{children:[s.jsx("span",{children:"Message they left"}),s.jsx("p",{children:e.message})]})]}),s.jsxs("div",{className:"lp-context-row",children:[s.jsx(bi,{name:"message"}),s.jsx("span",{children:"Chat history"}),s.jsxs("button",{className:"lp-show-chat","aria-expanded":r,onClick:()=>a(!r),children:[r?"Hide":"Show",s.jsx(bi,{name:"down"})]})]}),r&&s.jsxs("div",{className:"lp-lead-transcript",children:[s.jsx("p",{children:e.question}),s.jsx("p",{children:e.answer})]})]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Internal note"}),s.jsxs("div",{className:"lp-inset lp-note",children:[s.jsx("textarea",{"aria-label":"Internal note",placeholder:"Only visible to you",value:i,onChange:p=>{o(p.target.value),c(!1)}}),s.jsxs("div",{children:[l&&s.jsx("span",{role:"status",children:"Note saved"}),s.jsx("button",{onClick:()=>{n(i),c(!0)},children:"Save"})]})]})]})]})]})}function ld({title:e,children:t,id:n}){return s.jsxs("section",{className:"lp-card lp-insight-card",id:n,children:[s.jsx("div",{className:"lp-card-header",children:s.jsx("strong",{children:e})}),s.jsx("div",{className:"lp-card-body",children:t})]})}function NKe({period:e,captured:t,newCount:n,onConversations:r,onLeads:a,onNewLeads:i}
430){const o=t?1:0,l=e==="1"?{c:11+o,p:9,v:47,l:o,r:6+o,k:3,voice:2}:e==="7"?{c:46+o,p:32,v:218,l:2+o,r:21+o,k:9,voice:8}:e==="all"?{c:342+o,p:228,v:1430,l:4+o,r:174+o,k:64,voice:57}:{c:184+o,p:126,v:842,l:4+o,r:86+o,k:31,voice:29},c=B.useRef(null),u=[["Birthday shoutout",39,16,21],["Friday Club Hoodie Ultra",29,10,17],["Challenge brainstorm",19,5,12]],d=()=>c.current?.scrollIntoView({behavior:"smooth",block:"nearest"}),h=[["Conversations",l.c,s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lp-voice-bar",children:s.jsx("i",{style:{width:`${l.voice/l.c*100}%`}})}),"Voice ",l.voice," · Text ",l.c-l.voice]}),"conversations","View"],["People who chatted",l.p,`Different people · ${Math.round(l.p*.4)} not signed in`],["Profile visitors",l.v,"People who opened your profile page"],["Leads",l.l,"People who asked you to get in touch","leads","Open"],["Recommendations",l.r,"Times your AI suggested one of your offerings","breakdown","Breakdown"],["Offering clicks",l.k,`${Math.round(l.k/l.r*100)}% of recommendations led to a click`,"breakdown","Breakdown"]];return s.jsxs("section",{className:"lp-view",children:[s.jsx("div",{className:"lp-intro",children:s.jsxs("div",{children:[s.jsxs("h4",{children:["Find out what your audience ",s.jsx("em",{children:"actually wants"})]}),s.jsxs("p",{children:["Insights are ",s.jsx("strong",{children:"fully anonymous"}),". They show what people need, not who they are."]})]})}),s.jsx("div",{className:"lp-metrics",children:h.map(([p,m,g,x,b],y)=>{const v=x?"button":"div";return s.jsxs(v,{type:x?"button":void 0,className:`lp-metric ${y===0?"accent":""} ${y===1?"indigo-value":""}`,onClick:x?()=>{x==="breakdown"?d():x==="conversations"?r():x==="leads"&&a()}:void 0,"aria-label":x?`${p}, ${b}`:void 0,children:[s.jsx("span",{className:"lp-eyebrow",children:p}),s.jsx("strong",{children:m},m),s.jsxs("div",{children:[s.jsx("small",{children:g}),b&&s.jsxs("b",{children:[b," â"]})]})]},p)})}),s.jsxs("div",{className:"lp-card lp-next",children:[s.jsx("h5",{children:"What to do next"}),s.jsxs("button",{onClick:i,children:[s.jsxs("span",{children:[s.jsxs("strong",{children:[n," new requests waiting"]}),s.jsx("small",{children:"Reply while the conversation is still fresh."})]}),s.jsx("b",{children:"View new requests â"})]})]}),s.jsxs(ld,{title:"How conversations progress",children:[[["Conversations",l.c],["Kept talking (5+ messages)",Math.round(l.c*.63)],["Asked to connect",l.l]].map(([p,m],g)=>s.jsxs("div",{className:"lp-bar-row",children:[s.jsx("span",{children:p}),s.jsx("i",{children:s.jsx("b",{style:{width:`${Math.max(3,m/l.c*100)}%`}})}),s.jsx("strong",{children:m}),s.jsx("small",{children:g>0?`${Math.round(m/l.c*100)}%`:""})]},p)),s.jsxs("p",{className:"lp-foot",children:[s.jsxs("strong",{children:[Math.round(l.p*.18)," people came back"]})," for a second conversation in this period. Returning visitors are your warmest audience."]})]}),s.jsx("div",{ref:c,children:s.jsxs(ld,{title:"Your AI sales agent at work",children:[s.jsx("p",{className:"lp-foot",children:"What your AI recommended, and what people did about it."}),s.jsx("div",{className:"lp-ranking-grid",children:[["Most clicked",2],["Most recommended",1],["Most asked for",3]].map(([p,m])=>s.jsxs("div",{children:[s.jsx("h5",{children:p}),u.map((g,x)=>s.jsxs("div",{className:"lp-ranking",children:[s.jsxs("span",{children:["0",x+1]}),s.jsx("strong",{children:g[0]}),s.jsx("b",{children:e==="7"?Math.max(1,Math.round(g[m]/4)):e==="1"?Math.max(1,Math.round(g[m]/15)):e==="all"?g[m]*2:g[m]})]},g[0]))]},p))})]})}),s.jsx(ld,{title:"What people ask about",children:[["Challenge videos",68],["Friday Club merch",51],["Birthday shoutouts",39],["Video ideas",26]].map(([p,m])=>s.jsxs("div",{className:"lp-bar-row",children:[s.jsx("span",{children:p}),s.jsx("i",{children:s.jsx("b",{style:{width:`${m/68*100}%`}})}),s.jsx("strong",{children:m})]},p))}),s.jsx("div",{className:"lp-two-up",children:[["Busiest days",["M","T","W","T","F","S","S"],[18,21,24,20,32,39,31]],["Busiest hours",["6am","9am","12pm","3pm","6pm","9pm"],[9,18,31,35,54,38]]].map(([p,m,g])=>s.jsx(ld,{title:p,children:s.jsx("div",{className:"lp-columns",children:m.map((x,b)=>s.jsxs("div",{children:[s.jsx("span",{children:Math.round(g[b]*l.c/185)}),s.jsx("i",{style:{height:`${g[b]*1.4}px`}}),s.jsx("small",{children:x})]},b))})},p))}),s.jsxs("div",{className:"lp-two-up",children:[s.jsx(ld,{title:"Your experts",children:s.jsxs("table",{className:"lp-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Expert"}),s.jsx("th",{children:"Chats"}),s.jsx("th",{children:"Requests"})]})}),s.jsx("tbody",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Max Carter"}),s.jsx("td",{children:l.c}),s.jsx("td",{children:l.l})]})})]})}),s.jsxs(ld,{title:"Knowledge gaps",children:[s.jsx("h5",{children:"Challenge video rules"}),s.jsx("p",{className:"lp-foot",children:"People asked for more detail about the rules for the next challenge video."})]})]}),s.jsx(ld,{title:"Where people find you",children:s.jsxs("table",{className:"lp-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Source"}),s.jsx("th",{children:"Chats"}),s.jsx("th",{children:"Requests"})]})}),s.jsxs("tbody",{children:[s.jsxs("tr",{children:[s.jsx("th",{children:"Public profile"}),s.jsx("td",{children:Math.round(l.c*.8)}),s.jsx("td",{children:l.l})]}),s.jsxs("tr",{children:[s.jsx("th",{children:"Website embed"}),s.jsx("td",{children:l.c-Math.round(l.c*.8)}),s.jsx("td",{children:"0"})]})]})]})})]})}const tB=e=>(e?$j:$j.slice(1)).map(t=>({...t,status:t.status==="Closed"?"Replied":t.status,time:t.id===1?"Just now":t.time}));
430function EKe(){const[e,t]=B.useState("insights"),[n,r]=B.useState(()=>tB(!1)),[a,i]=B.useState(2),[o,l]=B.useState("All"),[c,u]=B.useState(""),[d,h]=B.useState("30"),[p,m]=B.useState(1),[g,x]=B.useState(""),[b,y]=B.useState("all"),[v,w]=B.useState(""),[j,E]=B.useState([]),[S,_]=B.useState(!1),[k,C]=B.useState("chat"),N=B.useRef(null),A=B.useRef(null),T=B.useRef({}),I=B.useRef(0),$=B.useRef(!1),O=B.useRef(!1),U=B.useRef(-1),[F,H]=B.useState(!1),[G,M]=B.useState(-1),z=G>=3,W=()=>{O.current=!0,H(!1)},D=B.useCallback(P=>{t(P),A.current&&(A.current.scrollTop=0)},[]),Z=B.useCallback((P,ee=!1)=>{const X=P<700?0:P<1500?1:P<2800?2:P<4800?3:4;X===U.current&&!ee||(U.current=X,M(X),(X===0||ee)&&(w(""),r(tB(X>=3)),i(X>=3?1:2),l("All"),u(""),x(""),y("all"),m(1),E([]),_(!1),C("chat"),D(X===3?"leads":"insights"),h("30")),X===3&&(r(ae=>ae.some(me=>me.id===1)?ae:[{...$j[0],time:"Just now"},...ae]),i(1),D("leads"),w("Emily Parker shared her details. New lead added to your inbox.")),X===4&&(m(1),D("conversations")))},[D]);B.useEffect(()=>{const P=window.matchMedia("(prefers-reduced-motion: reduce)"),ee=new IntersectionObserver(([me])=>{$.current=me.isIntersecting&&me.intersectionRatio>=.5,$.current&&!O.current&&!P.matches&&(O.current=!0,Z(0,!0),H(!0))},{threshold:.5,rootMargin:"-88px 0px 0px"}),X=N.current?.querySelector(".lc-shell");X&&ee.observe(X);const ae=()=>{P.matches&&(O.current=!0,H(!1),I.current=2800,Z(2800,!0))};return ae(),P.addEventListener("change",ae),()=>{ee.disconnect(),P.removeEventListener("change",ae)}},[Z]),B.useEffect(()=>{if(!F)return;let P=performance.now();const ee=setInterval(()=>{const X=performance.now(),ae=Math.min(X-P,200);P=X,!(!$.current||document.hidden)&&(I.current=Math.min(I.current+ae,9e3),Z(I.current),I.current===9e3&&H(!1))},100);return()=>clearInterval(ee)},[F,Z]);const V=n.filter(P=>(o==="All"||P.status===o)&&`${P.name} ${P.topic} ${P.email}`.toLowerCase().includes(c.toLowerCase())),L=V.find(P=>P.id===a)||V[0],K=n.filter(P=>P.status==="New").length,te=P=>{r(ee=>ee.map(X=>X.id===L.id?{...X,status:P}:X)),w(`${L.name} marked ${P.toLowerCase()}.`)},Q=P=>r(ee=>ee.map(X=>X.id===L.id?{...X,note:P}:X)),Y=P=>{if(!["ArrowLeft","ArrowRight"].includes(P.key))return;P.preventDefault();const ee=eS.findIndex(ae=>ae[0]===e),X=eS[(ee+(P.key==="ArrowRight"?1:2))%3][0];D(X),T.current[X]?.focus()},J=P=>{P.target.closest(".ld-export")||(W(),C("dashboard"))};return s.jsx("div",{className:"ld-showcase",ref:N,children:s.jsxs("div",{className:"ld-stage",children:[s.jsx("div",{className:"ld-demo lp-product",style:{zIndex:k==="dashboard"?4:1},onPointerDownCapture:J,onFocusCapture:J,children:s.jsxs("div",{className:"ld-app",ref:A,children:[s.jsxs("header",{className:"ld-header",children:[s.jsxs("h3",{children:["Insights & ",s.jsx("em",{children:"Leads"})]}),s.jsxs("button",{type:"button",className:"ld-reset ld-export",children:[s.jsx(bi,{name:"download"}),e==="conversations"?"Export chats":"Export CSV"]})]}),s.jsxs("div",{className:"ld-toolbar",children:[s.jsx("div",{className:"ld-tabs",role:"tablist","aria-label":"Leads views",onKeyDown:Y,children:eS.map(([P,ee])=>s.jsxs("button",{type:"button",ref:X=>T.current[P]=X,role:"tab",id:`demo-tab-${P}`,"aria-controls":`demo-panel-${P}`,"aria-selected":e===P,tabIndex:e===P?0:-1,onClick:()=>D(P),children:[s.jsx("span",{className:"lp-full-label",children:ee}),s.jsx("span",{className:"lp-short-label",children:P==="conversations"?"Chats":ee}),P==="leads"&&K>0&&s.jsx("span",{className:"lp-tab-count",children:K})]},P))}),e==="insights"&&s.jsx("div",{className:"ld-filters",role:"group","aria-label":"Period",children:jKe.map(([P,ee])=>s.jsx("button",{"aria-pressed":d===P,onClick:()=>h(P),children:ee},P))}),e==="leads"&&s.jsx("div",{className:"ld-filters",role:"group","aria-label":"Filter by status",children:["All",...Kne].map(P=>s.jsxs("button",{"aria-pressed":o===P,onClick:()=>l(P),children:[P,s.jsx("span",{children:P==="All"?n.length:n.filter(ee=>ee.status===P).length})]},P))})]}),s.jsxs("div",{role:"tabpanel",id:`demo-panel-${e}`,"aria-labelledby":`demo-tab-${e}`,children:[e==="insights"&&s.jsx(NKe,{period:d,captured:z,newCount:K,onConversations:()=>D("conversations"),onLeads:()=>{l("All"),u(""),D("leads")},onNewLeads:()=>{l("New"),u(""),D("leads")}}),e==="conversations"&&s.jsx(kKe,{captured:z,selected:p,setSelected:m,query:g,setQuery:x,expert:b,setExpert:y}),e==="leads"&&s.jsxs("section",{className:"lp-view",children:[s.jsxs("div",{className:"lp-intro",children:[s.jsxs("div",{children:[s.jsxs("h4",{children:["Someone is waiting for your ",s.jsx("em",{children:"reply"})]}),s.jsx("p",{children:"People who asked you to get in touch after talking with your AI Experts. You only see what they agreed to share."})]}),s.jsx(Xne,{label:"Search leads",value:c,onChange:u})]}),s.jsxs("div",{className:"lp-split lp-leads-split",children:[s.jsxs("div",{className:"lp-card lp-list",children:[s.jsxs("div",{className:"lp-card-header",children:[s.jsx("strong",{children:"Inbox"}),s.jsxs("span",{children:[V.length," ",V.length===1?"lead":"leads"]})]}),V.map(P=>s.jsxs("button",{className:`lp-list-row ${P.id===L?.id?"selected":""} ${P.id===1&&z?"ld-arrived":""}`,"aria-current":P.id===L?.id?"true":void 0,onClick:()=>{i(P.id),E(ee=>[...ee,P.id]),window.matchMedia("(max-width: 960px)").matches&&_(!0)},children:[s.jsxs("span",{className:"lp-row-top",children:[s.jsx("strong",{children:P.name}),s.jsx("small",{children:P.time})]}),s.jsxs("span",{className:"lp-row-meta",children:[(P.status!=="New"||!(j.includes(P.id)||P.id===L?.id))&&s.jsx("b",{className:`lp-status lp-${P.status.toLowerCase().replaceAll(" ","-")}`,children:P.status}),s.jsx("span",{children:"Expert: Max Carter"}),s.jsx("i",{children:s.jsx(bi,{name:"chevron",size:14})})]})]},P.id)),!V.length&&s.jsx("div",{className:"lp-empty",children:"No requests with this status."})]}),s.jsx("div",{className:"lp-lead-desktop",children:L&&s.jsx(eB,{lead:L,onStatus:te,onNote:Q},L.id)})]}),S&&L&&s.jsxs("div",{className:"lp-mobile-modal",role:"dialog","aria-label":"Lead detail",children:[s.jsx("button",{className:"lp-close","aria-label":"Close request",onClick:()=>_(!1),children:"Ã"}),s.jsx(eB,{lead:L,onStatus:te,onNote:Q},L.id)]})]})]}),s.jsx("div",{className:"ld-sr",role:"status","aria-live":"polite",children:v})]})}),s.jsx(wKe,{phase:G,onPause:()=>{W(),C("chat")},onPreviewNote:w,onCapture:P=>{W(),I.current=2800,Z(2800,!0),r(ee=>ee.map(X=>X.id===1?{...X,email:P}:X))}})]})})}function SKe(){return s.jsxs("article",{className:"ge-feature-row lf-feature",children:[s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["More interest. ",s.jsx("em",{children:"More leads."})]}),s.jsx("p",{children:"See what your audience asks about. Capture contact details and turn conversations into your next opportunity."}),s.jsxs("a",{href:"#create-profile",children:["Start capturing leads ",s.jsx("svg",{width:"19",height:"19",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})})]})]}),s.jsx(EKe,{})]})}const CKe=[{name:"Max Carter",initials:"MC",avatar:"/welcome/creator/assets/avatar.webp",earned:1599.65,subscribers:6,mrr:89.94,rating:94},{name:"Marcus Webb",initials:"MW",avatar:"/welcome/assets/creator/marcus-natural.jpg",avatarClass:"ef-avatar-candid",earned:1056.8,subscribers:4,mrr:59.96,rating:90},{name:"Sofia Reyes",initials:"SR",avatar:"/welcome/assets/creator/sofia-natural.jpg",earned:765.76,subscribers:2,mrr:29.98,rating:92}],zl=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e),bf=1499,Jne=bf-Math.round(bf*.3),sB=300,nB=850,rB=1550,TKe=1900,X3=3100,AKe=3650,tS=3650,aB=4200,J3=5800,cv=7500,RKe
430="Pick a challenge you can explain in one sentence. Set a clear rule, bring a friend and let the unexpected moments lead the video.";function IKe(e){const[t,n]=B.useState(0),r=B.useRef(0);return B.useEffect(()=>{const o=window.matchMedia("(prefers-reduced-motion: reduce)");let l=!1,c=null,u=null;const d=g=>{r.current=g,n(g)},h=g=>{if(c=null,!l||document.hidden||r.current>=cv){u=null;return}u!==null&&d(Math.min(cv,r.current+g-u)),u=g,c=requestAnimationFrame(h)},p=()=>{if(c!==null&&cancelAnimationFrame(c),c=null,u=null,o.matches){d(cv);return}l&&!document.hidden&&r.current<cv&&(c=requestAnimationFrame(h))},m=new IntersectionObserver(([g])=>{l=g.isIntersecting&&g.intersectionRatio>=.45,p()},{threshold:[0,.45],rootMargin:"-90px 0px 0px 0px"});return m.observe(e.current),document.addEventListener("visibilitychange",p),o.addEventListener("change",p),p(),()=>{m.disconnect(),c!==null&&cancelAnimationFrame(c),document.removeEventListener("visibilitychange",p),o.removeEventListener("change",p)}},[e]),[t,()=>{r.current=Math.max(r.current,X3),n(r.current)},()=>{r.current=Math.max(r.current,J3),n(r.current)}]}function go({name:e,size:t=18}){const n={arrow:s.jsx("path",{d:"M4 12h16m-6-6 6 6-6 6"}),download:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M12 3v12m-5-5 5 5 5-5M4 15v5h16v-5"})}),check:s.jsx("path",{d:"m5 12 4 4L19 6"}),plus:s.jsx("path",{d:"M12 5v14M5 12h14"}),up:s.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),menu:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"}),loader:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M12 3a9 9 0 1 1-9 9"})}),sparkles:s.jsx(s.Fragment,{children:s.jsx("path",{d:"m12 3 2.7 6.3L21 12l-6.3 2.7L12 21l-2.7-6.3L3 12l6.3-2.7L12 3Z"})}),thumb:s.jsx("path",{d:"M7 10v11H3V10h4Zm0 0 5-8a3 3 0 0 1 2 4l-1 4h6a2 2 0 0 1 2 2l-2 7a2 2 0 0 1-2 2H7"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]})}function cd({label:e,value:t,note:n,accent:r=!1,small:a=!1,credited:i=!1}){return s.jsxs("div",{className:`ef-stat ef-surface ${r?"ef-stat-accent":""} ${a?"ef-stat-small":""} ${i?"ef-stat-credited":""}`,children:[s.jsx("span",{className:"ef-eyebrow",children:e}),s.jsx("strong",{children:t}),s.jsx("span",{className:"ef-stat-note",children:i?s.jsxs("span",{className:"ef-credit-note",children:[s.jsx(go,{name:"check",size:12}),"+",zl(Jne/100)," added"]}):n})]})}function PKe({elapsed:e}){const[t,n]=B.useState({key:"earned",dir:-1}),r=e>=tS,a=Math.max(0,Math.min(1,(e-tS)/(aB-tS))),i=Math.round(Jne*(1-Math.pow(1-a,3))),o=(342221+i)/100,l=CKe.map((h,p)=>p===0?{...h,earned:(159965+i)/100,subscribers:h.subscribers+Number(r),mrr:(8994+(r?bf:0))/100}:h).sort((h,p)=>t.dir*(t.key==="name"?h.name.localeCompare(p.name):h[t.key]-p[t.key])),c=[["name","By expert"],["earned","Earned"],["subscribers","Subscriptions"],["mrr","MRR"],["rating","Rating"]],u=[0,0,120,480,890,o].map((h,p)=>({value:h,label:new Date(new Date().getFullYear(),new Date().getMonth()-5+p,1).toLocaleString("en-US",{month:"short"})})),d=h=>n(p=>({key:h,dir:p.key===h?-p.dir:h==="name"?1:-1}));return s.jsxs("div",{className:"ef-dashboard",role:"group","aria-label":"Earnings dashboard preview",children:[s.jsxs("header",{className:"ef-dashboard-header ef-surface",children:[s.jsxs("h3",{children:["Your ",s.jsx("em",{children:"earnings"})]}),s.jsxs("div",{className:"ef-dashboard-actions",children:[s.jsxs("button",{type:"button",className:"ef-export","aria-label":"Export sample earnings CSV",onClick:()=>{},children:[s.jsx(go,{name:"download",size:16}),"Export CSV"]}),s.jsx("button",{type:"button",className:"ef-payout",disabled:!0,title:"Payouts are available in your creator dashboard",children:"Request payout"})]})]}),s.jsx("p",{className:"ef-sample",children:"Sample data · This month"}),s.jsxs("div",{className:"ef-stats",children:[s.jsx(cd,{label:"Pending payout",value:zl(o),note:"Payout from $50.00",accent:!0,credited:r}),s.jsx(cd,{label:"Total earned",value:zl(o),note:"Your 70% share, after fees"}),s.jsx(cd,{label:"Active subscribers",value:r?"13":"12",note:`${r?5:4} new, 1 cancelled`}),s.jsx(cd,{label:"Subscriptions total",value:zl((488887+(r?bf:0))/100),note:"What subscribers paid. You keep 70%"})]}),s.jsx("div",{className:"ef-table-wrap ef-surface",children:s.jsxs("table",{children:[s.jsx("caption",{className:"ef-sr-only",children:"Earnings, subscriptions and rating for each of your experts"}),s.jsx("thead",{children:s.jsx("tr",{children:c.map(([h,p])=>s.jsx("th",{scope:"col","aria-sort":t.key===h?t.dir===1?"ascending":"descending":"none",children:s.jsxs("button",{type:"button",onClick:()=>d(h),children:[p,s.jsx("span",{"aria-hidden":"true",children:t.key===h?t.dir===1?"â":"â":""})]})},h))})}),s.jsx("tbody",{children:l.map(h=>s.jsxs("tr",{children:[s.jsx("th",{scope:"row",children:s.jsxs("span",{className:"ef-expert",children:[s.jsx("span",{className:"ef-avatar","aria-hidden":"true",children:h.avatar?s.jsx("img",{src:h.avatar,alt:"",className:h.avatarClass}):h.initials}),h.name]})}),s.jsx("td",{children:zl(h.earned)}),s.jsx("td",{children:h.subscribers}),s.jsx("td",{children:zl(h.mrr)}
430),s.jsx("td",{children:s.jsxs("span",{className:"ef-rating",children:[s.jsx(go,{name:"thumb",size:13}),h.rating,"%"]})})]},h.name))})]})}),s.jsxs("div",{className:"ef-history",children:[s.jsxs("div",{className:"ef-months ef-surface",children:[s.jsx("h4",{className:"ef-eyebrow",children:"Last 6 months"}),u.map((h,p)=>s.jsxs("div",{className:`ef-month ${p===5?"ef-current":""}`,children:[s.jsx("span",{children:h.label}),s.jsx("span",{className:"ef-bar",children:s.jsx("i",{style:{width:h.value?`${Math.max(5,h.value/o*100)}%`:"0%"}})}),s.jsx("strong",{children:zl(h.value)})]},h.label))]}),s.jsxs("div",{className:"ef-feedback ef-surface",children:[s.jsx("h4",{className:"ef-eyebrow",children:"Answer feedback"}),s.jsx("div",{className:"ef-ring",role:"img","aria-label":"92% of 142 rated answers were helpful",children:s.jsxs("span",{children:[s.jsx(go,{name:"thumb",size:17}),s.jsx("strong",{children:"92%"})]})}),s.jsx("p",{children:"From 142 rated answers"})]})]}),s.jsxs("div",{className:"ef-activity",children:[s.jsx(cd,{small:!0,label:"Questions answered",value:"487",note:"In the selected period"}),s.jsx(cd,{small:!0,label:"Active experts",value:"3",note:"Published and answering"}),s.jsx(cd,{small:!0,label:"Drafts",value:"1",note:"Not published yet"})]}),s.jsx("span",{className:"ef-sr-only",role:"status","aria-live":"polite",children:e>=aB?"Max Carter received a subscription payment. $10.49 added to earnings. Pending payout is now $3,432.70.":""})]})}function LKe({elapsed:e,onSubscribe:t,onContinue:n}){const r=e>=AKe,a=e>=TKe&&!r,i=e>=X3&&!r,o=e>=J3,l=e>=X3&&!o,c=o?RKe.split(" ").slice(0,Math.max(1,Math.floor((e-J3)/48))).join(" "):"",u=B.useRef(null),d=B.useRef(!0),h=B.useRef(null),p=B.useRef(!1),m=()=>{p.current=!0,t()};B.useEffect(()=>{p.current&&(l?h.current?.focus({preventScroll:!0}):(u.current?.closest(".ef-subscription").querySelector("textarea")?.focus({preventScroll:!0}),p.current=!1))},[l]);const g=e>=sB,x=e>=nB,b=e>=rB;return B.useEffect(()=>{const y=u.current;d.current&&(y.scrollTop=y.scrollHeight)},[g,x,b,r,c]),s.jsxs("section",{className:`ef-subscription ${a?"ef-chat-gated":""} ${r?"ef-payment-paid":""}`,"aria-label":"Paid expert conversation preview",children:[s.jsxs("div",{className:"ef-chat-content",inert:l?"":void 0,children:[s.jsxs("header",{className:"ef-chat-header",children:[s.jsx("img",{className:"ef-chat-avatar",src:"/welcome/creator/assets/avatar.webp",alt:"Max Carter"}),s.jsxs("div",{children:[s.jsx("strong",{children:"AI Maxxx"}),s.jsxs("span",{children:["Powered by ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",children:"Great Experts"})]})]}),s.jsx("span",{className:"ef-chat-menu","aria-hidden":"true",children:s.jsx(go,{name:"menu",size:26})})]}),s.jsxs("div",{className:"ef-chat-thread",ref:u,onScroll:y=>{const v=y.currentTarget;d.current=v.scrollHeight-v.scrollTop-v.clientHeight<40},"aria-label":"Example conversation",children:[s.jsx("div",{className:"ef-chat-message ef-chat-assistant",children:"Yo! Ask me about the videos, Friday Club or pitch me a challenge idea."}),e>=sB&&s.jsx("div",{className:"ef-chat-message ef-chat-user",children:"How do I come up with a fun challenge video?"}),e>=nB&&s.jsx("div",{className:"ef-chat-message ef-chat-assistant",children:"Start with something ordinary and add a surprising rule. Let your friends help shape the challenge."}),e>=rB&&s.jsx("div",{className:"ef-chat-message ef-chat-user",children:"Which challenge should I start with?"}),o&&s.jsx("div",{className:"ef-chat-message ef-chat-assistant ef-chat-continued","aria-label":"Answer after subscribing",children:c})]}),s.jsx("div",{className:"ef-chat-input-area",children:a?s.jsxs("div",{className:"ef-chat-paywall",role:"status",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Free messages used."})," ",zl(bf/100),"/mo to keep chatting."]}),s.jsxs("button",{type:"button",className:"ef-subscribe",onClick:m,disabled:i,"aria-label":i?"Redirecting to subscription checkout":"Preview a paid subscription",children:[i&&s.jsx(go,{name:"loader",size:12})," ",i?"Redirectingâ¦":"Subscribe"]})]}):s.jsxs("div",{className:"ef-chat-composer",children:[s.jsx("span",{"aria-hidden":"true",children:s.jsx(go,{name:"plus",size:20})}),s.jsx("textarea",{rows:"1",readOnly:!0,"aria-label":"Example message",placeholder:"Ask anything..."}),s.jsxs("span",{className:"ef-chat-call","aria-hidden":"true",children:[s.jsx(go,{name:"phone",size:17}),"Call"]})]})}),s.jsx("footer",{className:"ef-chat-footer",children:s.jsxs("p",{children:["AI Chat. Messages and AI replies may be reviewed by this expertâs owner for audience insights. Donât share sensitive personal information. ",s.jsx("a",{href:"https://greatexperts.ai/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})," · ",s.jsx("a",{href:"https://greatexperts.ai/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"})]})})]}),l&&s.jsx("div",{className:"ef-confirmation-overlay",children:s.jsxs("section",{ref:h,tabIndex:-1,
430className:"ef-confirmation",role:"dialog","aria-label":"Subscription confirmation preview",onKeyDown:y=>{y.key==="Escape"&&r&&n()},children:[s.jsx("span",{className:`ef-confirmation-icon ${r?"is-paid":""}`,children:s.jsx(go,{name:r?"check":"loader",size:26})}),s.jsx("span",{className:"ef-confirmation-label",children:r?"Subscription active":"Confirming subscription"}),s.jsx("h3",{children:r?"Youâre subscribed":"Almost there"}),s.jsx("p",{children:r?"You now have unlimited 1-on-1 chat with AI Maxxx for the next 30 days.":"Confirming your subscription to AI Maxxx."}),s.jsxs("div",{className:"ef-confirmation-payment",children:[s.jsxs("span",{children:["Monthly subscription",s.jsx("strong",{children:zl(bf/100)})]}),s.jsx("b",{children:r?"Paid":"Processingâ¦"})]}),s.jsx("p",{className:"ef-confirmation-renewal",children:"Renews monthly until you cancel."}),s.jsxs("button",{type:"button",onClick:n,disabled:!r,children:["Continue chatting ",s.jsx(go,{name:"arrow",size:16})]})]})}),s.jsx("span",{className:"ef-sr-only",role:"status","aria-live":"polite",children:r?"Your subscription to AI Maxxx is active. You can continue chatting.":""})]})}function OKe(){const e=B.useRef(null),t=B.useRef(null),n=B.useRef(null),[r,a]=B.useState("payment"),[i,o,l]=IKe(t);return B.useEffect(()=>{const c=e.current,u=()=>{c.style.setProperty("--ef-dashboard-scale",Math.min(c.clientWidth*.9/1040,c.clientHeight*.86/940)),c.style.setProperty("--ef-payment-scale",c.clientWidth*.38/440)};u();const d=new ResizeObserver(u);return d.observe(c),()=>d.disconnect()},[]),s.jsxs("div",{className:"ge-feature-row ef-feature",children:[s.jsxs("div",{className:"ef-scene",ref:e,children:[s.jsx("div",{ref:n,className:`ef-dashboard-window ${r==="dashboard"?"ef-front":""}`,onPointerDown:()=>a("dashboard"),onFocusCapture:()=>
430a("dashboard"),children:s.jsx(PKe,{elapsed:i})}),s.jsx("div",{ref:t,className:`ef-payment-window ${r==="payment"?"ef-front":""}`,onPointerDown:()=>a("payment"),onFocusCapture:()=>a("payment"),children:s.jsx(LKe,{elapsed:i,onSubscribe:o,onContinue:l})})]}),s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["Earn from ",s.jsx("em",{children:"your expertise."})]}),s.jsx("p",{children:"Offer paid access to your AI expert. Track subscriptions and earnings in one place."}),s.jsxs("a",{href:"#create-profile",children:["Start earning ",s.jsx(go,{name:"arrow",size:18})]})]})]})}function MKe(){return s.jsx($k,{src:"/welcome/creator/product-profile/index.html",title:"Customize Max Carterâs page in the Great Experts editor"})}function DKe(){return s.jsx(Fk,{src:"/welcome/creator/product-profile/knowledge.html"})}const $Ke={CallsFeature:vKe,LeadsFeature:SKe,EarningsFeature:OKe,ProfileFeature:MKe,KnowledgeFeature:DKe};function FKe(){return s.jsx(Bk,{canonicalPath:"/creator",heroProfileSrc:"/welcome/creator/HeroPhone.html?autoscroll=true",features:$Ke,pageClassName:"creator-landing"})}function Kc({name:e,size:t=20}){const n={phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"}),mic:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),s.jsx("path",{d:"M5 10v2a7 7 0 0 0 14 0v-2M12 19v3M8 22h8"})]}),micOff:s.jsx(s.Fragment,{children:s.jsx("path",{d:"m2 2 20 20M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V5a3 3 0 0 0-5.94-.6M5 10v2a7 7 0 0 0 12 4.9M19 10v2c0 .67-.09 1.32-.27 1.94M12 19v3M8 22h8"})}),arrow:s.jsx("path",{d:"M4 12h16m-6-6 6 6-6 6"}),external:s.jsx("path",{d:"M7 7h10v10M7 17 17 7"}),chevronRight:s.jsx("path",{d:"m9 6 6 6-6 6"}),chevronLeft:s.jsx("path",{d:"m15 6-6 6 6 6"}),chevronUp:s.jsx("path",{d:"m6 15 6-6 6 6"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.65",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]})}const Ad=1e4,BKe="Which English lessons would help me speak more confidently?",UKe=["Start with a 30-minute Trial Lesson.","Conversation Lessons build fluency.","Try IELTS Prep for your exam.","Iâve shared all three here for you."],zKe=[{at:2400,title:"Trial Lesson",category:"$15 · 30 minutes",image:"service-0.webp",url:"https://greatexperts.ai/education"},{at:4e3,title:"Conversation Lessons",category:"$35",image:"service-1.webp",url:"https://greatexperts.ai/education"},{at:5500,title:"IELTS Prep Package",category:"$299 · 8 lessons",image:"service-2.webp",url:"https://greatexperts.ai/education"}],iB=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function HKe(e,t,n,r=1){const[a,i]=B.useState(0),[o,l]=B.useState(!1),c=B.useRef(0);return B.useEffect(()=>{const u=window.matchMedia("(prefers-reduced-motion: reduce)"),d=()=>l(u.matches);return d(),u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[]),B.useEffect(()=>{c.current=0,i(0)},[n]),B.useEffect(()=>{if(o){c.current=Ad,i(Ad);return}if(!e||t||c.current>=Ad)return;let u,d=null,h=c.current;const p=g=>{document.hidden?d=null:(d!==null&&(c.current=Math.min(Ad,c.current+(g-d)*r)),d=g,(c.current-h>=80||c.current===Ad)&&(h=c.current,i(h))),c.current<Ad&&(u=requestAnimationFrame(p))},m=()=>{d=null};return document.addEventListener("visibilitychange",m),u=requestAnimationFrame(p),()=>{cancelAnimationFrame(u),document.removeEventListener("visibilitychange",m)}},[e,t,n,o,r]),a}function oB({products:e,large:t=!1}){return s.jsx("section",{className:`cf-recommendations ${t?"cf-recommendations-large":""}`,"aria-label":"Profile recommendations",children:e.map(n=>s.jsxs("a",{className:"cf-product-row",href:n.url,target:"_blank",rel:"noopener noreferrer","aria-label":`View product: ${n.title}`,children:[s.jsx("span",{className:"cf-product-image",children:s.jsx("img",{src:`/welcome/edu/assets/${n.image}`,alt:""})}),s.jsxs("span",{className:"cf-product-info",children:[s.jsx("strong",{children:n.title}),s.jsx("span",{children:n.category})]}),s.jsx(Kc,{name:"external",size:t?18:16})]},n.title))})}function lB({device:e,active:t,onComplete:n,onEnd:r,playbackRate:a=1}){const[i,o]=B.useState(!1),[l,c]=B.useState(!1),[u,d]=B.useState(0),[h,p]=B.useState(null),[m,g]=B.use
430State(!0),x=HKe(t,l,u,a),b=B.useRef(!1);B.useEffect(()=>{b.current=!1},[u]),B.useEffect(()=>{x>=Ad&&n&&!b.current&&(b.current=!0,n())},[x,n]);const y=x>=1750&&x<8200,v=x>=1200&&x<1750,w=l?[]:zKe.filter(T=>x>=T.at),j=w.length>0,E=j&&(h===null?x>=5e3:h),S=x<3200?0:x<4800?1:x<6500?2:3,_=BKe.split(" ").slice(0,Math.max(1,Math.floor(x/100))).join(" "),k=258-Math.floor(x/1e3),C=B.useRef(null),N=e==="phone";B.useEffect(()=>{const T=C.current,I=()=>T.style.setProperty("--call-scale",T.clientWidth/(N?390:1040));I();const $=new ResizeObserver(I);return $.observe(T),()=>$.disconnect()},[N]);const A=()=>{c(!1),o(!1),p(null),g(!0),d(T=>T+1)};return s.jsx("div",{className:`cf-device-screen ${N?"cf-screen-phone":"cf-screen-laptop"}`,ref:C,children:s.jsxs("div",{className:`cf-call-ui ${l?"cf-ended":""} ${i?"cf-muted":""} ${j?"cf-has-offers":""} ${y?"cf-speaking":v?"cf-thinking":"cf-listening"}`,role:"group","aria-label":`AI voice call preview on ${e}`,children:[s.jsxs("div",{className:"cf-call-main",children:[s.jsxs("header",{className:"cf-call-header",children:[s.jsxs("div",{className:"cf-identity",children:[s.jsxs("span",{children:[s.jsx("img",{src:"/welcome/edu/assets/expert.webp",alt:""}),s.jsx("i",{"aria-hidden":"true"})]}),s.jsx("strong",{children:"Emma AI"})]}),s.jsxs("div",{className:"cf-time",children:[s.jsx(Kc,{name:"phone",size:14}),!l&&s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",children:[s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"#e8e6dc",strokeWidth:"2.5"}),s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"#3d3df5",strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${k/300*40.8} 40.8`,transform:"rotate(-90 8 8)"})]}),s.jsx("span",{children:l?iB(42+Math.floor(x/1e3)):`${iB(k)} remaining`})]})]}),s.jsxs("div",{className:"cf-call-stage",children:[s.jsxs("div",{className:"cf-avatar-stage",children:[s.jsxs("div",{className:"cf-aura","aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("div",{className:"cf-avatar",children:[s.jsx("i",{className:"cf-avatar-halo","aria-hidden":"true"}),s.jsx("i",{className:"cf-avatar-ring","aria-hidden":"true"}),s.jsx("i",{className:"cf-avatar-ripple","aria-hidden":"true"}),s.jsx("img",{src:"/welcome/edu/assets/expert.webp",alt:"Dr. Emma Wells | AI Guide"})]})]}),s.jsx("p",{className:"cf-call-status",role:"status",children:l?"Call ended":i?"Microphone off":y?"Speaking":v?"Thinking":"Listening"}),s.jsx("div",{className:"cf-transcript",children:!l&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"cf-question",children:["You · ",_]}),x>=1750&&s.jsx("div",{className:"cf-captions","aria-label":"Call transcript",children:s.jsx("div",{className:"cf-caption-track",style:{transform:`translateY(${(1-S)*32.8}px)`},children:UKe.map((T,I)=>s.jsx("span",{className:I===S?"is-current":"","aria-current":I===S?"true":void 0,children:T},T))})})]})})]}),N&&j&&s.jsxs("button",{className:"cf-offers-bar",onClick:()=>p(!0),"aria-expanded":E,children:[s.jsx("span",{className:"cf-offer-thumbs",children:w.map(T=>s.jsx("span",{children:s.jsx("img",{src:`/welcome/edu/assets/${T.image}`,alt:""})},T.title))}),s.jsxs("strong",{children:[w.length," mentioned in this call"]}),s.jsx(Kc,{name:"chevronUp",size:16})]}),s.jsx("footer",{className:"cf-call-controls",children:l?s.jsxs("button",{className:"cf-call-again",onClick:A,children:[s.jsx(Kc,{name:"phone",size:16}),"Call again"]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`cf-mute ${i?"is-muted":""}`,onClick:()=>o(!i),"aria-pressed":i,"aria-label":i?"Unmute microphone":"Mute microphone",children:s.jsx(Kc,{name:i?"micOff":"mic"})}),s.jsxs("button",{className:"cf-end",onClick:()=>r?r():c(!0),children:[s.jsx(Kc,{name:"phone",size:16}),"End call"]})]})})]}),!N&&j&&(m?s.jsxs("aside",{className:"cf-offers-panel","aria-label":"Mentioned during this call",children:[s.jsxs("div",{className:"cf-offers-heading",children:[s.jsx("h3",{children:"Mentioned in this call"}),s.jsx("span",{children:w.length}),s.jsx("button",{onClick:()=>g(!1),"aria-label":"Collapse recommendations",children:s.jsx(Kc,{name:"chevronRight",size:16})})]}),s.jsx(oB,{products:w,large:!0})]}):s.jsxs("button",{className:"cf-offers-tab",onClick:()=>g(!0),"aria-label":`Show ${w.length} mentioned in this call`,"aria-expanded":!1,children:[s.jsx(Kc,{name:"chevronLeft",size:16}),w.slice(-2).map(T=>
430s.jsx("img",{src:`/welcome/edu/assets/${T.image}`,alt:""},T.title)),s.jsx("span",{children:w.length})]})),N&&E&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"cf-offers-backdrop",onClick:()=>p(!1),"aria-label":"Back to the call"}),s.jsxs("div",{className:"cf-offers-sheet",role:"dialog","aria-modal":"false","aria-label":"Mentioned in this call",onKeyDown:T=>{T.key==="Escape"&&p(!1)},children:[s.jsx("button",{className:"cf-sheet-handle",onClick:()=>p(!1),"aria-label":"Close recommendations",children:s.jsx("span",{})}),s.jsxs("div",{className:"cf-offers-heading",children:[s.jsx("h3",{children:"Mentioned in this call"}),s.jsx("span",{children:w.length})]}),s.jsx(oB,{products:w})]})]})]})})}function qKe(){const e=B.useRef(null),t=B.useRef(null),[n,r]=B.useState(!1);return B.useEffect(()=>{const a=new IntersectionObserver(([c])=>r(c.isIntersecting&&c.intersectionRatio>=.4),{threshold:[0,.4],rootMargin:"-90px 0px 0px"});e.current&&a.observe(e.current);const i=t.current,o=()=>i.style.setProperty("--phone-scale",i.clientWidth/356);o();const l=new ResizeObserver(o);return l.observe(i),()=>{a.disconnect(),l.disconnect()}},[]),s.jsx("div",{className:"cf-showcase",children:s.jsx("div",{className:`cf-scene ${n?"cf-visible":""}`,ref:e,"aria-label":"Voice calls on laptop and phone",children:s.jsxs("div",{className:"cf-devices",children:[s.jsxs("div",{className:"cf-laptop",children:[s.jsx("div",{className:"cf-laptop-display",children:s.jsx(lB,{device:"laptop",active:n})}),s.jsx("img",{className:"cf-laptop-frame",src:"/welcome/assets/device-frames/macbook-pro-14-space-black.png",alt:"","aria-hidden":"true",draggable:"false"})]}),s.jsx("div",{className:"cf-phone",ref:t,children:s.jsxs("div",{className:"cf-phone-device",children:[s.jsx("span",{className:"cf-phone-side cf-phone-silent","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-volume-up","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-volume-down","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-power","aria-hidden":"true"}),s.jsxs("div",{className:"cf-phone-display",children:[s.jsx(lB,{device:"phone",active:n}),s.jsx("div",{className:"cf-phone-home","aria-hidden":"true",children:s.jsx("span",{})})]})]})})]})})})}const Fj=[{id:1,name:"Emily Parker",time:"12 min ago",status:"New",ready:"Ready to book",source:"Instagram",topic:"Trial Lesson",email:"[email protected]",summary:"Wants to try an English lesson. Asked about available times, speaking level and how to book.",message:"Hi Emma, weâd love to book two trial lessons. Can we send our preferred times?",question:"Iâd love to book a trial English lesson.",answer:"A Trial Lesson is a great fit. Send a contact request and Emma can follow up with you.",offering:"Trial Lesson",price:"$15 · 30 minutes"},{id:2,name:"James Wilson",time:"38 min ago",status:"New",ready:"Exploring options",source:"YouTube",topic:"Conversation practice",email:"[email protected]",summary:"Looking for speaking practice. Interested in Conversation Lessons and wants advice before choosing.",message:"Could you help me decide which speaking lesson is right for me?",question:"What would you recommend for everyday speaking practice?",answer:"Conversation Lessons are $35. For self-paced practice, Speak with Confidence is $89.",offering:"Conversation Lessons",price:"$35 · Conversation practice"},{id:3,name:"Sophie Bennett",time:"2 hours ago",status:"Contacted",ready:"Ready to book",source:"Profile page",topic:"IELTS preparation",email:"[email protected]",summary:"Preparing for IELTS and looking for personal feedback on a selection of 12 speaking answers.",message:"Iâm preparing for my first IELTS test. Could we look at my speaking answers together?",question:"Can Emma help me prepare for IELTS?",answer:"The IELTS Prep Package includes 8 lessons for $299 to practice your answers, build confidence and plan your next steps.",offering:"IELTS Prep Package",price:"$299 · 8 lessons"},{id:4,name:"Alex Morgan",time:"8 days ago",status:"New",ready:"Ready to talk",source:"Instagram",topic:"Team training",email:"[email protected]",summary:"A brand is planning English training for its team and wants to discu
430ss business conversation practice.",message:"Weâre training a small international team. Are you available for business English lessons?",question:"Does Emma offer English training for teams?",answer:"Send a contact request with your teamâs goals so Emma can discuss a suitable English training plan with you.",offering:"Business English for teams",price:"Work together"},{id:5,name:"Daniel Reed",time:"12 days ago",status:"Closed",ready:"Exploring options",source:"YouTube",topic:"Pronunciation practice",email:"[email protected]",summary:"Asked about pronunciation practice and explored the 100 Phrasal Verbs course and Daily Speaking Checklist.",message:"Thanks for the practice recommendations. Iâve found the right study resources.",question:"Is there a simple resource for daily English practice?",answer:"100 Phrasal Verbs is $15 and the Daily Speaking Checklist is free. Both can support your daily English practice.",offering:"100 Phrasal Verbs",price:"$15 · Self-paced course"}];function WKe({phase:e,onPause:t,onCapture:n,onPreviewNote:r}){const[a,i]=B.useState(!1),[o,l]=B.useState(null),[c,u]=B.useState("[email protected]"),[d,h]=B.useState(!0),[p,m]=B.useState(""),[g,x]=B.useState([]),[b,y]=B.useState(!0),[v,w]=B.useState(!1),j=B.useRef(null),E=B.useRef(null);B.useEffect(()=>{l(null),i(!1),e===0&&(u("[email protected]"),h(!0),m(""),x([]))},[e]);const S=o||(e===2?"form":e===3?"sent":"chat");B.useEffect(()=>{j.current&&j.current.scrollTo({top:j.current.scrollHeight,behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"})},[e,g]);const _=(T,I=20)=>{const $={menu:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),plus:s.jsx("path",{d:"M12 5v14M5 12h14"}),close:s.jsx("path",{d:"m6 6 12 12M6 18 18 6"}),check:s.jsx("path",{d:"m20 6-11 11-5-5"}),mail:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),s.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),up:s.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})};return s.jsx("svg",{width:I,height:I,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:T==="menu"?1.35:1.85,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:$[T]})},k=()=>{t(),i(!1),h(!1),l("form")},C=()=>{t(),l("chat")},N=()=>{p.trim()&&(t(),x(T=>[...T,{role:"user",text:p.trim()},{role:"ai",text:"To ask Emma about a lesson, use Contact in the menu to send your details and conversation."}]),m(""))},A=d&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c);return s.jsxs("aside",{ref:E,className:`lc-shell ${v?"lc-expanded":""}`,"aria-label":"Chat with Emma AI · demonstration",onPointerDownCapture:t,onFocusCapture:t,children:[s.jsxs("header",{className:"lc-header",inert:S!=="chat"?"":void 0,children:[s.jsx("img",{src:"/welcome/edu/assets/expert.webp",alt:"Dr. Emma Wells | AI Guide"}),s.jsxs("div",{className:"lc-name",children:[s.jsx("strong",{children:"Emma AI"}),s.jsxs("small",{children:["Powered by ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",children:"Great Experts"})]})]}),s.jsx("button",{className:"lc-icon",type:"button","aria-label":"Conversation menu","aria-expanded":a,onClick:()=>i(!a),children:_("menu",26)})]}),s.jsxs("div",{className:"lc-body",inert:S!=="chat"?"":void 0,children:[s.jsxs("div",{className:"lc-thread",ref:j,children:[s.jsx("div",{className:"lc-message lc-ai",children:"Hi! Ask me about English lessons, pronunciation or preparing for IELTS."}),b&&e>=0&&s.jsx("div",{className:"lc-message lc-user",children:"Iâd love to book a trial English lesson."}),b&&e>=1&&s.jsx("div",{className:"lc-message lc-ai",children:"A Trial Lesson is a great fit. Send a contact request and Emma can follow up with you."}),g.map((T,I)=>s.jsx("div",{className:`lc-message lc-${T.role}`,children:T.text},I))]}),s.jsx("div",{className:"lc-compose",children:s.jsxs("div",{className:"lc-composer",children:[s.jsx("button",{className:"lc-icon",type:"button","aria-label":"Attach files",onClick:()=>r("Attachments are available in the full product."),children:_("plus")}),s.jsx("textarea",{rows:"1","aria-label":"Demo message",placeholder:"Ask anything...",maxLength:"2000",value:p,onChange:T=>m(T.target.value),onKeyDown:T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),N())}}),p.trim()?s.jsx("button",{type:"button",className:"lc-send","aria-label":"Send demo message",onClick:N,children:_("up",18)}):s.jsxs("button",{type:"button",className:"lc-call","aria-label":"Start a voice call with this AI expert",onClick:()=>r("Voice calls are available in the full product."),children:[_("phone",17),"Call"]})]})}),a&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"lc-menu-scrim",type:"button","aria-label":"Close conversation menu",onClick:()=>i(!1)}),s.jsxs("aside",{className:"lc-menu","aria-label":"Conversations",children:[s.jsx("button",{className:"lc-menu-action",onClick:k,children:"Contact"}),s.jsx("button",{className:"lc-menu-action",onClick:()=>{w(!v),i(!1)},children:v?"Exit full screen":"Expand"}),s.jsx("h4",{children:"Conversations"}),s.jsxs("button",{className:"lc-menu-new",onClick:()=>{i(!1),y(!1),x([]),m("")},children:[_("plus",17),"New conversation"]}),s.jsx("button",{className:"lc-history-item",onClick:()=>{i(!1),y(!0)},children:"Trial Lesson"})]})]})]}),(S==="form"||S==="sent")&&s.jsxs("div",{className:"lc-modal-wrap",children:[s.jsx("button",{className:"lc-modal-shade",type:"button","aria-label":"Close contact request",onClick:C}),s.jsxs("section",{className:"lc-modal",role:"dialog","aria-label":S==="sent"?"Request sent":"Send a contact request",onKeyDown:T=>{T.key==="Escape"&&C()},children:[s.jsx("button",{className:"lc-modal-close","aria-label":"Close contact form",type:"button",onClick:C,children:_("close")}),S==="form"?s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"Send a contact request"}),s.jsxs("form",{onSubmit:T=>{T.preventDefault(),A&&(n(c),l("sent"))},children:[s.jsxs("label",{className:"lc-email",children:[_("mail",16),s.jsx("input",{"aria-label":"Contact request email",type:"email",autoComplete:"off",placeholder:"Email",value:c,onChange:T=>u(T.target.value),required:!0})]}),s.jsxs("label",{className:"lc-consent",children:[s.jsx("input",{type:"checkbox",checked:d,onChange:T=>h(T.target.checked)}),s.jsx("span",{className:"lc-check-box","aria-hidden":"true",children:_("check",14)}),s.jsxs("span",{children:["I am 18+ and agree to the ",s.jsx("a",{href:"https://greatexperts.ai/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"})," and ",s.jsx("a",{href:"https://greatexperts.ai/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),", and to share my contact details and conversation with English with Emma."]})]}),s.jsx("button",{className:"lc-contact-submit",type:"submit",disabled:!A,children:"Send a contact request"})]})]}):s.jsxs("div",{className:"lc-sent",children:[s.jsx("span",{className:"lc-sent-check",children:_("check")}),s.jsx("h3",{children:"Request sent"}),s.jsx("p",{children:"Thanks for reaching out. Emma will get back to you soon."}),s.jsxs("p",{className:"lc-reply-email",children:["The reply will go to ",s.jsx("strong",{children:c.trim()}),"."]}),s.jsx("div",{children:s.jsx("button",{type:"button",className:"lc-done",onClick:C,children:"Done"})})]})]})]})]})}const Qne=["New","Contacted","Replied","Not replied","Booked a call","Not relevant"],VKe=[["1","Today"],["7","7 days"],["30","30 days"],["all","All time"]],sS=[["insights","Insights"],["conversations","Conversations"],["leads","Leads"]];function yi({name:e,size:t=16}){const n={search:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"10",cy:"10",r:"6"}),s.jsx("path",{d:"m15 15 5 5"})]}),download:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),chevron:s.jsx("path",{d:"m9 5 7 7-7 7"}),down:s.jsx("path",{d:"m6 9 6 6 6-6"}),spark:s.jsx("path",{d:"m12 3 2.5 6.5L21 12l-6.5 2.5L12 21l-2.5-6.5L3 12l6.5-2.5Z"}),mail:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),s.jsx("path",{d:"m3 7 9 6 9-6"})]}),clock:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 7v5l3 2"})]}
430),message:s.jsx("path",{d:"M21 11.5a8.4 8.4 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.4 8.4 0 0 1-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.4 8.4 0 0 1 3.8-.9h.5a8.5 8.5 0 0 1 8 8v.5Z"}),bot:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"4",y:"7",width:"16",height:"13",rx:"3"}),s.jsx("path",{d:"M12 3v4M9 12v2m6-2v2M2 12h2m16 0h2"})]}),source:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"m16 8-3 5-5 3 3-5Z"})]}),file:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),s.jsx("path",{d:"M14 2v6h6M8 13h8m-8 4h8"})]}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72l.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45l2.81.7A2 2 0 0 1 22 16.92z"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]||n.message})}function Zne({value:e,onChange:t,label:n}){return s.jsxs("label",{className:"lp-search",children:[s.jsx(yi,{name:"search"}),s.jsx("input",{type:"search","aria-label":n,placeholder:n,value:e,onChange:r=>t(r.target.value)})]})}function GKe({value:e,onChange:t,options:n,label:r}){const[a,i]=B.useState(!1),o=B.useRef(null);return B.useEffect(()=>{if(!a)return;const l=c=>{o.current?.contains(c.target)||i(!1)};return document.addEventListener("pointerdown",l),()=>document.removeEventListener("pointerdown",l)},[a]),s.jsxs("div",{className:"lp-select",ref:o,onKeyDown:l=>{l.key==="Escape"&&i(!1)},children:[s.jsxs("button",{type:"button","aria-label":r,"aria-expanded":a,"aria-haspopup":"listbox",onClick:()=>i(!a),children:[n.find(l=>l[0]===e)?.[1],s.jsx(yi,{name:"down"})]}),a&&s.jsx("div",{className:"lp-options",role:"listbox","aria-label":r,children:n.map(([l,c])=>s.jsxs("button",{type:"button",role:"option","aria-selected":l===e,onClick:()=>{t(l),i(!1)},children:[c,l===e&&s.jsx("span",{children:"â"})]},l))})]})}function YKe({captured:e,selected:t,setSelected:n,query:r,setQuery:a,expert:i,setExpert:o}){const[l,c]=B.useState(!1),[u,d]=B.useState([]),[h,p]=B.useState(!1),m=Fj.filter(b=>`${b.question} ${b.summary} Dr. Emma Wells | AI Guide`.toLowerCase().includes(r.toLowerCase())),g=m.find(b=>b.id===t)||m[0],x=g&&s.jsxs("article",{className:"lp-conversation-detail",children:[s.jsxs("header",{className:"lp-card-header",children:[s.jsxs("div",{children:[s.jsx("h4",{children:g.question}),s.jsxs("p",{children:["Dr. Emma Wells | AI Guide · ",g.id===1?"Today":g.time]})]}),h&&s.jsx("button",{className:"lp-close","aria-label":"Close conversation",onClick:()=>p(!1),children:"Ã"})]}),s.jsxs("div",{className:"lp-card-body",children:[s.jsxs("dl",{className:"lp-chat-counts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Visitor messages"}),s.jsx("dd",{children:"2"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Total messages"}),s.jsx("dd",{children:"4"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Source"}),s.jsx("dd",{children:"Public profile"})]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Conversation summary"}),s.jsxs("div",{className:"lp-summary",children:[s.jsx(yi,{name:"spark"}),s.jsxs("div",{children:[s.jsx("p",{children:g.summary}),l&&s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:"Recommended offering"}),s.jsxs("p",{children:[g.offering,". ",g.id===1&&e?"The visitor shared their email and asked Emma to follow up.":"The visitor explored this recommendation with Emma AI."]})]})]}),s.jsx("button",{"aria-label":l?"Collapse summary":"Expand summary","aria-expanded":l,onClick:()=>c(!l),children:s.jsx(yi,{name:"down"})})]})]}),s.jsxs("section",{className:"lp-transcript",children:[s.jsx("span",{className:"lp-eyebrow",children:"Transcript"}),s.jsx("ol",{children:[{role:"Visitor",text:g.question},{role:"AI expert",text:g.answer},{role:"Visitor",text:g.message},{role:"AI expert",text:"You can send a contact request and Emma can follow up with you."}].map((b,y)=>s.jsxs("li",{className:b.role==="AI expert"?"is-assistant":"",children:[s.jsx("span",{children:b.role}),s.jsx("p",{children:b.text})]},y))})]})]})]});return s.jsxs("section",{className:"lp-view",children:[s.jsxs("div",{className:"lp-intro lp-conversation-intro",children:[s.jsxs("div",{children:[s.jsxs("h4",{children:["What your audience is ",s.jsx("em",{children:"asking"})]}),s.jsx("p",{children:"See what visitors asked and how your AI responded across every audience conversation."})]}),s.jsxs("div",{className:"lp-chat-filters",children:[s.jsx(Zne,{label:"Search conversations",value:r,onChange:a}),s.jsx(GKe,{label:"Filter conversations by expert",value:i,onChange:o,options:[["all","All experts"],["emma","Dr. Emma Wells | AI Guide"]]})]})]}),m.length?s.jsxs("div",{className:"lp-split",children:[s.jsxs("div",{className:"lp-card lp-list",children:[s.jsxs("div",{className:"lp-card-header",children:[s.jsx("strong",{children:"Chat inbox"}),s.jsxs("span",{children:[m.length," ",m.length===1?"conversation":"conversations"]})]}),m.map(b=>s.jsxs("button",{className:`lp-list-row ${g.id===b.id?"selected":""}`,"aria-current":g.id===b.id?"true":void 0,onClick:()=>{n(b.id),c(!1),d(y=>[...y,b.id]),window.matchMedia("(max-width: 960px)").matches&&p(!0)},children:[s.jsxs("span",{className:"lp-row-top",children:[s.jsx("strong",{children:b.question}),s.jsx("small",{children:b.id===1?"Just now":b.time})]}),s.jsxs("span",{className:"lp-row-meta",children:[s.jsxs("span",{children:[b.id!==g.id&&!u.includes(b.id)&&s.jsx("b",{className:"lp-new",children:"New"}),"Dr. Emma Wells | AI Guide"]}),s.jsx("small",{children:"4 messages"}),s.jsx("i",{children:s.jsx(yi,{name:"chevron",size:14})})]})]},b.id))]}),s.jsx("div",{className:"lp-card lp-chat-desktop",children:x}),h&&s.jsx("div",{className:"lp-mobile-modal",role:"dialog","aria-label":"Conversation detail",children:x})]}):s.jsxs("div",{className:"lp-card lp-empty",children:[s.jsx("h4",{children:"No matching conversations"}),s.jsx("p",{children:"Try another search or expert."})]})]})}function cB({lead:e,onStatus:t,onNote:n}){const[r,a]=B.useState(!0),[i,o]=B.useState(e.note||""),[l,c]=B.useState(!1),[u,d]=B.useState(!1),h=(p,m,g)=>s.jsxs("div",{className:"lp-context-row",children:[s.jsx(yi,{name:p}),s.jsx("span",{children:m}),s.jsx("strong",{children:g})]});return s.jsxs("article",{className:"lp-card lp-lead-detail",children:[s.jsxs("header",{className:"lp-card-header",children:[s.jsxs("div",{children:[s.jsx("h4",{children:e.name}),s.jsx("small",{children:e.time})]}),s.jsx("span",{className:"lp-ready",children:e.id===1||e.id===3?"Ready now":"Exploring"}),s.jsx("select",{"aria-label":"Request status",value:e.status,onChange:p=>t(p.target.value),children:Qne.map(p=>s.jsx("option",{children:p},p))})]}),s.jsxs("div",{className:"lp-card-body",children:[s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Request context"}),s.jsxs("div",{className:"lp-inset",children:[h("source","Source","Public profile"),h("bot","Expert","Dr. Emma Wells | AI Guide"),s.jsxs("div",{className:"lp-context-row is-stack",children:[s.jsx(yi,{name:"file"}),s.jsxs("div",{children:[s.jsx("span",{children:"Summary"}),s.jsx("p",{children:e.summary})]})]}),h("clock","Received",e.time)]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Contact & details"}),s.jsxs("div",{className:"lp-inset",children:[s.jsxs("div",{className:"lp-context-row",children:[s.jsx(yi,{name:"mail"}),s.jsx("span",{children:"Email"}),s.jsx("strong",{children:e.email}),s.jsx("button",{className:"lp-text-button",onClick:async()=>{try{await navigator.clipboard.writeText(e.email),d(!0)}catch{d(!1)}},children:u?"Copied":"Copy"})]}),h("phone","Phone","Not shared"),s.jsxs("div",{className:"lp-context-row is-stack",children:[s.jsx(yi,{name:"message"}),s.jsxs("div",{children:[s.jsx("span",{children:"Message they left"}),s.jsx("p",{children:e.message})]})]}),s.jsxs("div",{className:"lp-context-row",children:[s.jsx(yi,{name:"message"}),s.jsx("span",{children:"Chat history"}),s.jsxs("button",{className:"lp-show-chat","aria-expanded":r,onClick:()=>a(!r),children:[r?"Hide":"Show",s.jsx(yi,{name:"down"})]})]}),r&&s.jsxs("div",{className:"lp-lead-transcript",children:[s.jsx("p",{children:e.question}),s.jsx("p",{children:e.answer})]})]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Internal note"}),s.jsxs("div",{className:"lp-inset lp-note",children:[s.jsx("textarea",{"aria-label":"Internal note",placeholder:"Only visible to you",value:i,onChange:p=>{o(p.target.value),c(!1)}}),s.jsxs("div",{children:[l&&s.jsx("span",{role:"status",children:"Note saved"}),s.jsx("button",{onClick:()=>{n(i),c(!0)},children:"Save"})]})]})]})]})]})}function ud({title:e,children:t,id:n}){return s.jsxs("section",{className:"lp-card lp-insight-card",id:n,children:[s.jsx("div",{className:"lp-card-header",children:s.jsx("strong",{children:e})}),s.jsx("div",{className:"lp-card-body",children:t})]})}function KKe({period:e,captured:t,newCount:n,onConversations:r,onLeads:a,onNewLeads:i}
430){const o=t?1:0,l=e==="1"?{c:11+o,p:9,v:47,l:o,r:6+o,k:3,voice:2}:e==="7"?{c:46+o,p:32,v:218,l:2+o,r:21+o,k:9,voice:8}:e==="all"?{c:342+o,p:228,v:1430,l:4+o,r:174+o,k:64,voice:57}:{c:184+o,p:126,v:842,l:4+o,r:86+o,k:31,voice:29},c=B.useRef(null),u=[["Trial Lesson",39,16,21],["Conversation Lessons",29,10,17],["IELTS Prep Package",19,5,12]],d=()=>c.current?.scrollIntoView({behavior:"smooth",block:"nearest"}),h=[["Conversations",l.c,s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lp-voice-bar",children:s.jsx("i",{style:{width:`${l.voice/l.c*100}%`}})}),"Voice ",l.voice," · Text ",l.c-l.voice]}),"conversations","View"],["People who chatted",l.p,`Different people · ${Math.round(l.p*.4)} not signed in`],["Profile visitors",l.v,"People who opened your profile page"],["Leads",l.l,"People who asked you to get in touch","leads","Open"],["Recommendations",l.r,"Times your AI suggested one of your offerings","breakdown","Breakdown"],["Offering clicks",l.k,`${Math.round(l.k/l.r*100)}% of recommendations led to a click`,"breakdown","Breakdown"]];return s.jsxs("section",{className:"lp-view",children:[s.jsx("div",{className:"lp-intro",children:s.jsxs("div",{children:[s.jsxs("h4",{children:["Find out what your audience ",s.jsx("em",{children:"actually wants"})]}),s.jsxs("p",{children:["Insights are ",s.jsx("strong",{children:"fully anonymous"}),". They show what people need, not who they are."]})]})}),s.jsx("div",{className:"lp-metrics",children:h.map(([p,m,g,x,b],y)=>{const v=x?"button":"div";return s.jsxs(v,{type:x?"button":void 0,className:`lp-metric ${y===0?"accent":""} ${y===1?"indigo-value":""}`,onClick:x?()=>{x==="breakdown"?d():x==="conversations"?r():x==="leads"&&a()}:void 0,"aria-label":x?`${p}, ${b}`:void 0,children:[s.jsx("span",{className:"lp-eyebrow",children:p}),s.jsx("strong",{children:m},m),s.jsxs("div",{children:[s.jsx("small",{children:g}),b&&s.jsxs("b",{children:[b," â"]})]})]},p)})}),s.jsxs("div",{className:"lp-card lp-next",children:[s.jsx("h5",{children:"What to do next"}),s.jsxs("button",{onClick:i,children:[s.jsxs("span",{children:[s.jsxs("strong",{children:[n," new requests waiting"]}),s.jsx("small",{children:"Reply while the conversation is still fresh."})]}),s.jsx("b",{children:"View new requests â"})]})]}),s.jsxs(ud,{title:"How conversations progress",children:[[["Conversations",l.c],["Kept talking (5+ messages)",Math.round(l.c*.63)],["Asked to connect",l.l]].map(([p,m],g)=>s.jsxs("div",{className:"lp-bar-row",children:[s.jsx("span",{children:p}),s.jsx("i",{children:s.jsx("b",{style:{width:`${Math.max(3,m/l.c*100)}%`}})}),s.jsx("strong",{children:m}),s.jsx("small",{children:g>0?`${Math.round(m/l.c*100)}%`:""})]},p)),s.jsxs("p",{className:"lp-foot",children:[s.jsxs("strong",{children:[Math.round(l.p*.18)," people came back"]})," for a second conversation in this period. Returning visitors are your warmest audience."]})]}),s.jsx("div",{ref:c,children:s.jsxs(ud,{title:"Your AI sales agent at work",children:[s.jsx("p",{className:"lp-foot",children:"What your AI recommended, and what people did about it."}),s.jsx("div",{className:"lp-ranking-grid",children:[["Most clicked",2],["Most recommended",1],["Most asked for",3]].map(([p,m])=>s.jsxs("div",{children:[s.jsx("h5",{children:p}),u.map((g,x)=>s.jsxs("div",{className:"lp-ranking",children:[s.jsxs("span",{children:["0",x+1]}),s.jsx("strong",{children:g[0]}),s.jsx("b",{children:e==="7"?Math.max(1,Math.round(g[m]/4)):e==="1"?Math.max(1,Math.round(g[m]/15)):e==="all"?g[m]*2:g[m]})]},g[0]))]},p))})]})}),s.jsx(ud,{title:"What people ask about",children:[["Speaking confidence",68],["Conversation practice",51],["Trial lessons",39],["Pronunciation",26]].map(([p,m])=>s.jsxs("div",{className:"lp-bar-row",children:[s.jsx("span",{children:p}),s.jsx("i",{children:s.jsx("b",{style:{width:`${m/68*100}%`}})}),s.jsx("strong",{children:m})]},p))}),s.jsx("div",{className:"lp-two-up",children:[["Busiest days",["M","T","W","T","F","S","S"],[18,21,24,20,32,39,31]],["Busiest hours",["6am","9am","12pm","3pm","6pm","9pm"],[9,18,31,35,54,38]]].map(([p,m,g])=>s.jsx(ud,{title:p,children:s.jsx("div",{className:"lp-columns",children:m.map((x,b)=>s.jsxs("div",{children:[s.jsx("span",{children:Math.round(g[b]*l.c/185)}),s.jsx("i",{style:{height:`${g[b]*1.4}px`}}),s.jsx("small",{children:x})]},b))})},p))}),s.jsxs("div",{className:"lp-two-up",children:[s.jsx(ud,{title:"Your experts",children:s.jsxs("table",{className:"lp-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Expert"}),s.jsx("th",{children:"Chats"}),s.jsx("th",{children:"Requests"})]})}),s.jsx("tbody",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Dr. Emma Wells | AI Guide"}),s.jsx("td",{children:l.c}),s.jsx("td",{children:l.l})]})})]})}),s.jsxs(ud,{title:"Knowledge gaps",children:[s.jsx("h5",{children:"IELTS speaking criteria"}),s.jsx("p",{className:"lp-foot",children:"People asked for more detail about the speaking assessment criteria for IELTS."})]})]}),s.jsx(ud,{title:"Where people find you",children:s.jsxs("table",{className:"lp-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Source"}),s.jsx("th",{children:"Chats"}),s.jsx("th",{children:"Requests"})]})}),s.jsxs("tbody",{children:[s.jsxs("tr",{children:[s.jsx("th",{children:"Public profile"}),s.jsx("td",{children:Math.round(l.c*.8)}),s.jsx("td",{children:l.l})]}),s.jsxs("tr",{children:[s.jsx("th",{children:"Website embed"}),s.jsx("td",{children:l.c-Math.round(l.c*.8)}),s.jsx("td",{children:"0"})]})]})]})})]})}const uB=e=>(e?Fj:Fj.slice(1)).map(t=>({...t,status:t.status==="Closed"?"Replied":t.status,time:t.id===1?"Just now":t.time}));
430function XKe(){const[e,t]=B.useState("insights"),[n,r]=B.useState(()=>uB(!1)),[a,i]=B.useState(2),[o,l]=B.useState("All"),[c,u]=B.useState(""),[d,h]=B.useState("30"),[p,m]=B.useState(1),[g,x]=B.useState(""),[b,y]=B.useState("all"),[v,w]=B.useState(""),[j,E]=B.useState([]),[S,_]=B.useState(!1),[k,C]=B.useState("chat"),N=B.useRef(null),A=B.useRef(null),T=B.useRef({}),I=B.useRef(0),$=B.useRef(!1),O=B.useRef(!1),U=B.useRef(-1),[F,H]=B.useState(!1),[G,M]=B.useState(-1),z=G>=3,W=()=>{O.current=!0,H(!1)},D=B.useCallback(P=>{t(P),A.current&&(A.current.scrollTop=0)},[]),Z=B.useCallback((P,ee=!1)=>{const X=P<700?0:P<1500?1:P<2800?2:P<4800?3:4;X===U.current&&!ee||(U.current=X,M(X),(X===0||ee)&&(w(""),r(uB(X>=3)),i(X>=3?1:2),l("All"),u(""),x(""),y("all"),m(1),E([]),_(!1),C("chat"),D(X===3?"leads":"insights"),h("30")),X===3&&(r(ae=>ae.some(me=>me.id===1)?ae:[{...Fj[0],time:"Just now"},...ae]),i(1),D("leads"),w("Emily Parker shared her details. New lead added to your inbox.")),X===4&&(m(1),D("conversations")))},[D]);B.useEffect(()=>{const P=window.matchMedia("(prefers-reduced-motion: reduce)"),ee=new IntersectionObserver(([me])=>{$.current=me.isIntersecting&&me.intersectionRatio>=.5,$.current&&!O.current&&!P.matches&&(O.current=!0,Z(0,!0),H(!0))},{threshold:.5,rootMargin:"-88px 0px 0px"}),X=N.current?.querySelector(".lc-shell");X&&ee.observe(X);const ae=()=>{P.matches&&(O.current=!0,H(!1),I.current=2800,Z(2800,!0))};return ae(),P.addEventListener("change",ae),()=>{ee.disconnect(),P.removeEventListener("change",ae)}},[Z]),B.useEffect(()=>{if(!F)return;let P=performance.now();const ee=setInterval(()=>{const X=performance.now(),ae=Math.min(X-P,200);P=X,!(!$.current||document.hidden)&&(I.current=Math.min(I.current+ae,9e3),Z(I.current),I.current===9e3&&H(!1))},100);return()=>clearInterval(ee)},[F,Z]);const V=n.filter(P=>(o==="All"||P.status===o)&&`${P.name} ${P.topic} ${P.email}`.toLowerCase().includes(c.toLowerCase())),L=V.find(P=>P.id===a)||V[0],K=n.filter(P=>P.status==="New").length,te=P=>{r(ee=>ee.map(X=>X.id===L.id?{...X,status:P}:X)),w(`${L.name} marked ${P.toLowerCase()}.`)},Q=P=>r(ee=>ee.map(X=>X.id===L.id?{...X,note:P}:X)),Y=P=>{if(!["ArrowLeft","ArrowRight"].includes(P.key))return;P.preventDefault();const ee=sS.findIndex(ae=>ae[0]===e),X=sS[(ee+(P.key==="ArrowRight"?1:2))%3][0];D(X),T.current[X]?.focus()},J=P=>{P.target.closest(".ld-export")||(W(),C("dashboard"))};return s.jsx("div",{className:"ld-showcase",ref:N,children:s.jsxs("div",{className:"ld-stage",children:[s.jsx("div",{className:"ld-demo lp-product",style:{zIndex:k==="dashboard"?4:1},onPointerDownCapture:J,onFocusCapture:J,children:s.jsxs("div",{className:"ld-app",ref:A,children:[s.jsxs("header",{className:"ld-header",children:[s.jsxs("h3",{children:["Insights & ",s.jsx("em",{children:"Leads"})]}),s.jsxs("button",{type:"button",className:"ld-reset ld-export",children:[s.jsx(yi,{name:"download"}),e==="conversations"?"Export chats":"Export CSV"]})]}),s.jsxs("div",{className:"ld-toolbar",children:[s.jsx("div",{className:"ld-tabs",role:"tablist","aria-label":"Leads views",onKeyDown:Y,children:sS.map(([P,ee])=>s.jsxs("button",{type:"button",ref:X=>T.current[P]=X,role:"tab",id:`demo-tab-${P}`,"aria-controls":`demo-panel-${P}`,"aria-selected":e===P,tabIndex:e===P?0:-1,onClick:()=>D(P),children:[s.jsx("span",{className:"lp-full-label",children:ee}),s.jsx("span",{className:"lp-short-label",children:P==="conversations"?"Chats":ee}),P==="leads"&&K>0&&s.jsx("span",{className:"lp-tab-count",children:K})]},P))}),e==="insights"&&s.jsx("div",{className:"ld-filters",role:"group","aria-label":"Period",children:VKe.map(([P,ee])=>s.jsx("button",{"aria-pressed":d===P,onClick:()=>h(P),children:ee},P))}),e==="leads"&&s.jsx("div",{className:"ld-filters",role:"group","aria-label":"Filter by status",children:["All",...Qne].map(P=>s.jsxs("button",{"aria-pressed":o===P,onClick:()=>l(P),children:[P,s.jsx("span",{children:P==="All"?n.length:n.filter(ee=>ee.status===P).length})]},P))})]}),s.jsxs("div",{role:"tabpanel",id:`demo-panel-${e}`,"aria-labelledby":`demo-tab-${e}`,children:[e==="insights"&&s.jsx(KKe,{period:d,captured:z,newCount:K,onConversations:()=>D("conversations"),onLeads:()=>{l("All"),u(""),D("leads")},onNewLeads:()=>{l("New"),u(""),D("leads")}}),e==="conversations"&&s.jsx(YKe,{captured:z,selected:p,setSelected:m,query:g,setQuery:x,expert:b,setExpert:y}),e==="leads"&&s.jsxs("section",{className:"lp-view",children:[s.jsxs("div",{className:"lp-intro",children:[s.jsxs("div",{children:[s.jsxs("h4",{children:["Someone is waiting for your ",s.jsx("em",{children:"reply"})]}),s.jsx("p",{children:"People who asked you to get in touch after talking with your AI Experts. You only see what they agreed to share."})]}),s.jsx(Zne,{label:"Search leads",value:c,onChange:u})]}),s.jsxs("div",{className:"lp-split lp-leads-split",children:[s.jsxs("div",{className:"lp-card lp-list",children:[s.jsxs("div",{className:"lp-card-header",children:[s.jsx("strong",{children:"Inbox"}),s.jsxs("span",{children:[V.length," ",V.length===1?"lead":"leads"]})]}),V.map(P=>s.jsxs("button",{className:`lp-list-row ${P.id===L?.id?"selected":""} ${P.id===1&&z?"ld-arrived":""}`,"aria-current":P.id===L?.id?"true":void 0,onClick:()=>{i(P.id),E(ee=>[...ee,P.id]),window.matchMedia("(max-width: 960px)").matches&&_(!0)},children:[s.jsxs("span",{className:"lp-row-top",children:[s.jsx("strong",{children:P.name}),s.jsx("small",{children:P.time})]}),s.jsxs("span",{className:"lp-row-meta",children:[(P.status!=="New"||!(j.includes(P.id)||P.id===L?.id))&&s.jsx("b",{className:`lp-status lp-${P.status.toLowerCase().replaceAll(" ","-")}`,children:P.status}),s.jsx("span",{children:"Expert: Dr. Emma Wells | AI Guide"}),s.jsx("i",{children:s.jsx(yi,{name:"chevron",size:14})})]})]},P.id)),!V.length&&s.jsx("div",{className:"lp-empty",children:"No requests with this status."})]}),s.jsx("div",{className:"lp-lead-desktop",children:L&&s.jsx(cB,{lead:L,onStatus:te,onNote:Q},L.id)})]}),S&&L&&s.jsxs("div",{className:"lp-mobile-modal",role:"dialog","aria-label":"Lead detail",children:[s.jsx("button",{className:"lp-close","aria-label":"Close request",onClick:()=>_(!1),children:"Ã"}),s.jsx(cB,{lead:L,onStatus:te,onNote:Q},L.id)]})]})]}),s.jsx("div",{className:"ld-sr",role:"status","aria-live":"polite",children:v})]})}),s.jsx(WKe,{phase:G,onPause:()=>{W(),C("chat")},onPreviewNote:w,onCapture:P=>{W(),I.current=2800,Z(2800,!0),r(ee=>ee.map(X=>X.id===1?{...X,email:P}:X))}})]})})}function JKe(){return s.jsxs("article",{className:"ge-feature-row lf-feature",children:[s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["More interest. ",s.jsx("em",{children:"More leads."})]}),s.jsx("p",{children:"See what your audience asks about. Capture contact details and turn conversations into your next opportunity."}),s.jsxs("a",{href:"#create-profile",children:["Start capturing leads ",s.jsx("svg",{width:"19",height:"19",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})})]})]}),s.jsx(XKe,{})]})}const QKe=[{name:"Dr. Emma Wells | AI Guide",initials:"EW",avatar:"/welcome/edu/assets/expert.webp",earned:1599.65,subscribers:6,mrr:89.94,rating:94},{name:"Marcus Webb",initials:"MW",avatar:"/welcome/assets/creator/marcus-natural.jpg",avatarClass:"ef-avatar-candid",earned:1056.8,subscribers:4,mrr:59.96,rating:90},{name:"Sofia Reyes",initials:"SR",avatar:"/welcome/assets/creator/sofia-natural.jpg",earned:765.76,subscribers:2,mrr:29.98,rating:92}],Hl=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e),yf=1499,ere=yf-Math.round(yf*.3),dB=300,hB=850,pB=1550,ZKe=1900,Q3=3100,eXe=3650,nS=3650,mB=4200,Z3=5800,uv=7500,tXe="Choose a fam
430iliar topic and speak for one minute. Record yourself, listen for word stress and repeat the same answer a little more clearly.";function sXe(e){const[t,n]=B.useState(0),r=B.useRef(0);return B.useEffect(()=>{const o=window.matchMedia("(prefers-reduced-motion: reduce)");let l=!1,c=null,u=null;const d=g=>{r.current=g,n(g)},h=g=>{if(c=null,!l||document.hidden||r.current>=uv){u=null;return}u!==null&&d(Math.min(uv,r.current+g-u)),u=g,c=requestAnimationFrame(h)},p=()=>{if(c!==null&&cancelAnimationFrame(c),c=null,u=null,o.matches){d(uv);return}l&&!document.hidden&&r.current<uv&&(c=requestAnimationFrame(h))},m=new IntersectionObserver(([g])=>{l=g.isIntersecting&&g.intersectionRatio>=.45,p()},{threshold:[0,.45],rootMargin:"-90px 0px 0px 0px"});return m.observe(e.current),document.addEventListener("visibilitychange",p),o.addEventListener("change",p),p(),()=>{m.disconnect(),c!==null&&cancelAnimationFrame(c),document.removeEventListener("visibilitychange",p),o.removeEventListener("change",p)}},[e]),[t,()=>{r.current=Math.max(r.current,Q3),n(r.current)},()=>{r.current=Math.max(r.current,Z3),n(r.current)}]}function xo({name:e,size:t=18}){const n={arrow:s.jsx("path",{d:"M4 12h16m-6-6 6 6-6 6"}),download:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M12 3v12m-5-5 5 5 5-5M4 15v5h16v-5"})}),check:s.jsx("path",{d:"m5 12 4 4L19 6"}),plus:s.jsx("path",{d:"M12 5v14M5 12h14"}),up:s.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),menu:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"}),loader:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M12 3a9 9 0 1 1-9 9"})}),sparkles:s.jsx(s.Fragment,{children:s.jsx("path",{d:"m12 3 2.7 6.3L21 12l-6.3 2.7L12 21l-2.7-6.3L3 12l6.3-2.7L12 3Z"})}),thumb:s.jsx("path",{d:"M7 10v11H3V10h4Zm0 0 5-8a3 3 0 0 1 2 4l-1 4h6a2 2 0 0 1 2 2l-2 7a2 2 0 0 1-2 2H7"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]})}function dd({label:e,value:t,note:n,accent:r=!1,small:a=!1,credited:i=!1}){return s.jsxs("div",{className:`ef-stat ef-surface ${r?"ef-stat-accent":""} ${a?"ef-stat-small":""} ${i?"ef-stat-credited":""}`,children:[s.jsx("span",{className:"ef-eyebrow",children:e}),s.jsx("strong",{children:t}),s.jsx("span",{className:"ef-stat-note",children:i?s.jsxs("span",{className:"ef-credit-note",children:[s.jsx(xo,{name:"check",size:12}),"+",Hl(ere/100)," added"]}):n})]})}function nXe({elapsed:e}){const[t,n]=B.useState({key:"earned",dir:-1}),r=e>=nS,a=Math.max(0,Math.min(1,(e-nS)/(mB-nS))),i=Math.round(ere*(1-Math.pow(1-a,3))),o=(342221+i)/100,l=QKe.map((h,p)=>p===0?{...h,earned:(159965+i)/100,subscribers:h.subscribers+Number(r),mrr:(8994+(r?yf:0))/100}:h).sort((h,p)=>t.dir*(t.key==="name"?h.name.localeCompare(p.name):h[t.key]-p[t.key])),c=[["name","By expert"],["earned","Earned"],["subscribers","Subscriptions"],["mrr","MRR"],["rating","Rating"]],u=[0,0,120,480,890,o].map((h,p)=>({value:h,label:new Date(new Date().getFullYear(),new Date().getMonth()-5+p,1).toLocaleString("en-US",{month:"short"})})),d=h=>n(p=>({key:h,dir:p.key===h?-p.dir:h==="name"?1:-1}));return s.jsxs("div",{className:"ef-dashboard",role:"group","aria-label":"Earnings dashboard preview",children:[s.jsxs("header",{className:"ef-dashboard-header ef-surface",children:[s.jsxs("h3",{children:["Your ",s.jsx("em",{children:"earnings"})]}),s.jsxs("div",{className:"ef-dashboard-actions",children:[s.jsxs("button",{type:"button",className:"ef-export","aria-label":"Export sample earnings CSV",onClick:()=>{},children:[s.jsx(xo,{name:"download",size:16}),"Export CSV"]}),s.jsx("button",{type:"button",className:"ef-payout",disabled:!0,title:"Payouts are available in your creator dashboard",children:"Request payout"})]})]}),s.jsx("p",{className:"ef-sample",children:"Sample data · This month"}),s.jsxs("div",{className:"ef-stats",children:[s.jsx(dd,{label:"Pending payout",value:Hl(o),note:"Payout from $50.00",accent:!0,credited:r}),s.jsx(dd,{label:"Total earned",value:Hl(o),note:"Your 70% share, after fees"}),s.jsx(dd,{label:"Active subscribers",value:r?"13":"12",note:`${r?5:4} new, 1 cancelled`}),s.jsx(dd,{label:"Subscriptions total",value:Hl((488887+(r?yf:0))/100),note:"What subscribers paid. You keep 70%"})]}),s.jsx("div",{className:"ef-table-wrap ef-surface",children:s.jsxs("table",{children:[s.jsx("caption",{className:"ef-sr-only",children:"Earnings, subscriptions and rating for each of your experts"}),s.jsx("thead",{children:s.jsx("tr",{children:c.map(([h,p])=>s.jsx("th",{scope:"col","aria-sort":t.key===h?t.dir===1?"ascending":"descending":"none",children:s.jsxs("button",{type:"button",onClick:()=>d(h),children:[p,s.jsx("span",{"aria-hidden":"true",children:t.key===h?t.dir===1?"â":"â":""})]})},h))})}),s.jsx("tbody",{children:l.map(h=>s.jsxs("tr",{children:[s.jsx("th",{scope:"row",children:s.jsxs("span",{className:"ef-expert",children:[s.jsx("span",{className:"ef-avatar","aria-hidden":"true",children:h.avatar?s.jsx("img",{src:h.avatar,alt:"",className:h.avatarClass}):h.initials}),h.name]})}),s.jsx("td",{children:Hl(h.earned)}),s.jsx("td",{children:h.subscribers}),s.jsx("td",{children:Hl(h.mrr)}
430),s.jsx("td",{children:s.jsxs("span",{className:"ef-rating",children:[s.jsx(xo,{name:"thumb",size:13}),h.rating,"%"]})})]},h.name))})]})}),s.jsxs("div",{className:"ef-history",children:[s.jsxs("div",{className:"ef-months ef-surface",children:[s.jsx("h4",{className:"ef-eyebrow",children:"Last 6 months"}),u.map((h,p)=>s.jsxs("div",{className:`ef-month ${p===5?"ef-current":""}`,children:[s.jsx("span",{children:h.label}),s.jsx("span",{className:"ef-bar",children:s.jsx("i",{style:{width:h.value?`${Math.max(5,h.value/o*100)}%`:"0%"}})}),s.jsx("strong",{children:Hl(h.value)})]},h.label))]}),s.jsxs("div",{className:"ef-feedback ef-surface",children:[s.jsx("h4",{className:"ef-eyebrow",children:"Answer feedback"}),s.jsx("div",{className:"ef-ring",role:"img","aria-label":"92% of 142 rated answers were helpful",children:s.jsxs("span",{children:[s.jsx(xo,{name:"thumb",size:17}),s.jsx("strong",{children:"92%"})]})}),s.jsx("p",{children:"From 142 rated answers"})]})]}),s.jsxs("div",{className:"ef-activity",children:[s.jsx(dd,{small:!0,label:"Questions answered",value:"487",note:"In the selected period"}),s.jsx(dd,{small:!0,label:"Active experts",value:"3",note:"Published and answering"}),s.jsx(dd,{small:!0,label:"Drafts",value:"1",note:"Not published yet"})]}),s.jsx("span",{className:"ef-sr-only",role:"status","aria-live":"polite",children:e>=mB?"English with Emma received a subscription payment. $10.49 added to earnings. Pending payout is now $3,432.70.":""})]})}function rXe({elapsed:e,onSubscribe:t,onContinue:n}){const r=e>=eXe,a=e>=ZKe&&!r,i=e>=Q3&&!r,o=e>=Z3,l=e>=Q3&&!o,c=o?tXe.split(" ").slice(0,Math.max(1,Math.floor((e-Z3)/48))).join(" "):"",u=B.useRef(null),d=B.useRef(!0),h=B.useRef(null),p=B.useRef(!1),m=()=>{p.current=!0,t()};B.useEffect(()=>{p.current&&(l?h.current?.focus({preventScroll:!0}):(u.current?.closest(".ef-subscription").querySelector("textarea")?.focus({preventScroll:!0}),p.current=!1))},[l]);const g=e>=dB,x=e>=hB,b=e>=pB;return B.useEffect(()=>{const y=u.current;d.current&&(y.scrollTop=y.scrollHeight)},[g,x,b,r,c]),s.jsxs("section",{className:`ef-subscription ${a?"ef-chat-gated":""} ${r?"ef-payment-paid":""}`,"aria-label":"Paid expert conversation preview",children:[s.jsxs("div",{className:"ef-chat-content",inert:l?"":void 0,children:[s.jsxs("header",{className:"ef-chat-header",children:[s.jsx("img",{className:"ef-chat-avatar",src:"/welcome/edu/assets/expert.webp",alt:"Dr. Emma Wells | AI Guide"}),s.jsxs("div",{children:[s.jsx("strong",{children:"Emma AI"}),s.jsxs("span",{children:["Powered by ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",children:"Great Experts"})]})]}),s.jsx("span",{className:"ef-chat-menu","aria-hidden":"true",children:s.jsx(xo,{name:"menu",size:26})})]}),s.jsxs("div",{className:"ef-chat-thread",ref:u,onScroll:y=>{const v=y.currentTarget;d.current=v.scrollHeight-v.scrollTop-v.clientHeight<40},"aria-label":"Example conversation",children:[s.jsx("div",{className:"ef-chat-message ef-chat-assistant",children:"Hi! Ask me about English lessons, pronunciation or preparing for IELTS."}),e>=dB&&s.jsx("div",{className:"ef-chat-message ef-chat-user",children:"How can I sound more confident when speaking English?"}),e>=hB&&s.jsx("div",{className:"ef-chat-message ef-chat-assistant",children:"Start with a familiar topic and short sentences. Focus on communicating your ideas rather than speaking perfectly."}),e>=pB&&s.jsx("div",{className:"ef-chat-message ef-chat-user",children:"Which speaking exercise should I start with?"}),o&&s.jsx("div",{className:"ef-chat-message ef-chat-assistant ef-chat-continued","aria-label":"Answer after subscribing",children:c})]}),s.jsx("div",{className:"ef-chat-input-area",children:a?s.jsxs("div",{className:"ef-chat-paywall",role:"status",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Free messages used."})," ",Hl(yf/100),"/mo to keep chatting."]}),s.jsxs("button",{type:"button",className:"ef-subscribe",onClick:m,disabled:i,"aria-label":i?"Redirecting to subscription checkout":"Preview a paid subscription",children:[i&&s.jsx(xo,{name:"loader",size:12})," ",i?"Redirectingâ¦":"Subscribe"]})]}):s.jsxs("div",{className:"ef-chat-composer",children:[s.jsx("span",{"aria-hidden":"true",children:s.jsx(xo,{name:"plus",size:20})}),s.jsx("textarea",{rows:"1",readOnly:!0,"aria-label":"Example message",placeholder:"Ask anything..."}),s.jsxs("span",{className:"ef-chat-call","aria-hidden":"true",children:[s.jsx(xo,{name:"phone",size:17}),"Call"]})]})}),s.jsx("footer",{className:"ef-chat-footer",children:s.jsxs("p",{children:["AI Chat. Messages and AI replies may be reviewed by this expertâs owner for audience insights. Donât share sensitive personal information. ",s.jsx("a",{href:"https://greatexperts.ai/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})," · ",s.jsx("a",{href:"https://greatexperts.ai/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"})]})})]}),l&&s.jsx("div",{className:"ef-confirmation-overlay",children:s.jsxs("section",{ref:h,tabIndex:-1,
430className:"ef-confirmation",role:"dialog","aria-label":"Subscription confirmation preview",onKeyDown:y=>{y.key==="Escape"&&r&&n()},children:[s.jsx("span",{className:`ef-confirmation-icon ${r?"is-paid":""}`,children:s.jsx(xo,{name:r?"check":"loader",size:26})}),s.jsx("span",{className:"ef-confirmation-label",children:r?"Subscription active":"Confirming subscription"}),s.jsx("h3",{children:r?"Youâre subscribed":"Almost there"}),s.jsx("p",{children:r?"You now have unlimited 1-on-1 chat with Emma AI for the next 30 days.":"Confirming your subscription to Emma AI."}),s.jsxs("div",{className:"ef-confirmation-payment",children:[s.jsxs("span",{children:["Monthly subscription",s.jsx("strong",{children:Hl(yf/100)})]}),s.jsx("b",{children:r?"Paid":"Processingâ¦"})]}),s.jsx("p",{className:"ef-confirmation-renewal",children:"Renews monthly until you cancel."}),s.jsxs("button",{type:"button",onClick:n,disabled:!r,children:["Continue chatting ",s.jsx(xo,{name:"arrow",size:16})]})]})}),s.jsx("span",{className:"ef-sr-only",role:"status","aria-live":"polite",children:r?"Your subscription to Emma AI is active. You can continue chatting.":""})]})}function aXe(){const e=B.useRef(null),t=B.useRef(null),n=B.useRef(null),[r,a]=B.useState("payment"),[i,o,l]=sXe(t);return B.useEffect(()=>{const c=e.current,u=()=>{c.style.setProperty("--ef-dashboard-scale",Math.min(c.clientWidth*.9/1040,c.clientHeight*.86/940)),c.style.setProperty("--ef-payment-scale",c.clientWidth*.38/440)};u();const d=new ResizeObserver(u);return d.observe(c),()=>d.disconnect()},[]),s.jsxs("div",{className:"ge-feature-row ef-feature",children:[s.jsxs("div",{className:"ef-scene",ref:e,children:[s.jsx("div",{ref:n,className:`ef-dashboard-window ${r==="dashboard"?"ef-front":""}`,onPointerDown:()=>a("dashboard"),onFocusCapture:()=>
430a("dashboard"),children:s.jsx(nXe,{elapsed:i})}),s.jsx("div",{ref:t,className:`ef-payment-window ${r==="payment"?"ef-front":""}`,onPointerDown:()=>a("payment"),onFocusCapture:()=>a("payment"),children:s.jsx(rXe,{elapsed:i,onSubscribe:o,onContinue:l})})]}),s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["Earn from ",s.jsx("em",{children:"your expertise."})]}),s.jsx("p",{children:"Offer paid access to your AI expert. Track subscriptions and earnings in one place."}),s.jsxs("a",{href:"#create-profile",children:["Start earning ",s.jsx(xo,{name:"arrow",size:18})]})]})]})}function iXe(){return s.jsx($k,{src:"/welcome/edu/product-profile/index.html",title:"Customize Emmaâs page in the Great Experts editor"})}function oXe(){return s.jsx(Fk,{src:"/welcome/edu/product-profile/knowledge.html"})}const lXe={CallsFeature:qKe,LeadsFeature:JKe,EarningsFeature:aXe,ProfileFeature:iXe,KnowledgeFeature:oXe};function cXe(){return s.jsx(Bk,{canonicalPath:"/edu",heroProfileSrc:"/welcome/edu/HeroPhone.html?autoscroll=true",features:lXe,pageClassName:"edu-landing"})}function Xc({name:e,size:t=20}){const n={phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"}),mic:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),s.jsx("path",{d:"M5 10v2a7 7 0 0 0 14 0v-2M12 19v3M8 22h8"})]}),micOff:s.jsx(s.Fragment,{children:s.jsx("path",{d:"m2 2 20 20M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V5a3 3 0 0 0-5.94-.6M5 10v2a7 7 0 0 0 12 4.9M19 10v2c0 .67-.09 1.32-.27 1.94M12 19v3M8 22h8"})}),arrow:s.jsx("path",{d:"M4 12h16m-6-6 6 6-6 6"}),external:s.jsx("path",{d:"M7 7h10v10M7 17 17 7"}),chevronRight:s.jsx("path",{d:"m9 6 6 6-6 6"}),chevronLeft:s.jsx("path",{d:"m15 6-6 6 6 6"}),chevronUp:s.jsx("path",{d:"m6 15 6-6 6 6"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.65",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]})}const Rd=1e4,uXe="What would you pick for a quick everyday makeup look?",dXe=["Start with Glowé Cloud Skin Tint.","Add a little Glowé Lip Butter.","Try the $8 viral blush dupe.","Iâve shared all three here for you."],hXe=[{at:2400,title:"Glowé Cloud Skin Tint",category:"$28",image:"product-0.webp",url:"https://greatexperts.ai/beautymiaaa"},{at:4e3,title:"Glowé Lip Butter",category:"$16",image:"product-1.webp",url:"https://greatexperts.ai/beautymiaaa"},{at:5500,title:"$8 dupe for the viral blush",category:"Drugstore dupe",image:"product-2.webp",url:"https://greatexperts.ai/beautymiaaa"}],fB=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function pXe(e,t,n,r=1){const[a,i]=B.useState(0),[o,l]=B.useState(!1),c=B.useRef(0);return B.useEffect(()=>{const u=window.matchMedia("(prefers-reduced-motion: reduce)"),d=()=>l(u.matches);return d(),u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[]),B.useEffect(()=>{c.current=0,i(0)},[n]),B.useEffect(()=>{if(o){c.current=Rd,i(Rd);return}if(!e||t||c.current>=Rd)return;let u,d=null,h=c.current;const p=g=>{document.hidden?d=null:(d!==null&&(c.current=Math.min(Rd,c.current+(g-d)*r)),d=g,(c.current-h>=80||c.current===Rd)&&(h=c.current,i(h))),c.current<Rd&&(u=requestAnimationFrame(p))},m=()=>{d=null};return document.addEventListener("visibilitychange",m),u=requestAnimationFrame(p),()=>{cancelAnimationFrame(u),document.removeEventListener("visibilitychange",m)}},[e,t,n,o,r]),a}function gB({products:e,large:t=!1}){return s.jsx("section",{className:`cf-recommendations ${t?"cf-recommendations-large":""}`,"aria-label":"Profile recommendations",children:e.map(n=>s.jsxs("a",{className:"cf-product-row",href:n.url,target:"_blank",rel:"noopener noreferrer","aria-label":`View product: ${n.title}`,children:[s.jsx("span",{className:"cf-product-image",children:s.jsx("img",{src:`/welcome/beauty/assets/${n.image}`,alt:""})}),s.jsxs("span",{className:"cf-product-info",children:[s.jsx("strong",{children:n.title}),s.jsx("span",{children:n.category})]}),s.jsx(Xc,{name:"external",size:t?18:16})]},n.title))})}function xB({device:e,active:t,onComplete:n,onEnd:r,playbackRate:a=1}){const[i,o]=B.useState(!1),[l,c]=B.useState(!1),[u,d]=B.useState(0),[h,p]=B.useState(null),[m,g]=B.use
430State(!0),x=pXe(t,l,u,a),b=B.useRef(!1);B.useEffect(()=>{b.current=!1},[u]),B.useEffect(()=>{x>=Rd&&n&&!b.current&&(b.current=!0,n())},[x,n]);const y=x>=1750&&x<8200,v=x>=1200&&x<1750,w=l?[]:hXe.filter(T=>x>=T.at),j=w.length>0,E=j&&(h===null?x>=5e3:h),S=x<3200?0:x<4800?1:x<6500?2:3,_=uXe.split(" ").slice(0,Math.max(1,Math.floor(x/100))).join(" "),k=258-Math.floor(x/1e3),C=B.useRef(null),N=e==="phone";B.useEffect(()=>{const T=C.current,I=()=>T.style.setProperty("--call-scale",T.clientWidth/(N?390:1040));I();const $=new ResizeObserver(I);return $.observe(T),()=>$.disconnect()},[N]);const A=()=>{c(!1),o(!1),p(null),g(!0),d(T=>T+1)};return s.jsx("div",{className:`cf-device-screen ${N?"cf-screen-phone":"cf-screen-laptop"}`,ref:C,children:s.jsxs("div",{className:`cf-call-ui ${l?"cf-ended":""} ${i?"cf-muted":""} ${j?"cf-has-offers":""} ${y?"cf-speaking":v?"cf-thinking":"cf-listening"}`,role:"group","aria-label":`AI voice call preview on ${e}`,children:[s.jsxs("div",{className:"cf-call-main",children:[s.jsxs("header",{className:"cf-call-header",children:[s.jsxs("div",{className:"cf-identity",children:[s.jsxs("span",{children:[s.jsx("img",{src:"/welcome/beauty/assets/expert.webp",alt:""}),s.jsx("i",{"aria-hidden":"true"})]}),s.jsx("strong",{children:"Mia Bennett"})]}),s.jsxs("div",{className:"cf-time",children:[s.jsx(Xc,{name:"phone",size:14}),!l&&s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",children:[s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"#e8e6dc",strokeWidth:"2.5"}),s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"#3d3df5",strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${k/300*40.8} 40.8`,transform:"rotate(-90 8 8)"})]}),s.jsx("span",{children:l?fB(42+Math.floor(x/1e3)):`${fB(k)} remaining`})]})]}),s.jsxs("div",{className:"cf-call-stage",children:[s.jsxs("div",{className:"cf-avatar-stage",children:[s.jsxs("div",{className:"cf-aura","aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("div",{className:"cf-avatar",children:[s.jsx("i",{className:"cf-avatar-halo","aria-hidden":"true"}),s.jsx("i",{className:"cf-avatar-ring","aria-hidden":"true"}),s.jsx("i",{className:"cf-avatar-ripple","aria-hidden":"true"}),s.jsx("img",{src:"/welcome/beauty/assets/expert.webp",alt:"Mia Bennett"})]})]}),s.jsx("p",{className:"cf-call-status",role:"status",children:l?"Call ended":i?"Microphone off":y?"Speaking":v?"Thinking":"Listening"}),s.jsx("div",{className:"cf-transcript",children:!l&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"cf-question",children:["You · ",_]}),x>=1750&&s.jsx("div",{className:"cf-captions","aria-label":"Call transcript",children:s.jsx("div",{className:"cf-caption-track",style:{transform:`translateY(${(1-S)*32.8}px)`},children:dXe.map((T,I)=>s.jsx("span",{className:I===S?"is-current":"","aria-current":I===S?"true":void 0,children:T},T))})})]})})]}),N&&j&&s.jsxs("button",{className:"cf-offers-bar",onClick:()=>p(!0),"aria-expanded":E,children:[s.jsx("span",{className:"cf-offer-thumbs",children:w.map(T=>s.jsx("span",{children:s.jsx("img",{src:`/welcome/beauty/assets/${T.image}`,alt:""})},T.title))}),s.jsxs("strong",{children:[w.length," mentioned in this call"]}),s.jsx(Xc,{name:"chevronUp",size:16})]}),s.jsx("footer",{className:"cf-call-controls",children:l?s.jsxs("button",{className:"cf-call-again",onClick:A,children:[s.jsx(Xc,{name:"phone",size:16}),"Call again"]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`cf-mute ${i?"is-muted":""}`,onClick:()=>o(!i),"aria-pressed":i,"aria-label":i?"Unmute microphone":"Mute microphone",children:s.jsx(Xc,{name:i?"micOff":"mic"})}),s.jsxs("button",{className:"cf-end",onClick:()=>r?r():c(!0),children:[s.jsx(Xc,{name:"phone",size:16}),"End call"]})]})})]}),!N&&j&&(m?s.jsxs("aside",{className:"cf-offers-panel","aria-label":"Mentioned during this call",children:[s.jsxs("div",{className:"cf-offers-heading",children:[s.jsx("h3",{children:"Mentioned in this call"}),s.jsx("span",{children:w.length}),s.jsx("button",{onClick:()=>g(!1),"aria-label":"Collapse recommendations",children:s.jsx(Xc,{name:"chevronRight",size:16})})]}),s.jsx(gB,{products:w,large:!0})]}):s.jsxs("button",{className:"cf-offers-tab",onClick:()=>g(!0),"aria-label":`Show ${w.length} mentioned in this call`,"aria-expanded":!1,children:[s.jsx(Xc,{name:"chevronLeft",size:16}),w.slice(-2).map(T=>
430s.jsx("img",{src:`/welcome/beauty/assets/${T.image}`,alt:""},T.title)),s.jsx("span",{children:w.length})]})),N&&E&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"cf-offers-backdrop",onClick:()=>p(!1),"aria-label":"Back to the call"}),s.jsxs("div",{className:"cf-offers-sheet",role:"dialog","aria-modal":"false","aria-label":"Mentioned in this call",onKeyDown:T=>{T.key==="Escape"&&p(!1)},children:[s.jsx("button",{className:"cf-sheet-handle",onClick:()=>p(!1),"aria-label":"Close recommendations",children:s.jsx("span",{})}),s.jsxs("div",{className:"cf-offers-heading",children:[s.jsx("h3",{children:"Mentioned in this call"}),s.jsx("span",{children:w.length})]}),s.jsx(gB,{products:w})]})]})]})})}function mXe(){const e=B.useRef(null),t=B.useRef(null),[n,r]=B.useState(!1);return B.useEffect(()=>{const a=new IntersectionObserver(([c])=>r(c.isIntersecting&&c.intersectionRatio>=.4),{threshold:[0,.4],rootMargin:"-90px 0px 0px"});e.current&&a.observe(e.current);const i=t.current,o=()=>i.style.setProperty("--phone-scale",i.clientWidth/356);o();const l=new ResizeObserver(o);return l.observe(i),()=>{a.disconnect(),l.disconnect()}},[]),s.jsx("div",{className:"cf-showcase",children:s.jsx("div",{className:`cf-scene ${n?"cf-visible":""}`,ref:e,"aria-label":"Voice calls on laptop and phone",children:s.jsxs("div",{className:"cf-devices",children:[s.jsxs("div",{className:"cf-laptop",children:[s.jsx("div",{className:"cf-laptop-display",children:s.jsx(xB,{device:"laptop",active:n})}),s.jsx("img",{className:"cf-laptop-frame",src:"/welcome/assets/device-frames/macbook-pro-14-space-black.png",alt:"","aria-hidden":"true",draggable:"false"})]}),s.jsx("div",{className:"cf-phone",ref:t,children:s.jsxs("div",{className:"cf-phone-device",children:[s.jsx("span",{className:"cf-phone-side cf-phone-silent","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-volume-up","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-volume-down","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-power","aria-hidden":"true"}),s.jsxs("div",{className:"cf-phone-display",children:[s.jsx(xB,{device:"phone",active:n}),s.jsx("div",{className:"cf-phone-home","aria-hidden":"true",children:s.jsx("span",{})})]})]})})]})})})}const Bj=[{id:1,name:"Emily Parker",time:"12 min ago",status:"New",ready:"Ready to book",source:"Instagram",topic:"1:1 Virtual Makeup Lesson (45 min)",email:"[email protected]",summary:"Wants to book a virtual makeup lesson. Asked about available times, everyday looks and what to bring.",message:"Hi Mia, weâd love to book two makeup lessons. Can we send our preferred times?",question:"Iâd love to book a virtual makeup lesson.",answer:"A 1:1 Virtual Makeup Lesson is a great fit. Send a contact request and Mia can follow up with you.",offering:"1:1 Virtual Makeup Lesson (45 min)",price:"$65 · 45 minutes"},{id:2,name:"James Wilson",time:"38 min ago",status:"New",ready:"Exploring options",source:"YouTube",topic:"Everyday makeup",email:"[email protected]",summary:"Looking for an everyday makeup routine. Interested in Glowé Cloud Skin Tint and wants advice before choosing.",message:"Could you help me decide which everyday makeup products to try?",question:"What would you recommend for a quick everyday makeup look?",answer:"Glowé Cloud Skin Tint is $28 and Glowé Lip Butter is $16. Start with a few products you enjoy using.",offering:"Glowé Cloud Skin Tint",price:"$28 · Shop"},{id:3,name:"Sophie Bennett",time:"2 hours ago",status:"Contacted",ready:"Ready to book",source:"Profile page",topic:"Makeup bag declutter",email:"[email protected]",summary:"Sorting a makeup bag and looking for personal guidance on a selection of 12 products.",message:"Iâm sorting out my makeup bag. Could we look at what to keep together?",question:"Can Mia help me declutter my makeup bag?",answer:"Makeup Bag Declutter is $39. Bring what you own and Mia can help you decide what to keep, toss or replace.",offering:"Makeup Bag Declutter",price:"$39 · Personal session"},{id:4,name:"Alex Morgan",time:"8 days ago",status:"New",ready:"Ready to talk",source:"Instagram",topic:"Brand partnership",email:"[email protected]",summary:"A beauty brand is planning a product launch and wants to discu
430ss a UGC campaign.",message:"Weâre launching a new beauty collection. Are you available for a UGC campaign?",question:"Does Mia work with beauty brands?",answer:"Send a contact request with your campaign brief so Mia can discuss UGC, partnerships or an ambassadorship with you.",offering:"Campaigns, UGC & ambassadorships",price:"Work together"},{id:5,name:"Daniel Reed",time:"12 days ago",status:"Closed",ready:"Exploring options",source:"YouTube",topic:"Drugstore dupes",email:"[email protected]",summary:"Asked about drugstore dupes and explored the viral blush dupe and five-minute face cheat sheet.",message:"Thanks for the makeup recommendations. Iâve found an everyday routine to try.",question:"Is there a simple guide for a five-minute makeup routine?",answer:"My 5-Minute Face Cheat Sheet is free. You can also find the $8 dupe for the viral blush in Miaâs favourites.",offering:"My 5-Minute Face Cheat Sheet",price:"Free · Cheat sheet"}];function fXe({phase:e,onPause:t,onCapture:n,onPreviewNote:r}){const[a,i]=B.useState(!1),[o,l]=B.useState(null),[c,u]=B.useState("[email protected]"),[d,h]=B.useState(!0),[p,m]=B.useState(""),[g,x]=B.useState([]),[b,y]=B.useState(!0),[v,w]=B.useState(!1),j=B.useRef(null),E=B.useRef(null);B.useEffect(()=>{l(null),i(!1),e===0&&(u("[email protected]"),h(!0),m(""),x([]))},[e]);const S=o||(e===2?"form":e===3?"sent":"chat");B.useEffect(()=>{j.current&&j.current.scrollTo({top:j.current.scrollHeight,behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"})},[e,g]);const _=(T,I=20)=>{const $={menu:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),plus:s.jsx("path",{d:"M12 5v14M5 12h14"}),close:s.jsx("path",{d:"m6 6 12 12M6 18 18 6"}),check:s.jsx("path",{d:"m20 6-11 11-5-5"}),mail:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),s.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),up:s.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})};return s.jsx("svg",{width:I,height:I,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:T==="menu"?1.35:1.85,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:$[T]})},k=()=>{t(),i(!1),h(!1),l("form")},C=()=>{t(),l("chat")},N=()=>{p.trim()&&(t(),x(T=>[...T,{role:"user",text:p.trim()},{role:"ai",text:"To ask Mia about a lesson, use Contact in the menu to send your details and conversation."}]),m(""))},A=d&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c);return s.jsxs("aside",{ref:E,className:`lc-shell ${v?"lc-expanded":""}`,"aria-label":"Chat with Mia Bennett · demonstration",onPointerDownCapture:t,onFocusCapture:t,children:[s.jsxs("header",{className:"lc-header",inert:S!=="chat"?"":void 0,children:[s.jsx("img",{src:"/welcome/beauty/assets/expert.webp",alt:"Mia Bennett"}),s.jsxs("div",{className:"lc-name",children:[s.jsx("strong",{children:"Mia Bennett"}),s.jsxs("small",{children:["Powered by ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",children:"Great Experts"})]})]}),s.jsx("button",{className:"lc-icon",type:"button","aria-label":"Conversation menu","aria-expanded":a,onClick:()=>i(!a),children:_("menu",26)})]}),s.jsxs("div",{className:"lc-body",inert:S!=="chat"?"":void 0,children:[s.jsxs("div",{className:"lc-thread",ref:j,children:[s.jsx("div",{className:"lc-message lc-ai",children:"Omg hi! ð Skin drama? Makeup questions? Need a dupe? You came to the right chat - spill
430! ðµ"}),b&&e>=0&&s.jsx("div",{className:"lc-message lc-user",children:"Iâd love to book a virtual makeup lesson."}),b&&e>=1&&s.jsx("div",{className:"lc-message lc-ai",children:"A 1:1 Virtual Makeup Lesson is a great fit. Send a contact request and Mia can follow up with you."}),g.map((T,I)=>s.jsx("div",{className:`lc-message lc-${T.role}`,children:T.text},I))]}),s.jsx("div",{className:"lc-compose",children:s.jsxs("div",{className:"lc-composer",children:[s.jsx("button",{className:"lc-icon",type:"button","aria-label":"Attach files",onClick:()=>r("Attachments are available in the full product."),children:_("plus")}),s.jsx("textarea",{rows:"1","aria-label":"Demo message",placeholder:"Ask anything...",maxLength:"2000",value:p,onChange:T=>m(T.target.value),onKeyDown:T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),N())}}),p.trim()?s.jsx("button",{type:"button",className:"lc-send","aria-label":"Send demo message",onClick:N,children:_("up",18)}):s.jsxs("button",{type:"button",className:"lc-call","aria-label":"Start a voice call with this AI expert",onClick:()=>r("Voice calls are available in the full product."),children:[_("phone",17),"Call"]})]})}),a&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"lc-menu-scrim",type:"button","aria-label":"Close conversation menu",onClick:()=>i(!1)}),s.jsxs("aside",{className:"lc-menu","aria-label":"Conversations",children:[s.jsx("button",{className:"lc-menu-action",onClick:k,children:"Contact"}),s.jsx("button",{className:"lc-menu-action",onClick:()=>{w(!v),i(!1)},children:v?"Exit full screen":"Expand"}),s.jsx("h4",{children:"Conversations"}),s.jsxs("button",{className:"lc-menu-new",onClick:()=>{i(!1),y(!1),x([]),m("")},children:[_("plus",17),"New conversation"]}),s.jsx("button",{className:"lc-history-item",onClick:()=>{i(!1),y(!0)},children:"1:1 Virtual Makeup Lesson (45 min)"})]})]})]}),(S==="form"||S==="sent")&&s.jsxs("div",{className:"lc-modal-wrap",children:[s.jsx("button",{className:"lc-modal-shade",type:"button","aria-label":"Close contact request",onClick:C}),s.jsxs("section",{className:"lc-modal",role:"dialog","aria-label":S==="sent"?"Request sent":"Send a contact request",onKeyDown:T=>{T.key==="Escape"&&C()},children:[s.jsx("button",{className:"lc-modal-close","aria-label":"Close contact form",type:"button",onClick:C,children:_("close")}),S==="form"?s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"Send a contact request"}),s.jsxs("form",{onSubmit:T=>{T.preventDefault(),A&&(n(c),l("sent"))},children:[s.jsxs("label",{className:"lc-email",children:[_("mail",16),s.jsx("input",{"aria-label":"Contact request email",type:"email",autoComplete:"off",placeholder:"Email",value:c,onChange:T=>u(T.target.value),required:!0})]}),s.jsxs("label",{className:"lc-consent",children:[s.jsx("input",{type:"checkbox",checked:d,onChange:T=>h(T.target.checked)}),s.jsx("span",{className:"lc-check-box","aria-hidden":"true",children:_("check",14)}),s.jsxs("span",{children:["I am 18+ and agree to the ",s.jsx("a",{href:"https://greatexperts.ai/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"})," and ",s.jsx("a",{href:"https://greatexperts.ai/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),", and to share my contact details and conversation with Mia Bennett."]})]}),s.jsx("button",{className:"lc-contact-submit",type:"submit",disabled:!A,children:"Send a contact request"})]})]}):s.jsxs("div",{className:"lc-sent",children:[s.jsx("span",{className:"lc-sent-check",children:_("check")}),s.jsx("h3",{children:"Request sent"}),s.jsx("p",{children:"Thanks for reaching out. Mia will get back to you soon."}),s.jsxs("p",{className:"lc-reply-email",children:["The reply will go to ",s.jsx("strong",{children:c.trim()}),"."]}),s.jsx("div",{children:s.jsx("button",{type:"button",className:"lc-done",onClick:C,children:"Done"})})]})]})]})]})}const tre=["New","Contacted","Replied","Not replied","Booked a call","Not relevant"],gXe=[["1","Today"],["7","7 days"],["30","30 days"],["all","All time"]],rS=[["insights","Insights"],["conversations","Conversations"],["leads","Leads"]];function vi({name:e,size:t=16}){const n={search:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"10",cy:"10",r:"6"}),s.jsx("path",{d:"m15 15 5 5"})]}),download:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),chevron:s.jsx("path",{d:"m9 5 7 7-7 7"}),down:s.jsx("path",{d:"m6 9 6 6 6-6"}),spark:s.jsx("path",{d:"m12 3 2.5 6.5L21 12l-6.5 2.5L12 21l-2.5-6.5L3 12l6.5-2.5Z"}),mail:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),s.jsx("path",{d:"m3 7 9 6 9-6"})]}),clock:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 7v5l3 2"})]}
430),message:s.jsx("path",{d:"M21 11.5a8.4 8.4 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.4 8.4 0 0 1-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.4 8.4 0 0 1 3.8-.9h.5a8.5 8.5 0 0 1 8 8v.5Z"}),bot:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"4",y:"7",width:"16",height:"13",rx:"3"}),s.jsx("path",{d:"M12 3v4M9 12v2m6-2v2M2 12h2m16 0h2"})]}),source:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"m16 8-3 5-5 3 3-5Z"})]}),file:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),s.jsx("path",{d:"M14 2v6h6M8 13h8m-8 4h8"})]}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72l.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45l2.81.7A2 2 0 0 1 22 16.92z"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]||n.message})}function sre({value:e,onChange:t,label:n}){return s.jsxs("label",{className:"lp-search",children:[s.jsx(vi,{name:"search"}),s.jsx("input",{type:"search","aria-label":n,placeholder:n,value:e,onChange:r=>t(r.target.value)})]})}function xXe({value:e,onChange:t,options:n,label:r}){const[a,i]=B.useState(!1),o=B.useRef(null);return B.useEffect(()=>{if(!a)return;const l=c=>{o.current?.contains(c.target)||i(!1)};return document.addEventListener("pointerdown",l),()=>document.removeEventListener("pointerdown",l)},[a]),s.jsxs("div",{className:"lp-select",ref:o,onKeyDown:l=>{l.key==="Escape"&&i(!1)},children:[s.jsxs("button",{type:"button","aria-label":r,"aria-expanded":a,"aria-haspopup":"listbox",onClick:()=>i(!a),children:[n.find(l=>l[0]===e)?.[1],s.jsx(vi,{name:"down"})]}),a&&s.jsx("div",{className:"lp-options",role:"listbox","aria-label":r,children:n.map(([l,c])=>s.jsxs("button",{type:"button",role:"option","aria-selected":l===e,onClick:()=>{t(l),i(!1)},children:[c,l===e&&s.jsx("span",{children:"â"})]},l))})]})}function bXe({captured:e,selected:t,setSelected:n,query:r,setQuery:a,expert:i,setExpert:o}){const[l,c]=B.useState(!1),[u,d]=B.useState([]),[h,p]=B.useState(!1),m=Bj.filter(b=>`${b.question} ${b.summary} Mia Bennett`.toLowerCase().includes(r.toLowerCase())),g=m.find(b=>b.id===t)||m[0],x=g&&s.jsxs("article",{className:"lp-conversation-detail",children:[s.jsxs("header",{className:"lp-card-header",children:[s.jsxs("div",{children:[s.jsx("h4",{children:g.question}),s.jsxs("p",{children:["Mia Bennett · ",g.id===1?"Today":g.time]})]}),h&&s.jsx("button",{className:"lp-close","aria-label":"Close conversation",onClick:()=>p(!1),children:"Ã"})]}),s.jsxs("div",{className:"lp-card-body",children:[s.jsxs("dl",{className:"lp-chat-counts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Visitor messages"}),s.jsx("dd",{children:"2"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Total messages"}),s.jsx("dd",{children:"4"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Source"}),s.jsx("dd",{children:"Public profile"})]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Conversation summary"}),s.jsxs("div",{className:"lp-summary",children:[s.jsx(vi,{name:"spark"}),s.jsxs("div",{children:[s.jsx("p",{children:g.summary}),l&&s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:"Recommended offering"}),s.jsxs("p",{children:[g.offering,". ",g.id===1&&e?"The visitor shared their email and asked Mia to follow up.":"The visitor explored this recommendation with Mia Bennett."]})]})]}),s.jsx("button",{"aria-label":l?"Collapse summary":"Expand summary","aria-expanded":l,onClick:()=>c(!l),children:s.jsx(vi,{name:"down"})})]})]}),s.jsxs("section",{className:"lp-transcript",children:[s.jsx("span",{className:"lp-eyebrow",children:"Transcript"}),s.jsx("ol",{children:[{role:"Visitor",text:g.question},{role:"AI expert",text:g.answer},{role:"Visitor",text:g.message},{role:"AI expert",text:"You can send a contact request and Mia can follow up with you."}].map((b,y)=>s.jsxs("li",{className:b.role==="AI expert"?"is-assistant":"",children:[s.jsx("span",{children:b.role}),s.jsx("p",{children:b.text})]},y))})]})]})]});return s.jsxs("section",{className:"lp-view",children:[s.jsxs("div",{className:"lp-intro lp-conversation-intro",children:[s.jsxs("div",{children:[s.jsxs("h4",{children:["What your audience is ",s.jsx("em",{children:"asking"})]}),s.jsx("p",{children:"See what visitors asked and how your AI responded across every audience conversation."})]}),s.jsxs("div",{className:"lp-chat-filters",children:[s.jsx(sre,{label:"Search conversations",value:r,onChange:a}),s.jsx(xXe,{label:"Filter conversations by expert",value:i,onChange:o,options:[["all","All experts"],["mia","Mia Bennett"]]})]})]}),m.length?s.jsxs("div",{className:"lp-split",children:[s.jsxs("div",{className:"lp-card lp-list",children:[s.jsxs("div",{className:"lp-card-header",children:[s.jsx("strong",{children:"Chat inbox"}),s.jsxs("span",{children:[m.length," ",m.length===1?"conversation":"conversations"]})]}),m.map(b=>s.jsxs("button",{className:`lp-list-row ${g.id===b.id?"selected":""}`,"aria-current":g.id===b.id?"true":void 0,onClick:()=>{n(b.id),c(!1),d(y=>[...y,b.id]),window.matchMedia("(max-width: 960px)").matches&&p(!0)},children:[s.jsxs("span",{className:"lp-row-top",children:[s.jsx("strong",{children:b.question}),s.jsx("small",{children:b.id===1?"Just now":b.time})]}),s.jsxs("span",{className:"lp-row-meta",children:[s.jsxs("span",{children:[b.id!==g.id&&!u.includes(b.id)&&s.jsx("b",{className:"lp-new",children:"New"}),"Mia Bennett"]}),s.jsx("small",{children:"4 messages"}),s.jsx("i",{children:s.jsx(vi,{name:"chevron",size:14})})]})]},b.id))]}),s.jsx("div",{className:"lp-card lp-chat-desktop",children:x}),h&&s.jsx("div",{className:"lp-mobile-modal",role:"dialog","aria-label":"Conversation detail",children:x})]}):s.jsxs("div",{className:"lp-card lp-empty",children:[s.jsx("h4",{children:"No matching conversations"}),s.jsx("p",{children:"Try another search or expert."})]})]})}function bB({lead:e,onStatus:t,onNote:n}){const[r,a]=B.useState(!0),[i,o]=B.useState(e.note||""),[l,c]=B.useState(!1),[u,d]=B.useState(!1),h=(p,m,g)=>s.jsxs("div",{className:"lp-context-row",children:[s.jsx(vi,{name:p}),s.jsx("span",{children:m}),s.jsx("strong",{children:g})]});return s.jsxs("article",{className:"lp-card lp-lead-detail",children:[s.jsxs("header",{className:"lp-card-header",children:[s.jsxs("div",{children:[s.jsx("h4",{children:e.name}),s.jsx("small",{children:e.time})]}),s.jsx("span",{className:"lp-ready",children:e.id===1||e.id===3?"Ready now":"Exploring"}),s.jsx("select",{"aria-label":"Request status",value:e.status,onChange:p=>t(p.target.value),children:tre.map(p=>s.jsx("option",{children:p},p))})]}),s.jsxs("div",{className:"lp-card-body",children:[s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Request context"}),s.jsxs("div",{className:"lp-inset",children:[h("source","Source","Public profile"),h("bot","Expert","Mia Bennett"),s.jsxs("div",{className:"lp-context-row is-stack",children:[s.jsx(vi,{name:"file"}),s.jsxs("div",{children:[s.jsx("span",{children:"Summary"}),s.jsx("p",{children:e.summary})]})]}),h("clock","Received",e.time)]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Contact & details"}),s.jsxs("div",{className:"lp-inset",children:[s.jsxs("div",{className:"lp-context-row",children:[s.jsx(vi,{name:"mail"}),s.jsx("span",{children:"Email"}),s.jsx("strong",{children:e.email}),s.jsx("button",{className:"lp-text-button",onClick:async()=>{try{await navigator.clipboard.writeText(e.email),d(!0)}catch{d(!1)}},children:u?"Copied":"Copy"})]}),h("phone","Phone","Not shared"),s.jsxs("div",{className:"lp-context-row is-stack",children:[s.jsx(vi,{name:"message"}),s.jsxs("div",{children:[s.jsx("span",{children:"Message they left"}),s.jsx("p",{children:e.message})]})]}),s.jsxs("div",{className:"lp-context-row",children:[s.jsx(vi,{name:"message"}),s.jsx("span",{children:"Chat history"}),s.jsxs("button",{className:"lp-show-chat","aria-expanded":r,onClick:()=>a(!r),children:[r?"Hide":"Show",s.jsx(vi,{name:"down"})]})]}),r&&s.jsxs("div",{className:"lp-lead-transcript",children:[s.jsx("p",{children:e.question}),s.jsx("p",{children:e.answer})]})]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Internal note"}),s.jsxs("div",{className:"lp-inset lp-note",children:[s.jsx("textarea",{"aria-label":"Internal note",placeholder:"Only visible to you",value:i,onChange:p=>{o(p.target.value),c(!1)}}),s.jsxs("div",{children:[l&&s.jsx("span",{role:"status",children:"Note saved"}),s.jsx("button",{onClick:()=>{n(i),c(!0)},children:"Save"})]})]})]})]})]})}function hd({title:e,children:t,id:n}){return s.jsxs("section",{className:"lp-card lp-insight-card",id:n,children:[s.jsx("div",{className:"lp-card-header",children:s.jsx("strong",{children:e})}),s.jsx("div",{className:"lp-card-body",children:t})]})}function yXe({period:e,captured:t,newCount:n,onConversations:r,onLeads:a,onNewLeads:i}
430){const o=t?1:0,l=e==="1"?{c:11+o,p:9,v:47,l:o,r:6+o,k:3,voice:2}:e==="7"?{c:46+o,p:32,v:218,l:2+o,r:21+o,k:9,voice:8}:e==="all"?{c:342+o,p:228,v:1430,l:4+o,r:174+o,k:64,voice:57}:{c:184+o,p:126,v:842,l:4+o,r:86+o,k:31,voice:29},c=B.useRef(null),u=[["1:1 Virtual Makeup Lesson (45 min)",39,16,21],["Glowé Cloud Skin Tint",29,10,17],["Makeup Bag Declutter",19,5,12]],d=()=>c.current?.scrollIntoView({behavior:"smooth",block:"nearest"}),h=[["Conversations",l.c,s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lp-voice-bar",children:s.jsx("i",{style:{width:`${l.voice/l.c*100}%`}})}),"Voice ",l.voice," · Text ",l.c-l.voice]}),"conversations","View"],["People who chatted",l.p,`Different people · ${Math.round(l.p*.4)} not signed in`],["Profile visitors",l.v,"People who opened your profile page"],["Leads",l.l,"People who asked you to get in touch","leads","Open"],["Recommendations",l.r,"Times your AI suggested one of your offerings","breakdown","Breakdown"],["Offering clicks",l.k,`${Math.round(l.k/l.r*100)}% of recommendations led to a click`,"breakdown","Breakdown"]];return s.jsxs("section",{className:"lp-view",children:[s.jsx("div",{className:"lp-intro",children:s.jsxs("div",{children:[s.jsxs("h4",{children:["Find out what your audience ",s.jsx("em",{children:"actually wants"})]}),s.jsxs("p",{children:["Insights are ",s.jsx("strong",{children:"fully anonymous"}),". They show what people need, not who they are."]})]})}),s.jsx("div",{className:"lp-metrics",children:h.map(([p,m,g,x,b],y)=>{const v=x?"button":"div";return s.jsxs(v,{type:x?"button":void 0,className:`lp-metric ${y===0?"accent":""} ${y===1?"indigo-value":""}`,onClick:x?()=>{x==="breakdown"?d():x==="conversations"?r():x==="leads"&&a()}:void 0,"aria-label":x?`${p}, ${b}`:void 0,children:[s.jsx("span",{className:"lp-eyebrow",children:p}),s.jsx("strong",{children:m},m),s.jsxs("div",{children:[s.jsx("small",{children:g}),b&&s.jsxs("b",{children:[b," â"]})]})]},p)})}),s.jsxs("div",{className:"lp-card lp-next",children:[s.jsx("h5",{children:"What to do next"}),s.jsxs("button",{onClick:i,children:[s.jsxs("span",{children:[s.jsxs("strong",{children:[n," new requests waiting"]}),s.jsx("small",{children:"Reply while the conversation is still fresh."})]}),s.jsx("b",{children:"View new requests â"})]})]}),s.jsxs(hd,{title:"How conversations progress",children:[[["Conversations",l.c],["Kept talking (5+ messages)",Math.round(l.c*.63)],["Asked to connect",l.l]].map(([p,m],g)=>s.jsxs("div",{className:"lp-bar-row",children:[s.jsx("span",{children:p}),s.jsx("i",{children:s.jsx("b",{style:{width:`${Math.max(3,m/l.c*100)}%`}})}),s.jsx("strong",{children:m}),s.jsx("small",{children:g>0?`${Math.round(m/l.c*100)}%`:""})]},p)),s.jsxs("p",{className:"lp-foot",children:[s.jsxs("strong",{children:[Math.round(l.p*.18)," people came back"]})," for a second conversation in this period. Returning visitors are your warmest audience."]})]}),s.jsx("div",{ref:c,children:s.jsxs(hd,{title:"Your AI sales agent at work",children:[s.jsx("p",{className:"lp-foot",children:"What your AI recommended, and what people did about it."}),s.jsx("div",{className:"lp-ranking-grid",children:[["Most clicked",2],["Most recommended",1],["Most asked for",3]].map(([p,m])=>s.jsxs("div",{children:[s.jsx("h5",{children:p}),u.map((g,x)=>s.jsxs("div",{className:"lp-ranking",children:[s.jsxs("span",{children:["0",x+1]}),s.jsx("strong",{children:g[0]}),s.jsx("b",{children:e==="7"?Math.max(1,Math.round(g[m]/4)):e==="1"?Math.max(1,Math.round(g[m]/15)):e==="all"?g[m]*2:g[m]})]},g[0]))]},p))})]})}),s.jsx(hd,{title:"What people ask about",children:[["Makeup routines",68],["Everyday makeup",51],["Makeup lessons",39],["Drugstore dupes",26]].map(([p,m])=>s.jsxs("div",{className:"lp-bar-row",children:[s.jsx("span",{children:p}),s.jsx("i",{children:s.jsx("b",{style:{width:`${m/68*100}%`}})}),s.jsx("strong",{children:m})]},p))}),s.jsx("div",{className:"lp-two-up",children:[["Busiest days",["M","T","W","T","F","S","S"],[18,21,24,20,32,39,31]],["Busiest hours",["6am","9am","12pm","3pm","6pm","9pm"],[9,18,31,35,54,38]]].map(([p,m,g])=>s.jsx(hd,{title:p,children:s.jsx("div",{className:"lp-columns",children:m.map((x,b)=>s.jsxs("div",{children:[s.jsx("span",{children:Math.round(g[b]*l.c/185)}),s.jsx("i",{style:{height:`${g[b]*1.4}px`}}),s.jsx("small",{children:x})]},b))})},p))}),s.jsxs("div",{className:"lp-two-up",children:[s.jsx(hd,{title:"Your experts",children:s.jsxs("table",{className:"lp-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Expert"}),s.jsx("th",{children:"Chats"}),s.jsx("th",{children:"Requests"})]})}),s.jsx("tbody",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Mia Bennett"}),s.jsx("td",{children:l.c}),s.jsx("td",{children:l.l})]})})]})}),s.jsxs(hd,{title:"Knowledge gaps",children:[s.jsx("h5",{children:"Skin tint shade choices"}),s.jsx("p",{className:"lp-foot",children:"People asked for more detail about choosing a skin tint shade for their everyday rout
430ine."})]})]}),s.jsx(hd,{title:"Where people find you",children:s.jsxs("table",{className:"lp-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Source"}),s.jsx("th",{children:"Chats"}),s.jsx("th",{children:"Requests"})]})}),s.jsxs("tbody",{children:[s.jsxs("tr",{children:[s.jsx("th",{children:"Public profile"}),s.jsx("td",{children:Math.round(l.c*.8)}),s.jsx("td",{children:l.l})]}),s.jsxs("tr",{children:[s.jsx("th",{children:"Website embed"}),s.jsx("td",{children:l.c-Math.round(l.c*.8)}),s.jsx("td",{children:"0"})]})]})]})})]})}const yB=e=>(e?Bj:Bj.slice(1)).map(t=>({...t,status:t.status==="Closed"?"Replied":t.status,time:t.id===1?"Just now":t.time}));function vXe(){const[e,t]=B.useState("insights"),[n,r]=B.useState(()=>yB(!1)),[a,i]=B.useState(2),[o,l]=B.useState("All"),[c,u]=B.useState(""),[d,h]=B.useState("30"),[p,m]=B.useState(1),[g,x]=B.useState(""),[b,y]=B.useState("all"),[v,w]=B.useState(""),[j,E]=B.useState([]),[S,_]=B.useState(!1),[k,C]=B.useState("chat"),N=B.useRef(null),A=B.useRef(null),T=B.useRef({}),I=B.useRef(0),$=B.useRef(!1),O=B.useRef(!1),U=B.useRef(-1),[F,H]=B.useState(!1),[G,M]=B.useState(-1),z=G>=3,W=()=>{O.current=!0,H(!1)},D=B.useCallback(P=>{t(P),A.current&&(A.current.scrollTop=0)},[]),Z=B.useCallback((P,ee=!1)=>{const X=P<700?0:P<1500?1:P<2800?2:P<4800?3:4;X===U.current&&!ee||(U.current=X,M(X),(X===0||ee)&&(w(""),r(yB(X>=3)),i(X>=3?1:2),l("All"),u(""),x(""),y("all"),m(1),E([]),_(!1),C("chat"),D(X===3?"leads":"insights"),h("30")),X===3&&(r(ae=>ae.some(me=>me.id===1)?ae:[{...Bj[0],time:"Just now"},...ae]),i(1),D("leads"),w("Emily Parker shared her details. New lead added to your inbox.")),X===4&&(m(1),D("conversations")))},[D]);B.useEffect(()=>{const P=window.matchMedia("(prefers-reduced-motion: reduce)"),ee=new IntersectionObserver(([me])=>{$.current=me.isIntersecting&&me.intersectionRatio>=.5,$.current&&!O.current&&!P.matches&&(O.current=!0,Z(0,!0),H(!0))},{threshold:.5,rootMargin:"-88px 0px 0px"}),X=N.current?.querySelector(".lc-shell");X&&ee.observe(X);const ae=()=>{P.matches&&(O.current=!0,H(!1),I.current=2800,Z(2800,!0))};return ae(),P.addEventListener("change",ae),()=>{ee.disconnect(),P.removeEventListener("change",ae)}},[Z]),B.useEffect(()=>{if(!F)return;let P=performance.now();const ee=setInterval(()=>{const X=performance.now(),ae=Math.min(X-P,200);P=X,!(!$.current||document.hidden)&&(I.current=Math.min(I.current+ae,9e3),Z(I.current),I.current===9e3&&H(!1))},100);return()=>clearInterval(ee)},[F,Z]);const V=n.filter(P=>(o==="All"||P.status===o)&&`${P.name} ${P.topic} ${P.email}`.toLowerCase().includes(c.toLowerCase())),L=V.find(P=>P.id===a)||V[0],K=n.filter(P=>P.status==="New").length,te=P=>{r(ee=>ee.map(X=>X.id===L.id?{...X,status:P}:X)),w(`${L.name} marked ${P.toLowerCase()}.`)},Q=P=>r(ee=>ee.map(X=>X.id===L.id?{...X,note:P}:X)),Y=P=>{if(!["ArrowLeft","ArrowRight"].includes(P.key))return;P.preventDefault();const ee=rS.findIndex(ae=>ae[0]===e),X=rS[(ee+(P.key==="ArrowRight"?1:2))%3][0];D(X),T.current[X]?.focus()},J=P=>{P.target.closest(".ld-export")||(W(),C("dashboard"))};return s.jsx("div",{className:"ld-showcase",ref:N,children:s.jsxs("div",{className:"ld-stage",children:[s.jsx("div",{className:"ld-demo lp-product",style:{zIndex:k==="dashboard"?4:1},onPointerDownCapture:J,onFocusCapture:J,children:s.jsxs("div",{className:"ld-app",ref:A,children:[s.jsxs("header",{className:"ld-header",children:[s.jsxs("h3",{children:["Insights & ",s.jsx("em",{children:"Leads"})]}),s.jsxs("button",{type:"button",className:"ld-reset ld-export",children:[s.jsx(vi,{name:"download"}),e==="conversations"?"Export chats":"Export CSV"]})]}),s.jsxs("div",{className:"ld-toolbar",children:[s.jsx("div",{className:"ld-tabs",role:"tablist","aria-label":"Leads views",onKeyDown:Y,children:rS.map(([P,ee])=>s.jsxs("button",{type:"button",ref:X=>T.current[P]=X,role:"tab",id:`demo-tab-${P}`,"aria-controls":`demo-panel-${P}`,"aria-selected":e===P,tabIndex:e===P?0:-1,onClick:()=>D(P),children:[s.jsx("span",{className:"lp-full-label",children:ee}),s.jsx("span",{className:"lp-short-label",children:P==="conversations"?"Chats":ee}),P==="leads"&&K>0&&s.jsx("span",{className:"lp-tab-count",children:K})]},P))}),e==="insights"&&s.jsx("div",{className:"ld-filters",role:"group","aria-label":"Period",children:gXe.map(([P,ee])=>s.jsx("button",{"aria-pressed":d===P,onClick:()=>h(P),children:ee},P))}),e==="leads"&&s.jsx("div",{className:"ld-filters",role:"group","aria-label":"Filter by status",children:["All",...tre].map(P=>s.jsxs("button",{"aria-pressed":o===P,onClick:()=>l(P),children:[P,s.jsx("span",{children:P==="All"?n.length:n.filter(ee=>ee.status===P).length})]},P))})]}),s.jsxs("div",{role:"tabpanel",id:`demo-panel-${e}`,"aria-labelledby":`demo-tab-${e}`,children:[e==="insights"&&s.jsx(yXe,{period:d,captured:z,newCount:K,onConversations:()=>D("conversations"),onLeads:()=>{l("All"),u(""),D("leads")},onNewLeads:()=>{l("New"),u(""),D("leads")}}),e==="conversations"&&s.jsx(bXe,{captured:z,selected:p,setSelected:m,query:g,setQuery:x,expert:b,setExpert:y}),e==="leads"&&s.jsxs("section",{className:"lp-view",children:[s.jsxs("div",{className:"lp-intro",children:[s.jsxs("div",{children:[s.jsxs("h4",{children:["Someone is waiting for your ",s.jsx("em",{children:"reply"})]}),s.jsx("p",{children:"People who asked you to get in touch after talking with your AI Experts. You only see what they agreed to share."})]}),s.jsx(sre,{label:"Search leads",value:c,onChange:u})]}),s.jsxs("div",{className:"lp-split lp-leads-split",children:[s.jsxs("div",{className:"lp-card lp-list",children:[s.jsxs("div",{className:"lp-card-header",children:[s.jsx("strong",{children:"Inbox"}),s.jsxs("span",{children:[V.length," ",V.length===1?"lead":"leads"]})]}),V.map(P=>s.jsxs("button",{className:`lp-list-row ${P.id===L?.id?"selected":""} ${P.id===1&&z?"ld-arrived":""}`,"aria-current":P.id===L?.id?"true":void 0,onClick:()=>{i(P.id),E(ee=>[...ee,P.id]),window.matchMedia("(max-width: 960px)").matches&&_(!0)},children:[s.jsxs("span",{className:"lp-row-top",children:[s.jsx("strong",{children:P.name}),s.jsx("small",{children:P.time})]}),s.jsxs("span",{className:"lp-row-meta",children:[(P.status!=="New"||!(j.includes(P.id)||P.id===L?.id))&&s.jsx("b",{className:`lp-status lp-${P.status.toLowerCase().replaceAll(" ","-")}`,children:P.status}),s.jsx("span",{children:"Expert: Mia Bennett"}),s.jsx("i",{children:s.jsx(vi,{name:"chevron",size:14})})]})]},P.id)),!V.length&&s.jsx("div",{className:"lp-empty",children:"No requests with this status."})]}),s.jsx("div",{className:"lp-lead-desktop",children:L&&s.jsx(bB,{lead:L,onStatus:te,onNote:Q},L.id)})]}),S&&L&&s.jsxs("div",{className:"lp-mobile-modal",role:"dialog","aria-label":"Lead detail",children:[s.jsx("button",{className:"lp-close","aria-label":"Close request",onClick:()=>_(!1),children:"Ã"}),s.jsx(bB,{lead:L,onStatus:te,onNote:Q},L.id)]})]})]}),s.jsx("div",{className:"ld-sr",role:"status","aria-live":"polite",children:v})]})}),s.jsx(fXe,{phase:G,onPause:()=>{W(),C("chat")},onPreviewNote:w,onCapture:P=>{W(),I.current=2800,Z(2800,!0),r(ee=>ee.map(X=>X.id===1?{...X,email:P}:X))}})]})})}function wXe(){return s.jsxs("article",{className:"ge-feature-row lf-feature",children:[s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["More interest. ",s.jsx("em",{children:"More leads."})]}),s.jsx("p",{children:"See what your audience asks about. Capture contact details and turn conversations into your next opportunity."}),s.jsxs("a",{href:"#create-profile",children:["Start capturing leads ",s.jsx("svg",{width:"19",height:"19",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})})]})]}),s.jsx(vXe,{})]})}const jXe=[{name:"Mia Bennett",initials:"MB",avatar:"/welcome/beauty/assets/expert.webp",earned:1599.65,subscribers:6,mrr:89.94,rating:94},{name:"Marcus Webb",initials:"MW",avatar:"/welcome/assets/creator/marcus-natural.jpg",avatarClass:"ef-avatar-candid",earned:1056.8,subscribers:4,mrr:59.96,rating:90},{name:"Sofia Reyes",initials:"SR",avatar:"/welcome/assets/creator/sofia-natural.jpg",earned:765.76,subscribers:2,mrr:29.98,rating:92}],ql=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e),vf=1499,nre=vf-Math.round(vf*.3),vB=300,wB=850,jB=1550,_Xe=1900,e5=3100,kXe=3650,aS=3650,_B=4200,t5=5800,dv=7500,NXe="Pick a light base, a lip colour you love and one eye product. Keep them together so your morning routine feels quick and easy.";function EXe(e){const[t,n]=B.useState(0),r=B.useRef(0);return B.useEffect(()=>{const o=window.matchMedia("(prefers-reduced-motion: reduce)");let l=!1,c=null,u=null;const d=g=>{r.current=g,n(g)},h=g=>{if(c=null,!l||document.hidden||r.current>=dv){u=null;return}u!==null&&d(Math.min(dv,r.current+g-u)),u=g,c=requestAnimationFrame(h)},p=()=>
430{if(c!==null&&cancelAnimationFrame(c),c=null,u=null,o.matches){d(dv);return}l&&!document.hidden&&r.current<dv&&(c=requestAnimationFrame(h))},m=new IntersectionObserver(([g])=>{l=g.isIntersecting&&g.intersectionRatio>=.45,p()},{threshold:[0,.45],rootMargin:"-90px 0px 0px 0px"});return m.observe(e.current),document.addEventListener("visibilitychange",p),o.addEventListener("change",p),p(),()=>{m.disconnect(),c!==null&&cancelAnimationFrame(c),document.removeEventListener("visibilitychange",p),o.removeEventListener("change",p)}},[e]),[t,()=>{r.current=Math.max(r.current,e5),n(r.current)},()=>{r.current=Math.max(r.current,t5),n(r.current)}]}function bo({name:e,size:t=18}){const n={arrow:s.jsx("path",{d:"M4 12h16m-6-6 6 6-6 6"}),download:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M12 3v12m-5-5 5 5 5-5M4 15v5h16v-5"})}),check:s.jsx("path",{d:"m5 12 4 4L19 6"}),plus:s.jsx("path",{d:"M12 5v14M5 12h14"}),up:s.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),menu:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"}),loader:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M12 3a9 9 0 1 1-9 9"})}),sparkles:s.jsx(s.Fragment,{children:s.jsx("path",{d:"m12 3 2.7 6.3L21 12l-6.3 2.7L12 21l-2.7-6.3L3 12l6.3-2.7L12 3Z"})}),thumb:s.jsx("path",{d:"M7 10v11H3V10h4Zm0 0 5-8a3 3 0 0 1 2 4l-1 4h6a2 2 0 0 1 2 2l-2 7a2 2 0 0 1-2 2H7"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]})}function pd({label:e,value:t,note:n,accent:r=!1,small:a=!1,credited:i=!1}){return s.jsxs("div",{className:`ef-stat ef-surface ${r?"ef-stat-accent":""} ${a?"ef-stat-small":""} ${i?"ef-stat-credited":""}`,children:[s.jsx("span",{className:"ef-eyebrow",children:e}),s.jsx("strong",{children:t}),s.jsx("span",{className:"ef-stat-note",children:i?s.jsxs("span",{className:"ef-credit-note",children:[s.jsx(bo,{name:"check",size:12}),"+",ql(nre/100)," added"]}):n})]})}function SXe({elapsed:e}){const[t,n]=B.useState({key:"earned",dir:-1}),r=e>=aS,a=Math.max(0,Math.min(1,(e-aS)/(_B-aS))),i=Math.round(nre*(1-Math.pow(1-a,3))),o=(342221+i)/100,l=jXe.map((h,p)=>p===0?{...h,earned:(159965+i)/100,subscribers:h.subscribers+Number(r),mrr:(8994+(r?vf:0))/100}:h).sort((h,p)=>t.dir*(t.key==="name"?h.name.localeCompare(p.name):h[t.key]-p[t.key])),c=[["name","By expert"],["earned","Earned"],["subscribers","Subscriptions"],["mrr","MRR"],["rating","Rating"]],u=[0,0,120,480,890,o].map((h,p)=>({value:h,label:new Date(new Date().getFullYear(),new Date().getMonth()-5+p,1).toLocaleString("en-US",{month:"short"})})),d=h=>n(p=>({key:h,dir:p.key===h?-p.dir:h==="name"?1:-1}));return s.jsxs("div",{className:"ef-dashboard",role:"group","aria-label":"Earnings dashboard preview",children:[s.jsxs("header",{className:"ef-dashboard-header ef-surface",children:[s.jsxs("h3",{children:["Your ",s.jsx("em",{children:"earnings"})]}),s.jsxs("div",{className:"ef-dashboard-actions",children:[s.jsxs("button",{type:"button",className:"ef-export","aria-label":"Export sample earnings CSV",onClick:()=>{},children:[s.jsx(bo,{name:"download",size:16}),"Export CSV"]}),s.jsx("button",{type:"button",className:"ef-payout",disabled:!0,title:"Payouts are available in your creator dashboard",children:"Request payout"})]})]}),s.jsx("p",{className:"ef-sample",children:"Sample data · This month"}),s.jsxs("div",{className:"ef-stats",children:[s.jsx(pd,{label:"Pending payout",value:ql(o),note:"Payout from $50.00",accent:!0,credited:r}),s.jsx(pd,{label:"Total earned",value:ql(o),note:"Your 70% share, after fees"}),s.jsx(pd,{label:"Active subscribers",value:r?"13":"12",note:`${r?5:4} new, 1 cancelled`}),s.jsx(pd,{label:"Subscriptions total",value:ql((488887+(r?vf:0))/100),note:"What subscribers paid. You keep 70%"})]}),s.jsx("div",{className:"ef-table-wrap ef-surface",children:s.jsxs("table",{children:[s.jsx("caption",{className:"ef-sr-only",children:"Earnings, subscriptions and rating for each of your experts"}),s.jsx("thead",{children:s.jsx("tr",{children:c.map(([h,p])=>s.jsx("th",{scope:"col","aria-sort":t.key===h?t.dir===1?"ascending":"descending":"none",children:s.jsxs("button",{type:"button",onClick:()=>d(h),children:[p,s.jsx("span",{"aria-hidden":"true",children:t.key===h?t.dir===1?"â":"â":""})]})},h))})}),s.jsx("tbody",{children:l.map(h=>s.jsxs("tr",{children:[s.jsx("th",{scope:"row",children:s.jsxs("span",{className:"ef-expert",children:[s.jsx("span",{className:"ef-avatar","aria-hidden":"true",children:h.avatar?s.jsx("img",{src:h.avatar,alt:"",className:h.avatarClass}):h.initials}),h.name]})}),s.jsx("td",{children:ql(h.earned)}),s.jsx("td",{children:h.subscribers}),s.jsx("td",{children:ql(h.mrr)}
430),s.jsx("td",{children:s.jsxs("span",{className:"ef-rating",children:[s.jsx(bo,{name:"thumb",size:13}),h.rating,"%"]})})]},h.name))})]})}),s.jsxs("div",{className:"ef-history",children:[s.jsxs("div",{className:"ef-months ef-surface",children:[s.jsx("h4",{className:"ef-eyebrow",children:"Last 6 months"}),u.map((h,p)=>s.jsxs("div",{className:`ef-month ${p===5?"ef-current":""}`,children:[s.jsx("span",{children:h.label}),s.jsx("span",{className:"ef-bar",children:s.jsx("i",{style:{width:h.value?`${Math.max(5,h.value/o*100)}%`:"0%"}})}),s.jsx("strong",{children:ql(h.value)})]},h.label))]}),s.jsxs("div",{className:"ef-feedback ef-surface",children:[s.jsx("h4",{className:"ef-eyebrow",children:"Answer feedback"}),s.jsx("div",{className:"ef-ring",role:"img","aria-label":"92% of 142 rated answers were helpful",children:s.jsxs("span",{children:[s.jsx(bo,{name:"thumb",size:17}),s.jsx("strong",{children:"92%"})]})}),s.jsx("p",{children:"From 142 rated answers"})]})]}),s.jsxs("div",{className:"ef-activity",children:[s.jsx(pd,{small:!0,label:"Questions answered",value:"487",note:"In the selected period"}),s.jsx(pd,{small:!0,label:"Active experts",value:"3",note:"Published and answering"}),s.jsx(pd,{small:!0,label:"Drafts",value:"1",note:"Not published yet"})]}),s.jsx("span",{className:"ef-sr-only",role:"status","aria-live":"polite",children:e>=_B?"Mia Bennett received a subscription payment. $10.49 added to earnings. Pending payout is now $3,432.70.":""})]})}function CXe({elapsed:e,onSubscribe:t,onContinue:n}){const r=e>=kXe,a=e>=_Xe&&!r,i=e>=e5&&!r,o=e>=t5,l=e>=e5&&!o,c=o?NXe.split(" ").slice(0,Math.max(1,Math.floor((e-t5)/48))).join(" "):"",u=B.useRef(null),d=B.useRef(!0),h=B.useRef(null),p=B.useRef(!1),m=()=>{p.current=!0,t()};B.useEffect(()=>{p.current&&(l?h.current?.focus({preventScroll:!0}):(u.current?.closest(".ef-subscription").querySelector("textarea")?.focus({preventScroll:!0}),p.current=!1))},[l]);const g=e>=vB,x=e>=wB,b=e>=jB;return B.useEffect(()=>{const y=u.current;d.current&&(y.scrollTop=y.scrollHeight)},[g,x,b,r,c]),s.jsxs("section",{className:`ef-subscription ${a?"ef-chat-gated":""} ${r?"ef-payment-paid":""}`,"aria-label":"Paid expert conversation preview",children:[s.jsxs("div",{className:"ef-chat-content",inert:l?"":void 0,children:[s.jsxs("header",{className:"ef-chat-header",children:[s.jsx("img",{className:"ef-chat-avatar",src:"/welcome/beauty/assets/expert.webp",alt:"Mia Bennett"}),s.jsxs("div",{children:[s.jsx("strong",{children:"Mia Bennett"}),s.jsxs("span",{children:["Powered by ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",children:"Great Experts"})]})]}),s.jsx("span",{className:"ef-chat-menu","aria-hidden":"true",children:s.jsx(bo,{name:"menu",size:26})})]}),s.jsxs("div",{className:"ef-chat-thread",ref:u,onScroll:y=>{const v=y.currentTarget;d.current=v.scrollHeight-v.scrollTop-v.clientHeight<40},"aria-label":"Example conversation",children:[s.jsx("div",{className:"ef-chat-message ef-chat-assistant",children:"Omg hi! ð Skin drama? Makeup questions? Need a dupe? You came to the right chat - spill
430! ðµ"}),e>=vB&&s.jsx("div",{className:"ef-chat-message ef-chat-user",children:"How can I make my everyday makeup routine quicker?"}),e>=wB&&s.jsx("div",{className:"ef-chat-message ef-chat-assistant",children:"Start with a few favourite products and a simple look. You do not need a long routine to feel put together."}),e>=jB&&s.jsx("div",{className:"ef-chat-message ef-chat-user",children:"Which products should I start with?"}),o&&s.jsx("div",{className:"ef-chat-message ef-chat-assistant ef-chat-continued","aria-label":"Answer after subscribing",children:c})]}),s.jsx("div",{className:"ef-chat-input-area",children:a?s.jsxs("div",{className:"ef-chat-paywall",role:"status",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Free messages used."})," ",ql(vf/100),"/mo to keep chatting."]}),s.jsxs("button",{type:"button",className:"ef-subscribe",onClick:m,disabled:i,"aria-label":i?"Redirecting to subscription checkout":"Preview a paid subscription",children:[i&&s.jsx(bo,{name:"loader",size:12})," ",i?"Redirectingâ¦":"Subscribe"]})]}):s.jsxs("div",{className:"ef-chat-composer",children:[s.jsx("span",{"aria-hidden":"true",children:s.jsx(bo,{name:"plus",size:20})}),s.jsx("textarea",{rows:"1",readOnly:!0,"aria-label":"Example message",placeholder:"Ask anything..."}),s.jsxs("span",{className:"ef-chat-call","aria-hidden":"true",children:[s.jsx(bo,{name:"phone",size:17}),"Call"]})]})}),s.jsx("footer",{className:"ef-chat-footer",children:s.jsxs("p",{children:["AI Chat. Messages and AI replies may be reviewed by this expertâs owner for audience insights. Donât share sensitive personal information. ",s.jsx("a",{href:"https://greatexperts.ai/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})," · ",s.jsx("a",{href:"https://greatexperts.ai/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"})]})})]}),l&&s.jsx("div",{className:"ef-confirmation-overlay",children:s.jsxs("section",{ref:h,tabIndex:-1,className:"ef-confirmation",role:"dialog","aria-label":"Subscription confirmation preview",onKeyDown:y=>{y.key==="Escape"&&r&&n()},children:[s.jsx("span",{className:`ef-confirmation-icon ${r?"is-paid":""}`,children:s.jsx(bo,{name:r?"check":"loader",size:26})}),s.jsx("span",{className:"ef-confirmation-label",children:r?"Subscription active":"Confirming subscription"}),s.jsx("h3",{children:r?"Youâre subscribed":"Almost there"}),s.jsx("p",{children:r?"You now have unlimited 1-on-1 chat with Mia Bennett for the next 30 days.":"Confirming your subscription to Mia Bennett."}),s.jsxs("div",{className:"ef-confirmation-payment",children:[s.jsxs("span",{children:["Monthly subscription",s.jsx("strong",{children:ql(vf/100)})]}),s.jsx("b",{children:r?"Paid":"Processingâ¦"})]}),s.jsx("p",{className:"ef-confirmation-renewal",children:"Renews monthly until you cancel."}),s.jsxs("button",{type:"button",onClick:n,disabled:!r,children:["Continue chatting ",s.jsx(bo,{name:"arrow",size:16})]})]})}),s.jsx("span",{className:"ef-sr-only",role:"status","aria-live":"polite",children:r?"Your subscription to Mia Bennett is active. You can continue chatting.":""})]})}function TXe(){const e=B.useRef(null),t=B.useRef(null),n=B.useRef(null),[r,a]=B.useState("payment"),[i,o,l]=EXe(t);return B.useEffect(()=>{const c=e.current,u=()=>{c.style.setProperty("--ef-dashboard-scale",Math.min(c.clientWidth*.9/1040,c.clientHeight*.86/940)),c.style.setProperty("--ef-payment-scale",c.clientWidth*.38/440)};u();const d=new ResizeObserver(u);return d.observe(c),()=>d.disconnect()},[]),s.jsxs("div",{className:"ge-feature-row ef-feature",children:[s.jsxs("div",{className:"ef-scene",ref:e,children:[s.jsx("div",{ref:n,className:`ef-dashboard-window ${r==="dashboard"?"ef-front":""}`,onPointerDown:()=>a("dashboard"),onFocusCapture:()=>
430a("dashboard"),children:s.jsx(SXe,{elapsed:i})}),s.jsx("div",{ref:t,className:`ef-payment-window ${r==="payment"?"ef-front":""}`,onPointerDown:()=>a("payment"),onFocusCapture:()=>a("payment"),children:s.jsx(CXe,{elapsed:i,onSubscribe:o,onContinue:l})})]}),s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["Earn from ",s.jsx("em",{children:"your expertise."})]}),s.jsx("p",{children:"Offer paid access to your AI expert. Track subscriptions and earnings in one place."}),s.jsxs("a",{href:"#create-profile",children:["Start earning ",s.jsx(bo,{name:"arrow",size:18})]})]})]})}function AXe(){return s.jsx($k,{src:"/welcome/beauty/product-profile/index.html",title:"Customize Mia Bennettâs page in the Great Experts editor"})}function RXe(){return s.jsx(Fk,{src:"/welcome/beauty/product-profile/knowledge.html"})}const IXe={CallsFeature:mXe,LeadsFeature:wXe,EarningsFeature:TXe,ProfileFeature:AXe,KnowledgeFeature:RXe};function PXe(){return s.jsx(Bk,{canonicalPath:"/beauty",heroProfileSrc:"/welcome/beauty/HeroPhone.html?autoscroll=true",features:IXe,pageClassName:"beauty-landing"})}const zn={name:"Max Carter",first:"Max",avatar:"/youtubers/max/avatar.webp",link:"greatexperts.ai/fun"};function LXe({name:e=`${zn.first}'s AI`,avatar:t=zn.avatar}){return s.jsxs("div",{className:"ytm-head",children:[s.jsx("span",{className:"ytm-avatar",children:s.jsx("img",{src:t,alt:"",width:"44",height:"44",loading:"lazy"})}),s.jsxs("span",{className:"ytm-id",children:[s.jsx("strong",{children:e}),s.jsxs("span",{children:["Powered by ",s.jsx("u",{children:"Great Experts"})]})]}),s.jsxs("span",{className:"ytm-contact",children:[s.jsx(Ms,{size:14,fill:"currentColor","aria-hidden":"true"}),"Contact"]}),s.jsx("span",{className:"ytm-icon",children:s.jsx(xl,{size:18,"aria-hidden":"true"})})]})}function OXe({typed:e="",call:t=!0,legal:n=!0}){return s.jsxs("div",{className:"ytm-foot",children:[s.jsxs("div",{className:"ytm-composer",children:[s.jsx("span",{className:"ytm-plus",children:s.jsx(Es,{size:18,"aria-hidden":"true"})}),s.jsx("span",{className:`ytm-placeholder${e?" is-typed":""}`,children:e||"Ask anything..."}),t&&s.jsxs("span",{className:"ytm-call",children:[s.jsx(Ts,{size:15,"aria-hidden":"true"}),"Call"]}),s.jsx("span",{className:"ytm-send",children:s.jsx(rl,{size:17,"aria-hidden":"true"})})]}),n&&s.jsxs("p",{className:"ytm-legal",children:["AI chat. Answers come from what ",zn.first," has shared."]})]})}const Og={title:"I Said YES to Everything for 24 Hours",thumb:"/youtubers/max/yes-24-hours.webp",length:1104},Op=[{chip:"The hoodie",q:"Where can I get the hoodie you wore?",a:"It is my own Friday Club hoodie. Heavy cotton, oversized fit, and it just restocked.",at:1010,chapter:"Friday Club drop",product:{name:"Friday Club Hoodie",price:"$97",img:"/youtubers/max/hoodie.webp"}},{chip:"Scariest dare",q:"What was the scariest dare in the yes video?",a:"The skydive, easily. I said yes before I saw how small the plane was, and my hands did not stop shaking until we landed.",at:94,chapter:"The skydive"},{chip:"The wedding",q:"How did you end up at a wedding?",a:"A viewer dared me to crash one. Turns out the couple were subscribers, so they let me stay for the cake and the first dance.",at:425,chapter:"Crashing a wedding"},{chip:"Ever say no?",q:"Did you ever say no?",a:"Once, sort of. Someone asked me to shave my eyebrows. I kept the rule and shaved one. You can see the regret on my face.",at:790,chapter:"The eyebrow dare"}],hv=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`,kB=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function MXe(){const[e,t]=f.useState(0),[n,r]=f.useState(0),[a,i]=f.useState(0),[o,l]=f.useState(0),[c,u]=f.useState(!1),[d,h]=f.useState(0),[p,m]=f.useState(!0),g=f.useRef(null),x=Op[e],b=x.a.split(" "),y=c||!p;function v(S,_=!1){t(S),i(_?Op[S].q.length:0),l(_?Op[S].a.split(" ").length:0),r(_?3:0)}f.useEffect(()=>{const S=g.current;if(!S||typeof IntersectionObserver>"u")return;const _=new IntersectionObserver(([k])=>m(k.isIntersecting),{threshold:.2});return _.observe(S),()=>_.disconnect()},[]),f.useEffect(()=>{if(y)return;const S=kB(),_=C=>S?0:C;let k;return n===0?k=S?setTimeout(()=>{i(x.q.length),r(1)},0):a<x.q.length?setTimeout(()=>i(a+1),32):setTimeout(()=>r(1),450):n===1?k=setTimeout(()=>r(2),_(900)):n===2?k=S?setTimeout(()=>{l(b.length),r(3)},0):o<b.length?setTimeout(()=>l(o+1),55):setTimeout(()=>r(3),250):S||(k=setTimeout(()=>v((e+1)%Op.length),5200)),()=>clearTimeout(k)});const w=n===3,E={"--p":`${w?x.at/Og.length*100:0}%`};return s.jsxs("div",{ref:g,className:"ytd",children:[s.jsxs("div",{className:"ytd-stage",children:[s.jsxs("figure",{className:"ytd-player","aria-hidden":"true",children:[s.jsxs("div",{className:"ytd-screen",children:[s.jsx("img",{src:Og.thumb,alt:"",width:"640",height:"360",fetchPriority:"high"}),s.jsxs("span",{className:`ytd-chapter${w?" is-on":""}`,children:[s.jsx("b",{children:hv(x.at)}),x.chapter]},`${e}-${d}-${w}`),s.jsx("span",{className:`ytd-big-play${w?" is-playing":""}
430`,children:s.jsx(Tr,{size:22,fill:"currentColor"})}),s.jsxs("div",{className:"ytd-controls",children:[s.jsxs("div",{className:"ytd-bar",style:E,children:[Op.map(S=>s.jsx("i",{style:{left:`${S.at/Og.length*100}%`}},S.at)),w&&s.jsxs("span",{className:"ytd-seek",children:[s.jsx("span",{className:"ytd-fill"}),s.jsx("span",{className:"ytd-knob"})]},`${e}-${d}`)]}),s.jsxs("div",{className:"ytd-time",children:[s.jsx(Tr,{size:13,fill:"currentColor"}),s.jsxs("span",{children:[w?hv(x.at):"0:00"," / ",hv(Og.length)]})]})]})]}),s.jsxs("figcaption",{children:[s.jsx("img",{src:zn.avatar,alt:"",width:"36",height:"36"}),s.jsxs("span",{children:[s.jsx("strong",{children:Og.title}),zn.name]})]})]}),s.jsxs("div",{className:"ytm-chat ytd-chat",role:"region","aria-label":`Sample chat with ${zn.first}'s AI`,children:[s.jsx(LXe,{}),s.jsxs("div",{className:"ytm-body ytd-body","aria-live":"polite",children:[n===0&&s.jsxs("p",{className:"ytm-ai ytd-in",children:["Hi, Iâm ",zn.first,"âs AI. Ask about any of ",zn.first,"âs videos and Iâll point you to the right moment."]}),n>=1&&s.jsx("p",{className:"ytm-user ytd-in",children:x.q}),n===1&&s.jsxs("span",{className:"ytm-ai ytm-typing ytd-in","aria-label":"Typing",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}),n>=2&&s.jsxs("div",{className:"ytm-ai ytd-in",children:[s.jsx("p",{children:b.slice(0,o).join(" ")}),w&&s.jsx("p",{className:"ytd-in",children:s.jsxs("button",{type:"button",className:"ytm-watch",onClick:()=>h(d+1),children:["Watch at ",hv(x.at)]})}),w&&x.product&&s.jsxs("span",{className:"ytd-offer ytd-in","aria-label":`${x.product.name}, ${x.product.price}`,children:[s.jsx("img",{src:x.product.img,alt:"",width:"48",height:"48",loading:"lazy"}),s.jsxs("span",{children:[s.jsx("strong",{children:x.product.name}),s.jsx("em",{children:x.product.price})]}),s.jsx("b",{children:"Buy"})]})]})]}),s.jsx(OXe,{typed:n===0?x.q.slice(0,a):"",legal:!1})]})]}),s.jsxs("div",{className:"ytd-controlsbar",children:[s.jsx("div",{className:"ytd-chips",role:"group","aria-label":"Try a sample question",children:Op.map((S,_)=>s.jsx("button",{type:"button","aria-pressed":_===e,onClick:()=>v(_,kB()),children:S.chip},S.at))}),s.jsx("button",{type:"button",className:"ytd-pause",onClick:()=>u(!c),"aria-label":c?"Play the demo":"Pause the demo",children:c?s.jsx(Tr,{size:15,fill:"currentColor","aria-hidden":"true"}):s.jsx(Lf,{size:15,fill:"currentColor","aria-hidden":"true"})})]})]})}const pv=[{id:"bio",label:"Link in bio",title:"One link for everything you share",body:"Your page lives at greatexperts.ai/yourname. Drop it anywhere a link fits and your viewers land on your AI.",points:["Put it in your channel bio, video descriptions and pinned comments.","Viewers can ask a question, call your AI, watch your videos and shop your gear in one place.","No website needed. Your page is ready the moment your AI is."]},{id:"site",label:"Embed on your website",title:"Answers right on your own site",body:"Already have a site? Add your AI as a floating bubble or inline in your page, so visitors get answers without leaving.",points:["Two lines of code. Paste them into any page.","Works with any site builder that lets you add code.","Answers point to the exact moment in your videos."]}];function DXe({driven:e}){const t=f.useRef(null),[n,r]=f.useState(!1);f.useEffect(()=>{const i=o=>{t.current?.contains(o.target)||r(!1)};return document.addEventListener("pointerdown",i),()=>document.removeEventListener("pointerdown",i)},[]);const a=e?{}:{tabIndex:0,onClick:()=>r(!0),onFocus:()=>r(!0),onBlur:()=>r(!1)};return s.jsxs("div",{ref:t,className:`yts-phone${n?" is-active":""}`,children:[s.jsx("div",{className:"yts-screen",role:"region","aria-label":`${zn.name}'s Great Experts profile`,...a,children:s.jsx("img",{src:"/youtubers/max/profile.webp",width:"420",height:"3518",loading:"lazy",alt:`${zn.name}'s profile page: his photo, a chat with his AI, merch, a live tour, videos, shoutouts and brand deals.`})}),!n&&s.jsx("span",{className:"yts-phone-hint","aria-hidden":"true",children:e?"Keep scrolling to explore":"Click to scroll the profile"})]})}function NB({driven:e}){return s.jsxs("div",{className:"yts-stage yts-stage-bio",children:[s.jsxs("div",{className:"yts-ytcard","aria-hidden":"true",children:[s.jsx("span",{className:"yts-ytlogo",children:s.jsx(z4,{size:16})}),s.jsxs("span",{className:"yts-ytcard-text",children:[s.jsx("strong",{children:"Links"}),s.jsx("span",{children:zn.link})]})]}),s.jsx(DXe,{driven:e})]})}const $Xe=[["Early access to every Friday video","Weekly"],["Members only live Q&A","Monthly"],["Vote on the next challenge","Always"]];function EB({driven:e}){const[t,n]=f.useState(!0),[r,a]=f.useState(0);return s.jsx("div",{className:"yts-stage yts-stage-site",children:s.jsxs("div",{className:"yts-frame",children:[s.jsxs("div",{className:"yts-bar","aria-hidden":"true",children:[s.jsxs("span",{className:"yts-dots",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("span",{className:"yts-address",children:[s.jsx(Zi,{size:12}),"maxcarter.tv/club"]})]}),s.jsx("div",{className:"yts-browser",children:s.jsxs("div",{className:"yts-page",children:[s.jsxs("div",{className:"yts-sitenav","aria-hidden":"true",children:[s.jsx("strong",{children:zn.name}),s.jsx("span",{children:"Videos"}),s.jsx("span",{children:"Tour"}),s.jsx("span",{children:"Shop"}),s.jsx("b",{className:"yts-shimmer"})]}),s.jsxs("div",{className:"yts-site-grid","aria-hidden":"true",children:[s.jsxs("div",{className:"yts-course",children:[s.jsx("span",{className:"yts-course-kicker",children:"Membership"}),s.jsx("h4",{children:"Join the Friday Club"}),s.jsxs("span",{className:"yts-course-meta",children:[s.jsx("span",{children:"Early videos"}),s.jsx("span",{children:"Live Q&A"}),s.jsx("span",{children:"Cancel anytime"})]}),s.jsx("i",{className:"yts-shimmer"}),s.jsx("i",{className:"yts-shimmer"}),s.jsx("i",{className:"yts-shimmer is-short"}),s.jsxs("div",{className:`yts-thumb${r?" is-playing":""}`,children:[s.jsx("img",{src:"/youtubers/max/friday-club-live.webp",alt:"",width:"320",height:"180",loading:"lazy"}),s.jsx("span",{className:"yts-thumb-play",children:s.jsx(Tr,{size:18,fill:"
430currentColor"})}),r>0&&s.jsxs("span",{className:"yts-thumb-chapter",children:[s.jsx("b",{children:"1:12"}),"What members get"]},r),s.jsx("span",{className:"yts-thumb-bar",children:r>0&&s.jsx("i",{},r)})]}),s.jsxs("span",{className:"yts-buy",children:[s.jsx("strong",{children:"$5/mo"}),s.jsx("span",{children:"Join now"})]})]}),s.jsxs("div",{className:"yts-lessons",children:[s.jsx("strong",{children:"What members get"}),$Xe.map(([i,o],l)=>s.jsxs("span",{children:[s.jsx("b",{children:l+1}),i,s.jsx("small",{children:o})]},i)),s.jsx("i",{className:"yts-shimmer"}),s.jsx("i",{className:"yts-shimmer is-short"})]})]}),s.jsxs("div",{className:`yts-widget${e?" is-driven":""}${e&&!t?" is-closed":""}`,children:[(e||t)&&s.jsxs("div",{className:"yts-panel",role:"region","aria-label":"Sample website chat",children:[s.jsxs("div",{className:"yts-panel-tools","aria-hidden":"true",children:[s.jsx(O4,{size:13}),s.jsx(as,{size:14})]}),s.jsxs("div",{className:"yts-panel-head","aria-hidden":"true",children:[s.jsx("span",{className:"yts-panel-avatar",children:s.jsx("img",{src:zn.avatar,alt:"",width:"44",height:"44",loading:"lazy"})}),s.jsxs("strong",{children:[zn.first,"'s AI"]}),s.jsxs("span",{className:"ytm-contact",children:[s.jsx(Ms,{size:14,fill:"currentColor"}),"Contact"]}),s.jsx(xl,{size:18})]}),s.jsxs("div",{className:"yts-panel-body",children:[s.jsxs("div",{className:"ytm-ai",children:["Hi, I'm ",zn.first,"'s AI. Ask me anything about the club or my videos."]}),s.jsx("div",{className:"ytm-user",children:"What do I get in the Friday Club?"}),s.jsxs("div",{className:"ytm-ai",children:["Every Friday video a day early, a monthly live Q&A, and a vote on the next challenge. ",s.jsx("button",{type:"button",className:"ytm-watch",onClick:()=>a(i=>i+1),children:"Watch at 1:12"})]})]}),s.jsxs("div",{className:"yts-panel-foot","aria-hidden":"true",children:[s.jsxs("div",{className:"yts-panel-input",children:[s.jsx("span",{children:"Ask a question..."}),s.jsxs("span",{className:"ytm-call",children:[s.jsx(Ts,{size:14}),"Call"]})]}),s.jsxs("p",{children:["AI Chat. Messages and AI replies may be reviewed by this expert's owner for audience insights. Don't share sensitive personal information. ",s.jsx("u",{children:"Privacy"})," ",s.jsx("u",{children:"Terms"})]})]})]}),(e||!t)&&s.jsx("div",{className:"yts-teaser","aria-hidden":"true",children:"Do you have a question?"}),s.jsxs("button",{type:"button",className:"yts-launcher","aria-expanded":t,"aria-label":t?"Close chat preview":"Open chat preview",onClick:()=>n(i=>!i),children:[(e||t)&&s.jsx(as,{className:"yts-ic-x",size:24,"aria-hidden":"true"}),(e||!t)&&s.jsx(ni,{className:"yts-ic-msg",size:24,"aria-hidden":"true"}),(e||!t)&&s.jsx("span",{className:"yts-launcher-call","aria-hidden":"true",children:s.jsx(Ts,{size:11,fill:"currentColor"})})]})]})]})})]})})}function SB({tab:e,style:t}){return s.jsxs("div",{className:"yts-copy-col",style:t,children:[s.jsx("h3",{className:"yt-h3",children:e.title}),s.jsx("p",{className:"yts-body",children:e.body}),s.jsx("ul",{className:"yts-points",children:e.points.map(n=>s.jsxs("li",{children:[s.jsx(ft,{size:18,"aria-hidden":"true"}),n]},n))}),s.jsx("a",{className:"yt-text-link",href:"/experts/new",children:"Create your AI for free"})]})}const FXe="(min-width: 1025px) and (min-height: 780px) and (prefers-reduced-motion: no-preference)",BXe="(max-width: 1024px)",Mp=.5,CB=.75;function UXe(){const[e,t]=f.useState(0),[n,r]=f.useState(!1),[a,i]=f.useState(!1),o=f.useRef([]),l=f.useRef(null),c=f.useRef(null),u=f.useRef(null),d=f.useRef(null),h=f.useRef(null);f.useEffect(()=>{if(!window.matchMedia)return;const g=window.matchMedia(FXe),x=window.matchMedia(BXe),b=()=>{r(g.matches),i(x.matches)};return b(),g.addEventListener("change",b),x.addEventListener("change",b),()=>{g.removeEventListener("change",b),x.removeEventListener("change",b)}},[]),f.useEffect(()=>{if(!n)return;let g=0;const x=()=>{g=0;const y=parseFloat(getComputedStyle(c.current).top)||0,v=u.current.offsetHeight,w=Math.min(1,Math.max(0,(y-l.current.getBoundingClientRect().top)/v));l.current.style.setProperty("--yts-p",Math.min(1,w/Mp).toFixed(4));const j=Math.min(1,Math.max(0,(w-Mp)/((1-Mp)*CB)));l.current.style.setProperty("--yts-q",j.toFixed(4)),l.current.dataset.chat=j>.9?"open":"opening";const E=w<Mp?0:1;h.current!==null&&h.current!==E||(h.current=null,t(E))},b=()=>{g||(g=requestAnimationFrame(x))};return x(),window.addEventListener("scroll",b,{passive:!0}),window.addEventListener("resize",b),()=>{cancelAnimationFrame(g),window.removeEventListener("scroll",b),window.removeEventListener("resize",b)}},[n]);function p(g){if(t(g),!n)return;h.current=g,d.current?.();const x=()=>{h.current=null,y()},b=setTimeout(x,3e3),y=()=>{clearTimeout(b),window.removeEventListener("scrollend",x),d.current=null};window.addEventListener("scrollend",x,{once:!0}),d.current=y;const v=parseFloat(getComputedStyle(c.current).top)||0,w=window.scrollY+l.current.getBoundingClientRect().top-v;window.scrollTo({top:w+(g===0?0:(Mp+(1-Mp)*CB)*u.current.offsetHeight),behavior:"smooth"})}function m(g){const x=pv.length-1,b=e===0?x:e-1,y=e===x?0:e+1,v={ArrowDown:y,ArrowRight:y,ArrowUp:b,ArrowLeft:b,Home:0,End:x}[g.key];v!==void 0&&(g.preventDefault(),p(v),o.current[v]?.focus({preventScroll:!0}))}return s.jsx("section",{className:"yt-section yts",id:"share","aria-labelledby":"yts-title",children:s.jsxs("div",{className:"yt-container",children:[s.jsxs("div",{className:"yt-head yt-head-center",children:[s.jsx("span",{className:"yt-kicker",children:"Share it"}),s.jsxs("h2",{id:"yts-title",className:"yt-h2",children:["Put it where your ",s.jsx("span",{className:"yt-grad",children:"viewers already are."})]}),s.jsx("p",{className:"yt-lede",children:"It's the same AI in both places. Pick the one that fits you, or use both."})]}),a?s.jsx("div",{className:"yts-stack",children:pv.map(g=>s.jsxs("article",{className:"yts-stack-item","aria-labelledby":`yts-h-${g.id}`,children:[s.jsx("h3",{id:`yts-h-${g.id}`,className:"yts-tab","aria-current":"true",children:g.label}),s.jsx(SB,{tab:g}),s.jsx("div",{className:"yts-visual",children:g.id==="bio"?s.jsx(NB,{}):s.jsx(EB,{})})]},g.id))}):s.jsxs("div",{ref:l,className:`yts-track${n?" is-pinned":""}`,children:[s.jsxs("div",{ref:c,className:"yts-main",children:[s.jsx("div",{className:"yts-tabs",role:"tablist","aria-orientation":"vertical","aria-label":"Ways to share your AI",onKeyDown:m,children:pv.map((g,x)=>s.jsx("button",{type:"button",role:"tab",id:`yts-tab-${g.id}`,ref:b=>{o.current[x]=b},"aria-selected":e===x,"aria-controls":`yts-panel-${g.id}`,tabIndex:e===x?0:-1,className:"yts-tab",style:{gridRow:x+2+(x>e?1:0)},onClick:()=>p(x),children:g.label},g.id))}),pv.map((g,x)=>s.jsxs("div",{role:"tabpanel",id:`yts-panel-${g.id}`,"aria-labelledby":`yts-tab-${g.id}`,hidden:e!==x,className:"yts-panel-grid",children:[s.jsx(SB,{tab:g,style:{gridRow:e+3}}),s.jsx("div",{className:"yts-visual",children:g.id==="bio"?s.jsx(NB,{driven:n}):s.jsx(EB,{driven:n})})]},g.id))]}),n&&s.jsx("div",{ref:u,className:"yts-spacer","aria-hidden":"true"})]})]})})}const TB="/welcome/connector-icons/",rre=[{name:"YouTube channel",img:"youtube.webp",result:"142 videos, with timestamps"},{name:"Instagram",img:"instagram.png",result:"86 posts"},{name:"TikTok",img:"tiktok.webp",result:"210 videos"},{name:"Off Script podcast",img:"spotify.svg",result:"38 episodes"},{name:"maxcarter.tv",Icon:vc,result:"12 pages"}],zXe=[{k:"yt",img:"youtube.webp"},{k:"ig",img:"instagram.png"},{k:"tt",img:"tiktok.webp"},{k:"file",Icon:si},{k:"li",img:"linkedin.png"},{k:"x",img:"x.webp"},{k:"fb",img:"facebook.png"},{k:"sp",img:"spotify.svg"},{k:"ap",img:"apple-podcasts.svg"},{k:"link",Icon:wb}],mv=rre.length,HXe=900;function qXe(){return typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function WXe({state:e,result:t}){return e==="done"?s.jsxs("span",{className:"ytsrc-chip ytsrc-chip-done",children:[s.jsx(ft,{size:13,strokeWidth:3}),t]}):e==="reading"?s.jsxs("span",{className:"ytsrc-chip ytsrc-chip-reading",children:[s.jsx(vt,{size:13,className:"ytsrc-spin"}),"Reading"]}):s.jsx("span",{className:"ytsrc-chip",children:"Waiting"})}function AB({done:e,label:t}){return s.jsxs("span",{className:`ytsrc-pill${e?" is-done":""}`,children:[e?s.jsx(ft,{size:12,strokeWidth:3}):s.jsx(vt,{size:12,className:"ytsrc-spin"}),e?t:"Reading..."]})}function VXe(){const e=f.useRef(null),[t,n]=f.useState(-1);return f.useEffect(()=>{if(t!==-1)return;if(qXe()){n(mv);return}const r=e.current;if(typeof IntersectionObserver>"u"||!r){const i=setTimeout(()=>n(0),0);return()=>clearTimeout(i)}const a=new IntersectionObserver(([i])=>{i.isIntersecting&&(n(0),a.disconnect())},{threshold:.35});return a.observe(r),()=>a.disconnect()},[t]),f.useEffect(()=>{if(t<0||t>=mv)return;const r=setTimeout(()=>n(a=>a+1),HXe);return()=>clearTimeout(r)},[t]),s.jsx("section",{className:"yt-section ytsrc","aria-labelledby":"ytsrc-title",children:s.jsxs("div",{className:"yt-container",children:[s.jsxs("div",{className:"yt-head yt-head-center",children:[s.jsxs("h2",{id:"ytsrc-title",className:"yt-h2",children:["Everything you already make, ",s.jsx("span",{className:"yt-grad",children:"in one AI."})]}),s.jsx("p",{className:"yt-lede",children:"Connect your channels and add your files. Your AI reads the transcripts, captions and pages, so it knows what you have said and where you said it."})]}),s.jsxs("div",{className:"ytsrc-stage",children:[s.jsx("div",{className:"ytsrc-tiles","aria-hidden":"true",children:zXe.map(({k:r,img:a,Icon:i})=>s.jsx("span",{className:`ytsrc-tile ytsrc-tile-${r}`,children:a?s.jsx("img",{src:TB+a,alt:"",loading:"lazy",width:"30",height:"30"}):s.jsx(i,{size:26})},r))}),s.jsxs("div",{className:"ytsrc-card",children:[s.jsx("p",{className:"yt-sr-only",children:"Sources shown: YouTube, Instagram, TikTok, a Spotify podcast and a website."}),s.jsxs("div",{"aria-hidden":"true",children:[s.jsxs("div",{className:"ytsrc-head",children:[s.jsx("img",{className:"ytsrc-avatar",src:zn.avatar,alt:"",loading:"lazy",width:"48",height:"48"}),s.jsxs("div",{className:"ytsrc-who",children:[s.jsx("strong",{children:zn.name}),s.jsxs("span",{className:"ytsrc-meta",children:[s.jsxs("span",{children:[s.jsx(nY,{size:13}),"Entertainment"]}),s.jsxs("span",{children:[s.jsx(gY,{size:13}),"Los Angeles"]}),s.jsxs("span",{children:[s.jsx(tve,{size:13}),"142 videos"]})]})]})]}),s.jsxs("div",{className:"ytsrc-pills",children:[s.jsx(AB,{done:t>2,label:"Transcripts read"}),s.jsx(AB,{done:t>=mv,label:"Captions read"})]}),s.jsx("ol",{className:"ytsrc-list",children:rre.map(({name:r,img:a,Icon:i,result:o},l)=>{const c=l<t?"done":l===t?"reading":"waiting";return s.jsxs("li",{className:`ytsrc-row is-${c}`,children:[s.jsx("span",{className:`ytsrc-node${i?" ytsrc-node-tint":""}`,children:a?s.jsx("img",{src:TB+a,alt:"",loading:"lazy",width:"20",height:"20"}):s.jsx(i,{size:18})}),s.jsx("span",{className:"ytsrc-name",children:r}),s.jsx("span",{className:"ytsrc-dash"}),s.jsx(WXe,{state:c,result:o})]},r)})}),s.jsxs("p",{className:`ytsrc-ready${t>
430=mv?" is-shown":""}`,children:[s.jsx("span",{className:"ytsrc-ready-check",children:s.jsx(ft,{size:14,strokeWidth:3})}),"Ready to answer"]})]})]})]})]})})}function GXe(){return s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"ytf-bubble",children:["The wedding dare starts right here: ",s.jsx("span",{className:"ytf-link",children:"Watch at 7:05"})]}),s.jsxs("div",{className:"ytf-player",children:[s.jsx("span",{className:"ytf-play"}),s.jsxs("span",{className:"ytf-track",children:[s.jsx("span",{className:"ytf-fill"}),s.jsx("span",{className:"ytf-knob"})]}),s.jsx("span",{className:"ytf-time",children:"7:05"})]})]})}function YXe(){return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"ytf-bubble",children:"It is the Friday Club hoodie. We just restocked it."}),s.jsxs("div",{className:"ytf-offer",children:[s.jsx("img",{src:"/youtubers/max/hoodie.webp",alt:"",width:"256",height:"256",loading:"lazy"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Friday Club Hoodie"}),s.jsx("em",{children:"$97"})]})]})]})}function KXe(){return s.jsxs("div",{className:"ytf-voice",children:[s.jsxs("span",{className:"ytf-call-pill",children:[s.jsx("img",{src:zn.avatar,alt:"",width:"32",height:"32",loading:"lazy"}),s.jsx(Ts,{size:14}),"Call ",zn.first,"'s AI"]}),s.jsx("span",{className:"ytf-wave",children:Array.from({length:18},(e,t)=>s.jsx("i",{style:{"--i":t}},t))}),s.jsx("small",{children:"Voice cloned from a 10 second recording"})]})}function XXe(){return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"ytf-bubble is-user",children:"How do you come up with video ideas?"}),s.jsx("p",{className:"ytf-bubble",children:"Mostly from your comments."}),s.jsxs("div",{className:"ytf-paywall",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Free messages used."})," $5/month to keep chatting."]}),s.jsx("span",{className:"ytf-subscribe",children:"Subscribe"})]})]})}const JXe=[{name:"Maya Chen",status:"New",cls:"st-new"},{name:"Daniel Ortiz",status:"Booked a call",cls:"st-booked"},{name:"Priya Nair",status:"Replied",cls:"st-replied"}];function QXe(){return s.jsx("ul",{className:"ytf-leads",children:JXe.map((e,t)=>s.jsxs("li",{style:{"--i":t},children:[s.jsx("span",{className:"ytf-initial",children:e.name[0]}),s.jsx("strong",{children:e.name}),s.jsx("span",{className:`ytf-badge ${e.cls}`,children:e.status})]},e.name))})}const ZXe=[{label:"Video ideas",pct:86},{label:"Merch and drops",pct:64},{label:"Behind the scenes",pct:47},{label:"Brand deals",pct:29}];function eJe(){return s.jsx("ul",{className:"ytf-topics",children:ZXe.map((e,t)=>s.jsxs("li",{style:{"--i":t,"--w":`${e.pct}%`},children:[s.jsx("span",{children:e.label}),s.jsx("span",{className:"ytf-bar",children:s.jsx("i",{})})]},e.label))})}const tJe=[{title:"Answers with timestamps",Icon:Rf,Mock:GXe,body:"Every answer links to the exact moment in your video, so viewers keep watching you."},{title:"Recommends your offers",Icon:Mf,Mock:YXe,body:"Suggests your courses, gear and links only when they actually fit the question."},{title:"Talks in your voice",Icon:bb,Mock:KXe,body:"Viewers can call your AI and just talk. Clone your voice or pick one of ours."},{title:"Paid access",Icon:Zi,Mock:XXe,body:"A few free answers, then a monthly subscription. You set the price and the limit."},{title:"Leads you can follow up",Icon:A_,Mock:QXe,body:"Viewers leave their details. Track each one from new to booked."},{title:"Anonymous insights",Icon:yb,Mock:eJe,body:"See what your audience asks about most, without reading anyone's private chats."}];function sJe(){return s.jsx("section",{className:"yt-section ytf",id:"features","aria-labelledby":"ytf-title",children:s.jsxs("div",{className:"yt-container",children:[s.jsxs("div",{className:"yt-head yt-reveal",children:[s.jsxs("h2",{id:"ytf-title",className:"yt-h2",children:["Your AI does more ",s.jsx("span",{className:"yt-grad",children:"than answer."})]}),s.jsx("p",{className:"yt-lede",children:"It sends people to the right video, the right course and the right gear. It can talk out loud, and it can earn for the time you put into your channel."}),s.jsx("span",{className:"ytf-chip",children:"Built from your videos, c
430ourses and products"})]}),s.jsx("div",{className:"ytf-grid yt-reveal",children:tJe.map(({title:e,body:t,Icon:n,Mock:r})=>s.jsxs("article",{className:"ytf-cell",children:[s.jsxs("div",{className:"ytf-cell-head",children:[s.jsx("h3",{className:"yt-h3",children:e}),s.jsx(n,{size:18,"aria-hidden":"true"})]}),s.jsx("p",{className:"ytf-desc",children:t}),s.jsx("div",{className:"ytf-mock","aria-hidden":"true",children:s.jsx(r,{})})]},e))})]})})}const nJe=`${zn.first}'s AI`,rJe=[["Conversations","1,284"],["People who chatted","612"],["Profile visitors","3,920"],["Leads","38"],["Recommendations","457"],["Offering clicks","214"]],aJe=[["Video ideas",34],["Merch and drops",27],["Behind the scenes",21],["Brand deals",18]],iJe=[["Started a conversation",1284,100],["5+ messages",486,38],["Left their contact",38,3]],oJe=[{name:"Maya Chen",when:"12 min ago",status:"New",cls:"new"},{name:"Daniel Ruiz",when:"Yesterday",status:"Booked a call",cls:"booked"},{name:"Priya Nair",when:"2 days ago",status:"Replied",cls:"replied"}],Dp=[{id:"insights",label:"Insights"},{id:"leads",label:"Leads",count:3}];function lJe(){return s.jsxs("div",{className:"ytl-insights",children:[s.jsx("div",{className:"ytl-periods",children:["Today","7 days","30 days","All time"].map(e=>s.jsx("span",{className:e==="30 days"?"is-on":"",children:e},e))}),s.jsx("ul",{className:"ytl-stats",children:rJe.map(([e,t])=>s.jsxs("li",{children:[s.jsx("span",{children:e}),s.jsx("strong",{children:t})]},e))}),s.jsxs("div",{className:"ytl-panels",children:[s.jsxs("section",{className:"ytl-panel",children:[s.jsx("h4",{children:"What people ask about"}),s.jsx("ul",{className:"ytl-topics",children:aJe.map(([e,t],n)=>s.jsxs("li",{children:[s.jsxs("span",{className:"ytl-topic-row",children:[s.jsx("span",{children:e}),s.jsxs("b",{children:[t,"%"]})]}),s.jsx("span",{className:"ytl-track",children:s.jsx("i",{style:{"--w":`${t/34*100}%`,"--d":`${n*90}ms`}})})]},e))})]}),s.jsxs("section",{className:"ytl-panel",children:[s.jsx("h4",{children:"How conversations progress"}),s.jsx("ol",{className:"ytl-funnel",children:iJe.map(([e,t,n],r)=>s.jsxs("li",{children:[s.jsxs("span",{className:"ytl-topic-row",children:[s.jsx("span",{children:e}),s.jsx("b",{children:t.toLocaleString("en-US")})]}),s.jsx("span",{className:"ytl-track is-funnel",children:s.jsx("i",{style:{"--w":`${Math.max(n,4)}%`,"--d":`${r*90}ms`}})})]},e))})]})]})]})}function cJe(){return s.jsxs("div",{className:"ytl-leads",children:[s.jsxs("div",{className:"ytl-inbox",children:[s.jsxs("div",{className:"ytl-inbox-head",children:[s.jsx("strong",{children:"Inbox"}),s.jsx("span",{children:"1 to 3 of 3"})]}),s.jsx("ul",{children:oJe.map((e,t)=>s.jsxs("li",{className:t===0?"is-active":"",children:[s.jsxs("span",{className:"ytl-row-top",children:[s.jsx("strong",{children:e.name}),s.jsx("span",{children:e.when})]}),s.jsxs("span",{className:"ytl-row-bottom",children:[s.jsx("span",{className:`ytl-badge st-${e.cls}`,children:e.status}),s.jsxs("span",{children:["Expert: ",nJe]})]})]},e.name))})]}),s.jsxs("div",{className:"ytl-detail",children:[s.jsxs("div",{className:"ytl-detail-head",children:[s.jsx("strong",{children:"Maya Chen"}),s.jsx("span",{className:"ytl-ready",children:"Ready now"}),s.jsxs("span",{className:"ytl-status",children:["New",s.jsx(Is,{size:14})]})]}),s.jsx("p",{className:"ytl-group-label",children:"Request context"}),s.jsxs("dl",{className:"ytl-group",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Source"}),s.jsx("dd",{children:"Website embed"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Summary"}),s.jsx("dd",{children:"Snack brand asking about a sponsored segment in a Friday video."})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Received"}),s.jsx("dd",{children:"12 min ago"})]})]}),s.jsx("p",{className:"ytl-group-label",children:"Contact & details"}),s.jsxs("dl",{className:"ytl-group",children:[s.jsxs("div",{children:[s.jsxs("dt",{children:[s.jsx(qr,{size:15}),"Email"]}),s.jsx("dd",{children:"[email protected]"})]}),s.jsxs("div",{children:[s.jsxs("dt",{children:[s.jsx(Ts,{size:15}),"Phone"]}),s.jsx("dd",{className:"is-muted",children:"Not shared"})]}),s.jsxs("div",{className:"is-stacked",children:[s.jsxs("dt",{children:[s.jsx(ea,{size:15}),"Message they left"]}),s.jsx("dd",{children:"Loved the yes video. Are you open to brand deals this
430spring?"})]})]})]})]})}const uJe=[{Icon:Vh,title:"Insights stay anonymous.",body:"You see what people ask and how far they get, not who they are."},{Icon:Cye,title:"Leads only come from consent.",body:"Someone becomes a lead only when they choose to share their contact details with you."},{Icon:If,title:"Statuses keep follow-ups on track.",body:"Mark each request as contacted, replied or booked so nobody slips through."}];function dJe(){const[e,t]=f.useState("insights"),n=f.useRef([]);function r(a){const i=Dp.findIndex(c=>c.id===e),o={ArrowRight:i+1,ArrowLeft:i-1,Home:0,End:Dp.length-1}[a.key];if(o===void 0)return;a.preventDefault();const l=(o+Dp.length)%Dp.length;t(Dp[l].id),n.current[l]?.focus()}return s.jsx("section",{className:"yt-section yt-on-night ytl","aria-labelledby":"ytl-title",children:s.jsxs("div",{className:"yt-container",children:[s.jsxs("div",{className:"yt-head yt-reveal",children:[s.jsx("span",{className:"yt-kicker ytl-kicker",children:"Insights and leads"}),s.jsxs("h2",{id:"ytl-title",className:"yt-h2",children:["See what your viewers ask.",s.jsx("br",{}),s.jsx("span",{className:"yt-grad",children:"Follow up with the ones who want more."})]}),s.jsx("p",{className:"yt-lede ytl-lede",children:"Every chat tells you something about your audience. The questions show you what to film next, and the people who want your help can leave a way to reach them."})]}),s.jsxs("div",{className:"ytl-window yt-reveal",children:[s.jsxs("div",{className:"ytl-chrome",children:[s.jsxs("span",{className:"ytl-dots","aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("p",{className:"ytl-title","aria-hidden":"true",children:["Insights & ",s.jsx("em",{children:"Leads"})]}),s.jsx("div",{className:"ytl-tabs",role:"tablist","aria-label":"Product preview",children:Dp.map((a,i)=>s.jsxs("button",{ref:o=>{n.current[i]=o},type:"button",role:"tab",id:`ytl-tab-${a.id}`,"aria-controls":"ytl-panel","aria-selected":e===a.id,tabIndex:e===a.id?0:-1,onClick:()=>t(a.id),onKeyDown:r,children:[a.label,a.count&&s.jsx("span",{className:"ytl-count",children:a.count})]},a.id))})]}),s.jsxs("div",{className:"ytl-screen",id:"ytl-panel",role:"tabpanel","aria-labelledby":`ytl-tab-${e}`,tabIndex:0,children:[s.jsx("div",{"aria-hidden":"true",children:e==="insights"?s.jsx(lJe,{}):s.jsx(cJe,{})}),s.jsx("p",{className:"yt-sr-only",children:e==="insights"?"A preview of the Insights view: conversation counts, the topics people ask about, and how many go on to leave their contact.":"A preview of the Leads inbox: three contact requests with statuses, and the details one viewer chose to share."})]})]}),s.jsx("ul",{className:"ytl-points yt-reveal",children:uJe.map(({Icon:a,title:i,body:o})=>s.jsxs("li",{children:[s.jsx(a,{size:22,"aria-hidden":"true"}),s.jsxs("p",{children:[s.jsx("strong",{children:i})," ",o]})]},i))})]})})}const Qb="/experts/new",RB=[["#how-it-works","How it works"],["#share","Where to share"],["#features","Features"],["/pricing","Pricing"]],iS=["Can you explain that part again?","Which of your videos should I watch first?","What settings did you use at 3:40?","Is your course right for beginners?","Which mic do you use?","Do you offer 1:1 coaching?","What song was playing at 4:12?","Is there a written version of this?","When is the next video coming out?","Where do I start with Python?","How many sets should I do?","What was the recipe for the sauce?"],hJe=[{name:"@lena.watches",when:"2 days ago",text:"Wait, did you actually do the skydive??",color:"#C9A08C"},{name:"@marco_clips",when:"5 days ago",text:"Do a part 2 with the wedding couple!",note:"He already did. It is linked at the end of this one.",color:"#407F57"},{name:"@lucia.vlogs",when:"1 week ago",text:"¿Dónde compro la sudadera? ð",color:"#855CD6"}],pJe=[["/youtubers/max/yes-24-hours.webp","I Said YES to Everything for 24 Hours","18:24"],["/youtubers/max/viewers-control.webp","Viewers Control My Life for 7 Days","24:10"],["/youtubers/max/hoodie-1-vs-1000.webp","$1 vs $1,000 Hoodie","15:47"]],mJe=[["How does my AI learn from my videos?","Paste public YouTube links or connect your channel. We read each videoâs transcript, with its timestamps, so your AI knows what you said and when you said it. You can also add courses, documents, products and notes."],["Will answers really point to the right moment?","When an answer comes from one of your videos, your AI adds a âWatch atâ link that opens YouTube at that timestamp. Answers that come from documents or notes wonât have one."],["How do I know the answers are right?","Your AI answers from the videos, files and notes you add. Test it before you share it, ask it what your viewers ask, and add a video or a note whenever an answer is missing something."],["Do my videos leave YouTube?","No. Your videos stay on your channel. Every âWatch atâ link sends viewers back to YouTube, so your views stay yours."],["Where will viewers find my AI?","Share your Great Experts link in your channel bio, video descriptions and pinned comments. You can also add the chat to your own website with two lines of code."],["Can it recommend my courses and products?","Yes. Add them with a short description and a link. Your AI suggests them when they fit the question, and viewers buy through your own store or checkout."],["Can viewers talk to it out loud?","Yes. Viewers can call your AI and have a spoken conversation. Clone your own voice from a short recording, or choose one of ours."],["Can I charge for access?","Yes. Let viewers try a few free messages, then ask them to subscribe to keep chatting. You choose the price."],["What do I see about my audience?","Insights shows what people ask about, when they chat and what they click, without naming anyone. When a viewer chooses to leave their contact details, they appear in Leads so you can follow up."],["Is it free to start?","Yes. You can create your AI and your profile page for free. Some features, like adding the chat to your website, are on paid plans with a free trial. See pricing for the details."]];function Mg({text:e}){return s.jsx("div",{className:"yt-container",children:s.jsxs("div",{className:"yt-section-cta",children:[s.jsx("p",{children:e}),s.jsxs("a",{className:"yt-button",href:Qb,children:["Start now",s.jsx(xn,{size:18,"aria-hidden":"true"})]})]})})}function fJe(){f.useEffect(()=>{const e=document.querySelectorAll(".yt-page .yt-reveal");if(typeof IntersectionObserver>"u"||window.matchMedia?.("(prefers-reduced-motion: reduce)").matches){e.forEach(n=>n.setAttribute("data-shown","true"));return}const t=new IntersectionObserver(n=>n.forEach(r=>{r.isIntersecting&&(r.target.setAttribute("data-shown","true"),t.unobserve(r.target))}),{rootMargin:"0px 0px -12% 0px"});return e.forEach(n=>t.observe(n)),()=>t.disconnect()},[])}function gJe(){const e=[...iS,...iS];return s.jsxs("section",{className:"yt-marquee","aria-label":"Questions viewers ask creators",children:[s.jsx("p",{className:"yt-marquee-label",children:"Questions viewers ask creators every day"}),s.jsx("ul",{className:"yt-marquee-track",children:e.map((t,n)=>s.jsx("li",{"aria-hidden":n>=iS.length||void 0,children:t},n))})]})}function xJe(){return s.jsx("section",{className:"yt-section yt-railed yt-gridded",children:s.jsxs("div",{className:"yt-container yt-problem",children:[s.jsxs("div",{className:"yt-reveal",children:[s.jsx("span",{className:"yt-kicker",children:"The comment section problem"}),s.jsxs("h2",{className:"yt-h2",children:["The same questions, ",s.jsx("span",{className:"yt-grad",children:"under every video."})]}),s.jsx("p",{className:"yt-lede",style:{marginTop:22},children:"The answers are already in your videos, somewhere in hours of footage. But comments pile up, most never get a reply, and the viewer moves on."}),s.jsxs("ul",{className:"yt-problem-points",children:[s.jsxs("li",{children:[s.jsx(ft,{size:20,"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Answers from your own videos"}),"It speaks from what you have made, so it sounds like you."]})]}),s.jsxs("li",{children:[s.jsx(Tr,{size:20,"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("strong",{children:"The exact moment, not the whole video"}),"Answers link to the timestamp where you explain it."]})]}),s.jsxs("li",{children:[s.jsx(Rf,{size:20,"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("strong",{children:"On at 2am, in every time zone"}),"Viewers get help without you checking your phone."]})]}),s.jsxs("li",{children:[s.jsx(P4,{size:20,"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("strong",{children:"In your viewerâs language"}
430),"Fans ask in their own language and get the answer in it too."]})]})]})]}),s.jsxs("div",{className:"yt-comments yt-reveal","aria-hidden":"true",children:[s.jsx("p",{className:"yt-comments-title",children:"1,248 comments"}),hJe.map(e=>s.jsxs("div",{className:"yt-comment",children:[s.jsx("span",{className:"yt-comment-avatar",style:{background:e.color},children:e.name[1].toUpperCase()}),s.jsxs("div",{children:[s.jsxs("strong",{children:[e.name,s.jsx("span",{children:e.when})]}),s.jsx("p",{children:e.text}),s.jsx("small",{children:e.note||"No replies yet"})]})]},e.name)),s.jsxs("div",{className:"yt-comment yt-comment-pinned",children:[s.jsx("img",{className:"yt-comment-avatar",src:zn.avatar,alt:"",width:"36",height:"36",style:{objectFit:"cover"}}),s.jsxs("div",{children:[s.jsxs("strong",{children:["@maxcarter",s.jsx("span",{children:"Pinned"})]}),s.jsxs("p",{children:["Got a question? My AI knows every video I have made, answers in your language and points you to the right moment: ",s.jsx("a",{children:zn.link})]})]})]})]})]})})}function bJe(){return s.jsx("section",{className:"yt-section yt-steps-band",id:"how-it-works",children:s.jsxs("div",{className:"yt-container",children:[s.jsxs("div",{className:"yt-head yt-head-center yt-reveal",children:[s.jsx("span",{className:"yt-kicker",children:"How it works"}),s.jsxs("h2",{className:"yt-h2",children:["Set it up once. ",s.jsx("span",{className:"yt-grad",children:"It keeps answering."})]})]}),s.jsxs("ol",{className:"yt-steps yt-reveal",children:[s.jsxs("li",{className:"yt-step",children:[s.jsx("span",{className:"yt-step-num",children:"1"}),s.jsx("h3",{className:"yt-h3",children:"Add your videos"}),s.jsx("p",{children:"Paste YouTube links or connect your channel. Add your courses, products and guides too."}),s.jsxs("div",{className:"yt-step-art yt-videos","aria-hidden":"true",children:[pJe.map(([e,t,n])=>s.jsxs("div",{className:"yt-video-row",children:[s.jsx("img",{src:e,alt:"",width:"64",height:"36",loading:"lazy"}),s.jsxs("span",{children:[s.jsx("strong",{children:t}),s.jsx("small",{children:n})]}),s.jsx(ft,{size:16})]},t)),s.jsxs("p",{className:"yt-paste-status",children:[s.jsx(ft,{size:16}),"Transcripts and timestamps ready"]})]})]}),s.jsxs("li",{className:"yt-step",children:[s.jsx("span",{className:"yt-step-num",children:"2"}),s.jsx("h3",{className:"yt-h3",children:"Check the answers"}),s.jsx("p",{children:"Ask it what your viewers ask. If something is missing, add a note or another video."}),s.jsx("div",{className:"yt-step-art ytm-chat","aria-hidden":"true",style:{boxShadow:"none"},children:s.jsxs("div",{className:"ytm-body",children:[s.jsx("p",{className:"ytm-user",children:"Where is your hoodie from?"}),s.jsxs("p",{className:"ytm-ai",children:["It is my Friday Club hoodie. I show how we made it in this one. ",s.jsx("span",{className:"ytm-watch",children:"Watch at 6:02"})]})]})})]}),s.jsxs("li",{className:"yt-step",children:[s.jsx("span",{className:"yt-step-num",children:"3"}),s.jsx("h3",{className:"yt-h3",children:"Share your link"}),s.jsx("p",{children:"Put it where viewers already look, or add the chat to your own website."}),s.jsxs("div",{className:"yt-step-art yt-videos","aria-hidden":"true",children:[s.jsxs("div",{className:"yt-link-row",children:[s.jsx("img",{src:"/brand/greatexperts-mark-indigo.png",alt:"",width:"36",height:"36",loading:"lazy"}),s.jsxs("span",{children:[s.jsx("strong",{children:zn.link}),s.jsx("small",{children:"Your page and AI, live"})]}),s.jsx("b",{children:"Copy"})]}),s.jsx("div",{className:"yt-share-chips",children:["Channel bio","Video descriptions","Pinned comments","Your website"].map(e=>s.jsxs("span",{children:[s.jsx(ft,{size:13}),e]},e))}),s.jsxs("p",{className:"yt-paste-status",children:[s.jsx(ft,{size:16}),"Shared in 4 places"]})]})]})]})]})})}function yJe(){const e=f.useRef(null),[t,n]=f.useState(!1),[r,a]=f.useState(!1),i=async()=>{try{await e.current?.play()}catch{a(!0)}};return s.jsxs("section",{className:"yt-section yt-container yt-walk",id:"tour",children:[s.jsxs("div",{className:"yt-walk-copy yt-reveal",children:[s.jsx("span",{className:"yt-kicker",children:"See the real product"}),s.jsxs("h2",{className:"yt-h2",children:["From sign-up to ",s.jsx("span",{className:"yt-grad",children:"a shareable link."})]}),s.jsx("p",{className:"yt-lede",children:"Pick a look, connect your channels, add what you know, choose a voice and go live. This is the actual app, sped up to 46 seconds."}),s.jsx("a",{className:"yt-button",href:Qb,children:"Create your AI free"})]}),s.jsxs("div",{className:"yt-reveal",children:[s.jsxs("div",{className:"yt-video",children:[s.jsxs("video",{ref:e,controls:t,playsInl
430ine:!0,preload:"none",width:"1280",height:"834",poster:"/youtubers/walkthrough-poster.jpg","aria-label":"Great Experts setup walkthrough",onPlay:()=>{n(!0),a(!1)},onError:()=>a(!0),children:[s.jsx("source",{src:"/youtubers/product-walkthrough.mp4",type:"video/mp4",onError:()=>a(!0)}),s.jsx("track",{kind:"captions",src:"/youtubers/walkthrough-captions.vtt",srcLang:"en",label:"English"})]}),!t&&!r&&s.jsx("button",{type:"button",className:"yt-video-play",onClick:()=>{i()},children:s.jsxs("span",{children:[s.jsx("i",{children:s.jsx(Tr,{size:16,fill:"currentColor","aria-hidden":"true"})}),"Watch the tour"]})}),r&&s.jsxs("p",{className:"yt-video-error",role:"alert",children:["This video would not play here. ",s.jsx("a",{href:"/youtubers/product-walkthrough.mp4",target:"_blank",rel:"noopener noreferrer",children:"Open it directly"}),"."]})]}),s.jsx("p",{className:"yt-video-meta",children:"46 seconds, with captions."})]})]})}function vJe(){const t=["Soniyaa Kiran Punjabi","Rebecca Ingram","Shahnaz Hassan"].map(n=>G3.find(r=>r.name===n)).filter(Boolean);return s.jsx("section",{className:"yt-section yt-railed",children:s.jsxs("div",{className:"yt-container",children:[s.jsxs("div",{className:"yt-head yt-head-center yt-reveal",children:[s.jsx("span",{className:"yt-kicker",children:"From our creators"}),s.jsxs("h2",{className:"yt-h2",children:["People who teach ",s.jsx("span",{className:"yt-grad",children:"are already using it."})]})]}),s.jsx("div",{className:"yt-reviews yt-reveal",children:t.map(n=>s.jsxs("figure",{className:"yt-review",children:[s.jsx(D1e,{size:26,color:"var(--yt-indigo)","aria-hidden":"true"}),s.jsx("blockquote",{children:n.quote}),s.jsxs("figcaption",{children:[s.jsx("img",{src:n.avatar,alt:"",width:"48",height:"48",loading:"lazy"}),s.jsxs("span",{children:[s.jsx("strong",{children:n.name}),s.jsx("span",{children:n.role})]})]})]},n.name))})]})})}function wJe(){const e=[{icon:Vh,title:"Answers from your content",text:"Your AI answers from the videos, files and notes you add. Test it before you share it, and add more whenever you like."},{icon:vb,title:"Anonymous insights",text:"Insights show what people ask about and when they chat. They never show who asked."},{icon:Uwe,title:"Leads only by consent",text:"A viewer becomes a lead only when they choose to send you their details. Every chat shows a clear privacy notice."}];return s.jsx("section",{className:"yt-section yt-trust yt-railed","aria-labelledby":"yt-trust-title",children:s.jsxs("div",{className:"yt-container",children:[s.jsxs("h2",{className:"yt-h2 yt-reveal",id:"yt-trust-title",children:["Your viewers trust you.",s.jsx("br",{}),s.jsx("span",{className:"yt-grad",children:"We take that seriously."})]}),s.jsx("div",{className:"yt-trust-grid yt-reveal",children:e.map(({icon:t,title:n,text:r})=>s.jsxs("article",{className:"yt-trust-card",children:[s.jsx("span",{className:"yt-tile",children:s.jsx(t,{size:20,"aria-hidden":"true"})}),s.jsx("h3",{className:"yt-h3",children:n}),s.jsx("p",{children:r})]},n))}),s.jsx("div",{className:"yt-trust-cta",children:s.jsx("a",{className:"yt-button yt-button-ghost",href:"/privacy",children:"Read our privacy policy"})})]})})}function jJe(){return s.jsx("section",{className:"yt-section yt-steps-band",children:s.jsxs("div",{className:"yt-container yt-faq",children:[s.jsxs("div",{className:"yt-faq-side",children:[s.jsxs("h2",{className:"yt-h2",children:["Questions ",s.jsx("span",{className:"yt-grad",children:"creators ask us."})]}),s.jsx("p",{className:"yt-lede",children:"Something else on your mind? Our pricing page covers plans and limits."}),s.jsxs("a",{className:"yt-text-link",href:"/pricing",children:[s.jsx($a,{size:17,"aria-hidden":"true"}),"See plans and pricing"]}),s.jsxs("a",{className:"yt-button yt-faq-cta",href:Qb,children:["Start now",s.jsx(xn,{size:18,"aria-hidden":"true"})]})]}),s.jsx("div",{className:"yt-faq-list",children:mJe.map(([e,t])=>s.jsxs("details",{children:[s.jsxs("summary",{children:[e,s.jsx(Es,{size:20,"aria-hidden":"true"})]}),s.jsx("p",{children:t})]},e))})]})})}function _Je(){return fJe(),s.jsxs("div",{className:"yt-page",children:[s.jsx(vs,{path:"/youtubers",title:"Great Experts for YouTubers | Your videos, now answering questions",description:"Turn your YouTube videos into an AI your viewers can ask. Answers sound like you and link to the exact moment in your video. Share it in your bio or add it to your website.",ogImage:"/youtubers/social-card.jpg"}),s.jsx(l0,{children:s.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..600;1,9..144,300..600&family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap",rel:"stylesheet"})}),s.jsx("a",{className:"yt-skip",href:"#main",children:"Skip to content"}),s.jsx("div",{className:"yt-navwrap",children:s.jsx("div",{children:s.jsx(Dk,{links:RB,mobileLinks:RB,cta:"Start free"})})}),s.jsxs("main",{id:"main",children:[s.jsxs("section",{className:"yt-hero","aria-labelledby":"yt-title",children:[s.jsxs("div",{className:"yt-container yt-hero-copy",children:[s.jsxs("span",{className:"yt-hero-badge",children:[s.jsxs("svg",{viewBox:"0 0 28 20",width:"28",height:"20","aria-hidden":"true",children:[s.jsx("rect",{width:"28",height:"20",rx:"5",fill:"#fff"}
430),s.jsx("path",{d:"M11 5.5v9l8-4.5z",fill:"currentColor"})]}),"For YouTube creators"]}),s.jsxs("h1",{id:"yt-title",children:["Every video youâve made, ",s.jsx("span",{className:"yt-grad",children:"now answering questions."})]}),s.jsx("p",{className:"yt-lede",children:"Great Experts turns your YouTube videos into an AI that talks like you. Viewers ask anything, get a clear answer, and jump straight to the moment in your video that explains it."}),s.jsxs("div",{className:"yt-hero-actions",children:[s.jsx("a",{className:"yt-button",href:Qb,children:"Create your AI free"}),s.jsxs("a",{className:"yt-button yt-button-ghost",href:"#tour",children:[s.jsx(Tr,{size:16,fill:"currentColor","aria-hidden":"true"}),"Watch the tour"]})]}),s.jsx("p",{className:"yt-hero-note",children:"Start with the videos you already have."})]}),s.jsx("div",{className:"yt-hero-stage",children:s.jsx("div",{className:"yt-container",children:s.jsxs("div",{className:"yt-frame yt-on-night",children:[s.jsxs("span",{className:"yt-frame-bar","aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{}),s.jsx("b",{children:zn.link})]}),s.jsx(MXe,{})]})})})]}),s.jsx(gJe,{}),s.jsx(xJe,{}),s.jsx(Mg,{text:"Stop answering the same comment twice."}),s.jsx(VXe,{}),s.jsx(bJe,{}),s.jsx(Mg,{text:"Your first videos take a few minutes to add."}),s.jsx(UXe,{}),s.jsx(Mg,{text:"One link. Every place your viewers already are."}),s.jsx(sJe,{}),s.jsx(Mg,{text:"All of this comes with your AI. Try it free."}),s.jsx(dJe,{}),s.jsx(yJe,{}),s.jsx(vJe,{}),s.jsx(Mg,{text:"Join creators who already let their AI take the questions."}),s.jsx(wJe,{}),s.jsx(jJe,{}),s.jsx("section",{className:"yt-final yt-on-night","aria-labelledby":"yt-final-title",children:s.jsxs("div",{className:"yt-container",children:[s.jsxs("h2",{className:"yt-h2",id:"yt-final-title",children:["Keep making videos. ",s.jsx("span",{className:"yt-grad",children:"Let your AI take the questions."})]}),s.jsx("p",{className:"yt-lede",children:"Add a few videos, share one link, and see what your viewers want to know."}),s.jsxs("div",{className:"yt-hero-actions",children:[s.jsx("a",{className:"yt-button",href:Qb,children:"Create your AI free"}),s.jsx("a",{className:"yt-button yt-button-ghost",href:"/pricing",children:"See pricing"})]})]})})]}),s.jsx("footer",{className:"yt-footer",children:s.jsx("div",{className:"yt-container",children:s.jsxs("div",{className:"yt-footer-row",children:[s.jsx("a",{href:"/welcome",children:s.jsx("img",{src:"/brand/logo-flat.svg",width:"120",height:"48",alt:"Great Experts home"})}),s.jsxs("nav",{"aria-label":"Footer",children:[s.jsx("a",{href:"/pricing",children:"Pricing"}),s.jsx("a",{href:"/privacy",children:"Privacy"}),s.jsx("a",{href:"/terms",children:"Terms"}),s.jsx("a",{href:"/login",children:"Log in"})]})]})})})]})}function kJe(){const e=Ps(),{user:t}=Ut(),n=mK({enabled:!!t}),{draftExperts:r,isDraftsLoading:a,draftsError:i}=n,[o,l]=f.useState(!1),c=tl,u="New expert",d=f.useMemo(()=>r.map(m=>`${m.id}:${m.updated_at||""}`).join("|"),[r]);f.useEffect(()=>{if(!t?.id||a||i||r.length===0||!d)return;const m=`gs_draft_reminder_seen_${t.id}_${d}`;try{if(sessionStorage.getItem(m))return;sessionStorage.setItem(m,"1")}catch{}l(!0)},[r.length,d,i,a,t?.id]);const h=()=>{l(!1),e("/lab/experts?filter=draft")},p=m=>{l(!1),e(`${Me.CREATE_EXPERT}?draft=${encodeURIComponent(m)}`)};return s.jsxs("div",{className:"flex min-h-full w-full flex-col gap-6 pb-8",children:[s.jsxs("header",{className:"ge-surface flex flex-wrap items-center gap-x-5 gap-y-3 px-5 py-3 sm:px-7",children:[s.jsxs("h1",{className:"min-w-0 font-heading text-[28px] font-normal leading-[1.1] tracking-[-0.018em] text-ink",children:["My ",s.jsx("em",{className:"italic text-indigo",children:"experts"})]}),s.jsx("div",{className:"ml-auto flex items-center gap-2 sm:gap-2.5",children:s.jsxs("button",{type:"button",onClick:()=>e(c),className:"inline-flex h-10 shrink-0 items-center gap-2 whitespace-nowrap rounded-pill border-none bg-indigo px-5 text-[13px] font-semibold text-cream shadow-[inset_0_1px_0_rgba(255,255,255,0.42),0_16px_32px_-18px_rgba(61,61,245,0.85)] transition-colors duration-200 ease-standard hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus",children:[s.jsx(Es,{className:"w-4 h-4","aria-hidden":"true"}),u]})})]}),s.jsx(vh,{context:n}),s.jsx(NJe,{drafts:r,isOpen:o,onClose:()=>l(!1),onViewDrafts:h,onResumeDraft:p})]})}function NJe({drafts:e,isOpen:t,onClose:n,onViewDrafts:r,onResumeDraft:
430a}){const i=e.length;return s.jsx(en,{isOpen:t,onClose:n,title:`You have ${i} draft expert${i!==1?"s":""}`,maxWidth:"max-w-lg",children:s.jsxs("div",{className:"space-y-5",children:[s.jsx("p",{className:"text-sm leading-relaxed text-ink-mid",children:"These experts already have knowledge attached. Finish setup when you're ready to publish them."}),s.jsx("div",{className:"max-h-72 overflow-y-auto divide-y divide-rule",children:e.map(o=>s.jsxs("div",{className:"flex items-center gap-3 py-3",children:[s.jsx(ws,{name:o.name,size:"md",variant:"expert",src:o.avatar_url,className:"shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-heading text-sm font-medium text-ink truncate",children:o.name}),s.jsxs("p",{className:"mt-0.5 flex items-center gap-1 text-xs text-ink-light",children:[s.jsx(Ou,{className:"w-3 h-3"}),Jm(o)," source",Jm(o)!==1?"s":""]})]}),s.jsxs("button",{type:"button",onClick:()=>a(o.id),className:"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium text-indigo hover:bg-indigo-wash transition-colors",children:[s.jsx(Du,{className:"w-3.5 h-3.5"}),"Resume"]})]},o.id))}),s.jsxs("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[s.jsx(yt,{variant:"secondary",onClick:n,children:"Later"}),s.jsx(yt,{onClick:r,children:"View drafts"})]})]})})}function EJe({drafts:e=[],isLoading:t=!1,error:n="",query:r="",onDeleted:a}){const i=Ps(),[o,l]=f.useState(""),[c,u]=f.useState(null),d=f.useMemo(()=>fke(e,r),[e,r]),h=async m=>{u(m),l("");try{await T_(m),a?.(m)}catch{l("Could not delete draft.")}finally{u(null)}};if(t)return s.jsx("div",{"aria-label":"Loading drafts","aria-busy":"true",className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Array.from({length:3},(m,g)=>s.jsx("div",{className:"card min-h-64 p-5",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"ge-skeleton h-12 w-12 rounded-full bg-cream-deep"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("div",{className:"ge-skeleton h-5 w-2/3 rounded-sm bg-cream-deep"}),s.jsx("div",{className:"ge-skeleton h-3 w-1/3 rounded-sm bg-cream-deep"})]})]})},g))});const p=o||n;return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("p",{className:"font-mono text-[11px] uppercase tracking-[0.14em] text-ink-muted","aria-live":"polite",children:[d.length," draft",d.length!==1?"s":""," in progress"]})}),p&&s.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-peach-tint px-4 py-3 text-sm text-destructive",children:p}),d.length===0?s.jsxs("div",{className:"flex flex-col items-start justify-center border-y border-rule py-16 text-left",children:[s.jsx("p",{className:"font-heading text-2xl font-medium tracking-[-0.015em] text-ink",children:r?"No draft experts found":"No draft experts in progress"}),s.jsx("p",{className:"mt-2 max-w-[65ch] text-sm leading-relaxed text-ink-mid",children:r?"Try a different search.":"Drafts appear here once you add knowledge or links."})]}):s.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:d.map(m=>s.jsxs("article",{className:"card card-hover flex min-h-64 min-w-0 flex-col p-5",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-4",children:[s.jsx(ws,{name:m.name,size:"xl",variant:"expert",src:m.avatar_url,className:"shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("h3",{className:"min-w-0 truncate font-heading text-xl font-medium leading-tight tracking-[-0.015em] text-ink",children:m.name}),s.jsx("span",{className:"shrink-0 rounded-pill border border-rule bg-cream-deep px-2.5 py-1 text-[11px] font-medium text-ink-mid",children:"Draft"})]}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[10px] tabular-nums text-ink-muted",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Ou,{className:"w-3 h-3"}),Jm(m)," source",Jm(m)!==1?"s":""]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Rf,{className:"w-3 h-3"}
430),"Updated ",gke(m.updated_at)]})]})]})]}),s.jsx("p",{className:"mt-5 line-clamp-3 text-sm leading-[1.6] text-ink-mid",children:m.tagline||m.description||"Continue setup to define this expert."}),s.jsxs("div",{className:"mt-auto flex items-center justify-between border-t border-rule pt-4",children:[s.jsxs(yt,{variant:"ink",onClick:()=>i(`${Me.CREATE_EXPERT}?draft=${encodeURIComponent(m.id)}`),className:"h-11 whitespace-nowrap !rounded-pill px-5 text-sm",children:[s.jsx(Du,{className:"w-4 h-4"}),"Resume"]}),s.jsx("button",{type:"button",onClick:()=>h(m.id),disabled:c===m.id,className:"inline-flex h-11 w-11 items-center justify-center rounded-pill text-ink-mid transition-colors duration-fast ease-standard hover:bg-peach-tint hover:text-destructive focus-visible:outline-none focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-50","aria-label":`Delete ${m.name}`,children:c===m.id?s.jsx("div",{className:"h-4 w-4 rounded-full border-2 border-rule border-t-destructive animate-spin"}):s.jsx(Qs,{className:"w-4 h-4"})})]})]},m.id))})]})}function SJe(e){if(!e)return[];if(e.is_team_expert)return[{key:"free",label:"Free",tone:"green"}];const t=[];return e.has_subscription&&t.push({key:"sub",label:"Subscription",tone:"peach"}),t}const IB={green:"bg-emerald-50 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300",indigo:"bg-indigo-wash text-indigo-deep",peach:"bg-peach-tint text-peach-deep"};function HP({expert:e,className:t="",direction:n="col"}){const r=SJe(e);return r.length===0?null:s.jsx("div",{className:`flex ${n==="row"?"flex-row gap-1.5":"flex-col gap-0.5"} shrink-0 ${t}`,children:r.map(({key:a,label:i,tone:o})=>s.jsx("span",{className:`inline-flex items-center justify-center rounded-md px-1.5 py-0.5 text-[10.5px] font-medium leading-none whitespace-nowrap ${IB[o]||IB.indigo}`,children:i},a))})}function K0({isOpen:e,onClose:t,subjectName:n,url:r,blurb:a,headline:i,subline:o}){const[l,c]=f.useState(!1),u=encodeURIComponent(r||""),d=encodeURIComponent(a||""),h=encodeURIComponent(n||""),p=[{id:"whatsapp",label:"WhatsApp",href:`https://wa.me/?text=${d}%20${u}`,Icon:ni,tone:"bg-[#25D366]/10 text-[#1FAD53] hover:bg-[#25D366]/15"},{id:"x",label:"X / Twitter",href:`https://twitter.com/intent/tweet?text=${d}&url=${u}`,Icon:Pwe,tone:"bg-ink/5 text-ink hover:bg-ink/10 dark:bg-white/5 dark:text-white dark:hover:bg-white/10"},{id:"facebook",label:"Facebook",href:`https://www.facebook.com/sharer/sharer.php?u=${u}`,Icon:oY,tone:"bg-[#1877F2]/10 text-[#1877F2] hover:bg-[#1877F2]/15"},{id:"linkedin",label:"LinkedIn",href:`https://www.linkedin.com/sharing/share-offsite/?url=${u}`,Icon:pY,tone:"bg-[#0A66C2]/10 text-[#0A66C2] hover:bg-[#0A66C2]/15"},{id:"telegram",label:"Telegram",href:`https://t.me/share/url?url=${u}&text=${d}`,Icon:$u,tone:"bg-[#0088cc]/10 text-[#0088cc] hover:bg-[#0088cc]/15"},{id:"email",label:"Email",href:`mailto:?subject=${h}&body=${d}%0A%0A${u}`,Icon:qr,tone:"bg-slate-200/60 text-slate-700 hover:bg-slate-300/60 dark:bg-white/10 dark:text-neutral-200 dark:hover:bg-white/15"}],m=()=>{c(!1),t()},g=()=>{r&&(navigator.clipboard.writeText(r),c(!0),setTimeout(()=>{c(!1),t()},900))},x=()=>t();return s.jsx(en,{isOpen:e,onClose:m,maxWidth:"max-w-sm",backdropClassName:"bg-ink/65 backdrop-blur-sm",backdropZ:"z-[100]",contentZ:"z-[110]",children:s.jsxs("div",{className:"flex flex-col text-left",children:[s.jsx("h2",{className:"text-lg font-bold text-slate-900 dark:text-white mb-1",children:i||`Share ${n}`}),s.jsx("p",{className:"text-sm text-slate-500 dark:text-neutral-400 mb-5",children:o||`Know someone who'd find this useful? Send ${n} their way.`}),s.jsx("div",{className:"grid grid-cols-3 gap-2 mb-4",children:p.map(({id:b,label:y,href:v,Icon:w,tone:j})=>s.jsxs("a",{href:v,target:"_blank",rel:"noopener noreferrer",onClick:x,className:`flex flex-col items-center justify-center gap-2 py-4 rounded-xl text-xs font-medium transition-colors ${j}`,children:[s.jsx(w,{size:22}),s.jsx("span",{children:y})]},b))}),s.jsxs("button",{onClick:g,className:`flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-medium transition-colors ${l?"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300":"bg-slate-50 text-slate-700 hover:bg-slate-100 dar
430k:bg-white/5 dark:text-neutral-200 dark:hover:bg-white/10"}`,children:[l?s.jsx(ft,{size:18}):s.jsx($a,{size:18}),s.jsx("span",{className:"flex-1 text-left",children:l?"Link copied to clipboard":"Copy link"}),s.jsx("span",{className:"text-xs text-slate-400 dark:text-neutral-500 truncate max-w-[140px]",children:(r||"").replace(/^https?:\/\//,"")})]})]})})}function X0({expert:e,label:t="Share",children:n}){const[r,a]=f.useState(!1),{user:i}=Ut();if(!e)return null;const o=i?.id||i?.user_id,l=e.user_id||e.creator_id;if((e.is_public===!1||e.is_public===0)&&!!!(o&&l&&o===l))return null;const d=`${window.location.origin}/experts/${e.slug||e.id}/chat`,h=e.name,p=`I found a thoughtful AI expert worth trying â ${e.name}${e.primary_category?` (${e.primary_category})`:""}. Have a chat:`,m=()=>a(!0),g=()=>a(!1),x=y=>y.stopPropagation(),b=typeof n=="function"?n({openShare:m}):s.jsx("button",{type:"button",onClick:y=>{x(y),m()},className:"px-4 py-2 rounded-md text-xs font-medium uppercase tracking-eyebrow bg-indigo-wash text-indigo-deep hover:bg-indigo-tint transition-colors",children:t});return s.jsxs(s.Fragment,{children:[b,s.jsx(K0,{isOpen:r,onClose:g,subjectName:h,url:d,blurb:p})]})}function CJe({expert:e,isOpen:t,onClose:n,context:r="own"}){const a=Ps(),i=r==="own",o=e?e.slug||e.id:"",l=e?`/experts/${o}/chat`:"",c=()=>{n(),a(l)},u=()=>{n(),a(`/experts/${o}/edit`)};return s.jsx(en,{isOpen:t,onClose:n,maxWidth:"max-w-md",children:e&&s.jsxs("div",{className:"flex flex-col items-center text-center",children:[s.jsxs("div",{className:"mb-5 flex w-full items-center justify-between",children:[s.jsx("h2",{className:"font-heading text-2xl font-medium tracking-[-0.015em] text-ink",children:"Expert profile"}),s.jsx(X0,{expert:e})]}),s.jsx("div",{className:"mb-4",children:s.jsx(ws,{name:e.name,size:"2xl",variant:"expert",src:e.avatar_url})}),s.jsx("h3",{className:"mb-1 font-heading text-3xl font-medium tracking-[-0.02em] text-ink",children:e.name}),!i&&e.creator_name&&s.jsxs("p",{className:"text-sm text-ink-mid",children:["By ",e.creator_name]}),e.primary_category&&s.jsxs("div",{className:"flex items-center gap-1.5 mt-3",children:[s.jsx("span",{className:"rounded-pill border border-rule bg-cream-deep px-3 py-1 text-xs font-medium text-ink-mid",children:e.primary_category}),e.secondary_category&&s.jsx("span",{className:"rounded-pill border border-rule bg-cream-deep px-3 py-1 text-xs font-medium text-ink-mid",children:e.secondary_category})]}),s.jsx("div",{className:"relative mt-5 w-full rounded-lg border border-rule bg-cream-deep text-left",children:s.jsx("div",{className:"p-4 max-h-40 overflow-y-auto custom-scrollbar",id:"desc-scroll",children:s.jsx("p",{className:"text-sm leading-[1.6] text-ink-mid",children:e.description})})}),s.jsxs("div",{className:"mt-4 flex items-center justify-center gap-6 font-mono text-[11px] tabular-nums text-ink-muted",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ea,{size:14})," ",e.answer_count||0]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(eo,{size:14})," ",e.thumbs_up||0]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(wc,{size:14})," ",e.thumbs_down||0]})]}),s.jsxs("div",{className:"mt-6 flex w-full flex-wrap items-center justify-center gap-2",children:[s.jsxs("button",{type:"button",onClick:c,className:"inline-flex h-11 flex-1 items-center justify-center gap-2 whitespace-nowrap rounded-pill bg-ink px-5 text-sm font-medium text-cream transition-colors duration-fast ease-standard hover:bg-ink-soft focus-visible:outline-none focus-visible:shadow-focus active:translate-y-px",children:[s.jsx(ea,{size:18}),"Start chat"]}),i&&s.jsxs("button",{type:"button",onClick:u,className:"inline-flex h-11 items-center justify-center gap-2 whitespace-nowrap rounded-pill border border-rule bg-paper px-5 text-sm font-medium text-ink-mid transition-colors duration-fast ease-standard hover:bg-cream-deep hover:text-ink focus-visible:outline-none focus-visible:shadow-focus active:translate-y-px",children:[s.jsx(EY,{size:16})," Settings"]})]})]})})}const oS=9,TJe=["Experts","Drafts"],PB=[{value:"updated",label:"Recently updated"},{value:"newest",label:"Newest"},{value:"popular",label:"Most popular"},{value:"name",label:"Name (AâZ)"}],AJe=Dn.button,RJe=Dn.div;function IJe(e,t){if(t<=7)return Array.from({length:t},(r,a)=>a+1);const n=[1];e>3&&n.push("...");for(let r=Math.max(2,e-1);r<=Math.min(t-1,e+1);r++)n.push(r);return e<t-2&&n.push("..."),n.push(t),n}function LB(e,t){return t&&new URLSearchParams(e).get("filter")==="draft"?"Drafts":"Experts"}function OB(){const e=Ps(),t=an(),n=l_()||{},r=t.pathname.startsWith("/lab"),{user:a}=Ut(),{experts:i,isLoading:o,fetchExperts:l}=jc(),{draftExperts:c=[],isDraftsLoading:u=!1,draftsError:d="",removeDraftExpert:h}=n,p=f.useMemo(()=>i.filter(G=>G.status==="active"),[i]),[m,g]=f.useState(""),[x,b]=f.useState(()=>LB(t.search,r)),[y,v]=f.useState("updated"),[w,j]=f.useState(()=>window.innerWidth<640?"grid":"list"),E=r&&x==="Drafts";f.useEffect(()=>{const G=()=>{j(window.innerWidth<640?"grid":"list")};return window.addEventListener("resize",G),()=>window.removeEventListener("resize",G)},[]);const[S,_]=f.useState(null),[k,C]=f.useState(!1),N=G=>{_(G),C(!0)},A=()=>{C(!1),setTimeout(()=>_(null),250)},[T,I]=f.useState(1);f.useEffect(()=>{l()},[l]),f.useEffect(()=>{if(!r&&x==="Drafts"){b("Experts");return}const G=LB(t.search,r);G!==x&&b(G)},[r,x,t.search]),f.useEffect(()=>{I(1)},[x,m,y]);const $=f.useMemo(()=>
430{if(E)return[];let G=p;if(m){const z=m.toLowerCase();G=G.filter(W=>W.name?.toLowerCase().includes(z)||W.description?.toLowerCase().includes(z))}const M=[...G];return y==="updated"?M.sort((z,W)=>new Date(W.updated_at)-new Date(z.updated_at)):y==="newest"?M.sort((z,W)=>new Date(W.created_at)-new Date(z.created_at)):y==="popular"?M.sort((z,W)=>(W.answer_count||0)-(z.answer_count||0)):y==="name"&&M.sort((z,W)=>(z.name||"").localeCompare(W.name||"")),M},[p,E,m,y]),O=Math.ceil($.length/oS),U=$.slice((T-1)*oS,T*oS),F=G=>{I(G),window.scrollTo({top:0,behavior:"smooth"})},H=G=>{if(b(G),!r)return;const M=new URLSearchParams(t.search);G==="Drafts"?M.set("filter","draft"):M.delete("filter");const z=M.toString(),W=`${t.pathname}${z?`?${z}`:""}`;`${t.pathname}${t.search}`!==W&&e(W,{replace:!0})};return a?o?s.jsx(OJe,{}):s.jsxs("div",{className:"space-y-6",children:[s.jsx("section",{"aria-label":"Expert library controls",className:"py-4",children:s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[s.jsxs("div",{className:"group relative min-w-0 flex-1 sm:max-w-2xl",children:[s.jsx("label",{htmlFor:"expert-search",className:"sr-only",children:"Search experts"}),s.jsx(Fa,{className:"pointer-events-none absolute left-5 top-1/2 h-4 w-4 -translate-y-1/2 text-ink-light transition-colors duration-fast ease-standard group-focus-within:text-indigo"}),s.jsx("input",{id:"expert-search",type:"search",value:m,onChange:G=>g(G.target.value),placeholder:"Search by name or description",className:"h-[54px] w-full appearance-none rounded-pill border border-rule bg-paper pl-12 pr-12 text-sm text-ink outline-none transition-[background-color,border-color] duration-fast ease-standard placeholder:text-ink-muted hover:bg-cream-deep focus:border-indigo focus:bg-paper focus:shadow-focus [&::-webkit-search-cancel-button]:appearance-none"}),s.jsx(Ei,{children:m&&s.jsx(AJe,{type:"button","aria-label":"Clear search",initial:{opacity:0}
430,animate:{opacity:1},exit:{opacity:0},transition:{duration:.12},onClick:()=>g(""),className:"absolute right-1 top-1/2 flex h-11 w-11 -translate-y-1/2 items-center justify-center rounded-pill text-ink-mid transition-colors duration-fast ease-standard hover:bg-indigo-wash hover:text-indigo-deep focus-visible:outline-none focus-visible:shadow-focus",children:s.jsx(as,{size:16})})})]}),r?s.jsx("div",{className:"flex shrink-0 items-center gap-1 rounded-pill border border-rule bg-cream-deep p-1 sm:ml-auto",role:"tablist","aria-label":"Expert library view",children:TJe.map(G=>{const M=x===G,z=G==="Drafts"?c.length:p.length;return s.jsxs("button",{type:"button",role:"tab","aria-selected":M,onClick:()=>H(G),className:`inline-flex h-11 items-center gap-2 whitespace-nowrap rounded-pill px-4 text-sm font-medium transition-colors duration-fast ease-standard focus-visible:outline-none focus-visible:shadow-focus ${M?"bg-ink text-cream shadow-subtle":"text-ink-mid hover:bg-paper hover:text-ink"}`,children:[G,s.jsx("span",{className:`font-mono text-[10px] tabular-nums ${M?"text-cream/70":"text-ink-muted"}`,children:z})]},G)})}):s.jsxs("button",{type:"button",onClick:()=>e(tl),className:"inline-flex h-11 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-pill border border-indigo bg-indigo px-5 text-sm font-medium text-cream transition-colors duration-fast ease-standard hover:border-indigo-deep hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus active:translate-y-px",children:[s.jsx(Es,{className:"h-4 w-4"}),"New expert"]})]})}),E?s.jsx(EJe,{drafts:c,isLoading:u,error:d,query:m,onDeleted:h}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("p",{className:"font-mono text-[11px] uppercase tracking-[0.14em] text-ink-muted","aria-live":"polite",children:[$.length," expert",$.length!==1?"s":"",m&&s.jsxs(s.Fragment,{children:[" matching â",m,"â"]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(LJe,{value:y,onChange:v}),s.jsxs("div",{className:"hidden items-center gap-0.5 rounded-pill border border-rule bg-cream-deep p-0.5 sm:flex","aria-label":"Expert display",children:[s.jsx("button",{type:"button","aria-label":"Grid view","aria-pressed":w==="grid",onClick:()=>j("grid"),className:`flex h-11 w-11 items-center justify-center rounded-pill transition-colors duration-fast ease-standard focus-visible:outline-none focus-visible:shadow-focus ${w==="grid"?"bg-paper text-ink shadow-subtle":"text-ink-light hover:bg-paper hover:text-ink-mid"}`,children:s.jsx(hY,{size:15})}),s.jsx("button",{type:"button","aria-label":"List view","aria-pressed":w==="list",onClick:()=>j("list"),className:`flex h-11 w-11 items-center justify-center rounded-pill transition-colors duration-fast ease-standard focus-visible:outline-none focus-visible:shadow-focus ${w==="list"?"bg-paper text-ink shadow-subtle":"text-ink-light hover:bg-paper hover:text-ink-mid"}`,children:s.jsx(mY,{size:15})})]})]})]}),s.jsx(Ei,{mode:"wait",children:s.jsxs(RJe,{initial:{opacity:0}
430,animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[U.length===0?s.jsxs("div",{className:"flex flex-col items-start justify-center border-y border-rule py-16 text-left",children:[s.jsx("p",{className:"font-heading text-2xl font-medium tracking-[-0.015em] text-ink",children:m?"No experts found":"No experts yet"}),s.jsx("p",{className:"mt-2 max-w-[65ch] text-sm leading-relaxed text-ink-mid",children:m?"Try a different search.":"Create your first AI expert to get started."}),!m&&s.jsxs("button",{type:"button",onClick:()=>e(tl),className:"mt-5 inline-flex h-11 items-center gap-2 whitespace-nowrap rounded-pill border border-indigo bg-indigo px-5 text-sm font-medium text-cream transition-colors duration-fast ease-standard hover:border-indigo-deep hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus active:translate-y-px",children:[s.jsx(Es,{className:"w-4 h-4"}),"Create expert"]})]}):w==="grid"?s.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:U.map(G=>s.jsx(MB,{expert:G,onClick:()=>N(G)},G.id))}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-1 gap-4 sm:hidden",children:U.map(G=>s.jsx(MB,{expert:G,onClick:()=>N(G)},G.id))}),s.jsx("div",{className:"hidden divide-y divide-rule border-y border-rule sm:block",children:U.map(G=>s.jsx(PJe,{expert:G,onClick:()=>N(G)},G.id))})]}),O>1&&s.jsxs("nav",{"aria-label":"Expert pages",className:"flex items-center justify-center gap-1 pt-12",children:[s.jsx("button",{type:"button","aria-label":"Previous page",onClick:()=>F(T-1),disabled:T===1,className:"flex h-11 w-11 items-center justify-center rounded-pill text-ink-light transition-colors duration-fast ease-standard hover:bg-cream-deep hover:text-ink disabled:cursor-not-allowed disabled:opacity-30 focus-visible:outline-none focus-visible:shadow-focus",children:s.jsx(Wh,{size:16})}),IJe(T,O).map((G,M)=>G==="..."?s.jsx("span",{className:"flex h-11 w-8 items-center justify-center text-xs text-ink-light",children:"â¦"},`d${M}`):s.jsx("button",{type:"button","aria-label":`Page ${G}`,"aria-current":G===T?"page":void 0,onClick:()=>F(G),className:`flex h-11 w-11 items-center justify-center rounded-pill font-mono text-xs font-medium transition-colors duration-fast ease-standard focus-visible:outline-none focus-visible:shadow-focus ${G===T?"bg-ink text-cream":"text-ink-mid hover:bg-cream-deep"}`,children:G},G)),s.jsx("button",{type:"button","aria-label":"Next page",onClick:()=>F(T+1),disabled:T===O,className:"flex h-11 w-11 items-center justify-center rounded-pill text-ink-light transition-colors duration-fast ease-standard hover:bg-cream-deep hover:text-ink disabled:cursor-not-allowed disabled:opacity-30 focus-visible:outline-none focus-visible:shadow-focus",children:s.jsx(hn,{size:16})})]})]},x)})]}),s.jsx(CJe,{expert:S,isOpen:k,onClose:A,context:"own"})]}):s.jsxs("div",{className:"flex flex-col items-start border-y border-rule px-1 py-20 text-left",children:[s.jsx(qh,{className:"mb-5 h-10 w-10 text-ink-light"}),s.jsx("h2",{className:"font-heading text-3xl font-medium tracking-[-0.02em] text-ink",children:"Create your own experts"}),s.jsx("p",{className:"mb-6 mt-2 max-w-[65ch] leading-relaxed text-ink-mid",children:"Build custom AI experts with your own knowledge base. Sign up to get started."}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx(yt,{variant:"secondary",onClick:()=>e("/login"),children:"Login"}),s.jsx(yt,{onClick:()=>e(Me.CREATE_EXPERT),children:"Sign up"})]})]})}function MB({expert:e,onClick:t}){const n=Ps();return s.jsxs("article",{className:"card card-hover group flex min-h-[24.5rem] min-w-0 flex-col p-5 sm:min-h-[18rem]",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-4",children:[s.jsx(ws,{name:e.name,size:"xl",variant:"expert",src:e.avatar_url,className:"shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("button",{type:"button",onClick:t,className:"flex min-h-11 min-w-0 items-center truncate rounded-sm font-heading text-xl font-medium leading-tight tracking-[-0.015em] text-ink transition-colors duration-fast ease-standard hover:text-indigo-deep focus-visible:outline-none focus-visible:shadow-focus",children:e.name}),s.jsx(HP,{expert:e})]}),e.tagline&&s.jsx("p",{className:"mt-1 line-clamp-1 text-xs font-medium text-ink-mid",children:e.tagline})]})]}),s.jsx("p",{className:"mt-5 line-clamp-4 text-sm leading-[1.6] text-ink-mid",children:e.description||"No description yet."}),s.jsxs("div",{className:"mt-auto pt-5",children:[s.jsxs("div",{className:"flex items-center gap-4 border-t border-rule py-3 font-mono text-[10px] tabular-nums text-ink-muted",children:[s.jsxs("span",{className:"inline-flex items-center gap-1","aria-label":`${e.answer_
430count||0} answers`,children:[s.jsx(ea,{size:12})," ",e.answer_count||0]}),s.jsxs("span",{className:"inline-flex items-center gap-1","aria-label":`${e.thumbs_up||0} helpful ratings`,children:[s.jsx(eo,{size:12})," ",e.thumbs_up||0]}),s.jsxs("span",{className:"inline-flex items-center gap-1","aria-label":`${e.thumbs_down||0} unhelpful ratings`,children:[s.jsx(wc,{size:12})," ",e.thumbs_down||0]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[s.jsx("button",{type:"button",onClick:()=>n(`/experts/${e.slug||e.id}/chat`),className:"inline-flex h-11 items-center whitespace-nowrap rounded-pill px-4 text-sm font-medium text-indigo-deep transition-colors duration-fast ease-standard hover:bg-indigo-wash focus-visible:outline-none focus-visible:shadow-focus active:translate-y-px",children:"Chat"}),s.jsx("button",{type:"button",onClick:()=>n(`/experts/${e.slug||e.id}/edit`),className:"inline-flex h-11 items-center whitespace-nowrap rounded-pill px-4 text-sm font-medium text-ink-mid transition-colors duration-fast ease-standard hover:bg-cream-deep hover:text-ink focus-visible:outline-none focus-visible:shadow-focus active:translate-y-px",children:"Settings"}),s.jsx(are,{expert:e})]})]})]})}function PJe({expert:e,onClick:t}){const n=Ps();return s.jsxs("article",{className:"group flex items-center gap-5 py-5",children:[s.jsx(ws,{name:e.name,size:"xl",variant:"expert",src:e.avatar_url,className:"shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"mb-0.5 flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("button",{type:"button",onClick:t,className:"flex min-h-11 min-w-0 items-center truncate rounded-sm font-heading text-lg font-medium text-ink transition-colors duration-fast ease-standard hover:text-indigo-deep focus-visible:outline-none focus-visible:shadow-focus",children:e.name}),s.jsx(HP,{expert:e})]}),s.jsx("p",{className:"text-sm text-ink-mid line-clamp-1 leading-relaxed",children:e.description})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-3 font-mono text-[10px] tabular-nums text-ink-muted",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ea,{size:12})," ",e.answer_count||0]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(eo,{size:12})," ",e.thumbs_up||0]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(wc,{size:12})," ",e.thumbs_down||0]})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s.jsx("button",{type:"button",onClick:()=>n(`/experts/${e.slug||e.id}/chat`),className:"inline-flex h-11 items-center whitespace-nowrap rounded-pill px-4 text-sm font-medium text-indigo-deep transition-colors duration-fast ease-standard hover:bg-indigo-wash focus-visible:outline-none focus-visible:shadow-focus",children:"Chat"}),s.jsx("button",{type:"button",onClick:()=>n(`/experts/${e.slug||e.id}/edit`),className:"inline-flex h-11 items-center whitespace-nowrap rounded-pill px-4 text-sm font-medium text-ink-mid transition-colors duration-fast ease-standard hover:bg-cream-deep hover:text-ink focus-visible:outline-none focus-visible:shadow-focus",children:"Settings"}),s.jsx(are,{expert:e})]})]})}function LJe({value:e,onChange:t}){const[n,r]=f.useState(!1),a=f.useRef(null);f.useEffect(()=>{if(!n)return;const o=c=>{a.current&&!a.current.contains(c.target)&&r(!1)},l=c=>{c.key==="Escape"&&r(!1)};return document.addEventListener("mousedown",o),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",l)}},[n]);const i=PB.find(o=>o.value===e)?.label||"Sort";return s.jsxs("div",{className:"relative",ref:a,children:[s.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":n,onClick:()=>r(o=>!o),className:"flex h-11 items-center gap-1.5 whitespace-nowrap rounded-pill border border-rule bg-paper px-4 text-xs text-ink-mid transition-colors duration-fast ease-standard hover:bg-cream-deep hover:text-ink focus-visible:outline-none focus-visible:shadow-focus",children:["Sort: ",s.jsx("span",{className:"font-medium",children:i})," ",s.jsx(Is,{size:13,className:`transition-transform duration-fast ease-standard ${n?"rotate-180":""}`})]}),n&&s.jsx("div",{role:"menu",className:"absolute right-0 z-50 mt-2 min-w-[190px] rounded-lg border border-rule bg-paper p-1 shadow-overlay",children:PB.map(o=>s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":e===o.value,onClick:()=>{t(o.value),r(!1)},className:`flex h-11 w-full items-center justify-between rounded-md px-3 text-sm transition-colors duration-fast ease-standard focus-visible:outline-none focus-visible:shadow-focus ${e===o.value?"bg-indigo-wash font-medium text-indigo-deep":"text-ink-mid hover:bg-cream-deep hover:text-ink"}`,children:[o.label,e===o.value&&s.jsx(ft,{size:14})]},o.value))})]})}
430function are({expert:e}){return s.jsx(X0,{expert:e,children:({openShare:t})=>s.jsxs("button",{type:"button",onClick:t,className:"inline-flex h-11 items-center gap-1.5 whitespace-nowrap rounded-pill px-4 text-sm font-medium text-ink-mid transition-colors duration-fast ease-standard hover:bg-cream-deep hover:text-ink focus-visible:outline-none focus-visible:shadow-focus",children:[s.jsx(Of,{size:14}),s.jsx("span",{children:"Share"})]})})}function OJe(){return s.jsxs("div",{"aria-label":"Loading experts",className:"space-y-6","aria-busy":"true",children:[s.jsx("div",{className:"ge-skeleton h-11 max-w-2xl rounded-md bg-cream-deep"}),s.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Array.from({length:6},(e,t)=>s.jsxs("div",{className:"card min-h-[18rem] p-5",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"ge-skeleton h-12 w-12 shrink-0 rounded-full bg-cream-deep"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("div",{className:"ge-skeleton h-5 w-2/3 rounded-sm bg-cream-deep"}),s.jsx("div",{className:"ge-skeleton h-3 w-1/3 rounded-sm bg-cream-deep"})]})]}),s.jsxs("div",{className:"mt-6 space-y-2",children:[s.jsx("div",{className:"ge-skeleton h-3 w-full rounded-sm bg-cream-deep"}),s.jsx("div",{className:"ge-skeleton h-3 w-11/12 rounded-sm bg-cream-deep"}),s.jsx("div",{className:"ge-skeleton h-3 w-3/4 rounded-sm bg-cream-deep"})]})]},t))})]})}function MJe({className:e=""}){return s.jsxs("svg",{className:e,viewBox:"0 0 120 96",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",children:[s.jsx("ellipse",{cx:"60",cy:"77.5",rx:"27",ry:"4.2",fill:"#141413",opacity:".05"}),s.jsx("ellipse",{cx:"60",cy:"77",rx:"18",ry:"3",fill:"#141413",opacity:".07"}),s.jsx("path",{d:"M26 27Q30 58 42 71Q60 77 78 71Q90 58 94 27Z",fill:"#fdfdfb",stroke:"#141413",strokeOpacity:".09",strokeWidth:".7"}),s.jsx("path",{d:"M26 27Q30 58 42 71Q46 73 51 74Q38 57 35.5 27Z",fill:"#141413",opacity:".04"}),s.jsx("path",{d:"M84.5 27Q83 57 70 74Q75 73 78 71Q90 58 94 27Z",fill:"#ffffff",opacity:".5"}),s.jsx("ellipse",{cx:"60",cy:"26.2",rx:"34",ry:"8",fill:"#e7e2d8"}),s.jsx("ellipse",{cx:"60",cy:"29.2",rx:"34",ry:"8",fill:"#fdfdfb"}),s.jsx("ellipse",{cx:"60",cy:"27",rx:"34",ry:"8",fill:"none",stroke:"#141413",strokeOpacity:".1",strokeWidth:".7"})]})}const jo=Object.freeze({question:"which v60 cup you recommend me ?",answerBefore:"For V60 / filter, get the ",answerProduct:"200ml Mikael Jasin Tasting Cup",answerAfter:" â right size for a single pour-over without drowning the aromatics.",productImage:"/create-expert/mikael-jasin-tasting-cup.png"}),DJe=`${jo.answerBefore}**${jo.answerProduct}**${jo.answerAfter}`;function Uk(e){const t=A3e(e);f.useEffect(()=>{if(!t||document.querySelector(`link[data-page-font="${t}"]`))return;const n=document.createElement("link");n.rel="stylesheet",n.href=t,n.dataset.pageFont=t,document.head.appendChild(n)},[t])}const DB="unbounded",ire="".trim(),$Je=ire||"farouk-lafriqui",FJe=ire?"":"&profile_source=production",lS=Object.freeze({profileStatic:"/create-expert/farouk-profile-static.png",profileUrl:`/creators/${encodeURIComponent($Je)}?preview=1&device=mobile&chrome=iphone&agent_mock=1${FJe}`,profile:null,voicePreview:"/create-expert/farouk-call-preview.png",chatPreview:null,chatAvatar:"https://pub-b149d40d9305498b95104048a0c4835d.r2.dev/page-photos/usr_6c70ddc34b/photo.webp?v=1786642047",product:jo.productImage,productCapture:null,content:[null,null,null]});function BJe({preview:e}){return s.jsxs("div",{className:"ce-voice-phone ce-voice-phone--snapshot",role:"img","aria-label":"Voice expert call preview",children:[s.jsx("div",{className:"ce-voice-snapshot-screen",children:s.jsx("img",{className:"ce-voice-preview-image",src:e,alt:""})}),s.jsx("span",{className:"ce-voice-side-button ce-voice-side-button--mute","aria-hidden":"true"}),s.jsx("span",{className:"ce-voice-side-button ce-voice-side-button--volume-up","aria-hidden":"true"}),s.jsx("span",{className:"ce-voice-side-button ce-voice-side-button--volume-down","aria-hidden":"true"}),s.jsx("span",{className:"ce-voice-side-button ce-voice-side-button--power","aria-hidden":"true"})]})}function UJe({images:e}){return e.profileStatic?s.jsxs("div",{className:"ce-profile-phone","aria-label":"Great Experts profile preview",children:[s.jsx("div",{className:"ce-profile-live-viewport",children:s.jsx("img",{className:"ce-profile-static-image",src:e.profileStatic,alt:"Example creator profile",loading:"eager",draggable:!1,onDragStart:t=>t.preventDefault()})}),s.jsx("span",{className:"ce-profile-side-button ce-profile-side-button--mute","aria-hidden":"true"}),s.jsx("span",{className:"ce-profile-side-button ce-profile-side-button--volume-up","aria-hidden":"true"}),s.jsx("span",{className:"ce-profile-side-button ce-profile-side-button--volume-down","aria-hidden":"true"}),s.jsx("span",{className:"ce-profile-side-button ce-profile-side-button--power","aria-hidden":"true"}),s.jsx("span",{className:"ce-profile-live-island","aria-hidden":"true"})]}):e.profileUrl?s.jsxs("div",{className:"ce-profile-phone","aria-label":"Interactive Great Experts profile preview",children:[s.jsx("div",{className:"ce-profile-live-viewport",children:s.jsx("iframe",{className:"ce-profile-live-frame",src:e.profileUrl,title:"Interactive Farouk profile",loading:"eager",referrerPolicy:"str
430ict-origin-when-cross-origin"})}),s.jsx("span",{className:"ce-profile-side-button ce-profile-side-button--mute","aria-hidden":"true"}),s.jsx("span",{className:"ce-profile-side-button ce-profile-side-button--volume-up","aria-hidden":"true"}),s.jsx("span",{className:"ce-profile-side-button ce-profile-side-button--volume-down","aria-hidden":"true"}),s.jsx("span",{className:"ce-profile-side-button ce-profile-side-button--power","aria-hidden":"true"}),s.jsx("span",{className:"ce-profile-live-island","aria-hidden":"true"})]}):s.jsxs("div",{className:"ce-profile-phone","aria-label":"Modern Great Experts profile preview",children:[s.jsxs("div",{className:"ce-profile-hero",children:[e.profile?s.jsx("img",{className:"ce-profile-media",src:e.profile,alt:"Example creator profile"}):s.jsx("span",{className:"ce-media-placeholder ce-profile-media","aria-hidden":"true"}),s.jsx("span",{className:"ce-phone-island","aria-hidden":"true"}),s.jsx("img",{className:"ce-profile-mark",src:"/brand/logo-mark.svg",alt:""}),s.jsx("button",{type:"button",className:"ce-profile-share","aria-label":"Share preview",children:s.jsx(Of,{size:15})})]}),s.jsxs("div",{className:"ce-profile-content",children:[s.jsx("h3",{children:"Photographer Farouk"}),s.jsxs("p",{children:[s.jsx(Rwe,{size:11,"aria-hidden":"true"})," ",s.jsxs("span",{children:["Two-time world",s.jsx("br",{}),"barista champion"]})]}),s.jsxs("div",{className:"ce-profile-socials","aria-hidden":"true",children:[s.jsx(__,{size:18}),s.jsx(j_,{size:19}),s.jsx(iY,{size:19}),s.jsx(qr,{size:19})]}),s.jsxs("button",{type:"button",className:"ce-call-expert",children:[s.jsx(Ts,{size:16})," Call Photographer Farouk's AI"]}),s.jsxs("div",{className:"ce-profile-tabs","aria-label":"Profile sections",children:[s.jsx("b",{children:"All"}),s.jsx("span",{children:"Ask my AI"}),s.jsx("span",{children:"Services"}),s.jsx("span",{children:"Shop"})]}),s.jsxs("div",{className:"ce-profile-gallery",children:[s.jsx("span",{children:"Photographer"}),s.jsx("h4",{children:"Content"}),s.jsx("div",{children:e.content.map((t,n)=>s.jsxs("figure",{children:[t?s.jsx("img",{src:t,alt:""}):s.jsx("span",{className:"ce-media-placeholder ce-gallery-placeholder","aria-hidden":"true"}),n===0&&s.jsx(Tr,{size:13,fill:"currentColor"})]},t||`empty-media-${n}`))})]})]})]})}function zJe({avatar:e,product:t,productCapture:n,preview:r}){const[a,i]=f.useState(!1);return Uk(DB),r&&!a?s.jsxs("div",{className:"ce-chat-card ce-chat-card--snapshot",role:"img","aria-label":"AI seller chat preview",children:[s.jsx("img",{className:"ce-chat-preview-image",src:r,alt:"",onError:()=>i(!0)}),s.jsxs("div",{className:"ce-chat-snapshot-identity","aria-hidden":"true",children:[s.jsx("img",{src:e,alt:""}),s.jsxs("span",{children:[s.jsx("b",{children:"Farouk"}),s.jsxs("small",{children:["Powered by ",s.jsx("u",{children:"Great Experts"})]})]})]})]}):s.jsxs("div",{className:"ce-chat-card",style:{fontFamily:JR(DB)},"aria-label":"AI seller chat preview",inert:!0,children:[s.jsxs("header",{className:"ce-chat-head",children:[e?s.jsx("img",{src:e,alt:""}):s.jsx("div",{className:"ce-media-placeholder ce-chat-avatar-placeholder","aria-hidden":"true"}),s.jsxs("span",{className:"ce-chat-identity",children:[s.jsx("b",{children:"Farouk"}),s.jsxs("small",{children:["Powered by ",s.jsx("span",{className:"ce-chat-link",children:"Great Experts"})]})]}),s.jsxs("button",{type:"button",className:"ce-chat-contact",children:[s.jsx(I_,{size:8,fill:"currentColor",strokeWidth:0,"aria-hidden":"true"})," Contact"]}),s.jsx(HT,{className:"ce-chat-head-icon",size:9,strokeWidth:1.7}),s.jsx(xl,{className:"ce-chat-head-icon",size:11,strokeWidth:1.35})]}),s.jsxs("div",{className:"ce-chat-thread",children:[s.jsx("div",{className:"ce-chat-question",children:jo.question}),s.jsxs("div",{className:"ce-chat-answer",children:[jo.answerBefore,s.jsx("b",{children:jo.answerProduct}),jo.answerAfter]}),t?s.jsx("img",{className:"ce-chat-product",src:t,alt:"Example product recommended by the expert"}):n?s.jsx("span",{className:"ce-chat-product ce-chat-product--capture",children:s.jsx("img",{src:n,alt:"120ml Cortado Cup in Ivory"})}):s.jsx("span",{className:"ce-chat-product ce-chat-product--drawn","aria-hidden":"true",children:s.jsx(MJe,{className:"ce-chat-cup"})})]}),s.jsxs("div",{className:"ce-chat-composer",children:[s.jsx(Es,{size:10,strokeWidth:1.9,"aria-hidden":"true"}),s.jsx("span",{children:"Ask anything..."}),s.jsxs("button",{type:"button",children:[s.jsx(Ts,{size:11,strokeWidth:1.85})," Call"]})]}),s.jsxs("p",{className:"ce-chat-legal",children:["AI chat. Messages are stored and analyzed."," ",s.jsx("span",{className:"ce-chat-link",children:"Privacy"})," · ",s.jsx("span",{className:"ce-chat-link",children:"Terms"})]})]})}
430function HJe({images:e=lS,className:t=""}){const n={...lS,...e,content:e.content||lS.content};return s.jsxs("aside",{className:`ce-product-showcase ${t}`,"aria-label":"What your Great Experts profile can become",children:[s.jsx("div",{className:"ce-product-stage-shell",children:s.jsxs("div",{className:"ce-product-stage",children:[s.jsx(BJe,{preview:n.voicePreview}),s.jsx(UJe,{images:n}),s.jsx(zJe,{avatar:n.chatAvatar,product:n.product,productCapture:n.productCapture,preview:n.chatPreview})]})}),s.jsxs("div",{className:"ce-showcase-cite",children:[s.jsxs("blockquote",{className:"ce-showcase-quote",children:["â",s.jsx("strong",{children:"I never thought I could get both,"})," a modern profile and a smart agent",s.jsx("br",{}),"that knows about me, sells me and my products.â"]}),s.jsx("div",{className:"ce-showcase-byline",children:s.jsxs("p",{children:[s.jsx("strong",{children:"Farouk Lafriqui"}),s.jsx("span",{children:"AI Product Specialist & Coffee enthusiast"})]})})]})]})}function qP({initialUsername:e="",deferProfileSave:t=!1,previewMode:n=!1,takenUsername:r="",onContinue:a}){return s.jsxs("section",{className:"ce-pre-journey ce-entry-screen",children:[s.jsx("div",{className:"ce-entry-copy",children:s.jsxs("div",{className:"ce-entry-main",children:[s.jsx("img",{className:"ce-entry-logo",src:"/brand/greatexperts-wordmark-indigo.png",alt:"Great Experts"}),s.jsxs("div",{className:"ce-entry-pitch",children:[s.jsxs("h1",{children:[s.jsx("span",{children:"Turn your social presence"})," ",s.jsxs("span",{children:["into a ",s.jsx("em",{className:"ge-em",children:"smart profile"})," that sells"]})]}),s.jsxs("p",{className:"ce-entry-benefits",children:[s.jsx("span",{children:"You'll get a professional profile, 24/7 seller,"}),s.jsxs("span",{children:["agent speaks your voice, store, leads and ",s.jsx("strong",{children:"much more"})]})]})]}),s.jsx(Pne,{initialUsername:e,deferProfileSave:t,previewMode:n,takenUsername:r,onContinue:a})]})}),s.jsx(HJe,{})]})}function Ru({label:e,children:t,tone:n="dark",width:r=280,placement:a="bottom"}){const i=f.useRef(null),o=f.useId(),l=f.useRef(null),[c,u]=f.useState(!1),[d,h]=f.useState(null);return f.useLayoutEffect(()=>{if(!c)return;const p=l.current.getBoundingClientRect(),m=Math.min(r,window.innerWidth-24);h({width:m,left:Math.max(12,Math.min(p.right-m,window.innerWidth-m-12)),top:p.bottom+8})},[c,r]),f.useLayoutEffect(()=>{if(!c||a!=="top"||!i.current||!d)return;const m=l.current.getBoundingClientRect().top-8-i.current.offsetHeight;m>=12&&Math.abs(d.top-m)>1&&h(g=>({...g,top:m}))},[c,a,d]),f.useEffect(()=>{if(!c)return;const p=()=>u(!1),m=x=>{x.key==="Escape"&&p()},g=x=>{l.current?.contains(x.target)||p()};return document.addEventListener("keydown",m),document.addEventListener("pointerdown",g),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{document.removeEventListener("keydown",m),document.removeEventListener("pointerdown",g),window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[c]),s.jsxs(s.Fragment,{children:[s.jsx("button",{ref:l,type:"button","aria-label":e,"aria-describedby":c?o:void 0,onMouseEnter:()=>u(!0),onMouseLeave:()=>{document.activeElement!==l.current&&u(!1)},onFocus:()=>u(!0),onBlur:()=>u(!1),onClick:()=>u(!0),className:`grid h-8 w-8 place-items-center rounded-full focus-visible:outline-none focus-visible:shadow-focus ${n==="indigo"?"text-indigo hover:bg-indigo-wash hover:text-indigo-deep":"text-ink-muted hover:bg-cream-deep hover:text-ink"}`,children:s.jsx(al,{className:"h-4 w-4","aria-hidden":"true"})}),c&&d&&Mn.createPortal(s.jsx("span",{ref:i,id:o,role:"tooltip",style:d,className:{light:"fixed z-[150] block rounded-2xl border border-rule bg-paper px-4 py-3.5 text-[13px] leading-[1.5] text-ink-mid shadow-[0_18px_44px_-18px_rgba(20,20,19,0.28)]",indigo:"fixed z-[150] rounded-lg bg-indigo px-3 py-2 text-xs leading-5 text-white shadow-overlay"}[n]||"fixed z-[150] rounded-lg bg-ink px-3 py-2 text-xs leading-5 text-paper shadow-overlay",children:t}),document.body)]})}function qJe({connector:e,connecting:t=!1,savedHandle:n="",allowConnect:r=!0,disabledConnectLabel:a="Coming soon",onCancel:i,onConnect:o,onSaveHandle:l}){const{name:c,signInVia:u,Icon:d}=e,h=u||c,[p,m]=f.useState(()=>ru(n,e.key)),g=f.useRef(n),[x,b]=f.useState(!1),[y,v]=f.useState("");f.useEffect(()=>{const j=E=>{E.key==="Escape"&&i?.()};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[i]);const w=async()=>{const j=ru(p,e.key),E=IG(j,e.key);if(E){v(E);return}b(!0),v("");try{const S=g.current,_=S&&ru(S,e.key)===j?S:j;await l?.(j,_)}catch(S){v(S?.message||"Could not save that username or link.")}finally{b(!1)}};return Mn.createPortal(s.jsx("div",{className:"ce-add-scrim",onClick:i,role:"presentation",children:s.jsxs("section",{className:"ce-add-sheet",role:"dialog","aria-modal":"true","aria-label":`Add ${c}`,onClick:j=>j.stopPropagation(),children:[s.jsx("button",{type:"button",className:"ce-add-close",onClick:i,"aria-label":"Close",children:s.jsx(as,{size:18,strokeWidth:2,"aria-hidden":"true"})}),s.jsxs("div",{className:"ce-add-pair",children:[s.jsx("span",{className:"ce-add-slot",children:s.jsx("img",{src:"/brand/greatexperts-mark-indigo.png",alt:"",className:"ce-add-ge"})}),s.jsx(xn,{className:"ce-add-arrow",size:20,strokeWidth:1.75,"aria-hidden":"true"}),s.jsx("span",{className:"ce-add-slot",children:s.jsx(d,{size:52})})]}),s.jsx("p",{className:"ce-add-lede",children:r?"Verify this account is yours.":"Verify this account is yours, or add its username or link."}),s.jsxs("div",{className:"ce-add-card",children:[s.jsxs("h3",{children:["Verify ",c]}),s.jsxs("ul",{className:"ce-add-points",children:[s.jsxs("li",{children:[s.jsx(ft,{size:15,strokeWidth:2.2,"aria-hidden":"true"}),"The profile stays linked to your Great Experts page."]}),s.jsxs("li",{children:[s.jsx(ft,{size:15,strokeWidth:2.2,"aria-hidden":"true"}),"Visitors can trust this account is yours"]}),s.jsxs("li",{children:[s.jsx(ft,{size:15,strokeWidth:2.2,"aria-hidden":"true"}),"Your credentials remain with the platform and are never shared with us."]})]}),s.jsx("button",{type:"button",className:`ce-add-connect${r?"":" is-soon"}`,onClick:o,disabled:t||!r,children:t?s.jsxs(s.Fragment,{children:[s.jsx(vt,{size:16,className:"animate-spin","aria-hidden":"true"}),"Sending you to ",h,"â¦"]}):r?`Verify with ${h}`:a})]}),r?null:s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"ce-add-or",children:"or"}),s.jsxs("div",{className:"ce-add-alt",children:[s.jsx("h3",{children:"Add a username or link"}),s.jsxs("div",{className:`ce-add-field${y?" is-error":""}`,children:[rh(p)?null:s.jsx("span",{children:sbe[e.key]||""}),s.jsx("input",{type:"text",name:"handle",autoComplete:"off",spellCheck:!1,autoCapitalize:"none",maxLength:Sw,placeholder:"username or link",value:p,onChange:j=>{const E=j.target.value.replace(/\s/g,"");g.current=E,m(E),v("")},onPaste:j=>{const E=j.clipboardData.getData("text");rh(E)&&(j.preventDefault(),g.current=E.trim().replace(/\s/g,""),m(ru(E,e.key)),v(""))},onBlur:()=>{m(j=>(rh(j)&&(g.current=j),ru(j,e.key)))},onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),w())},"aria-label":`${c} username or link`,"aria-invalid":y?!0:void 0})]}),y?s.jsx("p",{className:"ce-add-error",children:y}):null]}),s.jsxs("div",{className:"ce-add-actions",children:[s.jsx("button",{type:"button",className:"ce-add-cancel",onClick:i,children:"Cancel"}),s.jsx("button",{type:"button",className:"ce-add-save",onClick:w,disabled:x,children:x?"Savingâ¦":n?"Update":"Save"})]})]})]})}),document.body)}const WJe=["templates","platforms","profile-knowledge","profile-voice","profile-identity","profile-offerings"];function jl({step:e,steps:t=WJe}){const n=t.indexOf(e);if(n<0)return null;const r=n+1,a=t.length;return s.jsx("div",{className:"ce-onboarding-progress-row",children:s.jsx("div",{className:"ce-onboarding-progress",role:"progressbar","aria-valuemin":1,"aria-valuemax":a,"aria-valuenow":r,"aria-label":`Step ${r} of ${a}`,children:s.jsx("span",{className:"ce-onboarding-progress-fill",style:{width:`${r/a*100}%`}})})})}const VJe=["instagram","facebook","youtube","x","tiktok","linkedin","whatsapp","spotify"],GJe=Rxe,YJe=[{key:"whatsapp",name:"WhatsApp",Icon:k_,accounts:["whatsapp"],accountOnly:!0,comingSoon:!0},{key:"spotify",name:"Spotify",Icon:E4,accounts:["spotify"],accountOnly:!0,comingSoon:!0}],KJe=[...nu,...YJe],$d=VJe.map(e=>KJe.find(t=>
430t.key===e)).filter(Boolean).map(e=>GJe.has(e.key)?e:{...e,comingSoon:!0}),XJe=[],JJe={instagram:{placeholder:"@username",label:"Instagram username"},facebook:{placeholder:"Facebook Page URL",label:"Facebook Page URL",inputMode:"url",autoComplete:"url"},youtube:{placeholder:"YouTube channel URL",label:"YouTube channel URL",inputMode:"url",autoComplete:"url"},x:{placeholder:"@username",label:"X username"},tiktok:{placeholder:"@username",label:"TikTok username"},linkedin:{placeholder:"LinkedIn profile URL",label:"LinkedIn profile URL",inputMode:"url",autoComplete:"url"},whatsapp:{placeholder:"WhatsApp phone number",label:"WhatsApp phone number with country code",inputMode:"tel",autoComplete:"tel"},spotify:{placeholder:"Spotify URL",label:"Spotify profile, artist, or show URL",inputMode:"url",autoComplete:"url"}};function Xx(e,t){return e.accounts.map(n=>t[n]).find(Boolean)}function QJe(e,t){return new Set($d.filter(n=>Xx(n,e)||t[n.key]).map(n=>n.key))}function ZJe(e,t){return Object.fromEntries($d.map(n=>[n.key,t[n.key]||Xx(n,e)?.handle||""]))}function cS(e){const t=String(e||"").trim();if(!t)return"";try{const n=new URL(t.includes("://")?t:`https://${t}`);return!["http:","https:"].includes(n.protocol)||!n.hostname.includes(".")?"Add a valid website URL.":""}catch{return"Add a valid website URL."}}function $B(e){const t=String(e||"").trim();return t?new URL(t.includes("://")?t:`https://${t}`).toString():""}function Uj({connected:e={},handles:t={},additionalLinks:n=XJe,onConnect:r,onDisconnect:a,onSaveHandle:i,onSaveAdditionalLinks:o,onImportLink:l,onContinue:c,onSkip:u,onBack:d,variant:h="profile"}){const p=h==="business",[m,g]=f.useState("select"),[x,b]=f.useState(()=>QJe(e,t)),[y,v]=f.useState(()=>ZJe(e,t)),[w,j]=f.useState(()=>p?n.length?[...n]:[""]:[...n,...Array(Math.max(0,3-n.length)).fill("")]),E=w.filter(ae=>ae.trim()).join(` 431`),[S,_]=f.useState({status:"idle"}),[k,C]=f.useState({}),[N,A]=f.useState(!1),[T,I]=f.useState(null),[$,O]=f.useState(!1),[U,F]=f.useState(null),H=f.useMemo(()=>$d.filter(ae=>x.has(ae.key)),[x]),G=f.useRef(!1);f.useEffect(()=>{const ae=$d.filter(me=>Xx(me,e));if(!ae.length){G.current=!0;return}v(me=>{const q={...me};let he=!1;return ae.forEach(se=>{const le=Xx(se,e);q[se.key]||!le.handle||(q[se.key]=le.handle,he=!0)}),he?q:me}),b(me=>{const q=new Set(me),he=ae.filter(se=>!q.has(se.key));return he.length?(he.forEach(se=>q.add(se.key)),q):me}),G.current&&g("details"),G.current=!0},[e]);const M=ae=>{b(me=>{const q=new Set(me);return q.has(ae)?q.delete(ae):q.add(ae),q})},z=async()=>{const ae=T;if(!(!ae||$)){O(!0);try{await r?.(ae),I(null)}finally{O(!1)}}},W=async ae=>{if(!U){F(ae);try{await a?.(ae),v(me=>({...me,[ae]:""}))}finally{F(null)}}},D=(ae,me)=>{v(q=>({...q,[ae]:me.replace(/\s/g,"")})),C(q=>({...q,[ae]:""}))},Z=f.useRef(null),V=f.useRef(null),L=f.useRef(""),K=(ae,me)=>{L.current="",j(q=>q.map((he,se)=>se===ae?me.trim():he)),C(q=>({...q,link:""})),_({status:"idle"})},te=async()=>{if(!l)return;const ae=w.map(cS).find(Boolean);if(ae||!E){C(se=>({...se,link:ae||"Add a valid website URL."}));return}const me=[...new Set(w.filter(Boolean).map($B))],q=me.join(` 432`);if(clearTimeout(Z.current),L.current===q)return;L.current=q;const{hostname:he}=new URL(me[0]);_({status:"loading",hostname:he});try{await o?.(me);const se=await l(me);if(L.current!==q)return;
432["done","empty","partial"].includes(se?.status)?_({status:"done",hostname:he,count:se.rows?.length||0}):(L.current="",_({status:"error",hostname:he}))}catch{if(L.current!==q)return;L.current="",_({status:"error",hostname:he})}};V.current=te;const Q=!!l;f.useEffect(()=>{if(!(!Q||!E||w.some(ae=>cS(ae))))return Z.current=setTimeout(()=>{V.current()},700),()=>clearTimeout(Z.current)},[E,w,Q]);const Y=async()=>{const ae=w.map(cS).find(Boolean);return ae?(C(me=>({...me,link:ae})),!1):(E&&te(),await o?.([...new Set(w.filter(Boolean).map($B))]),!0)},J=async ae=>{if(!N){A(!0);try{await Y()&&await ae?.()}finally{A(!1)}}},P=async()=>{if(N)return;const ae={},me={};if(H.forEach(q=>{const he=ru(y[q.key],q.key),se=(y[q.key]||"").trim()?IG(he,q.key):"";se&&(ae[q.key]=se),me[q.key]=he}),Object.keys(ae).length){C(ae);return}A(!0);try{const q=$d.filter(he=>!x.has(he.key)&&t[he.key]);Promise.all([...H.map(he=>i?.(he.key,me[he.key],y[he.key])),...q.map(he=>i?.(he.key,"",""))]).catch(()=>C(he=>({...he,save:"Could not save your accounts. Please try again."}))),await c?.()}finally{A(!1)}},ee=$d.find(ae=>ae.key===T),X=s.jsxs("section",{className:`ce-additional-links${p?" is-website":""}`,"aria-label":p?void 0:"Add a link",children:[p?s.jsx("label",{className:"ce-website-label",htmlFor:"ce-business-website",children:"Website"}):s.jsx("p",{className:"ce-additional-links-divider",children:"Or add a link"}),s.jsx("div",{className:"ce-additional-link-fields",children:w.map((ae,me)=>s.jsxs("div",{className:`ce-additional-link-field${k.link?" is-error":""}`,children:[s.jsx($a,{size:22,strokeWidth:1.9,"aria-hidden":"true"}),s.jsx("input",{id:p&&me===0?"ce-business-website":void 0,type:"url",inputMode:"url",autoComplete:"url",placeholder:p?"yourwebsite.com":"Website or store link","aria-label":p?void 0:me===0?"Website or store link":`Website or store link ${me+1}`,"aria-describedby":k.link?"ce-website-error":void 0,value:ae,onChange:q=>K(me,q.target.value),onKeyDown:q=>{q.key==="Enter"&&(q.preventDefault(),te())},"aria-invalid":k.link?!0:void 0}),me>
432=(p?1:3)?s.jsx("button",{type:"button",className:"ce-additional-link-remove","aria-label":`Remove link field ${me+1}`,title:"Remove link field",onClick:()=>{ae.trim()&&(L.current="",_({status:"idle"})),C(q=>({...q,link:""})),j(q=>q.filter((he,se)=>se!==me))},children:s.jsx(as,{size:17,"aria-hidden":"true"})}):null,s.jsx("span",{className:"ce-additional-link-info",children:s.jsxs(Ru,{label:"What happens when you import a link",tone:"light",width:320,placement:"top",children:[s.jsxs("span",{className:"mb-2 flex items-center gap-1.5 font-semibold text-ink",children:[s.jsx(Ms,{size:14,className:"text-indigo","aria-hidden":"true"}),"Save time with your existing page"]}),s.jsxs("ul",{className:"list-disc space-y-1 pl-4",children:[s.jsx("li",{children:"Paste a link to your shop, course, booking page or Linktree."}),s.jsx("li",{children:"We read it and find your products and services."}),s.jsx("li",{children:"You pick what to show. Nothing goes live without you."})]})]})})]},me))}),s.jsxs("div",{className:"ce-additional-links-footer",children:[p?null:s.jsx("button",{type:"button",className:"ce-additional-link-add","aria-label":"Add another link",onClick:()=>j(ae=>[...ae,""]),children:s.jsx(Es,{size:20,"aria-hidden":"true"})}),k.link?s.jsx("p",{id:"ce-website-error",className:"ce-additional-link-status is-error",role:"alert",children:k.link}):p?E?s.jsx("p",{className:"ce-website-notice",children:"Weâll pull your products and services from this site, including its subpages."}):null:S.status==="loading"?s.jsxs("p",{className:"ce-additional-link-status",role:"status",children:[s.jsx(vt,{size:15,className:"animate-spin","aria-hidden":"true"}),"Finding offeringsâ¦"]}):S.status==="done"&&S.count>0?s.jsxs("p",{className:"ce-additional-link-status is-done",role:"status",children:[s.jsx(pc,{size:15,"aria-hidden":"true"}),S.count," ",S.count===1?"offering":"offerings"," found"]}):S.status==="done"?s.jsx("p",{className:"ce-additional-link-status",role:"status",children:"No offerings found"}):S.status==="error"?s.jsx("p",{className:"ce-additional-link-status is-error",role:"alert",children:"Couldnât import. Try again."}):null]})]});return s.jsxs("section",{className:`ce-pre-journey ce-onboarding-screen ce-platforms-screen${p?" is-business":""}`,children:[s.jsxs("div",{className:"ce-onboarding-header ce-platforms-header",children:[s.jsx(jl,{step:p?"business-sources":"platforms",steps:p?To:void 0}),s.jsx("div",{className:"ce-platforms-head",children:m==="select"?p?s.jsxs("h1",{children:[s.jsx("span",{children:"Add your"})," ",s.jsx("span",{children:s.jsx("em",{className:"ge-em",children:"website"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("h1",{children:[s.jsx("span",{children:"Which platforms"})," ",s.jsxs("span",{children:["are you ",s.jsx("em",{className:"ge-em",children:"on"}),"?"]})]}),s.jsx("p",{children:"Select every platform you want to add"})]}):p?s.jsxs("h1",{children:[s.jsx("span",{children:"Add your"})," ",s.jsx("span",{children:s.jsx("em",{className:"ge-em",children:"accounts"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("h1",{children:[s.jsx("span",{children:"Add your"})," ",s.jsx("span",{children:s.jsx("em",{className:"ge-em",children:"accounts"})})]}),s.jsx("p",{children:"Add the account name, phone number, or profile link for each platform"})]})}),m==="select"&&u?s.jsx("button",{type:"button",className:"ce-onboarding-header-skip",onClick:()=>J(u),children:"Skip"}):null]}),s.jsx("div",{className:"ce-onboarding-content ce-platforms-body",children:s.jsx("div",{className:"ce-onboarding-content-inner",children:m==="select"?s.jsxs("div",{className:`ce-platforms-select${p?" is-business":""}`,children:[p?X:null,s.jsxs("div",{className:p?"ce-business-socials":void 0,children:[p?s.jsx("p",{className:"ce-website-label",id:"ce-business-socials-label",children:"Socials"}):null,s.jsx("ul",{className:"ce-platforms-list ce-platforms-select-list","aria-labelledby":p?"ce-business-socials-label":void 0,children:$d.map(ae=>{const{key:me,name:q,Icon:he}=ae,se=x.has(me);return s.jsx("li",{children:s.jsx("article",{className:`ce-platform-card${se?" is-on":""}`,children:s.jsxs("button",{type:"button",className:"ce-platform-row",onClick:()=>M(me),"aria-pressed":se,"aria-label":`${se?"Remove":"Select"} ${q}`,children:[s.jsx("span",{className:"ce-platform-choice-mark",children:s.jsx("span",{className:"ce-platform-mark","aria-hidden":"true",children:s.jsx(he,{size:58})})}),s.jsx("span",{className:"ce-platform-select-name",children:q})]})})},me)})})]}
432),p?null:X]}):s.jsxs("div",{className:"ce-platform-details",children:[p?null:s.jsx("h2",{className:"ce-platform-details-section-title",children:"Your social profiles"}),s.jsx("div",{className:"ce-platform-fields",children:H.map(ae=>{const{key:me,name:q,Icon:he}=ae,se=JJe[me]||{placeholder:`${q} profile URL`,label:`${q} profile URL`},le=y[me]||"",oe=Xx(ae,e)?.verified===!0;return s.jsxs("div",{className:"ce-platform-field-row",children:[s.jsx("span",{className:"ce-platform-field-icon","aria-hidden":"true",children:s.jsx(he,{size:34})}),s.jsxs("div",{className:`ce-platform-input${k[me]?" is-error":""}`,children:[s.jsx("input",{type:"text",inputMode:se.inputMode||"text",autoComplete:se.autoComplete||"off",spellCheck:!1,autoCapitalize:"none",maxLength:Sw,placeholder:se.placeholder,value:le,onChange:Oe=>D(me,Oe.target.value),onBlur:()=>D(me,ru(le,me)),"aria-label":se.label,"aria-invalid":k[me]?!0:void 0}),oe?s.jsxs("span",{className:"ce-platform-field-status",children:[s.jsxs("small",{className:"ce-platform-field-verified",children:[s.jsx(BT,{size:16,"aria-hidden":"true"})," Verified"]}),a?s.jsx("button",{className:"ce-platform-field-remove",type:"button",disabled:U===me,onClick:()=>W(me),children:U===me?"Removingâ¦":"Remove"}):null]}):!ae.comingSoon&&r?s.jsxs("button",{className:"ce-platform-field-verify",type:"button",onClick:()=>I(me),children:[s.jsx(BT,{size:15,strokeWidth:2.1,"aria-hidden":"true"}),"Verify"]}):null]}),k[me]?s.jsx("p",{className:"ce-platform-field-error",children:k[me]}):null]},me)})})]})})}),s.jsx("div",{className:"ce-onboarding-footer ce-platforms-footer",children:s.jsx(Lo,{onBack:m==="select"?d:()=>g("select"),onContinue:m==="select"?()=>J(x.size?()=>g("details"):p?c:u):P,continueDisabled:N,continueLabel:N?"Savingâ¦":"Continue"})}),ee?s.jsx(qJe,{connector:ee,connecting:$,savedHandle:y[ee.key]||"",allowConnect:!!r&&!ee.comingSoon,disabledConnectLabel:"Coming soon",onCancel:()=>I(null),onConnect:z,onSaveHandle:async ae=>{await i?.(ee.key,ae),D(ee.key,ae),I(null)}}):null]})}function eQe(e,t){return(e%t+t)%t}function tQe(e,t){return e.label||`Look ${t+1}`}function sQe({template:e,templateIndex:t,selected:n,onSelect:r}){const a=tQe(e,t);return s.jsx("div",{className:`ce-tpl-card${n?" is-on":""}`,children:s.jsxs("div",{className:"ce-tpl-phone",children:[e.thumbnail?s.jsx("img",{src:e.thumbnail,alt:"",className:"ce-tpl-thumbnail",draggable:"false","aria-hidden":"true"}):s.jsxs("div",{className:"ce-tpl-missing-preview","aria-hidden":"true",children:[s.jsx("span",{children:"Imported look"}),s.jsx("strong",{children:a})]}),s.jsx("button",{type:"button",className:"ce-tpl-hit",onClick:r,"aria-pressed":n,"aria-label":`${n?"Selected":"Choose"} ${a}`,children:s.jsx("span",{className:"ce-tpl-choice-check","aria-hidden":"true",children:s.jsx(ft,{size:14,strokeWidth:2.8})})})]})})}function zk({templates:e=lc,defaultId:t=Kx,ready:n=!0,selectedId:r="",onSelect:a,onContinue:i,onSkip:o,onBack:l}){const c=e.length,u=e.findIndex(j=>j.id===r),d=e.findIndex(j=>j.id===t),h=u>=0?u:Math.max(d,0),p=f.useRef(!1),m=f.useRef(null),[g,x]=f.useState(!1),[b,y]=f.useState(!1);if(f.useEffect(()=>{!n||u>=0||p.current||c===0||(p.current=!0,a(e[h]))},[h,a,n,u,c,e]),f.useEffect(()=>{const j=m.current;if(!j)return;const E=()=>{const _=j.scrollHeight-j.scrollTop-j.clientHeight;x(j.scrollTop>8),y(_<=8)};E(),j.addEventListener("scroll",E,{passive:!0});const S=new ResizeObserver(E);return S.observe(j),()=>{j.removeEventListener("scroll",E),S.disconnect()}},[c]),c===0)return null;const v=j=>{a(e[eQe(j,c)])},w=j=>{j.key==="ArrowLeft"||j.key==="ArrowUp"?(j.preventDefault(),v(h-1)):(j.key==="ArrowRight"||j.key==="ArrowDown")&&(j.preventDefault(),v(h+1))};return s.jsxs("section",{className:`ce-pre-journey ce-onboarding-screen ce-templates-screen${g?" is-scrolled":""}${b?" is-at-bottom":""}`,children:[s.jsxs("div",{className:"ce-onboarding-header ce-templates-header",children:[s.jsx(jl,{step:"templates"}),s.jsxs("div",{className:"ce-templates-head",children:[s.jsxs("h1",{children:["Choose a ",s.jsx("em",{className:"ge-em",children:"look"})]}),s.jsx("p",{children:"Pick a starting style for your page. You can change it later."})]}),o?s.jsx("button",{type:"button",className:"ce-onboarding-header-skip",onClick:o,children:"Skip"}):null]}),s.jsx("div",{ref:m,className:"ce-onboarding-content ce-templates-body",children:s.jsx("div",{className:"ce-onboarding-content-inner",children:s.jsx("div",{className:"ce-templates-grid",role:"list","aria-label":"Profile looks",onKeyDown:w,children:e.map((j,E)=>s.jsx(sQe,{template:j,templateIndex:E,selected:j.id===r,onSelect:()=>v(E)},j.id))})})}),s.jsx("div",{className:"ce-onboarding-footer ce-templates-footer",children:s.jsx(Lo,{onBack:l,onContinue:i,
432continueDisabled:!r})})]})}async function nQe(e,t=null){const n=await f0({"Content-Type":e.type||"audio/webm"}),r=await fetch(`${Hr}/voice/transcribe`,{method:"POST",headers:n,body:e,signal:t});if(!r.ok){let a=null;try{a=await r.json()}catch{}const i=new Error(a?.detail?.message||`Transcription failed: ${r.status}`);throw i.status=r.status,i}return r.json()}const rQe=15e3;function aQe(e){e?.getTracks?.().forEach(t=>t.stop())}function uS(e,t,n="Error"){const r=new Error(e);return r.code=t,r.name=n,r}function iQe(e,{constraints:t={audio:!0},signal:n,timeoutMs:r=rQe}={}){return typeof e!="function"?Promise.reject(uS("Voice input is not supported in this browser.","MIC_NOT_SUPPORTED")):new Promise((a,i)=>{let o=!1,l=null;const c=()=>{l&&clearTimeout(l),n?.removeEventListener("abort",d)},u=h=>{o||(o=!0,c(),i(h))},d=()=>u(uS("Microphone request cancelled.","MIC_REQUEST_CANCELLED","AbortError"));if(n?.aborted){d();return}n?.addEventListener("abort",d,{once:!0}),l=setTimeout(()=>u(uS("The microphone did not open. Check your browser permission and try again.","MIC_PERMISSION_TIMEOUT")),r),Promise.resolve().then(()=>e(t)).then(h=>{if(o){aQe(h);return}o=!0,c(),a(h)}).catch(u)})}const FB=6e4,s5=8,dS=new Array(s5).fill(.18);function ore({onTranscript:e}={}){const[t,n]=f.useState("idle"),[r,a]=f.useState(0),[i,o]=f.useState(dS),[l,c]=f.useState(null),u=f.useRef(null),d=f.useRef(null),h=f.useRef([]),p=f.useRef(null),m=f.useRef(null),g=f.useRef(null),x=f.useRef(0),b=f.useRef(!1),y=f.useRef(null),v=f.useRef(null),w=f.useCallback(()=>{m.current&&(cancelAnimationFrame(m.current),m.current=null),g.current&&(clearInterval(g.current),g.current=null),p.current&&(p.current.close().catch(()=>{}),p.current=null),d.current&&(d.current.getTracks().forEach(k=>k.stop()),d.current=null)},[]);f.useEffect(()=>()=>{b.current=!0,v.current?.abort(),y.current?.abort(),w()},[w]);const j=f.useCallback(()=>{const k=u.current;k&&k.state!=="inactive"&&k.stop()},[]),E=f.useCallback(()=>{b.current=!0,v.current?.abort(),v.current=null;const k=u.current;k&&k.state!=="inactive"?k.stop():(w(),n("idle"),a(0),o(dS))},[w]),S=f.useCallback(()=>{c(null),n("idle")},[]),_=f.useCallback(async()=>{if(t==="recording"||t==="requesting"||t==="transcribing")return;c(null),b.current=!1,n("requesting");let k;try{v.current=new AbortController;const N=navigator.mediaDevices?.getUserMedia?.bind(navigator.mediaDevices);k=await iQe(N,{signal:v.current.signal})}catch(N){if(v.current=null,N?.name==="AbortError"){n("idle");return}N?.name==="NotAllowedError"||N?.name==="SecurityError"||N?.name==="PermissionDeniedError"?n("denied"):(c(N),n("error"));return}if(v.current=null,b.current){k.getTracks().forEach(N=>N.stop()),n("idle");return}d.current=k,h.current=[];try{const N=window.AudioContext||window.webkitAudioContext,A=new N;p.current=A;const T=A.createAnalyser();T.fftSize=64,T.smoothingTimeConstant=.75,A.createMediaStreamSource(k).connect(T);const I=new Uint8Array(T.frequencyBinCount),$=Math.max(1,Math.floor(I.length/s5)),O=()=>{T.getByteFrequencyData(I);const U=[];for(let F=0;F<s5;F++){let H=0;for(let M=0;M<$;M++)H+=I[F*$+M]||0;const G=H/$/255;U.push(Math.max(.18,Math.min(1,G*1.8)))}o(U),m.current=requestAnimationFrame(O)};m.current=requestAnimationFrame(O)}catch{}let C;try{C=new MediaRecorder(k)}catch(N){w(),c(N),n("error");return}u.current=C,C.ondataavailable=N=>{N.data?.size>0&&h.current.push(N.data)},C.onstop=async()=>{m.current&&(cancelAnimationFrame(m.current),m.current=null),g.current&&(clearInterval(g.current),g.current=null);const N=new Blob(h.current,{type:C.mimeType||"audio/webm"});if(w(),o(dS),b.current||N.size===0){n("idle"),a(0);return}n("transcribing");try{y.current=new AbortController;const{text:A}=await nQe(N,y.current.signal);a(0);const T=(A||"").trim();if(!T){c(new Error("No speech was detected. Please try again.")),n("error");return}n("idle"),e?.(T)}catch(A){if(A?.name==="AbortError"){n("idle");return}c(A),n("error")}},C.start(),x.current=Date.now(),a(0),n("recording"),g.current=setInterval(()=>{const N=Date.now()-x.current;a(N),N>=FB&&j()},200)},[t,e,w,j]);return{status:t,elapsedMs:r,levels:i,error:l,start:_,stop:j,cancel:E,reset:S,isRecording:t==="recording",isTranscribing:t==="transcribing",isDenied:t==="denied",isBusy:t==="recording"||t==="requesting"||t==="transcribing",maxDurationMs:FB}}function oQe(e){return!!String(e||"").trim()}async function lQe(e,{skip:t=!1}={}){if(!e||t)return null;const n=await Lbe(e),r=n?.data?.style;
432return!r||n?.data?.skipped?null:(await UG(e,r),r)}function zj(e){if(!e)return"web";const t=e.toLowerCase();return t.includes("youtube.com")||t.includes("youtu.be")?"youtube":t.includes("vimeo.com")?"vimeo":t.includes("tiktok.com")?"tiktok":t.includes("instagram.com")?"instagram":t.includes("twitter.com")||t.includes("x.com")?"twitter":t.includes("facebook.com")||t.includes("fb.watch")?"facebook":t.includes("dailymotion.com")?"dailymotion":t.includes("twitch.tv")?"twitch":t.includes("linkedin.com")?"linkedin":[".mp4",".mov",".avi",".webm",".mkv",".m4v",".flv",".wmv"].some(n=>t.endsWith(n))?"video":"web"}function cQe(e,t){switch(e){case"youtube":return s.jsx(z4,{className:"w-4 h-4 text-red-500"});case"vimeo":return s.jsx(Ac,{className:"w-4 h-4 text-blue-500"});case"tiktok":return s.jsx(sY,{className:"w-4 h-4 text-pink-500"});case"instagram":return s.jsx(Ac,{className:"w-4 h-4 text-purple-500"});case"twitter":return s.jsx(Ac,{className:"w-4 h-4 text-sky-500"});case"facebook":return s.jsx(Ac,{className:"w-4 h-4 text-blue-600"});case"dailymotion":return s.jsx(Ac,{className:"w-4 h-4 text-slate-500"});case"twitch":return s.jsx(Ac,{className:"w-4 h-4 text-purple-600"});case"linkedin":return s.jsx(Ac,{className:"w-4 h-4 text-blue-700"});default:return s.jsx(Ac,{className:"w-4 h-4 text-slate-500"})}}function uQe(e){switch(e){case"youtube":return"YouTube";case"vimeo":return"Vimeo";case"tiktok":return"TikTok";case"instagram":return"Instagram";case"twitter":return"Twitter/X";case"facebook":return"Facebook";case"dailymotion":return"Dailymotion";case"twitch":return"Twitch";case"linkedin":return"LinkedIn";case"video":return"Video";
432case"web":return"Web";default:return"Link"}}function dQe(e){try{return decodeURIComponent(e)}catch{return e}}function n5(e=""){const t=e.split(/[?#]/)[0];return dQe(t.split(/[\\/]/).pop()||t)}function lre(e){const n=n5(e?.source||e?.title||"").match(/\.([a-z0-9]+)$/i);return n?n[1].toLowerCase():""}function BB(e=""){return e.replace(/^doc_[a-f0-9]{10}_/i,"")}function WP(e){return e?.meta?.video_metadata||e?.meta||{}}function cre(e){return e?.source_type==="file"&&e?.source?BB(n5(e.source)):BB(e?.title||n5(e?.source||"")||"Untitled")}function ure(e){if(e?.source_type==="url")return"Website URL";if(e?.source_type==="x_profile")return e?.meta?.kind==="thread"?"X thread":"X posts";if(e?.source_type==="video_url"){const n=WP(e).platform||zj(e?.source);return`${uQe(n)} video URL`}const t=lre(e);return["xlsx","xls"].includes(t)?"Excel file":t==="csv"?"CSV file":t==="pdf"?"PDF file":["doc","docx"].includes(t)?"Word document":["png","jpg","jpeg","webp"].includes(t)?`${t.toUpperCase()} image`:["m4a"].includes(t)?`${t.toUpperCase()} audio`:["mp4","mov","avi","webm","mkv","m4v","flv","wmv"].includes(t)?`${t.toUpperCase()} video`:t==="epub"?"EPUB book":["json","jsonl","ndjson"].includes(t)?"JSON file":["txt","md"].includes(t)?`${t.toUpperCase()} file`:"File"}function hQe(e){return e?.progressLabel?e.progressLabel:e?.status==="queued"?"Queued":e?.status==="processing"||e?.status==="indexing"?"Processing":e?.status==="failed"?"Needs attention":""}function pQe(e){const t=lre(e);return["xlsx","xls","csv"].includes(t)?{Icon:lY,bg:"bg-emerald-50 dark:bg-emerald-900/20",color:"text-emerald-600 dark:text-emerald-400"}:["png","jpg","jpeg","webp"].includes(t)?{Icon:Gye,bg:"bg-fuchsia-50 dark:bg-fuchsia-900/20",color:"text-fuchsia-600 dark:text-fuchsia-400"}:["m4a"].includes(t)?{Icon:Wye,bg:"bg-violet-50 dark:bg-violet-900/20",color:"text-violet-600 dark:text-violet-400"}:["mp4","mov","avi","webm","mkv","m4v","flv","wmv"].includes(t)?{Icon:Kye,bg:"bg-red-50 dark:bg-red-900/20",color:"text-red-600 dark:text-red-400"}:["json","jsonl","ndjson"].includes(t)?{Icon:Hye,bg:"bg-amber-50 dark:bg-amber-900/20",color:"text-amber-600 dark:text-amber-400"}:t==="epub"?{Icon:Ou,bg:"bg-violet-50 dark:bg-violet-900/20",color:"text-violet-600 dark:text-violet-400"}:t==="pdf"?{Icon:si,bg:"bg-red-50 dark:bg-red-900/20",color:"text-red-600 dark:text-red-400"}:["doc","docx"].includes(t)?{Icon:si,bg:"bg-blue-50 dark:bg-blue-900/20",color:"text-blue-600 dark:text-blue-400"}:{Icon:si,bg:"bg-slate-100 dark:bg-neutral-800",color:"text-slate-500 dark:text-neutral-400"}}function dre({doc:e}){if(e?.source_type==="url")return s.jsx("div",{className:"w-8 h-8 rounded-xl bg-blue-50 dark:bg-blue-900/20 flex items-center justify-center shrink-0",children:s.jsx(vc,{className:"w-4 h-4 text-blue-500"})});if(e?.source_type==="video_url"){const a=WP(e).platform||zj(e?.source);return s.jsx("div",{className:"w-8 h-8 rounded-xl bg-red-50 dark:bg-red-900/20 flex items-center justify-center shrink-0",children:cQe(a)})}if(e?.source_type==="x_profile")return s.jsx("div",{className:"w-8 h-8 rounded-xl bg-neutral-900 flex items-center justify-center shrink-0",children:s.jsx("svg",{viewBox:"0 0 24 24",className:"w-3.5 h-3.5 fill-white","aria-hidden":"true",children:s.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})});const{Icon:t,bg:n,color:r}=pQe(e);return s.jsx("div",{className:`w-8 h-8 rounded-xl flex items-center justify-center shrink-0 ${n}`,children:s.jsx(t,{className:`w-4 h-4 ${r}`})})}const hre=2e3,pre=15e3,mre=600*1e3,fre=1800*1e3,UB="Still processing â large files can take a while and will appear in your library when done";function mQe(e){const t=Number(e)||0;return t>=fre?"stop":t>=mre?"slow":"fast"}const fQe=1024*1024,at={unsupportedFileType:"This file type isn't supported on Great Experts. Save your content as one of the supported formats (PDF, DOCX, TXT, MD, CSV, XLSX, JPG, PNG, MP4) and upload again. Text formats like PDF, DOCX, and TXT train your expert most precisely - images and video are processed too, but produce less reliable retrieval.",unsupportedJsonl:".jsonl files aren't supported - each line is a separate record, which our processor can't read directly. To use this data for your expert, open the .jsonl in your tool of choice and export the relevant fields as a .csv (one row per record), or convert each record into prose paragraphs and save as a .txt or .md file. Prose tends to train more accurate answers than raw structured records.",fileTooLarge:"This file is over our 200 MB upload limit. Split it into smaller documents organised by topic and upload them separately - that also helps your expert retrieve the right context per question instead of searching one large file. For very long source material, extract only the sections directly relevant to your expert's domain.",videoTooLarge:"This video is over our 200 MB upload limit. For training your expert, a written transcript usually works better than the raw video - exp
432ort captions or transcript from the source platform and upload it as a .txt or .md file. If the visual context matters, trim the video to just the segments that are essential.",textTooLarge:"This text file is too large for our processor (limit: 10 MB per file). Split it by topic or chapter rather than by raw size - your expert retrieves more accurate answers when each file covers one coherent subject. Aim for focused files of 1-5 MB, each covering a single area of your domain.",imageTooLarge:"This image is over our 20 MB processing limit. Resize or compress it and upload again. Tip: if the image contains text (slides, charts, infographics), exporting that text into a .txt or .pdf will train your expert more reliably than image OCR.",emptyFile:"This file is empty - there's nothing for your expert to learn from it. Add your written content (notes, explanations, FAQ answers, methodology) and upload it again. Even a few well-written paragraphs per topic give your expert something useful to retrieve.",duplicateFile:"This file is already in your knowledge base - you'll find it in your knowledge list. If you've updated the content, delete the old version first, then upload the new one. Uploading duplicates doesn't improve answer quality and just adds retrieval noise.",tooManyFiles:"You're uploading a lot of files at once - use 50 or fewer per batch for reliable processing. More importantly: quality beats quantity. Focused, well-written documents usually train a better expert than a large pile of mixed sources, so pick the ones that best represent your domain first.",noExtension:"This file doesn't have a recognisable type, so our processor doesn't know how to read it. Rename it with the correct extension (.pdf, .docx, .txt, .md, etc.) and upload again. The extension tells us whether to parse it as text, a PDF, a spreadsheet, and so on.",corruptPdf:"We couldn't open this PDF - it may be damaged. Open it on your computer and save or print it as a fresh PDF, then upload the new version. If the original is the only copy, try a clean export from the source application (Word, Pages, browser print-to-PDF).",protectedPdf:"This PDF is password-protected and we can't read its content for training. Remove the password (in Acrobat or your PDF viewer's security settings) and upload the unlocked version. Locked PDFs can't be used as expert knowledge - our processor needs to extract the text to train your expert.",corruptDocx:"We couldn't open this Word document - it may be damaged, or it may be a different file type renamed to .docx (a name like 'notes.md.docx' usually means a Markdown file was renamed). If it was renamed, restore the real extension (.md, .txt) and upload that - both are supported directly. Otherwise open it in Word or Google Docs and save a fresh .docx copy.",scannedPdf:"This PDF looks like a scan - there's no selectable text for our processor to read. Convert it to a text-based PDF using your operating system's built-in OCR, your PDF editor, or any OCR tool you trust. Once you can select and copy text from the file in your viewer, it's ready to train your expert.",emptySpreadsheet:"This spreadsheet is empty - there's no data for your expert to learn from. Add your records (one row per item, with clear column headers in row 1) and upload it again. Headers like 'question', 'answer', 'topic', 'date' help your expert understand what each column represents.",malformedCsv:"We couldn't read this spreadsheet - it likely has inconsistent rows, broken quotes, or unescaped commas. Open it in Excel or Google Sheets, confirm each row has the same number of columns, save a clean copy, and upload that. For your expert to use tabular data well, each row should be a self-contained record.",corruptExcel:"We couldn't open this Excel file - it may be damaged or in an unsupported variant. Open it in Excel or Google Sheets, save a fresh copy as .xlsx or export it as .csv, and upload the new version. If the workbook has multiple sheets, splitting them into separate files usually trains your expert better.",invalidJson:"This JSON file has syntax errors and we can't parse it. Open it in a code editor with JSON syntax highlighting or any JSON validator you trust to locate the issue, fix it, and upload again. For most training use cases, prose in a .txt or .md file is easier to maintain than raw JSON anyway.",imageUnavailable:"Image processing is temporarily unavailable on our side - your image is fine. Please try again in a few minutes. If you need to add this content now, upload the same information as a PDF or text file instead.",imageNoContent:"We couldn't find any readable text or recognisable content in this image. If it should contain text (slide, chart, screenshot), upload a sharper or higher-resolution version. For purely visual material, a written description in a .txt or .md file teaches your expert more reliably than the image alone.",proseInUrlField:"This looks like written content, not a web address. To use this text for training, paste it into a .txt, .md, or .docx file and use the file upload option. The URL field only accepts links starting with http:// or https://.",missingProtocol:"Web links need to start with 'https://' (or 'http://'). Add it to the beginning of your link - for example: https://instagram.com/p/ABC123 - and try again.",socialHandle:"This looks like a username, not a web link. Open the profile or post in your browser, copy the full address from the address bar (starting with https://), and paste that here. For training, make sure you're linking to a specific post or page - not just a profile.",unsupportedScheme:"This type of link isn't supported - we can only read content from standard web pages (https:// or http://). If the file is hosted on FTP or similar, download it to your computer first and upload it directly using the file upload option.",n
432oValidBulkUrls:"None of these links are valid - each line needs to start with https:// or http://. Add the protocol to every line and try again. For example, change 'example.com/article' to 'https://example.com/article'.",mixedBulkUrls:"Some of your links couldn't be added because they don't start with https:// or http:// - only the valid links were saved. Review the list, add the protocol to the missing ones, and submit them again. Each link should point to a specific page, not a homepage.",brokenWebsite:"We couldn't reach this website - the address may be wrong or the site may no longer exist. Open the link in your browser to confirm it loads, then copy the working address from the address bar and try again.",privateNetworkUrl:"This link points to a private or internal address that we can't reach. Only publicly available web pages can be used as expert knowledge. If the content lives on an internal system, export it as a file (PDF, DOCX, TXT) and upload it directly instead.",blockedWebsite:"This website blocked our reader from accessing its content. Open the page in your browser and either save it as a PDF (Print â Save as PDF) or copy the text into a .txt or .docx file, then upload that. Many sites block automated readers but let you save content manually.",pageNotFound:"We couldn't find this page - it may have been moved or deleted. Open the link in your browser to confirm and look for the current URL if the page was relocated. If the page is gone for good and you have a saved copy, upload it as a file instead.",websiteRateLimited:"This website is asking us to slow down - this is temporary. Wait a couple of minutes and try the link again. If it keeps happening, save the page as a PDF in your browser and upload that file instead.",websiteUnavailable:"This website isn't responding right now - the issue is on their side, not yours. Try again in a few minutes. If the site stays down, save a copy of the page as a PDF and upload that instead.",webpageTooLarge:"This webpage is too large for our reader to process in full. Identify the specific section relevant to your expert (an article, chapter, FAQ block), copy that part into a .txt or .md file, and upload it. Smaller, focused inputs also train more precise answers.",noReadableTextOnPage:"We couldn't find any readable text on this page - it likely loads its content dynamically or requires a login. Open the page in your browser, copy the visible text into a .txt or .docx file, and upload that instead.",homepageUrl:"This looks like a homepage rather than a specific article or page. Homepage content changes over time and rarely has the depth your expert needs. Open the homepage in your browser, click into the specific article or section you want to use, and paste that URL instead.",duplicateUrl:"You've already added this link - you'll find it in your existing knowledge. If the content has been updated, delete the old version first, then add the URL again. Adding the same source twice doesn't improve your expert's answers.",instagramHandle:"This looks like a username, not a link. Paste the full address of the specific Instagram post or reel - it should start with https://www.instagram.com/. Profile usernames alone don't give us a piece of content to process.",instagramProfile:"This is a profile link, not a specific post or reel. We can only process individual posts - open the post you want to use, copy its link from the share menu, and paste that instead. Train your expert on the specific content you want it to know.",instagramUnavailable:"We can't access this Instagram post - it may be private, deleted, or restricted to followers. Only public posts can be used for training. If you own the content, post a public copy first or upload a transcript of the audio as a .txt file.",socialProfile:"We can only process individual video posts, not profile pages. Open the specific video on that profile, copy its share link, and paste that here. Profile pages have no single piece of content for us to read.",youtubePlaylist:"This is a YouTube playlist - we can only process one video at a time. Open the playlist, click into the specific video you want to use, and paste that video's URL (it should look like youtube.com/watch?v=...). To add several videos from the playlist, paste each one on its own line in the link box.",youtubeNoCaptions:"This video doesn't have captions, and we couldn't transcribe the audio. Choose a video with captions enabled (auto-generated captions count), or open the video on YouTube, copy the transcript from the transcript panel, and upload it as a .txt file. Written transcripts often train more precise answers than audio anyway.",audioTranscriptionUnavailable:"We couldn't transcribe this audio file right now. The file may be valid, but the transcription service is unavailable or not configured. Try again later, or upload a written transcript as a .txt file.",videoNoAudio:"This video does not contain an audio track, so there is no speech for us to transcribe. Re-export the video with microphone or system audio enabled, or upload a written transcript as a .txt file.",youtubeBlocked:"YouTube is temporarily blocking our access to this video - this isn't related to your video specifically. Wait a few minutes and try again. As a faster alternative, copy the transcript from the YouTube transcript panel and upload it as a .txt file.",videoUnavailable:"We can't access this video - it may be private, region-locked, age-restricted, or no longer available. Only fully public videos can be used for training. If you own the video, make it public temporarily, or upload a written transcript as a .txt file instead.",videoTooLong:"This video is too long for us to process (limit: 4 hours). Trim it to the segments most relevant to your expert's domain, or - much better for training - upload the transcript as a .txt file. A focused transcript usually produces sharper answers than a long unedited recording.",jobExpired:"Your video took too long to process and the session expired. Refresh the page and add the link again. If the same video keeps timing out, uploading a written transcript usually finishes much faster and trains your expert just as well.",videoPollingNetwork:"We lost connection while processing your video. Check your internet and add the link again. Long videos are more sensitive to connection drops - shorter clips or a
432written transcript are more reliable inputs.",expertDeletedDuringVideo:"Your video was still processing when this expert was deleted, so the upload was discarded along with the expert. If the deletion was intentional, no action is needed - the upload is gone too. If it wasn't, recreate the expert and add the link again.",indexingUnavailable:"We're having trouble preparing your knowledge for retrieval right now - the issue is on our side, not yours. Please try again in a few minutes. Your uploaded files are safe; no action is needed from you.",scoreFailed:"We couldn't calculate your knowledge score this time - the issue is on our side. This doesn't affect your expert's ability to answer questions, only the score display. Try again in a few minutes.",summaryFailed:"We couldn't generate the personality summary for your expert this time. Your knowledge is fully saved and your expert can already answer questions - only the summary card is missing. Try again in a few minutes.",enhancementInputRequired:"Write some text before enhancing it.",enhancementLinksNotSupported:"Enhance works with written text only. Remove every link to use it.",enhancementTooLarge:"This note is too long to enhance at once. Shorten it to 20,000 characters or split it into focused sections.",enhancementFailed:"We couldn't enhance this text right now. Your original writing is unchanged. Try again.",enhancementNetwork:"We couldn't reach the writing assistant. Your original text is unchanged. Check your connection and try again.",categoriesFailed:"We couldn't sort your knowledge into categories right now. Your content is saved and your expert works as normal - categories will be assigned the next time you try. They only affect how your knowledge is organised in your dashboard, not answer quality.",permissionDenied:"You don't have permission to add knowledge to this expert. Only the owner (and collaborators with edit access invited by the owner) can upload training documents.",sessionExpired:"Your session has expired. Sign in again to continue - any files you uploaded before the timeout are still saved in your knowledge base.",fileNetwork:"Your upload was interrupted - your internet connection appears to have dropped. Check your connection and try again. For large files or batches, a stable connection (wired or strong Wi-Fi) avoids partial re-uploads.",urlNetwork:"We couldn't save your link because of a connection issue. Check your internet and paste the link again. If it keeps happening, upload the page content as a file (PDF or .txt) instead - file uploads are more resilient to connection drops.",noKnowledgeBeforeBuild:"Add at least one document or link to your knowledge base before building. Your expert needs source material to answer questions - even a single well-written .txt or .pdf is enough to start, though 3-5 focused documents produce more reliable retrieval.",rebuildBeforeSave:"You've added new knowledge - click 'Re-Build Knowledge' before saving so your expert can use it in chat. Without rebuilding, the newly added files won't appear in answers yet, even though they're stored in your knowledge list.",rebuildNoDocuments:"You don't have any documents in this expert's knowledge base, so there's nothing to rebuild. Upload at least one document or link first - your expert needs source material to answer questions in chat.",deleteFailed:"We couldn't remove this document right now - the issue is on our side. Try again in a few minutes. Until removal completes, your expert may still retrieve content from this document in answers.",fallback:"Something went wrong with this upload - check the specific error shown above, fix the issue, and try again. If you keep getting the same error on a URL or video, switch to a file format (.pdf, .txt, .docx) instead - text files are the most reliable input for training your expert."},VP=new Set(Object.values(at)),gQe=new Set([".txt",".md",".pdf",".csv",".json",".docx",".doc",".xlsx",".xls",".png",".jpg",".jpeg",".webp",".mp4",".mov",".avi",".webm",".mkv",".m4v",".flv",".wmv",".m4a",".epub"]),xQe=new Set([".png",".jpg",".jpeg",".webp"]),gre=new Set([".mp4",".mov",".avi",".webm",".mkv",".m4v",".flv",".wmv"]),bQe=new Set([".csv",".xlsx",".xls"]);function xre(e=""){const t=e.trim(),n=t.lastIndexOf(".");return n<=0||n===t.length-1?"":t.slice(n).toLowerCase()}function yQe(e=""){return String(e).trim().replace(/^https?:\/\//i,"").replace(/\/+$/g,"").toLowerCase()}const hS=/^[A-Za-z0-9_-]{11}$/,vQe=new Set(["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com","youtu.be"]);function wQe(e){try{const t=new URL(e),n=t.hostname.toLowerCase();if(!vQe.has(n))return null;
432if(n==="youtu.be"){const a=t.pathname.split("/").filter(Boolean)[0]||"";return hS.test(a)?a:null}if(t.pathname==="/watch"){const a=t.searchParams.get("v")||"";return hS.test(a)?a:null}const r=t.pathname.split("/").filter(Boolean);return r.length>=2&&["shorts","embed","v","live"].includes(r[0])&&hS.test(r[1])?r[1]:null}catch{return null}}function r5(e=""){const t=wQe(String(e).trim());return t?`youtube.com/watch?v=${t}`:yQe(e)}function jQe(e,t){const n=t?.name||"",r=n.replace(/\.[^.]+$/,"");return[e?.title,e?.source,e?.meta?.filename,e?.meta?.original_filename].filter(Boolean).some(a=>String(a).includes(n)||String(a)===r)}function bre(e,t=[]){if(!e)return null;const n=xre(e.name);return n?n===".jsonl"||n===".ndjson"?at.unsupportedJsonl:gQe.has(n)?e.size===0?at.emptyFile:e.size>200*fQe?gre.has(n)?at.videoTooLarge:at.fileTooLarge:t.some(r=>jQe(r,e))?at.duplicateFile:null:at.unsupportedFileType:at.noExtension}function _Qe(e){return e.split(/\s+/).length>5&&!e.includes(".")}function yre(e){return e==="instagram.com"||e.endsWith(".instagram.com")}function kQe(e){try{const t=new URL(e),n=t.hostname.replace(/^www\./,"").toLowerCase();return["youtube.com","m.youtube.com","music.youtube.com"].includes(n)?t.pathname.split("/").filter(Boolean)[0]==="playlist":!1}catch{return!1}}function NQe(e){try{const t=new URL(e),n=t.hostname.replace(/^www\./,"").toLowerCase(),r=t.pathname.split("/").filter(Boolean);if(!r.length)return!1;if(yre(n))return!["p","reel","reels","tv"].includes(r[0].toLowerCase());if(n==="tiktok.com"||n.endsWith(".tiktok.com"))return r.length===1&&r[0].startsWith("@");if(n==="youtube.com"||n==="m.youtube.com"||n==="music.youtube.com"){const a=r[0].toLowerCase();return!!(a.startsWith("@")||["c","channel","user"].includes(a))}return["x.com","twitter.com","linkedin.com","facebook.com"].some(a=>n===a||n.endsWith(`.${a}`))?r.length<=2&&!r.some(a=>/status|posts|reel|videos|watch/i.test(a)):!1}catch{return!1}}function EQe(e){try{const t=new URL(e);return!t.search&&["","/"].includes(t.pathname)}catch{return!1}}function zB(e,t=[]){const n=r5(e);return n&&t.some(a=>
432[a?.source,a?.meta?.original_url,a?.meta?.webpage_url].filter(Boolean).some(o=>r5(o)===n))?at.duplicateUrl:null}function vre(e,t=[]){const n=String(e||"").trim();if(!n)return null;if(_Qe(n))return at.proseInUrlField;if(/^@[\w.-]+$/.test(n))return at.socialHandle;if(/^instagram\.com\/[^/]+\/?$/i.test(n)||/^www\.instagram\.com\/[^/]+\/?$/i.test(n))return at.instagramHandle;if(/^[a-z][a-z0-9+.-]*:\/\//i.test(n)&&!/^https?:\/\//i.test(n))return at.unsupportedScheme;if(!/^https?:\/\//i.test(n))return at.missingProtocol;if(zB(n,t))return zB(n,t);if(kQe(n))return at.youtubePlaylist;if(NQe(n))try{return yre(new URL(n).hostname.replace(/^www\./,"").toLowerCase())?at.instagramProfile:at.socialProfile}catch{return at.socialProfile}return EQe(n)?at.homepageUrl:null}function SQe(e,t=[]){const n=String(e||"").split(` 433`).map(i=>i.trim()).filter(Boolean),r=new Set,a=n.map(i=>{const o=vre(i,t);if(o)return{url:i,status:"error",error:o};const l=r5(i);return r.has(l)?{url:i,status:"error",error:at.duplicateUrl}:(r.add(l),{url:i,status:"processing"})});return{statuses:a,validUrls:a.filter(i=>i.status!=="error").map(i=>i.url),invalidCount:a.filter(i=>i.status==="error").length}}function CQe(e=[],t=0){if(!e.length)return at.noValidBulkUrls;if(e.length===1)return"";const n=e.filter(i=>i.status==="error").map(i=>i.error),r=new Set([at.missingProtocol,at.socialHandle,at.instagramHandle,at.unsupportedScheme]),a=n.length>0&&n.every(i=>r.has(i));return t?a?at.mixedBulkUrls:"":a?at.noValidBulkUrls:""}function TQe(e){const t=String(e||"").trim();if(VP.has(t))return t;const n=String(e||"").toLowerCase();return n?n.includes("expert_deleted_during_processing")||n.includes("expert was deleted")?at.expertDeletedDuringVideo:n.includes("no audio track")||n.includes("does not contain any stream")||n.includes("no audio output")?at.videoNoAudio:n.includes("openai_api_key")||n.includes("openrouter_api_key")||n.includes("openrouter transcription failed")||n.includes("cannot transcribe audio")?at.audioTranscriptionUnavailable:n.includes("instagram")&&(n.includes("private")||n.includes("unavailable")||n.includes("deleted"))?at.instagramUnavailable:n.includes("bot protection")||n.includes("blocking")?at.youtubeBlocked:n.includes("unavailable")||n.includes("private")||n.includes("region")||n.includes("age-restricted")?at.videoUnavailable:n.includes("video too long")||n.includes("max: 4:00:00")?at.videoTooLong:n.includes("could not extract video information")?at.socialProfile:at.fallback:at.fallback}function wre({error:e,message:t,sourceType:n="file",platform:r=null,file:a=null}={}){const i=String(t||"").trim();if(VP.has(i))return i;if(n==="video")return TQe(e||t);const o=String(e||t||"").trim();return o?Qo({response:{data:{detail:{message:o}}}},{operation:n==="url"?"url":"file",sourceType:n,platform:r,file:a}):at.fallback}function Qo(e,t={}){const n=t.operation||"upload",r=t.file,a=xre(r?.name||""),i=e?.response?.data?.detail||{},o=i.code||"",l=String(i.message||e?.message||"").trim(),c=l.toLowerCase();return e?.response?.status===401?at.sessionExpired:e?.response?.status===403||o==="FORBIDDEN"?at.permissionDenied:VP.has(l)?l:e?.response?o==="INVALID_FILE"?a===".jsonl"||a===".ndjson"?at.unsupportedJsonl:a?at.unsupportedFileType:at.noExtension:o==="FILE_TOO_LARGE"?gre.has(a)?at.videoTooLarge:at.fileTooLarge:o==="INVALID_URL"?vre(t.url||l)||at.missingProtocol:o==="JOB_NOT_FOUND"?at.jobExpired:o==="BUILD_FAILED"?at.indexingUnavailable:o==="SCORE_FAILED"?at.scoreFailed:o==="SUMMARY_FAILED"?at.summaryFailed:o==="ENHANCEMENT_INPUT_REQUIRED"?at.enhancementInputRequired:o==="ENHANCEMENT_LINKS_NOT_SUPPORTED"?at.enhancementLinksNotSupported:o==="ENHANCEMENT_TOO_LARGE"?at.enhancementTooLarge:o==="ENHANCEMENT_FAILED"?at.enhancementFailed:o==="CATEGORY_FAILED"?at.categoriesFailed:o==="URL_LOAD_FAILED"?AQe(l):c.includes("text file exceeds size limit")?at.textTooLarge:c.includes("image exceeds size limit")?at.imageTooLarge:c.includes("openai api is not configured")||c.includes("cannot extract text from images")?at.imageUnavailable:c.includes("no audio track")||c.includes("does not contain any stream")||c.includes("no audio output")?at.videoNoAudio:c.includes("no content extracted from the image")?at.imageNoContent:c.includes("invalid json")?at.invali
433dJson:c.includes("failed to read csv")?at.malformedCsv:c.includes("failed to read xlsx")?at.corruptExcel:c.includes("failed to read docx")?at.corruptDocx:c.includes("failed to read pdf")?c.includes("password")||c.includes("encrypted")?at.protectedPdf:at.corruptPdf:c.includes("0 chunks")||c.includes("no extractable")||c.includes("empty")?a===".pdf"?at.scannedPdf:xQe.has(a)?at.imageNoContent:bQe.has(a)?at.emptySpreadsheet:at.emptyFile:t.fallback||at.fallback:n==="enhance"?at.enhancementNetwork:n==="url"?at.urlNetwork:n==="polling"?t.sourceType==="file"?at.fileNetwork:t.sourceType==="url"||t.platform==="web"?at.urlNetwork:at.videoPollingNetwork:at.fileNetwork}function AQe(e){const t=String(e||"").toLowerCase();return t.includes("private or internal")?at.privateNetworkUrl:t.includes("access denied")||t.includes("status 403")?at.blockedWebsite:t.includes("page not found")||t.includes("status 404")?at.pageNotFound:t.includes("too many requests")||t.includes("status 429")?at.websiteRateLimited:t.includes("currently unavailable")||t.includes("status 5")?at.websiteUnavailable:t.includes("too large")||t.includes("10mb")||t.includes("response body exceeds")?at.webpageTooLarge:t.includes("no extractable content")||t.includes("js-rendered")||t.includes("empty")?at.noReadableTextOnPage:t.includes("failed to fetch")||t.includes("network")||t.includes("name or service")||t.includes("nodename")?at.brokenWebsite:at.fallback}const RQe=Object.freeze([".txt",".md",".pdf",".csv",".json",".docx",".doc",".xlsx",".xls",".png",".jpg",".jpeg",".webp",".mp4",".mov",".avi",".webm",".mkv",".m4v",".flv",".wmv",".m4a",".epub"]),IQe=RQe.join(","),PQe=2e3;function HB(e,t=Date.now()){const n=e.filter(a=>["processing","indexing"].includes(a.status));if(!n.length)return null;const r=Math.min(...n.map(a=>a.startedAt));return Math.max(0,r+PQe-t)}function LQe(){const e=new Set;return{start(){let t;const n=new Promise(r=>{t=r});return e.add(n),()=>{e.delete(n),t()}},async wait(){for(;e.size;)await Promise.all([...e])}}}function OQe(e){if(!e.length)return;const t=e.find(r=>r.status==="failed"),n=new Error(t?`We couldn't finish â${t.title||t.name||"a knowledge source"}â. Review your knowledge to retry or remove it.`:"Your knowledge has not finished processing. Review your sources before building.");throw n.code="KNOWLEDGE_NOT_READY",n}const qB=5,pS=72,mS=e=>new Promise(t=>{setTimeout(t,e)}),MQe=/\b(?:https?:\/\/|www\.)\S+/i;function DQe(e){return MQe.test(e)}function $Qe(e){return String(e||"").replace(/^\s{0,3}#{1,6}\s+/,"").replace(/[*_`~]/g,"").replace(/\s+/g," ").trim()}function jre(e){const t=$Qe(e);if(t.length<=pS)return t;const n=t.slice(0,pS+1),r=n.lastIndexOf(" "),a=r>=36?r:pS;return`${n.slice(0,a).trimEnd()}â¦`}function _re(e){return jre(e)||"Knowledge note"}function FQe(e,t){const n=jre(e);if(n)return n;const r=String(t||"").split(` 434`).find(a=>/^\s{0,3}#{1,6}\s+\S/.test(a));return _re(r||t)}function BQe(e){const t=e.split(/\n+/).map(r=>r.trim()).filter(Boolean);if(!t.length)return[];const n=[];for(const r of t)try{const a=new URL(r);if(!["http:","https:"].includes(a.protocol))return[];n.push(a.toString())}catch{return[]}return n}function fS({kind:e,label:t,text:n,source:r}){return{id:`dev-source-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,title:t,name:t,filename:t,source:e==="url"?n:r||t,source_type:e,word_count:e==="url"?0:n.trim().split(/\s+/).filter(Boolean).length,status:"ready"}}function fv(e){const t=String(e?.source||"").split(/[\\/]/).pop();if(/^(?:doc_[a-f0-9]{10}_)?knowledge-note-(?:\d+|preview-\d+)\.txt$/i.test(t)&&e?.title)return e.title;const n=cre(e);return n==="Untitled"&&(e.name||e.filename)||n}function gS({sourceType:e,source:t,title:n,progressLabel:r="Uploading"}){return{id:`pending-source-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,title:n,name:n,filename:n,source:t,source_type:e,status:"processing",startedAt:Date.now(),progressLabel:r,pending:!0}}function GP({ref:e,hidden:t=!1,expertId:n,onEnsureDraft:r,documents:a=[],onDocumentsChange:i,onKnowledgeActivity:o,errorMessage:l="",addToast:c,previewMode:u=!1,onEnsureEnhancementSession:d,onQueueDraft:h,onQueueFiles:p,onRemoveQueuedSource:m,onContinue:g,onSkip:x,onBack:b,progressStep:y="profile-knowledge",progressSteps:v,styleDirective:w="",onStyleChange:j,onPersonaApplied:E}){const S=y==="business-knowledge",[_,k]=f.useState(""),[C,N]=f.useState(""),[A,T]=f.useState("note"),[I,$]=f.useState(!1),[O,U]=f.useState([]),F=f.useRef([]),H=f.useRef(null);H.current||(H.current=LQe());const[,G]=f.useState(0),M=f.useCallback($e=>{const Qe=typeof $e=="function"?$e(F.current):$e;F.current=Qe,U(Qe)},[]);f.useImperativeHandle(e,()=>({async waitForCompletion(){await H.current.wait(),OQe(F.current)}}),[]);const z=HB(O)===0;f.useEffect(()=>{const $e=HB(O);if($e===null||$e===0)return;const Qe=setTimeout(()=>G(ct=>ct+1),$e);return()=>clearTimeout(Qe)},[O]);const[W,D]=f.useState(""),[Z,V]=f.useState(null),[L,K]=f.useState(!1),te=f.useRef(null),Q=f.useRef(null),Y=f.useRef(!1),J=f.useRef(new Set);f.useEffect(()=>(Y.current=!1,()=>{Y.current=!0}),[]);const P=f.useCallback($e=>{k(Qe=>
434[Qe.trim(),$e].filter(Boolean).join(` 435 436`)),T("note"),requestAnimationFrame(()=>te.current?.focus())},[]),ee=ore({onTranscript:P}),X=I||ee.isBusy,ae=DQe(_),me=O.some($e=>$e.status==="processing"||$e.status==="indexing"),q=f.useCallback(async $e=>{const ct=((await mu($e)).data?.documents||[]).filter(ve=>!J.current.has(ve.id));return i?.(ct),ct},[i]),he=f.useCallback(($e,Qe)=>{const ct=new Set(Array.isArray($e)?$e:[$e]);M(ve=>ve.map(Ye=>ct.has(Ye.id)?{...Ye,...Qe}:Ye))},[M]),se=f.useCallback(async($e,Qe,ct,ve)=>{const Ye=Date.now();for(;;){const rt=mQe(Date.now()-Ye);await mS(rt==="fast"?hre:pre);const qe=(await Xm($e,Qe)).data;if(qe?.status==="completed")return;if(qe?.status==="failed")throw new Error(wre({error:qe.error,message:qe.message,...ct}));rt!=="fast"?he(ve,{status:"processing",progressLabel:"Still processing"}):qe?.message&&he(ve,{status:"processing",progressLabel:qe.message})}},[he]),le=async()=>n||r?.(),ke=async($e,Qe,ct)=>{he(ct,{status:"indexing",progressLabel:"Preparing for answers"});const ve=await $T($e);try{const Ye=ve?.data?.persona;if(Ye)await E?.({persona:Ye}),Ye.communication_style&&j?.(Ye.communication_style);else{const rt=await lQe($e,{skip:oQe(w)});rt&&j?.(rt)}}catch{}o?.(),await q($e),M(Ye=>Ye.filter(rt=>!ct.includes(rt.id))),!Y.current&&Qe&&c?.(Qe,"success")},oe=async($e,Qe,ct,ve=[])=>{const Ye=await Promise.allSettled(Qe.map(({run:qe})=>qe())),rt=[],De=[...ve];if(Ye.forEach((qe,ye)=>{const Ze=Qe[ye].pendingId;if(qe.status==="fulfilled"){rt.push(Ze);return}const jt=qe.reason?.message||at.fallback;De.push(qe.reason instanceof Error?qe.reason:new Error(jt)),he(Ze,{status:"failed",progressLabel:"Needs attention",error:jt})}),rt.length&&await ke($e,De.length?null:ct,rt),De.length)throw De[0]},Oe=($e,Qe,ct)=>{const ve=Qe.length?Qe.map(Ye=>fS({kind:"url",label:new URL(Ye).hostname,text:Ye})):[fS({kind:"file",label:ct,text:$e,source:`knowledge-note-preview-${Date.now()}.txt`})];i?.([...a,...ve]),o?.()},Je=async()=>{const $e=_.trim();if(!$e||X)return;const Qe=BQe($e),ct=Qe.length?null:new File([$e],`knowledge-note-${Date.now()}.txt`,{type:"text/plain"}),ve=Qe.length?"":C||_re($e),Ye=Qe.length?Qe.map(De=>gS({sourceType:"url",source:De,title:new URL(De).hostname,progressLabel:"Reading link"})):[gS({sourceType:"file",source:ct.name,title:ve,progressLabel:"Saving note"})];D(""),u||M(De=>[...De,...Ye]),u||o?.(),k(""),N(""),T("note"),requestAnimationFrame(()=>te.current?.focus());const rt=H.current.start();try{if(u)if(await mS(480),h){const De=await h($e,Qe,ve);i?.(De),o?.()}else Oe($e,Qe,ve);else{const De=await le();if(!De)throw new Error("We could not start your knowledge base. Please try again.");if(Qe.length){const qe=Qe.map((ye,Ze)=>({pendingId:Ye[Ze].id,run:async()=>{const jt=await S_(De,ye,null,Ze);if(jt.status!=="accepted"||!jt.data?.job_id)throw new Error(at.fallback);return se(De,jt.data.job_id,{sourceType:"url",url:ye},Ye[Ze].id)}}));await oe(De,qe,Qe.length===1?"Your link is now part of your knowledge.":`${Qe.length} links added to your knowledge.`)}else{const ye=(await Cw(De,[ct],ve)).data?.files?.[0];if(ye?.status!=="accepted"||!ye.job_id)throw new Error(ye?.message||at.fallback);await se(De,ye.job_id,{sourceType:"file",file:ct},Ye[0].id),await ke(De,"Your note is now part of your knowledge.",[Ye[0].id])}}}catch(De){if(!Y.current){const qe=De?.message||at.fallback;D(qe),he(Ye.map(ye=>ye.id),{status:"failed",progressLabel:"Needs attention",error:qe})}}finally{rt()}},Ie=async()=>{const $e=_.trim();if(!(!$e||ae||X)){$(!0),D("");try{let Qe,ct;if(u){await d?.();const ve=await YM(null,$e);Qe=ve.data?.text?.trim(),ct=ve.data?.title}else{const ve=await le();if(!ve)throw new Error("We could not start your knowledge base. Please try again.");const Ye=await YM(ve,$e);Qe=Ye.data?.text?.trim(),ct=Ye.data?.title}if(!Qe)throw new Error(at.enhancementFailed);Y.current||(k(Qe),N(FQe(ct,Qe)),T("note"),c?.("Your note is richer and ready to review.","success"),requestAnimationFrame(()=>te.current?.focus()))}catch(Qe){Y.current||D(Qo(Qe,{operation:"enhance",fallback:Qe?.message||at.enhancementFailed}))}finally{Y.current||$(!1)}}},ue=async $e=>{const Qe=Array.from($e||[]);if(!Qe.length||X)return;if(Q.current&&(Q.current.value=""),Qe.length>50){D(at.tooManyFiles);return}const ct=Qe.map(rt=>
436bre(rt,a)).filter(Boolean);if(ct.length){D(ct[0]);return}D("");const ve=Qe.map(rt=>gS({sourceType:"file",source:rt.name,title:rt.name}));u||M(rt=>[...rt,...ve]);const Ye=H.current.start();u||o?.();try{if(u){if(await mS(480),p){const rt=await p(Qe);i?.(rt)}else{const rt=Qe.map(De=>fS({kind:"file",label:De.name,text:De.name}));i?.([...a,...rt])}o?.()}else{const rt=await le();if(!rt)throw new Error("We could not start your knowledge base. Please try again.");const De=[],qe=[];for(let ye=0;ye<Qe.length;ye+=qB){const Ze=Qe.slice(ye,ye+qB);let jt;try{jt=await Cw(rt,Ze)}catch(ne){const ge=Qo(ne,{operation:"file",fallback:ne?.message||at.fallback});qe.push(ne instanceof Error?ne:new Error(ge)),he(Ze.map((xe,pe)=>ve[ye+pe].id),{status:"failed",progressLabel:"Needs attention",error:ge});continue}const Nt=jt.data?.files||[];for(const ne of Nt){const ge=Ze[ne.index],xe=ve[ye+ne.index].id;if(ne.status!=="accepted"||!ne.job_id){const pe=new Error(ne.message||at.fallback);qe.push(pe),he(xe,{status:"failed",progressLabel:"Needs attention",error:pe.message});continue}De.push({pendingId:xe,run:()=>se(rt,ne.job_id,{sourceType:"file",file:ge},xe)})}}o?.(),await oe(rt,De,Qe.length===1?`${Qe[0].name} is now in your knowledge.`:`${Qe.length} files added to your knowledge.`,qe)}}catch(rt){if(!Y.current){const De=Qo(rt,{operation:"file",fallback:rt?.message||at.fallback});D(De),he(ve.map(qe=>qe.id),{status:"failed",progressLabel:"Needs attention",error:De})}}finally{Ye()}},be=$e=>{V($e)},Re=()=>{const $e=Z;if(!$e)return;if(V(null),D(""),$e.pending){M(ct=>ct.filter(ve=>ve.id!==$e.id));return}const Qe=a.findIndex(ct=>ct.id===$e.id);J.current.add($e.id),i?.(ct=>(Array.isArray(ct)?ct:a).filter(ve=>ve.id!==$e.id)),(async()=>{try{if(u){if(m){const ct=await m($e.id);Y.current||i?.(ct)}}else{const ct=n||await le();if(!ct)throw new Error("This source is not ready to remove yet.");await FG(ct,$e.id)}}catch(ct){if(!Y.current){i?.(Ye=>{const rt=[...Array.isArray(Ye)?Ye:a];return rt.some(De=>De.id===$e.id)||rt.splice(Math.max(0,Math.min(Qe,rt.length)),0,$e),rt});const ve=Qo(ct,{operation:"delete",fallback:at.deleteFailed});D(ve),c?.(ve,"error")}}finally{J.current.delete($e.id)}})()},Ge=()=>{T("link"),te.current?.focus()},it=()=>{ee.isRecording?ee.stop():ee.status==="requesting"?ee.cancel():ee.start()},ut=ee.status==="requesting"?"Cancel mic":ee.isRecording?"Stop":ee.isTranscribing?"Transcribing":ee.isDenied?"Mic blocked":ee.status==="error"?"Try voice again":"Voice",$t=[...O,...a],tt=$t.length,He=a.length>0,wt=tt>3,St=wt&&L,Zt=St?$t:$t.slice(0,3),Jt=W||l||ee.error?.message||(ee.isDenied?"Microphone access is blocked. Allow it in your browser, then try again.":"");return s.jsxs("section",{hidden:t,className:"ce-pre-journey ce-onboarding-screen ce-profile-knowledge-screen",children:[s.jsxs("header",{className:"ce-onboarding-header ce-profile-knowledge-header",children:[s.jsx(jl,{step:y,steps:v}),s.jsxs("h1",{children:["Add ",s.jsx("em",{className:"ge-em",children:"knowledge"})]}),s.jsx("p",{children:"Everything you add here becomes part of what your expert knows."}),x?s.jsx("button",{type:"button",className:"ce-onboarding-header-skip",onClick:x,disabled:X||me&&!z,children:"Skip"}):null]}),s.jsx("div",{className:"ce-onboarding-content ce-profile-knowledge-body",children:s.jsxs("div",{className:"ce-profile-knowledge-inner",children:[s.jsxs("div",{className:"ce-profile-knowledge-composer-stage",children:[s.jsxs("div",{className:`ce-knowledge-composer${X?" is-busy":""}`,onDragOver:$e=>$e.preventDefault(),onDrop:$e=>{$e.preventDefault(),ue($e.dataTransfer.files)},children:[s.jsx("textarea",{ref:te,value:_,onChange:$e=>{const Qe=$e.target.value;k(Qe),Qe.trim()||N("")},disabled:X,rows:6,placeholder:S?A==="link"?"Paste links to your website, docs, videos or Zoom recordings, one per lineâ¦":"Drop in your PDFs, docs, FAQs and Zoom call transcripts, or paste links and notesâ¦":A==="link"?"Paste one or more links, one per lineâ¦":"Type notes, paste links, or drop files anywhere hereâ¦","aria-label":"Knowledge note or links"}),s.jsxs("div",{className:"ce-knowledge-composer-toolbar",children:[s.jsxs("div",{className:"ce-knowledge-source-actions",role:"group","aria-label":"Knowledge source type",children:[s.jsxs("button",{type:"button",onClick:()=>Q.current?.click(),disabled:X,"aria-label":"Upload files",children:[s.jsx(WT,{size:19,"aria-hidden":"true"}),s.jsx("span",{className:"ce-knowledge-action-label",children:"Upload"})]}),s.jsxs("button",{type:"button",onClick:Ge,disabled:X,"aria-label":"Add a link",children:[s.jsx(wb,{size:19,"aria-hidden":"true"}),s.jsx("span",{className:"ce-knowledge-action-label",children:"Link"})]}),s.jsxs("button",{type:"button",className:"ce-knowledge-enhance",onClick:Ie,disabled:!_.trim()||ae||X,"aria-label":I?"Enhancing text":ae?"Enhance unavailable for text with links":"Enhance text",title:ae?"Enhance is available for text without links.":"Expand and structure this text for a richer expert knowledge base.",children:[I?s.jsx(vt,{size:18,className:"animate-spin","aria-hidden":"true"}):s.jsx(Ms,{size:19,"aria-hidden":"true"}),s.jsx("span",{className:"ce-knowledge-action-label",children:I?"Enhancing":"Enhance"})]})]}),s.jsxs("div",{className:"ce-knowledge-submit-actions",children:[s.jsx("button",{type:"button",className:`ce-knowledge-voice${ee.isRecording?" is-recording":""}`,onClick:it,disabled:I||ee.isTranscribing,"aria-label":ut,title:ut,children:ee.status==="requesting"||ee.isTranscribing?s.jsx(vt,{size:18,className:"animate-spin","aria-hidden":"true"}):ee.isRecording?s.jsx(ku,{size:15,fill:"currentColor","aria-hidden":"true"}):s.jsx(Qr,{size:19,"aria-hidden":"true"})}),s.jsxs("button",{type:"button",className:"ce-knowledge-add",onClick:Je,disabled:!_.trim()||X,"aria-label":"Add to knowledge",children:[s.jsx(Es,{size:19,"aria-hidden":"true"}),"Add",s.jsx("span",{className:"ce-knowledge-add-tail",children:" to knowledge"})]})]})]}),s.jsx("input",{ref:Q,className:"sr-only",type:"file",accept:IQe,multiple:!0,"aria-label":"Upload knowledge files",onChange:$e=>ue($e.target.files)})]}),Jt?s.jsx("p",{className:"ce-profile-knowledge-error",role:"alert",children:Jt}):null,s.jsxs("p",{className:"ce-profile-knowledge-consent",children:["By continuing, you confirm you own or license this material and allow it to be used to create your AI expert under the"," ",s.jsxs("span",{className:"ce-consent-terms",children:[s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms & Conditions"}),"."]})]})]}),s.jsxs("div",{className:`ce-knowledge-library${St?" is-expanded":""}`,children:[s.jsxs("div",{className:"ce-knowledge-library-heading",children:[s.jsx("h2",{children:"Your knowledge"}),tt>0?s.jsxs("span",{children:[tt," ",tt===1?"source":"sources"]}):null]}),tt?s.jsxs(s.Fragment,{children:[s.jsx("ul",{id:"ce-knowledge-source-list",className:`ce-knowledge-source-list${St?" is-expanded":""}`,tabIndex:St?0:void 0,"aria-label":St?"All knowledge sources":void 0,children:Zt.map($e=>s.jsxs("li",{children:[s.jsx(dre,{doc:$e}),s.jsxs("span",{className:"ce-knowledge-source-copy",children:[s.jsx("strong",{children:fv($e)}
436),s.jsx("small",{children:[ure($e),hQe($e)].filter(Boolean).join(" · ")})]}),["processing","indexing"].includes($e.status)?s.jsx("span",{className:"ce-knowledge-source-progress",role:"status","aria-label":`${fv($e)}: ${$e.progressLabel||"Processing"}`,children:s.jsx(vt,{size:19,className:"animate-spin","aria-hidden":"true"})}):s.jsx("button",{type:"button",onClick:()=>be($e),"aria-label":`Remove ${fv($e)}`,children:s.jsx(Qs,{size:17,"aria-hidden":"true"})})]},$e.id))}),wt?s.jsx("button",{type:"button",className:"ce-knowledge-show-more",onClick:()=>K($e=>!$e),"aria-expanded":St,"aria-controls":"ce-knowledge-source-list",children:St?"Show less":`Show more (${tt-3})`}):null]}):s.jsxs("div",{className:"ce-knowledge-empty",role:"status",children:[s.jsx("ul",{className:"ce-knowledge-ghosts","aria-hidden":"true",children:[WT,wb,si].map(($e,Qe)=>s.jsxs("li",{children:[s.jsx("span",{className:"ce-knowledge-ghost-icon",children:s.jsx($e,{size:17,strokeWidth:2})}),s.jsxs("span",{className:"ce-knowledge-ghost-lines",children:[s.jsx("i",{}),s.jsx("i",{})]})]},Qe))}),s.jsx("p",{children:"Your files, links and notes will appear here"})]})]})]})}),s.jsxs("footer",{className:"ce-onboarding-footer ce-profile-knowledge-footer",children:[z?s.jsx("p",{className:"ce-knowledge-background-notice",role:"status",children:"Your knowledge is being prepared in the background. You can continue."}):null,s.jsx(Lo,{onBack:()=>{ee.cancel(),b?.()},onContinue:g,continueDisabled:X||me&&!z||!He&&!me})]}),s.jsxs(en,{isOpen:!!Z,onClose:()=>V(null),title:"Remove this knowledge source?",maxWidth:"max-w-sm",children:[s.jsx("p",{className:"text-sm leading-relaxed text-ink-mid",children:Z?`â${fv(Z)}â will be removed from your expert's knowledge. This cannot be undone.`:""}),s.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[s.jsx(yt,{variant:"secondary",onClick:()=>V(null),children:"Cancel"}),s.jsx(yt,{variant:"danger",onClick:Re,children:"Remove source"})]})]})]})}var UQe=["title"],zQe=["title"],HQe=["title"],qQe=["title"],WQe=["title"],VQe=["title"],GQe=["title"],YQe=["title"],KQe=["title"],XQe=["title"],JQe=["title"],QQe=["title"],ZQe=["title"];function za(){return za=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},za.apply(this,arguments)}function Ri(e,t){if(e==null)return{};var n=eZe(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function eZe(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}var tZe=function(t){var n=t.title,r=Ri(t,UQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},r),n&&B.createElement("title",null,n),B.createElement("path",{fill:"#D80027",d:"M0 0h513v342H0z"}),B.createElement("path",{d:"m226.8 239.2-9.7-15.6-17.9 4.4 11.9-14.1-9.7-15.6 17.1 6.9 11.8-14.1-1.3 18.4 17.1 6.9-17.9 4.4zM290.6 82l-10.1 15.4 11.6 14.3-17.7-4.8-10.1 15.5-1-18.4-17.7-4.8 17.2-6.6-1-18.4 11.6 14.3zm-54.4-56.6-2 18.3 16.8 7.6-18 3.8-2 18.3-9.2-16-17.9 3.8 12.3-13.7-9.2-15.9 16.8 7.5zm56.6 136.4-14.9 10.9 5.8 17.5-14.9-10.8-14.9 11 5.6-17.6-14.9-10.7 18.4-.1 5.6-17.6 5.8 17.5zM115 46.3l17.3 53.5h56.2l-45.4 32.9 17.3 53.5-45.4-33-45.5 33 17.4-53.5-45.5-32.9h56.3z",fill:"#FFDA44"}))},sZe=function(t){var n=t.title,r=Ri(t,zQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},r),n&&B.createElement("title",null,n),B.createElement("path",{fill:"#D80027",d:"M0 0h513v342H0z"}),B.createElement("path",{d:"M0 0h513v114H0z"}),B.createElement("path",{fill:"#FFDA44",d:"M0 228h513v114H0z"}))},nZe=function(t){var n=t.title,r=Ri(t,HQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 22.5 15"},r),n&&B.createElement("title",null,n),B.createElement("path",{fill:"#FFF",d:"M0 0h22.5v15H0V0z"}),B.createElement("path",{fill:"#D03433",d:"M0 0h22.5v4H0V0zm0 11h22.5v4H0v-4z"}),B.createElement("path",{fill:"#FBCA46",d:"M0 4h22.5v7H0V4z"}),B.createElement("path",{fill:"#FFF",d:"M7.8 7h1v.5h-1V7z"}),B.createElement("path",{fill:"#A41517",d:"M7.2 8.5c0 .3.3.5.6.5s.6-.2.6-.5L8.5 7H7.1l.1 1.5zM6.6 7c0-.3.2-.5.4-.5h1.5c.3 0 .5.2.5.4V7l-.1 1.5c-.1.6-.5 1-1.1 1-.6 0-1-.4-1.1-1L6.6 7z"}),B.createElement("path",{fill:"#A41517",d:"M6.8 7.5h2V8h-.5l-.5 1-.5-1h-.5v-.5zM5.3 6h1v3.5h-1V6zm4 0h1v3.5h-1V6zm-2.5-.5c0-.3.2-.5.5-.5h1c.3 0 .5.2.5.5v.2c0 .2-.1.3-.3.3H7c-.1 0-.2-.1-.2-.2v-.3z"}))},rZe=function(t){var n=t.title,r=Ri(t,qQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},r),n&&B.createElement("title",null,n),B.createElement("path",{fill:"#FFF",d:"M0 0h513v342H0z"}),B.createElement("path",{fill:"#00318A",d:"M0 0h171v342H0z"}),B.createElement("path",{fill:"#D80027",d:"M342 0h171v342H342z"}))},aZe=function(t){var n=t.title,r=Ri(t,WQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},r),n&&B.createElement("title",null,n),B.createElement("g",{fill:"#FFF"},B.createElement("path",{d:"M0 0h513v341.3H0V0z"}),B.createElement("path",{d:"M311.7 230 513 341.3v-31.5L369.3 230h-57.6zM200.3 111.3 0 0v31.5l143.7 79.8h56.6z"})),B.createElement("path",{d:"M393.8 230 513 295.7V230H393.8zm-82.1 0L513 341.3v-31.5L369.3 230h-57.6zm146.9 111.3-147-81.7v81.7h147zM90.3 230 0 280.2V230h90.3zm110 14.2v97.2H25.5l174.8-97.2zm-82.1-132.9L0 45.6v65.7h118.2zm82.1 0L0 0v31.5l143.7 79.8h56.6zM53.4 0l147 81.7V0h-147zm368.3 111.3L513 61.1v50.2h-91.3zm-110-14.2V0h174.9L311.7 97.1z",fill:"#012169"}),B.createElement("g",{fill:"#c8102e"},B.createElement("path",{d:"M288 0h-64v138.7H0v64h224v138.7h64V202.7h224v-64H288V0z"}),B.createElement("path",{d:"M311.7 230 513 341.3v-31.5L369.3 230h-57.6zm-168 0L0 309.9v31.5L200.3 230h-56.6zm56.6-118.7L0 0v31.5l143.7 79.8h56.6zm168 0L513 31.5V0L311.7 111.3h56.6z"})))},xS=function(t){var n=t.title,r=Ri(t,VQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},r),n&&B.createElement("title",null,n),B.createElement("path",{fill:"#ff6820",d:"M0 0h513v114H0V0z"}),B.createElement("path",{fill:"#FFF",d:"M0 114h513v114H0V114z"}
436),B.createElement("path",{fill:"#046a38",d:"M0 228h513v114H0V228z"}),B.createElement("path",{fill:"none",stroke:"#07038d",strokeWidth:4,d:"M256.5 136.8c18.9 0 34.2 15.3 34.2 34.2s-15.3 34.2-34.2 34.2-34.2-15.3-34.2-34.2 15.3-34.2 34.2-34.2z"}),B.createElement("path",{d:"m265.3 138.2-17.6 65.7m17.6-65.7-17.6 65.7m25.8-62.3-34 58.9m41-53.5-48 48m53.4-41L227 188m62.3-25.8-65.7 17.6m66.9-8.8h-68m66.8 8.8-65.7-17.6m62.3 25.8L227 154m53.5 41-48-48m41 53.4-34-58.9m25.8 62.3-17.6-65.7m8.8 66.9v-68m-8.8 66.8 17.6-65.7m-25.8 62.3 34-58.9m-41 53.5 48.1-48.1M227.1 188l58.9-34m-62.3 25.8 65.7-17.6m-66.9 8.8h68m-66.8-8.8 65.7 17.6M227.1 154l58.9 34m-53.5-41 48.1 48.1m-41.1-53.5 34 58.9m-25.8-62.3 17.6 65.7",stroke:"#07038d",strokeWidth:2}))},iZe=function(t){var n=t.title,r=Ri(t,GQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},r),n&&B.createElement("title",null,n),B.createElement("path",{fill:"#F4F5F0",d:"M342 0H0v341.3h512V0z"}),B.createElement("path",{fill:"#008C45",d:"M0 0h171v342H0z"}),B.createElement("path",{fill:"#CD212A",d:"M342 0h171v342H342z"}))},oZe=function(t){var n=t.title,r=Ri(t,YQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},r),n&&B.createElement("title",null,n),B.createElement("path",{fill:"#FFF",d:"M0 0h512v342H0z"}),B.createElement("circle",{fill:"#D80027",cx:256.5,cy:171,r:96}))},lZe=function(t){var n=t.title,r=Ri(t,KQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},r),n&&B.createElement("title",null,n),B.createElement("path",{fill:"#FFF",d:"M0 0h513v342H0z"}),B.createElement("path",{fill:"#dc143c",d:"M0 171h513v171H0z"}))},cZe=function(t){var n=t.title,r=Ri(t,XQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},r),n&&B.createElement("title",null,n),B.createElement("path",{fill:"red",d:"M0 0h513v342H0z"}),B.createElement("path",{fill:"#060",d:"M197 0v342H0V0z"}),B.createElement("circle",{fill:"#FF0",cx:197.1,cy:171,r:64}),B.createElement("path",{fill:"red",d:"M161.1 139v40c0 19.9 16.1 36 36 36s36-16.1 36-36v-40h-72z"}),B.createElement("path",{fill:"#FFF",d:"M197.1 191c-6.6 0-12-5.4-12-12v-16h24v16c0 6.6-5.3 12-12 12z"}))},uZe=function(t){var n=t.title,r=Ri(t,JQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},r),n&&B.createElement("title",null,n),B.createElement("path",{d:"M0 0h513v342H0z",fill:"#fff"}),B.createElement("g",{fill:"#00512e"},B.createElement("path",{d:"M0 0v342h513V0zm218 76q1 2-2 5-3 2-1 4 3 4 0 6-2 1-5-1-6-6 0-14 6-4 8 0m-102 2 1 6q0 4-2 4-5 1-5-6l2-4zm39 1 1 2q-1 4-5 4-5 0-6-4c0-4 7-6 10-2m47 2q3 4 2 9c-1 2-22 19-24 19q-3 0-4-4l6-6 6-5v-3c-5-10 7-18 14-10m35-3q3 1 0 7-2 8-6 6c-3-1-3 14 0 19q2 4 7-1c2-3 2-5 2-15 0-12 0-13 2-13q5-2 5 13 1 11 3 13 3 6 6 3 3-2-1-12-3-12 1-16h9q2-2 9 1l6 2 1-2q4-4 6-1l3 17c3 16 3 16 7 24l15 30q1 6-4 5l-8-14-6-12 1 20c1 21 1 23-4 23q-4 2-4-15l-1-27-1-16-9-13c-8-12-8-13-11-13q-6-1-2 6l2 7q0 4 3 2 6-2 6 3-1 4-8 5l-5 2-5 2q-6 0-10-3-2-3-5 1-5 5-12 2-5-1-7-10l-1-3-1 3q-3 7-9 8-7 0-9-11-3-10 2-10 4-1 5 7l2 6q1 0 4-7 6-17 13-12h1c-1-1 2-10 4-11zm-97 10 2 16 1 9h4q5 2 6-1c2-1 2-2-1-11l-3-12 3-1 11 5V82q4-2 6 1l3 23 1 20h2q5 0 5 5 1 6 3 0 3-9 8-2 1 3 2 0 3-7 4-6c5 0 6 7 1 13q-3 3-7 3l-6 1q-5 4-10 0l-2-2v5c0 21-16 42-33 42q-21-1-23-21 0-5 2-6 4-1 6 6 1 12 12 13 14 2 24-15 6-11 1-5-12 18-28 11-7-5-9-17-2-6 1-7 5-3 6 6 1 12 10 12 7 0 13-8 5-8-1-7-11-1-8-12 8-11 17-5l3 2-1-12-4-22q-3 1 0 7c2 6 2 6 0 10l-5 5q-3 3-7 1h-5l-1 16c-1 19-1 20-4 21-4 1-4-2-4-19l1-15-3 1q-3 1-6-2c-2-2-2-2-3-14l-1-12q-2-1-2 10l-1 13q-3 6-8 4c-3-2-4-4-7-15q-4-15 2-14 4-1 5 8l1 5 1-6q0-13 9-12l6 2c2 3 2 4 2 14l1 11 2-1 1-8-2-16q-3-12 2-11 3-1 5 7m163-3q4 10 1 13-4 3-7-7-3-11 2-10zm12-3 3 7q2 6 1 8v16l2 27c2 22 2 21 6 21h3l-1-5-2-23-3-33c-2-16-1-19 3-19 3 0 8 14 6 16v24c5 47 5 48 0 47q-3-2-1 4l2 6q2 1 5-9 7-18 10-16 3 0 7 5 4 7 7 7 4-1 1-33l-1-21-10-12-9-15q0-5 8-1 5 2 6 6l2 6q3 4 1-4 0-10 3-10c4 0 9 10 7 13l-1 8q1 8 4 12l3 3-2-15c-2-16-2-19 1-20q3 0 5 4l4 5h2q6-4 8 9 0 8-4 8-3 0-4-6 1-8-3-5c-1 2-1 3 1 19l2 17 5 7c6 10 12 21 11 22q-2 3-5 2l-5-8-5-8 1 8c0 11 0 11-3 11q-5 3-5-7l-1-16c0-8-1-10-4-15l-4-5v19c1 21 0 25-5 28q-6 5-13-3l-4-5-4 9q-6 14-11 15-9-1-11-16-1-8-5-1c-3 5-12 13-19 17q-8 4-8-2-1-2 6-6c9-5 17-14 17-18l-5-78q2-4 5-1m89 5 4 6q1 1-2 3l-2 2 4 24q4 25 4 35c0 10 0 11-3 17q-7 13-19 14-8 0-7-2-2-4 7-6 15-2 14-23a708 708 0 0 0-8-75c3-2 3-1 8 5m-211 19 1 4q0 3 2 2 5 0 5 4c0 4-9 6-13 2-4-5 0-17 5-12m108 1h2l4-1q4 2 0 7-7 6-11-1v-5q3-2 5 0m55 2q3 4-1 6-2 0-1 5t-1 6q-1 2-10-6-8-7-6-9 3-4 7 0l2 2 2-3q5-3 8-1m-131 13c3 2 6 14 6 17q-1 6 6 1l10-4q5-1 7-4 4-9 10-12 10 0 11 9 0 7-16 13l-2 1 13 1c16 0 16 0 13 9q-2 7-4 7l-10 2q-19 3-17 9 1 2 4 3 6 3 3 7l-7 1q-13-2-21-10l-3-3-2 3q-7 10-19 13-10 2-15-10l-5 2q-18 10-19 8l-2-3c0-2 1-2 15-11l9-6q1-3 5-4c3 1 10-5 12-9q3-6-1-15l-2-8q1-5 6-6c3 0 8 5 8 7q-1 4-4 3v1l1 10c1 9-1 13-10 21l-7 6 2 3q5 9 15-2 10-8 10-23 0-10-6-24v-4q3-4 6 1m17 2q2 3 4 0 11-3 5 5c-4 5-12 5-15-1v-4zm118 5 1 2q1 2-7 8c-8 6-9 7-11 5q-5-4 6-10c8-6 8-6 11-5m-229 3q3 2-10 10-12 8-13 3-5-3 9-10 13-8 14-3m229 10c3 2 4 9 3 11q-3 3-6 1c-2-2-3-11-1-13q1-2 4 1m-172 7q3 3 2 7 1 5-3 5-3 1-3-3l-2-4q-3-3-1-6 4-2 7 1m-79 9 1 8q0 9 3 6 4-1 4 3-1 7-7 7-7-1-7-14-1-9 2-10zm168 12q0 4 3 2t4 3q-2 6-8 8l-4-2q-3-3-4-2-4 0-5-4l5-6q7-6 7-4 3 1 2 5m102 3q4 4 1 9-7 7-7-4t6-5m-42 73c0 2 1 2 12 2q24-1 22 11 0 7-6 10c-4 1-31 2-34 0q-2-1-2-6v-4h-82l-74-1c-16 0-28-10-28-10h92c91 0 92
436-1 92-2q-1-3 4-5c5-2 4 4 4 5"}),B.createElement("path",{d:"m195 86 1 1 1-1-1-1q-2 0-1 1m84 5q-2 2 1 5l3 3-1-4-1-5zm-125 45q-3 3-1 4 5-1 6-4zm110-7q-4 5 0 3 6-4 2-4zm-31 30q0 6 4 8l5 4q3 2 2-3 0-3 4-7 4-3 2-4l-13-3h-5zm104 101q-1 3 13 2c11 0 13 0 14-2l-13-1z"})))},dZe=function(t){var n=t.title,r=Ri(t,QQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 85.333 512 341.333"},r),n&&B.createElement("title",null,n),B.createElement("path",{fill:"#FFF",d:"M0 85.334h512V426.66H0z"}),B.createElement("path",{fill:"#0052B4",d:"M0 194.056h512v123.882H0z"}),B.createElement("path",{d:"M0 85.334h512v54.522H0zm0 286.809h512v54.522H0z",fill:"#D80027"}))},hZe=function(t){var n=t.title,r=Ri(t,ZQe);return B.createElement("svg",za({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},r),n&&B.createElement("title",null,n),B.createElement("path",{fill:"#FFF",d:"M0 0h513v342H0z"}),B.createElement("path",{d:"M0 0h513v26.3H0zm0 52.6h513v26.3H0zm0 52.6h513v26.3H0zm0 52.6h513v26.3H0zm0 52.7h513v26.3H0zm0 52.6h513v26.3H0zm0 52.6h513V342H0z",fill:"#D80027"}),B.createElement("path",{fill:"#2E52B2",d:"M0 0h256.5v184.1H0z"}),B.createElement("path",{d:"m47.8 138.9-4-12.8-4.4 12.8H26.2l10.7 7.7-4 12.8 10.9-7.9 10.6 7.9-4.1-12.8 10.9-7.7zm56.3 0-4.1-12.8-4.2 12.8H82.6l10.7 7.7-4 12.8 10.7-7.9 10.8 7.9-4-12.8 10.7-7.7zm56.5 0-4.3-12.8-4 12.8h-13.5l11 7.7-4.2 12.8 10.7-7.9 11 7.9-4.2-12.8 10.7-7.7zm56.2 0-4-12.8-4.2 12.8h-13.3l10.8 7.7-4 12.8 10.7-7.9 10.8 7.9-4.3-12.8 11-7.7zM100 75.3l-4.2 12.8H82.6L93.3 96l-4 12.6 10.7-7.8 10.8 7.8-4-12.6 10.7-7.9h-13.4zm-56.2 0-4.4 12.8H26.2L36.9 96l-4 12.6 10.9-7.8 10.6 7.8L50.3 96l10.9-7.9H47.8zm112.5 0-4 12.8h-13.5l11 7.9-4.2 12.6 10.7-7.8 11 7.8-4.2-12.6 10.7-7.9h-13.2zm56.5 0-4.2 12.8h-13.3l10.8 7.9-4 12.6 10.7-7.8 10.8 7.8-4.3-12.6 11-7.9h-13.5zm-169-50.6-4.4 12.6H26.2l10.7 7.9-4 12.7L43.8 50l10.6 7.9-4.1-12.7 10.9-7.9H47.8zm56.2 0-4.2 12.6H82.6l10.7 7.9-4 12.7L100 50l10.8 7.9-4-12.7 10.7-7.9h-13.4zm56.3 0-4 12.6h-13.5l11 7.9-4.2 12.7 10.7-7.9 11 7.9-4.2-12.7 10.7-7.9h-13.2zm56.5 0-4.2 12.6h-13.3l10.8 7.9-4 12.7 10.7-7.9 10.8 7.9-4.3-12.7 11-7.9h-13.5z",fill:"#FFF"}))};function pZe(e){return String(e).trim().replace(/\/+$/,"").replace(/^https:/i,"wss:").replace(/^http:/i,"ws:")}async function mZe(e,t,n,r,a,i=!0){const o=(t.type?.split("/")[1]||"webm").split(";")[0],l=new FormData;l.append("file",t,`voice.${o}`),l.append("consent_id",n),r&&l.append("localization_consent_id",r),l.append("language",a),l.append("localization_enabled",String(i));const{data:c}=await Se.post(`/experts/${e}/voice`,l,{headers:{"Content-Type":"multipart/form-data"}});return c.data??c}async function fZe(){const{data:e}=await Se.get("/voice/presets");return(e.data??e).presets??[]}const fh=new Map;async function kre(e){const{data:t}=await Se.get(`/experts/${e}/voice`);return t.data??t}function bS(e){if(!e||fh.has(e))return;const t={value:null,settled:null};t.settled=kre(e).then(n=>(t.value=n,{ok:!0,value:n}),()=>(fh.delete(e),{ok:!1})),fh.set(e,t)}function WB(e){return fh.get(e)?.value??null}function gZe(e){fh.delete(e)}async function M1(e){const t=fh.get(e);if(t){fh.delete(e);const n=await t.settled;if(n.ok)return n.value}return kre(e)}async function Nre(e,t=null,n=null){const r=await f0(),a=n?`?language=${encodeURIComponent(n)}`:"",i=await fetch(`${Hr}/experts/${e}/voice/preview${a}`,{method:"POST",headers:r,signal:t});if(!i.ok){let o=null;try{o=(await i.json())?.detail}catch{}const l=new Error(o?.message||"Could not preview your cloned voice.");throw l.status=i.status,l.code=o?.code,l}return i}async function a5(e,t){const n=typeof t=="string"?{speaker_gender:t}:t,{data:r}=await Se.patch(`/experts/${e}/voice`,n);return r.data??r}async function VB(e,t=null){const{data:n}=await Se.delete(`/experts/${e}/voice`,{params:t?{language:t}:void 0});return n.data??n}async function xZe(e,t=null,n=null){const r=encodeURIComponent(await w_()||"");let a=`/ws/experts/${e}/voice?token=${r}`;t&&(a+=`&conversation_id=${encodeURIComponent(t)}`),n&&(a+=`&language=${encodeURIComponent(n)}`);const i=pZe(Axe);return i?`${i}${a}`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${a}`}const GB=[.35,.6,1,.6,.35],YB=[0,-.18,-.36,-.18,0],i5={ar:"Arabic",de:"German",en:"English",es:"Spanish",fr:"French",he:"Hebrew",hi:"Hindi",it:"Italian",ja:"Japanese",pl:"Polish",pt:"Portuguese",ta:"Tamil",te:"Telugu",th:"Thai",zh:"Chinese"};function bZe({className:e=""}){return s.jsxs("svg",{viewBox:"0 0 36 24",className:e,focusable:"false","aria-hidden":"true",children:[s.jsx("rect",{width:"36",height:"24",fill:"#FDFCF8"}),s.jsx("text",{x:"18",y:"16.5",fill:"#141413",fontFamily:"Arial Hebrew, Noto Sans Hebrew, sans-serif",fontSize:"13",fontWeight:"700",letterSpacing:"-0.5",textAnchor:"middle",children:"××"})]})}const KB={ar:uZe,de:sZe,"en-gb":aZe,"en-us":hZe,es:nZe,fr:rZe,he:bZe,hi:xS,it:iZe,ja:oZe,pl:lZe,pt:cZe,ta:xS,te:xS,th:dZe,zh:tZe},yZe={coordinator:"coordinator.png",presenter:"presenter.png"},vZe={reflective:["en","ar","ja"],nurturing:["en","es","hi"],kind:["en","zh","fr"],reassuring:["en","ta","de"],clear:["en","hi","pt"],easygoing:["en","ar","th"],grounded:["en","ja","te"],measured:["en","he","it"]},XB=[["reflective","female","Sarah","Even and unhurried, with room to think.",["ar","de","en","es","fr","he","hi","it","ja","pt","ta","te","th","zh"]],["nurturing","female","Maya","Calm and motherly, steady under weight.",["de","en","es","fr","he","hi","it","ja","pt","ta","te","th","zh"]],["kind","female","Hana","Warm and welcoming, easy to trust.",["de","en","es","fr","he","hi","it","ja","pt","ta","te","th","zh"]],["reassuring","female","Katy","Confident and empathic, keeps things settled.",["de","en","es","fr","he","hi","it","pt","ta","te","th","zh"]],["coordinator","female","Agnieszka","Formal and direct, for capable assistance.",["pl"]],["clear","male","Kai","Crisp and precise, never clipped.",["ar","de","en","es","fr","he","hi","it","ja","pt","ta","te","th","zh"]],["easygoing","male","Leo","Relaxed and friendly, low pressure.",["ar","de","en","es","fr","he","hi","it","ja","pt","ta","te","th","zh"]],["grounded","male","Idris","Rich and low, with natural authority.",["ar","de","en","es","fr","he","hi","it","ja","pt","ta","te","th"]],["measured","male","Theo","Firm and articulate, built for long explanations.",["de","en","es","fr","he","hi","it","ja","pt","ta","te","th","zh"]],["presenter","male","Marcin","Bright and energetic, bringing scripts to life.",["pl"]]].map(([e,t,n,r,a])=>({slug:e,gender:t,label:n,blurb:r,languages:a.map(i=>
436({code:i,name:i5[i]||i.toUpperCase(),...i==="en"?{locale:e==="nurturing"?"en-GB":"en-US"}:{}})),sample_url:`/voice-samples/${e}.wav`}));function wZe(e){return Array.isArray(e.languages)?e.languages.flatMap(t=>{const n=typeof t=="string"?t:t?.code;if(!n)return[];const r=typeof t=="object"?t.locale:void 0,a=r==="en-GB"?"English (British)":r==="en-US"?"English (American)":null;return[{code:String(n),locale:r,name:a||(typeof t=="string"?i5[n]||String(n).toUpperCase():t.name||i5[n]||String(n).toUpperCase())}]}):[]}function Ere({language:e,className:t=""}){const n=KB[(e.locale||e.code).toLowerCase()]||KB[e.code.toLowerCase()];return s.jsx("span",{"aria-hidden":"true",className:`relative block shrink-0 overflow-hidden rounded-full border border-rule bg-paper ${t}`,children:n?s.jsx(n,{className:"absolute left-1/2 top-1/2 h-full w-auto max-w-none -translate-x-1/2 -translate-y-1/2"}):s.jsx(iY,{className:"absolute left-1/2 top-1/2 h-3/5 w-3/5 -translate-x-1/2 -translate-y-1/2 text-ink-muted",strokeWidth:1.8})})}function jZe({voice:e,languages:t,triggerRef:n,onClose:r}){const a=f.useRef(null),[i,o]=f.useState(null);return f.useLayoutEffect(()=>{const l=()=>{const c=n.current;if(!c)return;const u=c.getBoundingClientRect();if(window.matchMedia("(max-width: 560px)").matches){o({mobile:!0});return}const h=280,p=12,m=a.current?.offsetHeight||360,g=Math.min(window.innerWidth-h-p,Math.max(p,u.right-h)),b=window.innerHeight-u.bottom-p>=m+8?u.bottom+8:Math.max(p,u.top-m-8);o({mobile:!1,left:g,top:b,width:h})};return l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0),()=>{window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[n]),typeof document>"u"?null:Mn.createPortal(s.jsxs("div",{ref:a,id:`voice-languages-${e.slug}`,role:"region","aria-label":`${e.label} supported languages`,"data-voice-language-layer":e.slug,style:i?.mobile?void 0:{left:i?.left??-9999,top:i?.top??-9999,width:i?.width??280},className:`fixed z-[120] max-h-[min(380px,calc(100vh-24px))] overflow-y-auto rounded-xl border border-rule bg-paper p-4 text-left shadow-elevation ${i?.mobile?"inset-x-4 bottom-4":""}`,children:[s.jsxs("div",{className:"mb-3 flex items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-ink",children:e.label}),s.jsxs("p",{className:"mt-0.5 text-xs text-ink-muted",children:[t.length," supported languages"]})]}),s.jsx("button",{type:"button",onClick:r,"aria-label":`Close ${e.label} language list`,className:"-mr-1 grid h-8 w-8 place-items-center rounded-full text-ink-muted outline-none transition-colors duration-fast hover:bg-cream-deep hover:text-ink focus-visible:shadow-focus",children:s.jsx(as,{className:"h-4 w-4",strokeWidth:2,"aria-hidden":"true"})})]}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:t.map(l=>s.jsxs("span",{className:"flex min-w-0 items-center gap-2 rounded-lg bg-cream-deep px-2 py-2",children:[s.jsx(Ere,{language:l,className:"h-5 w-5"}),s.jsx("span",{className:"truncate text-xs text-ink-mid",title:l.name,children:l.name})]},l.code))})]}),document.body)}function _Ze({voice:e,expanded:t,disabled:n,onToggle:r,onClose:a,registerTrigger:i}){const o=f.useRef(null),l=wZe(e);if(!l.length)return null;const c=(vZe[e.slug]||[]).map(p=>l.find(m=>m.code===p)).filter(Boolean),u=[...c,...l.filter(p=>!c.some(m=>m.code===p.code))].slice(0,3),d=l.length>u.length,h=u.map((p,m)=>s.jsx("span",{title:p.name,"aria-hidden":"true",className:`block shrink-0 ${m?"-ml-1":""}`,children:s.jsx(Ere,{language:p,className:"h-6 w-6"})},p.code));return s.jsxs("div",{className:"relative z-20 shrink-0","data-voice-language-layer":e.slug,children:[d?s.jsxs("button",{ref:p=>{o.current=p,i(p)},type:"button",disabled:n,"aria-expanded":t,"aria-controls":`voice-languages-${e.slug}`,"aria-label":`${t?"Hide":"Show"} all ${l.length} languages for ${e.label}`,onClick:r,className:"group/languages flex min-h-11 items-center rounded-pill px-1 outline-none transition-colors duration-fast hover:bg-cream-deep focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-50",children:[h,s.jsx("span",{"aria-hidden":"true",className:`-ml-1 grid h-6 w-6 shrink-0 place-items-center rounded-full border bg-paper transition-colors duration-fast ${t?"border-indigo bg-indigo text-cream":"border-ink-light text-ink-muted group-hover/languages:border-indigo group-hover/languages:text-indigo"}`,children:s.jsx(Es,{className:"h-3 w-3",strokeWidth:2.5})})]}):s.jsx("div",{role:"group","aria-label":`${e.label}
436 supports ${l.map(p=>p.name).join(", ")}`,className:"flex min-h-11 items-center px-1",children:h}),t?s.jsx(jZe,{voice:e,languages:l,triggerRef:o,onClose:()=>{a(),window.requestAnimationFrame(()=>o.current?.focus())}}):null]})}const gv=typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function Sre({value:e,onChange:t,layout:n="default",previewMode:r=!1,disabled:a=!1,contrasted:i=!1}){const[o,l]=f.useState(()=>r||n==="wizard"?XB:[]),[c,u]=f.useState(!1),[d,h]=f.useState(()=>XB.find(k=>k.slug===e)?.gender||"female"),p=f.useRef(null),m=f.useRef(null),g=f.useRef(new Map),[x,b]=f.useState(null),[y,v]=f.useState(null),w=f.useRef(e);w.current=e,f.useEffect(()=>{if(r)return;let _=!1;return fZe().then(k=>{if(_)return;k.length?l(k):u(!0);const C=k.find(N=>N.slug===w.current);n==="wizard"&&C?.gender&&h(C.gender),n!=="wizard"&&!w.current&&k.length&&t(k[0].slug)}).catch(()=>{_||u(!0)}),()=>{_=!0}},[r]);const j=()=>{p.current?.pause(),p.current=null,clearTimeout(m.current),m.current=null,b(null)};f.useEffect(()=>j,[]),f.useEffect(()=>{a&&j(),a&&v(null)},[a]),f.useEffect(()=>{if(!y)return;const _=C=>{C.target.closest?.("[data-voice-language-layer]")?.dataset.voiceLanguageLayer!==y&&v(null)},k=C=>{if(C.key!=="Escape")return;const N=y;v(null),window.requestAnimationFrame(()=>g.current.get(N)?.focus())};return document.addEventListener("pointerdown",_),document.addEventListener("keydown",k),()=>{document.removeEventListener("pointerdown",_),document.removeEventListener("keydown",k)}},[y]),f.useEffect(()=>{e||(p.current?.pause(),p.current=null,b(null))},[e]);const E=_=>{if(a)return;if(t(_.slug),x===_.slug)return j();if(j(),r){b(_.slug),m.current=setTimeout(()=>{b(null),m.current=null},2400);return}const k=new Audio(_.sample_url);k.onended=j,k.onerror=j,k.play().catch(j),p.current=k,b(_.slug)},S=(_,k)=>{a||(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),t(k))};if(c&&!o.length)return s.jsx("p",{className:"mx-auto max-w-2xl text-center text-sm text-ink-muted",children:"Voices could not be loaded. Your expert keeps its current voice."});if(!o.length)return n==="wizard"?s.jsxs("div",{"aria-label":"Loading expert voices",children:[s.jsx("div",{className:"mb-3 h-10 animate-pulse rounded-lg bg-cream-deep"}),s.jsx("div",{className:"flex flex-col gap-2.5",children:Array.from({length:4},(_,k)=>s.jsx("div",{className:"h-[54px] animate-pulse rounded-xl border border-rule bg-cream-deep"},k))})]}):s.jsx("div",{className:"mx-auto grid max-w-3xl grid-cols-2 gap-4 sm:grid-cols-4 sm:gap-5",children:Array.from({length:8},(_,k)=>s.jsx("div",{className:"h-52 animate-pulse rounded-2xl border-[1.5px] border-rule bg-paper"},k))});if(n==="wizard"){const _=o.filter(A=>A.gender===d),k=o.find(A=>A.slug===e),C=_.some(A=>A.slug===e),N=(A,T)=>{const I={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};let $;if(A.key==="Home")$=0;else if(A.key==="End")$=_.length-1;else if(I[A.key])$=(T+I[A.key]+_.length)%_.length;else return;A.preventDefault();const O=_[$];j(),v(null),t(O.slug),window.requestAnimationFrame(()=>{document.querySelector(`[data-voice-radio="${O.slug}"]`)?.focus()})};return s.jsxs("div",{"aria-disabled":a||void 0,children:[s.jsx("div",{role:"group","aria-label":"Filter voices by voice type",className:`mb-3 grid grid-cols-2 gap-1 rounded-lg p-1 ${i?"border border-rule bg-cream":"bg-cream-deep"}`,children:["female","male"].map(A=>{const T=o.filter(U=>U.gender===A).length,I=d===A,$=k?.gender===A,O=`${A[0].toUpperCase()}${A.slice(1)}`;return s.jsxs("button",{type:"button","aria-pressed":I,"aria-label":`${O} voices, ${T} options${$?", includes your selection":""}`,disabled:!T||a,onClick:()=>{j(),v(null),h(A)},className:`flex min-h-8 items-center justify-center gap-1.5 rounded-md px-2.5 py-1.5 text-[12.5px] font-medium outline-none transition-colors duration-fast focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-50 ${I?i?"bg-indigo-wash text-indigo-deep shadow-subtle":"bg-paper text-indigo-deep shadow-subtle":i?"bg-paper text-ink-mid hover:bg-indigo-wash/60 hover:text-indigo-deep":"text-ink-mid hover:bg-paper/60 hover:text-ink"}`,children:[s.jsx("span",{children:O}),s.jsx("span",{className:`min-w-4 text-[10.5px] ${I?"text-indigo-deep":"text-ink-muted"}`,children:T}),$&&s.jsx(ft,{className:"h-3 w-3 text-indigo",strokeWidth:3,"aria-hidden":"true"})]},A)})}),s.jsx("div",{role:"radiogroup","aria-label":`${d} expert voices`,className:"flex flex-col gap-2.5",children:_.map((A,T)=>
436{const I=e===A.slug,$=x===A.slug;return s.jsxs("div",{"aria-disabled":a||void 0,className:`relative flex min-h-[58px] items-center gap-3 rounded-xl border px-3 py-1.5 transition-colors ${a?`cursor-not-allowed border-rule ${i?"bg-cream":"bg-paper"}`:I?`border-indigo bg-indigo-wash ${i?"shadow-subtle":""}`:i?"border-rule bg-cream hover:border-indigo/35 hover:bg-paper":"border-rule bg-paper hover:border-ink-light"}`,children:[s.jsx("button",{type:"button",role:"radio","data-voice-radio":A.slug,"aria-checked":I,"aria-label":`${A.label}${$?", playing":", select and play preview"}`,tabIndex:a||!I&&(C||T!==0)?-1:0,disabled:a,onClick:()=>E(A),onKeyDown:O=>N(O,T),className:"absolute inset-0 z-10 rounded-xl outline-none focus-visible:shadow-focus disabled:cursor-not-allowed"}),s.jsxs("span",{"aria-hidden":"true",className:`pointer-events-none relative z-10 grid h-9 w-9 shrink-0 place-items-center overflow-hidden rounded-full bg-cream-deep text-sm font-semibold text-ink-mid transition-shadow ${I?"ring-2 ring-indigo ring-offset-2 ring-offset-paper":""}`,children:[s.jsx("span",{className:"absolute inset-0 grid place-items-center",children:A.label?.charAt(0)||"?"}),s.jsx("img",{src:`/voice-avatars/${yZe[A.slug]||`${A.slug}.jpg`}`,alt:"",width:"36",height:"36",loading:"lazy",decoding:"async",className:"relative h-full w-full object-cover",onError:({currentTarget:O})=>{O.style.display="none"}})]}),s.jsx("span",{className:"pointer-events-none relative z-10 min-w-0 flex-1 truncate text-sm font-medium text-ink",children:A.label}),s.jsx("span",{"aria-hidden":"true",className:`pointer-events-none relative z-10 hidden h-5 w-9 shrink-0 items-center justify-center gap-[3px] transition-opacity min-[430px]:flex ${$?"opacity-100":"opacity-0"}`,children:GB.map((O,U)=>s.jsx("span",{className:"h-4 w-[3px] origin-center rounded-pill bg-indigo motion-safe:animate-waveform",style:{transform:`scaleY(${O})`,animationDelay:`${YB[U]}s`}},U))}),s.jsx(_Ze,{voice:A,expanded:y===A.slug,disabled:a,registerTrigger:O=>{O?g.current.set(A.slug,O):g.current.delete(A.slug)},onToggle:()=>{v(O=>O===A.slug?null:A.slug)},onClose:()=>v(null)}),s.jsx("span",{"aria-hidden":"true",className:`pointer-events-none relative z-10 grid h-6 w-6 shrink-0 place-items-center rounded-full border transition-colors ${I?"border-indigo bg-indigo text-cream":"border-ink-light"}`,children:I&&s.jsx(ft,{className:"h-3 w-3",strokeWidth:3.5})})]},A.slug)})})]})}return s.jsxs("div",{role:"radiogroup","aria-label":"Expert voice",className:"mx-auto grid max-w-3xl grid-cols-2 gap-4 sm:grid-cols-4 sm:gap-5",children:[s.jsx("style",{children:` 437 @keyframes vsWave { 0%,100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } } 438 @keyframes vsPulse { 0% { transform: scale(1); opacity: .4; } 70% { transform: scale(1.6); opacity: 0; } 100% { transform: scale(1.6); opacity: 0; } } 439 @keyframes vsPop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } } 440 @keyframes vsRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } 441 `}),o.map((_,k)=>{const C=e===_.slug,N=x===_.slug;return s.jsxs("div",{role:"radio","aria-checked":C,"aria-label":`${_.label} â ${_.blurb}`,tabIndex:0,onClick:()=>t(_.slug),onKeyDown:A=>S(A,_.slug),style:gv?void 0:{animation:"vsRise 420ms cubic-bezier(0.16,1,0.3,1) both",animationDelay:`${k*45}ms`},className:`group relative flex cursor-pointer flex-col items-center rounded-2xl border-[1.5px] px-4 pb-6 pt-7 text-center outline-none transition-all duration-200 focus-visible:shadow-focus ${C?"border-primary-500 bg-primary-50 shadow-card":"border-rule bg-paper hover:shadow-elevation"}`,children:[C&&s.jsx("span",{style:gv?void 0:{animation:"vsPop 240ms cubic-bezier(0.16,1,0.3,1) both"},className:"absolute right-3 top-3 grid h-[22px] w-[22px] place-items-center rounded-full bg-primary-500 text-white",children:s.jsx(ft,{className:"h-3 w-3",strokeWidth:3})}),s.jsx("h3",{className:"font-heading text-lg font-medium leading-tight text-ink",children:_.label}),s.jsx("p",{className:"mb-5 mt-1 min-h-[2.5rem] text-xs text-ink-muted",children:_.blurb}),s.jsxs("div",{className:"relative mb-3 inline-flex",children:[N&&s.jsx("span",{style:gv?void 0:{animation:"vsPulse 1.3s ease-out infinite"},className:"pointer-events-none absolute -inset-1.5 rounded-full bg-primary-500 opacity-40"}),s.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),E(_)},"aria-label":N?`Stop ${_.label} sample`:`Preview the ${_.label} voice`,className:`relative grid h-12 w-12 place-items-center rounded-full outline-none transition-colors duration-200 hover:brightness-95 focus-visible:shadow-focus ${C?"bg-primary-500 text-white":"border-[1.5px] border-rule bg-paper text-ink-mid"}`,children:N?s.jsx(ku,{className:"h-3.5 w-3.5",fill:"currentColor",strokeWidth:0}):s.jsx(Tr,{className:"h-4 w-4 translate-x-px",fill:"currentColor",strokeWidth:0})})]}),s.jsx("div",{className:"flex h-6 items-end gap-[4px]",children:GB.map((A,T)=>s.jsx("span",{className:`w-[4px] rounded-[3px] ${C?"bg-primary-500":"bg-ink-light"}`,style:{height:"24px",transformOrigin:"bottom",transform:`scaleY(${A})`,animation:N&&!gv?`vsWave 0.9s ease-in-out ${YB[T]}s infinite`:void 0}},T))}),s.jsxs("p",{className:"mt-3 text-[11px] text-ink-light",children:[_.languages.length," languages"]})]},_.slug)})]})}const kZe=24e3;async function Cre(e,t,{onStart:n,output:r}={}){const a=r??t.destination,i=e.getReader();
441let o=t.currentTime,l=new Uint8Array(0),c=null;for(;;){const{done:u,value:d}=await i.read();if(u)break;const h=l.length?NZe(l,d):d,p=h.length-h.length%2;if(l=h.slice(p),!p)continue;const m=new Int16Array(h.slice(0,p).buffer),g=t.createBuffer(1,m.length,kZe),x=g.getChannelData(0);for(let y=0;y<m.length;y++)x[y]=m[y]/32768;const b=t.createBufferSource();b.buffer=g,b.connect(a),o=Math.max(o,t.currentTime),b.start(o),o+=g.duration,c=b,n?.(),n=null}c&&await new Promise(u=>{c.onended=u})}function NZe(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function EZe(e){const[t,n]=f.useState(null),[r,a]=f.useState("ready"),[i,o]=f.useState(!1),[l,c]=f.useState(""),u=f.useRef(null),d=f.useRef(null),h=f.useRef(0),p=f.useRef(!0),m=f.useCallback(()=>{h.current+=1,d.current?.abort(),d.current=null;const y=u.current;u.current=null,y&&y.state!=="closed"&&y.close().catch(()=>{})},[]);f.useEffect(()=>(p.current=!0,()=>{p.current=!1,m()}),[m]);const g=f.useCallback(()=>{m(),a("ready"),o(!1),c(""),n(null)},[m]);f.useEffect(()=>{g()},[e,g]);const x=f.useCallback(async(y=null)=>{m();const v=h.current,w=new AbortController;d.current=w,a("processing"),n(y),o(!1),c("");try{const j=window.AudioContext||window.webkitAudioContext;if(!j)throw new Error("Voice preview is not supported in this browser.");const E=new j({sampleRate:24e3});u.current=E,await E.resume();const S=await Nre(e,w.signal,y);if(!S.body)throw new Error("The voice preview was empty. Please try again.");await Cre(S.body,E,{onStart:()=>{p.current&&v===h.current&&a("previewPlaying")}}),p.current&&v===h.current&&(a("ready"),o(!1))}catch(j){j?.name!=="AbortError"&&p.current&&v===h.current&&(a("error"),o(!1),c(j?.message||"Could not preview your cloned voice."))}finally{if(v===h.current){d.current=null;const j=u.current;u.current=null,j&&j.state!=="closed"&&j.close().catch(()=>{})}}},[m,e]),b=f.useCallback(async(y=null)=>{if(y!==t){await x(y);return}if(r==="processing"){m(),a("ready"),o(!1);return}if(r==="previewPlaying"&&u.current){i?(await u.current.resume(),o(!1)):(await u.current.suspend(),o(!0));return}await x(y)},[m,t,i,x,r]);return{language:t,status:r,paused:i,error:l,toggle:b,stop:g}}const Zb=56,o5=280,xv=36,Tre=2,Dg=(o5-(Zb-1)*Tre)/Zb,SZe=Array.from({length:Zb},(e,t)=>.24+t*17%11/11*.52);function bv(e){const t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0;return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function CZe(e){const t=e.getChannelData(0),n=Math.max(1,Math.floor(t.length/Zb)),r=[];for(let i=0;i<Zb;i+=1){const o=i*n,l=Math.min(t.length,o+n);let c=0;for(let u=o;u<l;u+=1){const d=t[u];c+=d*d}r.push(Math.sqrt(c/Math.max(1,l-o)))}const a=Math.max(...r,.001);return r.map(i=>.18+i/a*.82)}function TZe({audioBlob:e,audioUrl:t,fallbackDuration:n,isBusy:r,saveError:a,onApprove:i,onRecordAgain:o,fill:l=!1}){const c=f.useRef(null),u=f.useRef(null),d=f.useRef(null),h=f.useRef(null),p=f.useId().replace(/:/g,""),[m,g]=f.useState("idle"),[x,b]=f.useState(0),[y,v]=f.useState(n||0),[w,j]=f.useState(SZe),[E,S]=f.useState(""),_=m==="playing",k=y>0?Math.min(1,x/y):0;f.useEffect(()=>{let $=!0;const O=window.AudioContext||window.webkitAudioContext;if(!e||!O)return;const U=new O;return e.arrayBuffer().then(F=>U.decodeAudioData(F)).then(F=>{$&&(j(CZe(F)),Number.isFinite(F.duration)&&v(F.duration))}).catch(()=>{}).finally(()=>U.close().catch(()=>{})),()=>{$=!1,U.close().catch(()=>{})}},[e]),f.useEffect(()=>{if(!_)return;const $=()=>{const O=c.current;O&&(b(O.currentTime),!O.paused&&!O.ended&&(h.current=requestAnimationFrame($)))};return h.current=requestAnimationFrame($),()=>cancelAnimationFrame(h.current)},[_]),f.useEffect(()=>{r&&c.current?.pause()},[r]),f.useEffect(()=>{u.current?.focus({preventScroll:!0})},[]),f.useEffect(()=>()=>cancelAnimationFrame(h.current),[]);const C=f.useMemo(()=>w.map(($,O)=>{const U=Math.max(4,$*(xv-4));return{height:U,x:O*(Dg+Tre),y:(xv-U)/2}}),[w]),N=async()=>{const $=c.current;if(!(!$||r)){if(S(""),!$.paused){$.pause();return}$.ended&&($.currentTime=0);try{await $.play(),g("playing")}catch{g("error"),S("We couldn't play the cloned voice preview. Try again or record a
441new sample.")}}},A=$=>{const O=c.current;if(!O||!y)return;const U=Math.max(0,Math.min(y,$*y));O.currentTime=U,b(U),O.ended&&g("paused")},T=$=>{if(r)return;const O=d.current?.getBoundingClientRect();O?.width&&A(($.clientX-O.left)/O.width)},I=$=>{if(!(r||!y))if($.key==="ArrowLeft"||$.key==="ArrowRight"){$.preventDefault();const O=$.key==="ArrowLeft"?-1:1;A((x+O)/y)}else($.key==="Home"||$.key==="End")&&($.preventDefault(),A($.key==="Home"?0:1))};return s.jsxs("div",{className:`voice-recorder-stage rounded-xl bg-paper p-3.5 ring-1 ring-ink/10 sm:p-4 ${l?"flex h-full flex-col":""}`,"data-recorder-state":"review",children:[s.jsx("p",{className:"sr-only",role:"status","aria-live":"polite",children:"Cloned voice preview ready."}),s.jsx("audio",{ref:c,src:t,preload:"metadata",onLoadedMetadata:$=>{const O=$.currentTarget.duration;Number.isFinite(O)&&v(O)},onPlaying:()=>g("playing"),onPause:$=>{!$.currentTarget.ended&&$.currentTarget.currentTime>0&&g("paused")},onTimeUpdate:$=>b($.currentTarget.currentTime),onEnded:()=>{b(y),g("ended")},onError:()=>{g("error"),S("We couldn't play the cloned voice preview. Try again or record a new sample.")}}),s.jsx("div",{className:l?"flex min-h-0 flex-1 items-center justify-center":"",children:s.jsxs("div",{className:"mx-auto flex w-full min-w-0 max-w-[40rem] items-center gap-3",children:[s.jsx("button",{ref:u,type:"button",onClick:N,disabled:r,"aria-label":_?"Pause cloned voice preview":"Play cloned voice preview","aria-pressed":_,className:`grid h-11 w-11 shrink-0 place-items-center rounded-full text-white shadow-sm transition-[background-color,transform,box-shadow] duration-200 ease-out hover:-translate-y-px focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-indigo/20 focus-visible:ring-offset-2 focus-visible:ring-offset-paper active:translate-y-0 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transform-none motion-reduce:transition-none ${_?"bg-indigo":"bg-ink hover:bg-ink-soft"}`,children:_?s.jsx(Lf,{className:"h-[18px] w-[18px] fill-current",strokeWidth:1.8,"aria-hidden":"true"}):s.jsx(Tr,{className:"ml-0.5 h-[18px] w-[18px] fill-current",strokeWidth:1.8,"aria-hidden":"true"})}),s.jsx("div",{ref:d,role:"slider",tabIndex:r?-1:0,"aria-label":"Cloned voice preview position","aria-valuemin":0,"aria-valuemax":Math.round(y),"aria-valuenow":Math.round(x),"aria-valuetext":`${bv(x)} of ${bv(y)}`,"aria-disabled":r,onPointerDown:T,onKeyDown:I,className:`min-w-0 flex-1 rounded-md py-1 outline-none focus-visible:ring-2 focus-visible:ring-indigo focus-visible:ring-offset-2 focus-visible:ring-offset-paper ${r?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:s.jsxs("svg",{viewBox:`0 0 ${o5} ${xv}`,preserveAspectRatio:"none",className:"block h-9 w-full","aria-hidden":"true",children:[s.jsx("defs",{children:s.jsx("clipPath",{id:p,children:s.jsx("rect",{width:o5*k,height:xv})})}),s.jsx("g",{className:"text-ink-light/70",fill:"currentColor",children:C.map(($,O)=>s.jsx("rect",{x:$.x,y:$.y,width:Dg,height:$.height,rx:Dg/2},O))}),s.jsx("g",{className:"text-ink",fill:"currentColor",clipPath:`url(#${p})`,children:C.map(($,O)=>s.jsx("rect",{x:$.x,y:$.y,width:Dg,height:$.height,rx:Dg/2},O))})]})}),s.jsxs("span",{className:"w-[76px] shrink-0 whitespace-nowrap text-right font-mono text-[11px] font-medium tabular-nums text-ink-mid","aria-hidden":"true",children:[bv(x)," / ",bv(y)]})]})}),E?s.jsx("p",{className:"mt-2 text-xs leading-5 text-red-600",role:"alert",children:E}):null,a?s.jsx("p",{className:"mt-2 text-xs leading-5 text-red-600",role:"alert",children:a}):null,s.jsxs("div",{className:`${l?"mt-auto":"mt-3"} grid grid-cols-2 gap-2`,children:[s.jsx(yt,{type:"button",variant:"primary",icon:ft,onClick:i,disabled:r,className:"min-h-11 w-full !rounded-lg px-4",children:"Use this voice"}),s.jsx(yt,{type:"button",variant:"secondary",icon:Du,onClick:o,isLoading:r,className:"min-h-11 w-full !rounded-lg px-4",children:r?"Resettingâ¦":"Record again"})]})]})}function JB({value:e,options:t,onChange:n,disabled:r=!1,defaultOpen:a=!1,ariaLabel:i,placeholder:o="Select",buttonClass:l="",buttonStyle:c}){const[u,d]=f.useState(a),h=f.useRef(null),p=f.useRef(null),m=f.useRef(null),g=t.find(v=>v.code===e)||null;f.useEffect(()=>{if(!u)return;const v=j=>{h.current&&!h.current.contains(j.target)&&d(!1)},w=j=>{j.key==="Escape"&&(d(!1),m.current?.focus())};return document.addEventListener("mousedown",v),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",w)}},[u]),f.useEffect(()=>{if(!u)return;const v=p.current?.querySelector('[aria-selected="true"]')||p.current?.querySelector('[role="option"]');v?.focus(),v?.scrollIntoView({block:"nearest"})},[u]);const x=v=>{n(v),d(!1),m.current?.focus()},b=v=>{if(v.key!=="ArrowDown"&&v.key!=="ArrowUp")return;v.preventDefault();const w=[...p.current?.querySelectorAll('[role="option"]')||[]],j=w.indexOf(document.activeElement),E=v.key==="ArrowDown"?w[Math.min(j+1,w.length-1)]:w[Math.max(j-1,0)];E?.focus(),E?.scrollIntoView({block:"nearest"})},y=v=>{(v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),d(!0))};return s.jsxs("div",{ref:h,className:"relative inline-block max-w-full shrink-0",children:[s.jsx("button",{ref:m,type:"button",disabled:r,"aria-haspopup":"listbox","aria-expanded":u,"aria-label":i,onClick:()=>d(v=>!v),onKeyDown:y,className:`text-left ${l}`,style:c,children:s.jsx("span",{className:"block max-w-full truncate",children:g?.name||o})}),u&&s.jsx("ul",{ref:p,role:"listbox","aria-label":i,onKeyDown:b,className:"absolute left-0 top-full z-50 mt-1 max-h-60 min-w-full w-max max-w-[min(18rem,calc(100vw-2.5rem))] overflow-y-auto rounded-lg border border-rule bg-paper py-1 shadow-overlay",children:t.map(v=>{const w=v.code===e;return s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":w,tabIndex:-1,onClick:()=>x(v.code),className:`flex w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-sm transition-colors focus:bg-cream-deep focus:outline-none ${w?"bg-indigo-wash font-medium text-indigo-deep":"text-ink hover:bg-cream-deep"}`,children:[s.jsx("span",{className:"truncate",children:v.name}),w&&s.jsx(ft,{className:"h-4 w-4 shrink-0","aria-hidden":"true"})]})},v.code)})})]})}function Are({status:e="",statusDelay:t=400,localizationEnabled:n=!0}){const[r,a]=f.useState(!1);return f.useEffect(()=>{if(!e)return;const i=setTimeout(()=>a(!0),t);return()=>clearTimeout(i)},[e,t]),s.jsxs("div",{children:[s.jsx("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:s.jsxs("div",{className:"min-w-0",children:[s.jsxs("h3",{className:"ce-clone-title font-heading text-2xl font-medium leading-tight tracking-[-0.015em] text-ink",children:["Clone your ",s.jsx("em",{className:"!font-bold italic text-indigo",children:"own voice"})]}),s.jsx("p",{className:"mt-1.5 max-w-[46ch] text-[13.5px] leading-[1.55] text-ink-mid",role:"status",children:e&&r?e:"It takes only 10 seconds"})]})}),s.jsxs("div",{"aria-hidden":"true",children:[s.jsxs("div",{className:`ce-voice-setup mt-5 grid items-start gap-3${n?" sm:grid-cols-2":""}`,children:[n?s.jsxs("div",{className:"ce-voice-gender",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("p",{className:"text-xs font-medium uppercase tracking-[0.08em] text-ink-muted",children:[s.jsx("span",{className:"ce-voice-label-desktop",children:"Choose your voice type"}),s.jsx("span",{className:"ce-voice-label-mobile",children:"Voice type"})]}),s.jsx("span",{className:"relative inline-flex text-ink-light",children:s.jsx(al,{className:"h-3.5 w-3.5"})})]}),s.jsxs("div",{className:"mt-2 grid min-h-[46px] w-full grid-cols-2 gap-2",children:[s.jsx(gt,{className:"h-[46px] rounded-lg"}),s.jsx(gt,{className:"h-[46px] rounded-lg"})]})]}
441):null,s.jsxs("div",{className:"ce-voice-language flex min-w-0 items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-xs font-medium uppercase tracking-[0.08em] text-ink-muted",children:[s.jsx("span",{className:"ce-voice-label-desktop",children:"Choose your language:"}),s.jsx("span",{className:"ce-voice-label-mobile",children:"Language"})]}),s.jsx(gt,{className:"h-[38px] w-[7.5rem] shrink-0 !rounded-full"})]})]}),s.jsxs("div",{className:"mt-4 space-y-4",children:[s.jsxs("div",{className:"ce-voice-script rounded-lg border border-rule bg-paper p-4",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-[0.08em] text-ink-muted",children:"Say this naturally"}),s.jsxs("div",{className:"mt-2 flex h-12 flex-col justify-center gap-2.5",children:[s.jsx(gt,{className:"h-[13px] w-full"}),s.jsx(gt,{className:"h-[13px] w-[68%]"})]})]}),s.jsxs("div",{className:"ce-voice-consent flex items-center gap-3",children:[s.jsx(gt,{className:"h-[22px] w-[22px] shrink-0 rounded-[7px]"}),s.jsx("div",{className:"min-w-0 flex-1 text-[12.5px] leading-[1.5]",children:s.jsx("span",{className:"ge-skeleton rounded-md text-transparent [box-decoration-break:clone]",children:n?"I have permission to use this voice and agree to private storage and language generation.":"I have permission to use this voice and agree to private storage for this language."})})]}),s.jsx("div",{className:"flex flex-col items-center pt-1",children:s.jsx(gt,{className:"ce-voice-record h-28 w-28 !rounded-full"})})]})]})]})}const ua=10,yS="h-[38px] cursor-pointer appearance-none rounded-lg border border-rule bg-paper py-2 pl-3.5 pr-10 text-sm leading-tight text-ink outline-none focus:border-indigo disabled:opacity-60",QB="inline-flex w-fit max-w-full items-center",vS={backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2386847B' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 14px center",backgroundSize:"16px 16px"},yv=[{code:"en",name:"English",script:"Hello. I speak clearly and naturally. I will answer your questions, explain useful ideas, and guide you step by step with calm confidence.",localizable:!1}],Hj={enabled:!1,status:"idle",source_language:null,total:0,ready:0,pending:0,failed:0,suppressed:[]},AZe=new Set(["pending","processing"]);function RZe(e){return new Promise((t,n)=>{const r=new Audio;let a=!1;const i=window.setTimeout(()=>l(n,new Error("Audio preparation timed out.")),5e3),o=()=>{window.clearTimeout(i),r.removeEventListener("loadeddata",c),r.removeEventListener("error",u),r.removeAttribute("src"),r.load()},l=(d,h)=>{a||(a=!0,o(),d(h))},c=()=>l(t),u=()=>l(n,new Error("Audio playback is unavailable."));r.preload="auto",r.addEventListener("loadeddata",c,{once:!0}),r.addEventListener("error",u,{once:!0}),r.src=e,r.load()})}function ZB(e){const n=Math.max(1,Math.min(ua,e||ua)),r=Math.floor(16e3*n),a=new ArrayBuffer(44+r*2),i=new DataView(a),o=(l,c)=>{for(let u=0;u<c.length;u+=1)i.setUint8(l+u,c.charCodeAt(u))};o(0,"RIFF"),i.setUint32(4,36+r*2,!0),o(8,"WAVE"),o(12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,16e3,!0),i.setUint32(28,16e3*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),o(36,"data"),i.setUint32(40,r*2,!0);for(let l=0;l<r;l+=1){const c=l/16e3,d=(.35+.65*Math.abs(Math.sin(c*Math.PI*1.7)))*(Math.sin(c*Math.PI*2*180)*.07+Math.sin(c*Math.PI*2*286)*.035);i.setInt16(44+l*2,Math.max(-1,Math.min(1,d))*32767,!0)}return new Blob([a],{type:"audio/wav"})}function IZe(e,t=24e3){const n=new Uint8Array(e),r=n.byteLength-n.byteLength%2,a=new ArrayBuffer(44+r),i=new DataView(a),o=(l,c)=>{for(let u=0;u<c.length;u+=1)i.setUint8(l+u,c.charCodeAt(u))};return o(0,"RIFF"),i.setUint32(4,36+r,!0),o(8,"WAVE"),o(12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),o(36,"data"),i.setUint32(40,r,!0),new Uint8Array(a,44).set(n.subarray(0,r)),new Blob([a],{type:"audio/wav"})}function eU(e){return e.origin==="localized"?"localized":"original"}function tU(e){return Array.isArray(e.voices)?e.voices.filter(t=>t.status==="ready"&&t.provider==="cartesia"&&t.language).map(t=>({...t,origin:eU(t)}
441)):e.voice?.status==="ready"&&e.voice?.provider==="cartesia"?[{...e.voice,origin:eU(e.voice),is_default:!0}]:[]}function PZe(e){return e?{...Hj,...e}:Hj}function Rre({expertId:e,onEnabledChange:t,onBusyChange:n,selectedGender:r,onGenderSelect:a,onGenderLoaded:i,onStateChange:o,sourceSelected:l=!1,onSelect:c,selectionDisabled:u=!1,layout:d="default",appearance:h="default",recorderAppearance:p="default",chrome:m="card",previewMode:g=!1,localizationEnabled:x=!0}){const b=EZe(e),y=d==="wizard",v=y||h==="journey",w=v||p==="journey",j=!y&&m!=="none",E=y&&r!==void 0,[S,_]=f.useState([]),[k,C]=f.useState([]),[N,A]=f.useState("en"),[T,I]=f.useState(""),[$,O]=f.useState(Hj),[U,F]=f.useState(()=>!g&&!WB(e)),[H,G]=f.useState(!1),[M,z]=f.useState("idle"),[W,D]=f.useState(null),[Z,V]=f.useState(""),[L,K]=f.useState(ua),[te,Q]=f.useState(!1),[Y,J]=f.useState(""),[P,ee]=f.useState(!1),[X,ae]=f.useState(!1),[me,q]=f.useState(null),[he,se]=f.useState(!1),[le,ke]=f.useState(!1),[oe,Oe]=f.useState(null),[Je,Ie]=f.useState(null),ue=f.useRef(null),be=f.useRef([]),Re=f.useRef(null),Ge=f.useRef(null),it=f.useRef(null),ut=f.useRef(null),$t=f.useRef(null),tt=f.useRef(null),He=f.useRef(null),wt=f.useRef(null),St=f.useRef(null),Zt=f.useRef(null),Jt=f.useRef(null),$e=f.useRef(null),Qe=f.useRef(t),ct=f.useRef(i),ve=f.useRef(o),Ye=f.useRef(""),rt=f.useRef(!1),De=f.useRef(Promise.resolve()),qe=f.useRef(0),ye=k.length?k:yv,Ze=ye.find(Pe=>Pe.code===N)||null,jt=S.find(Pe=>Pe.language===N),Nt=S.filter(Pe=>Pe.origin==="original"),ne=S.filter(Pe=>Pe.origin==="localized"),ge=new Set(Nt.map(Pe=>Pe.language)),xe=ye.filter(Pe=>Pe.code===N||!ge.has(Pe.code)),pe=Nt.length>0,Ne=Nt.length>0,Ue=AZe.has($.status),dt=`voice-gender-info-${e}`,Xe=`additional-voice-languages-${e}`,xt=E?r:T,et=M==="recording",st=M!=="idle"&&M!=="error",_t=["idle","requesting","recording"].includes(M);f.useEffect(()=>{Qe.current=t},[t]),f.useEffect(()=>{ct.current=i},[i]),f.useEffect(()=>{ve.current=o},[o]),f.useEffect(()=>{n?.(te||st)},[te,n,st]);const zt=f.useCallback(()=>{$t.current&&URL.revokeObjectURL($t.current),$t.current=null,D(null)},[]),us=f.useCallback(Pe=>{const At=tU(Pe),ds=Pe.speaker_gender||"";_(At),Pe.languages?.length&&C(Pe.languages),At.some(Ce=>Ce.origin==="original")&&(rt.current=!0),Ye.current=ds,I(ds),ct.current?.(ds);const Bs=PZe(Pe.localization);O(Bs),q(Pe.consent?.voice_clone_id||null);const qs=Pe.source==="clone"||Pe.voice?.status==="ready"&&Pe.voice?.provider==="cartesia";Qe.current?.(qs),ve.current?.({source:Pe.source||(qs?"clone":Pe.presets?.preset_active?"preset":"none"),cloneAvailable:At.some(Ce=>Ce.origin==="original"),localizationEnabled:!!Bs?.enabled})},[]),ms=()=>{clearTimeout(Ge.current),clearInterval(it.current),clearTimeout(ut.current),Ge.current=null,it.current=null,ut.current=null};f.useEffect(()=>()=>{ms(),clearTimeout($e.current),$t.current&&URL.revokeObjectURL($t.current);try{ue.current?.state&&ue.current.state!=="inactive"&&ue.current.stop()}catch{}try{Re.current?.getTracks().forEach(Pe=>Pe.stop())}catch{}},[]);const We=f.useCallback(Pe=>{const At=tU(Pe),ds=Pe.languages?.length?Pe.languages:yv,Bs=new Set(At.filter(Ce=>Ce.origin==="original").map(Ce=>Ce.language)),qs=ds.find(Ce=>!Bs.has(Ce.code));us(Pe),A(qs?.code||ds[0].code)},[us]);f.useEffect(()=>{if(g){C(yv),F(!1);return}let Pe=!0;const At=WB(e);return F(!At),_([]),C([]),I(""),O(Hj),G(!1),J(""),ee(!1),ae(!1),q(null),se(!1),ke(!1),tt.current=null,zt(),z("idle"),V(""),At?(gZe(e),We(At),()=>{Pe=!1}):(M1(e).then(ds=>{Pe&&We(ds)}).catch(()=>{Pe&&rt.current&&J("Could not load the saved voice languages.")}).finally(()=>{Pe&&F(!1)}),()=>{Pe=!1})},[e,We,g,zt]),f.useEffect(()=>{if(!Ue)return;let Pe=!0,At=null;const ds=async()=>{try{const Bs=await M1(e);Pe&&us(Bs)}catch{}Pe&&(At=setTimeout(ds,3e3))};return At=setTimeout(ds,3e3),()=>{Pe=!1,clearTimeout(At)}},[us,e,Ue]);const Dt=(Pe=null)=>{b.stop();const At=ye.find(ds=>!ge.has(ds.code));A(Pe||(pe?"":At?.code||ye[0].code)),ee(!1),ae(!1),tt.current=null,zt(),z("idle"),V(""),J(""),G(!0)},Ds=async(Pe=tt.current)=>{if(z("processing"),K(ua),V(""),J(""),!Pe?.blob?.size){z("error"),J("We couldn't find the recording needed to create your voice preview.");return}let At=null;Q(!0);try{let ds=Pe.clonedPayload;if(!ds){if(g)await new Promise(qs=>{ut.current=setTimeout(qs,650)}),ds={voice:{id:"dev-preview-voice",status:"ready",provider:"cartesia",language:Pe.language,origin:"original"},voices:[{id:"dev-preview-voice",status:"ready",provider:"cartesia",language:Pe.language,origin:"original",is_default:!0}],languages:yv,speaker_gender:xt||"female"};else{const qs=me?null:await gc({consentType:"voice_clone",tosVersion:SAe,checkboxStates:{voice_ownership:!0,voice_storage:!0},expertId:e}),Ce=x?await gc({consentType:"voice_localization",tosVersion:CAe,checkboxStates:{localized_derivatives:!0},expertId:e}):null,kt=me||qs?.data?.consent?.id,Kt=Ce?.data?.consent?.id||null;if(!kt||x&&!Kt)throw new Error("Voice consent could not be recorded.");me||q(kt),ds=await mZe(e,Pe.blob,kt,Kt,Pe.language,x)}Pe.clonedPayload=ds,tt.current=Pe}let Bs;
441if(g)Bs=ZB(6);else{const Ce=await(await Nre(e,null,Pe.language)).arrayBuffer();if(!Ce.byteLength)throw new Error("The cloned voice preview was empty.");Bs=IZe(Ce)}At=URL.createObjectURL(Bs),await RZe(At),zt(),$t.current=At,D({blob:Bs,url:At,duration:g?6:void 0,language:Pe.language}),z("review")}catch(ds){At&&URL.revokeObjectURL(At),z("error"),J(ds.response?.data?.detail?.message||ds.message||"We couldn't create your cloned voice preview. Try again.")}finally{Q(!1),ut.current=null}},Ys=async(Pe,At)=>{tt.current={blob:Pe,duration:At,language:N,hadExistingVoice:!!jt,clonedPayload:null},await Ds(tt.current)},Ks=(Pe="Recording stopped unexpectedly. Check your microphone and try again.")=>{ms();try{Re.current?.getTracks().forEach(At=>At.stop())}catch{}Re.current=null,ue.current=null,be.current=[],K(ua),z("idle"),J(Pe),requestAnimationFrame(()=>wt.current?.focus({preventScroll:!0}))},is=async()=>{if(M==="idle"){if(J(""),V(""),K(ua),z("requesting"),He.current=Date.now(),g){z("recording");const Pe=Date.now()+ua*1e3;it.current=setInterval(()=>{K(Math.max(0,Math.ceil((Pe-Date.now())/1e3)))},250),Ge.current=setTimeout(()=>es(),ua*1e3);return}try{const Pe=await navigator.mediaDevices.getUserMedia({audio:!0});Re.current=Pe;const At=new MediaRecorder(Pe);let ds=!1;ue.current=At,be.current=[],At.ondataavailable=qs=>{qs.data?.size&&be.current.push(qs.data)},At.onerror=()=>{ds=!0,Ks()},At.onstop=async()=>{if(ms(),Pe.getTracks().forEach(kt=>kt.stop()),Re.current=null,ue.current=null,ds)return;const qs=new Blob(be.current,{type:At.mimeType||"audio/webm"}),Ce=Math.min(ua,Math.max(.1,(Date.now()-He.current)/1e3));await Ys(qs,Ce)},At.start(),z("recording");const Bs=Date.now()+ua*1e3;it.current=setInterval(()=>{K(Math.max(0,Math.ceil((Bs-Date.now())/1e3)))},250),Ge.current=setTimeout(()=>{if(At.state!=="inactive"){z("processing");try{At.stop()}catch{ds=!0,Ks()}}},ua*1e3)}catch{z("idle"),J("Microphone permission is required. Check your browser settings and try again.")}}},es=async()=>{ms();const Pe=Math.min(ua,Math.max(1,(Date.now()-He.current)/1e3));await Ys(ZB(Pe),Pe)},Fs=()=>{if(M==="recording"){if(z("processing"),g){es();return}ms();try{if(!ue.current||ue.current.state==="inactive")throw new Error("Recorder is inactive.");ue.current.stop()}catch{Ks()}}},fn=()=>{clearTimeout($e.current),$e.current=null,Ie(null)},Gn=Pe=>{clearTimeout($e.current);const At=Pe==="language"?St.current:Pe==="gender"?Zt.current:Jt.current,ds=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;Ie(Pe),At?.scrollIntoView({behavior:ds?"auto":"smooth",block:"nearest"}),At?.focus({preventScroll:!0}),$e.current=window.setTimeout(()=>{Ie(Bs=>Bs===Pe?null:Bs),$e.current=null},1600)},Xs=()=>{if(!(M!=="idle"||te||U)){if(!N){Gn("language");return}if(x&&!xt){Gn("gender");return}if(!ii){Gn("consent");return}fn(),is()}},fs=async()=>{const Pe=tt.current;if(!te){Q(!0),V("");try{if(Pe?.clonedPayload&&!Pe.hadExistingVoice)if(g)Qe.current?.(!1);else{const At=await VB(e,Pe.language);us(At)}tt.current=null,zt(),z("idle"),K(ua),J(""),requestAnimationFrame(()=>wt.current?.focus({preventScroll:!0}))}catch(At){z("review"),V(At.response?.data?.detail?.message||"We couldn't reset the cloned voice. Try again.")}finally{Q(!1)}}},Lt=async()=>{if(!(!W||te||M==="saving")){Q(!0),z("saving"),V("");try{let Pe=tt.current?.clonedPayload;Pe&&Pe.source!=="clone"&&!g&&(await a5(e,{voice_source:"clone"}),Pe=await M1(e)),Pe&&us(Pe),tt.current=null,zt(),z("idle"),G(!1)}catch(Pe){z("review"),V(Pe.response?.data?.detail?.message||"Could not select your cloned voice. Please try again.")}finally{Q(!1)}}},yr=Pe=>{te||st||(J(""),b.stop(),Oe(Pe))},ta=()=>{te||(Oe(null),J(""))},Js=async()=>{const Pe=oe;if(Pe){if(Q(!0),J(""),g){_([]),G(!0),Oe(null),Q(!1),Qe.current?.(!1);return}try{const At=await VB(e,Pe);us(At),N===Pe&&G(!1),Oe(null)}catch(At){J(At.response?.data?.detail?.message||"Could not remove the voice.")}finally{Q(!1)}}},vr=async Pe=>{if(fn(),a?.(Pe),Pe===T)return;const At=qe.current+1;if(qe.current=At,I(Pe),J(""),g){Ye.current=Pe;return}De.current=De.current.catch(()=>{}).then(async()=>{try{const ds=await a5(e,{speaker_gender:Pe});if(Ye.current=ds.speaker_gender||Pe,At!==qe.current)return;us(ds)}catch(ds){if(At!==qe.current)return;I(Ye.current),ct.current?.(Ye.current),J(ds.response?.data?.detail?.message||"Could not save the voice gender.")}}),await De.current},er=Pe=>ye.find(At=>At.code===Pe)?.name||Pe.toUpperCase(),Ha="inline-flex items-center gap-1.5 rounded-md border border-indigo/25 bg-indigo-wash px-3 py-1.5 text-xs font-medium text-indigo-deep hover:border-indigo/40 hover:bg-indigo/10 disabled:opacity-60",to="inline-flex h-9 w-28 items-center justify-center gap-1.5 rounded-md text-xs font-medium disabled:opacity-60",Ec=`${to} border border-rule bg-paper text-ink hover:border-ink-light hover:bg-[#f1f2f4]`,ii=!!me||P&&X,pt=!!(N&&ii&&(!x||xt)),Ot=ua-L,Hs=`0:${String(Ot).padStart(2,"0")}`,vn=`${(ua-L)/ua*100}%`,on=y||H,$n=y&&pe&&M==="idle",oi=!y&&pe&&!on&&Nt.length<ye.length;return y&&U?s.jsx(Are,{status:"Checking saved voice languagesâ¦",localizationEnabled:x}):s.jsxs("div",{className:j?"rounded-xl border border-rule bg-paper px-4 py-4 sm:px-5":"",children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[v?s.jsxs("h3",{className:"ce-clone-title font-heading text-2xl font-medium leading-tight tracking-[-0.015em] text-ink",children:["Clone your ",s.jsx("em",{className:"!font-bold italic text-indigo",children:"own voice"})]}):s.jsx("p",{className:"text-sm font-semibold text-ink",children:pe?"Cloned voice":"Clone your voice"}),s.jsx("p",{className:v?"mt-1.5 max-w-[46ch] text-[13.5px] leading-[1.55] text-ink-mid":"mt-1 text-sm text-ink-muted",children:U?"Checking saved voice languagesâ¦":v?"It takes only 10 seconds":pe?"Your recorded voice is ready.":"Record one clear 10-second sample."})]}),oi||c?s.jsxs("div",{className:"flex shrink-0 items-center gap-2 self
441-end sm:self-auto",children:[oi?s.jsxs("button",{type:"button",onClick:()=>Dt(),disabled:te||U,className:`${Ec} shrink-0`,children:[s.jsx(Es,{className:"h-4 w-4"}),"Add language"]}):null,c?s.jsx("button",{type:"button",role:"radio","aria-checked":l,"aria-label":"Use cloned voice",disabled:u||!pe,onClick:c,className:`grid h-7 w-7 shrink-0 place-items-center rounded-full border outline-none transition-colors duration-150 focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-40 ${l?"border-indigo bg-indigo text-paper":"border-ink-light bg-paper"}`,children:l?s.jsx(ft,{className:"h-3.5 w-3.5",strokeWidth:3.5,"aria-hidden":"true"}):null}):null]}):null]}),(x&&(v||on)||v&&on)&&s.jsxs("div",{className:v?`ce-voice-setup mt-5 grid items-start gap-3${x?" sm:grid-cols-2":""}`:"mt-4",children:[x&&(v||on)?s.jsxs("div",{ref:Zt,tabIndex:-1,"aria-label":"Choose a voice type before recording","data-attention":Je==="gender"?"true":void 0,className:"ce-voice-gender focus:outline-none",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("p",{className:"text-xs font-medium uppercase tracking-[0.08em] text-ink-muted",children:[s.jsx("span",{className:"ce-voice-label-desktop",children:"Choose your voice type"}),s.jsx("span",{className:"ce-voice-label-mobile",children:"Voice type"})]}),s.jsxs("span",{className:"relative inline-flex",onBlur:Pe=>{Pe.currentTarget.contains(Pe.relatedTarget)||ke(!1)},children:[s.jsx("button",{type:"button","aria-label":"Why voice gender is needed","aria-describedby":le?dt:void 0,"aria-expanded":le,onClick:()=>ke(Pe=>!Pe),onKeyDown:Pe=>{Pe.key==="Escape"&&ke(!1)},className:"rounded-full text-ink-muted hover:text-ink focus-visible:outline-none focus-visible:shadow-focus",children:s.jsx(al,{className:"h-3.5 w-3.5"})}),le?s.jsx("span",{id:dt,role:"tooltip",className:"absolute left-1/2 top-6 z-20 w-56 -translate-x-1/2 rounded-md bg-ink px-3 py-2 text-xs leading-5 text-paper shadow-md",children:"Used to accurately adapt your voice to other languages."}):null]})]}),v?s.jsx("div",{className:"mt-2 grid min-h-[46px] w-full grid-cols-2 gap-2",role:"radiogroup","aria-label":"Cloned voice gender",children:[{value:"female",label:"Female voice",Icon:Kwe,idle:"border-fuchsia-200 bg-fuchsia-50 text-fuchsia-700 hover:border-fuchsia-300 hover:bg-fuchsia-100",active:"border-fuchsia-700 bg-fuchsia-700 text-white shadow-sm"},{value:"male",label:"Male voice",Icon:Qve,idle:"border-sky-200 bg-sky-50 text-sky-700 hover:border-sky-300 hover:bg-sky-100",active:"border-sky-700 bg-sky-700 text-white shadow-sm"}].map(({value:Pe,label:At,Icon:ds,idle:Bs,active:qs})=>{const Ce=xt===Pe;return s.jsx("button",{type:"button",onClick:()=>vr(Pe),disabled:te||st||U,role:"radio","aria-label":At,"aria-checked":Ce,className:`grid min-h-[46px] place-items-center rounded-lg border transition-[background-color,border-color,color,box-shadow,transform] duration-200 ease-out hover:-translate-y-px focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo focus-visible:ring-offset-2 active:translate-y-0 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transform-none motion-reduce:transition-none ${Je==="gender"?"voice-option-cue":""} ${Ce?qs:Bs}`,children:s.jsx(ds,{className:"h-[22px] w-[22px]",strokeWidth:2.35,"aria-hidden":"true"})},Pe)})}):s.jsxs("select",{value:T||"",onChange:Pe=>vr(Pe.target.value),disabled:te||st||U,"aria-label":"Cloned voice gender",className:`mt-2 ${yS} w-auto min-w-[9rem]`,style:vS,children:[s.jsx("option",{value:"",disabled:!0,children:"Select"}),s.jsx("option",{value:"male",children:"Male"}),s.jsx("option",{value:"female",children:"Female"})]})]}):null,v&&on&&s.jsxs("div",{className:"ce-voice-language flex min-w-0 items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-xs font-medium uppercase tracking-[0.08em] text-ink-muted",children:[s.jsx("span",{className:"ce-voice-label-desktop",children:"Choose your language:"}),s.jsx("span",{className:"ce-voice-label-mobile",children:"Language"})]}
441),s.jsx(JB,{value:N,defaultOpen:!N,options:xe,onChange:A,disabled:st||te,ariaLabel:"Recording language",buttonClass:`${QB} ${yS} shrink-0 !rounded-full`,buttonStyle:vS})]})]}),!y&&Nt.length>0?s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsx("div",{className:"min-w-0 space-y-2",children:Nt.map(Pe=>s.jsxs("div",{className:"flex flex-col items-stretch justify-between gap-2 rounded-lg border border-indigo/20 bg-paper px-3 py-2.5 shadow-subtle sm:flex-row sm:items-center sm:gap-3",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>b.toggle(Pe.language),disabled:te||st||on,"aria-label":`${b.language===Pe.language&&b.status==="processing"?"Cancel":b.language===Pe.language&&b.status==="previewPlaying"&&!b.paused?"Pause":"Play"} ${er(Pe.language)} voice preview`,className:"grid h-8 w-8 shrink-0 place-items-center rounded-full text-indigo-deep transition-colors hover:bg-indigo-wash focus-visible:outline-none focus-visible:shadow-focus disabled:opacity-50",children:b.language===Pe.language&&b.status==="processing"?s.jsx(vt,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}):b.language===Pe.language&&b.status==="previewPlaying"&&!b.paused?s.jsx(Lf,{className:"h-4 w-4","aria-hidden":"true"}):s.jsx(Tr,{className:"h-4 w-4","aria-hidden":"true"})}),s.jsx("span",{className:"truncate text-sm font-medium text-ink",children:er(Pe.language)}),s.jsx("span",{className:"rounded-md bg-primary-50 px-1.5 py-0.5 text-[10px] font-medium text-primary-700",children:"Original"})]}),s.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-3",children:[!on&&s.jsx("button",{type:"button",onClick:()=>Dt(Pe.language),disabled:te||st,className:`${to} border border-indigo/20 bg-indigo-wash text-indigo-deep hover:border-indigo/40 hover:bg-indigo/10`,children:"Re-record"}),s.jsx("button",{type:"button",onClick:()=>yr(Pe.language),disabled:te||st,"aria-label":`Remove ${er(Pe.language)} voice`,className:"grid h-8 w-8 place-items-center rounded-md bg-peach-tint text-destructive hover:bg-red-100 hover:text-red-700 disabled:opacity-60",children:te&&oe===Pe.language?s.jsx(vt,{className:"h-4 w-4 animate-spin"}):s.jsx(Qs,{className:"h-4 w-4"})})]})]},Pe.language))}),b.error?s.jsx("p",{className:"text-xs text-red-600",role:"alert",children:b.error}):null]}):null,!y&&Ne&&x&&$.enabled?s.jsxs("div",{className:"mt-3 border-t border-rule pt-3",children:[Ue?s.jsxs("div",{className:"mb-2 flex items-start gap-2 rounded-lg bg-indigo-wash/60 p-3",role:"status","aria-live":"polite",children:[s.jsx(vt,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-indigo-deep"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-xs font-medium text-ink",children:"Your original voice is ready."}),s.jsx("p",{className:"mt-0.5 text-xs leading-relaxed text-ink-mid",children:"We're adding more languages in the background. You can leave this page and they'll appear as they become ready."}),s.jsxs("p",{className:"mt-1 text-xs font-medium text-indigo-deep",children:[$.ready," of ",$.total," languages ready"]})]})]}):null,$.status==="failed"?s.jsxs("div",{className:"mb-2 flex items-start gap-2 rounded-lg bg-cream-deep p-3",role:"status",children:[s.jsx(al,{className:"mt-0.5 h-4 w-4 shrink-0 text-ink-mid"}),s.jsxs("p",{className:"text-xs leading-relaxed text-ink-mid",children:[$.failed," ",$.failed===1?"language could":"languages could"," not be added. The available languages below are ready to use."]})]}):null,s.jsxs("button",{type:"button","aria-expanded":he,"aria-controls":Xe,onClick:()=>se(Pe=>!Pe),className:"flex w-full items-center justify-between gap-3 rounded-md border border-rule bg-paper px-3 py-2 text-left transition-colors hover:border-indigo/30 hover:bg-indigo-wash/35 focus-visible:outline-none focus-visible:shadow-focus",children:[s.jsx("span",{className:"text-sm font-medium text-ink",children:"Your expert can also speak:"}),s.jsxs("span",{className:"flex items-center gap-2 text-xs text-ink-muted",children:[Ue?`${$.ready} of ${$.total} ready`:`${ne.length} ${ne.length===1?"language":"languages"}`,s.jsx(Is,{className:`h-4 w-4 transition-transform ${he?"rotate-180":""}`})]})]}),he?s.jsx("div",{id:Xe,className:"flex flex-wrap gap-2 px-1 pb-2 pt-1","aria-live":"polite",children:ne.length>0?ne.map(Pe=>s.jsx("span",{className:"rounded-md bg-[#f1f2f4] px-2.5 py-1 text-xs text-ink-mid",children:er(Pe.language)},Pe.language)):s.jsx("span",{className:"text-xs text-ink-muted",children:"Additional languages are being prepared."})}):null]}):null,on?s.jsxs("div",{className:"mt-4 space-y-4",children:[!v&&s.jsxs("div",{ref:St,tabIndex:-1,
441className:`block rounded-lg focus:outline-none ${Je==="language"?"voice-option-cue":""}`,children:[s.jsx("span",{className:"mb-1.5 block text-xs font-medium uppercase tracking-[0.08em] text-ink-muted",children:"Recording language"}),s.jsx(JB,{value:N,defaultOpen:!N,options:xe,onChange:Pe=>{fn(),A(Pe)},disabled:st||te,ariaLabel:"Recording language",placeholder:"Choose language",buttonClass:`${QB} ${yS}`,buttonStyle:vS})]}),s.jsx("style",{children:` 442 @keyframes voiceRecorderStageIn { 443 from { opacity: 0; transform: translateY(6px) scale(.99); } 444 to { opacity: 1; transform: translateY(0) scale(1); } 445 } 446 @keyframes voiceOptionCue { 447 0%, 100% { 448 box-shadow: 0 0 0 0 rgba(67,64,255,0); 449 filter: saturate(1); 450 transform: translateY(0); 451 } 452 38%, 68% { 453 background-color: rgba(67,64,255,.16); 454 border-color: rgb(67,64,255); 455 box-shadow: 0 5px 14px rgba(45,45,204,.22); 456 filter: saturate(1.18); 457 transform: translateY(-1px); 458 } 459 } 460 @keyframes voiceCheckboxCue { 461 0%, 100% { 462 border-color: rgb(134,132,123); 463 box-shadow: 0 1px 2px rgba(20,20,18,.08); 464 } 465 38%, 68% { 466 border-color: rgb(67,64,255); 467 box-shadow: 0 4px 12px rgba(45,45,204,.25); 468 } 469 } 470 @keyframes voiceConsentCue { 471 0%, 100% { color: inherit; } 472 38%, 68% { color: rgb(45,45,204); } 473 } 474 .voice-recorder-stage { animation: voiceRecorderStageIn 260ms cubic-bezier(.16,1,.3,1) both; } 475 .voice-option-cue { animation: voiceOptionCue 1.55s cubic-bezier(.22,1,.36,1) both; } 476 .voice-checkbox-cue { animation: voiceCheckboxCue 1.55s cubic-bezier(.22,1,.36,1) both; } 477 .voice-consent-cue { animation: voiceConsentCue 1.55s cubic-bezier(.22,1,.36,1) both; } 478 @media (prefers-reduced-motion: reduce) { 479 .voice-recorder-stage, 480 .voice-option-cue, 481 .voice-checkbox-cue, 482 .voice-consent-cue { animation: none !important; } 483 } 484 `}),Ze?s.jsxs("div",{className:`rounded-lg border border-rule p-4 ${v?"ce-voice-script bg-paper":"bg-[#f1f2f4]"}`,children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-[0.08em] text-ink-muted",children:"Say this naturally"}),s.jsxs("p",{dir:Ze.rtl?"rtl":"ltr",className:"mt-2 text-sm leading-6 text-ink",children:["â",Ze.script,"â"]})]}):s.jsx("p",{className:"rounded-lg border border-dashed border-indigo/30 bg-indigo-wash/35 px-4 py-3 text-xs text-indigo-deep",children:"Choose a language above to continue."}),s.jsxs("div",{className:"grid",children:[s.jsxs("div",{className:`col-start-1 row-start-1 space-y-4 ${_t?"":"invisible pointer-events-none select-none"}`,"aria-hidden":!_t,children:[!me&&(v?s.jsxs("label",{ref:Jt,tabIndex:-1,"aria-label":"Confirm voice permission and storage before recording","data-attention":Je==="consent"?"true":void 0,className:`ce-voice-consent group flex items-center gap-3 text-[12.5px] leading-[1.5] text-ink-mid focus:outline-none ${st?"cursor-default":"cursor-pointer"}`,children:[s.jsx("input",{type:"checkbox",checked:ii,disabled:st,onChange:Pe=>{fn(),ee(Pe.target.checked),ae(Pe.target.checked)},className:"peer sr-only"}),s.jsx("span",{"aria-hidden":"true",className:`grid h-[22px] w-[22px] shrink-0 place-items-center rounded-[7px] border-[1.5px] border-ink-light bg-paper text-white shadow-[0_1px_2px_rgba(20,20,18,0.08)] transition-[background-color,border-color,box-shadow,transform] duration-200 ease-out group-hover:border-indigo peer-checked:border-indigo peer-checked:bg-indigo peer-focus-visible:ring-4 peer-focus-visible:ring-indigo-tint peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-paper peer-active:scale-95 motion-reduce:transform-none motion-reduce:transition-none ${Je==="consent"?"voice-checkbox-cue":""}`,children:s.jsx(ft,{className:`h-3.5 w-3.5 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none ${ii?"scale-100 opacity-100":"scale-75 opacity-0"}`,strokeWidth:3})}),s.jsx("span",{className:Je==="consent"?"voice-consent-cue":"",children:x?"I have permission to use this voice and agree to private storage and language generation.":"I have permission to use this voice and agree to private storage for this language."})]}):s.jsxs("div",{ref:Jt,tabIndex:-1,"aria-label":"Confirm voice permission and storage before recording","data-attention":Je==="consent"?"true":void 0,className:`space-y-2 text-xs text-ink-muted focus:outline-none ${Je==="consent"?"voice-consent-cue":""}`,children:[s.jsxs("label",{className:"flex items-start gap-2",children:[s.jsx("input",{type:"checkbox",checked:P,onChange:Pe=>{fn(),ee(Pe.target.checked)},className:"mt-0.5"}),s.jsx("span",{children:"I confirm this is my voice, or I have permission to clone it."})]}),s.jsxs("label",{className:"flex items-start gap-2",children:[s.jsx("input",{type:"checkbox",checked:X,onChange:Pe=>{fn(),ae(Pe.target.checked)},className:"mt-0.5"}),s.jsx("span",{children:x?"I agree that this recording is stored privately and used to create versions of my voice in other languages.":"I agree that this recording is stored privately for the language I choose."})]})]})),et&&!w?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-ink-muted",children:[s.jsxs("span",{children:["Recording ",Ze?.name]}),s.jsxs("span",{children:[L,"s left"]})]}),s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-cream-deep",children:s.jsx("div",{className:"h-full rounded-full bg-primary-500 transition-[width] duration-200",style:{width:vn}})})]}):null,w?s.jsxs("div",{className:"flex flex-col items-center pt-1 text-center",children:[s.jsx("style",{children:` 485 @keyframes voiceRecordWave { 486 0%, 100% { transform: scaleY(.28); } 487 50% { transform: scaleY(1); } 488 } 489 @keyframes voiceRecordLive { 490 0%, 100% { box-shadow: inset 0 0 0 0 rgba(255,255,255,.03), 0 14px 34px rgba(45,45,204,.22); } 491 50% { box-shadow: inset 0 0 32px 4px rgba(255,255,255,.12), 0 16px 40px rgba(45,45,204,.3); } 492 } 493 @keyframes voiceRecordDot { 494 0%, 100% { opacity: .55; transform: scale(.82); } 495 50% { opacity: 1; transform: scale(1); } 496 } 497 .voice-record-live { animation: voiceRecordLive 1.8s ease-in-out infinite; } 498 .voice-record-bar { animation: voiceRecordWave .78s ease-in-out infinite; } 499 .voice-record-dot { animation: voiceRecordDot 1.2s ease-in-out infinite; } 500 @media (prefers-reduced-motion: reduce) { 501 .voice-record-live, 502 .voice-record-bar, 503 .voice-record-dot { animation: none !important; } 504 } 505 `}),$n?s.jsxs("div",{className:"flex h-28 items-center justify-center gap-3 text-left",role:"status","aria-live":"polite","data-recorder-state":"approved",children:[s.jsx("span",{className:"grid h-11 w-11 shrink-0 place-items-center rounded-full bg-sage-tint text-sage-deep","aria-hidden":"true",children:s.jsx(Aw,{className:"h-6 w-6",strokeWidth:2.4})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-ink",children:"Okay, your voice is ready."}),s.jsx("p",{className:"mt-0.5 text-xs text-ink-muted",children:"Continue below when you're ready."})]})]}):s.jsxs("button",{ref:wt,type:"button",onClick:et?Fs:Xs,disabled:!et&&(te||U||M==="requesting"),"aria-label":et?`Stop recording, ${Ot} seconds elapsed`:M==="requesting"?"Requesting microphone access":"Start 10 second voice recording",className:`ce-voice-record group relative isolate grid h-28 w-28 place-items-center overflow-hidden rounded-full border-0 text-white shadow-[0_14px_34px_rgba(45,45,204,0.22)] transition-[transform,background-color,box-shadow,opacity] duration-base focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-indigo disabled:cursor-not-allowed disabled:opacity-55 motion-reduce:transform-none motion-reduce:transition-none ${et?"voice-record-live bg-indigo-deep hover:scale-[1.025]":pt?"bg-indigo hover:scale-[1.04] hover:bg-indigo-deep":"cursor-pointer bg-indigo opacity-55 hover:scale-100 hover:bg-indigo"}`,children:[s.jsx("span",{"aria-hidden":"true",className:"absolute inset-x-5 top-2 h-7 rounded-full bg-white/10 blur-md"}),s.jsx("span",{className:"relative z-10 grid place-items-center",children:M==="requesting"?s.jsx(vt,{className:"h-8 w-8 animate-spin"}):et?s.jsxs("span",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{"aria-hidden":"true",className:"flex h-7 items-center gap-[5px]",children:[0,1,2,3,4].map(Pe=>s.jsx("span",{className:"voice-record-bar h-7 w-[3px] origin-center rounded-pill bg-white/95",style:{animationDelay:`${Pe*-.11}s`}},Pe))}),s.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[12px] font-semibold tabular-nums tracking-[0.04em] text-white/90",children:[s.jsx("span",{"aria-hidden":"true",className:"voice-record-dot h-1.5 w-1.5 rounded-full bg-white"}),Hs]})]}):s.jsx(Qr,{className:"h-8 w-8",strokeWidth:2.2})})]})]}):s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[et?s.jsxs("button",{type:"button",onClick:Fs,className:Ha,children:[s.jsx(ku,{className:"h-4 w-4"})," Stop"]}):s.jsxs("button",{ref:wt,type:"button",onClick:Xs,disabled:te||U||M==="requesting",className:`${Ha} ${pt?"":"opacity-55"}`,children:[M==="requesting"?s.jsx(vt,{className:"h-4 w-4 animate-spin"}):s.jsx(Qr,{className:"h-4 w-4"}),M==="requesting"?"Allow microphoneâ¦":`Record ${Ze?.name||""} voice`]}),s.jsx("button",{type:"button",onClick:()=>G(!1),disabled:te,className:`text-sm text-ink-muted hover:text-ink disabled:opacity-60 ${M==="idle"?"":"invisible"}`,children:"Cancel"})]})]}),_t?null:s.jsx("div",{className:"col-start-1 row-start-1 min-h-0",children:M==="processing"?s.jsxs("div",{className:"voice-recorder-stage flex h-full min-h-[92px] items-center justify-center gap-3 rounded-xl bg-paper px-4 py-5 text-left ring-1 ring-ink/10",role:"status","aria-live":"polite","data-recorder-state":"processing",children:[s.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-full bg-indigo-wash text-indigo-deep",children:s.jsx(vt,{className:"h-[18px] w-[18px] animate-spin motion-reduce:animate-none","aria-hidden":"true"})}),s.jsx("p",{className:"text-sm font-medium text-ink",children:"Creating your voice previewâ¦"})]}):["review","saving"].includes(M)&&W?s.jsx(TZe,{audioBlob:W.blob,audioUrl:W.url,fallbackDuration:W.duration,isBusy:te,saveError:Z,onApprove:Lt,onRecordAgain:fs,fill:!0}):M==="error"?s.jsxs("div",{className:"voice-recorder-stage flex h-full flex-col justify-center rounded-xl bg-paper p-4 ring-1 ring-red-200",role:"alert","data-recorder-state":"error",children:[s.jsx("p",{className:"text-sm font-medium text-ink",children:"Voice preview unavailable"}),s.jsx("p",{className:"mt-1 text-xs leading-5 text-red-600",children:Y||"Please try again."}),s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[tt.current?.blob?s.jsx(yt,{type:"button",variant:"primary",onClick:()=>Ds(),className:"min-h-11 !rounded-lg",children:"Try again"}):null,s.jsx(yt,{type:"button",variant:"secondary",icon:Du,onClick:fs,className:"min-h-11 !rounded-lg",children:"Record again"})]})]}):null})]})]}):pe?null:s.jsx("div",{className:"mt-4",children:s.jsxs("button",{type:"button",onClick:()=>Dt(),disabled:te||U,className:Ha,children:[s.jsx(Qr,{className:"h-4 w-4"}),"Clone your voice"]})}),Y&&M!=="error"&&!oe?s.jsx("p",{className:"mt-3 text-xs text-red-600",children:Y}):null,s.jsx("p",{className:"sr-only",role:"status","aria-live":"polite",children:Je==="language"?"Choose a recording language before recording.":Je==="gender"?"Choose a voice type before recording.":Je==="consent"?"Confirm voice permission and storage before recording.":""}),oe&&Mn.createPortal(s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/40 p-4",role:"presentation",children:s.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-rule bg-paper p-6 shadow-2xl sm:p-8",role:"dialog","aria-modal":"true","aria-labelledby":"voice-remove-title",children:[s.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[s.jsx("div",{className:"grid h-10 w-10 shrink-0 place-items-center rounded-xl bg-red-50",children:s.jsx(xr,{className:"h-5 w-5 text-red-600"})}),s.jsx("h3",{id:"voice-remove-title",className:"text-lg font-bold text-ink",children:"Delete voice?"})]}),s.jsxs("p",{className:"mb-6 text-sm leading-relaxed text-ink-mid",children:["Are you sure you want to delete the ",er(oe)," voice? This cannot be undone."]}),Y?s.jsx("p",{className:"mb-4 text-xs text-red-600",children:Y}):null,s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(yt,{variant:"secondary",onClick:ta,disabled:te,className:"min-w-[5rem]",children:"Cancel"}),s.jsx(yt,{variant:"danger",onClick:Js,isLoading:te,className:"min-w-[5rem]",children:te?"Deletingâ¦":"Confirm"})]})]})}),document.body)]})}function LZe({data:e,onChange:t,expertId:n,onNext:r,onBack:a,onSkip:i,saving:o=!1,setupError:l="",onSetupRetry:c,stepLabel:u="Step 3 of 5 · Voice",presentation:d="default",previewMode:h=!1}){const[p,m]=f.useState(!1),[g,x]=f.useState(),b=o||p,y=d==="minimal",v=!!e.voice_enabled,w=g===void 0?e.voice_preset?{type:"preset",voiceId:e.voice_preset}:null:g,j=w?.type==="clone"?w.gender:null,E=w?.type==="preset"?w.voiceId:null,S=v||!!E,_=H=>{x({type:"clone",gender:H}),t("voice_preset",null)},k=H=>{x(G=>(G===void 0&&e.voice_preset?{type:"preset",voiceId:e.voice_preset}:G)?.type==="preset"?G:H?{type:"clone",gender:H}:null)},C=H=>{x({type:"preset",voiceId:H}),t("voice_preset",H)},[N,A]=f.useState(()=>typeof window<"u"&&!!window.matchMedia?.("(max-width: 560px)").matches),[T,I]=f.useState(!1),$=f.useRef(null);f.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const H=window.matchMedia("(max-width: 560px)"),G=()=>A(H.matches);return G(),H.addEventListener("change",G),()=>H.removeEventListener("change",G)},[]);const O=y&&N&&!v&&!l,U=!O||T,F=()=>{I(H=>(H||window.requestAnimationFrame(()=>{$.current?.scrollIntoView({behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",block:"start"})}),!H))};return s.jsxs("section",{"aria-labelledby":"v4-voice-title",className:y?"ce-profile-voice-step":void 0,children:[y?s.jsx("h2",{id:"v4-voice-title",className:"sr-only",children:"Voice options"}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mb-3 block font-mono text-[11px] font-medium uppercase tracking-eyebrow text-ink-muted",children:u}),s.jsxs("h1",{id:"v4-voice-title",className:"font-heading text-[clamp(28px,3.8vw,40px)] font-medium leading-[1.14] tracking-[-0.015em] text-ink",children:["Give your Expert ",s.jsx("em",{className:"font-normal italic text-primary-500",children:"a voice."})]}),s.jsx("p",{className:"mt-2.5 max-w-[58ch] text-[15.5px] leading-[1.55] text-ink-mid",children:"Speak in your own voice or choose one of ours. Optional."})]}),s.jsxs("div",{className:`${y?"ce-profile-voice-options":"mt-8"} grid items-stretch gap-5 lg:grid-cols-[1.55fr_1fr]`,children:[s.jsxs("div",{ref:$,className:"ce-voice-clone-group","data-collapsible":O?"true":void 0,"data-open":U?"true":"false",children:[O?s.jsxs("button",{type:"button",className:"ce-voice-clone-toggle","aria-expanded":T,"aria-controls":"ce-voice-clone-panel",onClick:F,children:[s.jsx("span",{className:"ce-voice-clone-mark","aria-hidden":"true",children:s.jsx(Qr,{size:18,strokeWidth:2.2})}),s.jsxs("span",{className:"ce-voice-clone-copy",children:[s.jsxs("strong",{children:["Clone your ",s.jsx("em",{children:"own voice"})]}),s.jsx("span",{children:"It takes only 10 seconds"})]}),s.jsx("span",{className:"ce-voice-clone-chevron","aria-hidden":"true",children:s.jsx(Is,{size:18,strokeWidth:2.4})})]}
505):null,s.jsx("div",{id:"ce-voice-clone-panel",className:"ce-voice-clone-panel",inert:!U,children:s.jsx("div",{className:"ce-voice-clone-panel-inner",children:n?s.jsx("div",{className:`ce-voice-card ce-voice-card-clone relative rounded-2xl border p-5 shadow-subtle transition-colors duration-300 sm:p-6 ${v?"border-sage/35 bg-sage-tint/80":"border-indigo-tint bg-indigo-wash/40"}`,children:s.jsxs("div",{className:"grid",children:[s.jsx("div",{className:`col-start-1 row-start-1 ${v?"invisible pointer-events-none select-none":""}`,"aria-hidden":v||void 0,children:s.jsx(Rre,{expertId:n,layout:"wizard",onBusyChange:m,onEnabledChange:H=>t("voice_enabled",H),selectedGender:j,onGenderSelect:_,onGenderLoaded:k,previewMode:h,localizationEnabled:!1})}),v?s.jsxs("div",{className:"col-start-1 row-start-1 flex min-h-full flex-col items-center justify-center px-4 py-8 text-center",role:"status","aria-live":"polite","data-voice-card-state":"approved",children:[s.jsx("span",{className:"grid h-16 w-16 place-items-center rounded-full bg-paper text-sage-deep shadow-subtle","aria-hidden":"true",children:s.jsx(pc,{className:"h-8 w-8",strokeWidth:2.25})}),s.jsx("p",{className:"mt-5 font-heading text-[27px] font-medium leading-tight tracking-[-0.02em] text-ink",children:"Success! Your voice is ready."}),s.jsx("p",{className:"mt-2 text-[13.5px] leading-6 text-sage-deep",children:"Click Continue to keep going."})]}):null]})}):l?s.jsxs("div",{className:"ce-voice-card ce-voice-card-clone relative rounded-2xl border border-indigo-tint bg-indigo-wash/40 p-5 shadow-subtle sm:p-6",children:[s.jsxs("h2",{className:"ce-clone-title font-heading text-[25px] font-medium leading-tight tracking-[-0.02em] text-ink",children:["Clone your ",s.jsx("em",{className:"font-normal italic text-primary-500",children:"own voice"})]}),s.jsx("p",{className:"mt-1.5 text-[13.5px] text-ink-mid",children:"It takes only 10 seconds"}),s.jsxs("div",{className:"ce-profile-voice-pending",role:"alert",children:[s.jsx("span",{"aria-hidden":"true",children:s.jsx(Co,{size:20})}),s.jsxs("div",{children:[s.jsx("strong",{children:"Voice recording is not ready"}),s.jsx("p",{children:l})]}),c?s.jsx(yt,{type:"button",variant:"secondary",icon:Du,onClick:c,className:"ml-auto shrink-0 !rounded-pill px-4",children:"Try again"}):null]})]}):s.jsx("div",{className:"ce-voice-card ce-voice-card-clone relative rounded-2xl border border-indigo-tint bg-indigo-wash/40 p-5 shadow-subtle sm:p-6",children:s.jsx(Are,{status:"Setting up voice recordingâ¦",localizationEnabled:!1})})})})]}),s.jsxs("div",{className:`ce-voice-card ce-voice-card-preset relative rounded-2xl border border-rule bg-paper p-5 transition-opacity duration-300 ${v?"pointer-events-none select-none opacity-45":""}`,"aria-disabled":v||void 0,"data-voice-card-state":v?"blocked":"available",children:[v?s.jsx("span",{className:"sr-only",children:"Ready-made voices are unavailable because your cloned voice is selected."}):null,s.jsx("span",{className:"mb-3.5 block font-mono text-[10px] font-semibold uppercase tracking-[0.13em] text-ink-muted",children:n?"Or pick our ready-made voice":"Pick our ready-made voice"}),s.jsx("p",{className:"ce-voice-preset-hint mb-3 text-[12.5px] leading-[1.5] text-ink-muted",children:"A studio voice, if you would rather not record your own."}),s.jsx(Sre,{layout:"wizard",value:E,onChange:C,previewMode:h,disabled:v})]})]}),y?null:s.jsxs("p",{className:"mt-6 flex items-start gap-2.5 text-[12.5px] leading-[1.5] text-ink-mid",children:[s.jsx(Vh,{className:"mt-px h-4 w-4 shrink-0 text-ink-muted","aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("b",{className:"font-medium text-ink",children:"Private by default."})," Delete your voice anytime."]})]}),s.jsx("div",{className:y?"ce-profile-voice-footer mx-auto w-full max-w-[520px]":"mt-8 flex items-center gap-4",children:y?s.jsx(Lo,{onBack:a,onContinue:r,continueDisabled:b||!S}):s.jsxs("span",{className:"ml-auto inline-flex items-center gap-[18px]",children:[s.jsx("button",{type:"button",onClick:i,disabled:b,className:"rounded-sm text-[13px] font-medium text-ink-light transition-colors hover:text-ink-mid focus-visible:shadow-focus focus-visible:outline-none disabled:opacity-50",children:"Skip"}),s.jsx(yt,{variant:"primary",onClick:r,isLoading:o,disabled:b,children:"Continue"})]})})]})}function qj({data:e,onChange:t,expertId:n,saving:r,error:a,previewMode:i=!1,onRetry:o,onBack:l,onContinue:c,progressStep:u="profile-voice",progressSteps:d}){return s.jsxs("section",{className:"ce-pre-journey ce-onboarding-screen ce-profile-voice-screen",children:[s.jsxs("div",{className:"ce-onboarding-header ce-profile-voice-head",children:[s.jsx(jl,{step:u,steps:d}),s.jsxs("h1",{children:["Choose a ",s.jsx("em",{className:"ge-em",children:"voice"})]}),s.jsx("p",{children:"Clone your voice in one language, or choose one of ours."})]}),s.jsx("div",{className:"ce-onboarding-content ce-profile-voice-body",children:s.jsx(LZe,{data:e,onChange:t,expertId:n,previewMode:i,saving:r,setupError:a,onSetupRetry:o,presentation:"minimal",onBack:l,onNext:c})})]})}const Wj=280,OZe=2;function $p(){return`I write about the work I do and the ideas behind it. 506Always building something new and sharing what I learn along the way.`}function MZe(e){let t=String(e||"").replace(/\s+/g," ").trim();if(!t)return"";const n=[];for(;t&&n.length<OZe;){const o=t.match(/^[^.!?]+[.!?]+/);if(!o){n.push(t.endsWith(".")||t.endsWith("!")||t.endsWith("?")?t:`${t}.`);break}n.push(o[0].trim()),t=t.slice(o[0].length).trim()}let r=n.join(` 507`);if(r.length<=Wj)return r;const a=r.slice(0,Wj),i=Math.max(a.lastIndexOf(". "),a.lastIndexOf("? "),a.lastIndexOf("! "),a.lastIndexOf(`. 508`));return i>80?a.slice(0,i+1).trim():`${a.trimEnd()}â¦`}function DZe(e){const t={};return Object.entries(e||{}
508).forEach(([n,r])=>{const a=typeof r=="string"?r.trim():String(r?.handle||r?.username||"").trim();n&&a&&(t[n]=a)}),t}function Ire({identity:e,expertId:t=null,previewMode:n=!1,handles:r={},onEnsureDraft:a,saving:i=!1,error:o="",addToast:l,onChange:c,onAvatar:u,onBack:d,onContinue:h}){const p=f.useId(),m=f.useId(),g=f.useRef(null),[x,b]=f.useState(""),[y,v]=f.useState(!1),w=f.useRef(!1),j=f.useRef(r);j.current=r,f.useEffect(()=>()=>{x&&URL.revokeObjectURL(x)},[x]);const E=async T=>{const I=T.target.files?.[0];if(T.target.value="",!!I){if(!["image/png","image/jpeg","image/webp"].includes(I.type)||I.size>Ph){l?.(`Use a PNG, JPEG or WebP image under ${Lh}.`,"error");return}try{b(URL.createObjectURL(await A0(I)))}catch{l?.("We could not prepare that image. Try another one.","error")}}},S=T=>{b(""),u(T,URL.createObjectURL(T))},_=f.useCallback(async()=>{if(y||i)return;const T=e.name.trim();if(T.length<2){l?.("Add a name first so the bio can use it.","error");return}v(!0);try{let I="";if(n)I=$p();else{const $=t||await a?.();if(!$){c("bio",$p());return}const O=e.bio.trim(),U=await KG($,{name:T,bio:O===$p()?"":O,handles:DZe(j.current)});I=MZe(U?.data?.description)||$p()}if(!I)throw new Error("empty");c("bio",I)}catch{c("bio",$p())}finally{v(!1)}},[y,i,e.name,e.bio,n,t,a,c,l]);f.useEffect(()=>{if(!(w.current||y||i)){if(e.bio.trim()){w.current=!0;return}e.name.trim().length<2||(n||t||a)&&(w.current=!0,_())}},[e.name,e.bio,n,t,a,y,i,_]);const k=e.name.trim().length>=2,C=e.bio.trim()?"Regenerate":"Generate",N=e.bio.trim()!==$p(),A=!y&&!i&&e.name.trim().length>=2&&(n||!!t||!!a);return s.jsxs("section",{className:"ce-pre-journey ce-onboarding-screen ce-profile-identity-screen",children:[s.jsxs("header",{className:"ce-onboarding-header ce-profile-identity-head",children:[s.jsx(jl,{step:"profile-identity"}),s.jsxs("h1",{children:["Add profile ",s.jsx("em",{className:"ge-em",children:"details"})]}),s.jsx("p",{children:"This photo, name and bio will represent you everywhere."})]}),s.jsxs("div",{className:"ce-onboarding-content ce-profile-identity-body",children:[s.jsxs("section",{className:"ce-identity-form","aria-label":"Shared profile and AI expert identity",children:[s.jsxs("div",{className:"ce-identity-photo",children:[s.jsxs("button",{type:"button",className:`ce-identity-avatar${e.avatarSrc?"":" is-empty"}`,onClick:()=>g.current?.click(),"aria-label":`${e.avatarSrc?"Change":"Add"} avatar`,children:[s.jsx(ws,{name:e.name||"Your identity",src:e.avatarSrc,size:"3xl",className:"ce-identity-avatar-image"}),s.jsx("span",{"aria-hidden":"true",children:s.jsx(Nh,{size:16})})]}),s.jsx("input",{ref:g,type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",onChange:E})]}),s.jsxs("div",{className:"ce-identity-fields",children:[s.jsxs("label",{className:"ce-identity-name",htmlFor:p,children:[s.jsx("span",{className:"sr-only",children:"Name"}),s.jsx("input",{id:p,type:"text",value:e.name,maxLength:120,autoComplete:"name",placeholder:"Name",onChange:T=>c("name",T.target.value)})]}),s.jsxs("div",{className:"ce-identity-bio",children:[s.jsxs("label",{htmlFor:m,children:[s.jsxs("span",{className:"ce-identity-bio-label",children:["Short intro",s.jsx("span",{className:"ce-identity-bio-hint",children:"Shown on your public profile"})]}),s.jsx("textarea",{id:m,rows:5,value:e.bio,maxLength:Wj,placeholder:"A short bio visitors will read",disabled:y,onChange:T=>c("bio",T.target.value)})]}),s.jsxs("div",{className:"ce-identity-bio-bar",children:[N?s.jsxs("button",{type:"button",className:"ce-identity-generate",onClick:_,disabled:!A,"aria-label":y?"Generating intro":`${C} intro`,children:[y?s.jsx(vt,{size:16,className:"animate-spin","aria-hidden":"true"}):s.jsx(Ms,{size:16,"aria-hidden":"true"}),y?"Generating":C]}):s.jsx("span",{}),s.jsxs("small",{children:[e.bio.length,"/",Wj]})]})]})]})]}),typeof o=="string"&&o?s.jsx("p",{className:"ce-profile-identity-error",role:"alert",children:o}):null]}),s.jsx("footer",{className:"ce-onboarding-footer ce-profile-identity-footer",children:s.jsx(Lo,{onBack:d,onContinue:h,continueDisabled:!k||i||y,continueLabel:i?"Savingâ¦":"Continue"})}),s.jsx(T0,{isOpen:!!x,imageSrc:x,onCancel:()=>b(""),onSave:S})]})}function Pre({state:e="dim",sources:t=[],size:n=120,className:r="",src:a=""}){const i=n*.46,o=t.slice(0,6);return s.jsxs("div",{className:`j-orb-zone j-orb-zone--${e} ${r}`,style:{"--j-orb-size":`${n}px`},"aria-hidden":"true",children:[a?s.jsx("img",{className:"j-orb",src:a,alt:""}):s.jsx("span",{className:"j-orb"}),s.jsx("span",{className:"j-orb-ring"}),e==="live"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"j-ripple"}),s.jsx("span",{className:"j-ripple"}),s.jsx("span",{className:"j-ripple"})]}),o.length>0&&s.jsx("span",{className:"j-orbiters",children:o.map((l,c)=>{const u=c/o.length*Math.PI*2-Math.PI/2;return s.jsx("span",{className:"j-orbiter",style:{left:`calc(50% + ${(Math.cos(u)*i).toFixed(1)}px)`,top:`calc(50% + ${(Math.sin(u)*i).toFixed(1)}px)`,animationDelay:`0s, ${(c*.12).toFixed(2)}s`},children:l.icon||s.jsx(si,{className:"w-3.5 h-3.5"})},l.key||c)})})]})}const ts=Object.freeze({IDENTITY:"identity",APPEARANCE:"appearance",CONNECTIONS:"connections",CONTENT:"content",KNOWLEDGE:"knowledge",FINALIZING:"finalizing",PUBLISHING:"publishing",PERSONALIZING:"personalizing",READY:"ready",ERROR:"error"}),Lre=[ts.IDENTITY,ts.APPEARANCE,ts.CONNECTIONS,ts.CONTENT,ts.KNOWLEDGE,ts.FINALIZING,ts.PUBLISHING,ts.PERSONALIZING,ts.READY],$Ze=Object.freeze({[ts.IDENTITY]:"Building your layout",[ts.APPEARANCE]:"Adding your identity",[ts.CONNECTIONS]:"Connecting your links",[ts.CONTENT]:"Setting up your AI expert",[ts.KNOWLEDGE]:"Preparing knowledge for answers",[ts.FINALIZING]:"Finishing your profile",[ts.PUBLISHING]:"Publishing your profile",[ts.PERSONALIZING]:"Creating a look inspired by you",[ts.READY]:"Your profile is ready",[ts.ERROR]:"Profile creation paused"});function FZe(e){const t=Lre.indexOf(e);return t<0?0:t}const sU=[{key:"layout",icon:s.jsx(Ci,{className:"h-3.5 w-3.5"})},{key:"look",icon:s.jsx(Pf,{className:"h-3.5 w-3.5"})},{key:"links",icon:s.jsx($a,{className:"h-3.5 w-3.5"})},{key:"expert",icon:s.jsx(Ms,{className:"h-3.5 w-3.5"})},{key:"knowledge",icon:s.jsx(Ou,{className:"h-3.5 w-3.5"})},{key:"complete",icon:s.jsx(ft,{className:"h-3.5 w-3.5"})}],BZe=Object.freeze({[ts.IDENTITY]:"Creating the structure for your public profile",[ts.APPEARANCE]:"Applying your chosen look, name, photo and bio",[ts.CONNECTIONS]:"Adding your connected profiles and links",[ts.CONTENT]:"Preparing your AI expert and selected voice",[ts.KNOWLEDGE]:"Indexing your sources for accurate answers",[ts.FINALIZING]:"Checking everything before your profile is ready",[ts.PUBLISHING]:"Making your page and your AI expert live",[ts.PERSONALIZING]:"Bringing your colors and style into a suggested look",[ts.READY]:"Everything is ready for your test conversation",[ts.ERROR]:"Your progress is safe. Try again to continue."});function UZe(e,t){return t?"Paused":e===ts.READY?"Ready":e===ts.FINALIZING?"Checking":e===ts.PUBLISHING?"Publishing":"Building"}function zZe({stage:e,error:t,waitingForKnowledge:n}){const r=zu(),a=t?ts.ERROR:e,i=FZe(e),o=(i+1)/Lre.length*100,l=112,c=2*Math.PI*l,u=e===ts.READY,d=sU.slice(0,Math.min(i+1,sU.length));return s.jsxs("div",{className:`ce-build-orb-ceremony${t?" is-error":""}${u?" is-ready":""}`,role:"status","aria-live":"polite","aria-atomic":"true",children:[s.jsxs("div",{className:"ce-build-orb-progress","aria-hidden":"true",children:[s.jsxs("svg",{viewBox:"0 0 264 264",className:"ce-build-orb-progress-ring",children:[s.jsx("circle",{cx:"132",cy:"132",r:l,className:"ce-build-orb-progress-base"}),s.jsx(Dn.circle,{cx:"132",cy:"132",r:l,className:"ce-build-orb-progress-value",strokeDasharray:c,animate:{strokeDashoffset:c-c*(o/100)},transition:r?{duration:.12}:{duration:.62,ease:[.16,1,.3,1]}})]}),s.jsx(Pre,{state:u||t?"awake":"working",sources:d,size:220})]}),s.jsxs(Dn.div,{className:"ce-build-orb-copy",initial:r?{opacity:0}
508:{opacity:0,y:7,filter:"blur(5px)"},animate:{opacity:1,y:0,filter:"blur(0px)"},transition:{duration:r?.1:.2,ease:[.16,1,.3,1]},children:[s.jsxs("span",{className:"ce-build-orb-status",children:[t?s.jsx(Co,{size:15,"aria-hidden":"true"}):null,u?s.jsx(ft,{size:15,"aria-hidden":"true"}):null,UZe(e,t)]}),s.jsx("h2",{children:t?"Profile creation paused":n?"Finishing your knowledge uploads":$Ze[e]}),s.jsx("p",{children:!t&&n?"Your files are still uploading or processing. Weâll continue automatically when theyâre ready.":BZe[a]})]},a)]})}function l5({stage:e=ts.IDENTITY,error:t="",onRetry:n,waitingForKnowledge:r=!1,onReviewKnowledge:a}){const i=e===ts.READY;return s.jsxs("section",{className:`ce-pre-journey ce-onboarding-screen ce-profile-building-screen${t?" is-error":""}${i?" is-ready":""}`,"aria-busy":!t&&!i,"data-stage":t?ts.ERROR:e,children:[s.jsxs("header",{className:"ce-onboarding-header ce-profile-building-head",children:[s.jsx("h1",{children:t?"We couldnât finish your profile":s.jsxs(s.Fragment,{children:["Weâre making your ",s.jsx("em",{className:"ge-em",children:"profile"})]})}),s.jsx("p",{children:t?typeof t=="string"&&t||"Your progress is safe. Try again to continue.":s.jsxs(s.Fragment,{children:["Weâre applying your look, connecting your content,",s.jsx("br",{className:"ce-build-desktop-break"})," and preparing your profile."]})})]}),s.jsx("div",{className:"ce-onboarding-content ce-profile-building-body",children:s.jsxs("div",{className:"ce-build-stage",children:[s.jsx("span",{className:"ce-build-ambient","aria-hidden":"true"}),s.jsx(zZe,{stage:e,error:t,waitingForKnowledge:r})]})}),t?s.jsxs("footer",{className:"ce-onboarding-footer ce-profile-building-footer",children:[a?s.jsx(yt,{type:"button",variant:"secondary",onClick:a,className:"!rounded-pill px-7",children:"Review knowledge"}):null,s.jsx(yt,{type:"button",icon:_b,onClick:n,className:"!rounded-pill px-7",children:"Try again"})]}):null]})}function Vj({profilePath:e,config:t,profile:n=null,focusKey:r=null,device:a="desktop",zoom:i=1,onEdit:o=null,scrollTop:l=null,scrollBehavior:c="smooth"}){const u=f.useRef(null),[d,h]=f.useState(!1),[p,m]=f.useState(!1),g=f.useCallback(j=>{const E=u.current?.contentWindow;E&&j&&E.postMessage({type:mI,config:j},window.location.origin)},[]),x=f.useCallback(j=>{const E=u.current?.contentWindow;E&&j&&E.postMessage({type:fI,profile:j},window.location.origin)},[]);f.useEffect(()=>{const j=E=>{if(o&&Dx(E,d5e)){o(E.data.key);return}Dx(E,pI)&&(h(!0),g(t),x(n))};return window.addEventListener("message",j),()=>window.removeEventListener("message",j)},[t,n,g,x,o]),f.useEffect(()=>{d&&g(t)},[d,t,g]),f.useEffect(()=>{d&&x(n)},[d,n,x]),f.useEffect(()=>{const j=u.current?.contentWindow;d&&r&&j&&j.postMessage({type:yQ,key:r},window.location.origin)},[d,r]),f.useEffect(()=>{const j=u.current?.contentWindow;if(!(!d||!j||!Number.isFinite(l)))try{j.scrollTo({top:l,left:0,behavior:c})}catch{j.scrollTo(0,l)}},[d,c,l]),f.useEffect(()=>{if(d)return;const j=setTimeout(()=>m(!0),8e3);return()=>clearTimeout(j)},[d]);const b=p&&!d&&s.jsxs("div",{className:"ppb-frame-warn",role:"alert",children:[s.jsx(xr,{className:"ico","aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("b",{children:"The preview could not load here."})," Your page itself is fine."," ",s.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:["Open it in a new tab",s.jsx(Ro,{className:"ico ico-13","aria-hidden":"true"})]})]})]}),y=a==="mobile",v=s.jsx("iframe",{ref:u,src:`${e}${e.includes("?")?"&":"?"}preview=1&device=${a}${y?"&chrome=iphone":""}${n?"&preview_source=parent":""}`,title:"Your public page",className:"ppb-iframe"}),w=a==="laptop";return s.jsx("div",{className:`ppb-frame${y?" mob":w?" lap":""}`,style:{"--ppb-z":i},children:w?s.jsxs("div",{className:"ppb-macbook","aria-label":"MacBook Pro preview",children:[s.jsxs("div",{className:"ppb-macbook-screen",children:[b,v]}),s.jsx("img",{className:"ppb-macbook-frame",src:"/device-frames/macbook-pro-14-space-black.png",alt:"","aria-hidden":"true",draggable:"false"})]}):y?s.jsxs("div",{className:"ppb-iphone","aria-hidden":!1,children:[s.jsx("span",{className:"ppb-iphone-side ppb-iphone-side--silent","aria-hidden":"true"}),s.jsx("span",{className:"ppb-iphone-side ppb-iphone-side--vol-up","aria-hidden":"true"}),s.jsx("span",{className:"ppb-iphone-side ppb-iphone-side--vol-down","aria-hidden":"true"}),s.jsx("span",{className:"ppb-iphone-side ppb-iphone-side--power","aria-hidden":"true"}),s.jsxs("div",{className:"ppb-iphone-screen",children:[s.jsx("span",{className:"ppb-iphone-island","aria-hidden":"true"}),b,v,s.jsx("span",{className:"ppb-iphone-home","aria-hidden":"true"})]})]}):s.jsxs(s.Fragment,{children:[b,v]})})}function HZe(e,t=!1){if(!e||e.enabled===!1)return"hidden";if(t&&e.template)return"revealed";if(["accepted","discarded"].includes(e.decision)){if(e.status==="ready"&&e.template)return"ready";if(["queued","running"].includes(e.status))return"making"}return e.status==="loading"?"loading":e.status==="failed"?"unavailable":["queued","running"].includes(e.status)?"making":e.status==="ready"&&e.template?"ready":"hidden"}function qZe(e){return Math.min(90,Math.round(12+78*(1-Math.exp(-Math.max(0,e)/22e3))))}const nU=["#3d3df5","#ffb961","#f77ea5","#56bfad","#6b57e9"];function Ore({profilePath:e="/",shareUrl:t="",config:n=null,personalizationSources:r,profile:a,onContinue:i,onEditProfile:o,trial:l=null,onPayNow:c,payNowBusy:u=!1}){const d=zu(),h=f.useRef(null),p=f.useRef(null),[m,g]=f.useState(!1),[x,b]=f.useState(0),{state:y,decide:v,start:w,refresh:j}=hI(!0),E=f.useRef(!1),[S,_]=f.useState(!1),[k,C]=f.useState(!1);f.useEffect(()=>{const se=setTimeout(()=>_(!0),3e3);return()=>clearTimeout(se)},[]),f.useEffect(()=>{E.current||r===void 0||(E.current=!0,w(r).catch(()=>{}))},[r,w]);const[N,A]=f.useState(null),[T,I]=f.useState(!1),[$,O]=f.useState(""),[U,F]=f.useState(null),H=U??(y.decision==="accepted"?"saved":y.decision==="discarded"?"original":null),[G,M]=f.useState(null),[z,W]=f.useState(0),[D,Z]=f.useState(50),V=HZe(y,!!N),L=k?"hidden":!S&&["ready","revealed","loading","making"].includes(V)?"making":N||V==="ready"?"revealed":V,K=N||(V==="ready"?y.template:null),te=L==="revealed"&&!!n,Q=L==="making"||L==="loading",Y=L==="unavailable",J=L==="loading";f.useEffect(()=>{if(!Q)return;const se=Date.now(),le=setInterval(()=>W(Date.now()-se),1e3);return()=>clearInterval(le)},[Q]);const P=qZe(z),ee=z>=6e4,X=G||y.originalDesign,ae=f.useMemo(()=>n&&X?bQ({...n,layouts:n.layouts||{}},{...X,order:X.order||[],layouts:X.layouts||{}}):n,[n,X]),me=f.useMemo(()=>K&&n?C0(n,K):n,[n,K]);f.useEffect(()=>{!N&&!H||(p.current?.focus({preventScroll:!0}),!H&&window.matchMedia("(max-width: 900px)").matches&&p.current?.scrollIntoView({behavior:d?"instant":"smooth",block:"start"}))},[N,d,H]);const q=async(se,le=!1)=>{const ke=D;Z(se==="accept"?0:100),ae&&M(lf(ae)),I(!0),O("");try{if(se==="accept"){A(K);const oe=ae||(await $r())?.config||{};await v("accept",lf(oe)),F("saved"),Z(0),b(Oe=>Oe+1)}else K&&A(K),await v(H==="saved"?"revert":"discard"),Z(100),F("original"),le&&C(!0)}catch{Z(ke),O("Your choice could not be saved. Please try again.")}finally{I(!1)}},he=t||(typeof window>"u"?e:new URL(e,window.location.origin).href);return f.useEffect(()=>{if(d||!h.current)return;let se=!1,le=0,ke=null;return re(async()=>{const{default:oe}=await import("./confetti.module-5PKC4vm3.js");return{default:oe}},[]).then(({default:oe})=>
508{if(se||!h.current)return;if(ke=oe.create(h.current,{resize:!0,useWorker:!0,disableForReducedMotion:!0}),x>0){ke({particleCount:32,spread:85,startVelocity:20,scalar:.65,ticks:90,gravity:1.1,colors:nU,origin:{x:.5,y:.55}});return}const Oe=performance.now()+2400,Je=(ue,be,Re)=>ke({particleCount:2,angle:ue,spread:58,startVelocity:42,decay:.93,gravity:.9,drift:Re,ticks:280,scalar:.95,colors:nU,shapes:["square","circle"],origin:{x:be,y:.76}}),Ie=ue=>{Je(62,.02,.08),Je(118,.98,-.08),ue<Oe&&(le=requestAnimationFrame(Ie))};le=requestAnimationFrame(Ie)}),()=>{se=!0,cancelAnimationFrame(le),ke?.reset()}},[d,x]),s.jsxs("section",{className:`ce-onboarding-screen ce-profile-congratulations-screen${L!=="hidden"?" has-gift":""}`,children:[x===0&&typeof document<"u"?Mn.createPortal(s.jsx("canvas",{ref:h,className:"ce-congrats-confetti","aria-hidden":"true"},x),document.body):null,s.jsxs("div",{className:"ce-congrats-layout",children:[s.jsxs("div",{className:"ce-congrats-copy",children:[s.jsx("span",{className:"ce-congrats-mark","aria-hidden":"true",children:s.jsx(ft,{size:21,strokeWidth:3})}),s.jsxs("h1",{children:[s.jsx("span",{children:"Congratulations,"}),s.jsx("em",{children:"Youâre live."})]}),s.jsx("p",{children:"Share your new profile and let your audience experience your expertise, anytime."}),L!=="hidden"&&s.jsxs("section",{className:"ce-congrats-personalization","aria-label":"Profile personalization",children:[s.jsxs("div",{className:"ce-congrats-gift-heading",children:[s.jsx("span",{className:"ce-congrats-gift-seal","aria-hidden":"true",children:s.jsx(uY,{size:23,strokeWidth:1.6})}),s.jsx("span",{className:"ce-congrats-gift-label",children:"Complimentary · Just for you"})]}),s.jsxs("div",{role:"status",children:[s.jsx("h2",{children:J?"Finding your complimentary designâ¦":Y?"Your complimentary design is unavailable":Q?"A little gift is on its way":"A little gift, made for you"}),s.jsx("p",{children:J?"Your profile is live. Weâre checking your saved design.":Y?"Your current design is safe. Try again to load your complimentary option.":Q?y.template?"Your complimentary look is ready. Weâre preparing the comparison for you.":"Weâre crafting a complimentary look inspired by your links. You can keep your original design anytime.":"Inspired by your links. Yours to use, if you like."})]}),L==="revealed"&&s.jsxs("div",{className:"ce-congrats-gift-choice","aria-busy":T,children:[T&&s.jsx("span",{className:"ce-congrats-choice-note",role:"status",children:"Saving your choiceâ¦"}),s.jsxs("button",{type:"button",className:"ce-congrats-gift-ghost","aria-pressed":H!=="saved",onClick:()=>H!=="saved"?Z(100):q("discard"),disabled:T,children:[s.jsx("span",{children:"Original"}),s.jsx("small",{children:H!=="saved"?"â Live now":"Use this design"})]}),s.jsxs("button",{type:"button",className:"ce-congrats-gift-ghost ce-congrats-use-design","aria-pressed":H==="saved",onClick:()=>H==="saved"?Z(0):q("accept"),disabled:T,children:[s.jsx("span",{children:"Personalized"}),s.jsx("small",{children:H==="saved"?"â Live now":"Use this design"})]}),$&&s.jsx("span",{className:"ce-congrats-gift-error",role:"alert",children:$})]}),Y&&s.jsx("button",{type:"button",className:"ce-congrats-gift-ghost",onClick:()=>y.reason==="request_failed"?j():void w(void 0,!0).catch(()=>{}),children:"Try again"}),Q&&s.jsx("button",{type:"button",className:"ce-congrats-gift-ghost ce-congrats-skip",onClick:()=>q("discard",!0),disabled:T||y.status==="loading"||y.enabled===void 0,children:T?"Keeping your designâ¦":"Skip · keep my original design"}),Q&&$&&s.jsx("span",{className:"ce-congrats-gift-error",role:"alert",children:$})]}),s.jsxs("div",{className:"ce-congrats-actions",children:[s.jsxs(yt,{type:"button",onClick:()=>g(!0),className:"ce-congrats-continue !rounded-pill min-h-[52px]",children:["Share profile ",s.jsx(Of,{size:18,"aria-hidden":"true"})]}),s.jsxs("button",{type:"button",className:"ce-congrats-secondary",onClick:i,children:[s.jsx(hY,{size:17,"aria-hidden":"true"})," Go to dashboard"]}),s.jsxs("button",{type:"button",className:"ce-congrats-secondary",onClick:o,children:[s.jsx(Mu,{size:17,"aria-hidden":"true"})," Edit profile"]})]}),l?.plan&&c?s.jsxs("p",{className:"ce-congrats-trial",children:["Your 7-day ",l.planName," tri
508al is on, no card needed."," ",s.jsx("button",{type:"button",className:"ce-congrats-trial-pay",onClick:c,disabled:u,children:u?"Opening checkout":"Prefer to start your plan today?"})]}):null]}),s.jsx("div",{className:"ce-congrats-preview",ref:p,tabIndex:-1,role:"region","aria-label":te?"Compare your selected and personalized designs":"Your profile preview",children:s.jsxs(Dn.div,{className:"ce-congrats-phone ce-test-device",initial:d?{opacity:0}:{opacity:0,y:20,rotate:2},animate:{opacity:1,y:0,rotate:0},transition:d?{duration:.12}:{type:"spring",stiffness:210,damping:25,delay:.12},"aria-label":`Preview of ${a?.full_name||"your public profile"}`,children:[x>0&&s.jsx("canvas",{ref:h,className:"ce-congrats-phone-confetti","aria-hidden":"true"},x),s.jsx("span",{className:"ce-test-device-silent","aria-hidden":"true"}),s.jsx("span",{className:"ce-test-device-volume ce-test-device-volume-up","aria-hidden":"true"}),s.jsx("span",{className:"ce-test-device-volume ce-test-device-volume-down","aria-hidden":"true"}),s.jsx("span",{className:"ce-test-device-power","aria-hidden":"true"}),s.jsxs("div",{className:`ce-test-phone ce-congrats-profile-phone${te?" is-gifted":""}`,children:[s.jsx("div",{className:"ce-test-phone-speaker","aria-hidden":"true"}),s.jsx("div",{className:`ce-congrats-profile-preview${Q?" is-preparing":""}`,inert:Q||te&&D!==0,"aria-hidden":Q||te&&D!==0,children:s.jsx(Vj,{profilePath:e,config:Q||k?ae:me,profile:a,device:"mobile",zoom:.68,scrollTop:0,scrollBehavior:"instant"})}),te&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"ce-congrats-profile-preview ce-congrats-original",style:{clipPath:`inset(0 ${100-D}% 0 0)`},inert:D!==100,"aria-hidden":D!==100,children:s.jsx(Vj,{profilePath:e,config:ae,profile:a,device:"mobile",zoom:.68,scrollTop:0,scrollBehavior:"instant"})}),s.jsx("div",{className:"ce-congrats-divider",style:{left:`${D}%`},"aria-hidden":"true",children:s.jsx("span",{children:"â"})}),s.jsx("input",{className:"ce-congrats-drag",type:"range",min:"0",max:"100",value:D,onChange:se=>Z(Number(se.target.value)),"aria-label":"Drag to compare designs","aria-valuetext":`${D}% selected design, ${100-D}% personalized design`})]}),Q&&s.jsxs("div",{className:"ce-congrats-preparing",children:[s.jsx("span",{className:"ce-congrats-preparing-mark","aria-hidden":"true",children:s.jsx(Ms,{size:25})}),s.jsx("strong",{children:y.template?"Preparing your personalized preview":"Weâre personalising your profile"}),s.jsxs("span",{children:["A complimentary design inspired by your links.",s.jsx("br",{}),"Yours to use if you like."]}),!y.template&&s.jsxs("div",{className:"ce-congrats-gift-progress",children:[s.jsxs("div",{children:[s.jsx("span",{children:"Estimated progress"}),s.jsxs("strong",{children:[P,"%"]})]}),s.jsx("progress",{max:"100",value:P,"aria-label":"Estimated personalization progress"}),s.jsx("span",{role:"status",children:ee?"Taking a little longer. No need to wait â your selected design is live.":"No need to wait. Your selected design is live."})]})]}),s.jsx("div",{className:"ce-test-phone-home","aria-hidden":"true"})]})]})})]}),s.jsx(K0,{isOpen:m,onClose:()=>g(!1),subjectName:a?.full_name||"your profile",url:he,headline:"Share your profile",subline:"Choose a platform or copy your profile link.",blurb:`Explore ${a?.full_name||"this creator"}'s profile and AI expert on Great Experts.`})]})}const WZe=[{id:"files",label:"Files",Icon:WT},{id:"links",label:"Links",Icon:$a},{id:"notes",label:"Notes",Icon:si}];function Mre({isOpen:e,onClose:t,onAdd:n,onSkip:r}){return s.jsx(en,{isOpen:e,onClose:t,title:"Add more knowledge?",hideTitle:!0,maxWidth:"max-w-[400px]",className:"ce-knowledge-prompt-dialog !rounded-xl",children:s.jsxs("div",{className:"ce-knowledge-prompt",children:[s.jsxs("header",{className:"ce-knowledge-prompt-head",children:[s.jsx("h2",{id:"ce-knowledge-prompt-title",children:"Add more knowledge?"}),s.jsx("p",{id:"ce-knowledge-prompt-hint",children:"Optional"})]}),s.jsx("div",{className:"ce-knowledge-prompt-stack",role:"group","aria-labelledby":"ce-knowledge-prompt-title","aria-describedby":"ce-knowledge-prompt-hint",children:WZe.map(({id:a,label:i,Icon:o})=>s.jsxs("button",{type:"button",className:`ce-knowledge-prompt-block is-${a}`,onClick:n,children:[s.jsx("span",{className:"ce-knowledge-prompt-mark","aria-hidden":"true",children:s.jsx(o,{size:20,strokeWidth:2.1})}),s.jsx("span",{className:"ce-knowledge-prompt-label",children:i}),s.jsx(hn,{className:"ce-knowledge-prompt-chevron",size:18,"aria-hidden":"true"})]},a))}),s.jsx("button",{type:"button",className:"ce-knowledge-prompt-skip",onClick:r,children:"Not now"})]})})}function Dre(e,t){const n=e&&typeof e=="object"?e:{};return t?.id?PP({...n,order:wa(n)},t.id):n}const c5="dev-journey:screen",YP="devStep",$re="devPreview",u5="wizard_draft_expert_id",Fre=[{id:"welcome",label:"Welcome"}
508,{id:"templates",label:"Choose a look"},{id:"platforms",label:"Connect profiles"},{id:"profile-knowledge",label:"Add knowledge"},{id:"profile-voice",label:"Choose a voice"},{id:"profile-identity",label:"Add details"},{id:"profile-building",label:"Build profile"},{id:"profile-congratulations",label:"Congratulations"},{id:"dashboard",label:"Dashboard"}],KP=new Set(Fre.map(e=>e.id));function XP(e=""){if(!wu)return null;const t=new URLSearchParams(e).get(YP);return KP.has(t)?t:null}function VZe(e=""){return wu?new URLSearchParams(e).get($re)==="1":!1}function GZe(e){return["welcome","platforms"].includes(e)?{screen:e,completed:!1,knowledgeCompleted:!1,voiceCompleted:!1,profileBuilt:!1,testCompleted:!1}:e==="profile-knowledge"?{screen:"profile-knowledge",completed:!1,knowledgeCompleted:!1,voiceCompleted:!1,profileBuilt:!1,testCompleted:!1}:e==="templates"?{screen:"templates",completed:!1,knowledgeCompleted:!0,voiceCompleted:!1,profileBuilt:!1,testCompleted:!1}:e==="profile-building"?{screen:"profile-building",completed:!0,knowledgeCompleted:!0,voiceCompleted:!0,identityCompleted:!0,profileBuilt:!1,testCompleted:!0}:e==="profile-voice"?{screen:"profile-voice",completed:!0,knowledgeCompleted:!0,voiceCompleted:!1,identityCompleted:!1,profileBuilt:!1,testCompleted:!1}:e==="profile-identity"?{screen:"profile-identity",completed:!0,knowledgeCompleted:!0,voiceCompleted:!0,identityCompleted:!1,profileBuilt:!1,testCompleted:!1}:{screen:e,completed:!0,knowledgeCompleted:!0,voiceCompleted:!0,identityCompleted:!0,profileBuilt:!0,testCompleted:!0}}function YZe(){sf();try{sessionStorage.removeItem(u5),sessionStorage.removeItem(S4)}catch{}}function rU(e,t,{reset:n=!1,preview:r=!1}={}){if(!wu||!KP.has(e))return;if(n&&YZe(),e==="dashboard"&&!r){window.location.assign("/dashboard");return}Pt(GZe(e));try{t&&!["welcome","platforms","templates","profile-knowledge"].includes(e)?sessionStorage.setItem(u5,t):sessionStorage.removeItem(u5)}catch{}const a=new URLSearchParams;a.set(YP,e),r&&a.set($re,"1"),a.set("devRun",Date.now().toString(36)),t&&!["welcome","platforms","templates","profile-knowledge"].includes(e)&&a.set("draft",t),window.location.assign(`/experts/new?${a.toString()}`)}function Bre(e){f.useEffect(()=>{if(!(!wu||!KP.has(e))){try{sessionStorage.setItem("dev_journey_current_step",e);const t=new URL(window.location.href);t.pathname==="/experts/new"&&(t.searchParams.set(YP,e),window.history.replaceState(window.history.state,"",t))}catch{}window.dispatchEvent(new CustomEvent(c5,{detail:{screen:e}}))}},[e])}const vv="dev-preview-expert",aU="/creators/dev-preview-creator?agent_mock=1",KZe=[{code:"en",name:"English",origin:"preset",localizable:!0}],iU={name:"Farouk Lafriqui",tagline:"Practical guidance, shaped around your goals.",description:"A private preview expert for testing the complete creation journey.",avatar_url:"/create-expert/farouk-lafriqui.jpg",avatar_preview:"",voice:"",voice_preset:null,voice_enabled:!1,enable_leads:!0,consent:{}},oU=[{id:"dev-source-1",name:"Your expertise overview.pdf",status:"ready"}],lU={name:"Farouk Lafriqui",bio:"Creator, builder, and practical problem solver.",avatarSrc:"/create-expert/farouk-lafriqui.jpg"},XZe=[[0,ts.IDENTITY],[620,ts.APPEARANCE],[1320,ts.CONNECTIONS],[2100,ts.CONTENT],[2800,ts.KNOWLEDGE],[3500,ts.FINALIZING],[4140,ts.READY]],cU=5140;function JZe(){const e=an(),t=XP(e.search),[n,r]=f.useState(t||"welcome"),[a,i]=f.useState("preview-expert"),[o,l]=f.useState({}),[c,u]=f.useState({}),[d,h]=f.useState(""),[p,m]=f.useState(iU),[g,x]=f.useState(lU),[b,y]=f.useState(oU),[v,w]=f.useState(!1),[j,E]=f.useState(!1),[S,_]=f.useState(ts.IDENTITY),[k,C]=f.useState(()=>new URLSearchParams(e.search).get("devBuildError")==="1"),N=t==="profile-building";Bre(n),f.useEffect(()=>{if(n!=="profile-building"||k)return;let F=!1;const H=new Set,G=(z,W)=>{const D=setTimeout(()=>{H.delete(D),F||z()},W);H.add(D)},M=()=>{XZe.forEach(([z,W])=>{G(()=>_(W),z)}),G(N?M:()=>r("profile-congratulations"),cU)};return M(),()=>{F=!0,H.forEach(clearTimeout)}},[N,k,n]);const A=f.useMemo(()=>({id:vv,name:p.name,tagline:p.tagline,avatar_url:p.avatar_preview||p.avatar_url,voice_languages:KZe}),[p]),T=f.useMemo(()=>Dre({},A),[A]),I=(F,H)=>m(G=>({...G,[F]:H})),$=async(F,H)=>{l(G=>{const M={...G};return H?M[F]=H:delete M[F],M})},O=async F=>{u(H=>({...H,[F]:{handle:`@${F}-preview`,name:`${F} preview`}}))},U=()=>{i("preview-expert"),l({}),u({}),h(""),m(iU),x(lU),y(oU),w(!1),E(!1),_(ts.IDENTITY),C(!1),r("welcome")};return s.jsxs(s.Fragment,{children:[s.jsx(vs,{title:"Create Expert journey preview",path:"/experts/new",noIndex:!0}),n==="welcome"?s.jsx(qP,{initialUsername:a,deferProfileSave:!0,previewMode:!0,onContinue:({username:F})=>{i(F),r("templates")}
508}):n==="templates"?s.jsx(zk,{selectedId:d,onSelect:F=>h(F.id),onContinue:()=>r("platforms"),onSkip:()=>r("platforms"),onBack:()=>r("welcome")}):n==="platforms"?s.jsx(Uj,{connected:c,handles:o,onConnect:O,onSaveHandle:$,onContinue:()=>w(!0),onSkip:()=>w(!0),onBack:()=>r("templates")}):n==="profile-knowledge"?s.jsx(GP,{expertId:vv,onEnsureDraft:async()=>vv,documents:b,onDocumentsChange:y,previewMode:!0,onContinue:()=>{m(F=>({...F,consent:{...F.consent||{},authorship:!0,derivative_works:!0,no_third_party:!0}})),E(!1),r("profile-voice")},onSkip:()=>{E(!1),r("profile-voice")},onBack:()=>r("platforms")}):n==="profile-voice"?s.jsx(qj,{data:p,onChange:I,expertId:vv,previewMode:!0,onBack:()=>{j?(r("platforms"),w(!0)):r("profile-knowledge")},onContinue:()=>r("profile-identity")}):n==="profile-identity"?s.jsx(Ire,{identity:g,previewMode:!0,onChange:(F,H)=>{x(G=>({...G,[F]:H})),F==="name"?I("name",H):m(G=>({...G,description:H,tagline:H}))},onAvatar:(F,H)=>{x(G=>({...G,avatarSrc:H})),I("avatar_preview",H)},onBack:()=>r("profile-voice"),onContinue:()=>{m(F=>({...F,name:g.name,tagline:g.bio,description:g.bio,avatar_preview:g.avatarSrc})),r("profile-building")}}):n==="profile-building"?s.jsx(l5,{stage:S,profilePath:aU,profile:{name:g.name||"Your profile",username:a,bio:g.bio,avatarSrc:g.avatarSrc},sources:Object.keys(o),contentCount:b.length,error:k?"We could not finish your profile.":"",onRetry:()=>C(!1)}):n==="profile-congratulations"?s.jsx(Ore,{profilePath:aU,config:T,profile:{full_name:g.name||"Your profile",bio:g.bio||"",avatar_url:g.avatarSrc,expert_avatar_url:p.avatar_preview||p.avatar_url,experts:[A]},onContinue:()=>r("dashboard")}):s.jsxs("section",{className:"dev-journey-complete","aria-live":"polite",children:[s.jsx(pc,{size:54,"aria-hidden":"true"}),s.jsx("h1",{children:"Creation journey complete"}),s.jsx("p",{children:"You reached the end without creating an account or changing saved application data."}),s.jsx(yt,{type:"button",icon:Du,onClick:U,className:"!rounded-pill px-7",children:"Run it again"})]}),s.jsx(Mre,{isOpen:v,onClose:()=>w(!1),onAdd:()=>{w(!1),E(!1),r("profile-knowledge")},onSkip:()=>{w(!1),E(!0),r("profile-voice")}})]})}function QZe({children:e,className:t="",...n}){return s.jsx("div",{className:`bg-paper rounded-lg border border-rule shadow-card ${t}`,...n,children:e})}const $g=[{id:"bubble",label:"Bubble in the corner",video:"/business/chat-bubble.mp4"},{id:"inline",label:"Chat inside your page",video:"/business/chat-inline.mp4"}];function Ure({initialMode:e="",onSelect:t,onContinue:n,onBack:r}){const[a,i]=f.useState(()=>mc(e)||"bubble"),o=f.useRef(!1);f.useEffect(()=>{o.current||mc(e)||(o.current=!0,t?.("bubble"))},[e,t]);const l=u=>{i(u),t?.(u)},c=u=>{if(u.key!=="ArrowLeft"&&u.key!=="ArrowRight")return;u.preventDefault();const d=$g.findIndex(p=>p.id===a);if(d<0){l(u.key==="ArrowRight"?"bubble":"inline");return}const h=u.key==="ArrowRight"?1:-1;l($g[(d+h+$g.length)%$g.length].id)};return s.jsxs("section",{className:"ce-pre-journey ce-onboarding-screen ce-business-chat-screen",children:[s.jsxs("div",{className:"ce-onboarding-header ce-business-chat-header",children:[s.jsx(jl,{step:"business-chat",steps:To}),s.jsx("div",{className:"ce-business-chat-head",children:s.jsxs("h1",{children:["Choose a ",s.jsx("em",{className:"ge-em",children:"chat"})]})})]}),s.jsx("div",{className:"ce-onboarding-content ce-business-chat-body",children:s.jsx("div",{className:"ce-onboarding-content-inner",children:s.jsx("div",{className:"ce-business-chat-choices",role:"listbox","aria-label":"Chat style",onKeyDown:c,children:$g.map(u=>{const d=a===u.id;return s.jsxs("button",{type:"button",role:"option",className:`ce-biz-chat-card${d?" is-on":""}`,"aria-selected":d,"aria-label":u.label,onClick:()=>l(u.id),children:[s.jsxs("span",{className:"ce-biz-chat-stage",children:[s.jsx("video",{className:"ce-biz-chat-media","data-chat-mode":u.id,src:u.video,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),s.jsx("span",{className:"ce-biz-chat-check","aria-hidden":"true",children:s.jsx(ft,{size:14,strokeWidth:2.8})})]}),s.jsx("span",{className:"ce-biz-chat-name",children:u.label})]},u.id)})})})}),s.jsx("div",{className:"ce-onboarding-footer ce-business-chat-footer",children:s.jsx(Lo,{onBack:r,onContinue:()=>n?.(a),continueDisabled:!a})})]})}const Lm=[{id:"site",title:"Reading your website",detail:"Finding what you offer and how you talk about it",icon:s.jsx(vc,{className:"h-3.5 w-3.5"})},{id:"knowledge",title:"Learning your knowledge",detail:"Indexing your sources for accurate answers",icon:s.jsx(Ou,{className:"h-3.5 w-3.5"})},{id:"voice",title:"Tuning your voice",detail:"Getting your chat ready to sound like you",icon:s.jsx(Qr,{className:"h-3.5 w-3.5"})},{id:"ready",title:"All set",detail:"Next, make it look like your brand",icon:s.jsx(ft,{className:"h-3.5 w-3.5"})}],ZZe=2400,d5=112,wS=2*Math.PI*d5;function eet({stageIndex:e,error:t}){const n=zu(),r=Lm[e],a=r.id==="ready",i=(e+1)/Lm.length,o=Lm.slice(0,e+1).map(({id:l,icon:c})=>({key:l,icon:c}));return s.jsxs("div",{className:`ce-build-orb-ceremony${t?" is-error":""}${a?" is-ready":""}`,role:"status","aria-live":"polite","aria-atomic":"true",children:[s.jsxs("div",{className:"ce-build-orb-progress","aria-hidden":"true",children:[s.jsxs("svg",{viewBox:"0 0 264 264",className:"ce-build-orb-progress-ring",children:[s.jsx("circle",{cx:"132",cy:"132",r:d5,className:"ce-build-orb-progress-base"}),s.jsx(Dn.circle,{cx:"132",cy:"132",r:d5,className:"ce-build-orb-progress-value",strokeDasharray:wS,animate:{strokeDashoffset:wS-wS*i},transition:n?{duration:.12}:{duration:.62,ease:[.16,1,.3,1]}})]}),s.jsx(Pre,{state:a||t?"awake":"working",sources:o,size:220})]}),s.jsxs(Dn.div,{className:"ce-build-orb-copy",initial:n?{opacity:0}
508:{opacity:0,y:7,filter:"blur(5px)"},animate:{opacity:1,y:0,filter:"blur(0px)"},transition:{duration:n?.1:.2,ease:[.16,1,.3,1]},children:[s.jsxs("span",{className:"ce-build-orb-status",children:[t?s.jsx(Co,{size:15,"aria-hidden":"true"}):null,a&&!t?s.jsx(ft,{size:15,"aria-hidden":"true"}):null,t?"Paused":a?"Ready":"Building"]}),s.jsx("h2",{children:t?"Building paused":r.title}),s.jsx("p",{children:t||r.detail})]},t?"error":r.id)]})}function zre({stage:e,error:t="",onRetry:n,onBack:r,onContinue:a}){const[i,o]=f.useState(0),l=Lm.findIndex(p=>p.id===e),c=l>=0?l:i,u=Lm[c].id==="ready",d=!!t,h=u||d;return f.useEffect(()=>{if(l>=0||i>=Lm.length-1)return;const p=setTimeout(()=>o(m=>m+1),ZZe);return()=>clearTimeout(p)},[l,i]),s.jsxs("section",{className:"ce-pre-journey ce-onboarding-screen ce-business-chat-screen ce-business-building-screen","data-failed":d||void 0,"aria-busy":!u&&!d,children:[s.jsxs("div",{className:"ce-onboarding-header ce-business-chat-header",children:[s.jsx(jl,{step:"business-building",steps:To}),s.jsx("div",{className:"ce-business-chat-head",children:s.jsx("h1",{children:u?s.jsxs(s.Fragment,{children:["Your ",s.jsx("em",{className:"ge-em",children:"chat"})," is ready"]}):s.jsxs(s.Fragment,{children:["Building your ",s.jsx("em",{className:"ge-em",children:"chat"})]})})})]}),s.jsx("div",{className:"ce-onboarding-content ce-profile-building-body",children:s.jsxs("div",{className:"ce-build-stage",children:[s.jsx("span",{className:"ce-build-ambient","aria-hidden":"true"}),s.jsx(eet,{stageIndex:c,error:t})]})}),s.jsx("div",{className:`ce-onboarding-footer ce-business-chat-footer ce-bb-footer${h?" is-ready":""}`,inert:!h,children:s.jsx(Lo,{onBack:r,onContinue:d?n:a,continueDisabled:d?!n:!a,continueLabel:d?"Try again":"Continue"})})]})}const tet=MP.filter(e=>e.primary),jS=MP.filter(e=>!e.primary);function Hre({initialContact:e=null,loading:t=!1,saving:n=!1,onChange:r,onBack:a,onContinue:i}){const[o,l]=f.useState(()=>Kb({businessContact:e})),[c,u]=f.useState(()=>jS.filter(v=>o[v.key]).map(v=>v.key)),[d,h]=f.useState(!1),p=f.useRef({}),m=(v,w)=>{const j={...o,[v]:w.slice(0,Yb[v])};l(j),r?.(j)},g=v=>{u(w=>[...w,v]),h(!1),requestAnimationFrame(()=>p.current[v]?.focus())},x=v=>{u(w=>w.filter(j=>j!==v)),m(v,"")},b=jS.filter(v=>!c.includes(v.key)),y=[...tet,...jS.filter(v=>c.includes(v.key))];return s.jsxs("section",{className:"ce-pre-journey ce-onboarding-screen ce-business-chat-screen ce-business-contact-screen",children:[s.jsxs("div",{className:"ce-onboarding-header ce-business-chat-header",children:[s.jsx(jl,{step:"business-contact",steps:To}),s.jsxs("div",{className:"ce-business-chat-head",children:[s.jsxs("h1",{children:["Your ",s.jsx("em",{className:"ge-em",children:"contacts"})]}),s.jsx("p",{className:"ce-bct-lede",children:"Where your chat sends people ready to talk."})]})]}),s.jsx("div",{className:"ce-onboarding-content ce-bct-body",children:t?s.jsx(vt,{size:22,className:"animate-spin text-ink-light","aria-label":"Loading your contacts"}):s.jsxs("form",{className:"ce-bct-stack",onSubmit:v=>{v.preventDefault(),i?.(o)},children:[y.map(v=>{const w=v.icon,j=`ce-bct-${v.key}`,E={id:j,ref:S=>{p.current[v.key]=S},className:"ce-bct-input",value:o[v.key],placeholder:v.prompt,maxLength:Yb[v.key],onChange:S=>m(v.key,S.target.value)};return s.jsxs("div",{className:`ce-bct-pill${o[v.key].trim()?" is-filled":""}${v.multiline?" is-multiline":""}`,children:[s.jsxs("label",{htmlFor:j,className:"ce-bct-icon",children:[s.jsx(w,{size:22,...v.brand?{}:{strokeWidth:1.9}}),s.jsx("span",{className:"sr-only",children:v.label})]}),v.multiline?s.jsx("textarea",{rows:1,...E}):s.jsx("input",{type:v.type,autoComplete:v.autoComplete,...E}),v.primary?null:s.jsx("button",{type:"button",className:"ce-bct-remove",onClick:()=>x(v.key),"aria-label":`Remove ${v.label}`,children:s.jsx(as,{size:15,strokeWidth:2.2})})]},v.key)}),b.length?d?s.jsx("div",{className:"ce-bct-chips",role:"group","aria-label":"Add another contact",children:b.map(v=>{const w=v.icon;return s.jsxs("button",{type:"button",className:"ce-bct-chip",onClick:()=>g(v.key),children:[s.jsx(w,{size:15,strokeWidth:2,"aria-hidden":"true"}),v.label]},v.key)})}):s.jsx("button",{type:"button",className:"ce-bct-add",onClick:()=>h(!0),"aria-label":"Add another contact",children:s.jsx(Es,{size:18,strokeWidth:2.4,"aria-hidden":"true"})}
508):null,s.jsx("button",{type:"submit",hidden:!0,"aria-hidden":"true",tabIndex:-1})]})}),s.jsx("div",{className:"ce-onboarding-footer ce-business-chat-footer",children:s.jsx(Lo,{onBack:a,onContinue:()=>i?.(o),continueDisabled:t||n,continueLabel:n?"Savingâ¦":"Continue"})})]})}function qre({embedMode:e="",website:t="",expertId:n=null,previewMode:r=!1,initialWidget:a,avatarSrc:i="",addToast:o,onAvatar:l,onChange:c,onBack:u,onContinue:d,saving:h=!1}){const p=mc(e)||"bubble",[m,g]=f.useState(()=>{const b=Df(a);return{...b,name:b.name||oA(t)}}),x=b=>{const y={...m,...b};g(y),c?.({widget:y})};return s.jsxs("section",{className:"ce-pre-journey ce-onboarding-screen ce-business-chat-screen ce-business-customize-screen",children:[s.jsxs("div",{className:"ce-onboarding-header ce-business-chat-header",children:[s.jsx(jl,{step:"business-customize",steps:To}),s.jsx("div",{className:"ce-business-chat-head",children:s.jsxs("h1",{children:["Make it ",s.jsx("em",{className:"ge-em",children:"yours"})]})})]}),s.jsx("div",{className:"ce-onboarding-content ce-bc-body",children:s.jsx(nne,{mode:p,website:t,widget:m,onUpdate:x,expertId:n,previewMode:r,avatarSrc:i,addToast:o,onAvatar:l})}),s.jsx("div",{className:"ce-onboarding-footer ce-business-chat-footer",children:s.jsx(Lo,{onBack:u,onContinue:()=>d?.({widget:m}),continueDisabled:h,continueLabel:h?"Savingâ¦":"Continue"})})]})}const Wre="Welcome â ask me anything about my work, experience, or recommendations.",set="Untitled expert";function Qd(e){const t=String(e??"").trim();return!t||t.startsWith(set)}function uU(e={},t=""){const n=Qd(e?.name)?"":String(e.name).trim(),r=Qd(t)?"":String(t).trim();return{name:n||r||"Your profile",greeting:String(e?.greeting||Wre).trim()}}function dU(e){return String(e??"").trim()===Wre}const D1=["/create-expert/avatars/kitten-suit.webp","/create-expert/avatars/giraffe-astronaut.webp","/create-expert/avatars/penguin-cafe.webp","/create-expert/avatars/capybara-camp.webp","/create-expert/avatars/rabbit-pilot.webp"],hU="create_expert_preset_avatar";function net(e){return D1.includes(String(e||""))}function ret(){try{const t=sessionStorage.getItem(hU);if(D1.includes(t))return t}catch{}const e=D1[Math.floor(Math.random()*D1.length)];try{sessionStorage.setItem(hU,e)}catch{}return e}async function aet(e){const t=await fetch(e);if(!t.ok)throw new Error("Could not load the preset photo.");const n=await t.blob(),r=String(e).split("/").pop()||"avatar.webp";return new File([n],r,{type:n.type||"image/webp"})}const JP="create_expert_offerings_v2",Fg=20,cc=100,Vre=120,pU=80,iet=new Set(["idle","loading","done","partial","empty","error"]),mU={schemaVersion:3,url:"",urls:[],status:"idle",rows:[],deletedIds:[],deletedKeys:[]},wf=["name","description","price","url","image","action","buttonLabel","kind","offeringKind"],Gj=new Set,au=new Map,wv=new Map,Yj=new Set;let el=0,Fp=null;const Fh=e=>/\bABC\s*\d/i.test(e||""),oet=e=>String(e||"").replace(/\s+/g,"").toLowerCase(),fU=e=>Zr(e).replace(/\/$/,"");function Kj(e){return!!e.url&&!e.editedFields.includes("price")&&!e.editedFields.includes("url")&&(Fh(e.price)||e.issues.some(t=>t.field==="price"&&t.values?.some(Fh)))}function Gre(e,t){return e.flatMap(n=>{if(n.field!=="price"||!n.values?.some(Fh)||n.id.startsWith("local:"))return[n];const r=[...new Map([...n.values.filter(a=>!Fh(a)),t].filter(Boolean).map(a=>[oet(a),a])).values()];return r.length>1?[{...n,values:r}]:[]})}function cet(e){const t=Nn(),n=el;if(Fp?.generation===n&&Fp.jobId===t.jobId)return Fp.run;const r=new Map(t.rows.filter(Kj).map(l=>[l.id,l])),a=()=>n===el&&Nn().jobId===t.jobId,i=l=>{const c=r.get(l.id);return c&&l.price===c.price&&l.url===c.url&&Kj(l)},o=(async()=>{const l=[...new Set([...r.values()].flatMap(c=>[c.sourceUrl]).filter(Boolean).concat([...r.values()].map(c=>c.url)))];for(const c of l){if(!a())return 0;if(!Nn().rows.some(p=>i(p)&&[p.sourceUrl,p.url].includes(c)))continue;let u;try{u=await e(c)}catch{continue}if(!a())return 0;const d=new Map(u.filter(p=>p.price&&!Fh(p.price)).map(p=>[fU(p.link),p.price])),h=Nn().rows.map(p=>{const m=d.get(fU(p.url));return i(p)&&m?{...p,price:m,issues:Gre(p.issues,m)}:p});Eo({rows:h,fromImport:!0})}return a()?Nn().rows.filter(i).length:0})().finally(()=>{Fp?.run===o&&(Fp=null)});return Fp={run:o,generation:n,jobId:t.jobId},o}function Lc(e,t){return String(e??"").replace(/\s+/g," ").trim().slice(0,t)}function J0(e){if(!e||typeof e!="object")return null;const t=Lc(e.name,Vre);return t?{id:typeof e.id=="string"&&e.id?e.id:Kh("offer"),kind:e.kind==="service"?"service":"product",offeringKind:["course","ebook","inquiry","service"].includes(e.offeringKind)?e.offeringKind:"product",name:t,description:Lc(e.description,500),price:Lc(e.price,pU),url:Zr(e.url),image:Zr(e.image),sourceUrl:Zr(e.sourceUrl),action:["book","inquiry","contact"].includes(e.action)?e.action:"buy",buttonLabel:Lc(e.buttonLabel,rf),selected:e.selected===!0,canonicalKeys:Array.isArray(e.canonicalKeys)?e.canonicalKeys.filter(n=>typeof n=="string"):[],aliases:Array.isArray(e.aliases)?e.aliases.filter(n=>typeof n=="string"):[],issues:Array.isArray(e.issues)?e.issues.filter(n=>n&&typeof n.id=="string"):[],resolvedIssues:Array.isArray(e.resolvedIssues)?e.resolvedIssues:[],editedFields:Array.isArray(e.editedFields)?e.editedFields.filter(n=>wf.includes(n)):[],selectedOptionId:typeof e.selectedOptionId=="string"?e.selectedOptionId:"",options:(Array.isArray(e.options)?e.options:[]).map(n=>({id:String(n.id||""),label:Lc(n.label,100),price:Lc(n.price,pU),link:Zr(n.link),action:["book","inquiry","contact"].includes(n.action)?n.action:"buy",buttonLabel:Lc(n.buttonLabel,rf),billingPeriod:Lc(n.billingPeriod,30)}))}:null}function uet(e){if(!e||e.kind==="none")return[];const t=(n,r)=>(Array.isArray(n)?n:[]).map(a=>
508J0({...a,offeringKind:a.kind,kind:r,url:a.link,selected:r==="product"})).filter(Boolean).map(a=>So(a)?{...a,selected:!1}:a);return[...t(e.products,"product"),...t(e.services,"service")].slice(0,cc)}function Nn(){try{const e=JSON.parse(sessionStorage.getItem(JP)||"null");return!e||typeof e!="object"||Array.isArray(e)?{...mU,rows:[],deletedIds:[]}:{...e,schemaVersion:3,url:Zr(e.url),urls:(e.urls||[e.url]).map(Zr).filter(Boolean),status:iet.has(e.status)?e.status:"idle",rows:(Array.isArray(e.rows)?e.rows:[]).map(t=>J0(e.schemaVersion===3?t:{...t,editedFields:wf})).filter(Boolean).slice(0,cc),deletedIds:Array.isArray(e.deletedIds)?e.deletedIds:[],deletedKeys:Array.isArray(e.deletedKeys)?e.deletedKeys:[]}}catch{return{...mU,rows:[],deletedIds:[]}}}function Eo(e){const t=Nn(),n={...t,...e,schemaVersion:3};if(n.rows=(n.rows||[]).map(J0).filter(Boolean).slice(0,cc).map(r=>So(r)?{...r,selected:!1}:r),Array.isArray(e?.rows)&&!e.fromImport){const r=new Set(n.rows.map(i=>i.id)),a=t.rows.filter(i=>!r.has(i.id));n.deletedIds=[...new Set([...n.deletedIds,...a.flatMap(i=>[i.id,...i.aliases])])],n.deletedKeys=[...new Set([...n.deletedKeys,...a.flatMap(i=>i.canonicalKeys)])]}delete n.fromImport;try{sessionStorage.setItem(JP,JSON.stringify(n))}catch{}return Gj.forEach(r=>r(n)),n}function det(e){return Gj.add(e),()=>Gj.delete(e)}function gU(){el+=1,Yj.forEach(t=>t.abort());const e=Promise.allSettled([...au.values()]);au.clear();try{sessionStorage.removeItem(JP)}catch{}return Gj.forEach(t=>t(Nn())),e}function xU(e){const t=Nn();if(!t.jobId)return Promise.resolve(t);const n=wv.get(t.jobId);if(n?.generation===el)return n.run;const r=++el;Yj.forEach(i=>i.abort({stopRequested:!0})),au.clear(),Eo({status:t.rows.length?"done":"empty",reason:"stopping"});const a=Promise.resolve().then(()=>e(t.jobId)).then(()=>(r===el&&Eo({reason:"stopped"}),Nn())).catch(i=>{if(r===el)throw Eo({reason:"stop_failed"}),i;return Nn()}).finally(()=>{wv.get(t.jobId)?.run===a&&wv.delete(t.jobId)});return wv.set(t.jobId,{generation:r,run:a}),a}function het(e,t){return e.map(n=>n.id===t&&!So(n)?{...n,selected:!n.selected}:n)}function pet(e,t){return e.map(n=>n.id===t?{...n,kind:n.kind==="product"?"service":"product",offeringKind:n.kind==="product"?"service":"product",action:n.url?"buy":"contact",editedFields:[...new Set([...n.editedFields,"kind","offeringKind","action"])]}:n)}function met(e,t){return e.filter(n=>n.id!==t)}function fet(e,t,n){return e.map(r=>{if(r.id!==t)return r;const a=wf.filter(o=>o in n&&n[o]!==r[o]);for(const o of r.issues){if(!(n.resolvedIssues||[]).includes(o.id)||r.resolvedIssues.includes(o.id))continue;const l=o.field==="options"?["price","url","action","buttonLabel"]:[o.field==="link"?"url":o.field];a.push(...l.filter(c=>wf.includes(c)))}const i=J0({...r,...n,editedFields:[...new Set([...r.editedFields,...a])]})||r;return So(i)?{...i,selected:!1}:i})}function get(e,t){if(e.length>=cc)return e;const n=J0({...t,id:Kh("offer"),selected:!0,editedFields:wf});return n?[n,...e]:e}function So(e){return(e.issues||[]).some(t=>t.blocking!==!1&&!(e.resolvedIssues||[]).includes(t.id))||(e.options||[]).length>1&&!e.options.some(t=>t.id===e.selectedOptionId)}function xet(e,t,n){return e.map(r=>{if(r.id!==t)return r;const a=r.options.find(i=>i.id===n);return a?{...r,selectedOptionId:a.id,price:a.price,url:a.link,action:a.action,buttonLabel:a.buttonLabel,selected:!1,editedFields:[...new Set([...r.editedFields,"price","url","action","buttonLabel"])]}:{...r,selectedOptionId:"",selected:!1}})}function Yre(e){return e.filter(t=>t.selected&&!So(t))}function h5(e){const t=Yre(e),n=o=>{const l=o.options.find(c=>c.id===o.selectedOptionId)?.billingPeriod;return["quarterly","yearly"].includes(l)&&!/\bbilled\b/i.test(o.price)?`${o.price} · billed ${l}`:o.price},r=o=>({id:o.id,name:o.name,description:o.description||"",kind:o.offeringKind||(o.kind==="service"?"service":"product"),action:o.action,price:n(o),image:o.image||null,link:o.action==="contact"?null:o.url||null,buttonLabel:o.buttonLabel||""}),a=t.filter(o=>o.kind==="product").map(r),i=t.filter(o=>o.kind==="service").map(r);return{kind:a.length?"products":i.length?"services":"none",products:a,services:i}}function Kre(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return""}}function bet(e,t){let n=[...e.rows];const r=new Set(e.deletedIds),a=new Set(e.deletedKeys||[]);for(const l of uet(t)){const c=new Set([l.id,...l.aliases]);if([...c].some(p=>r.has(p))||l.canonicalKeys.some(p=>a.has(p)))continue;const u=n.filter(p=>c.has(p.id)||p.canonicalKeys.some(m=>l.canonicalKeys.includes(m)));if(!u.length){n.push(l);continue}const d=u[0],h={...d,...l,id:d.id,selected:d.selected,selectedOptionId:d.selectedOptionId,resolvedIssues:d.resolvedIssues,issues:[...l.issues,...d.issues.filter(p=>p.id.startsWith("local:"))],editedFields:d.editedFields,aliases:[...new Set([...d.aliases,l.id,...l.aliases])]};for(const p of wf)(d.editedFields.includes(p)||!l[p]&&d[p]&&!l.options.length)&&(h[p]=d[p]);d.price&&!Fh(d.price)&&Fh(l.price)&&!l.options.length&&(h.price=d.price,h.issues=Gre(h.issues,h.price));for(const p of u.slice(1)){h.selected||=p.selected,h.selectedOptionId?p.selectedOptionId&&h.selectedOptionId!==p.selectedOptionId&&h.issues.push({id:`local:billing:${h.selectedOptionId}:${p.selectedOptionId}`,field:"options",values:[h.selectedOptionId,p.selectedOptionId],blocking:!0}):h.selectedOptionId=p.selectedOptionId;for(const m of p.editedFields)h.editedFields.includes(m)&&h[m]!==p[m]?h.issues=[...h.issues,{id:`local:${p.id}:${m}:${String(h[m])}:${String(p[m])}`,field:m,values:[String(h[m]||""),String(p[m]||"")],blocking:!0}]:(h[m]=p[m],h.editedFields=[...new Set([...h.editedFields,m])])}So(h)&&(h.selected=!1),n=n.filter(p=>!u.includes(p)||p===d).map(p=>p===d?h:p)}const i=t.import,o=i&&["queued","reading","extracting"].includes(i.status);return n=n.slice(0,cc),{rows:n,fromImport:!0,jobId:i?.id||e.jobId,urls:i?.sources||e.urls,progress:i?.progress,reason:i?.reason,errors:i?.errors||[],skippedDestinations:i?.skippedDestinations||[],status:o?"loading":i?.status==="failed"?"error":i?.status==="partial"?"partial":n.length?"done":"empty"}}function p5(e,t,{force:n=!1}={}
508){const r=[...new Set((Array.isArray(e)?e:[e]).map(Zr).filter(Boolean))],a=Nn(),i=[...new Set([...a.urls,...r])],o=JSON.stringify(i);if(au.has(o))return au.get(o);if(!n&&["done","empty","partial"].includes(a.status)&&r.every(p=>a.urls.includes(p))||!i.length)return Promise.resolve(a);const l=++el,c=new AbortController;Yj.add(c);const u=n||!a.requestKey?crypto.randomUUID():a.requestKey;Eo({url:i[0],urls:i,requestKey:u,status:"loading",errors:[]});const d=p=>{l===el&&Eo(bet(Nn(),p))},h=Promise.resolve().then(()=>t(i,{jobId:a.jobId,requestKey:u,force:n,onProgress:d,signal:c.signal})).then(p=>(d(p),Nn())).catch(p=>(l===el&&Eo({status:"error",errors:[{message:p.response?.data?.detail?.message||p.message||"Could not import these links."}]}),Nn())).finally(()=>{Yj.delete(c),au.get(o)===h&&au.delete(o)});return au.set(o,h),h}const yet=[{kind:"product",title:"Products",Icon:jb},{kind:"service",title:"Services",Icon:F0e}],vet={kind:"product",offeringKind:"product",name:"",description:"",price:"",url:"",image:"",action:"buy",buttonLabel:"",issues:[],resolvedIssues:[]};function wet({row:e,Icon:t}){const[n,r]=f.useState(!1);return e.image&&!n?s.jsx("img",{className:"ce-offering-thumb",src:e.image,alt:"",loading:"lazy",referrerPolicy:"no-referrer",onError:()=>r(!0)}):s.jsx("span",{className:`ce-offering-thumb is-${e.kind}`,"aria-hidden":"true",children:s.jsx(t,{size:20,strokeWidth:1.8})})}function bU({row:e,onSave:t,onCancel:n,limitReached:r=!1}){const[a,i]=f.useState({...e}),o=f.useRef(e.price),[l,c]=f.useState(!1),[u,d]=f.useState(""),h=!e.id,p=a.kind==="product"||a.action!=="contact",m=h?"Add offering":"Edit offering";f.useEffect(()=>{const b=o.current;o.current=e.price,i(y=>({...y,price:y.price===b?e.price:y.price,issues:e.issues}))},[e.price,e.issues]);const g=b=>y=>i(v=>({...v,[b]:y.target.value})),x=()=>{if(p&&!Zr(a.url)){d("Add a valid destination link, or choose the contact form for a service.");return}t(a)};return s.jsx(CP,{children:s.jsxs(en,{isOpen:!0,onClose:n,title:m,hideTitle:!0,maxWidth:"max-w-lg",className:"ppb ppb-product-dialog ce-offering-editor",backdropZ:"z-[10012]",contentZ:"z-[10013]",children:[s.jsxs("div",{className:"ppb-product-dialog-header",children:[s.jsxs("div",{children:[s.jsx("h2",{children:m}),s.jsx("p",{children:h?"Add the details you want on your profile.":"Update the details shown on your profile."})]}),s.jsx("button",{type:"button","aria-label":"Close offering editor",onClick:n,children:s.jsx(as,{})})]}),s.jsxs("fieldset",{className:"ce-offering-editor-kind",children:[s.jsx("legend",{className:"sr-only",children:"Offering type"}),s.jsx("span",{"aria-hidden":"true",children:"Type"}),s.jsx("div",{className:"ce-offering-kind",children:[["product","Shop"],["service","Service"]].map(([b,y])=>s.jsx("button",{type:"button","aria-pressed":a.kind===b,className:a.kind===b?"is-on":"",onClick:()=>{a.kind!==b&&(i(v=>({...v,kind:b,offeringKind:b,action:b==="product"?"buy":"contact",buttonLabel:""})),d(""))},children:y},b))})]}),s.jsxs("div",{className:"ppb-rowcard ppb-product-rowcard",children:[(a.issues||[]).filter(b=>b.blocking!==!1).map(b=>s.jsxs("div",{className:"ce-offering-conflict",children:[s.jsxs("strong",{children:["Check ",b.field==="link"?"destination":b.field]}),s.jsx("p",{children:(b.values||[]).join(" / ")}),(b.sources||[]).map(y=>s.jsx("a",{href:y,target:"_blank",rel:"noreferrer",children:"View source"},y)),s.jsxs("label",{children:[s.jsx("input",{type:"checkbox",checked:a.resolvedIssues.includes(b.id),onChange:y=>{const v=y.target.checked;i(w=>({...w,resolvedIssues:v?[...w.resolvedIssues,b.id]:w.resolvedIssues.filter(j=>j!==b.id)}))}})," I reviewed the conflicting values and confirmed my correction below."]})]},b.id)),s.jsxs("div",{className:"ppb-product-editor",children:[s.jsx("div",{className:"ppb-product-dialog-photo",children:s.jsx(Nne,{img:a.image,index:0,onBusyChange:c,onCfg:b=>{i(y=>{const v={items:[{img:y.image}]},w=typeof b=="function"?b(v):b;return{...y,image:w.items[0].img}})}})}),s.jsxs("div",{className:"ppb-product-fields",children:[s.jsxs("label",{className:"ppb-product-dialog-title",children:["Title",s.jsx("input",{type:"text",value:a.name,maxLength:Vre,onChange:g("name")}
508)]}),s.jsxs("div",{className:"ppb-product-dialog-price",children:[s.jsx("span",{children:"Price"}),s.jsx(Mk,{label:"Offering",value:a.price,onChange:b=>i(y=>({...y,price:b}))})]}),s.jsxs("label",{className:"ce-offering-editor-description",children:["Description",s.jsx("textarea",{rows:2,value:a.description||"",maxLength:500,onChange:g("description")})]}),a.kind==="service"?s.jsxs("label",{className:"ce-offering-editor-action",children:["Action",s.jsxs("select",{value:a.action,onChange:g("action"),children:[s.jsx("option",{value:"contact",children:"Contact me on my profile"}),s.jsx("option",{value:"book",children:"Open booking link"}),s.jsx("option",{value:"inquiry",children:"Open inquiry link"}),s.jsx("option",{value:"buy",children:"Open purchase link"})]})]}):null,p?s.jsxs("label",{className:"ppb-product-dialog-link",children:["Destination link",s.jsx("input",{type:"url",value:a.url,maxLength:2e3,onChange:g("url")})]}):null,s.jsxs("label",{className:"ppb-product-dialog-button-text",children:["Button text",s.jsx("input",{type:"text",value:a.buttonLabel||"",placeholder:a.action==="contact"?"Contact me":a.kind==="service"?"Book":"Buy",maxLength:rf,onChange:g("buttonLabel")})]})]})]}),u?s.jsx("p",{className:"ce-offerings-note is-error",role:"alert",children:u}):null,r?s.jsxs("p",{className:"ce-offerings-note",role:"status",children:["You can add up to ",cc," offerings. Remove one before adding another."]}):null,s.jsxs("div",{className:"ppb-product-dialog-footer",children:[s.jsx(yt,{variant:"secondary",onClick:n,children:"Cancel"}),s.jsx("button",{type:"button",className:"ppb-product-dialog-done",disabled:!a.name.trim()||l||r,onClick:x,children:h?"Add offering":"Done"})]})]})]})})}function jet({row:e,group:t,onMove:n,onRemove:r,onEdit:a,onToggle:i,onOption:o}){return s.jsxs("li",{className:`ce-offering ce-offering-selectable${e.selected?" is-on":""}`,children:[s.jsx("input",{type:"checkbox",className:"ce-offering-check",checked:e.selected,disabled:So(e),onChange:i,"aria-label":`Include ${e.name}`}),s.jsx(wet,{row:e,Icon:t.Icon},e.image),s.jsxs("div",{className:"ce-offering-copy",children:[s.jsx("b",{children:e.name}),So(e)?s.jsxs("small",{className:"ce-offering-review-note",children:["Needs review",e.options.length>1&&!e.selectedOptionId?" · choose billing":" · check conflicting details"]}):null,e.options.length>1?s.jsxs("label",{className:"ce-offering-billing",children:["Billing",s.jsxs("select",{"aria-label":`Billing for ${e.name}`,value:e.selectedOptionId,onChange:l=>o(l.target.value),children:[s.jsx("option",{value:"",children:"Choose a billing option"}),e.options.map(l=>s.jsxs("option",{value:l.id,children:[l.label," · ",l.price]},l.id))]})]}):null,e.description?s.jsx("small",{children:e.description}):null,e.kind==="service"?s.jsx("small",{children:e.action==="contact"?"Contact form":e.buttonLabel||"Book"}):null,e.url?s.jsxs("small",{children:[s.jsx($a,{size:12,"aria-hidden":"true"}),Kre(e.url)]}):null]}),s.jsx("span",{className:`ce-offering-price${e.price?"":e.kind==="service"?" is-inquiry":" is-empty"}`,children:e.price||(e.kind==="service"?"Inquiry":"No price")}),s.jsxs("div",{className:"ce-offering-actions",children:[s.jsxs("div",{className:`ce-offering-kind ce-offering-category${e.kind==="service"?" is-service":""}`,role:"group","aria-label":`Category for ${e.name}`,children:[s.jsx("span",{className:"ce-offering-category-highlight","aria-hidden":"true"}),[["product","Shop"],["service","Service"]].map(([l,c])=>s.jsx("button",{type:"button","aria-pressed":e.kind===l,className:e.kind===l?"is-on":"",onClick:()=>{e.kind!==l&&n()},children:c},l))]}),s.jsx("button",{type:"button",className:"ce-offering-icon",onClick:a,"aria-label":`Edit ${e.name}`,title:"Edit",children:s.jsx(Mu,{size:16,"aria-hidden":"true"})}),s.jsx("button",{type:"button",className:"ce-offering-icon is-danger",onClick:r,"aria-label":`Delete ${e.name}`,title:"Delete",children:s.jsx(Qs,{size:16,"aria-hidden":"true"})})]})]})}const _et={item_limit:"The import reached 100 offerings. Choose which ones to add.",page_limit:"The page budget was reached. These results may not include every offering.",time_limit:"Discovery reached its time limit. You can use the results found so far.",discovery_limit:"Discovery was limited. These results may not include every offering.",stop_failed:"You can keep reviewing. Discovery may still be running; retry stopping it.",importer_updated:"The importer was updated. Your edits are saved. Start a new import to continue discovery.",extraction_incomplete:"The site contains offering information, but extraction was incomplete. Review these results or add missing offerings manually.",some_pages_failed:"Some pages could not be imported. Successful results are available below."},yU={profile:{step:"profile-offerings",steps:void 0,title:s.jsxs(s.Fragment,{children:["Choose your ",s.jsx("em",{className:"ge-em",children:"offerings"})]}),lede:"Select the products and services you want on your profile.",add:e=>`Add ${e} to my profile`,none:"Continue without offerings"},business:{step:"business-offerings",steps:To,title:s.jsxs(s.Fragment,{children:["Your ",s.jsx("em",{className:"ge-em",children:"products & services"})]}),lede:"Pick what your chat can offer.",add:e=>`Add ${e} to my chat`,none:"Continue without any"}};function m5({url:e,extract:t,saving:n=!1,onBack:r,onContinue:a,variant:i="profile"}){const o=yU[i]||yU.profile,[l,c]=f.useState(()=>Nn()),[u,d]=f.useState(null),[h,p]=f.useState(!1),[m,g]=f.useState(null),[x,b]=f.useState(Fg),[y,v]=f.useState(""),[w,j]=f.useState("all"),[E,S]=f.useState(""),[_,k]=f.useState(""),[C,N]=f.useState(""),[A,T]=f.useState(0),I=f.useRef(null),$=f.useRef(null),O=JSON.stringify(e),U=l.status==="loading",F=n||!!_,H=l.rows.filter(Kj).map(Y=>Y.id).join("|");f.useEffect(()=>det(c),[]),f.useEffect(()=>{p5(JSON.parse(O),t)},[O,t]),f.useEffect(()=>{l.reason==="stopping"&&xU(Sb).catch(()=>{})},[l.jobId,l.reason]),f.useEffect(()=>{if(U||!H){N("");return}let Y=!0;return N("loading"),cet(Z_e).then(J=>{Y&&N(J?"failed":"")}
508),()=>{Y=!1}},[U,l.jobId,H,A]);const G=l.rows,M=Yre(G),z=y.trim().toLowerCase(),W=G.filter(Y=>(w==="all"||(w==="review"?So(Y):Y.kind===w))&&`${Y.name} ${Y.description}`.toLowerCase().includes(z)),D=W.slice(0,x),Z=G.filter(Y=>!So(Y)).length,V=Z>0&&M.length===Z;f.useEffect(()=>{const Y=$.current;if(!Y)return;const J=new IntersectionObserver(([P])=>{P.isIntersecting&&(J.disconnect(),b(ee=>Math.min(ee+Fg,W.length)))},{root:I.current,rootMargin:"0px 0px 240px 0px"});return J.observe(Y),()=>J.disconnect()},[W.length,x,y,w]);const L=Y=>c(Eo({rows:Y})),K=Y=>{const J=Nn();J.rows.length>=cc||(L(get(J.rows,Y)),p(!1),v(""),j("all"),b(Fg))},te=async()=>{S("");try{await xU(Sb)}catch(Y){S(Y.response?.data?.detail?.message||"Could not stop the import. Please try again.")}},Q=async()=>{if(S(""),M.some(Kj)){S("Some prices could not be verified. Retry the price check or edit those prices before continuing.");return}if(M.some(Y=>(Y.kind==="product"||Y.action!=="contact")&&!Zr(Y.url))){S("Add a valid destination link to selected shop items and external services, or use the contact form for a service.");return}try{k("Preparing selected offeringsâ¦");const Y=await oK(h5(G),(X,ae)=>k(`Preparing images ${X} of ${ae}â¦`)),J=[...Y.products,...Y.services].filter(X=>!X.image&&M.some(ae=>ae.id===X.id&&ae.image)),P=new Map([...Y.products,...Y.services].map(X=>[X.id,X.image||""])),ee=Nn().rows.map(X=>P.has(X.id)?{...X,image:P.get(X.id)}:X);if(Eo({rows:ee}),J.length){S(`${J.length} image(s) could not be copied. Your offerings are kept. Click Add again to continue without those images.`);return}await a(ee)}catch(Y){S(Y.response?.data?.detail?.message||"Could not prepare these offerings. Your selection is saved; please try again.")}finally{k("")}};return s.jsxs("section",{className:"ce-pre-journey ce-onboarding-screen ce-profile-offerings-screen",children:[s.jsxs("header",{className:"ce-onboarding-header ce-profile-offerings-head",children:[s.jsx(jl,{step:o.step,steps:o.steps}),s.jsx("h1",{children:o.title}),s.jsx("p",{children:o.lede})]}),s.jsx("div",{ref:I,className:"ce-onboarding-content ce-profile-offerings-body",children:s.jsxs("div",{className:"ce-offerings",children:[s.jsxs("div",{className:"ce-offering-toolbar",children:[U?s.jsxs("div",{className:"ce-offerings-bar",children:[s.jsxs("div",{className:"ce-offering-progress",role:"status",children:[s.jsxs("span",{className:"ce-offering-progress-label",children:[s.jsx(vt,{size:14,className:"animate-spin","aria-hidden":"true"})," Finding offerings"]}),s.jsxs("span",{className:"ce-offering-progress-meta",children:[l.progress?.pagesRead||0," pages read ",s.jsx("span",{"aria-hidden":"true",children:"·"})," ",G.length," found"]})]}),l.jobId?s.jsxs("button",{type:"button",className:"ce-offering-btn ce-offering-stop",disabled:F,onClick:te,children:[s.jsx(ku,{size:10,fill:"currentColor","aria-hidden":"true"})," Stop and review"]}):null]}):null,s.jsxs("div",{className:"ce-offering-controls",children:[G.length?s.jsxs("div",{className:"ce-offering-filters",children:[s.jsxs("label",{className:"ce-offering-search",children:[s.jsx(Fa,{size:15,"aria-hidden":"true"}),s.jsx("input",{type:"search","aria-label":"Search offerings",placeholder:"Search offerings",value:y,onChange:Y=>{v(Y.target.value),b(Fg)}})]}),s.jsxs("select",{"aria-label":"Filter offerings",value:w,onChange:Y=>{j(Y.target.value),b(Fg)},children:[s.jsx("option",{value:"all",children:"All offerings"}),s.jsx("option",{value:"product",children:"Shop"}),s.jsx("option",{value:"service",children:"Services"}),s.jsx("option",{value:"review",children:"Needs review"})]})]}):null,s.jsx("div",{className:"ce-offering-selection",children:G.length?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"ce-offering-select-all",children:[s.jsx("input",{type:"checkbox",checked:V,ref:Y=>{Y&&(Y.indeterminate=M.length>0&&!V)},disabled:F||!Z,onChange:Y=>{const J=Y.target.checked;L(Nn().rows.map(P=>({...P,selected:J&&!So(P)})))}}),"Select all ",G.length]}),s.jsxs("span",{className:"ce-offering-selected",role:"status","aria-label":`${M.length} of ${G.length} selected`,children:[M.length," selected"]}),M.length?s.jsx("button",{type:"button",className:"ce-offering-btn ce-offering-clear","aria-label":"Clear selection",disabled:F,onClick:()=>L(Nn().rows.map(Y=>({...Y,selected:!1}))),children:"Clear"}):null]}):null}),s.jsxs("div",{className:"ce-offerings-bar-actions",children:[l.reason==="stop_failed"?s.jsxs("button",{type:"button",className:"ce-offering-btn",disabled:F,onClick:te,children:[s.jsx(_b,{size:14,"aria-hidden":"true"})," Retry stop"]}):null,!U&&l.urls.length>0&&!["stopping","stop_failed"].includes(l.reason)&&["done","error","partial","empty"].includes(l.status)?s.jsxs("button",{type:"button",className:"ce-offering-btn",disabled:F,"aria-label":l.status==="done"?"Refresh offerings":"Try again",onClick:()=>p5(l.urls,t,{force:!0}),children:[s.jsx(_b,{size:14,"aria-hidden":"true"})," ",l.status==="done"?"Refresh":"Try again"]}):null,G.length<cc?s.jsxs("button",{type:"button",className:"ce-offering-btn ce-offering-add-more",disabled:F,onClick:()=>p(!0),children:[s.jsx(Es,{size:15,"aria-hidden":"true"})," Add more"]}):null]})]})]}),l.reason&&!["stopping","stopped"].includes(l.reason)?s.jsx("p",{className:"ce-offerings-note",role:"status",children:_et[l.reason]||"Import finished with some limitations. Review the results below."}):null,(l.errors||[]).map((Y,J)=>s.jsxs("p",{className:"ce-offerings-note is-error",children:[Y.url?`${Kre(Y.url)}: `:"",Y.message]},`${Y.url}-${J}`)),(l.skippedDestinations||[]).length?s.jsxs("details",{className:"ce-offerings-note",children:[s.jsx("summary",{children:"Some external destinations were skipped"}),s.jsx("p",{children:"We could not establish that these pages belong to this business. You can add their offerings manually."}),s.jsx("ul",{children:l.skippedDestinations.map(Y=>s.jsx("li",{children:s.jsx("a",{href:Y,target:"_blank",rel:"noreferrer",children:Y})},Y))})]}):null,E?s.jsx("p",{className:"ce-offerings-note is-error",role:"alert",children:E}):null,C==="loading"?s.jsx("p",{className:"ce-offerings-note",role:"status",children:"Refreshing prices from the sourceâ¦"}):null,C==="failed"?s.jsxs("p",{className:"ce-offerings-note",role:"status",children:["Some prices could not be verified. ",s.jsx("button",{type:"button",className:"ce-offering-btn",onClick:()=>{S(""),T(Y=>Y+1)},children:"Retry price check"})]}):null,G.length?s.jsxs(s.Fragment,{children:[s.jsx("fieldset",{disabled:F,className:"ce-offering-fieldset",children:s.jsx("ul",{className:"ce-offering-list","aria-label":"Offer
508ings",children:D.map(Y=>s.jsx(jet,{row:Y,group:yet.find(J=>J.kind===Y.kind),onToggle:()=>L(het(Nn().rows,Y.id)),onOption:J=>L(xet(Nn().rows,Y.id,J)),onMove:()=>L(pet(Nn().rows,Y.id)),onEdit:()=>d(Y.id),onRemove:()=>g(Y)},Y.id))})}),W.length?null:s.jsx("p",{className:"ce-offerings-note",children:"No matching offerings."}),W.length>D.length?s.jsx("div",{ref:$,className:"ce-offering-more-sentinel","aria-hidden":"true"}):null]}):U?null:s.jsx("p",{className:"ce-offerings-note",children:["error","partial"].includes(l.status)?"We could not confirm offerings from this import. Add an offering manually, try again, or continue and add them later.":"No offerings found. Add an offering manually, try again, or continue and add them later."})]})}),s.jsx("footer",{className:"ce-onboarding-footer ce-profile-offerings-footer",children:s.jsx(Lo,{onBack:()=>{F||r()},onContinue:Q,continueDisabled:U||F||C==="loading",continueLabel:_||(n?"Savingâ¦":M.length?o.add(M.length):o.none)})}),h?s.jsx(bU,{row:vet,limitReached:G.length>=cc,onCancel:()=>p(!1),onSave:K}):null,G.find(Y=>Y.id===u)?s.jsx(bU,{row:G.find(Y=>Y.id===u),onCancel:()=>d(null),onSave:Y=>{L(fet(Nn().rows,u,Y)),d(null)}},u):null,s.jsxs(en,{isOpen:!!m,onClose:()=>g(null),title:"Delete offering?",maxWidth:"max-w-sm",children:[s.jsx("p",{children:m?`â${m.name}â will be removed. You can uncheck it instead to keep it for review.`:""}),s.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[s.jsx(yt,{variant:"secondary",onClick:()=>g(null),children:"Cancel"}),s.jsx(yt,{variant:"danger",onClick:()=>{L(met(Nn().rows,m.id)),g(null)},children:"Delete"})]})]})]})}const ket="great_experts_create_expert",Net=1,jf="preauth_knowledge";function Om(){return new Error("This browser could not save your knowledge before signup. Try again or use a standard browser window.")}function Xre(){return typeof indexedDB>"u"?Promise.reject(Om()):new Promise((e,t)=>{const n=indexedDB.open(ket,Net);n.onupgradeneeded=()=>{const r=n.result;r.objectStoreNames.contains(jf)||r.createObjectStore(jf,{keyPath:"id"})},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error||Om()),n.onblocked=()=>t(Om())})}function Eet(e){const t=e.name||"Knowledge source";return{id:e.id,title:t,name:t,filename:t,source:e.kind==="url"?e.url:t,source_type:e.kind==="url"?"url":"file",word_count:e.wordCount||0,status:"queued",meta:{filename:t,original_filename:t,size:e.size||0}}}async function f5(){const e=await Xre();try{return await new Promise((t,n)=>{const r=e.transaction(jf,"readonly").objectStore(jf).getAll();r.onsuccess=()=>t((r.result||[]).sort((a,i)=>a.createdAt-i.createdAt)),r.onerror=()=>n(r.error||Om())})}finally{e.close()}}async function Cet(){return(await f5()).map(Eet)}async function Tet(e){const t=await Xre();try{await new Promise((n,r)=>{const a=t.transaction(jf,"readwrite");a.objectStore(jf).delete(e),a.oncomplete=()=>n(),a.onerror=()=>r(a.error||Om()),a.onabort=()=>r(a.error||Om())})}finally{t.close()}return Cet()}function Aet(e){return e.kind==="note"?new File([e.text||""],e.name,{type:"text/plain"}):new File([e.blob],e.name,{type:e.type||e.blob?.type||"application/octet-stream",lastModified:e.lastModified||Date.now()})}const Jre=["youtube","tiktok","instagram","facebook","x","linkedin"],Ret=[...Jre,"whatsapp","spotify"];function Iet(e,t){const n=typeof t?.url=="string"?t.url.trim():"";if(n)return n;const r=typeof t?.handle=="string"?t.handle.trim():"";return!r||/connected|channel|profile|account|page/i.test(r)?"":C4(e,r)}function vU(e=[],t={},n={}){const r=new Map;for(const i of Ret){const o=C4(i,t?.[i]);o&&r.set(i,o);const l=Iet(i,n?.[i]);l&&r.set(i,l)}const a=(Array.isArray(e)?e:[]).filter(i=>typeof i=="string"&&!r.has(Gb(i).key));for(const i of r.values())a.includes(i)||a.push(i);return a}function wU(e={}){return Jre.filter(t=>{const n=e?.[t];return n?t!=="x"||!!n.handle:!1})}function Pet(e,{id:t,name:n,tagline:r,avatarUrl:a,greeting:i,starters:o}){return t?{...e||{},id:t,name:String(n||"").trim()||e?.name||"Your expert",tagline:r??e?.tagline??"",avatar_url:a||e?.avatar_url||"",greeting:i??e?.greeting??"",custom_conversation_starters:Array.isArray(o)?o:e?.custom_conversation_starters||[],voice_languages:Array.isArray(e?.voice_languages)?e.voice_languages:[]}:e||null}const Li="wizard_draft_expert_id",jU=5,Let=e=>new Promise(t=>{setTimeout(t,e)}),Oet=45e3,Qre="PUBLISH_TIMEOUT";async function _S(e,t){return t}function Met(e){let t;const n=new Promise((r,a)=>{t=setTimeout(()=>{const i=new Error("Publishing is taking longer than expected. Please try again.");i.code=Qre,a(i)},Oet)});return Promise.race([e,n]).finally(()=>clearTimeout(t))}async function Zre(e,t){for(let n=0;n<300;n+=1){await Let(2e3);const a=(await Xm(e,t)).data;if(a?.status==="completed")return;if(a?.status==="failed")throw new Error(a.error||a.message||"A queued knowledge source could not be processed.")}throw new Error("A queued knowledge source took too long to process. Please try again.")}async function _U(e,t){const n=async(a,i)=>{try{let o;if(a.kind==="url"){const l=await S_(e,a.url,null,i);if(l.status!=="accepted"||!l.data?.job_id)throw new Error("A queued link could not be added to your knowledge.");o=l.data.job_id}else{const l=Aet(a),u=(await Cw(e,[l])).data?.files?.[0];if(u?.status!=="accepted"||!u.job_id)throw new Error(u?.message||`Could not upload ${a.name}.`);o=u.job_id}await Zre(e,o)}catch{}try{await Tet(a.id)}catch{}};for(let a=0;a<t.length;a+=jU){const i=t.slice(a,a+jU);await Promise.all(i.map((o,l)=>n(o,a+l)))}return(await mu(e)).data?.documents||[]}async function Det(e,t){const n=Vb(t);if(!n||((await mu(e)).data?.documents||[]).some(o=>Vb(o?.source)===n))return;const a=/^https?:\/\//i.test(t)?t:`https://${t}`,i=await S_(e,a,null,0);if(i.status!=="accepted"||!i.data?.job_id)throw new Error("Your website could not be read.");await Zre(e,i.data.job_id)}const kU=new Set(["profile-knowledge","profile-voice","profile-identity","templates","profile-ready"]),$et=new Set(["welcome","platforms","profile-knowledge","profile-voice","profile-identity","profile-offerings","templates","profile-building","profile-ready","profile-congratulations","business-chat","business-sources","business-contact","business-knowledge","business-voice","business-offerings","business-building","business-customize","business-congratulations"]),jv="profile-knowledge",kS=(e,t)=>iK(e,t),Fet=new Set(["profile-knowledge","profile-identity","business-knowledge"]),Bet=new Set(["profile-voice","business-voice"]),Uet=new Set([...Bet,"business-customize"]),rm=["youtube","tiktok","instagram","facebook","x","linkedin"],zet=new Set(["whatsapp","spotify"]),NU={name:"",tagline:"",description:"",system_prompt:"",style_directive:"",stance:"",style_examples:"",persona_rules:"",communication_style:"Supporter",is_public:!0,greeting:"",custom_rules:"",answer_detail:50,custom_conversation_starters:[],avatar_file:null,avatar_preview:null,voice:"",voice_preset
508:null,voice_enabled:!1,phone:"",embed_domain:"",enable_leads:!0},eae="Draft expert â description in progress.";function _v(e){return e===eae}function EU(e,t,n){return String(e||"").trim()||String(t||"").trim()||(Qd(n)?"":String(n).trim())}function SU(e){if(!e)return{};if(typeof e=="object")return e;if(typeof e!="string")return{};try{const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function CU(e,t){return Array.from(new Set([...Object.entries(e||{}).filter(([,n])=>!!n).map(([n])=>n),...Object.entries(t||{}).filter(([n,r])=>rm.includes(n)&&!!r).map(([n])=>n)]))}function TU(){const e=Ps(),t=an(),n=new URLSearchParams(t.search),r=n.get("draft"),a=n.get("start"),i=U_(t.search),o=XP(t.search),l=n.get("connected"),c=n.get("connection"),u=n.get("message"),d=n.get("selection"),{createExpert:h,deleteExpert:p,updateExpert:m}=jc(),{addToast:g}=f.useContext(Zs),x=f.useCallback((ce,_e="info")=>{_e!=="success"&&g(ce,_e)},[g]),{user:b,updateUser:y}=Ut(),v=b?.id,w=f.useRef(Su()),j=f.useRef(w.current.voiceCompleted===!0),E=f.useRef(UAe()),[S,_]=f.useState(""),[k,C]=f.useState(()=>w.current.username&&E.current===w.current.username&&(b?.username||b?.slug)!==w.current.username?"saving":"ready"),[N,A]=f.useState({}),[,T]=f.useState(null),[,I]=f.useState({}),[$,O]=f.useState([]),[U,F]=f.useState(null),[H,G]=f.useState(dbe),[M,z]=f.useState(w.current.templateId||""),[W]=f.useState(Oj),[D,Z]=f.useState(W?.templates||lc),[V,L]=f.useState(W?.defaultId||Kx),[K,te]=f.useState(!!W),[Q,Y]=f.useState(()=>ar({})),[J,P]=f.useState(()=>{if(o)return o;if(i||w.current.journey==="business"&&!r){const ce=w.current;return ce.screen==="business-congratulations"?"business-congratulations":ce.screen==="business-customize"?"business-customize":ce.screen==="business-building"?"business-building":ce.screen==="business-offerings"?"business-offerings":ce.screen==="business-voice"?"business-voice":ce.screen==="business-knowledge"?"business-knowledge":ce.screen==="business-contact"?"business-contact":ce.screen==="business-sources"||l&&ce.journey==="business"?"business-sources":"business-chat"}return r?jv:l?"platforms":a==="welcome"?w.current.screen==="templates"&&w.current.username&&!w.current.templateCompleted?"templates":"welcome":a==="platforms"||w.current.screen==="platforms"?"platforms":w.current.completed?w.current.knowledgeCompleted?w.current.voiceCompleted?w.current.identityCompleted?w.current.profileBuilt?"profile-ready":"profile-building":"profile-identity":"profile-voice":"profile-knowledge":w.current.screen==="profile-knowledge"?"profile-knowledge":w.current.screen==="profile-offerings"&&w.current.identityCompleted?"profile-offerings":w.current.knowledgeCompleted&&!w.current.voiceCompleted?"profile-voice":w.current.voiceCompleted&&!w.current.identityCompleted?"profile-identity":w.current.screen==="templates"&&w.current.knowledgeCompleted&&w.current.voiceCompleted&&w.current.testCompleted?"templates":"platforms"}),[ee,X]=f.useState(null),[ae,me]=f.useState(!1);f.useEffect(()=>{if(J!=="business-contact"||ee!==null||!v)return;let ce=!1;return $r().then(_e=>{if(ce)return;const Te=Kb(_e?.config);X({...Te,email:Te.email||b?.email||""})}).catch(()=>{ce||X({email:b?.email||""})}),()=>{ce=!0}},[J,ee,v,b?.email]);const[q,he]=f.useState(()=>w.current.publicationConsentAccepted?{...NU,consent:{authorship:!0,derivative_works:!0,no_third_party:!0}}:NU),[se,le]=f.useState({}),[ke,oe]=f.useState(()=>({name:b?.full_name||"",bio:b?.bio||"",avatarUrl:b?.avatar_url&&!b.avatar_url.includes("api.dicebear.com")?b.avatar_url:ret(),avatarPreview:"",avatarFile:null})),[Oe,Je]=f.useState(()=>w.current.completed?sessionStorage.getItem(Li):null),[,Ie]=f.useState(null),[ue,be]=f.useState([]),[Re,Ge]=f.useState(!1),[it,ut]=f.useState(!1),[$t,tt]=f.useState(!1),[He,wt]=f.useState(""),[St,Zt]=f.useState(null),[Jt,$e]=f.useState(!1),[Qe,ct]=f.useState(null),[ve,Ye]=f.useState(""),[rt,De]=f.useState(0),[qe,ye]=f.useState(""),Ze=!1,[jt,Nt]=f.useState(!1),ne=f.useRef(null),[ge,xe]=f.useState(0),[pe,Ne]=f.useState("site"),[Ue,dt]=f.useState(""),[Xe,xt]=f.useState(0),[et,st]=f.useState(!1),_t=f.useRef({attempt:-1,promise:null}),[zt,us]=f.useState(ts.IDENTITY),[ms,We]=f.useState(!1),[Dt,Ds]=f.useState(null),[Ys,Ks]=f.useState(!!r&&!i);Bre(J),f.useEffect(()=>{J==="profile-congratulations"&&f5e()},[J]);const is=f.useRef(!1),es=f.useRef(null),Fs=f.useRef({}),fn=f.useRef(new Set),Gn=f.useRef(null),Xs=f.useRef(null),fs=f.useRef({connectedReturn:l,resumeDraftId:r}),Lt=f.useRef(!1),yr=f.useRef(!1),ta=f.useRef([]),Js=f.useRef(!1),vr=f.useRef(null),er=f.useRef(null),Ha=f.useRef(null),to=f.useRef(null),Ec=f.useRef(null),ii=f.useRef({attempt:-1,promise:null}),pt=f.useRef({key:"",promise:null}),Ot=f.useRef(null),Hs=f.useRef(null),vn=f.useRef(Promise.resolve()),on=f.useRef(new Map),$n=f.useRef(Promise.resolve()),oi=f.useRef(Promise.resolve()),Pe=f.useRef(H),At=f.useRef(new Set),ds=f.useRef({}),Bs=f.useRef(Q.socials||[]),qs=f.useRef(Q),Ce=f.useRef(!1),kt=Jt||ue.length>0,Kt=kt;f.useEffect(()=>{$et.has(J)||P(jv)},[J]),es.current=Oe,Fs.current=N,Pe.current=H,ta.current=ue,Js.current=kt,yr.current=Kt,f.useEffect(()=>(Lt.current=!1,()=>{Lt.current=!0}),[]),f.useEffect(()=>{let ce=!0;if(!v)return Z(lc),L(Kx),te(!0),()=>{ce=!1};const _e=Oj();return _e?(Z(_e.templates),L(_e.defaultId),te(!0),()=>{ce=!1}):(te(!1),G0().then(Te=>{ce&&(Z(Te.templates),L(Te.defaultId))}).catch(()=>{ce&&(Z(lc),L(Kx))}).finally(()=>{ce&&te(!0)}),()=>{ce=!1})},[v]),f.useEffect(()=>{const ce=w.current.username;if(!v||!ce||(b?.username||b?.slug)===ce){C("ready");return}if(E.current!==ce){w.current=Pt({username:""}),C("ready");return}Ot.current!==ce&&(Ot.current=ce,C("saving"),ch({username:ce}).then(_e=>{if(Lt.current)return;const Te=_e.data?.user?.username||_e.data?.user?.slug||ce;y?.({username:Te}),C("ready")}
508).catch(_e=>{if(Lt.current)return;const Te=_e?.response?.data?.detail,Ve=typeof Te=="object"?String(Te?.code||""):"";if(C("ready"),!Ve.startsWith("SLUG_")){Ot.current=null,x("We could not save your profile link just now. It will be saved automatically before your profile goes live.","error");return}nf(),E.current="",w.current=Pt({screen:"welcome"}),_(ce),P("welcome")}))},[x,y,b?.username,b?.slug,v]);const Et=f.useCallback(async(ce,{silent:_e=!1,keepScreen:Te=!1,isCancelled:Ve=()=>!1}={})=>{const ot=()=>Lt.current||Ve(),Yt=()=>{sessionStorage.getItem(Li)===ce&&sessionStorage.removeItem(Li)};try{const Mt=await cu(ce);if(ot())return null;const It=Mt.data?.expert;if(!It||It.status!=="draft")return _e?Yt():(x("That draft is no longer available.","error"),e("/lab/experts")),Ks(!1),null;const ss=_v(It.description)?"":It.description||"",Vt=SU(It.draft_data),gs=Vt.screen==="profile-test"?"profile-identity":Vt.screen,gn=kU.has(gs)?gs:jv;Je(It.id),es.current=It.id,Ie(It.slug||null),$e(!0),Te||P(o||gn),he(Wa=>({...Wa,name:Qd(It.name)?"":It.name,tagline:Vt.tagline??It.tagline??"",description:Vt.description??ss,system_prompt:Vt.system_prompt??It.system_prompt??"",custom_rules:Vt.custom_rules??Vt.system_prompt??It.system_prompt??"",answer_detail:Vt.answer_detail??50,communication_style:Vt.communication_style??It.communication_style??"Supporter",greeting:Vt.greeting??It.greeting??"",custom_conversation_starters:Vt.custom_conversation_starters??It.custom_conversation_starters??[],avatar_url:It.avatar_url||"",is_public:Vt.is_public??!!It.is_public,voice:Object.hasOwn(Vt,"voice")?Vt.voice:Wa.voice,voice_preset:Object.hasOwn(Vt,"voice_preset")?Vt.voice_preset:Wa.voice_preset,voice_enabled:Object.hasOwn(Vt,"voice_enabled")?!!Vt.voice_enabled:Wa.voice_enabled,phone:Vt.phone??"",embed_domain:Vt.embed_domain??"",consent:Vt.consent??Wa.consent})),Vt.platformHandles&&typeof Vt.platformHandles=="object"&&(G(Vt.platformHandles),fN(Vt.platformHandles));try{const Wa=await mu(It.id);ot()||be(Wa?.data?.documents||[])}catch{}return sessionStorage.setItem(Li,It.id),o&&Ds(It),Ks(!1),It.id}catch{return ot()||(_e?Yt():(x("Could not load draft.","error"),e("/lab/experts"))),Ks(!1),null}},[x,o,e,be]);f.useEffect(()=>{if(!r||i)return;let ce=!1;return Et(r,{isCancelled:()=>ce}),()=>{ce=!0}},[i,Et,r]),f.useEffect(()=>{const{connectedReturn:ce,resumeDraftId:_e}=fs.current;if(!b||!ce||_e)return;const Te=sessionStorage.getItem(Li);if(!Te)return;let Ve=!1;return Xs.current=Et(Te,{silent:!0,keepScreen:!0,isCancelled:()=>Ve}),()=>{Ve=!0}},[Et,b]),f.useEffect(()=>{ue.length>0&&$e(!0)},[ue.length]),f.useEffect(()=>{let ce=!1;const _e=$r();return Hs.current=_e,_e.then(Te=>{if(ce)return;const Ve=Te?.enabled!==!1,ot=ar(Te?.config??{});qs.current=ot,Bs.current=ot.socials||[],Ce.current=!0,Y(ot),Ec.current=Ve,he(Yt=>({...Yt,enable_leads:Ve}))}).catch(()=>{}),()=>{ce=!0}},[]),f.useEffect(()=>{Eu().then(ce=>ct(ce.data)).catch(()=>ct({active:!1,unlimited:!1}))},[]),f.useEffect(()=>()=>{const ce=Js.current||ta.current.length>0;is.current||ce||!es.current||(p(es.current).catch(()=>{}).finally(Uc),sessionStorage.removeItem(Li))},[p]),f.useEffect(()=>{const ce=_e=>{if(!yr.current||is.current)return;const Te=_e.target.closest("a");if(!Te||Te.target==="_blank")return;const Ve=Te.getAttribute("href");!Ve||Ve===t.pathname||(Ve.startsWith("/")||Ve.startsWith(window.location.origin))&&(_e.preventDefault(),_e.stopPropagation(),Zt(Ve),ut(!0))};return document.addEventListener("click",ce,!0),()=>document.removeEventListener("click",ce,!0)},[t.pathname]),f.useEffect(()=>{if(is.current||!Kt)return;const ce=()=>{!yr.current||is.current||(window.history.pushState(null,"",t.pathname),Zt(Me.DASHBOARD),ut(!0))};return window.history.pushState(null,"",t.pathname),window.addEventListener("popstate",ce),()=>window.removeEventListener("popstate",ce)},[t.pathname,Kt]),f.useEffect(()=>{const ce=_e=>{if(Kt)return _e.preventDefault(),_e.returnValue="",""};return window.addEventListener("beforeunload",ce),()=>window.removeEventListener("beforeunload",ce)},[Kt]);const Ft=()=>{ut(!1),Zt(null)},js=f.useCallback(async({requireSuccess:ce=!1,identity:_e=null}={})=>{const Te=es.current;if(!Te||is.current)return null;const Ve=String(_e?.name??q.name??"").trim(),ot=String(_e?.greeting??q.greeting??"").trim(),Yt=String(_e?.tagline??q.tagline??"").trim();let Mt=String(_e?.description??q.description??"").trim();(!Mt||_v(Mt))&&(Mt=Yt),Mt&&Mt.length<10&&(Mt=`${Mt} â built from connected channels.`.slice(0,2e3));const It={screen:kU.has(J)?J:jv,name:Ve,tagline:Yt,description:Mt||q.description||"",system_prompt:q.system_prompt||"",custom_rules:q.custom_rules||"",answer_detail:Number.isFinite(q.answer_detail)?q.answer_detail:50,communication_style:q.communication_style||"Supp
508orter",greeting:ot,custom_conversation_starters:q.custom_conversation_starters||[],is_public:!!q.is_public,voice:q.voice||"",voice_preset:q.voice_preset||null,voice_enabled:!!q.voice_enabled,phone:q.phone||"",embed_domain:q.embed_domain||"",consent:q.consent||{},platformHandles:H};if(!Ve||Ve.length<2||Qd(Ve)){if(ce)throw new Error("Add a real expert name before publishing.");try{await a1(Te,{draft_data:It}),Uc()}catch{}return null}const ss={name:Ve,tagline:Yt.slice(0,150),communication_style:q.communication_style||"Supporter",greeting:ot||null,...Array.isArray(q.custom_conversation_starters)?{custom_conversation_starters:q.custom_conversation_starters}:{},voice:q.voice||"female",...q.voice_preset?{voice_preset:q.voice_preset}:{},...q.style_directive?{style_directive:q.style_directive,stance:q.stance||"",style_examples:q.style_examples||"",persona_rules:q.persona_rules||""}:{},draft_data:It};Mt&&Mt.length>=10&&(ss.description=Mt),q.system_prompt!=null&&(ss.system_prompt=q.system_prompt||"");try{const gs=(await a1(Te,ss)).data?.expert;return gs?.slug&&Ie(gs.slug),Uc(),gs||null}catch(Vt){if(ce)throw Vt;return null}},[J,q.name,q.custom_rules,q.answer_detail,q.tagline,q.communication_style,q.greeting,q.custom_conversation_starters,q.description,q.system_prompt,q.style_directive,q.stance,q.style_examples,q.persona_rules,q.is_public,q.voice,q.voice_preset,q.phone,q.embed_domain,q.consent,H]),Fn=f.useCallback(async()=>{if(ut(!1),Js.current||ta.current.length>0)await js();else if(es.current){try{await p(es.current)}catch{}Uc()}is.current=!0,sessionStorage.removeItem(Li),St&&e(St),Zt(null)},[p,e,St,js]),Ea=async ce=>{const _e=es.current,Te=Fs.current.x?.handle;let Ve;ce==="youtube"?Ve=await kbe(_e):ce==="tiktok"?Ve=await Ebe(_e):ce==="instagram"?Ve=await Sbe(_e):ce==="facebook"?Ve=await Cbe(_e):ce==="linkedin"?Ve=await Nbe(_e):Ve=await _be(_e,Te);const ot=Ve?.data?.job_id;if(!ot)throw new Error("missing job id");return ot},Cn=f.useCallback(async ce=>{const _e=ce?.author,Te=ce?.persona;let Ve={};try{Ve=(await cu(es.current)).data?.expert||{}}catch{}Lt.current||he(ot=>{const Yt=b?.full_name||_e?.name||Ve.name||"",Mt=Qd(ot.name)?Yt||ot.name:ot.name||Yt,It=Ve.avatar_url&&!Ve.avatar_url.includes("api.dicebear.com")?Ve.avatar_url:ot.avatar_url||"";return{...ot,name:Mt,tagline:ot.tagline||Te?.tagline||Ve.tagline||"",description:_v(ot.description)||!ot.description?Ve.description&&!_v(Ve.description)?Ve.description:_e?.bio||Te?.tagline||ot.description||"":ot.description,avatar_url:It,communication_style:Te?.communication_style||Ve.communication_style||ot.communication_style,system_prompt:Ve.system_prompt??ot.system_prompt,greeting:Ve.greeting??ot.greeting,style_directive:Ve.style_directive??Te?.style_directive??ot.style_directive,stance:Ve.stance??Te?.stance??ot.stance,style_examples:Ve.style_examples??(Te?.style_examples||[]).join(` 509`)??ot.style_examples,persona_rules:Ve.persona_rules??(Te?.persona_rules||[]).join(` 510`)??ot.persona_rules}})},[b?.full_name]),Yn=f.useRef({key:l,result:c,message:u,selection:d});f.useEffect(()=>{if(!b)return;let ce=!1;return(async()=>{const{key:_e,result:Te,message:Ve,selection:ot}=Yn.current;try{if(_e&&Te==="error"){const gs=nu.find(gn=>gn.key===_e)?.name||_e;throw new Error(Ve||`Could not verify ${gs}.`)}let Yt=!1;if(_e==="facebook")if(Te==="choose"){if(!ot)throw new Error("The Facebook Page selection could not be verified.");const gs=await fbe(ot),gn=gs.pages||[];if(gn.length===0)throw new Error("No Facebook Pages were found. Make sure this account has Page access.");Yt=!0,F(gs.selection_id||ot),O(gn)}else F(null),O([]);_e==="youtube"&&await xbe(),_e==="linkedin"&&await bbe();const Mt=await Nd();if(ce||(Fs.current=Mt,A(Mt),T(gs=>_e&&rm.includes(_e)&&Mt[_e]?_e:gs&&Mt[gs]?gs:rm.find(gn=>Mt[gn])||null),!_e))return;Yn.current={key:null,result:null,message:null,selection:null};const It=nu.find(gs=>gs.key===_e)?.name||_e,ss=Pe.current[_e],Vt=Mt[_e];if(Vt?.oauthHandle&&ss)x(cbe(It,ss,Vt.oauthHandle),"error");else if(Yt)x("Facebook verified. Choose the Page you want to use.","success");else if(Vt){if(x(_e==="facebook"&&Vt.name?`Facebook Page ${Vt.name} connected.`:`${It} verified.`,"success"),rm.includes(_e)&&!ss){if(Xs.current&&await Xs.current,ce)return;Gn.current?.(_e,Mt)}}else x(`Couldn't connect ${It}. Please try again.`,"error");e(t.pathname,{replace:!0})}catch(Yt){if(!ce){Yn.current={key:null,result:null,message:null,selection:null};try{const Mt=await Nd();ce||(Fs.current=Mt,A(Mt))}catch{}x(ui(Yt,"Could not load your connected channels."),"error"),e(t.pathname,{replace:!0})}}})(),()=>{ce=!0}},[b,x,e,t.pathname]);const Rr=J==="templates"&&!Oe&&!r&&!w.current.completed&&!w.current.knowledgeCompleted&&!w.current.voiceCompleted,tr=ce=>{z(ce.id),Rr&&(w.current=Pt({screen:"templates",templateId:ce.id,templateCompleted:!1}));const _e=qs.current;Y(ar({..._e,...JA(_e,ce)}))},$s=(ce,_e,Te=_e)=>(G(Ve=>{const ot={...Ve};return _e?ot[ce]=_e:delete ot[ce],fN(ot),ot}),vn.current=vn.current.catch(()=>{}).then(async()=>{const Ve=Hs.current||$r();Hs.current=Ve;const ot=await Ve;if(!Ce.current){const ss=ar(ot?.config??{});Bs.current=ss.socials||[],Ce.current=!0}const Yt=Bs.current.filter(ss=>Gb(ss).key!==ce),Mt=_e?C4(ce,Te):"";
510if(Mt&&Yt.push(Mt),Bs.current=Yt,Lt.current||Y(ss=>ar({...ss,socials:Yt})),await Xl({config:{socials:Yt}}),on.current.delete(ce),!_e||zet.has(ce))return;At.current.delete(ce),fn.current.delete(ce),delete ds.current[ce],await ybe(ce,Te);const It=await Nd();Fs.current=It,Lt.current||A(It),Gn.current?.(ce,It)}).catch(Ve=>{on.current.set(ce,Ve),!Lt.current&&x(Ve?.response?.data?.detail?.message||Ve?.message||"Your username is saved on this device, but could not be synced yet.","error")}),vn.current),Sa=async ce=>{const _e=Pt({additionalLinks:ce});w.current=_e;const Te=Nn();Te.urls.some(Ve=>!_e.additionalLinks.includes(Ve))&&(Te.jobId&&Te.status==="loading"&&await Sb(Te.jobId),await gU())},wr=ce=>p5(ce,kS),sg=async ce=>{try{await mbe(ce)}catch(_e){throw x(_e?.message||"Could not start verification. Please try again.","error"),_e}},Oo=async ce=>{try{await DG(ce);const _e=nu.find(Ve=>Ve.key===ce)?.accounts||[ce],Te={...N};_e.forEach(Ve=>delete Te[Ve]),Fs.current=Te,A(Te),T(Ve=>_e.includes(Ve)?rm.find(ot=>Te[ot])||null:Ve)}catch(_e){x(_e?.message||"Could not disconnect that account.","error")}},qa=async ce=>{try{if(!U)throw new Error("The Facebook Page selection expired. Please connect again.");await gbe(ce,U);const _e=await Nd();Fs.current=_e,A(_e),O([]),F(null);const Te=_e.facebook?.name;x(Te?`Facebook Page ${Te} connected.`:"Facebook Page connected.","success"),Xs.current&&await Xs.current,Pe.current.facebook||Gn.current?.("facebook",_e),P(Ve=>Ve==="business-sources"?Ve:"platforms")}catch(_e){throw x(ui(_e,"Could not connect that Facebook Page."),"error"),_e}},cp=f.useCallback((ce,_e)=>{he(Te=>({...Te,[ce]:_e})),le(Te=>{const Ve={...Te};return delete Ve[ce],Ve})},[]),Yu=f.useCallback(async(ce,_e)=>{if(!ce||!_e)return"";if(Ha.current===_e&&to.current)return to.current;Ha.current=_e;const Te=T4(ce,_e).then(Ve=>{const ot=Ve.data?.avatar_url||Ve.data?.expert?.avatar_url;if(!ot)throw new Error("The avatar upload did not return an image URL.");return he(Yt=>Yt.avatar_file!==_e?Yt:{...Yt,avatar_file:null,avatar_preview:null,avatar_url:ot}),ot}).catch(Ve=>{throw Ha.current===_e&&(Ha.current=null,to.current=null),Ve});return to.current=Te,Te},[]);f.useEffect(()=>{if(!(!Oe||!kt||is.current))return er.current&&clearTimeout(er.current),er.current=setTimeout(()=>{js()},800),()=>{er.current&&clearTimeout(er.current)}},[Oe,kt,js]),f.useEffect(()=>{!Oe||!kt||!q.avatar_file||is.current||Yu(Oe,q.avatar_file).catch(()=>{})},[Oe,kt,q.avatar_file,Yu]),f.useEffect(()=>{Oe&&Ds(ce=>Pet(ce,{id:Oe,name:q.name,tagline:q.tagline||"",avatarUrl:q.avatar_preview||q.avatar_url,greeting:q.greeting,starters:q.custom_conversation_starters}))},[q.avatar_preview,q.avatar_url,q.custom_conversation_starters,q.greeting,q.name,q.tagline,Oe]),f.useEffect(()=>{o||!J||lh(`create_step:${J}`,"ge_create_expert_step",{step_name:J})},[J,o]);const sa=f.useCallback(async()=>es.current?es.current:(vr.current||(vr.current=(async()=>{try{const ce=q.name?.trim()||"",_e=q.tagline?.trim()||"",Te=await h({name:ce,tagline:_e,description:q.description?.trim()||eae,status:"draft"});return Je(Te.id),es.current=Te.id,Ie(Te.slug||null),he(Ve=>({...Ve,avatar_url:Te.avatar_url||""})),sessionStorage.setItem(Li,Te.id),Uc(),o||lh(`expert_created:${Te.id}`,"ge_expert_created",{expert_id:Te.id}),(ce||_e)&&$e(!0),Te.id}catch(ce){return le({name:ui(ce,"Failed to create expert.")}),null}finally{vr.current=null}})()),vr.current),[h,q.name,q.tagline,q.description,o]);f.useEffect(()=>{!Oe||!Fet.has(J)||bS(Oe)},[Oe,J]),f.useEffect(()=>{if(!Uet.has(J)||Oe)return;let ce=!1;return Ye(""),(async()=>{const Te=sessionStorage.getItem(Li);if(Te){try{const ot=(await cu(Te)).data?.expert;if(!ce&&ot?.status==="draft"){const Yt=SU(ot.draft_data);bS(ot.id),Je(ot.id),es.current=ot.id,Ie(ot.slug||null),$e(!0),he(Mt=>({...Mt,voice:Object.hasOwn(Yt,"voice")?Yt.voice:Mt.voice,voice_preset:Object.hasOwn(Yt,"voice_preset")?Yt.voice_preset:Mt.voice_preset}));return}}catch{}sessionStorage.removeItem(Li)}const Ve=await sa();if(!ce){if(!Ve)throw new Error("We could not prepare voice setup. Please try again.");bS(Ve),$e(!0)}})().catch(Te=>{ce||Ye(Te?.message||"We could not prepare voice setup. Please try again.")}),()=>{ce=!0}}
510,[sa,Oe,rt,J]);const a2=async(ce,_e,Te)=>{const Ve=nu.find(Yt=>Yt.key===Te);let ot=!1;for(let Yt=0;Yt<90;Yt+=1){if(await new Promise(ss=>{setTimeout(ss,2e3)}),Lt.current)return;const Mt=(await Xm(ce,_e)).data||{};if(Lt.current)return;if(Mt.status==="failed"){x(Mt.message||"The import failed. Please try again.","error"),At.current.delete(Te),delete ds.current[Te];return}if(Mt.status==="completed"||Mt.result?.seed_ready){if(!ot){if(ot=!0,At.current.add(Te),await Cn(Mt.result),Lt.current)return;const ss=await mu(ce);if(Lt.current)return;be(ss.data?.documents||[]),x(`Your ${Ve?.name||Te} content is in.`,"success")}if(Mt.status==="completed"){delete ds.current[Te],Lt.current||I(ss=>{const Vt={...ss};return delete Vt[Te],Vt});return}noe(ce,_e,Te);return}}x("The import is taking longer than usual. New sources will appear here when they land.","error")},noe=async(ce,_e,Te)=>{for(let Ve=0;Ve<180;Ve+=1){if(await new Promise(ot=>{setTimeout(ot,2e3)}),Lt.current)return;try{const ot=(await Xm(ce,_e)).data||{};if(ot.status==="failed")return;if(ot.status!=="completed")continue;await Cn(ot.result);const Yt=await mu(ce);Lt.current||be(Yt.data?.documents||[]),delete ds.current[Te],Lt.current||I(Mt=>{const It={...Mt};return delete It[Te],It});return}catch{return}}},roe=async(ce,_e=null)=>{if(Lt.current)return;const Te=_e||Fs.current,Yt=(nu.find(It=>It.key===ce)?.accounts||[ce]).some(It=>Te[It]);if(!rm.includes(ce)||!Yt||ce==="x"&&!Te.x?.handle||At.current.has(ce))return;const Mt=ds.current[ce];if(Mt){const It=es.current||await sa();if(!It||Lt.current)return;await a2(It,Mt,ce);return}if(fn.current.has(ce)){for(let Vt=0;Vt<50;Vt+=1){if(await new Promise(gs=>{setTimeout(gs,200)}),Lt.current||At.current.has(ce))return;if(ds.current[ce])break}const It=ds.current[ce],ss=es.current;It&&ss&&await a2(ss,It,ce);return}fn.current.add(ce);try{const It=await sa();if(!It||Lt.current)return;$e(!0),Fs.current=Te;const ss=await Ea(ce),Vt=async()=>{if(Lt.current)return;const gs=await $r();if(Lt.current||!gs?.config)return;const gn=ar(gs.config);qs.current=gn,Y(gn)};if(mAe(It,ss,v,Vt).then(Vt).catch(()=>{}),Lt.current)return;ds.current[ce]=ss,I(gs=>({...gs,[ce]:{jobId:ss}})),await a2(It,ss,ce)}catch(It){Lt.current||x(ui(It,"Could not start the import. Please try again."),"error")}finally{fn.current.delete(ce)}};Gn.current=roe,f.useEffect(()=>{const ce=w.current;if(!v||J!=="profile-building"||!ce.completed||qe&&ii.current.attempt===ge)return;let _e=!1;if(ii.current.attempt!==ge){const Te=async()=>{const Ve=cr=>new Promise(dp=>{setTimeout(dp,cr)}),ot=cr=>{Lt.current||us(cr)};if(We(!1),ot(ts.IDENTITY),es.current&&ne.current){const cr=ne.current;FA(`uploads:${es.current}`,{expertId:es.current,userId:v},()=>cr.waitForCompletion())}if(await Promise.all([vn.current,$n.current,oi.current]),on.current.size)throw new Error("Some social accounts could not be saved. Return to your accounts and try again.");const Yt=Nd().catch(()=>Fs.current),Mt=$r(),It=ce.username&&E.current===ce.username&&ce.username!==(b?.username||b?.slug)?ch({username:ce.username}):Promise.resolve(null),[ss,Vt]=await Promise.all([Yt,Mt,Ve(480)]);Fs.current=ss||{},Lt.current||A(ss||{}),ot(ts.APPEARANCE);const gs=ar(Vt?.config??{}),gn=eYe(ce.templateId,D),Wa=gn?JA(gs,gn):{},kl=vU(gs.socials,H,ss),{services:Va,items:up}=y7(gs.services,gs.items,h5(Nn().rows)),xoe={...gs,...Wa,socials:kl,services:Va,items:up},[[u2,FL]]=await Promise.all([Promise.allSettled([It,Xl({config:{...Wa,socials:kl,services:Va,items:up}})]),Ve(520)]);if(FL.status==="rejected")throw FL.reason;if(u2.status==="rejected"&&!Lt.current&&x(u2.reason?.response?.data?.detail?.message||u2.reason?.message||"Your profile link could not be saved. You can choose another later.","error"),!Lt.current){const cr=ar(xoe);qs.current=cr,Y(cr),gn&&z(gn.id)}ot(ts.CONNECTIONS),await Ve(420),ot(ts.CONTENT);const BL=wU(ss),d2=await f5(),boe=d2.length?(async()=>{const cr=es.current||await sa();if(!cr)throw new Error("We could not create your knowledge base. Please try again.");const dp=await _U(cr,d2);Lt.current||(be(dp),$e(!0))})():Promise.resolve(),UL=BL.map(cr=>Gn.current?.(cr,ss));if(d2.length){const cr=es.current;FA(`legacy:${cr}`,{expertId:cr,userId:v},async()=>{await boe,await $T(cr)})}if(UL.length&&await Promise.race([Promise.race(UL),Ve(4e3)]),ot(ts.FINALIZING),es.current){const cr=await Tbe(es.current);if(cr?.config&&!Lt.current){const dp=ar(cr.config);qs.current=dp,Y(dp)}}return await Ve(620),{linked:ss,importSources:BL,openEditor:xQ(gn)}};ii.current={attempt:ge,promise:Te()}}return ye(""),Nt(!1),ii.current.promise.then(async()=>
510{if(_e||Lt.current)return;us(ts.PUBLISHING);const Te="profile-ready",Ve=Pt({screen:Te,profileBuilt:!0});w.current=Ve,P(Te)}).catch(Te=>{_e||Lt.current||(Nt(Te?.code==="KNOWLEDGE_NOT_READY"),ye(ui(Te,"We could not finish your profile. Please try again.")))}),()=>{_e=!0}},[x,sa,H,ge,qe,D,J,b?.username,b?.slug,v]),f.useEffect(()=>{if(!v||J!=="business-building")return;let ce=!1;if(_t.current.attempt!==Xe){const _e=async()=>{const Te=Va=>new Promise(up=>{setTimeout(up,Va)}),Ve=(Va,up)=>Promise.race([Promise.resolve(Va).catch(()=>{}),Te(up)]),ot=Va=>{Lt.current||Ne(Va)};ot("site");const Yt=es.current||await sa();if(!Yt)throw new Error("We could not create your chat. Please try again.");$e(!0);const Mt=w.current.additionalLinks?.[0]||"",It=Mt?Det(Yt,Mt):Promise.resolve(),ss=await Nd().catch(()=>Fs.current);Fs.current=ss||{};const Vt=wU(ss||{}).map(Va=>Gn.current?.(Va,ss));await Promise.all([Ve(It,6e4),Vt.length?Ve(Promise.race(Vt),4e3):null,Te(1200)]),ot("knowledge");const gs=await f5(),gn=gs.length?_U(Yt,gs).then(Va=>{Lt.current||be(Va)}):Promise.resolve(),Wa=ne.current?.waitForCompletion?.();await Promise.all([Ve(Promise.all([gn,Wa]),45e3),Te(1200)]),Promise.all([It,gn]).catch(()=>{}).then(()=>$T(Yt)).catch(()=>{}),ot("voice"),await Promise.all([Ve($n.current,15e3),Ve(vn.current,15e3)]);const kl=w.current.widget?.name||oA(Mt);kl&&await m(Yt,{name:kl}).catch(()=>{}),await Te(900)};_t.current={attempt:Xe,promise:_e()}}return dt(""),_t.current.promise.then(()=>{!ce&&!Lt.current&&Ne("ready")}).catch(_e=>{ce||Lt.current||dt(ui(_e,"We could not build your chat. Please try again."))}),()=>{ce=!0}},[Xe,sa,J,m,v]);const aoe=async({widget:ce})=>{if(et)return;const _e=Df(ce);if(!l2){w.current=Pt({widget:_e,screen:"business-knowledge",journey:"business"}),P("business-knowledge"),x("Please confirm the knowledge terms before going live.","error");return}w.current=Pt({widget:_e,journey:"business"}),st(!0);try{const Te=es.current||await sa();if(!Te)throw new Error("We could not find your chat. Please try again.");await c2().catch(()=>null);const Ve=q.avatar_file?await Yu(Te,q.avatar_file):q.avatar_url,ot=w.current.additionalLinks?.[0]||"";await m(Te,{name:_e.name.trim()||oA(ot)||void 0,greeting:_e.greeting.trim()||v0});let Yt=null;const{domain:Mt,error:It}=Pj(ot);if(It)Yt={keyId:"",domain:"",serving:!1,error:"Add your website to get your code."};else try{const Vt=(await x0(Te,Mt,z_e(_e,w.current.embedMode,!!Ve))).data||{};Yt={keyId:Vt.key_id||"",domain:Vt.domain||Mt,serving:!!Vt.serving,error:""}}catch(ss){const Vt=ss?.response?.data?.detail;if(Vt?.code!=="PLAN_LIMIT")throw ss;Yt={keyId:"",domain:Mt,serving:!1,error:Vt.message}}await gc({consentType:"expert_submission",tosVersion:n$,expertId:Te,checkboxStates:{authorship:!0,derivative_works:!0,no_third_party:!0}}),is.current=!0,await m(Te,{status:"active",draft_data:{}}),sessionStorage.removeItem(Li),Uc(),await mke(v,Te).catch(()=>{}),w.current=Pt({screen:"business-congratulations",journey:"business",embed:{...Yt,expertId:Te}}),P("business-congratulations")}catch(Te){is.current=!1,x(ui(Te,"We could not save your chat. Please try again."),"error")}finally{Lt.current||st(!1)}},_L=(ce,_e)=>{$e(!0),cp(ce,_e)},_l=f.useCallback((ce,_e={})=>{const Te=Pt({screen:ce,..._e});w.current=Te,P(ce)},[]),kL=f.useCallback(()=>{const ce=Pt({screen:"profile-knowledge",completed:!1,knowledgeCompleted:!1,knowledgeSkipped:!1,publicationConsentAccepted:!1,voiceCompleted:!1,identityCompleted:!1,profileBuilt:!1,testCompleted:!1});w.current=ce,P("profile-knowledge")},[]),NL=f.useCallback(()=>{tt(!0)},[]),EL=f.useCallback(ce=>{if(tt(!1),ce){kL();return}const _e=Pt({screen:"profile-voice",completed:!1,knowledgeCompleted:!0,knowledgeSkipped:!0,publicationConsentAccepted:!1,voiceCompleted:!1,identityCompleted:!1,profileBuilt:!1,testCompleted:!1});w.current=_e,P("profile-voice")},[kL]),ioe=f.useCallback(()=>{if(w.current.knowledgeSkipped){const ce=Pt({screen:"platforms",voiceCompleted:!1,identityCompleted:!1,testCompleted:!1,completed:!1,profileBuilt:!1});w.current=ce,P("platforms"),tt(!0);return}_l("profile-knowledge",{voiceCompleted:!1,identityCompleted:!1,testCompleted:!1,completed:!1,profileBuilt:!1})},[_l]),sy=f.useRef(!1),ny=f.useCallback(async()=>
510{if(sy.current)return;const ce=String(q.greeting||"").trim();if(ce&&!dU(ce))return;const _e=es.current;if(_e){sy.current=!0;try{const Te=EU(b?.full_name,Ot.current||w.current.username,q.name);Te&&Qd(q.name)&&(cp("name",Te),await js({identity:{name:Te}}));const Ve=String((await Qbe(_e))?.data?.greeting||"").trim();if(!Ve){sy.current=!1;return}if(Lt.current)return;he(ot=>String(ot.greeting||"").trim()&&!dU(ot.greeting)?ot:{...ot,greeting:Ve}),$e(!0)}catch{sy.current=!1}}},[q.greeting,q.name,cp,js,b?.full_name]);f.useEffect(()=>{J!=="profile-identity"||!Oe||ny()},[J,Oe,ny]);const SL=f.useCallback(()=>{he(_e=>({..._e,consent:{..._e.consent||{},authorship:!0,derivative_works:!0,no_third_party:!0}})),$e(!0);const ce=Pt({screen:"profile-voice",completed:!1,knowledgeCompleted:!0,knowledgeSkipped:!1,publicationConsentAccepted:!0,voiceCompleted:!1,identityCompleted:!1,profileBuilt:!1,testCompleted:!1});w.current=ce,P("profile-voice"),ny()},[ny]),CL=f.useCallback(async()=>{if(!(es.current||await sa()))return x("We could not prepare voice setup. Please try again.","error"),!1;$e(!0);const _e=Pt({screen:"profile-building",templateId:M,completed:!0,knowledgeCompleted:!0,voiceCompleted:!0,profileBuilt:!1,testCompleted:!0});return w.current=_e,xe(Te=>Te+1),P("profile-building"),!0},[x,sa,M]),TL=f.useCallback(()=>{if(!M)return!1;const ce=Pt({screen:"platforms",templateId:M,templateCompleted:!0});return w.current=ce,P("platforms"),e(Eb,{replace:!0}),!0},[e,M]),ooe=f.useCallback(()=>{const ce=Pt({screen:"welcome"});w.current=ce,P("welcome"),e(oc,{replace:!0})},[e]),AL=()=>{const ce=$n.current.catch(()=>{}).then(async()=>{const _e=es.current||await sa();if(!_e)throw new Error("We could not save your voice choice. Please try again.");await a1(_e,{voice:q.voice||"female",voice_preset:q.voice_preset||null});try{const Te=(await cu(_e)).data?.expert;Te&&Ds(Te)}catch{}$e(!0),j.current=!0});return $n.current=ce,ce},loe=()=>{w.current=Pt({screen:"profile-identity",voiceCompleted:!0,identityCompleted:!1,testCompleted:!1}),P("profile-identity"),AL().catch(ce=>{P(_e=>_e==="profile-identity"?"profile-voice":_e),x(ui(ce,"We could not save your voice choice. Please try again."),"error")})},coe=()=>{w.current=Pt({screen:"business-offerings",journey:"business",voiceCompleted:!0}),P("business-offerings"),AL().catch(ce=>{w.current=Pt({screen:"business-voice",journey:"business",voiceCompleted:!1}),P(_e=>_e==="business-offerings"?"business-voice":_e),x(ui(ce,"We could not save your voice choice. Please try again."),"error")})},[uoe,RL]=f.useState(!1),doe=async ce=>{RL(!0);try{Eo({rows:ce});const _e=await $r(),Te=ar(_e?.config??{}),{services:Ve,items:ot}=y7(Te.services,Te.items,h5(ce)),Yt=wa(Te),Mt=["services","products","contact"].filter(It=>!Yt.includes(It));await Xl({config:{services:Ve,items:ot,...Mt.length?{order:[...Yt,...Mt]}:{}}})}catch(_e){x(ui(_e,"We could not save your products and services. Please try again."),"error");return}finally{RL(!1)}w.current=Pt({screen:"business-building",journey:"business"}),P("business-building")},ry=f.useCallback(ce=>{is.current=!0,nf(),sf(),gU(),fN({}),w.current={},sessionStorage.removeItem(Li),e(ce)},[e]),IL=f.useCallback(()=>{const ce=es.current;if(!ce)return Promise.reject(new Error("We could not find the AI expert you just built."));const _e=uU(q,EU(b?.full_name,Ot.current||w.current.username,q.name)),Te=q.consent||{},Ve=q.avatar_file?`${q.avatar_file.name}:${q.avatar_file.size}:${q.avatar_file.lastModified}`:"",ot=JSON.stringify([ce,_e.name,_e.greeting,q.custom_conversation_starters||[],q.tagline||"",q.avatar_url||"",Ve,Te.authorship,Te.derivative_works,Te.no_third_party,Te.identity_verification]);if(pt.current.key===ot&&pt.current.promise)return pt.current.promise;const Yt=(async()=>{const Mt=q.avatar_url&&!q.avatar_url.startsWith("blob:")?q.avatar_url:"",[It,ss]=await Promise.all([$r(),q.avatar_file?Yu(ce,q.avatar_file):Prom
510ise.resolve(Mt),js({requireSuccess:!0,identity:_e}),gc({consentType:"expert_submission",tosVersion:n$,expertId:ce,checkboxStates:{authorship:!!Te.authorship,derivative_works:!!Te.derivative_works,no_third_party:!!Te.no_third_party,identity_verification:!!Te.identity_verification}})]),Vt=ar(It?.config??{}),gs=PP({...Vt,order:wa(Vt)},ce),gn={profileExperts:gs.profileExperts};gs.featuredExpertId&&(gn.featuredExpertId=gs.featuredExpertId),JSON.stringify(gs.order)!==JSON.stringify(wa(Vt))&&(gn.order=gs.order),!Vt.headerStyle?.photoUrl&&!b?.avatar_url&&ss&&(gn.headerStyle={...Vt.headerStyle,photoUrl:ss}),await Xl({config:gn})})();return pt.current={key:ot,promise:Yt},Yt.catch(()=>{pt.current.promise===Yt&&(pt.current={key:"",promise:null})}),Yt},[q,js,Yu,b?.avatar_url,b?.full_name]),PL=f.useCallback(async()=>{const ce=es.current;if(!ce)throw new Error("We could not find the AI expert you just built.");(await m(ce,{status:"active",draft_data:{}}))?.is_public||await YG(ce,!0),fAe(ce),o||lh(`expert_published:${ce}`,"ge_expert_published",{expert_id:ce,event_id:`expertpublished:${ce}`}),Uc()},[o,m]),LL=f.useCallback(()=>{ry(Me.DASHBOARD)},[ry]),i2=jJ({addToast:x,onPaid:ce=>{ce&&ct(ce),LL()},title:"Start your plan"}),OL=Qe?.trial?.active&&Qe.trial.plan?{plan:Qe.trial.plan,planName:J_(Qe.trial.plan).name}:null,hoe=f.useCallback((ce,_e)=>{oe(Te=>({...Te,[ce]:_e})),ce==="name"?cp("name",_e):he(Te=>({...Te,tagline:_e,description:_e})),wt("")},[cp]),ML=f.useCallback((ce,_e)=>{oe(Te=>(Te.avatarPreview?.startsWith("blob:")&&URL.revokeObjectURL(Te.avatarPreview),{...Te,avatarFile:ce,avatarPreview:_e})),he(Te=>({...Te,avatar_file:ce,avatar_preview:_e})),$e(!0),wt("")},[]),poe=f.useCallback(()=>{const ce=ke.name.trim(),_e=ke.bio.trim();if(ce.length<2){wt("Add a name before continuing.");return}wt("");const Te=!!w.current.additionalLinks?.[0],Ve={...q.consent||{},authorship:!0,derivative_works:!0,no_third_party:!0};he(Mt=>({...Mt,name:ce,tagline:_e,description:_e,consent:Ve})),$e(!0);const ot=oi.current.catch(()=>{}).then(async()=>{await $n.current;const Mt=es.current||await sa();if(!Mt)throw new Error("We could not prepare your AI expert. Please try again.");const It=!ke.avatarFile&&net(ke.avatarUrl),ss=ke.avatarFile||(It?await aet(ke.avatarUrl):null),Vt=(async()=>{const[gn,Wa]=await Promise.all([ch({full_name:ce,bio:_e}),ss?zke(ss,{preset:It}):Promise.resolve(null)]),kl=Wa?.data?.avatar_url||ke.avatarUrl;y({...gn.data.user,...kl?{avatar_url:kl}:{}}),ke.avatarPreview?.startsWith("blob:")&&URL.revokeObjectURL(ke.avatarPreview),oe(Va=>({...Va,name:ce,bio:_e,avatarUrl:kl,avatarPreview:"",avatarFile:null}))})(),gs=uU({...q,name:ce},ce);gs.tagline=_e,gs.description=_e,await Promise.all([Vt,ss?Yu(Mt,ss):Promise.resolve(),js({requireSuccess:!0,identity:gs})])});oi.current=ot;const Yt=Pt({screen:Te?"profile-offerings":"profile-building",completed:!Te,knowledgeCompleted:!0,publicationConsentAccepted:!0,voiceCompleted:!0,identityCompleted:!0,testCompleted:!0,profileBuilt:!1});
510w.current=Yt,Te||xe(Mt=>Mt+1),P(Te?"profile-offerings":"profile-building"),ot.catch(Mt=>{P(It=>It==="profile-offerings"?"profile-identity":It),wt(ui(Mt,"We could not save these details. Please try again."))})},[q,sa,ke,js,Yu,y]),moe=f.useCallback(ce=>{Eo({rows:ce});const _e=Pt({screen:"profile-building",completed:!0,profileBuilt:!1});w.current=_e,xe(Te=>Te+1),P("profile-building")},[]),o2=q.consent||{},l2=!!o2.authorship&&!!o2.derivative_works&&!!o2.no_third_party,c2=f.useCallback(async()=>{let ce=Qe;if(ce||(ce=(await Eu()).data,ct(ce)),ce?.active||ce?.unlimited)return ce;let _e=!!q.voice_enabled;if(!_e&&es.current)try{_e=(await M1(es.current))?.source==="clone"}catch{_e=!!q.voice_enabled}_e&&!q.voice_enabled&&he(Ve=>({...Ve,voice_enabled:!0}));const Te=q.voice_enabled||_e?"pro":"starter";try{const ot=(await DR(Te)).data;return ct(ot),ot}catch(Ve){const ot=Ve?.response?.data?.detail?.code;if(ot==="TRIAL_ALREADY_USED"||ot==="TRIAL_REJECTED")return ce;throw Ve}},[Qe,q.voice_enabled]),DL=f.useCallback(async()=>{if(!Re){if(!l2){x("Please review the publishing terms on the Details step.","error"),_l("profile-identity",{completed:!1,identityCompleted:!1,testCompleted:!1,profileBuilt:!1});return}Ge(!0);try{await Met((async()=>{await Promise.all([_S("prepare profile",IL()),_S("activate plan",c2())]),await _S("activate expert",PL())})()),We(!0)}catch(ce){is.current=!1,ce?.code===Qre&&(pt.current={key:"",promise:null}),ye(ui(ce,"We could not finish your profile. Please try again.")),P("profile-building")}finally{Lt.current||Ge(!1)}}},[c2,PL,x,l2,Re,IL,_l]);f.useEffect(()=>{if(J!=="profile-ready"||Re)return;if(!ms){DL();return}const ce=Pt({screen:"profile-congratulations",profileBuilt:!0});w.current=ce,P("profile-congratulations")},[Re,DL,ms,J]);const $L=q.avatar_preview||q.avatar_url,foe=Dre(Q,Dt),goe=Dt?.id&&Array.isArray(q.custom_conversation_starters)?{[String(Dt.id)]:q.custom_conversation_starters}:{};return s.jsxs("div",{className:"animate-fade-in",children:[s.jsx(vs,{title:or.create.title,description:or.create.description,path:"/experts/new",ogImage:or.create.image}),J.startsWith("business-")&&!Ys?s.jsx(HR,{screen:J,onGo:ce=>{w.current=Pt({screen:ce,journey:"business"}),P(ce)}}):null,s.jsx(GP,{hidden:Ys||k==="saving"||J!=="profile-knowledge"&&J!=="business-knowledge",progressStep:J==="business-knowledge"?"business-knowledge":"profile-knowledge",progressSteps:J==="business-knowledge"?To:void 0,ref:ne,expertId:Oe,onEnsureDraft:sa,documents:ue,onDocumentsChange:be,onKnowledgeActivity:()=>$e(!0),errorMessage:se.documents,addToast:x,onContinue:J==="business-knowledge"?()=>{he(ce=>({...ce,consent:{...ce.consent||{},authorship:!0,derivative_works:!0,no_third_party:!0}})),$e(!0),w.current=Pt({screen:"business-voice",journey:"business",knowledgeCompleted:!0,knowledgeSkipped:!1,publicationConsentAccepted:!0,voiceCompleted:!1}),P("business-voice")}:SL,onSkip:J==="business-knowledge"?void 0:SL,styleDirective:q.style_directive,onStyleChange:ce=>cp("communication_style",ce),onPersonaApplied:Cn,onBack:()=>{if(J==="business-knowledge"){w.current=Pt({screen:"business-contact",journey:"business"}),P("business-contact");return}_l("platforms",{knowledgeCompleted:!1,voiceCompleted:!1,testCompleted:!1,completed:!1,profileBuilt:!1})}}),Ys?s.jsxs("section",{className:"flex min-h-dvh flex-col items-center justify-center gap-4 bg-cream px-6 text-center text-ink",children:[s.jsx(vt,{className:"h-9 w-9 animate-spin text-indigo motion-reduce:animate-none","aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-3xl font-semibold",children:"Restoring your progress"}),s.jsx("p",{className:"mt-2 text-ink-muted",children:"Hang on while we bring you back to where you left off."})]})]}):k==="saving"?s.jsxs("section",{className:"flex min-h-dvh flex-col items-center justify-center gap-4 bg-cream px-6 text-center text-ink",children:[s.jsx(vt,{className:"h-9 w-9 animate-spin text-indigo motion-reduce:animate-none","aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-3xl font-semibold",children:"Securing your profile link"}),s.jsxs("p",{className:"mt-2 text-ink-muted",children:["greatexperts.ai/",w.current.username]})]})]}):J==="business-chat"?s.jsx(Ure,{initialMode:w.current.embedMode,onSelect:ce=>{w.current=Pt({screen:"business-chat",journey:"business",embedMode:ce})},onContinue:ce=>{w.current=Pt({screen:"business-sources",journey:"business",embedMode:ce}),P("business-sources")},onBack:()=>e(Me.FOR_BUSINESS)}):J==="business-sources"?s.jsx(Uj,{variant:"business",connected:N,handles:H,additionalLinks:w.current.additionalLinks,onConnect:sg,onDisconnect:Oo,onSaveHandle:$s,onSaveAdditionalLinks:Sa,onImportLink:wr,facebookPageChoices:$,onSelectFacebookPage:qa,onContinue:()=>{w.current=Pt({screen:"business-contact",journey:"business"}),P("business-contact")},onBack:()=>{w.current=Pt({screen:"business-chat",journey:"business"}),P("business-chat")}}):J==="business-contact"?s.jsx(Hre,{initialContact:ee,loading:ee===null,saving:ae,onChange:X,onBack:()=>{w.current=Pt({screen:"business-sources",journey:"business"}),P("business-sources")},onContinue:async ce=>{me(!0);try{await Xl({config:{businessContact:Tne(ce)}})}catch{me(!1),x("We could not save your contacts. Please try again.","error");return}me(!1),w.current=Pt({screen:"business-knowledge",journey:"business",knowledgeCompleted:!1,knowledgeSkipped:!1}),P("business-knowledge")}},ee===null?"loading":"ready"):J==="welcome"?s.jsx(qP,{initialUsername:w.current.username||"",takenUsername:S,onContinue:({username:ce})=>{E.current=zR(ce);const _e=w.current.templateCompleted?"platforms":"templates";w.current=Pt({screen:_e,username:ce}),Ot.current=ce,_(""),P(_e)}}):J==="platforms"?s.jsx(Uj,{connected:N,handles:H,additionalLinks:w.current.additionalLinks,onConnect:sg,onDisconnect:Oo,onSaveHandle:$s,onSaveAdditionalLinks:Sa,onImportLink:wr,facebookPageChoices:$,onSelectFacebookPage:qa,onContinue:NL,onSkip:NL,onBack:()=>e(Me.HOME)}):J==="templates"?s.jsx(zk,{templates:D,defaultId:V,ready:K,displayName:b?.full_name||"You",photoSrc:$L||b?.avatar_url,profilePath:b?qd(b):"",profileBio:b?.bio||"",baseConfig:Q,leadsEnabled:q.enable_leads,selectedId:M,onSelect:tr,onContinue:Rr?TL:CL,onSkip:Rr?TL:CL,onBack:Rr?ooe:()=>_l("profile-identity",{completed:!1,identityCompleted:!1,testCompleted:!1,profileBuilt:!1})}):J==="profile-knowledge"?null:J==="profile-voice"?s.jsx(qj,{data:q,onCh
510ange:_L,expertId:Oe,saving:Re,error:ve,onRetry:()=>De(ce=>ce+1),onBack:ioe,onContinue:loe}):J==="business-voice"?s.jsx(qj,{progressStep:"business-voice",progressSteps:To,data:q,onChange:_L,expertId:Oe,saving:Re,error:ve,onRetry:()=>De(ce=>ce+1),onBack:()=>{w.current=Pt({screen:"business-knowledge",journey:"business",voiceCompleted:!1}),P("business-knowledge")},onContinue:coe}):J==="business-offerings"?s.jsx(m5,{variant:"business",url:w.current.additionalLinks||[],extract:kS,saving:uoe,onBack:()=>{w.current=Pt({screen:"business-voice",journey:"business"}),P("business-voice")},onContinue:doe}):J==="business-building"?s.jsx(zre,{embedMode:w.current.embedMode,website:w.current.additionalLinks?.[0],stage:pe,error:Ue,onRetry:()=>{dt(""),xt(ce=>ce+1)},onBack:()=>{w.current=Pt({screen:"business-offerings",journey:"business"}),P("business-offerings")},onContinue:()=>{w.current=Pt({screen:"business-customize",journey:"business"}),P("business-customize")}}):J==="business-customize"?s.jsx(qre,{embedMode:w.current.embedMode,website:w.current.additionalLinks?.[0],expertId:Oe,initialWidget:w.current.widget,avatarSrc:q.avatar_preview||q.avatar_url,addToast:x,onAvatar:ML,onChange:ce=>{w.current=Pt(ce)},onBack:()=>{w.current=Pt({screen:"business-building",journey:"business"}),P("business-building")},saving:et,onContinue:aoe}):J==="business-congratulations"?s.jsx(lne,{embedMode:w.current.embedMode,website:w.current.additionalLinks?.[0],embed:w.current.embed,onBack:()=>{const ce=w.current.embed?.expertId;!es.current&&ce&&(es.current=ce,Je(ce)),w.current=Pt({screen:"business-customize",journey:"business"}),P("business-customize")},onContinue:()=>ry(Me.DASHBOARD)}):J==="profile-identity"?s.jsx(Ire,{identity:{name:ke.name,bio:ke.bio,avatarSrc:ke.avatarPreview||ke.avatarUrl},expertId:Oe,handles:H,onEnsureDraft:sa,saving:!1,error:He,addToast:x,onChange:hoe,onAvatar:ML,onBack:()=>_l("profile-voice",{voiceCompleted:!1,identityCompleted:!1,testCompleted:!1,completed:!1,profileBuilt:!1}),onContinue:poe}):J==="profile-offerings"?s.jsx(m5,{url:w.current.additionalLinks||[],extract:kS,saving:!1,onBack:()=>_l("profile-identity",{completed:!1,identityCompleted:!1,testCompleted:!1,profileBuilt:!1}),onContinue:moe}):J==="profile-building"?s.jsx(l5,{stage:zt,waitingForKnowledge:Ze,onReviewKnowledge:jt?()=>{xe(ce=>ce+1),_l("profile-knowledge",{completed:!1,profileBuilt:!1})}:void 0,profilePath:qd(b),config:Q,profile:{name:ke.name||b?.full_name||q.name||"Your profile",username:w.current.username||b?.username||b?.slug||"your-name",bio:ke.bio||b?.bio||"",avatarSrc:ke.avatarPreview||ke.avatarUrl||b?.avatar_url},sources:CU(N,H),contentCount:ue.length,error:qe,onRetry:()=>xe(ce=>ce+1)}):J==="profile-ready"?s.jsx(l5,{stage:ts.PUBLISHING,profilePath:qd(b),config:Q,profile:{name:ke.name||b?.full_name||q.name||"Your profile",username:w.current.username||b?.username||b?.slug||"your-name",bio:ke.bio||b?.bio||"",avatarSrc:ke.avatarUrl||b?.avatar_url},sources:CU(N,H),contentCount:ue.length}):J==="profile-congratulations"?s.jsx(Ore,{personalizationSources:[...w.current.additionalLinks||[],...vU(Q.socials,H,N)].slice(0,6),profilePath:qd(b),shareUrl:ll({id:b?.id,username:b?.username||b?.slug||w.current.username}),config:foe,profile:{full_name:ke.name||b?.full_name||"Your profile",bio:ke.bio||b?.bio||"",avatar_url:ke.avatarUrl||b?.avatar_url,expert_avatar_url:$L||q.avatar_url,experts:Dt?[Dt]:[],startersByExpert:goe},addToast:x,onContinue:LL,onEditProfile:()=>ry(Me.PUBLIC_PAGE),trial:OL,onPayNow:()=>i2.open(OL.plan),payNowBusy:i2.busy}):null,i2.modal,s.jsx(Mre,{isOpen:$t&&J==="platforms",onClose:()=>tt(!1),onAdd:()=>EL(!0),onSkip:()=>EL(!1)}),it&&Mn.createPortal(s.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-ink/60 p-4",children:s.jsxs(QZe,{className:"p-6 sm:p-8 max-w-sm w-full !shadow-overlay",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"w-10 h-10 rounded-md bg-peach-tint border border-peach flex items-center justify-center shrink-0",children:s.jsx(xr,{className:"w-5 h-5 text-destructive"})}),s.jsx("h3",{className:"font-heading text-xl font-medium text-ink tracking-tight",children:"Leave and save draft?"})]}),s.jsx("p",{className:"text-sm text-ink-mid mb-6 leading-relaxed",children:"Your draft will stay in Lab under My experts, so you can resume setup later."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(yt,{variant:"secondary",onClick:Ft,className:"min-w-[5rem] !rounded-md",children:"Stay"}),s.jsx(yt,{variant:"primary",onClick:Fn,className:"min-w-[5rem] !rounded-md",children:"Save & leave"})]})]})}),document.body)]})}const Het="business-preview-expert",qet=async()=>({status:"empty",rows:[]});function Wet(){const e=Ps(),t=an(),[n,r]=f.useState(()=>VGe(t.search)),a=U_(t.search)||n.journey==="business",[i,o]=f.useState(!1),[l]=f.useState(Oj),[c,u]=f.useState(n.templateId||""),[d,h]=f.useState(l?.templates||[]),[p,m]=f.useState(l?.defaultId||""),[g,x]=f.useState(!!l),[b,y]=f.useState({voice:"",voice_preset
510:null,voice_enabled:!1}),[v,w]=f.useState(""),[j,E]=f.useState(null);f.useEffect(()=>{if(l)return;let A=!0;return G0().then(T=>{A&&(h(T.templates),m(T.defaultId))}).catch(T=>{A&&(console.warn("Managed profile looks unavailable; using bundled fallback.",T),h(lc),m(Kx))}).finally(()=>{A&&x(!0)}),()=>{A=!1}},[l]);const S=f.useCallback(A=>{u(A.id),Pt({screen:"templates",templateId:A.id,templateCompleted:!1})},[]),_=f.useCallback(()=>{c&&(Pt({screen:"platforms",templateId:c,templateCompleted:!0}),e(Me.SIGNUP,{state:{from:Me.CREATE_EXPERT}}))},[e,c]),k=f.useCallback(A=>{const T=Pt({screen:"business-chat",journey:"business",embedMode:A});r(T)},[]),C=f.useCallback(A=>{Pt({screen:"business-sources",journey:"business",embedMode:A}),e(Me.SIGNUP,{state:{from:ol}})},[e]),N=()=>n.screen==="business-congratulations"?s.jsx(lne,{embedMode:n.embedMode,website:n.additionalLinks?.[0],embed:n.embed,onBack:()=>r(Pt({screen:"business-customize",journey:"business"})),onContinue:()=>e(Me.SIGNUP,{state:{from:ol}})}):n.screen==="business-customize"?s.jsx(qre,{previewMode:!0,embedMode:n.embedMode,website:n.additionalLinks?.[0],initialWidget:n.widget,avatarSrc:v,onAvatar:(A,T)=>w(I=>(I&&URL.revokeObjectURL(I),T)),onChange:A=>Pt(A),onBack:()=>r(Pt({screen:"business-building",journey:"business"})),onContinue:A=>r(Pt({...A,screen:"business-congratulations",journey:"business"}))}):n.screen==="business-building"?s.jsx(zre,{embedMode:n.embedMode,website:n.additionalLinks?.[0],onBack:()=>r(Pt({screen:"business-offerings",journey:"business"})),onContinue:()=>r(Pt({screen:"business-customize",journey:"business"}))}):n.screen==="business-offerings"?s.jsx(m5,{variant:"business",url:[],extract:qet,onBack:()=>r(Pt({screen:"business-voice",journey:"business"})),onContinue:()=>r(Pt({screen:"business-building",journey:"business"}))}):n.screen==="business-voice"?s.jsx(qj,{previewMode:!0,progressStep:"business-voice",progressSteps:To,data:b,onChange:(A,T)=>y(I=>({...I,[A]:T})),expertId:Het,onBack:()=>{r(Pt({screen:"business-knowledge",journey:"business",voiceCompleted:!1}))},onContinue:()=>{r(Pt({screen:"business-offerings",journey:"business",voiceCompleted:!0}))}}):n.screen==="business-knowledge"?s.jsx(GP,{previewMode:!0,progressStep:"business-knowledge",progressSteps:To,onBack:()=>{r(Pt({screen:"business-contact",journey:"business"}))},onContinue:()=>{r(Pt({screen:"business-voice",journey:"business",knowledgeCompleted:!0,knowledgeSkipped:!1,voiceCompleted:!1}))}}):n.screen==="business-sources"?s.jsx(Uj,{variant:"business",additionalLinks:n.additionalLinks,onSaveAdditionalLinks:A=>{r(Pt({screen:"business-sources",journey:"business",additionalLinks:A}))},onBack:()=>{r(Pt({screen:"business-chat",journey:"business"}))},onContinue:()=>{r(Pt({screen:"business-contact",journey:"business"}))}}):n.screen==="business-contact"?s.jsx(Hre,{initialContact:j,onChange:E,onBack:()=>r(Pt({screen:"business-sources",journey:"business"})),onContinue:()=>r(Pt({screen:"business-knowledge",journey:"business",knowledgeCompleted:!1,knowledgeSkipped:!1}))}):s.jsx(Ure,{initialMode:n.embedMode,onSelect:k,onContinue:C,onBack:()=>e(Me.FOR_BUSINESS)});return a?s.jsxs(s.Fragment,{children:[s.jsx(HR,{screen:n.screen,onGo:A=>r(Pt({screen:A,journey:"business"}))}),N()]}):!n.username||i?s.jsx(qP,{initialUsername:n.username||"",deferProfileSave:!0,onContinue:async({username:A})=>{await DP(A,e),r(Su()),o(!1)}}):s.jsx(zk,{templates:d,defaultId:p,ready:g,selectedId:c,onSelect:S,onContinue:_,onSkip:_,onBack:()=>o(!0)})}function Vet(){const e=an(),{user:t,isAuthenticated:n,isLoading:r}=Ut(),{status:a,entry:i,isLoading:o}=N0(),[l]=f.useState(()=>e.search),c=VZe(e.search);return f.useEffect(()=>{c||lh("create_expert_start","ge_create_expert_start")},[c]),c?s.jsx(JZe,{}):r?s.jsx(il,{fullPage:!0,text:"Loading..."}):n?t?.terms_current!==!0?s.jsx(Pn,{to:Me.SIGNUP,replace:!0,state:{from:`${e.pathname}${e.search}`}}):sK(e.search)||V_e({search:l,hasJourney:$Ae(),accountCreatedAt:t?.created_at})?s.jsx(TU,{}):o||!i?s.jsx(il,{fullPage:!0,text:"Loading..."}):a==="dashboard"?s.jsx(Pn,{to:Me.DASHBOARD,replace:!0}):a==="resume"?s.jsx(Pn,{to:i.to,replace:!0}):s.jsx(TU,{}):s.jsx(Wet,{})}function Get({expertId:e}){const{addToast:t}=f.useContext(Zs),[n,r]=f.useState(!0),[a,i]=f.useState(!1),[o,l]=f.useState(!1),[c,u]=f.useState({}),[d,h]=f.useState(!0),[p,m]=f.useState(null),[g,x]=f.useState(""),[b,y]=f.useState("20");f.useEffect(()=>{let j=!1;return r(!0),t0e(e).then(E=>{if(j)return;const S=E.data.settings||{};h(S.allow_answer_packs!==!1),m(S.trial_answers??null),x(E.data.subscription_price_usd!=null?String(E.data.subscription_price_usd):""),y(String(S.free_messages_before_subscription??20))}).catch(()=>t("Could not load subscription settings.","error")).finally(()=>{j||r(!1)}),()=>{j=!0}},[e,t]);const v=()=>{const j={};if(d||((p==null||p<2||p>5)&&(j.trial_answers="Pick a trial allowance between 2 and 5."),g||(j.subscription_price_usd="A subscription price is required when packs are off.")),g!==""){const S=Number(g);(Number.isNaN(S)||S<5||S>1e4)&&(j.subscription_price_usd="Price must be between $5 and $10,000.")}const E=Number(b);return(b===""||!Number.isInteger(E)||E<0||E>20)&&(j.free_messages_before_subscription="Pick a whole number between 0 and 20."),u(j),Object.keys(j).length===0},w=async()=>
510{if(v()){i(!0);try{const j={allow_answer_packs:d,trial_answers:d?null:p};g!==""&&(j.subscription_price_usd=Number(g)),j.free_messages_before_subscription=Number(b);const S=(await s0e(e,j)).data.subscription_price_usd;S!=null&&x(String(S)),l(!0),t("Subscription settings saved.","success")}catch(j){const E=j.response?.data?.detail?.code,S=j.response?.data?.detail?.message||"Could not save subscription settings.";E==="INVALID_TRIAL_ANSWERS"||E==="TRIAL_ANSWERS_REQUIRED"?u(_=>({..._,trial_answers:S})):E==="INVALID_FREE_MESSAGE_LIMIT"?u(_=>({..._,free_messages_before_subscription:S})):E==="PRICE_OUT_OF_RANGE"||E==="INVALID_PRICE"?u(_=>({..._,subscription_price_usd:S})):t(S,"error")}finally{i(!1)}}};return n?s.jsx("div",{className:"flex items-center justify-center bg-cream py-10 text-ink-light",children:s.jsx(vt,{className:"h-5 w-5 animate-spin"})}):s.jsxs("div",{className:"space-y-3 bg-cream px-4 pb-5 pt-4 sm:px-5",children:[s.jsxs("div",{className:"grid gap-4 rounded-lg border border-rule bg-paper p-4 sm:grid-cols-2",children:[(()=>{const j=g!==""?Number(g):null,E=j!=null&&!Number.isNaN(j)&&(j<5||j>1e4);return s.jsxs("div",{children:[s.jsx("label",{htmlFor:"subscription-price",className:"mb-1.5 block text-sm font-semibold text-ink-soft",children:"Monthly price"}),s.jsxs("div",{className:"relative",children:[s.jsx("span",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm text-ink-mid",children:"$"}),s.jsx("input",{id:"subscription-price",type:"number",min:"5",max:"10000",step:"0.01",value:g,placeholder:"5â10,000",onChange:S=>{x(S.target.value),l(!1)},className:`h-11 w-full rounded-lg border bg-cream py-2.5 pl-7 pr-14 text-sm text-ink placeholder:text-ink-light transition-colors duration-150 ease-out hover:bg-paper focus:bg-paper focus:outline-none focus:shadow-focus ${E?"border-red-400 focus:border-red-500":"border-rule focus:border-indigo"}`}),s.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-ink-mid",children:"/mo"})]}),c.subscription_price_usd&&s.jsx("p",{className:"mt-1 text-xs text-red-700",children:c.subscription_price_usd})]})})(),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"free-messages",className:"mb-1.5 block text-sm font-semibold text-ink-soft",children:"Free messages"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{id:"free-messages",type:"number",min:"0",max:"20",step:"1",value:b,placeholder:"0â20",onChange:j=>{y(j.target.value),l(!1)},className:`h-11 w-full rounded-lg border bg-cream px-3 pr-20 text-sm text-ink placeholder:text-ink-light transition-colors duration-150 ease-out hover:bg-paper focus:bg-paper focus:outline-none focus:shadow-focus ${c.free_messages_before_subscription?"border-red-400 focus:border-red-500":"border-rule focus:border-indigo"}`}),s.jsx("span",{className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-xs text-ink-mid",children:"/visitor"})]}),c.free_messages_before_subscription&&s.jsx("p",{className:"mt-1 text-xs text-red-700",children:c.free_messages_before_subscription})]})]}),s.jsxs("div",{className:"flex flex-col gap-3 pt-1 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{className:"flex min-h-10 min-w-0 flex-1 items-center gap-2 rounded-lg border border-rule bg-[#f1f2f4] px-3 text-xs leading-snug text-ink-mid",children:[s.jsx(al,{className:"h-3.5 w-3.5 shrink-0 text-indigo-deep"}),s.jsxs("p",{children:["You keep ",s.jsx("strong",{children:"70%"})," after fees · New prices affect new subscribers · Existing visitors keep their current limit."]})]}),s.jsxs("button",{type:"button",onClick:w,disabled:a,className:"inline-flex h-10 shrink-0 items-center justify-center gap-2 rounded-xl bg-indigo px-4 text-sm font-medium text-cream transition-colors duration-150 ease-out hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-60",children:[a?s.jsx(vt,{className:"h-4 w-4 animate-spin"}):o?s.jsx(ft,{className:"h-4 w-4","aria-hidden":"true"}):null,a?"Savingâ¦":o?"Saved":"Save changes"]})]})]})}const Pl="rounded-xl border border-slate-200 dark:border-white/10 bg-slate-50 dark:bg-white/5 px-3 py-2.5 text-sm text-slate-900 dark:text-neutral-100 placeholder-slate-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-1 focus:ring-slate-300 dark:focus:ring-white/20 focu
510s:bg-white dark:focus:bg-white/10 transition-all",NS="shrink-0 w-10 self-stretch rounded-xl border border-slate-200 dark:border-white/10 text-slate-400 dark:text-neutral-500 hover:text-red-500 dark:hover:text-red-400 hover:border-red-200 transition-colors flex items-center justify-center",Yet=[{value:"direct",label:"Directly quiz",hint:"Embed opens straight into the quiz"},{value:"chat",label:"Chat with quiz button",hint:"Normal chat, plus a highlighted quiz button"},{value:"off",label:"Off",hint:"Quiz hidden, settings kept"}];function Ket({expertId:e,value:t,onChange:n}){const r=t||{mode:"direct",intro:"",questions:[],levels:[]},a=r.mode||"direct",i=r.levels||[],o=r.questions||[],l=A=>n({...r,...A}),[c,u]=f.useState(!1),[d,h]=f.useState(""),p=async()=>{u(!0),h("");try{const A=await Ibe(e);l({questions:A.data.questions})}catch(A){h(A.response?.data?.detail?.message||"Generation failed. Try again.")}finally{u(!1)}},[m,g]=f.useState(!1),[x,b]=f.useState(""),y=async()=>{g(!0),b("");try{const A=await Pbe(e);l({audio:A.data})}catch(A){b(A.response?.data?.detail?.message||"Audio generation failed. Try again.")}finally{g(!1)}},v=(A,T)=>l({levels:i.map((I,$)=>$===A?{...I,...T}:I)}),w=()=>l({levels:[...i,{id:"",label:"",form_url:"",min_points:0}]}),j=A=>l({levels:i.filter((T,I)=>I!==A)}),E=(A,T)=>l({questions:o.map((I,$)=>$===A?{...I,...T}:I)}),S=()=>l({questions:[...o,{text:"",options:[{label:"",points:0},{label:"",points:1}]}]}),_=A=>l({questions:o.filter((T,I)=>I!==A)}),k=(A,T,I)=>E(A,{options:o[A].options.map(($,O)=>O===T?{...$,...I}:$)}),C=A=>E(A,{options:[...o[A].options,{label:"",points:0}]}),N=(A,T)=>E(A,{options:o[A].options.filter((I,$)=>$!==T)});return s.jsxs("div",{className:"space-y-6",children:[s.jsx("p",{className:"text-sm text-slate-500 dark:text-neutral-400",children:"Visitors take this quiz step by step, each answer carries points, and at the end they get the form link for the level matching their total. Runs instantly, no AI latency."}),s.jsxs("div",{children:[s.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-neutral-300 mb-1.5",children:"How the quiz appears"}),s.jsx("div",{className:"grid sm:grid-cols-3 gap-2",children:Yet.map(A=>s.jsxs("button",{type:"button",onClick:()=>l({mode:A.value}),"aria-pressed":a===A.value,className:`text-left rounded-xl border-2 px-3 py-2.5 transition-all ${a===A.value?"border-primary-500 bg-primary-50 dark:bg-primary-900/20":"border-slate-200 dark:border-neutral-700 hover:border-slate-300 dark:hover:border-neutral-600"}`,children:[s.jsx("p",{className:`text-sm font-semibold ${a===A.value?"text-primary-700 dark:text-primary-300":"text-slate-900 dark:text-neutral-100"}`,children:A.label}),s.jsx("p",{className:"text-[11px] text-slate-500 dark:text-neutral-400",children:A.hint})]},A.value))})]}),a==="chat"&&s.jsxs("div",{children:[s.jsx("label",{htmlFor:"quiz-button-label",className:"block text-sm font-medium text-slate-700 dark:text-neutral-300 mb-1.5",children:"Quiz button label"}),s.jsx("input",{id:"quiz-button-label",type:"text",maxLength:40,value:r.button_label||"",onChange:A=>l({button_label:A.target.value}),placeholder:"Take the quiz",className:`${Pl} w-full sm:max-w-xs`})]}),a!=="off"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-neutral-300 mb-1.5",children:"Result screen"}),s.jsxs("div",{className:"grid sm:grid-cols-2 gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>l({show_result:!0}),"aria-pressed":r.show_result!==!1,className:`text-left rounded-xl border-2 px-3 py-2.5 transition-all ${r.show_result!==!1?"border-primary-500 bg-primary-50 dark:bg-primary-900/20":"border-slate-200 dark:border-neutral-700 hover:border-slate-300 dark:hover:border-neutral-600"}`,children:[s.jsx("p",{className:`text-sm font-semibold ${r.show_result!==!1?"text-primary-700 dark:text-primary-300":"text-slate-900 dark:text-neutral-100"}`,children:"Show the level"}),s.jsx("p",{className:"text-[11px] text-slate-500 dark:text-neutral-400",children:"Visitor sees their level plus the form link"})]}),s.jsxs("button",{type:"button",onClick:()=>l({show_result:!1}),"aria-pressed":r.show_result===!1,className:`text-left rounded-xl border-2 px-3 py-2.5 transition-all ${r.show_result===!1?"border-primary-500 bg-primary-50 dark:bg-primary-900/20":"border-slate-200 dark:border-neutral-700 hover:border-slate-300 dark:hover:border-neutral-600"}`,children:[s.jsx("p",{className:`text-sm font-semibold ${r.show_result===!1?"text-primary-700 dark:text-primary-300":"text-slate-900 dark:text-neutral-100"}`,children:"Keep the level hidden"}),s.jsx("p",{className:"text-[11px] text-slate-500 dark:text-neutral-400",children:"Visitor fills the form to get their score from you"})]})]})]}),s.jsxs("div",{className:"grid sm:grid-cols-[1fr_180px] gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"quiz-intro",className:"block text-sm font-medium text-slate-700 dark:text-neutral-300 mb-1.5",children:"Welcome message"}),s.jsx("input",{id:"quiz-intro",type:"text",maxLength:500,value:r.
510intro||"",onChange:A=>l({intro:A.target.value}),placeholder:"Find your level in a few quick questions.",className:`${Pl} w-full`})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"quiz-voice-lang",className:"block text-sm font-medium text-slate-700 dark:text-neutral-300 mb-1.5",children:"Voice language"}),s.jsx("input",{id:"quiz-voice-lang",type:"text",maxLength:15,value:r.voice_lang||"",onChange:A=>l({voice_lang:A.target.value}),placeholder:"e.g. es-ES",title:"Language for read-aloud and voice answers in the quiz. Empty = visitor's browser default.",className:`${Pl} w-full`})]})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("span",{className:"text-sm font-medium text-slate-700 dark:text-neutral-300",children:"Questions"}),s.jsxs("button",{type:"button",onClick:p,disabled:c,className:"inline-flex items-center gap-1.5 text-xs font-medium text-primary-600 dark:text-primary-400 hover:text-primary-700 disabled:opacity-60 transition-colors",children:[c?s.jsx(vt,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Ms,{className:"w-3.5 h-3.5"}),c?"Generatingâ¦":"Generate from knowledge"]})]}),s.jsx("p",{className:"text-xs text-slate-500 dark:text-neutral-400 mb-2",children:"Each answer option carries points (0 = beginner answer, higher = more advanced). Generating replaces the questions below, review before saving."}),d&&s.jsx("p",{className:"text-xs text-red-500 mb-2",role:"alert",children:d}),s.jsx("div",{className:"space-y-3",children:o.map((A,T)=>s.jsxs("div",{className:"rounded-xl border border-slate-200 dark:border-white/10 p-3 space-y-2",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("span",{className:"shrink-0 w-6 flex items-center justify-center text-xs font-medium text-slate-400",children:[T+1,"."]}),s.jsx("input",{type:"text",maxLength:500,value:A.text||"",onChange:I=>E(T,{text:I.target.value}),placeholder:'e.g. How would you say "I went to the market yesterday"?',"aria-label":`Question ${T+1}`,className:`${Pl} flex-1 min-w-0`}),s.jsx("button",{type:"button",onClick:()=>_(T),"aria-label":`Remove question ${T+1}`,className:NS,children:s.jsx(Qs,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"pl-8 space-y-2",children:[s.jsxs("div",{className:"flex gap-2 pr-12",children:[s.jsx("span",{className:"flex-1 text-[10px] uppercase tracking-wide text-slate-400",children:"Answer option"}),s.jsx("span",{className:"w-16 shrink-0 text-center text-[10px] uppercase tracking-wide text-slate-400",children:"Points"})]}),(A.options||[]).map((I,$)=>s.jsxs("div",{className:"flex gap-2 items-stretch",children:[s.jsx("input",{type:"text",maxLength:200,value:I.label||"",onChange:O=>k(T,$,{label:O.target.value}),placeholder:`Option ${$+1}`,"aria-label":`Question ${T+1} option ${$+1}`,className:`${Pl} flex-1 min-w-0`}),s.jsx("input",{type:"number",min:0,max:10,value:I.points??0,onChange:O=>k(T,$,{points:O.target.value===""?0:Number(O.target.value)}),"aria-label":`Question ${T+1} option ${$+1} points`,className:`${Pl} w-16 shrink-0 text-center`}),s.jsx("button",{type:"button",onClick:()=>N(T,$),"aria-label":`Remove option ${$+1}`,className:NS,children:s.jsx(Qs,{className:"w-4 h-4"})})]},$)),s.jsxs("button",{type:"button",onClick:()=>C(T),className:"text-xs text-slate-500 dark:text-neutral-400 hover:text-slate-700 dark:hover:text-neutral-200 transition-colors flex items-center gap-1",children:[s.jsx(Es,{className:"w-3.5 h-3.5"})," Add option"]})]})]},T))}),s.jsxs("button",{type:"button",onClick:S,className:"mt-2 w-full rounded-xl border border-dashed border-slate-300 dark:border-white/15 py-2.5 text-sm text-slate-500 dark:text-neutral-400 hover:text-slate-700 dark:hover:text-neutral-200 hover:border-slate-400 dark:hover:border-white/30 transition-colors flex items-center justify-center gap-1.5",children:[s.jsx(Es,{className:"w-4 h-4"})," Add question"]})]}),o.length>0&&s.jsxs("div",{className:"rounded-xl border border-slate-200 dark:border-white/10 p-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("p",{className:"text-sm font-medium text-slate-700 dark:text-neutral-300 flex items-center gap-1.5",children:[s.jsx(bb,{className:"w-4 h-4 text-primary-600 dark:text-primary-400"})," Voice audio"]}),s.jsx("p",{className:"text-xs text-slate-500 dark:text-neutral-400 mt-0.5",children:r.audio?`Audio ready for ${r.audio.count} question${r.audio.count===1?"":"s"}. Regenerate after editing questions.`:"Pre-record each question in your cloned voice so the quiz speaks instantly. Uses your saved questions, so save changes first."})]}),s.jsxs("button",{type:"button",onClick:y,disabled:m,className:"shrink-0 inline-flex items-center gap-1.5 text-xs font-medium text-primary-600 dark:text-primary-400 hover:text-primary-700 disabled:opacity-60 transition-colors",children:[m?s.jsx(vt,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(bb,{className:"w-3.5 h-3.5"}),m?"Generatingâ¦":r.audio?"Regenerate":"Generate audio"]})]}),x&&s.jsx("p",{className:"text-xs text-red-500 mt-2",role:"alert",children:x})]}),s.jsxs("div",{children:[s.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-neutral-300 mb-1.5",children:"Levels and form links"}),s.jsx("p",{className:"text-xs text-slate-500 dark:text-neutral-400 mb-2",children:'"From points" is the minimum total for that level, the visitor gets the highest level their score reaches. Rows without both a name and a link are ignored.'}),s.jsxs("div",{className:"flex gap-2 pr-12 mb-1",children:[s.jsx("span",{className:"sm:w-[160px] shrink-0 text-[10px] uppercase tracking-wide text-slate-400 hidden sm:block",children:"Level"}),s.jsx("span",{className:"flex-1 text-[10px] uppercase tracking-wide text-slate-400",children:"Form link"}),s.jsx("span",{className:"w-20 shrink-0 text-center text-[10px] uppercase tracking-wide text-slate-400",children:"From points"})]}),s.jsx("div",{className:"space-y-2",children:i.map((A,T)=>s.jsxs("div",{className:"flex gap-2 items-stretch",children:[s.jsx("input",{type:"text",maxLength:100,value:A.label||"",onChange:I=>v(T,{label:I.target.value}),placeholder:"B1 Intermediate","aria-label":`Level ${T+1} name`,className:`${Pl} w-full sm:w-[160px] shrink-0 min-w-0`}),s.jsx("input",{type:"url",maxLength:500,value:A.form_url||"",onChange:I=>v(T,{form_url:I.target.value}),placeholder:"https://yoursite.com/forms/b1","aria-label":`Level ${T+1} form link`,className:`${Pl} flex-1 min-w-0`}),s.jsx("input",{type:"number",min:0,value:A.min_points??0,onChange:I=>v(T,{min_points:I.target.value===""?0:Number(I.target.value)}),"aria-label":`Level ${T+1} minimum points`,className:`${Pl} w-20 shrink-0 text-center`}),s.jsx("button",{type:"button",onClick:()=>j(T),"aria-label":`Remove level ${T+1}`,className:NS,children:s.jsx(Qs,{className:"w-4 h-4"})})]},T))}),s.jsxs("button",{type:"button",onClick:w,className:"mt-2 w-full rounded-xl border border-dashed border-slate-300 dark:border-white/15 py-2.5 text-sm text-slate-500 dark:text-neutral-400 hover:text-slate-700 dark:hover:text-neutral-200 hover:border-slate-400 dark:hover:border-white/30 transition-colors flex items-center justify-center gap-1.5",children:[s.jsx(Es,{className:"w-4 h-4"})," Add level"]})]})]})]})}const Xet=!1;function Jet({checked:e,disabled:t,label:n,onClick:r}){return s.jsx("button",{type:"button",role:"radio","aria-checked":e,"aria-label":n,disabled:t,onClick:r,className:`grid h-7 w-7 shrink-0 place-items-center rounded-full border outline-none transition-colors duration-150 focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-40 ${e?"border-indigo bg-indigo text-paper":"border-ink-light bg-paper"}
510`,children:e?s.jsx(ft,{className:"h-3.5 w-3.5",strokeWidth:3.5,"aria-hidden":"true"}):null})}function Qet({expertId:e,onPresetEnabledChange:t,selectedPreset:n,onPresetChange:r}){const[a,i]=f.useState(null),[o,l]=f.useState(!1),[c,u]=f.useState(!1),[d,h]=f.useState(!1),[p,m]=f.useState(""),g=f.useRef(Promise.resolve()),x=f.useRef(0),b=_=>{i(_),t(_==="preset")},y=(_,k=n)=>{if(_==="clone"&&!o||_===a&&_!=="preset")return;const C=a,N=x.current+1;x.current=N,h(!0),m(""),b(_);const A=g.current.catch(()=>{}).then(()=>a5(e,{voice_source:_,..._==="preset"&&k?{voice_preset:k}:{}}));g.current=A,A.then(T=>{N===x.current&&b(T.source||_)}).catch(T=>{N===x.current&&(b(C),m(T.response?.data?.detail?.message||"Could not change the voice source."))}).finally(()=>{N===x.current&&h(!1)})},v=({source:_,cloneAvailable:k,localizationEnabled:C})=>{l(k),C!==void 0&&u(!!C),(_==="clone"||_==="preset"||_==="none")&&b(_)},w=_=>{r(_),y("preset",_)},j=_=>{_.defaultPrevented||!_.currentTarget.contains(_.target)||_.target.closest('button, a, input, select, textarea, label, [role="button"], [role="option"], [role="listbox"], [contenteditable="true"]')||y("clone")},E=a==="clone",S=a==="preset";return s.jsxs("div",{className:"bg-cream px-4 pb-5 pt-4 sm:px-5",children:[s.jsxs("div",{role:"radiogroup","aria-label":"Voice source","aria-busy":d,className:"grid min-w-0 gap-3",children:[s.jsx("section",{"aria-label":"Clone your voice",onClick:j,className:`min-w-0 rounded-lg border p-4 transition-colors duration-150 ${o?"cursor-pointer":""} ${E?"border-indigo bg-indigo-wash/45 shadow-subtle":"border-rule bg-paper hover:border-ink-light"}`,children:s.jsx(Rre,{expertId:e,chrome:"none",recorderAppearance:"journey",sourceSelected:E,selectionDisabled:!o,onSelect:()=>y("clone"),onStateChange:v,localizationEnabled:Xet})}),s.jsxs("section",{"aria-label":"Ready-made voices",className:`min-w-0 rounded-lg border p-4 transition-colors duration-150 ${S?"border-indigo bg-indigo-wash/45 shadow-subtle":"border-rule bg-paper hover:border-ink-light"}`,children:[s.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{className:"text-sm font-semibold text-ink",children:"Ready-made voice"}),s.jsx("p",{className:"mt-1 text-xs leading-relaxed text-ink-mid",children:"Pick a studio voice instead of recording your own."})]}),s.jsx(Jet,{checked:S,disabled:a===null,label:"Use ready-made voice",onClick:()=>y("preset")})]}),s.jsx(Sre,{layout:"wizard",contrasted:!0,value:S?n:null,onChange:w,disabled:a===null})]})]}),p?s.jsx("p",{className:"mt-3 text-xs text-red-600",role:"alert",children:p}):null]})}const Zet={mode:"bubble",bubble_color:"#4f46e5",show_avatar_on_bubble:!0,show_teaser:!1,teaser_text:"Do you have a question?",show_call_badge:!0,inline_height:"560px",inline_width:"480px"},ES=[{label:"Compact",value:"420px"},{label:"Standard",value:"560px"},{label:"Large",value:"700px"},{label:"Fill screen",value:"85vh"}],SS=[{label:"Narrow",value:"380px"},{label:"Standard",value:"480px"},{label:"Wide",value:"640px"},{label:"Full width",value:"100%"}],AU=(e,t,n)=>e.some(r=>r.value===t)?t:n;function CS({checked:e,onChange:t,label:n,hint:r,disabled:a}){return s.jsxs("button",{type:"button",onClick:()=>!a&&t(!e),disabled:a,className:`w-full flex items-center justify-between gap-3 text-left py-2 ${a?"opacity-50 cursor-not-allowed":""}`,children:[s.jsxs("span",{children:[s.jsx("span",{className:"block text-sm font-medium text-slate-800 dark:text-neutral-200",children:n}),r&&s.jsx("span",{className:"block text-[11px] text-slate-400",children:r})]}),s.jsx("span",{className:`shrink-0 w-9 h-5 rounded-full transition-colors relative ${e?"bg-primary-600":"bg-slate-300 dark:bg-neutral-600"}`,children:s.jsx("span",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-all ${e?"left-[18px]":"left-0.5"}`})})]})}function RU(){return s.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md text-[10px] font-semibold uppercase tracking-wide bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",children:"Pro"})}function IU({active:e,onClick:t,title:n,children:r}){return s.jsxs("button",{type:"button",onClick:t,className:`flex-1 rounded-xl border-2 p-3 text-left transition-all ${e?"border-primary-500 bg-primary-50/60 dark:bg-primary-900/20":"border-slate-200 dark:border-neutral-700 hover:border-slate-300"}`,children:[s.jsx("div",{className:"h-20 rounded-lg bg-slate-100 dar
510k:bg-neutral-800 overflow-hidden mb-2 relative",children:r}),s.jsx("p",{className:`text-sm font-semibold ${e?"text-primary-700 dark:text-primary-300":"text-slate-700 dark:text-neutral-300"}`,children:n})]})}function PU({url:e,color:t,size:n="w-7 h-7"}){return e?s.jsx("img",{src:e,alt:"",className:`${n} rounded-full object-cover`}):s.jsx("span",{className:`${n} rounded-full flex items-center justify-center`,style:{backgroundColor:`${t}22`},children:s.jsx(Ms,{size:13,style:{color:t}})})}function ett({expertId:e,expertName:t,expertAvatarUrl:n,domain:r,lockedAppearance:a=[],existingConfig:i,onClose:o,onSaved:l}){const{addToast:c}=f.useContext(Zs),u=!!i,d={...Zet,...i||{}},h=new Set(a),p=h.has("bubble_color"),m=h.has("show_avatar_on_bubble")||h.has("show_teaser"),[g,x]=f.useState(d.mode),[b,y]=f.useState(d.bubble_color),[v,w]=f.useState(d.show_avatar_on_bubble),[j,E]=f.useState(d.show_teaser),[S,_]=f.useState(d.teaser_text),[k,C]=f.useState(d.show_call_badge!==!1),[N,A]=f.useState(AU(ES,d.inline_height,"560px")),[T,I]=f.useState(AU(SS,d.inline_width,"480px")),[$,O]=f.useState(!1),U={mode:g,bubble_color:b,show_avatar_on_bubble:v,show_teaser:j,teaser_text:S,show_call_badge:k,inline_height:N,inline_width:T},F=async()=>{if(!$){O(!0);try{let H;u?(H=await JG(e,U),c("Embed updated â live on your site","success")):(H=await x0(e,r,U),c("Embed is on â copy the snippet below","success")),l(H.data)}catch(H){const G=H?.response?.data?.detail?.message||"Could not save the embed settings";c(G,"error")}finally{O(!1)}}};return Mn.createPortal(s.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-slate-900/50 p-4",onClick:o,children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[90vh] overflow-y-auto rounded-2xl bg-white dark:bg-neutral-900 shadow-2xl",onClick:H=>H.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-slate-100 dark:border-neutral-800 sticky top-0 bg-white dark:bg-neutral-900 z-10",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold text-slate-900 dark:text-white",children:u?"Edit embed appearance":"Customize your embed"}),s.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:u?"Changes apply to your live website instantly.":"Choose how the chat looks on your website."})]}),s.jsx("button",{type:"button",onClick:o,className:"w-8 h-8 rounded-lg flex items-center justify-center text-slate-400 hover:bg-slate-100 dark:hover:bg-neutral-800","aria-label":"Close",children:s.jsx(as,{size:16})})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-5 p-5",children:[s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-slate-400 mb-2",children:"Layout"}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx(IU,{active:g==="bubble",onClick:()=>x("bubble"),title:"Floating bubble",children:s.jsx("div",{className:"absolute bottom-2 right-2 w-7 h-7 rounded-full flex items-center justify-center",style:{backgroundColor:b},children:s.jsx(ni,{size:13,className:"text-white"})})}),s.jsx(IU,{active:g==="inline",onClick:()=>x("inline"),title:"Inline in page",children:s.jsxs("div",{className:"absolute inset-2 rounded-md bg-white dark:bg-neutral-700 border border-slate-200 dark:border-neutral-600 flex flex-col",children:[s.jsx("div",{className:"h-3 rounded-t-md",style:{backgroundColor:b}}),s.jsx("div",{className:"flex-1"})]})})]})]}),s.jsxs("div",{className:p?"opacity-60":"",children:[s.jsxs("p",{className:"text-xs font-semibold uppercase tracking-wide text-slate-400 mb-2 flex items-center gap-2",children:[g==="bubble"?"Bubble color":"Accent color",p&&s.jsx(RU,{})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"color",value:b,disabled:p,onChange:H=>y(H.target.value),className:"w-10 h-10 rounded-lg border border-slate-200 dark:border-neutral-700 cursor-pointer bg-transparent disabled:cursor-not-allowed"}),s.jsx("input",{type:"text",value:b,disabled:p,onChange:H=>y(H.target.value),className:"w-28 rounded-lg border border-slate-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 px-3 py-2 text-sm font-mono text-slate-900 dark:text-white outline-none focus:border-primary-500 disabled:cursor-not-allowed"})]}),p&&s.jsx("p",{className:"text-[11px] text-slate-400 mt-1.5",children:"Custom color is available on Pro."})]}),g==="bubble"&&s.jsxs("div",{className:"rounded-xl border border-slate-100 dar
510k:border-neutral-800 divide-y divide-slate-100 dark:divide-neutral-800 px-3",children:[m&&s.jsxs("div",{className:"py-2 flex items-center gap-2 text-[11px] text-slate-400",children:[s.jsx(RU,{})," Avatar & greeting prompt are available on Pro."]}),s.jsx(CS,{checked:v,onChange:w,disabled:h.has("show_avatar_on_bubble"),label:"Show avatar on the bubble",hint:"Use the expert's photo instead of a chat icon"}),s.jsx(CS,{checked:j,onChange:E,disabled:h.has("show_teaser"),label:"Show a greeting prompt",hint:"A small card with an arrow pointing to the bubble"}),s.jsx(CS,{checked:k,onChange:C,label:"Show call badge",hint:"A small phone icon on the bubble when your expert takes voice calls"}),j&&!h.has("show_teaser")&&s.jsxs("div",{className:"py-2.5",children:[s.jsx("input",{type:"text",value:S,onChange:H=>_(H.target.value.slice(0,80)),placeholder:"Do you have a question?",className:"w-full rounded-lg border border-slate-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 px-3 py-2 text-sm text-slate-900 dark:text-white outline-none focus:border-primary-500"}),s.jsxs("p",{className:"text-[11px] text-slate-400 mt-1",children:[S.length,"/80"]})]})]}),g==="inline"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-slate-400 mb-2",children:"Width"}),s.jsx("select",{value:T,onChange:H=>I(H.target.value),className:"w-full rounded-lg border border-slate-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 px-3 py-2 text-sm text-slate-900 dark:text-white outline-none focus:border-primary-500",children:SS.map(H=>s.jsx("option",{value:H.value,children:H.label},H.value))})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-slate-400 mb-2",children:"Height"}),s.jsx("select",{value:N,onChange:H=>A(H.target.value),className:"w-full rounded-lg border border-slate-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 px-3 py-2 text-sm text-slate-900 dark:text-white outline-none focus:border-primary-500",children:ES.map(H=>s.jsx("option",{value:H.value,children:H.label},H.value))})]})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-slate-400 mb-2",children:"Preview"}),s.jsx("div",{className:"rounded-xl border border-slate-200 dark:border-neutral-700 bg-slate-50 dark:bg-neutral-800 overflow-hidden",children:g==="bubble"?s.jsxs("div",{className:"relative h-72",children:[s.jsxs("div",{className:"p-4 space-y-2 opacity-50",children:[s.jsx("div",{className:"h-3 w-2/3 rounded bg-slate-200 dark:bg-neutral-700"}),s.jsx("div",{className:"h-3 w-1/2 rounded bg-slate-200 dark:bg-neutral-700"}),s.jsx("div",{className:"h-3 w-3/4 rounded bg-slate-200 dark:bg-neutral-700"})]}),j&&s.jsx("div",{className:"absolute bottom-[84px] right-3 w-[230px] max-w-[80%]",children:s.jsxs("div",{className:"relative bg-white dark:bg-neutral-900 rounded-2xl shadow-lg border border-slate-100 dark:border-neutral-700 px-3 py-2.5 flex items-start gap-2",children:[s.jsx(PU,{url:n,color:b}),s.jsx("p",{className:"text-[13px] leading-snug text-slate-800 dark:text-neutral-200 break-words",children:S||"Do you have a question?"}),s.jsx("span",{className:"absolute -bottom-1.5 right-5 w-3 h-3 rotate-45 bg-white dark:bg-neutral-900 border-r border-b border-slate-100 dark:border-neutral-700"})]})}),s.jsxs("div",{className:"absolute bottom-3 right-3",children:[s.jsx("div",{className:"relative w-12 h-12 rounded-full flex items-center justify-center overflow-hidden shadow-lg",style:{backgroundColor:b},children:v&&n?s.jsx("img",{src:n,alt:"",className:"w-full h-full object-cover"}):s.jsx(ni,{size:20,className:"text-white"})}),k&&s.jsx("span",{className:"absolute -left-1.5 -top-1.5 flex h-[18px] w-[18px] items-center justify-center rounded-full border-2 border-white bg-[#407F57] text-white shadow",children:s.jsx(Ts,{size:8})})]})]}):s.jsxs("div",{className:"p-3",children:[s.jsxs("div",{className:"mx-auto w-full max-w-[300px] h-[300px] rounded-lg bg-white dark:bg-neutral-900 border border-slate-200 dark:border-neutral-700 overflow-hidden flex flex-col shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 shrink-0",style:{backgroundColor:`${b}14`},children:[s.jsx(PU,{url:n,color:b,size:"w-6 h-6"}),s.jsx("span",{className:"text-xs font-medium text-slate-800 dark:text-neutral-200 truncate",children:t||"Your expert"})]}),s.jsxs("div",{className:"flex-1 overflow-hidden p-3 space-y-2 bg-slate-50 dark:bg-neutral-800/50",children:[s.jsxs("div",{className:"max-w-[88%] px-2.5 py-1.5 rounded-xl rounded-bl-sm bg-slate-100 dar
510k:bg-neutral-700 text-[11px] leading-snug text-slate-700 dark:text-neutral-200",children:["Hi! I'm ",t||"your expert"," â ask me anything and I'll answer from my training."]}),s.jsx("div",{className:"ml-auto max-w-[70%] px-2.5 py-1.5 rounded-xl rounded-br-sm text-[11px] text-white",style:{backgroundColor:b},children:"What can you help with?"}),s.jsx("div",{className:"max-w-[88%] px-2.5 py-1.5 rounded-xl rounded-bl-sm bg-slate-100 dark:bg-neutral-700 text-[11px] leading-snug text-slate-700 dark:text-neutral-200",children:"Plenty â strategy, step-by-step guidance, and answers grounded in my knowledge base."})]}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-2 border-t border-slate-100 dark:border-neutral-700 shrink-0",children:[s.jsx("div",{className:"flex-1 h-6 rounded-md bg-slate-100 dark:bg-neutral-800"}),s.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{backgroundColor:b},children:s.jsx($u,{size:11,className:"text-white"})})]})]}),s.jsxs("p",{className:"text-[11px] text-slate-400 mt-1.5 text-center",children:["Inline · ",(SS.find(H=>H.value===T)||{}).label||"Standard"," width"," · ",(ES.find(H=>H.value===N)||{}).label||"Standard"," height"]})]})})]})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-4 border-t border-slate-100 dark:border-neutral-800 sticky bottom-0 bg-white dark:bg-neutral-900",children:[s.jsx("button",{type:"button",onClick:o,className:"px-4 py-2 rounded-xl text-sm font-medium text-slate-600 dark:text-neutral-300 hover:bg-slate-100 dark:hover:bg-neutral-800",children:"Cancel"}),s.jsxs("button",{type:"button",onClick:F,disabled:$,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-xl bg-primary-600 hover:bg-primary-700 disabled:opacity-50 text-white text-sm font-semibold",children:[$?s.jsx(vt,{size:14,className:"animate-spin"}):s.jsx(ft,{size:14}),u?"Save changes":"Create embed"]})]})]})}),document.body)}const LU=rne;function ttt({expertId:e,expertName:t,expertAvatarUrl:n,onStatusChange:r}){const{addToast:a}=f.useContext(Zs),[i,o]=f.useState(!0),[l,c]=f.useState(null),[u,d]=f.useState(""),[h,p]=f.useState(!1),[m,g]=f.useState(!1),[x,b]=f.useState(!1),[y,v]=f.useState(null),[w,j]=f.useState(null),[E,S]=f.useState(!1);f.useEffect(()=>{let U=!1;return XG(e).then(F=>{U||(c(F.data),d(F.data.domain||""))}).catch(()=>{U||c(null)}).finally(()=>{U||o(!1)}),()=>{U=!0}},[e]),f.useEffect(()=>{r?.(l?.key_id?{domain:l.domain,serving:!!l.serving}:null)},[l?.domain,l?.key_id,l?.serving,r]);const _=U=>{c(U),d(U.domain||""),p(!1),v(null),j(null)},k=()=>{if(!u.trim())return;const{domain:U,error:F}=Pj(u);d(F?u.trim():U),j(F)},C=async()=>{if(m)return;const{domain:U,error:F}=Pj(u);if(F){j(F);return}if(d(U),j(null),!l?.key_id){const{embedded_count:H,max_experts:G,plan:M}=l?.plan||{};if(H>=G){v({message:`Your plan covers ${G} embedded expert${G===1?"":"s"}. Upgrade to embed this one too, or remove another expert's website.`,upgradeable:M!=="pro"});return}v(null),S(!0);return}g(!0),v(null);try{const H=await x0(e,U);_(H.data),a("Website updated â the old one stops working now","success")}catch(H){const G=H?.response?.data?.detail;G?.code==="PLAN_LIMIT"?v(G):a(G?.message||"Could not save the website","error")}finally{g(!1)}},N=async()=>{if(window.confirm("Remove this embed? The snippet on your website stops working permanently â adding this expert back later gives you a new one to paste."))try{const U=await n0e(e);_(U.data),a("Embed removed","success")}catch{a("Could not remove the embed","error")}},A=async()=>{try{await navigator.clipboard.writeText(LU(l.key_id)),b(!0),setTimeout(()=>b(!1),2e3)}catch{a("Copy failed â select the snippet manually","error")}};if(i)return s.jsx("div",{className:"flex justify-center bg-cream py-10",children:s.jsx(vt,{className:"h-5 w-5 animate-spin text-ink-light"})});const T="space-y-3 bg-cream px-4 pb-5 pt-4 sm:px-5",I=l?.plan||{active:!1},$=!!l?.key_id,O=!$||h;return s.jsxs("div",{className:T,children:[O?s.jsxs("div",{className:"rounded-lg border border-rule bg-paper p-4",children:[s.jsx("label",{htmlFor:"embed-website",className:"mb-1.5 block text-sm font-semibold text-ink-soft",children:"Website"}),s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(vc,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-ink-light","aria-hidden":"true"}),s.jsx("input",{id:"embed-website",type:"text",value:u,onChange:U=>{d(U.target.value),j(null)},onBlur:k,onKeyDown:U=>{U.key==="Enter"&&C()},placeholder:"yourwebsite.com","aria-invalid":w?"true":void 0,"aria-describedby":w?"embed-website-error":"embed-website-hint",className:`h-10 w-full rounded-lg border bg-cream py-2 pl-9 pr-3.5 text-sm text-ink placeholder:text-ink-mid outline-none transition-colors duration-150 ease-out hover:bg-paper focus:bg-paper focus:shadow-focus ${w?"border-red-400 focus:border-red-500":"border-rule focus:border-indigo"}`})]}),s.jsxs("button",{type:"button",onClick:C,disabled:!u.trim()||m,className:"inline-flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-md bg-indigo px-4 text-sm font-medium text-cream transition-colors hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus disabled:opacity-50",children:[m?s.jsx(vt,{className:"w-4 h-4 animate-spin"}):null,$?"Save website":"Embed here"]}),$&&s.jsx("button",{type:"button",onClick:()=>{p(!1),d(l.domain||"")},className:"h-10 shrink-0 rounded-md px-3 text-sm font-medium text-ink-mid transition-colors hover:bg-[#f1f2f4] hover:text-ink focus-visible:outline-none focus-visible:shadow-focus",children:"Cancel"})]}),w?s.jsx("p",{id:"embed-website-error",role:"alert",className:"mt-1.5 text-[11px] text-red-600",children:w}):s.jsx("p",{id:"embed-website-hint",className:"mt-1.5 text-[11px] text-ink-mid",children:"Any page on this domain can use the embed."})]}):null,y&&s.jsxs("div",{className:"space-y-2.5 rounded-lg border border-amber-200 bg-amber-50 p-4",children:[s.jsx("p",{className:"text-sm text-amber-900",children:y.message}),y.upgradeable&&s.jsx(Le,{to:"/pricing?for=creators",className:"inline-flex h-10 items-center gap-2 rounded-md bg-indigo px-4 text-sm font-medium text-cream transition-colors hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus",children:"Upgrade to embed more experts"})]}),$&&!l.serving&&s.jsxs("div",{className:"space-y-2.5 rounded-lg border border-rule bg-paper p-4",children:[s.jsx("p",{className:"text-sm text-ink-mid",children:I.active?"Paused â your plan no longer covers it.":"Ready when you start a plan."}),s.jsx(Le,{to:"/pricing?for=creators",className:"inline-flex h-10 items-center gap-2 rounded-md bg-indigo px-4 text-sm font-medium text-cream transition-colors hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus",children:I.active?"Upgrade your plan":"Start a 7-day free trial"})]}),$&&s.jsxs("div",{className:"relative rounded-lg border border-rule bg-paper p-3",children:[s.jsx("p",{className:"mb-2 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-mid",children:"Embed code"}),s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-all rounded-md bg-[#f1f2f4] p-3 pr-12 font-mono text-[11px] leading-relaxed text-ink-mid",children:LU(l.key_id)}),s.jsx("button",{type:"button",onClick:A,className:"absolute bottom-5 right-5 flex h-8 w-8 items-center justify-center rounded-md border border-rule bg-paper text-ink-mid transition-colors hover:border-indigo/30 hover:bg-indigo-wash hover:text-indigo-deep focus-visible:outline-none focus-visible:shadow-focus","aria-label":"Copy snippet",children:x?s.jsx(ft,{className:"w-3.5 h-3.5 text-green-500"}):s.jsx(ju,{className:"w-3.5 h-3.5"})})]}),$&&!h?s.jsx("div",{className:"flex justify-center pt-1",children:s.jsxs("div",{className:"grid w-full grid-cols-3 overflow-hidden rounded-lg border border-rule bg-paper sm:w-auto",children:[s.jsxs("button",{type:"button",onClick:()=>p(!0),className:"inline-flex h-10 items-center justify-center gap-1.5 border-r border-rule px-3 text-xs font-medium text-ink-soft transition-colors hover:bg-indigo-wash hover:text-indigo-deep focus-visible:z-10 focus-visible:outline-none focus-visible:shadow-focus",children:[s.jsx(Mu,{className:"w-3.5 h-3.5"})," Change website"]}),s.jsxs("button",{type:"button",onClick:()=>S(!0),className:"inline-flex h-10 items-center justify-center gap-1.5 border-r border-rule px-3 text-xs font-medium text-ink-soft transition-colors hover:bg-indigo-wash hover:text-indigo-deep focus-visible:z-10 focus-visible:outline-none focus-visible:shadow-focus",children:[s.jsx(swe,{className:"h-3.5 w-3.5"})," Customize Look"]}),s.jsxs("button",{type:"button",onClick:N,className:"inline-flex h-10 items-center justify-center gap-1.5 px-3 text-xs font-medium text-destructive transition-colors hover:bg-red-50 hover:text-red-700 focus-visible:z-10 focus-visible:outline-none focus-visible:shadow-focus",children:[s.jsx(Qs,{className:"w-3.5 h-3.5"})," Remove"]})]})}):null,E&&s.jsx(ett,{expertId:e,expertName:t,expertAvatarUrl:n,domain:Vb(u),lockedAppearance:I.locked_appearance||[],existingConfig:$?l.config:void 0,onClose:()=>S(!1),onSaved:U=>{_(U),S(!1)}})]})}const OU={indigo:"bg-indigo-wash text-indigo-deep border-indigo-tint",peach:"bg-peach-tint text-peach-deep border-peach",cream:"bg-cream-deep text-ink-soft border-rule",green:"bg-emerald-50 text-emerald-700 border-emerald-200"},MU={sm:"text-[11px] px-2.5 py-0.5",md:"text-[13px] px-3 py-1"};function stt({children:e,tone:t="indigo",size:n="md",className:r="",...a}){return s.jsx("span",{className:`inline-flex items-center gap-1.5 rounded-pill border font-medium ${OU[t]||OU.indigo} ${MU[n]||MU.md} ${r}`,...a,children:e})}const ntt=6,tae=5,rtt=new Set(["x_profile","instagram_profile","facebook_page","linkedin_profile"]),att=new Set(["youtube","tiktok","instagram","facebook","linkedin","x"]),DU=[{key:"files",label:"Files"},{key:"videos",label:"Videos"},{key:"webpages",label:"Web pages"}];function sae(e){const t=e?.meta;if(!t)return{};if(typeof t=="string")try{const n=JSON.parse(t);return n&&typeof n=="object"?n:{}}catch{return{}}return typeof t=="object"?t:{}}function itt(e){if(!e)return!1;if(rtt.has(e.source_type))return!0;const t=sae(e);return!!t.kind&&att.has(t.platform)}function ott(e){return e?.source_type==="url"?"webpages":e?.source_type==="video_url"?"videos":"files"}function ltt(e){return String(e??"").trim().toLowerCase()}function ctt(e,t){const n=ltt(t);if(!n)return!0;const r=sae(e);return[e?.title,e?.source,r.webpage_url,r.original_url,r.video_metadata?.title].some(i=>typeof i=="string"&&i.toLowerCase().includes(n))}function $U(e,t=""){const n=(Array.isArray(e)?e:[]).filter(i=>i&&!itt(i)),r=n.filter(i=>ctt(i,t)),a={files:[],videos:[],webpages:[]};return r.forEach(i=>
510{a[ott(i)].push(i)}),{groups:a,visibleTotal:n.length,matchedTotal:r.length}}function utt(e){if(e?.source_type==="video_url"){const t=WP(e);return t.webpage_url||t.original_url||e.source||""}return e?.source_type==="url"&&e.source||""}function dtt({label:e,count:t,open:n,onToggle:r,controlsId:a}){return s.jsxs("button",{type:"button",onClick:r,"aria-expanded":n,"aria-controls":a,className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left transition-colors duration-150 ease-out hover:bg-cream focus-visible:outline-none focus-visible:shadow-focus",children:[s.jsx(Is,{className:`h-4 w-4 shrink-0 text-ink-mid transition-transform duration-150 ease-out ${n?"rotate-0":"-rotate-90"}`,"aria-hidden":"true"}),s.jsx("span",{className:"text-sm font-semibold text-ink-soft",children:e}),s.jsx(stt,{tone:"indigo",size:"sm",children:t})]})}function htt({doc:e,onDelete:t}){const n=cre(e),r=utt(e);return s.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-rule bg-paper px-4 py-3",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx(dre,{doc:e}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("p",{className:"truncate text-sm font-medium text-ink",children:n}),r&&s.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${n} in a new tab`,className:"shrink-0 text-ink-mid transition-colors duration-150 ease-out hover:text-indigo focus-visible:outline-none focus-visible:shadow-focus",children:s.jsx(Ro,{className:"h-3 w-3","aria-hidden":"true"})})]}),s.jsx("p",{className:"text-xs text-ink-mid",children:ure(e)})]})]}),s.jsx("button",{type:"button",onClick:()=>t?.(e.id),"aria-label":`Delete ${n}`,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full text-ink-mid transition-colors duration-150 ease-out hover:bg-peach-tint hover:text-destructive focus-visible:outline-none focus-visible:shadow-focus",children:s.jsx(Qs,{className:"h-4 w-4","aria-hidden":"true"})})]})}function ptt({items:e,label:t,onDelete:n,scrollable:r}){const a=f.useRef(null),[i,o]=f.useState({atTop:!0,atBottom:!r}),l=f.useCallback(()=>{const c=a.current;if(!c||!r){o({atTop:!0,atBottom:!0});return}o({atTop:c.scrollTop<=1,atBottom:c.scrollTop+c.clientHeight>=c.scrollHeight-1})},[r]);return f.useEffect(()=>{const c=window.requestAnimationFrame(l);return window.addEventListener("resize",l),()=>{window.cancelAnimationFrame(c),window.removeEventListener("resize",l)}},[e.length,l]),s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative",children:[r&&!i.atTop&&s.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 h-10 bg-gradient-to-b from-paper/90 via-paper/45 to-transparent","aria-hidden":"true"}),s.jsx("div",{ref:a,onScroll:l,tabIndex:r?0:void 0,"aria-label":r?`${t}: scroll to view all ${e.length} sources`:void 0,className:`space-y-2 ${r?"max-h-[23.25rem] overflow-y-auto overscroll-contain pr-2 focus-visible:outline-none focus-visible:shadow-focus":""}`,children:e.map(c=>s.jsx(htt,{doc:c,onDelete:n},c.id))}),r&&!i.atBottom&&s.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-10 h-10 bg-gradient-to-t from-paper/90 via-paper/45 to-transparent","aria-hidden":"true"})]}),r&&!i.atBottom&&s.jsxs("div",{className:"mt-2 flex items-center justify-center gap-1 text-[11px] font-medium text-indigo-deep",children:[s.jsx(oye,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Scroll to see ",e.length-tae," more"]})]})}function mtt({documents:e,onDelete:t}){const[n,r]=f.useState(""),[a,i]=f.useState(()=>{const{groups:m}=$U(e,""),g=DU.find(({key:x})=>m[x].length>0);return new Set(g?[g.key]:[])}),{groups:o,visibleTotal:l,matchedTotal:c}=f.useMemo(()=>$U(e,n),[e,n]),u=m=>{r(m.target.value)},d=()=>{r("")},h=m=>{i(g=>{const x=new Set(g);return x.has(m)?x.delete(m):x.add(m),x})},p=(m,g)=>n?g.length>0:a.has(m);return l===0?s.jsx("p",{className:"text-xs text-ink-mid",children:"No files, videos or web pages yet. Add them above."}):s.jsxs("div",{className:"space-y-3",children:[l>
510=ntt&&s.jsx(ul,{type:"search",icon:Fa,value:n,onChange:u,placeholder:"Search files, videos and web pages","aria-label":"Search files, videos and web pages"}),c===0&&n?s.jsxs("p",{className:"text-xs text-ink-mid",children:["No sources match â",n,"â."," ",s.jsx("button",{type:"button",onClick:d,className:"font-medium text-indigo-deep underline-offset-2 hover:underline focus-visible:outline-none focus-visible:shadow-focus",children:"Clear search"})]}):DU.map(({key:m,label:g})=>{const x=o[m];if(x.length===0)return null;const b=p(m,x),y=x.length>tae,v=`knowledge-library-${m}`;return s.jsxs("section",{"aria-label":g,children:[s.jsx(dtt,{label:g,count:x.length,open:b,controlsId:v,onToggle:()=>h(m)}),b&&s.jsx("div",{id:v,className:"mt-2",children:s.jsx(ptt,{items:x,label:g,onDelete:t,scrollable:y})})]},m)})]})}function ftt({className:e}){return s.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M4 5h16v12H8l-4 4V5z"})})}function gtt({className:e}){return s.jsxs("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"2"}),s.jsx("rect",{x:"13",y:"13",width:"8",height:"8",rx:"2"}),s.jsx("path",{d:"M7 11v3.5A2.5 2.5 0 0 0 9.5 17H13"})]})}function xtt({className:e}){return s.jsxs("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M12 20h9"}),s.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]})}function btt({isOpen:e,onClose:t,onChat:n,onLab:r}){return s.jsxs(en,{isOpen:e,onClose:t,children:[s.jsxs("div",{className:"flex items-center justify-center gap-2.5 mt-2 mb-4",children:[s.jsx("span",{className:"w-8 h-8 rounded-full bg-indigo/10 flex items-center justify-center shrink-0",children:s.jsx(pc,{className:"w-5 h-5 text-indigo"})}),s.jsx("h2",{className:"font-heading text-2xl font-medium text-ink tracking-tight",children:"Changes saved"})]}),s.jsxs("p",{className:"text-sm text-ink-muted leading-relaxed text-center mb-6",children:["Your expert has been updated.",s.jsx("br",{}),"What would you like to do next?"]}),s.jsxs("div",{className:"flex flex-col gap-2.5",children:[s.jsx(yt,{icon:ftt,onClick:n,className:"w-full justify-center",children:"Test in chat"}),s.jsx(yt,{icon:gtt,variant:"secondary",onClick:r,className:"w-full justify-center",children:"Back to My experts"}),s.jsx(yt,{icon:xtt,variant:"secondary",onClick:t,className:"w-full justify-center",children:"Keep editing"})]})]})}function nae({value:e,className:t="",...n}){const r=f.useRef(null),a=()=>{const i=r.current;i&&(i.style.height="auto",i.style.height=`${i.scrollHeight}px`)};return f.useEffect(a,[e]),s.jsx("textarea",{ref:r,value:e,onInput:a,className:t,...n})}const g5=80,ytt=3;function kv(e){const t=Array.isArray(e)?e.filter(n=>typeof n=="string"):[];return Array.from({length:ytt},(n,r)=>t[r]||"")}function TS(e){return(Array.isArray(e)?e:[]).map(t=>String(t||"").trim().slice(0,g5)).filter(Boolean)}const FU=5;function $o({isOpen:e,children:t}){return s.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-in-out ${e?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:s.jsx("div",{className:"overflow-hidden",children:t})})}function Nv({id:e,label:t,description:n,value:r,onChange:a,onGenerate:i,generating:o,generateDisabled:l,maxLength:c,placeholder:u,rows:d=4}){return s.jsxs("div",{className:"rounded-lg border border-rule bg-paper p-4",children:[s.jsx("label",{htmlFor:e,className:"block text-sm font-semibold text-ink-soft",children:t}),s.jsx("p",{className:"mt-1 text-xs leading-relaxed text-ink-mid",children:n}),s.jsxs("div",{className:"mt-2",children:[s.jsx(nae,{id:e,value:r,onChange:h=>a(h.target.value),maxLength:c,rows:d,placeholder:u,className:"max-h-[20rem] w-full resize-none overflow-y-auto rounded-lg border border-rule bg-cream px-3 py-2.5 text-sm leading-relaxed text-ink placeholder:text-ink-mid outline-none transition-colors duration-150 ease-out hover:bg-paper focus:border-indigo focus:bg-paper focus:shadow-focus"}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"font-mono text-[10px] text-ink-mid",children:[r.length,"/",c]}),s.jsxs("button",{type:"button",onClick:i,disabled:l,"aria-label":`Generate ${t} with AI`,className:"inline-flex h-10 items-center gap-2 rounded-md border border-indigo/25 bg-indigo-wash px-4 text-xs font-medium text-indigo-deep transition-colors duration-150 ease-out hover:border-indigo/40 hover:bg-indigo/10 focus-visible:outline-none focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-50",children:[o?s.jsx(vt,{className:"h-4 w-4 animate-spin text-indigo"}):s.jsx(Ms,{className:"h-4 w-4 text-indigo"}),o?"Generatingâ¦":"Generate with AI"]})]})]})]})}function vtt({name:e,avatarUrl:t,description:n}){const r=e.trim()||"Your expert",a=n.trim()||"Your description will appear here and be shortened to fit the profile card.";return s.jsxs("div",{className:"mt-4",children:[s.jsx("p",{className:"mb-2 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-mid",children:"Profile card preview"}),s.jsx("div",{className:"overflow-hidden rounded-xl bg-[#1c274b] p-3 sm:p-4",children:s.jsxs("div",{className:"rounded-[20px] border border-[#7b263c] bg-[#512544] p-4 sm:p-5",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3 sm:gap-5",children:[s.jsx(ws,{name:r,src:t,size:"xl",variant:"expert",className:"h-16 w-16 shrink-0 border-0 text-base sm:h-[72px] sm:w-[72px]"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-lg font-medium text-white sm:text-xl",children:r}),s.jsx("p",{className:"mt-1 line-clamp-2 text-sm leading-6 text-white/55 sm:text-base",children:a})]}),s.jsx("span",{className:"hidden shrink-0 rounded-full bg-[#bd2719] px-6 py-3 text-sm font-medium text-white sm:inline-flex",children:"Chat now"})]}),s.jsx("span",{className:"mt-4 inline-flex w-full items-center justify-center rounded-full bg-[#bd2719] px-6 py-3 text-sm font-medium text-white sm:hidden",children:"Chat now"})]})})]})}function wtt({greeting:e,questions:t}){const n=e.trim()||"Your greeting will appear here before visitors choose a starter question.",r=t.map(a=>
510a.trim()).filter(Boolean).slice(0,3);return s.jsxs("div",{className:"mt-4",children:[s.jsx("p",{className:"mb-2 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-mid",children:"Chat preview"}),s.jsxs("div",{className:"rounded-xl border border-rule bg-paper px-4 py-5 sm:px-6 sm:py-6",children:[s.jsx("div",{className:"max-w-[86%] rounded-[18px] border border-rule bg-paper px-4 py-3 text-sm leading-relaxed text-ink sm:text-base",children:n}),s.jsx("div",{className:"ml-auto mt-5 flex w-full flex-col gap-2.5 sm:w-[62%]",children:r.length>0?r.map((a,i)=>s.jsx("div",{className:"w-full rounded-[18px] border border-indigo/30 bg-indigo-wash px-4 py-3 text-center text-sm font-semibold text-indigo-deep",children:a},`${i}-${a}`)):s.jsx("div",{className:"w-full rounded-[18px] border border-dashed border-indigo/30 bg-indigo-wash px-4 py-3 text-center text-sm text-indigo-deep",children:"Your starter questions will appear here."})})]})]})}const jtt=[3,5,10,15,20].map(e=>({value:e,label:`${e} messages`}));function _tt(){const{id:e}=Ef(),t=Ps(),n=an(),r=()=>{n.key!=="default"?t(-1):t(Me.LAB)},{addToast:a}=f.useContext(Zs),{updateExpert:i}=jc(),{isBusiness:o}=z_(),{removeRecentExpert:l}=A4(),c=f.useRef(null),[u,d]=f.useState(!0),[h,p]=f.useState(null),[m,g]=f.useState(""),[x,b]=f.useState(""),[y,v]=f.useState(""),[w,j]=f.useState(""),[E,S]=f.useState(!1),[_,k]=f.useState("Coach"),[C,N]=f.useState(!1),[A,T]=f.useState(!1),[I,$]=f.useState(20),[O,U]=f.useState(""),[F,H]=f.useState(["","",""]),[G,M]=f.useState(null),[z,W]=f.useState(""),D=f.useRef([]),[Z,V]=f.useState([]),L=f.useRef(!1),[K,te]=f.useState(""),[Q,Y]=f.useState(""),[J,P]=f.useState(""),[ee,X]=f.useState(""),[ae,me]=f.useState(""),[q,he]=f.useState(null),[se,le]=f.useState(null),[ke,oe]=f.useState(null),[Oe,Je]=f.useState(!0),[Ie,ue]=f.useState(null),be=new URLSearchParams(n.search).get("section"),[Re,Ge]=f.useState(()=>new Set(be?[be]:[])),it=f.useRef(!1);f.useEffect(()=>{if(!be||it.current||u)return;const Ce=document.getElementById(`section-${be}`);Ce&&(it.current=!0,Ce.scrollIntoView({block:"start",behavior:"smooth"}))},[be,u]);const[ut,$t]=f.useState([]),[tt,He]=f.useState(!1),[wt,St]=f.useState(!1),[Zt,Jt]=f.useState([]),[$e,Qe]=f.useState(""),[ct,ve]=f.useState(!1),[Ye,rt]=f.useState(""),[De,qe]=f.useState([]),[ye,Ze]=f.useState({}),jt=f.useRef({});f.useEffect(()=>()=>{Object.values(jt.current).forEach(({interval:Ce,timeouts:kt})=>{clearInterval(Ce),kt.forEach(clearTimeout)}),jt.current={}},[]);const[Nt,ne]=f.useState(!1),[ge,xe]=f.useState(!1),[pe,Ne]=f.useState(!1),[Ue,dt]=f.useState(!1),[Xe,xt]=f.useState(!1),et=f.useRef(null);f.useEffect(()=>()=>clearTimeout(et.current),[]);const[st,_t]=f.useState(!1),[zt,us]=f.useState(!1),[ms,We]=f.useState(""),[Dt,Ds]=f.useState(!1),[Ys,Ks]=f.useState(null),is=f.useRef(null);f.useEffect(()=>{(async()=>{try{const[kt,Kt]=await Promise.all([cu(e),mu(e).catch(Ft=>(console.error("EDIT_DOCS_LOAD_ERR",Ft),{data:{documents:[]}}))]),Et=kt.data.expert;p(Et),b(Et.name||""),v(Et.tagline||""),j(Et.description||""),k(wN(Et.communication_style||"Coach")),N(!!Et.is_public),T(!!Et.require_login_to_chat),$(Et.guest_free_messages??20),U(Et.greeting||""),H(kv(Et.custom_conversation_starters)),te(Et.system_prompt||""),Y(Et.style_directive||""),P(Et.stance||""),X(Et.style_examples||""),me(Et.persona_rules||""),oe(Et.voice_preset||null),Je(Et.voice_preset_enabled!==!1),ue(Et.behaviors?.quiz??null),We(Et.avatar_url||""),$t(Kt.data.documents||[])}catch(kt){console.error("EDIT_LOAD_ERR",kt),g("Expert not found.")}finally{d(!1)}})()},[e]),f.useEffect(()=>{!e||!Re.has("starters")||L.current||(L.current=!0,kh(e).then(Ce=>{const kt=Ce?.data?.starters;Array.isArray(kt)&&V(kt)}).catch(()=>{}))},[e,Re]);const es=f.useCallback(async()=>{if(e)try{const Ce=await mu(e);$t(Ce.data?.documents||[])}catch(Ce){console.error("refreshDocuments failed:",Ce)}},[e]);f.useEffect(()=>{if(!ut?.length)return;const Ce=/(?:[?&]v=|youtu\.be\/|\/shorts\/|\/embed\/)([a-zA-Z0-9_-]{11})/,kt=new Set(ut.map(Kt=>{const Et=(Kt.source||"").match(Ce);return Et?`yt:${Et[1]}`:Kt.source}));qe(Kt=>{const Et=Kt.filter(Ft=>{const js=(Ft.url||"").match(Ce),Fn=js?`yt:${js[1]}`:Ft.url;return!kt.has(Fn)});return Et.length===Kt.length?Kt:Et})},[ut]);const Fs=async Ce=>{const kt=Array.from(Ce.target.files||[]);if(!kt.length)return;if(kt.length>
51050){Qe(at.tooManyFiles),c.current&&(c.current.value="");return}St(!0),Qe("");const Kt=kt.map((Ft,js)=>{const Fn=bre(Ft,ut);return{key:`${Ft.name}-${Date.now()}-${js}`,name:Ft.name,status:Fn?"error":"uploading",error:Fn||null}});Jt(Ft=>[...Ft,...Kt]);const Et=Kt.map((Ft,js)=>({status:Ft,file:kt[js]})).filter(({status:Ft})=>Ft.status!=="error");if(Et.length)for(let Ft=0;Ft<Et.length;Ft+=FU){const js=Et.slice(Ft,Ft+FU);try{((await Cw(e,js.map(({file:Cn})=>Cn))).data?.files||[]).forEach(Cn=>{const Yn=js[Cn.index];if(!Yn)return;const Rr=Yn.status.key;Cn.status==="accepted"&&Cn.job_id?(Jt(tr=>tr.map($s=>$s.key===Rr?{...$s,status:"processing",jobId:Cn.job_id}:$s)),fn(Cn.job_id,Yn.file.name,{initialStages:Cn.stages||[]})):Jt(tr=>tr.map($s=>$s.key===Rr?{...$s,status:"error",error:Cn.message||at.fallback}:$s))})}catch(Fn){const Ea=Qo(Fn,{operation:"file"}),Cn=new Set(js.map(({status:Yn})=>Yn.key));Jt(Yn=>Yn.map(Rr=>Cn.has(Rr.key)?{...Rr,status:"error",error:Ea}:Rr))}}St(!1),c.current&&(c.current.value=""),setTimeout(()=>{Jt(Ft=>Ft.filter(js=>js.status!=="success"))},4e3)},fn=f.useCallback((Ce,kt,{platform:Kt=null,initialStages:Et=[]}={})=>{Ze(tr=>({...tr,[Ce]:{status:"pending",progress:0,message:Et[0]||"Starting...",url:kt,platform:Kt,stages:Et,stage_index:0}}));const Ft=Kt==null?"file":Kt==="web"?"url":"video",js={interval:null,timeouts:[]};jt.current[Ce]=js;let Fn=!1;const Ea=()=>{Fn=!0,clearInterval(js.interval),js.timeouts.forEach(clearTimeout),delete jt.current[Ce]},Cn=(tr=0)=>{setTimeout(()=>{Ze($s=>{const Sa={...$s};return delete Sa[Ce],Sa})},tr)},Yn=async()=>{Fn||(Ea(),Cn(),qe(tr=>tr.filter($s=>$s.jobId!==Ce)),Jt(tr=>tr.filter($s=>$s.jobId!==Ce)),await es())},Rr=async()=>{if(!Fn)try{const tr=await Xm(e,Ce);if(Fn)return;const $s=tr.data,Sa=$s.status==="failed"?wre({error:$s.error,message:$s.message,sourceType:Ft,platform:Kt,file:Ft==="file"?{name:kt}:null}):null;if(Ze(wr=>({...wr,[Ce]:{...wr[Ce]||{},status:$s.status,progress:$s.progress,message:$s.status==="failed"?Sa:wr[Ce]?.stillProcessing?UB:$s.message,stages:$s.stages||[],stage_index:$s.stage_index??0,url:kt,platform:Kt,result:$s.result,error:$s.error}})),$s.status==="completed"||$s.status==="failed"){Ea();const wr=$s.status==="completed",sg=wr?null:Sa;qe(Oo=>Oo.map(qa=>qa.jobId===Ce?{...qa,status:wr?"success":"error",error:sg}:qa)),Jt(Oo=>Oo.map(qa=>qa.jobId===Ce?{...qa,status:wr?"success":"error",error:sg}:qa)),wr&&(await es(),He(!0),setTimeout(()=>{Jt(Oo=>Oo.filter(qa=>qa.jobId!==Ce)),qe(Oo=>Oo.filter(qa=>qa.jobId!==Ce))},3e3)),Cn(3e3)}}catch(tr){if(Fn)return;if(tr.response?.status===404){await Yn();return}Ea();const $s=Qo(tr,{operation:"polling",sourceType:Ft,platform:Kt,file:Ft==="file"?{name:kt}:null});Ze(Sa=>({...Sa,[Ce]:{...Sa[Ce]||{url:kt,platform:Kt},status:"failed",progress:0,message:$s}})),qe(Sa=>Sa.map(wr=>wr.jobId===Ce?{...wr,status:"error",error:$s}:wr)),Jt(Sa=>Sa.map(wr=>wr.jobId===Ce?{...wr,status:"error",error:$s}:wr))}};js.interval=setInterval(Rr,hre),js.timeouts.push(setTimeout(()=>{Fn||(clearInterval(js.interval),js.interval=setInterval(Rr,pre),Ze(tr=>({...tr,[Ce]:{...tr[Ce]||{url:kt,platform:Kt,stages:Et,stage_index:0},status:"processing",message:UB,stillProcessing:!0}})),es())},mre)),js.timeouts.push(setTimeout(()=>{Yn()},fre))},[e,es]),Gn=async()=>{const{statuses:Ce,invalidCount:kt}=SQe(Ye,ut),Kt=Ce.filter(Ft=>Ft.status!=="error").map(Ft=>Ft.url),Et=CQe(Ce,Kt.length);if(!Kt.length){qe(Ce),Qe(Et);return}ve(!0),Qe(kt?Et:""),qe(Ce.map(Ft=>({...Ft,platform:zj(Ft.url)})));for(let Ft=0;Ft<Ce.length;Ft++){if(Ce[Ft].status==="error")continue;const js=Ce[Ft].url;try{const Fn=await S_(e,js,null,Ft);if(Fn.status==="accepted"&&Fn.data?.job_id){const Ea=Fn.data.job_id;qe(Cn=>Cn.map((Yn,Rr)=>Rr===Ft?{...Yn,status:"processing",jobId:Ea}:Yn)),fn(Ea,js,{platform:zj(js),initialStages:Fn.data.stages||[]})}else Fn.data?.document&&(await es(),He(!0),qe(Ea=>Ea.map((Cn,Yn)=>Yn===Ft?{...Cn,status:"success"}:Cn)))}catch(Fn){const Ea=Qo(Fn,{operation:"url",url:js});qe(Cn=>Cn.map((Yn,Rr)=>Rr===Ft?{...Yn,status:"error",error:Ea}:Yn))}}ve(!1),rt(""),setTimeout(()=>{qe(Ft=>Ft.filter(js=>js.status!=="success"))},3e3)},Xs=async Ce=>{$t(kt=>kt.filter(Kt=>Kt.id!==Ce)),He(!0);try{await FG(e,Ce),await es()}catch(kt){await es(),Qe(Qo(kt,{operation:"delete",fallback:at.deleteFailed}))}},fs=async()=>{ne(!0),Qe("");try{await BG(e),He(!1),a("Knowledge rebuilt. You can save your changes now.","success"),Obe(e).catch(()=>{})}catch(Ce){Qe(Qo(Ce,{operation:"build"}))}finally{ne(!1)}},Lt=G===null?F:F.map((Ce,kt)=>kt===G?z:Ce),yr=!!h&&(x.trim()!==(h.name||"").trim()||w.trim()!==(h.description||"").trim()||_!==wN(h.communication_style||"Coach")||C!==!!h.is_public||A!==!!h.require_login_to_chat||I!==(h.guest_free_messages??20)||O!==(h.greeting||"")||JSON.stringify(TS(Lt))!==JSON.stringify(TS(kv(h.custom_conversation_starters)))||K!==(h.system_prompt||"")||Q!==(h.style_directive||"")||J!==(h.stance||"")||ee!==(h.style_examples||"")||ae!==(h.persona_rules||"")||(ke||null)!==(h.voice_preset||null)||Oe!==(h.voice_preset_enabled!==!1)||JSON.stringify(Ie??null)!==JSON.stringify(h.behaviors?.quiz??null)),ta=()=>
510{if(!(!yr||pe)){if(tt){a(at.rebuildBeforeSave,"error");return}xe(!0)}},Js=async()=>{Ne(!0);try{const Ce={tagline:y,...w.trim().length>=10?{description:w.trim()}:{},system_prompt:K,greeting:O||null,custom_conversation_starters:TS(F),voice_preset:ke,voice_preset_enabled:Oe,require_login_to_chat:A,guest_free_messages:I,style_directive:Q,stance:J,style_examples:ee,persona_rules:ae};x.trim()!==(h.name||"").trim()&&(Ce.name=x.trim()),Ie&&(Ce.behaviors={quiz:{mode:Ie.mode||"direct",button_label:(Ie.button_label||"").trim()||null,voice_lang:(Ie.voice_lang||"").trim()||null,show_result:Ie.show_result!==!1,intro:(Ie.intro||"").trim()||null,assessment_hint:(Ie.assessment_hint||"").trim()||null,questions:(Ie.questions||[]).map(Et=>({text:(Et.text||"").trim(),options:(Et.options||[]).filter(Ft=>(Ft.label||"").trim()).map(Ft=>({label:Ft.label.trim(),points:Number(Ft.points)||0}))})).filter(Et=>Et.text&&Et.options.length>=2),levels:(Ie.levels||[]).filter(Et=>(Et.label||"").trim()&&(Et.form_url||"").trim()).map(Et=>({id:((Et.id||"").trim()||Et.label.trim()).slice(0,50),label:Et.label.trim(),form_url:Et.form_url.trim(),min_points:Number(Et.min_points)||0}))}}),await i(e,Ce);const kt=wN(h.communication_style||"Coach");_!==kt&&await UG(e,_),C!==!!h.is_public&&await YG(e,C);const Kt=await cu(e);Kt.data?.expert&&(p(Kt.data.expert),ue(Kt.data.expert.behaviors?.quiz??null),H(kv(Kt.data.expert.custom_conversation_starters))),kh(e,{force:!0}).then(Et=>{const Ft=Et?.data?.starters;Array.isArray(Ft)&&V(Ft)}).catch(()=>{}),xe(!1),dt(!0),xt(!0),clearTimeout(et.current),et.current=setTimeout(()=>xt(!1),5e3)}catch(Ce){a(Ce.response?.data?.detail?.message||"Failed to save changes.","error"),xe(!1)}finally{Ne(!1)}},vr=async()=>{if(!(E||pe)){S(!0);try{const Ce=await KG(e,{name:x.trim(),bio:w}),kt=(Ce?.data?.description||"").trim();if(!kt)throw new Error("empty description");if(Ce.data.from_example){a("Add knowledge or social links first â there is nothing factual to rewrite from yet.","error");return}j(kt)}catch(Ce){a(Ce.response?.data?.detail?.message||"Could not rewrite the description. Try again.","error")}finally{S(!1)}}},er=async(Ce,kt,Kt)=>{if(!(q||pe)){he(Ce);try{const Ft=((await Zbe(e,{field:Ce,current_value:kt,name:x.trim(),description:w,greeting:O,communication_style:_,stance:J,style_directive:Q,style_examples:ee,persona_rules:ae}))?.data?.value||"").trim();if(!Ft)throw new Error("empty persona field");Kt(Ft)}catch(Et){a(Et.response?.data?.detail?.message||"Could not generate persona text. Try again.","error")}finally{he(null)}}},Ha=()=>{dt(!1),t(`/experts/${h?.slug||e}/chat`)},to=()=>{dt(!1),t(Me.LAB)},Ec=()=>{_t(!0)},ii=async()=>{us(!0);try{await T_(e),l(e),a("Expert deleted successfully.","success"),t(Me.DASHBOARD)}catch(Ce){a(Ce.response?.data?.detail?.message||"Failed to delete expert.","error"),us(!1),_t(!1)}},pt=async Ce=>{const kt=Ce.target.files?.[0];if(is.current&&(is.current.value=""),!kt)return;if(!["image/png","image/jpeg","image/webp"].includes(kt.type)){a("Only PNG, JPEG, and WebP images are allowed.","error");return}if(kt.size>Ph){a(`Avatar must be under ${Lh}.`,"error");return}Ks(URL.createObjectURL(await A0(kt)))},Ot=()=>{Ys&&URL.revokeObjectURL(Ys),Ks(null)},Hs=async Ce=>{Ot(),Ds(!0);try{const kt=await T4(e,Ce);We(kt.data.avatar_url),a("Avatar updated.","success")}catch{a("Failed to upload avatar.","error")}finally{Ds(!1)}};if(u)return s.jsx(il,{text:"Loading expert..."});if(m||!h)return s.jsx("div",{className:"mx-auto max-w-3xl",children:s.jsxs("div",{className:"rounded-lg border border-rule bg-paper p-8 text-center shadow-subtle",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-lg bg-peach-tint",children:s.jsx(xr,{className:"h-7 w-7 text-destructive"})}),s.jsx("p",{className:"text-ink-mid",children:m||"Expert not found."}),s.jsx(yt,{variant:"secondary",onClick:()=>t(Me.DASHBOARD),className:"mt-4",children:"Back to dashboard"})]})});const vn=F.some(Ce=>Ce.trim()),on=vn?F:kv(Z),$n=(Ce,{cancel:kt=!1,restoreFocus:Kt=!1}={})=>{kt||H(Et=>{const Ft=vn?[...Et]:[...on];return Ft[Ce]=z,Ft}),M(null),Kt&&requestAnimationFrame(()=>D.current[Ce]?.focus())},oi=Ce=>{if(G===Ce){$n(Ce,{restoreFocus:!0});return}G!==null&&$n(G),W(on[Ce]||""),M(Ce)},Pe=Ce=>Ge(kt=>
510{const Kt=new Set(kt);return Kt.has(Ce)?Kt.delete(Ce):Kt.add(Ce),Kt}),At=!!(J.trim()||Q.trim()||ee.trim()||ae.trim()),ds=!!K.trim(),Bs="overflow-hidden rounded-xl border border-rule bg-paper transition-colors duration-150 ease-out hover:border-ink-light",qs=({sectionKey:Ce,icon:kt,title:Kt,badge:Et})=>{const Ft=Re.has(Ce),js=`w-4 h-4 ${Ft?"text-indigo":"text-ink-light"}`;return s.jsxs("button",{type:"button",id:`section-${Ce}`,"aria-expanded":Ft,onClick:()=>Pe(Ce),className:`flex min-h-14 w-full items-center justify-between px-4 py-3 text-left transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:shadow-focus scroll-mt-6 sm:px-5 ${Ft?"border-b border-rule bg-paper":"bg-paper hover:bg-cream"}`,children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.createElement(kt,{className:js}),s.jsx("span",{className:`text-[13px] font-medium ${Ft?"text-ink":"text-ink-mid"}`,children:Kt}),Et]}),s.jsx(Is,{className:`ml-2 h-4 w-4 shrink-0 text-ink-light transition-transform duration-200 ease-out ${Ft?"rotate-180":""}`})]})};return s.jsxs("div",{className:"mx-auto min-h-full max-w-3xl px-4 pb-28 pt-4 sm:px-6 sm:pb-10 sm:pt-6",children:[s.jsxs("header",{className:"mb-6 flex items-center gap-2",children:[s.jsx("button",{onClick:r,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full text-ink-mid transition-colors duration-150 ease-out hover:bg-cream-deep focus-visible:outline-none focus-visible:shadow-focus","aria-label":"Back",children:s.jsx(ja,{className:"h-4 w-4"})}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("h1",{className:"min-w-0 font-display text-2xl font-medium leading-tight tracking-[-0.015em] text-ink [overflow-wrap:anywhere]",children:"Edit expert"})})]}),s.jsx("div",{className:"mb-8",children:s.jsxs("div",{className:"grid min-w-0 grid-cols-1 items-start gap-5 md:grid-cols-[176px_minmax(0,1fr)] md:gap-6",children:[s.jsxs("div",{className:"flex justify-center md:justify-start",children:[s.jsxs("button",{type:"button",onClick:()=>is.current?.click(),disabled:Dt,className:"group relative inline-flex h-24 w-24 shrink-0 items-center justify-center rounded-full bg-paper p-1 ring-1 ring-rule focus-visible:outline-none focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-60 md:h-44 md:w-44","aria-label":"Change expert photo",children:[s.jsx(ws,{name:x||h?.name||"",size:"xl",className:"h-[88px] w-[88px] border-0 text-xl md:h-[168px] md:w-[168px] md:text-3xl",variant:"expert",src:ms}),s.jsx("span",{className:"absolute bottom-0 right-0 flex h-8 w-8 items-center justify-center rounded-full border border-rule bg-paper text-ink-mid transition-colors duration-150 ease-out group-hover:bg-indigo-wash group-focus-visible:bg-indigo-wash md:h-10 md:w-10",children:Dt?s.jsx("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-indigo border-t-transparent"}):s.jsx(Nh,{className:"h-4 w-4"})})]}),s.jsx("input",{ref:is,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:pt})]}),s.jsxs("div",{className:"min-w-0 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"expert-name",className:"mb-1 block text-[13px] font-medium text-ink-soft",children:"Expert name"}),s.jsxs("div",{className:"relative",children:[s.jsx(F4,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-light"}),s.jsx("input",{id:"expert-name",type:"text",placeholder:"e.g., Dr. John Doe",value:x,onChange:Ce=>b(Ce.target.value),className:"h-11 w-full rounded-md border border-rule bg-paper px-9 text-sm text-ink placeholder:text-ink-mid outline-none transition-colors duration-150 ease-out hover:bg-cream focus:border-indigo focus:bg-paper focus:shadow-focus"})]})]}),s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"expert-greeting",className:"mb-1 block text-[13px] font-medium text-ink-soft",children:["Greeting",s.jsx("span",{className:"ml-1.5 font-normal text-ink-mid",children:"Optional"})]}),s.jsxs("div",{className:"relative",children:[s.jsx("textarea",{id:"expert-greeting",value:O,onChange:Ce=>U(Ce.target.value),maxLength:800,rows:2,placeholder:"e.g., Hi, Iâm Dr. John â ask me anything about nutrition, supplements, or gut health.",className:"h-28 w-full resize-none overflow-y-auto rounded-md border border-rule bg-paper px-3 pb-7 pt-2.5 pr-14 text-sm leading-relaxed text-ink placeholder:text-ink-mid outline-none transition-colors duration-150 ease-out hover:bg-cream focus:border-indigo focus:bg-paper focus:shadow-focus"}),s.jsxs("span",{className:"absolute bottom-2.5 right-3 font-mono text-[10px] text-ink-mid",children:[O.length,"/800"]})]})]})]})]})}),s.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[s.jsxs("div",{className:Bs,children:[s.jsx(qs,{sectionKey:"description",icon:si,title:"About this expert"}),s.jsx($o,{isOpen:Re.has("description"),children:s.jsxs("div",{className:"bg-cream px-4 pb-5 pt-4 sm:px-5",children:[s.jsx("div",{className:"relative",children:s.jsx("textarea",{id:"expert-description","aria-label":"Expert description",value:w,onChange:Ce=>j(Ce.target.value),maxLength:2e3,rows:3,placeholder:"What does this expert help with, and who is it for?",className:"block h-40 w-full resize-none overflow-y-auto rounded-lg border border-rule bg-paper px-3 py-2.5 text-sm leading-relaxed text-ink placeholder:text-ink-mid outline-none transition-colors duration-150 ease-out hover:bg-cream focus:border-indigo focus:bg-paper focus:shadow-focus"})}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"font-mono text-[10px] text-ink-mid",children:[w.length,"/2000"]}),s.jsxs("button",{type:"button",disabled:pe||E,onClick:vr,className:"inline-flex h-10 items-center gap-2 rounded-md border border-indigo/25 bg-indigo-wash px-4 text-xs font-medium text-indigo-deep transition-colors duration-150 ease-out hover:border-indigo/40 hover:bg-indigo/10 focus-visible:outline-none focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-50",children:[E?s.jsx(vt,{className:"h-4 w-4 animate-spin text-indigo"}):s.jsx(Ms,{className:"h-4 w-4 text-indigo"}),E?"Rewritingâ¦":"Rewrite with AI"]})]}),w.trim().length>0&&w.trim().length<10&&s.jsx("p",{className:"mt-1 text-[12px] text-ink-mid",children:"Needs at least 10 characters to save."}),s.jsx(vtt,{name:x,avatarUrl:ms,description:w})]})})]}),s.jsxs("div",{className:Bs,children:[s.jsx(qs,{sectionKey:"starters",icon:M4,title:"Starter questions"}),s.jsx($o,{isOpen:Re.has("starters"),children:s.jsxs("div",{className:"bg-cream px-4 pb-5 pt-4 sm:px-5",children:[s.jsx("ol",{className:"space-y-3",children:on.map((Ce,kt)=>{const Kt=G===kt;return s.jsxs("li",{className:`flex min-h-16 min-w-0 items-center gap-4 roun
510ded-lg border bg-paper py-2 pl-4 pr-2 transition-colors duration-150 ease-out ${Kt?"border-indigo shadow-focus":"border-rule hover:bg-cream"}`,children:[s.jsx("span",{className:"shrink-0 font-mono text-[11px] text-ink-light",children:String(kt+1).padStart(2,"0")}),Kt?s.jsxs("div",{className:"relative min-w-0 flex-1",children:[s.jsx("input",{autoFocus:!0,"aria-label":`Starter question ${kt+1}`,type:"text",value:z,maxLength:g5,onChange:Et=>W(Et.target.value),onBlur:()=>$n(kt),onKeyDown:Et=>{Et.key==="Enter"&&(Et.preventDefault(),$n(kt,{restoreFocus:!0})),Et.key==="Escape"&&(Et.preventDefault(),$n(kt,{cancel:!0,restoreFocus:!0}))},placeholder:Ce.trim()||Z[kt]||"e.g. How much does a session cost?",className:"h-11 w-full min-w-0 bg-transparent pb-3 pr-12 pt-0.5 text-sm text-ink placeholder:text-ink-mid outline-none"}),s.jsxs("span",{className:"pointer-events-none absolute bottom-0 right-1 font-mono text-[10px] text-ink-mid",children:[z.length,"/",g5]})]}):s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx("p",{className:`text-sm leading-snug [overflow-wrap:anywhere] ${Ce.trim()?"text-ink":"text-ink-light"}`,children:Ce.trim()||"Not set"})}),s.jsx("button",{ref:Et=>{D.current[kt]=Et},type:"button","aria-label":`Edit starter question ${kt+1}`,"aria-pressed":Kt,onMouseDown:Et=>Et.preventDefault(),onClick:()=>oi(kt),className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-full transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:shadow-focus ${Kt?"bg-indigo-wash text-indigo-deep":"text-indigo hover:bg-indigo-wash hover:text-indigo-deep"}`,children:s.jsx(Mu,{className:"h-4 w-4"})})]},kt)})}),s.jsx(wtt,{greeting:O,questions:on})]})})]}),s.jsxs("div",{className:Bs,children:[s.jsx(qs,{sectionKey:"knowledge",icon:Ou,title:"Knowledge base"}),s.jsx($o,{isOpen:Re.has("knowledge"),children:s.jsxs("div",{className:"space-y-4 bg-cream px-4 pb-5 pt-4 sm:px-5",children:[s.jsxs("div",{className:"rounded-lg border border-rule bg-paper p-4",children:[s.jsxs("h3",{className:"mb-1 flex items-center gap-2 text-sm font-semibold text-ink-soft",children:[s.jsx(Lw,{className:"h-4 w-4 text-indigo"}),"Upload documents"]}),s.jsx("p",{className:"mb-3 text-xs leading-relaxed text-ink-mid",children:"Give your expert the knowledge it needs â upload files like guides, manuals, reports, or any reference material."}),s.jsx("input",{ref:c,type:"file",className:"hidden",accept:".txt,.md,.pdf,.csv,.json,.docx,.doc,.xlsx,.xls,.png,.jpg,.jpeg,.webp,.mp4,.mov,.avi,.webm,.mkv,.m4v,.flv,.wmv,.m4a,.epub",multiple:!0,onChange:Fs}),s.jsxs("button",{type:"button",className:"w-full cursor-pointer rounded-lg border border-dashed border-indigo/25 bg-cream p-5 text-center transition-colors duration-150 ease-out hover:border-indigo/40 hover:bg-indigo-wash focus-visible:outline-none focus-visible:shadow-focus",onClick:()=>c.current?.click(),onDragOver:Ce=>Ce.preventDefault(),onDrop:Ce=>{Ce.preventDefault();const kt=Ce.dataTransfer.files;kt.length&&Fs({target:{files:kt}})},children:[wt?s.jsx(vt,{className:"mx-auto h-6 w-6 animate-spin text-indigo"}):s.jsx(Lw,{className:"mx-auto mb-1.5 h-6 w-6 text-indigo"}),s.jsx("span",{className:"block text-sm font-medium text-ink-soft",children:wt?"Uploading...":"Drop files here or click to upload"}),s.jsx("span",{className:"mt-1 block text-xs text-ink-mid",children:"Supports documents, spreadsheets, e-books (EPUB), images, and videos"})]}),Zt.length>0&&s.jsx("div",{className:"space-y-1.5 mt-3",children:Zt.map(Ce=>{const Kt=(Ce.jobId?ye[Ce.jobId]:null)?.message;return s.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[(Ce.status==="uploading"||Ce.status==="processing")&&s.jsx(vt,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-indigo"}),Ce.status==="success"&&s.jsx(Aw,{className:"w-3.5 h-3.5 text-emerald-500 shrink-0 mt-0.5"}),Ce.status==="error"&&s.jsx(zT,{className:"w-3.5 h-3.5 text-red-500 shrink-0 mt-0.5"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:`block truncate ${Ce.status==="error"?"text-red-700":"text-ink-mid"}`,children:Ce.name}),Ce.status==="processing"&&Kt&&s.jsxs("p",{className:"mt-0.5 text-[11px] text-ink-mid",children:[Kt,"â¦"]}),Ce.error&&s.jsx("p",{className:"mt-0.5 text-red-700",children:Ce.error})]})]},Ce.key)})})]}),s.jsxs("div",{className:"rounded-lg border border-rule bg-paper p-4",children:[s.jsx("div",{className:"flex items-center mb-1",children:s.jsxs("h3",{className:"flex items-center gap-2 text-sm font-semibold text-ink-soft",children:[s.jsx(wb,{className:"h-4 w-4 text-indigo"}),"Add multiple links"]})}),s.jsx("p",{className:"mb-3 text-xs leading-relaxed text-ink-mid",children:"Paste one or more URLs, one per line. We support websites, YouTube, Vimeo, TikTok, and more."}),s.jsxs("div",{className:"relative",children:[s.jsx("textarea",{className:"block h-36 w-full resize-none overflow-y-auto rounded-lg border border-rule bg-cream px-4 pb-16 pt-3 text-sm text-ink placeholder:text-ink-mid outline-none transition-colors duration-150 ease-out hover:bg-paper focus:border-indigo focus:bg-paper focus:shadow-focus",rows:4,placeholder:`https://example.com/article 511https://youtube.com/watch?v=... 512https://vimeo.com/...`,value:Ye,onChange:Ce=>rt(Ce.target.value),disabled:ct}),s.jsx(yt,{onClick:Gn,isLoading:ct,disabled:!Ye.trim(),className:"absolute bottom-4 right-4 h-10 !rounded-md",children:"Process all"})]}),De.length>0&&s.jsx("div",{className:"space-y-1.5 mt-3",children:De.map((Ce,kt)=>{const Et=(Ce.jobId?ye[Ce.jobId]:null)?.message;return s.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[Ce.status==="processing"&&s.jsx(vt,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-indigo"}),Ce.status==="success"&&s.jsx(Aw,{className:"w-3.5 h-3.5 text-emerald-500 shrink-0 mt-0.5"}),Ce.status==="error"&&s.jsx(zT,{className:"w-3.5 h-3.5 text-red-500 shrink-0 mt-0.5"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:`break-all ${Ce.status==="error"?"text-red-700":"text-ink-mid"}`,children:Ce.url}),Ce.status==="processing"&&Et&&s.jsxs("p",{className:"mt-0.5 text-[11px] text-ink-mid",children:[Et,"â¦"]}),Ce.error&&s.jsx("p",{className:"mt-0.5 text-red-700",children:Ce.error})]})]},kt)})})]}),s.jsxs("div",{className:"rounded-lg border border-rule bg-paper p-4",children:[s.jsx("h3",{className:"mb-3 text-sm font-semibold text-ink-soft",children:"Your knowledge library"}),s.jsx(mtt,{documents:ut,onDelete:Xs}),$e&&s.jsx("div",{className:"mt-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3",children:s.jsx("p",{className:"text-sm text-red-700",children:$e})}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-rule pt-3",children:[s.jsx(yt,{onClick:fs,isLoading:Nt,disabled:ut.length===0,variant:"ghost",size:"sm",icon:_b,className:"!rounded-md !px-2.5 !py-1.5 text-[11px]",children:Nt?"Rebuildingâ¦":"Rebuild knowledge"}),ut.length===0&&s.jsx("p",{className:"text-[11px] text-ink-mid",children:"Add a source first."}),tt&&s.jsxs("p",{className:"flex items-center gap-1 text-[11px] text-amber-700",children:[s.jsx(xr,{className:"h-3 w-3"}),"Rebuild before saving"]})]})]})]})})]}),s.jsxs("div",{className:Bs,children:[s.jsx(qs,{sectionKey:"voice",icon:uu,title:"Voice"}),s.jsx($o,{isOpen:Re.has("voice"),children:s.jsx(Qet,{expertId:e,onPresetEnabledChange:Je,selectedPreset:ke,onPresetChange:oe})})]}),!o&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:Bs,children:[s.jsxs("div",{className:"relative",children:[s.jsx(qs,{sectionKey:"access",icon:Zi,title:"Guest access"}),s.jsx("span",{className:"absolute right-11 top-3",children:s.jsx(Ru,{label:"What is a guest?",children:"A guest is anyone chatting with your expert without logging in to a Great Experts account, on your profile page or your website widget."})})]}),s.jsx($o,{isOpen:Re.has("access"),children:s.jsxs("div",{className:"space-y-4 bg-cream px-4 pb-5 pt-4 sm:px-5",children:[s.jsxs("button",{type:"button",role:"switch","aria-checked":A,"aria-labelledby":"require-login-label","aria-describedby":"require-login-help",onClick:()=>T(Ce=>!Ce),className:"flex w-full items-start gap-3 rounded-lg border border-rule bg-paper p-4 text-left focus:outline-none focus-visible:shadow-focus",children:[s.jsx("span",{className:`relative mt-0.5 inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors ${A?"bg-indigo":"bg-slate-300"}
512`,children:s.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${A?"translate-x-4":"translate-x-0.5"}`})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{id:"require-login-label",className:"block text-sm font-semibold text-ink-soft",children:"Require login to chat"}),s.jsx("span",{id:"require-login-help",className:"mt-0.5 block text-xs leading-snug text-ink-mid",children:"Visitors log in before their first message or call. Their question is kept and sent right after."})]})]}),s.jsxs("div",{className:`rounded-lg border border-rule bg-paper p-4 ${A?"opacity-60":""}`,children:[s.jsx("p",{className:"mb-1.5 text-sm font-semibold text-ink-soft",children:"Messages before login"}),s.jsx(xu,{label:"Messages before login",value:I,disabled:A,onChange:$,options:jtt,className:"sm:w-44",fixed:!0}),s.jsx("p",{className:"mt-1.5 text-xs leading-snug text-ink-mid",children:A?"Not used while login is required.":"How many answers a logged-out visitor gets before confirming their email."})]})]})})]}),s.jsxs("div",{className:Bs,children:[s.jsxs("div",{className:"relative",children:[s.jsx(qs,{sectionKey:"money",icon:Iye,title:"Subscription"}),s.jsx("span",{className:"absolute right-11 top-3",children:s.jsx(Ru,{label:"About audience subscriptions",children:"Set the subscription your audience pays to access this expert. This is separate from your own creator plan."})})]}),s.jsx($o,{isOpen:Re.has("money"),children:s.jsx(Get,{expertId:e})})]}),s.jsxs("div",{className:Bs,children:[s.jsx(qs,{sectionKey:"embed",icon:rY,title:"Embed on your website",badge:se?.domain?s.jsxs("span",{className:"ml-1 flex min-w-0 items-center gap-1.5 rounded-md bg-[#f1f2f4] px-2 py-1 text-[10px] font-medium text-ink-mid",children:[s.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${se.serving?"bg-green-500":"bg-amber-400"}`}),s.jsxs("span",{className:"max-w-[10rem] truncate sm:max-w-[18rem]",children:[se.serving?"Live on":"Set up for"," ",se.domain]})]}):null}),s.jsx($o,{isOpen:Re.has("embed"),children:s.jsx(ttt,{expertId:e,expertName:x,expertAvatarUrl:ms,onStatusChange:le})})]})]}),!o&&Ie!==null&&s.jsxs("div",{className:Bs,children:[s.jsx(qs,{sectionKey:"quiz",icon:If,title:"Quiz mode"}),s.jsx($o,{isOpen:Re.has("quiz"),children:s.jsx("div",{className:"bg-cream px-4 pb-5 pt-4 sm:px-5",children:s.jsx(Ket,{expertId:e,value:Ie,onChange:ue})})})]}),s.jsxs("div",{className:Bs,children:[s.jsx(qs,{sectionKey:"persona",icon:Ms,title:"Persona",badge:At?s.jsx("span",{className:"rounded-md bg-indigo-wash px-2 py-0.5 text-[10px] font-medium text-indigo-deep",children:"Added"}):s.jsx("span",{className:"text-[11px] font-normal text-ink-mid",children:"Optional"})}),s.jsx($o,{isOpen:Re.has("persona"),children:s.jsxs("div",{className:"space-y-3 bg-cream px-4 pb-5 pt-4 sm:px-5",children:[s.jsx(Nv,{id:"persona-stance",label:"General approach",description:"How your expert approaches topics and gives advice.",value:J,onChange:P,onGenerate:()=>er("stance",J,P),generating:q==="stance",generateDisabled:!!q||pe,maxLength:2e3,placeholder:"e.g., Evidence first. Be clear about professional limits."}),s.jsx(Nv,{id:"persona-style",label:"How they talk",description:"Tone and answer structure.",value:Q,onChange:Y,onGenerate:()=>er("style_directive",Q,Y),generating:q==="style_directive",generateDisabled:!!q||pe,maxLength:2e3,placeholder:"e.g., Direct and warm. Answer first, then explain."}),s.jsx(Nv,{id:"persona-examples",label:"Response examples",description:"Example phrases, one per line.",value:ee,onChange:X,onGenerate:()=>er("style_examples",ee,X),generating:q==="style_examples",generateDisabled:!!q||pe,maxLength:2e3,rows:5,placeholder:`Here is the practical version⦠513The tradeoff is simpleâ¦`}),s.jsx(Nv,{id:"persona-rules",label:"Always",description:"Short rules, one per line.",value:ae,onChange:me,onGenerate:()=>er("persona_rules",ae,me),generating:q==="persona_rules",generateDisabled:!!q||pe,maxLength:1e3,placeholder:`Stay specific. 514Acknowledge uncertainty. 515Never use hype.`})]})})]}),s.jsxs("div",{className:Bs,children:[s.jsx(qs,{sectionKey:"advanced",icon:NY,title:"Custom instructions",badge:ds?s.jsx("span",{className:"rounded-md bg-indigo-wash px-2 py-0.5 text-[10px] font-medium text-indigo-deep",children:"Added"}):s.jsx("span",{className:"text-[11px] font-normal text-ink-mid",children:"Optional"})}),s.jsx($o,{isOpen:Re.has("advanced"),children:s.jsx("div",{className:"bg-cream px-4 pb-5 pt-4 sm:px-5",children:s.jsxs("div",{className:"rounded-lg border border-rule bg-paper p-4",children:[s.jsx("label",{htmlFor:"expert-instructions",className:"sr-only",children:"Instructions"}),s.jsx("p",{className:"mb-2 text-xs leading-relaxed text-ink-mid",children:"Extra always/never rules."}),s.jsxs("div",{className:"relative",children:[s.jsx(nae,{id:"expert-instructions",value:K,onChange:Ce=>te(Ce.target.value),maxLength:15e3,rows:8,placeholder:"e.g., Ask about allergies before supplement advice.",className:"max-h-[28rem] w-full resize-none overflow-y-auto rounded-lg border border-rule bg-cream px-3 pb-7 pt-2.5 font-mono text-sm text-ink placeholder:text-ink-mid outline-none transition-colors duration-150 ease-out hover:bg-paper focus:border-indigo focus:bg-paper focus:shadow-focus"}),s.jsxs("span",{className:"absolute bottom-2 left-3 font-mono text-[10px] text-ink-mid",children:[K.length,"/15000"]})]})]})})})]})]}),s.jsxs("div",{className:"mt-8 hidden items-center justify-between pb-4 pt-2 sm:flex",children:[s.jsx("button",{onClick:Ec,className:"inline-flex h-11 items-center whitespace-nowrap rounded-full px-4 text-sm font-medium text-ink-mid transition-colors duration-150 ease-out hover:bg-peach-tint hover:text-destructive focus-visible:outline-none focus-visible:shadow-focus",children:"Delete expert"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("span",{role:"status","aria-hidden":!Xe,className:`inline-flex items-center gap-1.5 text-[12.5px] font-semibold text-ink transition-opacity duration-200 ${Xe?"opacity-100":"opacity-0"}`,children:[s.jsx(ft,{className:"h-4 w-4","aria-hidden":"true"}),"Saved"]}),s.jsx("button",{onClick:ta,disabled:!yr||pe,className:"inline-flex h-11 items-center whitespace-nowrap rounded-xl bg-indigo px-6 text-sm font-medium text-cream transition-colors duration-150 ease-out hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus disabled:cursor-not-allowed disabled:bg-ink/10 disabled:text-ink-mid disabled:hover:bg-ink/10",children:"Save changes"})]})]}),s.jsxs("div",{className:"safe-area-bottom fixed bottom-0 left-0 right-0 z-30 flex items-center justify-between border-t border-rule bg-paper/95 px-4 py-3 backdrop-blur-sm sm:hidden",children:[s.jsx("button",{onClick:Ec,className:"inline-flex h-11 items-center whitespace-nowrap rounded-full px-4 text-sm font-medium text-ink-mid transition-colors duration-150 ease-out hover:bg-peach-tint hover:text-destructive focus-visible:outline-none focus-visible:shadow-focus",children:"Delete"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{role:"status","aria-hidden":!Xe,className:`inline-flex items-center gap-1 text-xs font-semibold text-ink transition-opacity duration-200 ${Xe?"opacity-100":"opacity-0"}`,children:[s.jsx(ft,{className:"h-4 w-4","aria-hidden":"true"}),"Saved"]}),s.jsx("button",{onClick:ta,disabled:!yr||pe,className:"inline-flex h-11 items-center whitespace-nowrap rounded-xl bg-indigo px-5 text-sm font-medium text-cream transition-colors duration-150 ease-out hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus disabled:cursor-not-allowed disabled:bg-ink/10 disabled:text-ink-mid disabled:hover:bg-ink/10",children:"Save changes"})]})]}),ge&&Mn.createPortal(s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/40",children:s.jsxs("div",{className:"mx-4 max-w-sm rounded-lg border border-rule bg-paper p-6 shadow-overlay
515sm:p-8",children:[s.jsx("h3",{className:"mb-4 font-display text-xl font-medium text-ink",children:"Save changes?"}),s.jsx("p",{className:"mb-6 text-sm leading-relaxed text-ink-mid",children:"Are you sure you want to save these changes to your expert?"}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(yt,{variant:"secondary",onClick:()=>xe(!1),className:"min-w-[5rem] !rounded-xl",children:"Cancel"}),s.jsx(yt,{onClick:Js,isLoading:pe,className:"min-w-[5rem] !rounded-xl",children:"Confirm"})]})]})}),document.body),s.jsx(T0,{isOpen:!!Ys,imageSrc:Ys,onCancel:Ot,onSave:Hs}),s.jsx(btt,{isOpen:Ue,onClose:()=>dt(!1),onChat:Ha,onLab:to}),st&&Mn.createPortal(s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/40",children:s.jsxs("div",{className:"mx-4 max-w-sm rounded-lg border border-rule bg-paper p-6 shadow-overlay sm:p-8",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-peach-tint",children:s.jsx(xr,{className:"h-5 w-5 text-destructive"})}),s.jsx("h3",{className:"font-display text-xl font-medium text-ink",children:"Delete expert?"})]}),s.jsxs("p",{className:"mb-6 text-sm leading-relaxed text-ink-mid",children:['Are you sure you want to delete "',h?.name,'"? This action cannot be undone and all data will be permanently lost.']}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(yt,{variant:"secondary",onClick:()=>_t(!1),className:"min-w-[5rem]",children:"Cancel"}),s.jsx(yt,{variant:"danger",onClick:ii,isLoading:zt,className:"min-w-[5rem]",children:"Delete"})]})]})}),document.body)]})}const ktt=["All","Business","Technology","Education","Health","Creativity","Legal","Science","Finance","Lifestyle","Other"],rae=[{value:"recommended",label:"Recommended"},{value:"newly_added",label:"Newest"},{value:"popularity",label:"Most Popular"},{value:"highly_rated",label:"Highest Rated"},{value:"name",label:"Name (A-Z)"}],AS=12;function Ntt(e,t){if(t<=7)return Array.from({length:t},(r,a)=>a+1);const n=[];n.push(1),e>3&&n.push("...");for(let r=Math.max(2,e-1);r<=Math.min(t-1,e+1);r++)n.push(r);return e<t-2&&n.push("..."),n.push(t),n}function BU(){const e=Ps(),t=an(),{user:n}=Ut(),r=!!n;f.useEffect(()=>{t.pathname==="/explore"&&e("/explore/experts",{replace:!0})},[t.pathname,e]);const[a,i]=f.useState([]),[o,l]=f.useState(!0),[c,u]=f.useState(""),[d,h]=f.useState("All"),[p,m]=f.useState("recommended"),[g,x]=f.useState(1),[b,y]=f.useState(null);f.useEffect(()=>{let _=!1;async function k(){try{const C={sort:p};d!=="All"&&(C.category=d);const N=await Xbe(C);_||i(N.data?.experts||[])}catch{}finally{_||l(!1)}}return k(),()=>{_=!0}},[p,d]),f.useEffect(()=>{x(1)},[c,d,p]);const w=f.useMemo(()=>{if(!c)return a;const _=c.toLowerCase();return a.filter(k=>k.name?.toLowerCase().includes(_)||k.description?.toLowerCase().includes(_)||k.creator_name?.toLowerCase().includes(_))},[a,c]),j=Math.ceil(w.length/AS),E=w.slice((g-1)*AS,g*AS),S=_=>{x(_),window.scrollTo({top:0,behavior:"smooth"})};return s.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-8 space-y-8 min-h-full flex flex-col",children:[s.jsxs("div",{children:[s.jsx("span",{className:"font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:"DISCOVER · EXPLORE"}),s.jsx("h1",{className:"text-5xl font-bold text-slate-900 dark:text-white mt-2",children:"Experts"}),s.jsx("p",{className:"text-sm text-slate-400 dark:text-neutral-500 mt-2",children:"Discover experts built by the community"})]}),s.jsxs("div",{className:"max-w-2xl focus-within:max-w-full transition-all duration-300 relative group",children:[s.jsx("div",{className:"absolute inset-y-0 left-5 flex items-center pointer-events-none",children:s.jsx(Fa,{className:"text-slate-400 dark:text-neutral-500 group-focus-within:text-slate-700 dark:group-focus-within:text-white transition-colors",size:20})}),s.jsx("input",{type:"text",value:c,onChange:_=>u(_.target.value),placeholder:"Search experts...",className:"w-full pl-14 pr-12 py-3.5 border border-slate-200 dark:border-white/10 bg-slate-50 dark:bg-white/5 rounded-xl focus:outline-none focus:ring-1 focus:ring-slate-300 dark:focus:ring-white/20 focu
515s:bg-white dark:focus:bg-white/10 text-slate-900 dark:text-white placeholder:text-slate-400 dark:placeholder:text-neutral-500 transition-all text-sm"}),s.jsx(Ei,{children:c&&s.jsx(Dn.button,{initial:{opacity:0,scale:1},animate:{opacity:1,scale:1},exit:{opacity:0,scale:1},transition:{duration:.15},onClick:()=>u(""),className:"absolute inset-y-0 right-5 flex items-center text-slate-400 dark:text-neutral-500 hover:text-slate-700 dark:hover:text-white transition-colors",children:s.jsx(as,{size:18})})})]}),(()=>{const _=ktt,k=d,C=h;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"sm:hidden relative",children:[s.jsx("div",{className:"overflow-x-auto no-scrollbar -mx-4 px-4",children:s.jsx("div",{className:"flex gap-2 w-max",children:_.map(N=>s.jsx("button",{onClick:()=>C(N),className:`shrink-0 px-3.5 py-1.5 rounded-full text-sm font-medium border transition-colors ${k===N?"bg-slate-900 dark:bg-white text-white dark:text-black border-slate-900 dark:border-white":"bg-transparent text-slate-500 dark:text-neutral-400 border-slate-200 dark:border-white/20 hover:border-slate-400 dark:hover:border-white/40 hover:text-slate-700 dark:hover:text-white"}`,children:N},N))})}),s.jsx("p",{className:"text-[10px] text-slate-400 dark:text-neutral-500 text-center mt-2",children:"Swipe for more â"})]}),s.jsx("div",{className:"hidden sm:flex flex-wrap gap-3",children:_.map(N=>s.jsx("button",{onClick:()=>C(N),className:`px-4 py-1.5 rounded-full text-sm font-medium border transition-colors ${k===N?"bg-slate-900 dark:bg-white text-white dark:text-black border-slate-900 dark:border-white":"bg-transparent text-slate-500 dark:text-neutral-400 border-slate-200 dark:border-white/20 hover:border-slate-400 dark:hover:border-white/40 hover:text-slate-700 dark:hover:text-white"}`,children:N},N))})]})})(),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-eyebrow text-ink-muted",children:[w.length," expert",w.length!==1?"s":"",c&&s.jsxs(s.Fragment,{children:[" matching â",c,"â"]})]}),s.jsx(Ett,{value:p,onChange:m,options:rae})]}),s.jsx(Ei,{mode:"wait",children:s.jsxs(Dn.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.15},className:"flex-1 flex flex-col",children:[o?s.jsx("div",{className:"text-center py-16",children:s.jsx("div",{className:"w-6 h-6 border-2 border-slate-300 dark:border-neutral-600 border-t-slate-600 dark:border-t-neutral-300 rounded-full animate-spin mx-auto"})}):E.length===0?s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-16 space-y-2",children:[s.jsx("p",{className:"text-xl font-bold text-primary-600 dark:text-primary-400",children:"No experts found"}),s.jsx("p",{className:"text-sm text-slate-400 dark:text-neutral-500",children:"Try a different search or category."})]}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-16",children:E.map(_=>s.jsx(Stt,{expert:_,onClick:()=>y(_)},_.id))}),s.jsx("div",{className:"flex-1"}),j>1&&s.jsxs("div",{className:"flex items-center justify-center gap-1 pt-16",children:[s.jsx("button",{onClick:()=>S(g-1),disabled:g===1,className:"w-8 h-8 flex items-center justify-center rounded-xl text-slate-400 dark:text-neutral-500 hover:bg-slate-100 dark:hover:bg-neutral-800 disabled:opacity-30 transition-colors",children:s.jsx(Wh,{size:16})}),Ntt(g,j).map((_,k)=>_==="..."?s.jsx("span",{className:"w-8 h-8 flex items-center justify-center text-xs text-slate-400 dark:text-neutral-500",children:"..."},`dots-${k}`):s.jsx("button",{onClick:()=>S(_),className:`w-8 h-8 flex items-center justify-center rounded-xl text-xs font-medium transition-colors ${_===g?"bg-primary-600 text-white":"text-slate-500 dark:text-neutral-400 hover:bg-slate-100 dark:hover:bg-neutral-800"}`,children:_},_)),s.jsx("button",{onClick:()=>S(g+1),disabled:g===j,className:"w-8 h-8 flex items-center justify-center rounded-xl text-slate-400 dark:text-neutral-500 hover:bg-slate-100 dark:hover:bg-neutral-800 disabled:opacity-30 transition-colors",children:s.jsx(hn,{size:16})})]})]},"experts")}),s.jsx(Ei,{children:b&&s.jsx(Ctt,{onClose:()=>y(null),children:s.jsxs("div",{className:"p-6 relative",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h2",{className:"text-lg font-bold text-slate-900 dark:text-white",children:"Expert profile"}),s.jsx(X0,{expert:b})]}),s.jsxs("div",{className:"text-center mb-6",children:[s.jsx("div",{className:"mx-auto mb-4",children:s.jsx(ws,{name:b.name,size:"2xl",variant:"expert",src:b.avatar_url})}),s.jsx("h3",{className:"text-2xl font-bold text-slate-900 dark:text-white mb-1",children:b.name}),s.jsxs("p",{className:"text-sm text-slate-500 dark:text-neutral-400",children:["By ",b.creator_name||"Unknown"]})]}),s.jsxs("div",{className:"rounded-xl bg-slate-50 dark:bg-white/5 mb-6 relative",children:[s.jsx("div",{className:"p-4 max-h-40 overflow-y-auto custom-scrollbar",children:s.jsx("p",{className:"text-sm leading-relaxed text-slate-600 dar
515k:text-neutral-300",children:b.description})}),(b.description?.length||0)>300&&s.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-paper to-transparent rounded-b-xl pointer-events-none"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-6 mb-6 text-sm text-slate-500 dark:text-neutral-400",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ea,{size:14})," ",b.answer_count||0," answers"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(eo,{size:14})," ",b.thumbs_up||0]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(wc,{size:14})," ",b.thumbs_down||0]})]}),s.jsx("button",{onClick:()=>{const _=`/experts/${b.slug||b.id}/chat`;y(null),r?e(_):e("/login",{state:{from:{pathname:_}}})},className:"w-full py-3 rounded-md font-medium flex items-center justify-center gap-2 bg-indigo-wash text-indigo-deep border border-indigo hover:bg-indigo hover:text-cream transition-colors duration-300 ease-standard",children:r?s.jsxs(s.Fragment,{children:[s.jsx(ea,{size:18})," Start chat"]}):s.jsxs(s.Fragment,{children:[s.jsx(fY,{size:18})," Login to chat"]})})]})})})]})}function Ett({value:e,onChange:t,options:n=rae}){const[r,a]=f.useState(!1),i=f.useRef(null);f.useEffect(()=>{if(!r)return;const l=c=>{i.current&&!i.current.contains(c.target)&&a(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);const o=n.find(l=>l.value===e)?.label||"Sort";return s.jsxs("div",{className:"relative",ref:i,children:[s.jsxs("button",{onClick:()=>a(l=>!l),className:"flex items-center gap-1 text-xs text-ink-mid hover:text-ink transition-colors",children:["Sort by: ",s.jsx("span",{className:"font-medium",children:o})," ",s.jsx(Is,{size:12})]}),r&&s.jsx("div",{className:"absolute right-0 top-full mt-1 bg-white dark:bg-neutral-800 border border-slate-200 dark:border-neutral-700 rounded-xl shadow-xl z-50 min-w-[160px] p-1",children:n.map(l=>s.jsxs("button",{onClick:()=>{t(l.value),a(!1)},className:`w-full flex items-center justify-between px-3 py-2 rounded-xl text-sm transition-colors ${e===l.value?"text-primary-600 dark:text-primary-400 bg-primary-50 dark:bg-primary-900/20 font-medium":"text-slate-600 dark:text-neutral-300 hover:bg-slate-50 dark:hover:bg-neutral-700"}`,children:[l.label,e===l.value&&s.jsx(ft,{size:14})]},l.value))})]})}function Stt({expert:e,onClick:t}){return s.jsxs("button",{onClick:t,className:"flex items-start gap-4 text-left group w-full",children:[s.jsx(ws,{name:e.name,size:"2xl",variant:"expert",src:e.avatar_url,className:"shrink-0 !w-[72px] !h-[72px] !text-2xl"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("h3",{className:"font-bold text-slate-900 dark:text-white truncate",children:e.name}),s.jsx(HP,{expert:e})]}),s.jsx("p",{className:"text-sm text-slate-500 dark:text-neutral-400 line-clamp-3 leading-relaxed h-[4.5rem]",children:e.description}),s.jsxs("p",{className:"text-xs text-slate-400 dark:text-neutral-500 mt-1.5 flex items-center justify-between transition-colors",children:[s.jsxs("span",{className:"group-hover:text-primary-600 dark:group-hover:text-primary-400 transition-colors duration-300",children:["By ",e.creator_name||"Unknown"]}),s.jsxs("span",{className:"flex items-center gap-2.5",children:[s.jsxs("span",{className:"flex items-center gap-0.5 group-hover:text-ink transition-colors duration-300",children:[s.jsx(ea,{size:10})," ",e.answer_count||0]}),s.jsxs("span",{className:"flex items-center gap-0.5 group-hover:text-green-600 transition-colors duration-300",children:[s.jsx(eo,{size:10})," ",e.thumbs_up||0]}),s.jsxs("span",{className:"flex items-center gap-0.5 group-hover:text-destructive transition-colors duration-300",children:[s.jsx(wc,{size:10})," ",e.thumbs_down||0]})]})]})]})]})}function Ctt({children:e,onClose:t}){return Mn.createPortal(s.jsxs(s.Fragment,{children:[s.jsx(Dn.div,{initial:{opacity:0}
515,animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 z-[60] bg-ink/60"}),s.jsx(Dn.div,{initial:{opacity:0,scale:1,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:1,y:20},className:"fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none",children:s.jsx("div",{className:"w-full max-w-md rounded-xl pointer-events-auto bg-white dark:bg-neutral-900 border border-slate-200 dark:border-white/10 shadow-2xl",children:e})})]}),document.body)}async function aae(e,t){return(await Se.post("/subscriptions/checkout",{expert_id:e,...t?{return_path:t}:{}})).data}async function UU(){return(await Se.get("/subscriptions/mine")).data}async function Ttt(e){return(await Se.post(`/subscriptions/${e}/cancel`)).data}async function QP(e,{target:t="_self",returnPath:n}={}){const a=(await aae(e,n))?.data?.url;if(!a)throw new Error("Checkout did not return a URL.");return t==="_blank"?window.open(a,"_blank","noopener,noreferrer"):window.location.assign(a),a}function Hk({expert:e,className:t="",onSubscribed:n,checkoutTarget:r="_self",label:a,returnPath:i}){const o=Ps(),{isAuthenticated:l}=Ut(),{addToast:c}=f.useContext(Zs),[u,d]=f.useState(!1),h=e?.subscription?.price_usd,p=!!e?.access?.is_subscribed;if(!h||p)return null;const m=async()=>{if(!l){o(`/login?redirect=${encodeURIComponent(window.location.pathname)}`);return}d(!0);try{await QP(e.id,{target:r,returnPath:i||`${window.location.pathname}${window.location.search}`}),typeof n=="function"&&n(),r==="_blank"&&d(!1)}catch(g){const x=g.response?.data?.detail?.code,b=g.response?.data?.detail?.message;c(x==="PAYMENTS_DISABLED"?"Subscriptions are not enabled in this environment yet.":b||"Could not start checkout. Please try again.","error"),d(!1)}};return s.jsxs("button",{type:"button",onClick:m,disabled:u,className:t||"inline-flex items-center gap-2 px-5 py-2.5 rounded-md text-sm font-medium bg-indigo text-cream hover:bg-indigo-deep transition-colors disabled:opacity-60",children:[u&&s.jsx(vt,{className:"w-4 h-4 animate-spin"}),u?"Redirectingâ¦":a||`Subscribe â $${Number(h).toFixed(2)}/mo`]})}function Att({expert:e,messages:t,onClearChat:n,onNewChat:r,onMenuClick:a,desktopCollapsed:i,onToggleDesktop:o,isFullscreen:l,onToggleFullscreen:c}){const[u,d]=f.useState(!1),h=()=>{d(!1),n()};return s.jsxs(s.Fragment,{children:[s.jsxs("header",{className:"h-14 relative z-10 flex items-center justify-between px-4 lg:px-6 flex-shrink-0 bg-cream",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[a&&s.jsx("button",{onClick:a,className:"w-9 h-9 flex items-center justify-center rounded-md text-ink-muted hover:bg-cream-deep transition-colors lg:hidden","aria-label":"Open sidebar",children:s.jsx(Pw,{className:"w-[17px] h-[17px]"})}),i&&o&&s.jsx("button",{onClick:o,className:"hidden lg:flex w-8 h-8 items-center justify-center rounded-md text-ink-light hover:text-ink-mid hover:bg-cream-deep transition-colors","aria-label":"Expand sidebar",children:s.jsx(Pw,{className:"w-[17px] h-[17px]"})}),e&&s.jsx("div",{className:"flex items-center gap-3",children:s.jsx("h1",{className:"font-heading font-medium text-[17px] text-ink tracking-tight",children:e.name})})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Hk,{expert:e,className:"hidden sm:inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-peach-deep text-cream hover:bg-peach transition-colors"}),r&&s.jsx("button",{onClick:r,className:"w-8 h-8 flex items-center justify-center rounded-md text-ink-light hover:text-indigo hover:bg-indigo-wash transition-colors","aria-label":"New chat",title:"New chat",children:s.jsx(Es,{className:"w-4 h-4"})}),n&&s.jsx("button",{onClick:()=>d(!0),className:"w-8 h-8 flex items-center justify-center rounded-md text-ink-light hover:text-destructive hover:bg-peach-tint transition-colors","aria-label":"Clear chat",children:s.jsx(Qs,{className:"w-4 h-4"})}),c&&s.jsx("button",{onClick:c,className:"w-8 h-8 flex items-center justify-center rounded-md text-ink-light hover:text-indigo hover:bg-indigo-wash transition-colors","aria-label":l?"Exit full screen":"Full screen",title:l?"Exit full screen":"Full screen",children:l?s.jsx(vY,{className:"w-4 h-4"}):s.jsx(O4,{className:"w-4 h-4"})}),s.jsx(X0,{expert:e,children:({openShare:p})=>s.jsx("div",{className:"flex items-center gap-0.5 bg-cream-deep border border-rule rounded-pill p-0.5",children:s.jsxs("button",{onClick:p,className:"flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-pill transition-colors text-ink-mid hover:text-ink hover:bg-cream-tint","aria-label":"Share expert link",title:"Share expert link",children:[s.jsx(Of,{className:"w-3.5 h-3.5"}),s.jsx("span",{className:"hidden sm:inline",children:"Share expert"})]})})}),s.jsx(Ik,{expert:e,messages:t,source:"platform"})]})]}),u&&Mn.createPortal(s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/40 p-4",children:s.jsxs("div",{className:"bg-paper rounded-lg border border-rule shadow-overlay p-6 sm:p-8 max-w-sm w-full",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"w-10 h-10 rounded-md bg-peach-tint border border-peach flex items-center justify-center shrink-0",children:s.jsx(xr,{className:"w-5 h-5 text-destructive"})}),s.jsx("h3",{className:"font-heading text-xl font-medium text-ink tracking-tight",children:"Clear chat?"})]}),s.jsx("p",{className:"text-sm text-ink-mid mb-6 leading-relaxed",children:"Are you sure? All messages in this conversation will be permanently deleted."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(yt,{variant:"secondary",onClick:()=>d(!1),className:"min-w-[5rem]",children:"Cancel"}),s.jsx(yt,{variant:"danger",onClick:h,className:"min-w-[5rem]",children:"Clear"})]})]})}),document.body)]})}const Rtt=new Set([".","!","?"]),Itt=new Set([` 516`,"Ø","ã","ï¼","ï¼","।"]),Ptt=new Set([" ",`
517`,'"',"'",")","]"]);function iae(e){if(!e)return[];const t=[];let n=0;for(let r=0;r<e.length;r+=1){const a=e[r];if(!(Itt.has(a)||Rtt.has(a)&&(r+1===e.length||Ptt.has(e[r+1]))))continue;let o=r+1;for(;o<e.length&&(e[o]===" "||e[o]===` 518`);)o+=1;const l=e.slice(n,o);l.trim()&&t.push(l),n=o,r=o-1}if(n<e.length){const r=e.slice(n);r.trim()&&t.push(r)}return t}const Ltt=13;function Ott(e){if(e&&typeof e=="object")return{now:Number(e.now)||0,playAt:Number(e.playAt)||0};const t=Number(e)||0;return{now:t,playAt:t}}function Mtt(e,t,n){const a=(typeof e.start=="number"?e.start:0)+Math.max(.45,(e.text||"").length/Ltt);return typeof t?.start=="number"?t.start:typeof n=="number"&&n>a?n:a}function Dtt(e,t,n){if(!Array.isArray(e)||e.length===0)return 0;let r=0;for(let a=0;a<e.length;a+=1){const i=e[a].text||"",o=typeof e[a].start=="number"?e[a].start:null;if(o==null){if(a===e.length-1)return r;r+=i.length;continue}if(t<o)return r;const l=Mtt(e[a],e[a+1],n),c=Math.max(.05,l-o);if(t<l||a===e.length-1){const u=Math.min(1,(t-o)/c);return r+Math.min(i.length,Math.floor(u*i.length))}r+=i.length}return r}function $tt(e,t){if(!Array.isArray(e)||e.length===0)return 0;for(let n=0;n<e.length;n+=1)if(t<e[n].end)return n;return e.length-1}const Ftt="2.05rem",Btt=3;function Utt(e){const t=e?.textContent||"";if(!e||!t)return[];const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=[];for(let u=n.nextNode();u;u=n.nextNode())r.push(u);if(!r.length)return[{start:0,end:t.length,text:t}];const a=document.createRange(),i=[];let o=0,l=0,c=null;for(const u of r){const d=u.data.length;for(let h=0;h<d;h+=1){a.setStart(u,h),a.setEnd(u,Math.min(h+1,d));const p=a.getClientRects()[0];p&&(c!==null&&p.top>c+2&&(i.push({start:l,end:o+h,text:t.slice(l,o+h).replace(/\s+$/,"")}),l=o+h),c=p.top)}o+=d}return i.push({start:l,end:t.length,text:t.slice(l).replace(/\s+$/,"")}),i.filter(u=>u.text.length)}function ztt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n].start!==t[n].start||e[n].end!==t[n].end||e[n].text!==t[n].text)return!1;return!0}function Htt({text:e,units:t,speaking:n=!1,reducedMotion:r=!1,audioNowRef:a}){const i=f.useRef(null),[o,l]=f.useState([]),[c,u]=f.useState(0),d=f.useMemo(()=>Array.isArray(t)&&t.length?t:iae(e).map(x=>({text:x})),[t,e]),h=()=>{const x=i.current;if(!x)return;const b=Utt(x);l(y=>ztt(y,b)?y:b)};if(f.useLayoutEffect(()=>{h()},[e]),f.useEffect(()=>{const x=i.current;if(!x||typeof ResizeObserver!="function")return;const b=new ResizeObserver(()=>{h()});return b.observe(x),()=>b.disconnect()},[e]),f.useEffect(()=>{if(!n)return;let x;const b=()=>{x=requestAnimationFrame(b);const y=Ott(a?.current?.()),v=Dtt(d,y.now,y.playAt),w=$tt(o,v);u(j=>j===w?j:w)};return x=requestAnimationFrame(b),()=>cancelAnimationFrame(x)},[n,d,o,a]),!e)return null;const p=o.length?o:[{start:0,end:e.length,text:e}],m=Math.min(c,p.length-1),g=1-m;return s.jsxs("div",{className:"relative mt-2 w-full",children:[s.jsx("p",{ref:i,dir:"auto","aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 top-0 -z-10 m-0 w-full text-center font-heading text-xl leading-relaxed text-transparent",children:e}),s.jsx("div",{role:"region","aria-label":"Live transcript",className:"relative overflow-hidden",style:{"--caption-line":Ftt,height:`calc(${Btt} * var(--caption-line))`},children:s.jsx("div",{dir:"auto",className:"motion-reduce:transition-none",style:{transform:`translateY(calc(${g} * var(--caption-line)))`,transition:r?"none":"transform 280ms cubic-bezier(0.16, 1, 0.3, 1)"},children:p.map((x,b)=>{const y=n&&b===m;return s.jsx("div",{"aria-current":y?"true":void 0,"aria-live":y?"polite":void 0,className:`flex items-center justify-center overflow-hidden text-center font-heading text-xl leading-snug motion-reduce:transition-none transition-colors duration-base ease-standard ${y?"text-ink":n?"text-ink-muted":"text-ink-soft"}`,style:{height:"var(--caption-line)"},children:s.jsx("span",{className:"block w-full truncate",children:x.text})},`${x.start}:${x.end}`)})})})]})}const zU=24e3,Ev=12,qtt=2e3,Wtt="Your mic is muted while you fill this in. The call resumes when you close it.";function HU(e,t){e.getByteTimeDomainData(t);let n=0;for(let r=0;r<t.length;r++){const a=(t[r]-128)/128;n+=a*a}return Math.min(1,Math.sqrt(n/t.length)*4)}
518function oae({expert:e,conversationId:t=null,language:n,onClose:r,presentation:a="fullscreen"}){const[i,o]=f.useState("connecting"),[l,c]=f.useState(""),[u,d]=f.useState({user:"",expert:"",units:[]}),[h,p]=f.useState(!1),[m,g]=f.useState(0),[x,b]=f.useState(300),[y,v]=f.useState(!1),[w,j]=f.useState(0),[E,S]=f.useState([]),[_,k]=f.useState(!1),[C,N]=f.useState(!1),[A,T]=f.useState(!0),[I,$]=f.useState(!1),O=f.useRef(null),U=f.useRef(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches).current,F=f.useRef({ws:null,ac:null,stream:null,proc:null,src:null,playAt:0,closed:!1,muted:!1,srcs:[],outGain:null,micAn:null,outAn:null,conversationId:t??null,hadTurn:!1,seconds:0,failed:!1,micOpen:!1,limitReached:!1,muteBeforeForm:null}),H=f.useRef({user:"",expert:"",units:[],phase:"user"}),G=f.useRef(()=>({now:F.current.ac?.currentTime??0,playAt:F.current.playAt??0}));f.useEffect(()=>{const q=F.current;q.closed=!1;const he=se=>{q.failed=!0,q.srcs.forEach(le=>{try{le.stop()}catch{}}),q.srcs=[],q.proc&&(q.proc.onaudioprocess=null);try{q.proc?.disconnect(),q.src?.disconnect()}catch{}try{q.stream?.getTracks().forEach(le=>le.stop())}catch{}try{q.ws?.readyState===WebSocket.CONNECTING?q.ws.addEventListener("open",()=>q.ws?.close(),{once:!0}):q.ws?.close()}catch{}try{q.ac?.close()}catch{}q.closed||(c(se),o("error"))};return(async()=>{try{const se=navigator.mediaDevices.getUserMedia({audio:{channelCount:{ideal:1},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}).then(be=>q.closed||q.failed?(be.getTracks().forEach(Re=>Re.stop()),be):(q.stream=be,be));se.catch(()=>{});const le=new(window.AudioContext||window.webkitAudioContext)({sampleRate:zU});q.ac=le,q.playAt=le.currentTime,q.outGain=le.createGain(),q.outGain.connect(le.destination),q.outAn=le.createAnalyser(),q.outAn.fftSize=512,q.outGain.connect(q.outAn);const ke=new WebSocket(await xZe(e.id,t,n));ke.binaryType="arraybuffer",q.ws=ke;const oe=be=>{const Re=(Array.isArray(be)?be:[]).filter(Ge=>Ge?.type==="profile_elements"&&Ge?.version===1).flatMap(Ge=>Array.isArray(Ge.elements)?Ge.elements:[]).filter(Ge=>Ge&&typeof Ge=="object"&&typeof Ge.ref=="string");Re.length&&S(Ge=>{const it=new Set(Ge.map(tt=>tt.ref)),ut=[];if(Re.forEach(tt=>{it.has(tt.ref)||(it.add(tt.ref),ut.push(tt))}),!ut.length)return Ge;const $t=Ge.concat(ut);return $t.length>Ev?$t.slice(-Ev):$t})},Oe=be=>{const Re=H.current;if(be.role==="user")Re.phase!=="user"&&(Re.user="",Re.expert="",Re.units=[],Re.phase="user"),Re.user=be.final?be.text||Re.user:be.text||Re.user+(be.delta||""),be.final&&Re.user.trim()&&(q.hadTurn=!0);else if(Re.phase="expert",be.final){const Ge=be.text||Re.expert;if(Re.expert=Ge,!Re.units.length&&Ge){const it=q.ac?Math.max(q.ac.currentTime,q.playAt):0;Re.units=iae(Ge).map(ut=>({text:ut,start:it}))}}else if(be.delta){const Ge=q.ac?Math.max(q.ac.currentTime,q.playAt):0;Re.units.push({text:be.delta,start:Ge}),Re.expert+=be.delta}d({user:Re.user,expert:Re.expert,units:Re.units.slice()})};ke.onmessage=be=>{if(typeof be.data=="string"){try{const tt=JSON.parse(be.data);tt.type==="status"?(tt.state==="listening"&&(q.micOpen=!0),o(tt.state)):tt.type==="caption"?Oe(tt):tt.type==="profile_elements"?oe(tt.blocks):tt.type==="conversation"?q.conversationId=tt.id:tt.type==="voice_limit"?b(Math.max(0,Number(tt.remaining_seconds)||0)):tt.type==="limit_reached"?(q.limitReached=!0,q.limitReason=tt.reason||null,v(!0)):tt.type==="error"?tt.severity!=="turn"&&he(tt.message||"Voice transcription failed."):tt.type==="action"&&tt.name==="open_contact"?(k(!0),U0(e.id,{notice:Wtt})):tt.type==="flush"&&(q.srcs.forEach(He=>{try{He.stop()}catch{}}),q.srcs=[],q.playAt=le.currentTime)}catch{}return}if(le.state!=="running"&&le.state!=="closed")try{Promise.resolve(le.resume()).catch(()=>{})}catch{}const Re=new Int16Array(be.data),Ge=new Float32Array(Re.length);for(let tt=0;tt<Re.length;tt++)Ge[tt]=Re[tt]/32768;const it=le.createBuffer(1,Ge.length,zU);it.getChannelData(0).set(Ge);const ut=le.createBufferSource();ut.buffer=it,ut.connect(q.outGain);const $t=Math.max(le.currentTime,q.playAt);ut.start($t),q.playAt=$t+it.duration,q.srcs.push(ut),ut.onended=()=>{q.srcs=q.srcs.filter(tt=>tt!==ut)}}
518,ke.onerror=()=>he("Connection error."),ke.onclose=be=>{console.info("[voice] ws closed",be.code,be.reason||""),!q.closed&&!q.failed&&r?.({conversationId:q.conversationId,hadTurn:q.hadTurn,seconds:q.seconds,reason:(()=>{if(q.limitReason==="time_limit")return"time-limit";if(q.limitReason==="plan_minutes")return"plan-minutes";if(q.limitReached||be.reason==="email_verification_required")return"email-verification-required"})()})},await new Promise((be,Re)=>{ke.onopen=be,ke.addEventListener("error",()=>Re(new Error("ws")),{once:!0})});const Je=await se;if(q.closed)return;const Ie=le.createMediaStreamSource(Je);q.src=Ie,q.micAn=le.createAnalyser(),q.micAn.fftSize=512,Ie.connect(q.micAn);const ue=le.createScriptProcessor(2048,1,1);q.proc=ue,ue.onaudioprocess=be=>{if(!q.micOpen||ke.readyState!==WebSocket.OPEN||q.limitReached)return;const Re=be.inputBuffer.getChannelData(0),Ge=new Int16Array(Re.length);if(!q.muted)for(let it=0;it<Re.length;it++){const ut=Math.max(-1,Math.min(1,Re[it]));Ge[it]=ut<0?ut*32768:ut*32767}ke.send(Ge.buffer)},Ie.connect(ue),ue.connect(le.destination)}catch(se){he(se?.message==="ws"?"Could not connect the call.":se?.name==="NotAllowedError"||se?.name==="PermissionDeniedError"?"Microphone access is blocked. Allow the microphone for this site in your browser settings, then try again.":se?.name==="NotFoundError"||se?.name==="OverconstrainedError"?"No microphone was found. Connect one and try again.":se?.message||"Could not start voice.")}})(),()=>{q.closed=!0;try{q.ws?.send(JSON.stringify({type:"end"}))}catch{}try{q.proc?.disconnect(),q.src?.disconnect()}catch{}try{q.stream?.getTracks().forEach(se=>se.stop())}catch{}try{q.ws?.close()}catch{}try{q.ac?.close()}catch{}}},[]),f.useEffect(()=>{if(i!=="connecting")return;const q=setInterval(()=>j(he=>Math.min(he+1,2)),qtt);return()=>clearInterval(q)},[i]);const M=i!=="connecting"&&i!=="error";f.useEffect(()=>{if(!M)return;const q=setInterval(()=>{g(se=>(F.current.seconds=se+1,se+1));const he=F.current;he.ac&&$(he.ac.state==="running"&&he.playAt>he.ac.currentTime+.05)},1e3);return()=>clearInterval(q)},[M]),f.useEffect(()=>{if(U)return;const q=F.current;let he,se=0,le=0;const ke=new Uint8Array(256),oe=()=>{he=requestAnimationFrame(oe);const Oe=O.current;!Oe||!q.ac||(q.micAn&&(se=Math.max(HU(q.micAn,ke),se*.88)),q.outAn&&(le=Math.max(HU(q.outAn,ke),le*.88)),Oe.style.setProperty("--mic",se.toFixed(3)),Oe.style.setProperty("--out",le.toFixed(3)))};return he=requestAnimationFrame(oe),()=>cancelAnimationFrame(he)},[U]),f.useEffect(()=>{const q=()=>{const{ac:he}=F.current;!he||he.state==="running"||he.state==="closed"||Promise.resolve(he.resume()).catch(()=>{})};return document.addEventListener("visibilitychange",q),window.addEventListener("focus",q),window.addEventListener("pageshow",q),document.addEventListener("pointerdown",q),()=>{document.removeEventListener("visibilitychange",q),window.removeEventListener("focus",q),window.removeEventListener("pageshow",q),document.removeEventListener("pointerdown",q)}},[]);const z=i==="listening"&&I?"speaking":i,W=!U,D=h&&z==="listening"?{word:"Microphone off",cls:"text-red-500"}:{connecting:{word:["Checking microphoneâ¦",`Preparing ${e.name}â¦`,"Checking approved sourcesâ¦"][w],cls:"text-ink-muted"},listening:{word:"Listening",cls:"text-ink-muted"},thinking:{word:"Thinking",cls:"text-indigo"},speaking:{word:"Speaking",cls:"text-indigo"},error:{word:"Call ended",cls:"text-red-600"}}[z],Z=z==="speaking"?"--out":"--mic",L=h&&z==="listening"?{blob:.3,ring:.45,dur:"11s",spin:"13s",gain:0}:{connecting:{blob:.4,ring:.5,dur:"11s",spin:"14s",gain:.1},listening:{blob:.6,ring:.85,dur:"7s",spin:"9s",gain:.35},thinking:{blob:.8,ring:1,dur:"2.2s",spin:"1.6s",gain:0},speaking:{blob:.75,ring:1,dur:"3.5s",spin:"4s",gain:.2},error:{blob:.12,ring:.25,dur:"0s",spin:"0s",gain:0}}[z],K=W&&z!=="error",te="conic-gradient(from 0deg, #3D3DF5, #E6C3B3 30%, #A8A8F5 55%, #DCDCFB 75%, #3D3DF5)",Q=Math.max(0,x-m),Y=M&&Q<=60,J=q=>r?.({conversationId:F.current.conversationId,hadTurn:F.current.hadTurn,seconds:F.current.seconds,reason:typeof q=="string"?q:void 0}),P=f.useRef(null);f.useEffect(()=>{const q=P.current;!q||q.scrollHeight-q.scrollTop-q.clientHeight>180||q.scrollTo({top:q.scrollHeight,behavior:U?"auto":"smooth"})},[E.length,U]),f.useEffect(()=>{if(!C)return;const q=he=>{he.key==="Escape"&&N(!1)};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[C]),f.useEffect(()=>
518{if(!e?.id)return;const q=he=>{if(he.detail?.expertId!==e.id)return;const se=F.current;if(he.detail.open){if(se.muteBeforeForm!==null)return;se.muteBeforeForm=se.muted,se.muted=!0,p(!0)}else{if(se.muteBeforeForm===null)return;se.muted=se.muteBeforeForm,se.muteBeforeForm=null,p(se.muted)}};return window.addEventListener(Tj,q),()=>window.removeEventListener(Tj,q)},[e?.id]);const ee=E.length>0,X=a==="contained",ae=f.useMemo(()=>ee?[{type:"profile_elements",version:1,elements:E}]:[],[ee,E]),me=s.jsxs("div",{className:`${X?"ce-test-contained-call absolute":"fixed"} inset-0 z-[60] flex flex-col overflow-hidden bg-cream animate-fade-in`,children:[s.jsxs("div",{className:`relative flex min-h-0 flex-1 flex-col ${X?"":"md:flex-row"}`,children:[s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.jsxs("header",{className:"flex flex-col items-center gap-4 px-5",style:{paddingTop:"max(1.5rem, env(safe-area-inset-top), var(--device-safe-top, 0px))"},children:[s.jsx("div",{className:"flex flex-col items-center gap-1",children:s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"grid h-8 w-8 place-items-center overflow-hidden rounded-full bg-indigo/10",children:e.avatar_url?s.jsx("img",{src:e.avatar_url,alt:"",className:"h-8 w-8 rounded-full object-cover"}):s.jsx("span",{className:"text-sm font-medium text-indigo",children:e.name?.charAt(0)?.toUpperCase()})}),s.jsx("span",{className:"absolute bottom-0 right-0 h-2 w-2 rounded-full bg-emerald-500 ring-[1.5px] ring-cream","aria-hidden":"true"})]}),s.jsx("span",{className:"font-medium text-ink",children:e.name})]})}),s.jsxs("div",{className:`flex items-center gap-2 rounded-full border border-rule bg-cream-deep px-5 py-2 text-sm shadow-sm ${Y?"text-red-600":"text-ink-mid"}`,children:[s.jsx(Ts,{className:`h-3.5 w-3.5 ${z==="error"||Y?"text-red-500":"text-ink-muted"}`,"aria-hidden":"true"}),z==="error"?s.jsx("span",{className:"tabular-nums","aria-label":"Call duration",children:nA(m)}):s.jsxs(s.Fragment,{children:[s.jsxs("svg",{viewBox:"0 0 16 16",className:"h-3.5 w-3.5 -rotate-90","aria-hidden":"true",children:[s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",strokeWidth:"2.5",className:"stroke-rule"}),s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",strokeWidth:"2.5",strokeLinecap:"round",className:Y?"stroke-red-500":"stroke-indigo",strokeDasharray:`${Math.max(0,Q/Math.max(x,1))*40.8} 40.8`})]}),s.jsx("span",{className:"tabular-nums","aria-label":"Time remaining",children:y?"Finishing this responseâ¦":`${nA(Q)} remaining`})]})]})]}),s.jsxs("div",{ref:O,className:"flex min-h-0 flex-1 flex-col items-center justify-center overflow-y-auto overflow-x-hidden px-6",children:[s.jsxs("div",{className:"relative grid place-items-center",children:[s.jsxs("div",{className:"absolute h-[min(18rem,78vw)] w-[min(18rem,78vw)] transition-opacity duration-slow",style:{opacity:L.blob,transform:L.gain?`scale(calc(1 + var(${Z}, 0) * ${L.gain}))`:void 0},"aria-hidden":"true",children:[s.jsx("div",{className:`absolute inset-2 rounded-full bg-gradient-to-br from-indigo-soft via-indigo-tint to-peach blur-lg ${K?"animate-blob":""}`,style:{animationDuration:L.dur}}),s.jsx("div",{className:`absolute inset-8 rounded-full bg-gradient-to-tl from-peach via-peach-tint to-indigo-soft blur-md ${K?"animate-blob":""}`,style:{animationDuration:L.dur,animationDirection:"reverse",animationDelay:"-2s"}})]}),s.jsxs("div",{className:"relative transition-opacity duration-slow",children:[z==="speaking"&&s.jsxs("div",{className:"absolute -inset-1.5",style:{opacity:"calc(0.35 + var(--out, 0) * 0.65)"},"aria-hidden":"true",children:[s.jsx("div",{className:`absolute inset-0 rounded-full border-2 border-indigo-soft ${W?"animate-ripple":"opacity-40"}`}),s.jsx("div",{className:`absolute inset-0 rounded-full border border-indigo-soft ${W?"animate-ripple":"hidden"}`,style:{animationDelay:"-1s"}})]}),s.jsx("div",{className:`absolute -inset-2 rounded-full blur-md ${K?"animate-spin":""}`,style:{background:te,animationDuration:L.spin,opacity:L.ring*.8},"aria-hidden":"true"}),s.jsx("div",{className:`absolute -inset-1.5 rounded-full blur-[3px] ${K?"animate-spin":""}
518`,style:{background:te,animationDuration:L.spin,opacity:L.ring},"aria-hidden":"true"}),s.jsx("div",{className:`relative grid ${X?ee?"h-20 w-20":"h-28 w-28":ee?"h-24 w-24 [@media(max-height:700px)]:h-16 [@media(max-height:700px)]:w-16 sm:h-40 sm:w-40":"h-40 w-40"} place-items-center overflow-hidden rounded-full bg-indigo/10 shadow-card ${z==="error"?"opacity-60":""}`,children:e.avatar_url?s.jsx("img",{src:e.avatar_url,alt:e.name,className:"h-full w-full object-cover"}):s.jsx("span",{className:"font-heading text-5xl text-indigo",children:e.name?.charAt(0)?.toUpperCase()})})]})]}),s.jsx("p",{className:`relative ${X?ee?"mt-4":"mt-8":ee?"mt-10 [@media(max-height:700px)]:mt-4 sm:mt-20":"mt-20"} text-sm font-medium uppercase tracking-[0.2em] ${D.cls}`,"aria-live":"polite",children:D.word}),i==="connecting"&&s.jsx("p",{className:"relative mt-3 max-w-[34ch] text-center text-xs leading-relaxed text-ink-muted",children:"You're talking with an AI, not a human. This call is transcribed and saved here."}),s.jsxs("div",{className:`mt-8 w-full max-w-xl text-center ${X?"":"xl:max-w-[min(36rem,calc(100vw-46rem))]"} min-h-[6.5rem]`,children:[u.user&&z!=="error"&&s.jsxs("p",{className:"mx-auto max-w-md line-clamp-2 text-xs text-ink-muted",children:["You · ",u.user]}),s.jsx(Htt,{text:z==="error"?l:u.expert,units:z==="error"?[]:u.units,speaking:z==="speaking",reducedMotion:U,audioNowRef:G},u.user||"idle")]})]}),ee&&s.jsxs("button",{type:"button",onClick:()=>N(!0),"aria-expanded":C,className:`mx-4 mb-3 flex shrink-0 items-center gap-3 rounded-pill border border-rule bg-paper py-2 pl-2 pr-3.5 shadow-subtle transition-colors duration-fast ease-standard active:bg-cream-deep ${X?"":"md:hidden"}`,children:[s.jsx("span",{className:"flex -space-x-2","aria-hidden":"true",children:E.slice(-3).map(q=>s.jsx("span",{className:"grid h-7 w-7 place-items-center overflow-hidden rounded-full border border-paper bg-cream-tint",children:q.image_url?s.jsx("img",{src:q.image_url,alt:"",className:"h-full w-full object-cover"}):s.jsx(jb,{className:"h-3.5 w-3.5 text-ink-muted",strokeWidth:1.6})},q.ref))}),s.jsxs("span",{className:"flex-1 text-left text-[13px] font-medium text-ink",children:[E.length," mentioned in this call"]}),s.jsx(aye,{className:"h-4 w-4 shrink-0 text-ink-muted","aria-hidden":"true"})]}),s.jsx("div",{className:"flex items-center justify-center gap-4 pb-[max(2.5rem,env(safe-area-inset-bottom))]",children:z==="error"?s.jsx("button",{onClick:J,className:"rounded-full bg-ink px-8 py-3 font-medium text-cream transition-opacity hover:opacity-90",children:"Close"}):s.jsxs(s.Fragment,{children:[s.jsx(Ik,{expert:e,source:"voice",silent:!_,className:"flex h-12 w-12 items-center justify-center rounded-full border border-rule bg-cream-deep shadow-sm transition-colors hover:bg-cream-tint",labelClassName:"sr-only",iconClassName:"h-5 w-5 text-indigo"}),s.jsx("button",{onClick:()=>{const q=F.current;q.muted=!q.muted,p(q.muted)},disabled:!M,"aria-pressed":h,"aria-label":h?"Unmute microphone":"Mute microphone",title:h?"Unmute":"Mute",className:`flex h-12 w-12 items-center justify-center rounded-full border shadow-sm transition-colors disabled:opacity-40 ${h?"border-red-600 bg-red-600 text-white hover:bg-red-700":"border-rule bg-cream-deep text-ink-mid hover:bg-cream-tint"}`,children:h?s.jsx(yY,{className:"h-5 w-5"}):s.jsx(Qr,{className:"h-5 w-5"})}),s.jsxs("button",{onClick:J,className:"flex items-center gap-2 rounded-full bg-red-600 px-6 py-3 font-medium text-white shadow-sm transition-colors hover:bg-red-700","aria-label":"End call",children:[s.jsx(Ts,{className:"h-4 w-4 rotate-[135deg]"}),"End call"]})]})})]}),ee&&!A&&s.jsxs("button",{type:"button",onClick:()=>T(!0),"aria-expanded":!1,"aria-label":`Show ${E.length} mentioned in this call`,className:`group absolute right-6 top-1/2 z-20 -translate-y-1/2 flex-col items-center gap-2.5 rounded-2xl border border-rule bg-paper/95 p-3 shadow-elevation backdrop-blur-sm transition-colors duration-fast ease-standard hover:bg-paper ${X?"hidden":"hidden md:flex"}`,children:[s.jsx(Wh,{className:"h-4 w-4 text-ink-muted transition-colors duration-fast group-hover:text-indigo","aria-hidden":"true"}),s.jsx("span",{className:"flex flex-col -space-y-1.5","aria-hidden":"true",children:E.slice(-2).map(q=>s.jsx("span",{className:"grid h-11 w-11 place-items-center overflow-hidden rounded-xl border border-rule bg-paper shadow-subtle",children:q.image_url?s.jsx("img",{src:q.image_url,alt:"",className:"h-full w-full object-cover"}):s.jsx(jb,{className:"h-4 w-4 text-ink-muted",strokeWidth:1.6})},q.ref))}),s.jsx("span",{className:"rounded-pill bg-ink px-2.5 py-1 text-[12px] font-semibold leading-none tabular-nums text-cream",children:E.length})]}),ee&&s.jsxs("aside",{className:`hidden min-h-0 w-[23rem] shrink-0 flex-col border-l border-rule bg-cream-deep xl:absolute xl:inset-y-0 xl:right-0 xl:z-20 xl
518:shadow-overlay ${X?"":A?"md:flex xl:translate-x-0":"md:hidden xl:flex xl:translate-x-full"}`,style:{transition:U?"none":`transform 280ms cubic-bezier(0.16,1,0.3,1), visibility 0s ${A?"0s":"280ms"}`,visibility:A?"visible":"hidden"},"aria-label":"Mentioned during this call",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-rule py-3 pl-4 pr-2",children:[s.jsx("h2",{className:"flex-1 text-[11px] font-medium uppercase tracking-eyebrow text-ink-mid",children:"Mentioned in this call"}),s.jsx("span",{className:"rounded-pill bg-cream-tint px-2 py-0.5 text-[11px] font-semibold tabular-nums text-ink-mid",children:E.length}),s.jsx("button",{type:"button",onClick:()=>T(!1),"aria-label":"Collapse",className:"grid h-8 w-8 shrink-0 place-items-center rounded-lg text-ink-muted transition-colors duration-fast ease-standard hover:bg-cream-tint hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo/40",children:s.jsx(hn,{className:"h-4 w-4","aria-hidden":"true"})})]}),s.jsxs("div",{className:"relative min-h-0 flex-1",children:[s.jsx("div",{ref:P,className:"h-full overflow-y-auto overscroll-contain",children:s.jsx(Wb,{blocks:ae,expertId:e.id,surface:"voice",linkTarget:"_blank",maxElements:Ev,stacked:!0,large:!0})}),s.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-cream-deep to-transparent","aria-hidden":"true"})]})]})]}),ee&&s.jsx("button",{type:"button","aria-label":"Back to the call",tabIndex:C?0:-1,onClick:()=>N(!1),className:`${X?"absolute":"fixed"} inset-0 z-[70] bg-ink/20 backdrop-blur-[3px] ${X?"":"md:hidden"} ${C?"opacity-100":"pointer-events-none opacity-0"}`,style:{transition:U?"none":`opacity 200ms cubic-bezier(0.2,0.6,0.2,1), visibility 0s ${C?"0s":"280ms"}`,visibility:C?"visible":"hidden"}}),ee&&s.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Mentioned in this call",className:`${X?"absolute":"fixed"} inset-x-0 bottom-0 z-[80] flex max-h-[min(76dvh,640px)] flex-col rounded-t-2xl border border-b-0 border-rule bg-cream-deep shadow-overlay ${X?"":"md:hidden"} ${C?"translate-y-0":"translate-y-full"}`,style:{paddingBottom:"env(safe-area-inset-bottom)",transition:U?"none":`transform 280ms cubic-bezier(0.16,1,0.3,1), visibility 0s ${C?"0s":"280ms"}`,visibility:C?"visible":"hidden"},children:[s.jsx("button",{type:"button",onClick:()=>N(!1),"aria-label":"Close",className:"grid w-full shrink-0 place-items-center py-2.5",style:{touchAction:"none"},children:s.jsx("span",{className:"h-1 w-10 rounded-full bg-rule","aria-hidden":"true"})}),s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-rule px-4 pb-2.5",children:[s.jsx("h2",{className:"text-[11px] font-medium uppercase tracking-eyebrow text-ink-mid",children:"Mentioned in this call"}),s.jsx("span",{className:"rounded-pill bg-cream-tint px-2 py-0.5 text-[11px] font-semibold tabular-nums text-ink-mid",children:E.length})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:s.jsx(Wb,{blocks:ae,expertId:e.id,surface:"voice",linkTarget:"_blank",maxElements:Ev,stacked:!0})})]})]});return X?me:Mn.createPortal(me,document.body)}const qU=e=>e?.code==="en"?0:e?.origin==="original"?1:2;function Vtt(e,t=""){const n=Array.isArray(e)?e:[],r=t.trim().toLowerCase();return n.filter(a=>!r||a?.name?.toLowerCase().includes(r)||a?.code?.toLowerCase().includes(r)).sort((a,i)=>qU(a)-qU(i)||(a?.name||"").localeCompare(i?.name||""))}const Gtt=3;function Ytt(e){const t=(Array.isArray(e)?e:[]).filter(n=>n?.origin==="original").length;return Math.max(Gtt,t)}function lae(e){const t=Array.isArray(e)?e:[];return t.length===1?t[0]:null}function cae({isOpen:e,languages:t,onClose:n,onSelect:r,presentation:a="fullscreen"}){const[i,o]=f.useState(!1),[l,c]=f.useState("");!e&&l&&c("");const u=Vtt(t,l),d=Ytt(u),h=l.trim()?0:u.length-d,p=i||h<=0?u:u.slice(0,d);return s.jsxs(en,{isOpen:e,onClose:n,title:"Choose call language",maxWidth:"max-w-sm",contained:a==="contained",surface:!0,children:[s.jsx("p",{className:"mb-4 text-[13px] leading-relaxed text-ink-mid",children:"You'll be talking with an AI, not a human. The call is transcribed and saved here. Tap a language to start the call."}),s.jsx("input",{type:"search","aria-label":"Search languages",placeholder:"Search languages",value:l,onCh
518ange:m=>c(m.target.value),className:"mb-3 min-h-[44px] w-full rounded-xl border border-rule bg-paper px-3 py-2 text-base text-ink placeholder:text-ink-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo"}),s.jsxs("div",{className:"flex max-h-72 flex-col gap-2 overflow-y-auto pr-1 [scrollbar-color:rgba(20,20,19,0.28)_rgba(20,20,19,0.07)] [scrollbar-width:thin] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-[rgba(20,20,19,0.28)] [&::-webkit-scrollbar-track]:rounded-full [&::-webkit-scrollbar-track]:bg-[rgba(20,20,19,0.07)] [&::-webkit-scrollbar]:w-[9px]",children:[p.length===0&&s.jsx("p",{role:"status",className:"py-3 text-sm text-ink-mid",children:l.trim()?"No languages found. Try another search.":"No languages available."}),p.map(m=>s.jsxs("button",{type:"button",onClick:()=>r(m),className:"flex w-full min-h-[52px] shrink-0 items-center gap-3 rounded-xl border border-rule bg-paper px-4 py-2.5 text-left shadow-subtle transition-[border-color,background-color,transform] duration-base ease-standard hover:border-indigo hover:bg-indigo-wash active:scale-[0.99] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-[15px] font-medium text-ink",children:m.name}),m.origin==="original"&&s.jsx("span",{className:"shrink-0 rounded-full bg-indigo-tint px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-indigo",children:"Original"}),s.jsx("span",{className:"grid h-7 w-7 shrink-0 place-items-center rounded-full bg-indigo-wash text-indigo","aria-hidden":"true",children:s.jsx(hn,{className:"h-4 w-4",strokeWidth:2.4})})]},m.code)),h>0&&s.jsxs("button",{type:"button",onClick:()=>o(m=>!m),className:"flex min-h-[44px] w-full shrink-0 items-center justify-center gap-2 rounded-xl text-[13.5px] font-semibold text-indigo transition-colors hover:bg-indigo-wash focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo",children:[i?"Show less":`Show more (${h})`,s.jsx(Is,{className:`h-4 w-4 shrink-0 transition-transform ${i?"rotate-180":""}`,"aria-hidden":"true"})]})]})]})}function Ktt({seconds:e,status:t,reason:n,onCallAgain:r,onDismiss:a}){return s.jsxs("div",{className:"flex min-h-[3.25rem] items-center justify-between gap-3 rounded-lg border border-rule bg-cream-deep px-4 py-2 animate-fade-in",role:"status","aria-live":"polite",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-sm text-ink-mid",children:[s.jsx(Ts,{className:"h-3.5 w-3.5 shrink-0 rotate-[135deg] text-ink-muted","aria-hidden":"true"}),s.jsxs("span",{className:"truncate",children:["Voice call ended · ",s.jsx("span",{className:"tabular-nums",children:nA(e)}),n==="time-limit"&&s.jsx("span",{className:"text-ink-muted",children:" · Call time limit reached"})]})]}),t==="saving"?s.jsxs("span",{className:"flex shrink-0 items-center gap-2 text-sm text-ink-muted",children:[s.jsx(vt,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":"true"}),"Saving transcriptâ¦"]}):s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:r,className:"flex h-8 items-center gap-1.5 rounded-full bg-indigo px-3.5 text-sm font-medium text-cream transition-colors hover:bg-indigo-deep",children:[s.jsx(Ts,{className:"h-3 w-3","aria-hidden":"true"}),"Call again"]}),s.jsx("button",{type:"button",onClick:a,className:"flex h-8 items-center rounded-full border border-rule bg-cream px-3.5 text-sm text-ink-mid transition-colors hover:bg-cream-tint",children:"Continue in chat"})]})]})}const WU=25,Xtt=5,ZP=["image/png","image/jpeg","image/webp","image/gif"],Jtt=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","text/plain","text/csv","text/markdown","application/epub+zip"],Qtt=[...ZP,...Jtt],uae=[...ZP,".pdf",".docx",".xlsx",".xls",".txt",".csv",".md",".epub"].join(",");function Ztt(e){return ZP.includes(e)}function dae(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function est(e){return Qtt.includes(e.type)?e.size>
518WU*1024*1024?{valid:!1,error:`File exceeds ${WU}MB limit.`}:e.size===0?{valid:!1,error:"File is empty."}:{valid:!0,error:null}:{valid:!1,error:`File type "${e.type||"unknown"}" is not supported.`}}function tst(e,t,n=null){return new Promise((r,a)=>{(async()=>{const i=await Pxe(),o=new XMLHttpRequest,l=new FormData;l.append("file",e),n&&l.append("expert_id",n),o.open("POST",`${Hr}/attachments/upload`),o.setRequestHeader("Authorization",`Bearer ${i}`),o.upload.onprogress=c=>{c.lengthComputable&&t&&t(Math.round(c.loaded/c.total*100))},o.onload=()=>{if(o.status>=200&&o.status<300)try{const c=JSON.parse(o.responseText);r(c.data)}catch{a(new Error("Invalid response from server"))}else try{const c=JSON.parse(o.responseText);a(new Error(c.detail?.message||`Upload failed (${o.status})`))}catch{a(new Error(`Upload failed (${o.status})`))}},o.onerror=()=>a(new Error("Network error during upload")),o.send(l)})().catch(a)})}function RS({attachments:e,variant:t="default"}){if(!e||e.length===0)return null;const n=e.filter(i=>i.file_category==="image"),r=e.filter(i=>i.file_category==="document"),a=t==="own";return s.jsxs("div",{className:"mt-1.5 space-y-1.5",children:[n.length>0&&s.jsx("div",{className:`flex flex-wrap gap-1.5 ${n.length===1?"":"max-w-[320px]"}`,children:n.map(i=>s.jsx(sst,{attachment:i,isOwn:a},i.id))}),r.length>0&&s.jsx("div",{className:"space-y-1",children:r.map(i=>s.jsx(nst,{attachment:i,isOwn:a},i.id))})]})}function sst({attachment:e,isOwn:t}){const[n,r]=f.useState(!1),a=e.storage_url;return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:()=>r(!0),className:"rounded-xl overflow-hidden border border-white/20 hover:opacity-90 transition-opacity",children:s.jsx("img",{src:a,alt:e.file_name,className:"max-w-[200px] max-h-[160px] object-cover",loading:"lazy"})}),n&&s.jsxs("div",{className:"fixed inset-0 z-[200] bg-black/80 flex items-center justify-center p-4",onClick:()=>r(!1),children:[s.jsx("button",{onClick:()=>r(!1),className:"absolute top-4 right-4 p-2 rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors",children:s.jsx(as,{className:"w-5 h-5"})}),s.jsx("img",{src:a,alt:e.file_name,className:"max-w-full max-h-[90vh] object-contain rounded-xl",onClick:i=>i.stopPropagation()}),s.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:i=>i.stopPropagation(),className:"absolute bottom-4 right-4 flex items-center gap-1.5 px-3 py-1.5 bg-ink/60 hover:bg-ink/75 text-cream text-xs rounded-pill transition-colors",children:[s.jsx(Ro,{className:"w-3.5 h-3.5"}),"Open original"]})]})]})}function nst({attachment:e,isOwn:t}){const n=t?"bg-white/10 hover:bg-white/15 border-white/20":"bg-slate-50 dark:bg-neutral-800/50 hover:bg-slate-100 dark:hover:bg-neutral-800 border-slate-200 dark:border-neutral-700",r=t?"text-white/90":"text-slate-700 dark:text-neutral-300",a=t?"text-white/50":"text-slate-400 dark:text-neutral-500",i=t?"text-white/60":"text-slate-400 dark:text-neutral-500";return s.jsxs("a",{href:e.storage_url,target:"_blank",rel:"noopener noreferrer",className:`flex items-center gap-2.5 px-3 py-2 rounded-xl border ${n} transition-colors`,children:[s.jsx(si,{className:`w-4 h-4 shrink-0 ${i}`}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:`text-xs font-medium truncate ${r}`,children:e.file_name}),s.jsx("p",{className:`text-[10px] ${a}`,children:dae(e.file_size)})]}),s.jsx(Eh,{className:`w-3.5 h-3.5 shrink-0 ${i}`})]})}function x5({attachments:e,onRemove:t}){return!e||e.length===0?null:s.jsx("div",{className:"flex gap-2 overflow-x-auto no-scrollbar pb-1",children:e.map(n=>s.jsxs("div",{className:"relative shrink-0 group",children:[n.file_category==="image"?s.jsxs("div",{className:"w-16 h-16 rounded-xl overflow-hidden border border-slate-200 dark:border-neutral-700 bg-slate-100 dark:bg-neutral-800",children:[n.preview?s.jsx("img",{src:n.preview,alt:n.file_name,className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center",children:s.jsx(si,{className:"w-5 h-5 text-slate-300 dark:text-neutral-600"})}),n.uploading&&s.jsx("div",{className:"absolute inset-0 bg-black/40 flex items-center justify-center rounded-xl",children:s.jsxs("span",{className:"text-[10px] font-bold text-white",children:[n.progress,"%"]})})]}):s.jsxs("div",{className:"w-40 h-16 rounded-xl border border-slate-200 dark:border-neutral-700 bg-slate-50 dark:bg-neutral-800 flex items-center gap-2 px-2.5",children:[s.jsx(si,{className:"w-4 h-4 shrink-0 text-slate-400 dark:text-neutral-500"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-[11px] font-medium text-slate-700 dark:text-neutral-300 truncate",children:n.file_name}),n.uploading?s.jsx("div",{className:"mt-1 h-1 bg-slate-200 dark:bg-neutral-700 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-primary-500 transition-all",style:{width:`${n.progress}%`}})}):n.error?s.jsx("p",{className:"text-[9px] text-red-500 truncate",children:n.error}):s.jsx("p",{className:"text-[9px] text-slate-400 dark:text-neutral-500",children:dae(n.file_size)})]})]}),n.error&&n.file_category==="image"&&s.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-red-500/90 text-white text-[8px] px-1 py-0.5 text-center rounded-b-xl truncate",children:"Error"}),s.jsx("button",{type:"button",onClick:()=>t(n.localId),className:"absolute -top-1.5 -right-1.5 w-5 h-5 bg-slate-600 dar
518k:bg-neutral-600 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500",children:s.jsx(as,{className:"w-3 h-3"})})]},n.localId))})}async function rst(e,t,n=null){const r=await f0({"Content-Type":"application/json"}),a=await fetch(`${Hr}/voice/synthesize`,{method:"POST",headers:r,body:JSON.stringify({text:e,expert_id:t}),signal:n});if(!a.ok){let i=null;try{i=await a.json()}catch{}const o=new Error(i?.detail?.message||`Speech synthesis failed: ${a.status}`);throw o.status=a.status,o}return a}function ast({expertId:e}={}){const[t,n]=f.useState("idle"),[r,a]=f.useState(null),[i,o]=f.useState(!1),l=f.useRef(null),c=f.useRef(null),u=f.useRef(0),d=f.useRef(null),h=f.useRef(!1),p=f.useCallback(()=>{d.current?.abort(),d.current=null,l.current?.close().catch(()=>{}),l.current=null,c.current=null,o(!1)},[]);f.useEffect(()=>()=>{h.current=!0,p()},[p]);const m=f.useCallback(()=>{h.current=!0,p(),n("idle")},[p]),g=f.useCallback(()=>{l.current?.suspend(),o(!0)},[]),x=f.useCallback(()=>{l.current?.resume(),o(!1)},[]),b=f.useCallback(async w=>{if(!w)return;m(),h.current=!1,a(null),n("loading");const j=new AudioContext({sampleRate:24e3});l.current=j;const E=j.createAnalyser();E.fftSize=64,E.connect(j.destination),c.current=E;try{d.current=new AbortController;const S=await rst(w,e,d.current.signal);if(h.current)return;await Cre(S.body,j,{output:E,onStart:()=>{h.current||(u.current=j.currentTime,n("playing"))}}),h.current||(p(),n("idle"))}catch(S){if(h.current||S?.name==="AbortError")return;p(),a(S),n("error")}},[e,m,p]),y=f.useCallback(()=>l.current?Math.max(0,l.current.currentTime-u.current):0,[]),v=f.useCallback(()=>c.current,[]);return{status:t,error:r,isPaused:i,play:b,stop:m,pause:g,resume:x,getElapsed:y,getAnalyser:v,isLoading:t==="loading",isPlaying:t==="playing",isBusy:t==="loading"||t==="playing"}}function ist({tts:e}){const{isBusy:t,getAnalyser:n,getElapsed:r}=e,a=f.useRef(null),[i,o]=f.useState(0);if(f.useEffect(()=>{if(!t)return;let c,u;const d=()=>{c=requestAnimationFrame(d),o(Math.floor(r()));const h=a.current,p=n();if(!h||!p)return;const m=h.getContext("2d"),g=new Uint8Array(p.frequencyBinCount);p.getByteFrequencyData(g);const{width:x,height:b}=h;m.clearRect(0,0,x,b),u||=getComputedStyle(h).color,m.fillStyle=u;const y=x/g.length;for(let v=0;v<g.length;v++){const w=Math.max(2,g[v]/255*b);m.fillRect(v*y,(b-w)/2,y*.6,w)}};return d(),()=>cancelAnimationFrame(c)},[t,n,r]),!t)return null;const l=`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`;return s.jsxs("div",{className:"flex items-center gap-2 mt-1 w-fit px-2 py-1 rounded-lg bg-cream-deep",children:[e.isLoading?s.jsxs(s.Fragment,{children:[s.jsx(vt,{className:"w-3.5 h-3.5 animate-spin text-ink-light"}),s.jsx("span",{className:"text-xs text-ink-light",children:"Warming upâ¦"})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:e.isPaused?e.resume:e.pause,className:"text-indigo","aria-label":e.isPaused?"Resume":"Pause",children:e.isPaused?s.jsx(Tr,{className:"w-3.5 h-3.5"}):s.jsx(Lf,{className:"w-3.5 h-3.5"})}),s.jsx("canvas",{ref:a,width:120,height:24,className:"text-indigo"}),s.jsx("span",{className:"text-xs tabular-nums text-ink-light",children:l})]}),s.jsx("button",{onClick:e.stop,className:"text-ink-light hover:text-destructive","aria-label":"Stop",children:s.jsx(as,{className:"w-3.5 h-3.5"})})]})}function hae({message:e,expertId:t,onReact:n,onFeedback:r,alwaysVisible:a=!1}){const[i,o]=f.useState(e.user_reaction||null),[l,c]=f.useState(!1),u=ast({expertId:t}),d=f.useCallback(()=>{e.content&&u.play(e.content)},[u,e.content]),h=async g=>{if(!n)return;const x=i;o(x===g?null:g);try{const y=await n(t,{reaction:g,message_id:e.id});o(y.data.reaction)}catch{o(x)}},p=f.useCallback(()=>{e.content&&(navigator.clipboard.writeText(e.content),c(!0),setTimeout(()=>c(!1),2e3))},[e.content]),m=a||u.isBusy?"":"opacity-0 group-hover:opacity-100 transition-opacity";return s.jsxs("div",{children:[s.jsxs("div",{className:`flex items-center gap-0.5 ${m}`,children:[s.jsx("button",{onClick:p,className:`inline-flex items-center p-1 rounded-md transition-colors ${l?"text-indigo":"text-ink-light hover:text-ink-mid"} hover:bg-cream-deep`,"aria-label":l?"Copied":"Copy",children:l?s.jsx(ft,{className:"w-3.5 h-3.5"}):s.jsx(ju,{className:"w-3.5 h-3.5"})}),!u.isBusy&&s.jsx("button",{onClick:d,className:"inline-flex items-center p-1 rounded-md transition-colors text-ink-light hover:text-ink-mid hover:bg-cream-deep","aria-label":"Listen",title:"Listen",children:s.jsx(uu,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>h("up"),className:`inline-flex items-center p-1 rounded-md transition-colors ${i==="up"?"text-indigo-deep":"text-ink-light hover:text-indigo"} hover:bg-cream-deep`,"aria-label":"Helpful",children:s.jsx(eo,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>h("down"),className:`inline-flex items-center p-1 rounded-md transition-colors ${i==="down"?"text-destructive":"text-ink-light hover:text-destructive"} hover:bg-cream-deep`,"aria-label":"Not helpful",children:s.jsx(wc,{className:"w-3.5 h-3.5"})}),r&&s.jsx("button",{onClick:()=>r(e.id),className:"inline-flex items-center p-1 rounded-md transition-colors text-ink-light hover:text-indigo hover:bg-cream-deep","aria-label":"Send feedback",title:"Send feedback",children:s.jsx(xY,{className:"w-3.5 h-3.5"})})]}),s.jsx(ist,{tts:u})]})}function ost(e){const t=f.useRef(null),[n,r]=f.useState(!1);return f.useEffect(()=>{const a=t.current;if(!e||!a)return;const i=()=>{const l=parseFloat(getComputedStyle(a).lineHeight)||24;r(a.scrollHeight<=l*1.6)};i();const o=new ResizeObserver(i);return o.observe(a),()=>o.disconnect()},[e]),[t,n]}function lst({message:e,expertName:t,expertAvatarUrl:n,expertId:r,onReact:a,onFeedback:i,hideActions:o=!1}){const l=e.role==="user",c=e.source==="voice",u=e.attachments||[],d=u.filter(j=>j.file_category==="image"),h=u.filter(j=>j.file_category!=="image"),p=!e._isStreaming&&!!e.content,m=e._isStreaming&&!e.content,g=!l&&p&&!e._isError&&u.length===0,[x,b]=ost(g),y=g&&b;if(l){const j=!!e.content,E=h.length>0,S=j||E;return s.jsx("div",{"data-message-id":e.id,className:"flex justify-end",children:s.jsxs("div",{className:"max-w-[85%] sm:max-w-[75%]",children:[d.length>0&&s.jsx("div",{className:`flex justify-end ${S?"mb-1.5":""}`,children:s.jsx(RS,{attachments:d})}),S&&s.jsxs("div",{className:"bg-indigo text-cream rounded-lg px-4 py-3 shadow-subtle",children:[E&&s.jsx(RS,{attachments:h,variant:"own"}),j&&s.jsx("div",{className:`text-sm leading-[1.55] whitespace-pre-wrap ${E?"mt-1.5":""} ${c?"italic":""}`,style:{wordBreak:"break-word"},children:e.content}),c&&s.jsxs("div",{className:"mt-1 flex items-center justify-end gap-1 font-mono text-[10px] uppercase tracking-eyebrow text-cream/60",children:[s.jsx(Qr,{className:"w-2.5 h-2.5","aria-hidden":"true"}),s.jsx("span",{children:"Voice"})]})]})]})})}const v="lg:pl-[3.25rem]",w=e._isStreaming&&!e.content;return s.jsxs("div",{className:"group",children:[s.jsxs("div",{className:`flex gap-5 ${m?"items-center":y?"lg:items-center":""}`,children:[s.jsx("div",{className:`shrink-0 ${m?"flex":y?"hidden lg:block":"mt-0.5 hidden lg:block"}`,children:s.jsx(ws,{name:t||"Expert",size:"sm",variant:"expert",src:n})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[w&&s.jsx(Pk,{}),e._isError?s.jsx("div",{className:"text-sm text-destructive bg-peach-tint border border-peach rounded-md px-3 py-2",children:e.content}):e.content?s.jsxs("div",{ref:x,className:"relative text-[15px] leading-[1.6]",children:[c&&s.jsxs("div",{className:"mb-1 flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-eyebrow text-ink-light",children:[s.jsx(Qr,{className:"w-3 h-3","aria-hidden":"true"}),s.jsx("span",{children:"Voice call"})]}),u.length>0&&s.jsx(RS,{attachments:u}),s.jsx("div",{className:`${u.length>0?"mt-1.5":""} ${c?"italic":""}`,children:s.jsx(Qf,{content:e.content,isStreaming:!!e._isStreaming})})]}
518):null,s.jsx(Wb,{blocks:e.blocks,expertId:r,messageId:e.id,surface:"platform"})]})]}),p&&!o&&s.jsx("div",{className:`mt-3 ${v}`,children:s.jsx(hae,{message:e,expertId:r,onReact:a,onFeedback:i})})]})}const cst=f.memo(lst),IS=new Map,PS=24;function ust({messages:e,isTyping:t,isHistoryLoading:n=!1,expertName:r,expertAvatarUrl:a,expertDescription:i,creatorName:o,userName:l,expertId:c,onReact:u,onFeedback:d,starters:h,onStarterClick:p,onLoadMore:m,hasMore:g=!1,isLoadingOlder:x=!1,scrollKey:b,pinMessageId:y=null}){const v=f.useRef(null),w=f.useRef(null),j=f.useRef(!0),E=f.useRef(0),S=f.useRef(b),_=f.useRef(!1),k=f.useRef(null),C=f.useRef(null),N=f.useRef(null),A=f.useRef(null),[T,I]=f.useState(!1),$=f.useCallback(()=>{const F=w.current,H=N.current,G=v.current;if(!F||!H||!G)return;const M=A.current,z=M?F.querySelector(`[data-message-id="${M}"]`):null;if(!z)return;const W=G.getBoundingClientRect().top-z.getBoundingClientRect().top,D=Math.max(0,F.clientHeight-PS-W);H.style.height=`${D}px`},[]);f.useLayoutEffect(()=>{S.current!==b&&(S.current=b,E.current=0,j.current=!0,k.current=null,C.current=null,A.current=null,N.current&&(N.current.style.height="0px"))},[b]);const O=f.useCallback(async()=>{const F=w.current;if(!(!F||!g||!m||_.current||x)){_.current=!0,k.current=F.scrollHeight,C.current=e.length,I(!0);try{(await m())?.messages?.length||(k.current=null,C.current=null)}finally{I(!1),setTimeout(()=>{_.current=!1},200)}}},[g,x,e.length,m]),U=()=>{const F=w.current;F&&(j.current=F.scrollHeight-F.scrollTop-F.clientHeight<100,b&&IS.set(b,{top:F.scrollTop,height:F.scrollHeight}),F.scrollTop<100&&O())};return f.useLayoutEffect(()=>{if(!y)return;const F=w.current;!F||!F.querySelector(`[data-message-id="${y}"]`)||(A.current=y,$(),requestAnimationFrame(()=>{const H=w.current,G=H?.querySelector(`[data-message-id="${y}"]`);if(!H||!G)return;const M=G.getBoundingClientRect().top-H.getBoundingClientRect().top+H.scrollTop-PS;H.scrollTo({top:M,behavior:"smooth"})}))},[y,$]),f.useLayoutEffect(()=>{if(!w.current)return;if(k.current!==null){const M=C.current??e.length;if(e.length<=M){!T&&!x&&(k.current=null,C.current=null);return}const z=k.current;k.current=null,C.current=null,E.current=e.length,requestAnimationFrame(()=>{w.current&&(w.current.scrollTop+=w.current.scrollHeight-z,b&&IS.set(b,{top:w.current.scrollTop,height:w.current.scrollHeight}))});return}let H=null;for(let M=e.length-1;M>=0;M--)if(e[M].role==="user"){H=e[M].id;break}if(e.some(M=>M._isStreaming)&&H&&H!==A.current){A.current=H,E.current=e.length,$(),requestAnimationFrame(()=>{const M=w.current,z=M?.querySelector(`[data-message-id="${H}"]`);if(M&&z){const W=z.getBoundingClientRect().top-M.getBoundingClientRect().top+M.scrollTop-PS;M.scrollTo({top:W,behavior:"smooth"})}});return}if(e.length>0&&E.current===0){E.current=e.length;const M=b?IS.get(b):null;requestAnimationFrame(()=>{if(M&&w.current){const z=w.current.scrollHeight-M.height;w.current.scrollTop=Math.max(0,M.top+z)}else{const z=()=>v.current?.scrollIntoView({behavior:"instant"});z(),requestAnimationFrame(z),setTimeout(z,250)}});return}E.current=e.length,A.current&&$()},[e,b,T,x,$]),s.jsx("div",{ref:w,onScroll:U,className:"flex-1 overflow-y-auto overscroll-contain custom-scrollbar bg-cream",children:s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 py-6",children:[(T||x)&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(vt,{className:"w-5 h-5 text-ink-light animate-spin"})}),n&&e.length===0&&s.jsx("div",{className:"flex items-center justify-center min-h-[70vh]",children:s.jsx(vt,{className:"w-6 h-6 text-ink-light animate-spin"})}),e.length===0&&!t&&!n&&s.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[70vh] text-center",children:[s.jsx(ws,{name:r||"Expert",size:"xl",variant:"expert",src:a,className:"mb-5 !w-16 !h-16 !text-xl"}),s.jsxs("h3",{className:"font-heading text-2xl font-medium text-ink tracking-tight mb-2",children:["Chat with ",s.jsx("em",{className:"text-indigo not-italic font-display italic",children:r||"Expert"})]}),i&&s.jsx("p",{className:"text-sm text-ink-mid max-w-sm leading-relaxed line-clamp-3",children:i}),o&&s.jsxs("p",{className:"font-mono text-[11px] uppercase tracking-eyebrow text-ink-muted mt-3",children:["By ",o]}),Array.isArray(h)&&h.length>0&&s.jsx("div",{className:"mt-8 flex flex-col items-center gap-3 w-full max-w-md",children:h.map((F,H)=>s.jsx("button",{type:"button",onClick:()=>p?.(F),className:"w-full px-4 py-2.5 text-sm font-medium rounded-md bg-paper border border-rule text-ink-soft hover:border-indigo hover:bg-indigo-wash hover:text-indigo-deep transition-colors focus:outline-none focus:shadow-focus",children:F},H))})]}),(()=>{const F=e.some(M=>M.role==="user"),H=!t&&!F&&e.length>0&&Array.isArray(h)&&h.length>0,G=H?e.find(M=>M.role==="assistant"&&!M._isStreaming&&!!M.content):null;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"space-y-10",children:e.map(M=>s.jsx(cst,{message:M,expertName:r,expertAvatarUrl:a,userName:l,expertId:c,onReact:u,onFeedback:d,hideActions:H&&M.role==="assistant"},M.id))}),H&&s.jsxs("div",{className:"mt-3 flex gap-5 group",children:[s.jsx("div",{className:"shrink-0 w-8 hidden lg:block","aria-hidden":"true"}),s.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-start gap-3",children:[h.map((M,z)=>s.jsx("button",{type:"button",onClick:()=>p?.(M),className:"px-4 py-2.5 text-sm font-medium rounded-md bg-paper border border-rule text-ink-soft hover:border-indigo hover:bg-indigo-wash hover:text-indigo-deep transition-colors focus:outline-none focus:shadow-focus",children:M},z)),G&&(u||d)&&s.jsx(hae,{message:G,expertId:c,onReact:u,onFeedback:d})]})]})]})})(),t&&!e.some(F=>F._isStreaming)&&s.jsx("div",{className:"mt-4",children:s.jsx("span",{className:"font-mono text-[11px] uppercase tracking-eyebrow text-ink-muted animate-pulse",children:"Thinkingâ¦"})}),s.jsx("div",{ref:v,className:"h-1"}),s.jsx("div",{ref:N,"aria-hidden":"true"})]})})}function pae(e=null){const[t,n]=f.useState([]),r=f.useRef(null),a=f.useCallback(async m=>{const g=Array.from(m),x=t.length;for(let b=0;b<g.length&&!(x+b>=Xtt);b++){const y=g[b],v=est(y),w=`local-${Date.now()}-${b}`,j=Ztt(y.type),E=j?URL.createObjectURL(y):null,S={localId:w,id:null,file_name:y.name,file_size:y.size,mime_type:y.type,file_category:j?"image":"document",storage_url:null,preview:E,progress:0,error:v.error,uploading:!v.error};n(_=>[..._,S]),v.valid&&tst(y,_=>{n(k=>k.map(C=>C.localId===w?{...C,progress:_}:C))},e).then(_=>{n(k=>k.map(C=>C.localId===w?{...C,id:_.id,storage_url:_.storage_url,progress:100,uploading:!1}:C))}).catch(_=>{n(k=>k.map(C=>C.localId===w?{...C,error:_.message,uploading:!1}:C))})}},[t.length,e]),i=f.useCallback(m=>{n(g=>{const x=g.find(b=>b.localId===m);return x?.preview&&URL.revokeObjectURL(x.preview),g.filter(b=>b.localId!==m)})},[]),o=f.useCallback(()=>{n(m=>(m.forEach(g=>{g.preview&&URL.revokeObjectURL(g.preview)}),[]))},[]),l=f.useCallback(()=>{r.current?.click()},[]),c=t.filter(m=>m.id&&!m.error&&!m.uploading).map(m=>({id:m.id,file_name:m.file_name,file_size:m.file_size,mime_type:m.mime_type,file_category:m.file_category,storage_url:m.storage_url})),u=c.map(m=>m.id),d=t.some(m=>m.uploading),h=t.some(m=>m.error),p=c.length>0&&!d;return{attachments:t,addFiles:a,removeAttachment:i,clearAttachments:o,openFilePicker:l,fileInputRef:r,readyAttachments:c,readyAttachmentIds:u,hasUploading:d,hasErrors:h,canSendAttachments:p}}function dst(){return s.jsxs("p",{className:"mt-2 px-1 text-[11px] leading-4 text-ink-muted",children:["Messages and AI replies may be reviewed by this expertâs owner for audience insights. Donât share sensitive personal information."," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-ink",children:"Privacy"})]})}function hst(e){const t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function pst({onSend:e,onStop:t,isStreaming:n=!1,disabled:r,placeholder:a,outOfAnswers:i=!1,expert:o=null,isOwner:l=!1,isUnlimited:c=!1,loginRequired:u=!1,onLoginRequired:d,voiceEnabled:h=!1,onStartCall:p,creatorSummaryConsent:m=!1,onCreatorSummaryConsentChange:g,shell
518ClassName:x="bg-cream px-3 sm:px-4 pb-4 pt-2"}){const[b,y]=f.useState(""),[v,w]=f.useState(!1),[j,E]=f.useState(!1),S=f.useRef(null),_=f.useRef(0),{attachments:k,addFiles:C,removeAttachment:N,clearAttachments:A,openFilePicker:T,fileInputRef:I,readyAttachments:$,hasUploading:O}=pae(o?.id||null);f.useEffect(()=>{const le=S.current;le&&(le.style.height="auto",le.style.height=`${Math.min(le.scrollHeight,200)}px`)},[b]),f.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const le=window.matchMedia("(max-width: 639px)"),ke=()=>E(le.matches);return ke(),le.addEventListener("change",ke),()=>le.removeEventListener("change",ke)},[]);const U=le=>{le.preventDefault();const ke=b.trim(),oe=$.length>0;!ke&&!oe||r||O||(e(b.trim(),$),y(""),A(),S.current&&(S.current.style.height="auto"))},F=le=>{le.key==="Enter"&&!le.shiftKey&&(le.preventDefault(),U(le))},H=le=>{le.preventDefault(),_.current++,le.dataTransfer?.types?.includes("Files")&&w(!0)},G=le=>{le.preventDefault(),_.current--,_.current===0&&w(!1)},M=le=>{le.preventDefault()},z=le=>{le.preventDefault(),_.current=0,w(!1),le.dataTransfer?.files?.length>0&&C(le.dataTransfer.files)},W=f.useCallback(le=>{y(ke=>{const oe=ke.trim();return((oe?`${oe} `:"")+le).slice(0,2e3)}),requestAnimationFrame(()=>{const ke=S.current;if(ke){ke.focus();const oe=ke.value.length;ke.setSelectionRange(oe,oe)}})},[]),D=ore({onTranscript:W}),Z=o?.allow_answer_packs===!1,V=!!o?.access?.is_subscribed,L=typeof o?.access?.trial_remaining=="number"?o.access.trial_remaining:o?.trial_answers??null,K=!l&&!c&&Z&&!V&&(L==null||L<=0),te=!l&&!c&&i&&!Z&&!V,Q=K||te,Y=!!(b.trim()||$.length>0),J=Y&&!r&&!O&&!Q,P=r||Q,ee=D.isRecording||D.isTranscribing,X=!n&&!P,ae=!Y&&!n&&h&&!!p&&!Q;if(u)return s.jsx("div",{className:x,children:s.jsx("div",{className:"max-w-4xl mx-auto",children:s.jsxs("button",{type:"button",onClick:d,className:"w-full min-h-[64px] bg-paper rounded-2xl border border-rule shadow-sm hover:border-indigo hover:bg-indigo-wash/40 focus:outline-none focus:shadow-focus transition-all px-4 py-3 flex items-center gap-3 text-left",children:[s.jsx("span",{className:"flex-1 font-display italic text-[16px] text-ink-muted",children:"Log in to chat"}),s.jsx("span",{className:"w-10 h-10 flex items-center justify-center rounded-full bg-indigo text-cream",children:s.jsx(rl,{className:"w-5 h-5",strokeWidth:2.5})})]})})});const me=le=>s.jsx("button",{type:"button",onClick:T,disabled:P,"aria-label":"Attach files",title:"Attach files",className:`shrink-0 grid place-items-center rounded-full text-ink-mid transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${le?"w-8 h-8 hover:text-ink hover:bg-cream-deep":"w-[38px] h-[38px] border border-rule hover:border-ink-light hover:text-ink"}`,children:s.jsx(Es,{className:le?"w-[18px] h-[18px]":"w-5 h-5",strokeWidth:1.9})}),q=le=>s.jsx("button",{type:"button",onClick:D.start,disabled:D.isDenied,"aria-label":D.isDenied?"Microphone blocked":"Dictate",title:D.isDenied?"Microphone blocked":"Dictate",className:`shrink-0 grid place-items-center rounded-full text-ink-mid transition-colors active:scale-95 disabled:opacity-40 disabled:cursor-not-allowed ${le?"w-8 h-8 hover:text-ink hover:bg-cream-deep":"w-[38px] h-[38px] border border-rule hover:border-ink-light hover:text-ink"}`,children:D.isDenied?s.jsx(yY,{className:le?"w-[18px] h-[18px]":"w-5 h-5",strokeWidth:1.75}):s.jsx(Qr,{className:le?"w-[18px] h-[18px]":"w-5 h-5",strokeWidth:1.75})}),he=le=>n&&t?s.jsx("button",{type:"button",onClick:t,"aria-label":"Stop generating",className:"shrink-0 w-10 h-10 grid place-items-center rounded-full bg-indigo text-cream hover:bg-indigo-deep transition-colors",children:s.jsx(ku,{className:"w-3.5 h-3.5",fill:"currentColor",strokeWidth:0})}):ae?le?s.jsx("button",{type:"button",onClick:p,"aria-label":"Start a voice call with this AI expert",title:"Talk to this AI expert",className:"shrink-0 w-10 h-10 grid place-items-center rounded-full bg-sage text-cream shadow-sm hover:bg-sage-deep active:scale-95 transition-all",children:s.jsx(Ts,{className:"w-[18px] h-[18px]",strokeWidth:1.85})}):s.jsxs("button",{type:"button",onClick:p,"aria-label":"Start a voice call with this AI expert",title:"Talk to this AI expert",className:"shrink-0 h-[38px] px-4 inline-flex items-center gap-2 rounded-full bg-sage text-cream text-[15px] font-medium hover:bg-sage-deep active:scale-[0.98] transition-all",children:[s.jsx(Ts,{className:"w-[18px] h-[18px]",strokeWidth:1.85}),s.jsx("span",{children:"Call"})]}):s.jsx("button",{type:"submit",disabled:!J,"aria-label":"Send message",className:`shrink-0 w-10 h-10 grid place-items-center rounded-full transition-colors ${J?"bg-indigo text-cream hover:bg-indigo-deep":"bg-cream-deep text-ink-light cursor-not-allowed"}`,children:s.jsx(rl,{className:"w-5 h-5",strokeWidth:2})}),se=v||D.isRecording;return s.jsx("div",{className:x,onDragEnter:H,onDragLeave:G,onDragOver:M,onDrop:z,children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[K?s.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3 px-4 py-1.5 rounded-lg bg-peach-tint/60 border border-peach-tint",children:[s.jsxs("p",{className:"flex-1 text-sm text-ink-mid",children:[s.jsx("span",{className:"font-medium text-ink",children:"Your free trial is over."})," ","Subscribe to continue chatting with ",o?.name||"this expert","."]}),o?.subscription?.price_usd&&s.jsx(Hk,{expert:o,className:"shrink-0 inline-flex items-center gap-2 px-4 py-1.5 rounded-md text-sm font-medium bg-peach-deep text-cream hover:bg-peach transition-colors disabled:opacity-60"})]}):te?s.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-3 px-1",children:[s.jsx("span",{className:"truncate text-xs text-destructive",children:"You're out of expert answers."}),s.jsx(Le,{to:"/pricing?for=users",className:"shrink-0 text-sm font-medium text-indigo hover:text-indigo-deep hover:underline",children:"Buy a pack â"})]}):null,D.isDenied&&s.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3 px-4 py-1.5 rounded-lg bg-peach-tint/60 border border-peach-tint animate-fade-in",children:[s.jsxs("p",{className:"flex-1 text-sm text-ink-mid",children:[s.jsx("span",{className:"font-medium text-ink",children:"Microphone access blocked."})," ","Enable it in your browser settings to use voice input."]}),s.jsx("button",{type:"button",onClick:D.reset,className:"shrink-0 text-sm font-medium text-peach-deep hover:underline",children:"Dismiss"})]}),D.status==="error"&&D.error&&s.jsxs("div",{role:"alert",className:"mb-2 flex items-center justify-between gap-3 rounded-lg border border-peach-tint bg-peach-tint/60 px-4 py-1.5 animate-fade-in",children:[s.jsxs("p",{className:"flex-1 text-sm text-ink-mid",children:[s.jsx("span",{className:"font-medium text-ink",children:"Voice input failed."})," ",D.error.message||"Could not transcribe the recording. Please try again."]}),s.jsx("button",{type:"button",onClick:D.reset,className:"shrink-0 text-sm font-medium text-peach-deep hover:underline",children:"Dismiss"})]}),s.jsx("form",{onSubmit:U,children:ee?s.jsxs("div",{className:"relative bg-paper rounded-2xl border border-indigo shadow-focus px-3 py-3 animate-fade-in",children:[k.length>0&&s.jsx("div",{className:"pb-2",children:s.jsx(x5,{attachments:k,onRemove:N})}),D.isRecording?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3 min-h-[40px] px-1",children:[s.jsxs("span",{className:"inline-flex items-center gap-2 text-destructive shrink-0",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-destructive animate-rec-pulse motion-reduce:animate-none"}),s.jsx("span",{className:"font-mono text-[11px] uppercase tracking-eyebrow font-medium",children:"Listening"})]}),s.jsx("div",{className:"flex items-center gap-[3px] h-5 flex-1 min-w-0","aria-hidden":"true",children:D.levels.map((le,ke)=>s.jsx("span",{className:"w-[2px] bg-indigo rounded-full transition-[height] duration-100 ease-out motion-reduce:transition-none",style:{height:`${Math.round(le*100)}%`}},ke))}),s.jsx("span",{className:"font-mono text-[12px] text-ink-mid tabular-nums shrink-0",children:hst(D.elapsedMs)})]}),s.jsxs("div",{className:"mt-1 flex items-center justify-end gap-1.5 min-h-[2rem]",children:[s.jsx("button",{type:"button",onClick:D.cancel,className:"px-3 h-8 rounded-md text-[13px] font-medium text-ink-muted hover:text-ink hover:bg-cream-deep transition-colors",children:"Cancel"}),s.jsx("button",{type:"button",onClick:D.stop,className:"w-9 h-9 flex items-center justify-center rounded-full bg-destructive text-cream shadow-glow hover:opacity-90 active:scale-95 transition-all","aria-label":"Stop recording",children:s.jsx(ku,{className:"w-3 h-3",fill:"
518currentColor",strokeWidth:0})})]})]}):s.jsxs("div",{className:"flex items-center gap-2 min-h-[40px] px-1",children:[s.jsx(vt,{className:"w-3.5 h-3.5 animate-spin text-indigo motion-reduce:animate-none"}),s.jsx("span",{className:"font-mono text-[11px] uppercase tracking-eyebrow font-medium text-indigo",children:"Transcribingâ¦"})]})]}):s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsxs("div",{className:`relative flex-1 min-w-0 bg-paper border transition-all rounded-[22px] sm:rounded-2xl px-2 py-1.5 sm:px-[18px] sm:pt-4 sm:pb-3.5 ${se?"border-indigo shadow-focus":"border-rule shadow-sm focus-within:border-indigo focus-within:shadow-focus"}`,children:[v&&s.jsx("div",{className:"absolute inset-0 bg-indigo-wash/80 rounded-[22px] sm:rounded-2xl flex items-center justify-center z-10 pointer-events-none",children:s.jsx("p",{className:"font-mono text-[11px] uppercase tracking-eyebrow font-medium text-indigo",children:"Drop files here"})}),k.length>0&&s.jsx("div",{className:"pb-2.5 sm:pb-3",children:s.jsx(x5,{attachments:k,onRemove:N})}),s.jsxs("div",{className:"flex items-center gap-1 sm:block",children:[s.jsx("span",{className:"sm:hidden",children:me(!0)}),s.jsx("textarea",{ref:S,value:b,onChange:le=>y(le.target.value.slice(0,2e3)),onKeyDown:F,placeholder:a||(j?"Ask anythingâ¦":"Ask anything. They'll only speak from what they know."),disabled:P,rows:1,className:"flex-1 sm:w-full min-w-0 min-h-[24px] sm:min-h-[28px] max-h-[104px] sm:max-h-[200px] bg-transparent text-[16px] sm:text-[16px] leading-[1.55] text-ink resize-none focus:outline-none overflow-y-auto break-words placeholder:italic placeholder:font-display placeholder:text-ink-muted block py-0.5 sm:py-0"}),X&&s.jsx("span",{className:"sm:hidden",children:q(!0)}),s.jsxs("div",{className:"hidden sm:flex items-center justify-between mt-3.5",children:[s.jsx("div",{className:"flex items-center gap-2",children:me(!1)}),s.jsxs("div",{className:"flex items-center gap-2",children:[X&&q(!1),he(!1)]})]})]})]}),s.jsx("div",{className:"sm:hidden",children:he(!0)})]})}),g&&s.jsx(dst,{checked:m,onChange:g}),s.jsx("input",{ref:I,type:"file",multiple:!0,accept:uae,className:"hidden",onChange:le=>{le.target.files?.length>0&&C(le.target.files),le.target.value=""}})]})})}function mst({className:e=""}){return s.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute rounded-full border-2 border-transparent border-t-indigo border-r-indigo-soft animate-spin motion-reduce:animate-none ${e}`})}function fst({name:e,src:t}){return s.jsxs("span",{className:"relative inline-flex",children:[s.jsx(ws,{name:e||"Expert",src:t,size:"xl",variant:"expert"}),s.jsx(mst,{className:"-inset-[4px]"})]})}function gst({expertName:e,expertAvatarUrl:t,label:n}){return s.jsxs("div",{className:"flex flex-col items-center justify-center text-center px-6",children:[s.jsx(fst,{name:e,src:t}),s.jsx("p",{className:"mt-5 text-sm font-medium text-ink dark:text-neutral-100",children:n||"Loading chat"})]})}function xst({expert:e,isUnlimited:t=!1}){if(!e||t||e.allow_answer_packs!==!1||e.access?.is_subscribed)return null;const n=e.access?.trial_remaining;return typeof n!="number"||n<=0?null:s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-1.5 rounded-lg bg-peach-tint/60 border border-peach-tint",children:[s.jsxs("p",{className:"flex-1 text-sm text-ink-mid",children:[s.jsx("span",{className:"font-medium text-ink",children:"Trial:"})," ",n," answer",n===1?"":"s"," remaining with this expert."]}),s.jsx(Hk,{expert:e,className:"shrink-0 inline-flex items-center gap-2 px-4 py-1.5 rounded-md text-sm font-medium bg-peach-deep text-cream hover:bg-peach transition-colors disabled:opacity-60"})]})}function VU(e,t){e==="open_contact"?U0(t):e==="offer_live_chat"&&Fje(t)}const ps=new Map,am=new Map,Sv=new Map;function bst(e,t,n=null){return t?`${e}:${t}`:`${e}:new:${n||"default"}`}function oa(e,t){(am.get(e)||[]).forEach(r=>{try{r(t)}catch{}})}function eL(e,t,n,r=null,a=null){const i=bst(e,t,r),o=f.useRef(i);o.current=i;const l=f.useRef(t);l.current=t,f.useEffect(()=>{l.current=t},[t]),f.useEffect(()=>{if(t&&r){const v=`${e}:new:${r}`,w=ps.get(v);
518w&&(ps.set(i,{...w,conversationId:t}),w.isStreaming||ps.delete(v))}},[t,e,r,i]);const[c,u]=f.useState(()=>{const v=ps.get(i),w=v?.conversationId===t,j=!t&&!v?.conversationId&&v?.tempId===r;return v?.isStreaming&&v?.expertId===e&&(w||j)||!1}),[d,h]=f.useState(()=>{const v=ps.get(i),w=v?.conversationId===t,j=!t&&!v?.conversationId&&v?.tempId===r;return v?.isStreaming&&v?.expertId===e&&(w||j)||!1}),p=f.useRef(!1),m=f.useCallback((v,w,j={})=>{if(!(!v||!w||!a))try{a(v,{messages:w,...j})}catch{}},[a]),g=f.useCallback((v,w=v,j=i)=>{const E=l.current;return v?E===v:E?!!(w&&E===w):o.current===j},[i]);f.useEffect(()=>{const v=ps.get(i);v?.isStreaming&&v?.expertId===e&&v?.conversationId===t?(u(!0),h(!0)):(u(!1),h(!1))},[e,t,i]),f.useEffect(()=>{p.current=!0;const v=j=>{if(p.current&&j?.expertId===e){if(j?.conversationId!==l.current)if(!j?.conversationId&&!l.current){if(ps.get(i)!==j)return}else return;j&&(u(j.isStreaming),h(j.isStreaming),j.messages&&n(j.messages))}};am.has(i)||am.set(i,[]),am.get(i).push(v);const w=ps.get(i);return w?.isStreaming&&w?.expertId===e&&(w?.conversationId===t||!w?.conversationId&&!t)&&(t||w?.tempId===r)&&v(w),()=>{p.current=!1;const j=am.get(i)||[],E=j.indexOf(v);E>-1&&j.splice(E,1)}},[i,n,e,t,r]);const x=f.useCallback(async(v,w=[],j,E,S=null,_=null,k={})=>{const C=w.map(G=>G.id),N={id:`temp-${Date.now()}`,role:"user",content:v,created_at:new Date().toISOString(),attachments:w},A={id:"__streaming__",role:"assistant",content:"",_isStreaming:!0};let T=[...j,N,A];const I=l.current;ps.set(i,{isStreaming:!0,messages:T,expertId:e,conversationId:I,tempId:r}),n(T),u(!0),h(!0),oa(i,ps.get(i));const $=new AbortController,O={abortController:$,timeoutId:null,userStopped:!1,silentAbort:!1};Sv.set(i,O);const U=12e4,F=()=>{O.timeoutId&&clearTimeout(O.timeoutId),O.timeoutId=setTimeout(()=>{$.abort()},U)};F();let H=!1;try{const G=j.length>0?j[j.length-1].id:null,z=(await $_e(e,v,C,I,$.signal,G,k)).getReader();H=!0;const W=new TextDecoder;let D="",Z=!1,V=I;const L=K=>{const te=K.slice(7).trim();if(te)try{const Q=JSON.parse(te),Y=String(Q.title||"").trim(),J=Q.conversation_id||V||I;if(!Y||!J)return;aA(e,J,Y),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gs:refresh-expert-conversations",{detail:{expertId:e,conversationId:J,title:Y,force:!0,timestamp:Date.now()}}))}catch{}};for(;!Z;){const{done:K,value:te}=await z.read();if(K){if(D+=W.decode(void 0,{stream:!1}),D.trim()){const Y=D.split(` 519`);for(const J of Y){if(!J.startsWith("data: "))continue;const P=J.slice(6);if(P.startsWith("[TITLE]")){L(P);continue}if(P.startsWith("[DONE]")){const ee=P.slice(6).trim();let X=null;if(ee)try{if(X=JSON.parse(ee),X.conversation_id&&(V=X.conversation_id),X.balance&&S)try{S(X.balance)}catch{}}catch{}const ae=T.map(me=>{if(me.id==="__streaming__"){if(!X)return{...me,_isStreaming:!1};const{thinking_duration:q,...he}=X;return{...he,_isStreaming:!1}}return me});ps.set(i,{isStreaming:!1,messages:ae,expertId:e,conversationId:V,tempId:r}),m(V,ae,{isStreaming:!1}),g(I,V)&&(n(ae),u(!1),h(!1)),oa(i,ps.get(i)),E&&g(I,V)&&E(V),Z=!0}else if(P.startsWith("[ERROR]")){const ee=P.slice(8).trim(),X=T.map(ae=>ae.id==="__streaming__"?{...ae,id:`error-${Date.now()}`,content:ee,_isStreaming:!1,_isError:!0}:ae);ps.set(i,{isStreaming:!1,messages:X,expertId:e,conversationId:I,tempId:r,error:ee}),m(I,X,{isStreaming:!1}),g(I)&&(n(X),u(!1),h(!1)),oa(i,ps.get(i)),Z=!0}else if(!(P==="[THINKING_START]"||P==="[THINKING_DONE]"||P.startsWith("[THINKING_TOKEN]")||P.startsWith("[THINKING]")||P==="[ANSWER_START]"))if(P.startsWith("[STATUS]")){const ee=P.slice(8).replace(/\\n
519/g," ").trim(),X=T.map(ae=>ae.id==="__streaming__"?{...ae,_statuses:[...ae._statuses||[],ee]}:ae);T=X,g(I)&&n(X)}else if(P.startsWith("[ACTION]"))VU(P.slice(8).trim(),e);else{const ee=P.replace(/\\n/g,` 520`),X=T.map(ae=>ae.id==="__streaming__"?{...ae,content:ae.content+ee}:ae);T=X,ps.set(i,{isStreaming:!0,messages:X,expertId:e,conversationId:I,tempId:r}),g(I)&&n(X),oa(i,ps.get(i))}}}break}D+=W.decode(te,{stream:!0}),F();const Q=D.split(` 521`);D=Q.pop()||"";for(const Y of Q){if(!Y.startsWith("data: "))continue;const J=Y.slice(6);if(J.startsWith("[DONE]")){const X=J.slice(6).trim();let ae=null;if(X)try{if(ae=JSON.parse(X),ae.conversation_id&&(V=ae.conversation_id),ae.balance&&S)try{S(ae.balance)}catch{}}catch{}const me=T.map(q=>{if(q.id==="__streaming__"){if(!ae)return{...q,_isStreaming:!1};const{thinking_duration:he,...se}=ae;return{...se,_isStreaming:!1}}return q});ps.set(i,{isStreaming:!1,messages:me,expertId:e,conversationId:V,tempId:r}),m(V,me,{isStreaming:!1}),g(I,V)&&(n(me),u(!1),h(!1)),oa(i,ps.get(i)),E&&g(I,V)&&E(V),Z=!0;continue}if(J.startsWith("[TITLE]")){L(J);continue}if(J==="[THINKING_START]"||J==="[THINKING_DONE]"||J.startsWith("[THINKING_TOKEN]")||J.startsWith("[THINKING]")||J==="[ANSWER_START]")continue;
521if(J.startsWith("[STATUS]")){const X=J.slice(8).replace(/\\n/g," ").trim(),ae=T.map(me=>me.id==="__streaming__"?{...me,_statuses:[...me._statuses||[],X]}:me);T=ae,ps.set(i,{isStreaming:!0,messages:ae,expertId:e,conversationId:I,tempId:r}),g(I)&&n(ae),oa(i,ps.get(i));continue}if(J.startsWith("[ACTION]")){VU(J.slice(8).trim(),e);continue}if(J.startsWith("[ERROR]")){const X=J.slice(8).trim(),ae=T.map(me=>me.id==="__streaming__"?{...me,id:`error-${Date.now()}`,content:X,_isStreaming:!1,_isError:!0}:me);ps.set(i,{isStreaming:!1,messages:ae,expertId:e,conversationId:I,tempId:r,error:X}),m(I,ae,{isStreaming:!1}),g(I)&&(n(ae),u(!1),h(!1)),oa(i,ps.get(i)),Z=!0;continue}const P=J.replace(/\\n/g,` 522`),ee=T.map(X=>X.id==="__streaming__"?{...X,content:X.content+P}:X);T=ee,ps.set(i,{isStreaming:!0,messages:ee,expertId:e,conversationId:I,tempId:r}),g(I)&&n(ee),oa(i,ps.get(i))}}}catch(G){if(O.timeoutId&&(clearTimeout(O.timeoutId),O.timeoutId=null),O.silentAbort)return;if(O.userStopped){O.userStopped=!1;const Z=T.map(V=>V.id==="__streaming__"?{...V,id:`stopped-${Date.now()}`,_isStreaming:!1}:V);ps.set(i,{isStreaming:!1,messages:Z,expertId:e,conversationId:I,tempId:r}),m(I,Z,{isStreaming:!1}),g(I)&&(n(Z),u(!1),h(!1)),oa(i,ps.get(i));return}if(G.code==="LIVE_CHAT_ACTIVE"&&Bje(I),G.code==="EXPERT_SUBSCRIPTION_REQUIRED"){const Z=T.filter(V=>V.id!=="__streaming__"&&V.id!==N.id);if(ps.set(i,{isStreaming:!1,messages:Z,expertId:e,conversationId:I,tempId:r}),m(I,Z,{isStreaming:!1}),g(I)&&(n(Z),u(!1),h(!1)),oa(i,ps.get(i)),k.onExpertSubscriptionRequired)try{k.onExpertSubscriptionRequired({content:v,attachments:w,error:G})}catch{}return}if(G.code==="INSUFFICIENT_BALANCE"||G.status===402){const Z=T.filter(V=>V.id!=="__streaming__");if(ps.set(i,{isStreaming:!1,messages:Z,expertId:e,conversationId:I,tempId:r}),m(I,Z,{isStreaming:!1}),g(I)&&(n(Z),u(!1),h(!1)),oa(i,ps.get(i)),_)try{_(G)}catch{}return}if(G.code==="ANONYMOUS_SIGNUP_REQUIRED"||G.code==="LOGIN_REQUIRED"){const Z=T.filter(V=>V.id!=="__streaming__"&&V.id!==N.id);if(ps.set(i,{isStreaming:!1,messages:Z,expertId:e,conversationId:I,tempId:r}),g(I)&&(n(Z),u(!1),h(!1)),oa(i,ps.get(i)),k.onAuthRequired)try{k.onAuthRequired({content:v,attachments:w,error:G})}catch{}return}if(G.code==="TERMS_ACCEPTANCE_REQUIRED"){const Z=T.filter(V=>V.id!=="__streaming__"&&V.id!==N.id);if(ps.set(i,{isStreaming:!1,messages:Z,expertId:e,conversationId:I,tempId:r}),g(I)&&(n(Z),u(!1),h(!1)),oa(i,ps.get(i)),k.onTermsRequired)try{k.onTermsRequired({content:v,attachments:w,error:G})}catch{}return}let M=!1;if(H&&G.name!=="AbortError"){const V=Date.now()+9e4;let L=null,K=1e3;for(;!L&&Date.now()<V;){await new Promise(te=>setTimeout(te,K)),K=Math.min(K+1e3,5e3);try{const Q=(await Nb(e,I))?.data?.messages||[],Y=Q.findLastIndex(J=>J.role==="user"&&J.content===v);L=Y>=0?Q.slice(Y+1).find(J=>J.role==="assistant"):null}catch{}}if(L){const te=T.map(Q=>Q.id==="__streaming__"?{...L,_isStreaming:!1}:Q);ps.set(i,{isStreaming:!1,messages:te,expertId:e,conversationId:I,tempId:r}),m(I,te,{isStreaming:!1}),g(I)&&(n(te),u(!1),h(!1)),oa(i,ps.get(i));return}M=!0}const W=G.name==="AbortError"?"The expert took too long to respond. Please try again.":M?"Connection lost. Your message may not have been answered â please try again.":G.message||"Failed to send message",D=T.map(Z=>Z.id==="__streaming__"?{...Z,id:`error-${Date.now()}`,content:W,_isStreaming:!1,_isError:!0}:Z);ps.set(i,{isStreaming:!1,messages:D,expertId:e,conversationId:I,tempId:r,error:W}),m(I,D,{isStreaming:!1}),g(I)&&(n(D),u(!1),h(!1)),oa(i,ps.get(i))}finally{O.timeoutId&&(clearTimeout(O.timeoutId),O.timeoutId=null),Sv.delete(i),setTimeout(()=>{const G=ps.get(i);G&&!G.isStreaming&&(ps.delete(i),am.delete(i))},3e4)}},[e,i,n,r,g,m]),b=f.useCallback(()=>{const v=Sv.get(i);v?.abortController&&(v.userStopped=!0,v.abortController.abort())},[i]),y=f.useCallback(()=>{const v=Sv.get(i);v&&(v.silentAbort=!0,v.timeoutId&&(clearTimeout(v.timeoutId),v.timeoutId=null),v.abortController?.abort());const w=ps.get(i);if(w){const j=(w.messages||[]).filter(E=>E.id!=="__streaming__");ps.set(i,{...w,isStreaming:!1,messages:j}),oa(i,ps.get(i))}u(!1),h(!1)},[i]);return f.useEffect(()=>{const v=ps.get(i);if(v?.isStreaming&&v?.expertId===e&&(v?.conversationId===t||!v?.conversationId&&!t)){if(!t&&v?.tempId!==r)return;n(v.messages),u(!0),h(!0)}}
522,[i,n,e,t,r]),{isStreaming:c,isSending:d,startStream:x,abortStream:y,stopStream:b}}function Cv(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}const GU=50,yst=25,zi=new Map;function Dl(e,t){return!e||!t?null:`${e}:${t}`}function Tv(e,t){if(e)for(zi.has(e)&&zi.delete(e),zi.set(e,t);zi.size>yst;){const n=zi.keys().next().value;zi.delete(n)}}function vst(e,t){const n=Dl(e,t);n&&zi.delete(n)}function wst(e,t){if(e?.role!=="user"||t?.role!=="user"||(e.content||"")!==(t.content||""))return!1;const n=new Date(e.created_at||0).getTime(),r=new Date(t.created_at||0).getTime();return!Number.isFinite(n)||!Number.isFinite(r)?!0:Math.abs(n-r)<30*1e3}function jst(e,t=[]){const n=String(e?.id||"");return n.startsWith("temp-")?t.some(r=>wst(e,r)):n==="__streaming__"&&!e?._isStreaming?t.some(r=>r.role==="assistant"&&(r.content||"")===(e.content||"")):!1}function _st(e=[],t=[]){const n=new Map;return(t.length?e.filter(a=>!jst(a,t)):e).forEach(a=>n.set(a.id,a)),t.forEach(a=>n.set(a.id,a)),[...n.values()].sort((a,i)=>{const o=new Date(a.created_at||0)-new Date(i.created_at||0);return o!==0?o:String(a.id||"").localeCompare(String(i.id||""))})}function kst(e,t=null){const[n,r]=f.useState([]),[a,i]=f.useState(!1),[o,l]=f.useState(!1),[c,u]=f.useState(!1),[d,h]=f.useState(null),[p,m]=f.useState(null),[g,x]=f.useState(t),[b,y]=f.useState(!1),v=f.useRef(t),w=f.useRef(!1),j=f.useRef(e),[E,S]=f.useState(()=>Cv()),_=f.useRef(0),k=f.useRef(null),C=f.useCallback((K,te)=>{const Q=Dl(e,K);if(!Q||!Array.isArray(te?.messages))return;const Y=zi.get(Q);Tv(Q,{messages:te.messages,hasMoreMessages:Y?.hasMoreMessages||!1,nextCursor:Y?.nextCursor||null})},[e]),{isStreaming:N,isSending:A,startStream:T,abortStream:I,stopStream:$}=eL(e,g,r,E,C),{updateBalance:O,refreshBalance:U}=Ut(),{addToast:F}=f.useContext(Zs)||{};f.useEffect(()=>{if(j.current!==e)return;const K=Dl(e,g||v.current);!K||a&&n.length===0||Tv(K,{messages:n,hasMoreMessages:c,nextCursor:d,creatorSummaryConsent:b})},[e,g,n,c,d,a,b]);const H=f.useCallback(()=>{F&&F("You're out of answers. Buy a pack to keep chatting.","error"),U()},[F,U]);f.useEffect(()=>{j.current!==e&&(j.current=e,v.current=t,x(t),S(Cv()),r([]),u(!1),h(null),m(null),y(!1),k.current&&(k.current.abort(),k.current=null))},[e,t]);const G=f.useCallback(async(K=null)=>{const te=++_.current;k.current&&k.current.abort(),k.current=new AbortController,i(!0),m(null);const Q=K||v.current;try{const Y=Dl(e,Q),J=Y?zi.get(Y):null;J?(r(J.messages),u(J.hasMoreMessages||!1),h(J.nextCursor||null),y(!!J.creatorSummaryConsent)):(r([]),u(!1),h(null));const P=await Nb(e,Q,k.current.signal,{limit:GU});if(te!==_.current||j.current!==e)return;const ee=P.data.conversation_id||Q,X=P.data.messages||[],ae=J?_st(J.messages,X):X;r(ae),y(!!P.data.creator_summary_consent),u(P.data.has_more||!1),h(P.data.next_cursor||null),Tv(Dl(e,ee),{messages:ae,hasMoreMessages:P.data.has_more||!1,nextCursor:P.data.next_cursor||null,creatorSummaryConsent:!!P.data.creator_summary_consent}),P.data.conversation_id&&(v.current=P.data.conversation_id,x(P.data.conversation_id))}catch(Y){if(Y.name==="AbortError"||te!==_.current)return;if(Y.response?.status===404&&Q){zi.delete(Dl(e,Q)),v.current=null,x(null),r([]),u(!1),h(null),m({code:"CONVERSATION_NOT_FOUND",conversationId:Q});return}m(Y.response?.data?.detail?.message||"Failed to load history")}finally{te===_.current&&(i(!1),k.current=null)}},[e]),M=f.useCallback(async()=>{if(!v.current||!d||!c||w.current)return null;w.current=!0,l(!0);try{const K=await Nb(e,v.current,null,{limit:GU,before:d}),te=K.data.messages||[];return r(Q=>{const Y=new Set(Q.map(P=>P.id));return[...te.filter(P=>!Y.has(P.id)),...Q]}),u(K.data.has_more||!1),h(K.data.next_cursor||null),K.data}catch(K){return m(K.response?.data?.detail?.message||"Failed to load older messages"),null}finally{w.current=!1,l(!1)}},[e,c,d]),z=f.useCallback(async(K,te=[])=>{m(null);const Q=[...n];await T(K,te,Q,Y=>{Y&&(v.current=Y,x(Y))},O,H,{creatorSummaryConsent:b})},[n,T,O,H,b]),W=f.useCallback(async({resetState:K=!0}={})=>{if(!v.current)return!1;I();try{const te=v.current;return await F_e(e,te),zi.delete(Dl(e,te)),K&&(r([]),u(!1),h(null),y(!1),v.current=null,x(null)),!0}catch(te){return m(te.response?.data?.detail?.message||"Failed to clear chat"),!1}}
522,[e,I]),D=f.useCallback(async K=>{k.current&&(k.current.abort(),k.current=null),v.current=K,x(K);const te=zi.get(Dl(e,K));if(te){r(te.messages),u(te.hasMoreMessages||!1),h(te.nextCursor||null),y(!!te.creatorSummaryConsent);return}r([]),u(!1),h(null),y(!1),await G(K)},[e,G]),Z=f.useCallback(async(K=[])=>{k.current&&(k.current.abort(),k.current=null),_.current+=1;const te={conversationId:v.current,activeConversationId:g,newConversationKey:E,messages:n,hasMoreMessages:c,nextCursor:d,creatorSummaryConsent:b};S(Cv()),v.current=null,x(null),r(K),u(!1),h(null),y(!1);try{const Q=await X4(e),Y=Q.data.conversation,J=Array.isArray(Q.data.messages)?Q.data.messages:K;return v.current=Y.id,x(Y.id),r(J),y(!!Y.creator_summary_consent),Tv(Dl(e,Y.id),{messages:J,hasMoreMessages:!1,nextCursor:null,creatorSummaryConsent:!!Y.creator_summary_consent}),Y}catch(Q){throw v.current=te.conversationId,x(te.activeConversationId),S(te.newConversationKey),r(te.messages),u(te.hasMoreMessages),h(te.nextCursor),y(te.creatorSummaryConsent),Q}},[e,g,E,n,c,d,b]),V=f.useCallback(()=>{k.current&&(k.current.abort(),k.current=null),I(),v.current=null,x(null),S(Cv()),r([]),u(!1),h(null),m(null),y(!1)},[I]),L=f.useCallback(()=>{k.current&&k.current.abort()},[]);return{messages:n,isHistoryLoading:a,isSending:A,isStreaming:N,error:p,isOlderMessagesLoading:o,hasMoreMessages:c,activeConversationId:g,creatorSummaryConsent:b,setCreatorSummaryConsent:y,loadHistory:G,loadOlderMessages:M,sendMessage:z,clearChat:W,switchConversation:D,startNewConversation:Z,resetChatState:V,cleanup:L,stopStream:$}}function Nst(e){const t=String(e||"").replace(/\s+/g," ").trim();if(!t)return null;const n=t.split(" ").slice(0,7).join(" ");return n.length>60?`${n.slice(0,57).trim()}...`:n}function YU(){const{id:e,conversationId:t}=Ef(),n=Ps(),r=an(),{onMenuClick:a,desktopCollapsed:i,onToggleDesktop:o}=l_()||{},{user:l,balance:c,isAuthenticated:u,isLoading:d,hasStoredSession:h}=Ut();f.useEffect(()=>{!d&&u&&l?.account_completed===!1&&n("/complete-account",{replace:!0})},[d,u,l?.account_completed,n]);const p=u||d&&h,m=c?.answers===-1,g=c?c.answers===0:!1,{messages:x,isSending:b,isHistoryLoading:y,isOlderMessagesLoading:v,hasMoreMessages:w,error:j,loadHistory:E,loadOlderMessages:S,sendMessage:_,clearChat:k,activeConversationId:C,startNewConversation:N,switchConversation:A,resetChatState:T,cleanup:I,stopStream:$,creatorSummaryConsent:O,setCreatorSummaryConsent:U}=kst(e,t),{recentExperts:F,addRecentExpert:H,ensureRecentExpert:G,removeRecentExpert:M,refreshRecentExperts:z}=A4(),[W,D]=f.useState(null),Z=!!(l?.id&&W?.user_id&&W.user_id===l.id),[V,L]=f.useState(!0),[K,te]=f.useState(null),[Q,Y]=f.useState(!1),J=f.useRef(t),P=f.useRef(e),ee=f.useRef(!1),[X,ae]=f.useState(!1),[me,q]=f.useState(!1),[he,se]=f.useState(!1),[le,ke]=f.useState(null),[oe,Oe]=f.useState(null),Je=f.useRef(null),Ie=f.useRef(x);f.useEffect(()=>{Ie.current=x},[x]);const ue=f.useCallback((De={})=>{window.dispatchEvent(new CustomEvent("gs:refresh-expert-conversations",{detail:{timestamp:Date.now(),...De}}))},[]);f.useEffect(()=>{j?.code!=="CONVERSATION_NOT_FOUND"||!t||(rA(W?.id||e,t),ue({expertId:W?.id||e,deletedConversationId:t,force:!0}),n(`/experts/${e}/chat`,{replace:!0}))},[j,t,W?.id,e,ue,n]),f.useEffect(()=>{u&&(W&&(!ee.current&&b?ue({expertId:W.id}):ee.current&&!b&&ue({expertId:W.id,force:!0})),ee.current=b)},[b,W,ue,u]),f.useEffect(()=>{P.current!==e&&(P.current=e,J.current=t,queueMicrotask(()=>{q(!1),se(!1),ke(null),Oe(null),D(null),L(!0),te(null),Y(!1)}))},[e,t]);const be=f.useRef(null);f.useEffect(()=>()=>clearTimeout(be.current),[]);const Re=f.useCallback(({conversationId:De,hadTurn:qe,seconds:ye=0,reason:Ze}={})=>{if(q(!1),ke(null),!qe)return;const jt=W?.id||e,Nt=()=>ue({expertId:jt,force:!0});clearTimeout(be.current),Oe({seconds:ye,reason:Ze,status:"saving",convId:De||null,afterId:Ie.current[Ie.current.length-1]?.id??null});const ne=()=>Oe(xe=>xe&&xe.status==="saving"?{...xe,status:"saved"}:xe),ge=()=>{Nt(),J.current===De?Promise.resolve(E(De)).catch(()=>{}).finally(ne):(vst(jt,De),ne())};if(!De){Nt(),z(),be.current=setTimeout(()=>{Nt(),ne()},2500);return}
522De===(C||t)?(Nt(),be.current=setTimeout(ge,2500)):(n(`/experts/${e}/chat/${De}`),z(),Nt(),be.current=setTimeout(ge,2500))},[W,e,C,t,E,n,z,ue]);oe&&(j?.code==="CONVERSATION_NOT_FOUND"||oe.convId&&t&&oe.convId!==t)&&Oe(null);const Ge=f.useMemo(()=>{if(oe?.status!=="saved"||!oe.convId||oe.convId!==(C||t))return null;const De=oe.afterId?x.findIndex(ye=>ye.id===oe.afterId):-1;let qe=De+1;if(De===-1)for(qe=x.length;qe>0&&x[qe-1].source==="voice";)qe-=1;return x.slice(qe).find(ye=>ye.source==="voice"&&ye.role==="user")?.id??null},[oe,x,C,t]),it=f.useCallback(De=>{Je.current=De.code,ke(De.code),se(!1),Oe(null),q(!0)},[]),ut=f.useCallback(()=>{const De=lae(W?.voice_languages);De?it(De):se(!0)},[W?.voice_languages,it]);f.useEffect(()=>{if(!W||!new URLSearchParams(r.search).has("call"))return;u&&Qw(W)&&ut(),n(r.pathname,{replace:!0})},[W,u]);const $t=f.useCallback(()=>{se(!1)},[]),tt=f.useCallback(()=>{Oe(null),Je.current?(ke(Je.current),q(!0)):ut()},[ut]);f.useEffect(()=>()=>{I()},[I]),f.useEffect(()=>{!d&&!u&&t&&n("/login",{replace:!0,state:{from:{pathname:r.pathname,search:r.search}}})},[d,u,t,n,r.pathname,r.search]);const He=f.useCallback(()=>{n("/login",{state:{from:{pathname:r.pathname,search:r.search}}})},[n,r.pathname,r.search]),wt=f.useCallback(De=>{n("/feedback",{state:{contextType:"chat",messageId:De,expertId:W?.id,expertName:W?.name}})},[n,W?.id,W?.name]);f.useEffect(()=>{let De=!1;async function qe(){try{return(await cu(e)).data.expert}catch{return(await FT(e)).data.expert}}async function ye(){return(await FT(e)).data.expert}J.current=t,queueMicrotask(()=>{De||L(!0)});const Ze=p?qe():ye(),jt=p?E(t):Promise.resolve().then(T);return Promise.all([Ze.then(Nt=>{De||D(Nt)}).catch(()=>{De||D(null)}),jt.catch(()=>{})]).finally(()=>{De||L(!1)}),()=>{De=!0}},[e,p]),f.useEffect(()=>{u&&t&&t!==J.current&&(J.current=t,A(t))},[t,A,u]);const St=W?.id;f.useEffect(()=>{if(!St||Q)return;let De=!1;return kh(St).then(qe=>{if(De)return;const ye=qe?.data?.starters;Array.isArray(ye)&&ye.length>0&&te(ye)}).catch(()=>{}).finally(()=>{De||Y(!0)}),()=>{De=!0}},[St,Q]),f.useEffect(()=>{u&&!V&&!y&&W&&x.length>0&&G({id:W.id,slug:W.slug,name:W.name,avatar_url:W.avatar_url})},[u,V,y,W,x.length,G]),f.useEffect(()=>{u&&C&&!t&&(J.current=C,n(`/experts/${e}/chat/${C}`,{replace:!0,state:r.state}),W&&z())},[C,t,e,n,W,z,u,r.state]);const Zt=f.useCallback(async(De,qe=[])=>{if(!u){He();return}if(Oe(null),W){H({id:W.id,slug:W.slug,name:W.name,avatar_url:W.avatar_url});const ye=!x.some(Nt=>Nt.role==="user"),Ze=C||t,jt=ye?Nst(De):null;jt&&Ze?(aA(W.id,Ze,jt),ue({expertId:W.id,conversationId:Ze,title:jt}),setTimeout(()=>ue({expertId:W.id,force:!0}),2e3),setTimeout(()=>ue({expertId:W.id,force:!0}),5e3)):ue({expertId:W.id})}await _(De,qe),D(ye=>{if(!ye||m||ye.allow_answer_packs!==!1||ye.access?.is_subscribed)return ye;const Ze=ye.access?.trial_remaining;return typeof Ze!="number"||Ze<=0?ye:{...ye,access:{...ye.access,trial_remaining:Ze-1}}})},[u,He,_,W,H,ue,m,x,C,t]),Jt=f.useRef(!1);f.useEffect(()=>{const De=r.state?.pendingMessage;!De||Jt.current||V||!W||!u||(Jt.current=!0,n(r.pathname+r.search,{replace:!0,state:null}),Zt(De))},[V,W,u]);const $e=f.useCallback(async()=>{if(!u){He();return}Oe(null),clearTimeout(be.current);const De=W?.id||e,qe=C||t,Ze=L_e(De)?.data?.conversations,jt=Array.isArray(Ze),Nt=(Ze||[]).filter(ge=>ge.id!==qe);if(qe&&(rA(De,qe),ue({expertId:De,deletedConversationId:qe})),!await k({resetState:jt&&Nt.length===0})){ue({expertId:De,force:!0});return}if(W?.id&&W.id!==e&&fD(W.id),Nt.length>0){n(`/experts/${e}/chat/${Nt[0].id}`,{replace:!0}),ue({expertId:De,force:!0});return}try{const xe=(await F_(De,{force:!0})).data.conversations||[];xe.length>0?n(`/experts/${e}/chat/${xe[0].id}`,{replace:!0}):(M(W?.id||e),T(),n(`/experts/${e}/chat`,{replace:!0}))}catch{T(),n(`/experts/${e}/chat`,{replace:!0})}},[u,He,k,M,e,n,W,C,t,ue,T]),Qe=f.useCallback(async()=>{if(!u){He();return}Oe(null),clearTimeout(be.current);const De=W?.greeting?[{id:`optimistic-greeting-${W.id}-${Date.now()}`,role:"assistant",content:W.greeting,expert_id:W.id,created_at:new Date().toISOString(),user_reaction:null,attachments:[]}]:[],qe=await N(De);
522W?.id&&W.id!==e&&fD(W.id),J.current=qe.id,n(`/experts/${e}/chat/${qe.id}`);const ye=W?.id||e,Ze=qe.title||"New Chat";W&&H({id:W.id,slug:W.slug,name:W.name,avatar_url:W.avatar_url}),aA(ye,qe.id,Ze),ue({expertId:ye,conversationId:qe.id,title:Ze}),setTimeout(()=>ue({expertId:ye,force:!0}),1500)},[u,He,N,e,n,W,H,ue]),ct=t?s.jsx(vs,{noIndex:!0}):W?s.jsx(vs,{title:or.expert.title(W.name),description:or.expert.description(W.name),path:`/experts/${encodeURIComponent(e)}/chat`,ogImage:or.expert.image(e)}):null;if(V){const De=(F||[]).find(qe=>qe.slug===e||qe.id===e)||r.state?.expert;return s.jsxs(s.Fragment,{children:[ct,s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-cream",children:s.jsx(gst,{variant:"expert",expertName:De?.name,expertAvatarUrl:De?.avatar_url})})]})}if(!W)return s.jsxs(s.Fragment,{children:[ct,s.jsxs("div",{className:"mx-auto max-w-md px-6 py-16 text-center",children:[s.jsx("p",{className:"text-[15px] font-medium text-ink",children:"This expert is no longer available."}),s.jsx("p",{className:"mt-2 text-sm leading-relaxed text-ink-muted",children:"It may have been removed by its creator. You cannot send new messages to it."}),s.jsx(Le,{to:"/explore",className:"mt-6 inline-flex h-11 items-center justify-center rounded-pill border border-rule bg-paper px-5 text-sm font-medium text-ink transition-colors duration-fast ease-standard hover:border-ink-light hover:bg-cream-deep",children:"Find another expert"})]})]});const Ye=(!u&&W.greeting?[{id:`preview-greeting-${W.id}`,role:"assistant",content:W.greeting,expert_id:W.id,created_at:null}]:null)||x,rt=Array.isArray(W.voice_languages)?W.voice_languages:[];return s.jsxs(s.Fragment,{children:[ct,s.jsx(cae,{isOpen:he,languages:rt,onClose:$t,onSelect:it}),s.jsxs("div",{className:X?"fixed inset-0 z-50 flex flex-col bg-cream":"flex flex-col flex-1 min-h-0 bg-cream rounded-lg overflow-hidden border border-rule shadow-card",children:[s.jsx(Att,{expert:W,messages:x,onClearChat:u?$e:void 0,onNewChat:u?Qe:void 0,onMenuClick:a,desktopCollapsed:i,onToggleDesktop:o,isFullscreen:X,onToggleFullscreen:()=>ae(De=>!De)}),me&&s.jsx(oae,{expert:W,conversationId:C||t||null,language:le,onClose:Re},le),s.jsx(ust,{messages:Ye,isTyping:b,isHistoryLoading:y,expertName:W.name,expertAvatarUrl:W.avatar_url,expertDescription:W.description,creatorName:W.creator_name,userName:l?.full_name||"You",expertId:W.id,onReact:u?Jbe:void 0,onFeedback:u?wt:void 0,starters:K,onStarterClick:Zt,onLoadMore:u?S:void 0,hasMore:u&&w,isLoadingOlder:v,scrollKey:C?`expert:${W.id}:${C}`:`expert:${W.id}:new`,pinMessageId:Ge}),s.jsx("div",{className:"bg-cream px-4 pt-2",children:s.jsx("div",{className:"max-w-4xl mx-auto",children:s.jsx(xst,{expert:W,isUnlimited:m})})}),oe&&s.jsx("div",{className:"bg-cream px-4 pt-2",children:s.jsx("div",{className:"max-w-4xl mx-auto",children:s.jsx(Ktt,{seconds:oe.seconds,status:oe.status,reason:oe.reason,onCallAgain:tt,onDismiss:()=>Oe(null)})})}),s.jsx(pst,{onSend:Zt,onStop:$,isStreaming:b,disabled:b,loginRequired:!u,onLoginRequired:He,outOfAnswers:g,expert
522:W,isOwner:Z,isUnlimited:m,voiceEnabled:u&&Qw(W),onStartCall:ut,creatorSummaryConsent:O,onCreatorSummaryConsentChange:U})]})]})}function Est({platform:e,disabled:t=!1}){const[n,r]=f.useState(null),[a,i]=f.useState(""),[o,l]=f.useState(!1),[c,u]=f.useState(0),d=f.useRef(0),h=f.useRef(!1),p=f.useRef(null),m=o||n?.status==="running";f.useEffect(()=>{h.current=!0;let b=!1;async function y(){const v=d.current;let w=0;try{const j=await Rbe(e);!b&&v===d.current&&r(j),j?.status==="running"&&(w=4e3)}catch{w=15e3}!b&&w&&(p.current=window.setTimeout(y,w))}return y(),()=>{b=!0,h.current=!1,window.clearTimeout(p.current)}},[e,c]);async function g(){if(!m){d.current+=1,l(!0),i("");try{const b=await Abe(e);h.current&&(r(b),u(y=>y+1))}catch(b){if(h.current){const y=b?.response?.data?.detail;i(typeof y=="string"?y:y?.message||"Could not start the update. Please retry.")}}finally{h.current&&l(!1)}}}const x=a||n?.error||(n?.status==="failed"?"Some experts could not be updated. Refetch to retry.":n?.status==="completed"?n.result?.documents?"New posts added to your experts.":"Your experts are up to date.":m?"Updating connected expertsâ¦":"");return s.jsxs("div",{className:"flex max-w-full flex-col items-end gap-1.5",children:[s.jsxs("button",{type:"button",onClick:g,disabled:t||m,className:"ge-surface-btn h-10 gap-2 px-4 text-[13px]","aria-label":`Refetch ${e}`,children:[s.jsx(_b,{className:`h-[15px] w-[15px] ${m?"animate-spin":""}`,"aria-hidden":"true"}),o?"Startingâ¦":m?"Updatingâ¦":"Refetch"]}),x&&s.jsx("span",{role:"status",className:"max-w-64 text-right text-xs text-ink-muted",children:x})]})}function Sst({onClose:e,onChanged:t}){const{updateUser:n}=Ut(),r=f.useId(),a=f.useRef(null),[i,o]=f.useState(null),[l,c]=f.useState("edit"),[u,d]=f.useState(""),[h,p]=f.useState(!1),[m,g]=f.useState(""),[x,b]=f.useState(""),[y,v]=f.useState(null),[w,j]=f.useState(""),[E,S]=f.useState(!1),[_,k]=f.useState(0),C=f.useRef(!1);f.useEffect(()=>{let M=!1;return q_().then(z=>{if(M)return;const W=z.data.user.username||z.data.user.slug||"";o(W),b(W)}).catch(()=>{M||j("Could not load your username. Close this dialog and try again.")}),()=>{M=!0}},[]),f.useEffect(()=>{l!=="edit"&&a.current?.focus()},[l]);const N=Jb(x),A=i!==null&&x!==i,T=l==="edit"&&A&&!N,I=y?.username===x?y:null;f.useEffect(()=>{if(!T)return;let M=!1;const z=setTimeout(async()=>{try{const W=await nR(x);M||v({username:x,available:W.data?.available===!0,reason:W.data?.reason})}catch{M||v({username:x,available:null})}},400);return()=>{M=!0,clearTimeout(z)}},[x,T,_]);const $=A&&!N&&I?.available===!0&&!E,O=()=>{C.current||e()},U=M=>{M.preventDefault(),$&&!C.current&&(j(""),c("confirm"))},F=async()=>{if(!(l!=="confirm"||!$||C.current)){C.current=!0,S(!0),j("");try{const M=await ch({username:x}),z=M?.data?.user?.username||M?.data?.user?.slug;if(z!==x||Jb(z))throw new Error("The new profile link could not be confirmed. Please try again.");n({username:z}),d(ll({username:z})),c("success"),t?.(z)}catch(M){j(M.response?.data?.detail?.message||M.message||"Could not change your username. Try again.")}finally{C.current=!1,S(!1)}}},H=async()=>{p(!1),g("");try{await navigator.clipboard.writeText(u),p(!0)}catch{g("Could not copy the link. Select it below and copy it manually.")}},G=l==="success"?"Your profile link has changed":l==="confirm"?"Change your profile link?":"Change username";return s.jsxs(en,{isOpen:!0,onClose:O,title:G,hideTitle:!0,className:"username-dialog",backdropZ:"z-[10020]",contentZ:"z-[10030]",children:[s.jsxs("div",{className:"username-dialog-header",children:[s.jsx("h2",{ref:a,tabIndex:-1,children:G}),s.jsx("button",{type:"button",className:"username-dialog-close","aria-label":"Close username editor",disabled:E,onClick:O,children:s.jsx(as,{"aria-hidden":"true"})})]}),l==="success"?s.jsxs("div",{children:[s.jsx("p",{className:"username-dialog-notice",children:"Share your new profile link:"}),s.jsx("input",{className:"username-dialog-share-link","aria-label":"New profile link",readOnly:!0,value:u,onFocus:M=>M.target.select()}),m&&s.jsx("p",{role:"alert",className:"username-dialog-error",children:m}),s.jsxs("div",{className:"username-dialog-actions",children:[s.jsxs(yt,{type:"button",variant:"secondary",onClick:H,children:[h?s.jsx(ft,{"aria-hidden":"true"}):s.jsx(ju,{"aria-hidden":"true"}),h?"Copied":"Copy link"]}),s.jsx(yt,{type:"button",variant:"ink",onClick:O,children:"Done"})]})]}):l==="confirm"?s.jsxs("div",{children:[s.jsx("p",{className:"username-dialog-notice",children:"Are you sure you want to change your profile link to:"}),s.jsx("p",{className:"username-dialog-share-link",children:ll({username:x})}),s.jsx("p",{className:"username-dialog-notice",children:"Your old link will stop working after the change."}),w&&s.jsx("p",{role:"alert",className:"username-dialog-error",children:w}),s.jsxs("div",{className:"username-dialog-actions",children:[s.jsx(yt,{type:"button",variant:"secondary",disabled:E,onClick:()=>{c("edit"),j("")},children:"Cancel"}),s.jsx(yt,{type:"button",variant:"ink",disabled:!$,isLoading:E,onClick:F,children:"Yes, change link"})]})]}):s.jsxs("form",{onSubmit:U,children:[s.jsx("label",{htmlFor:r,className:"username-dialog-label",children:"Your profile link"}),s.jsxs("div",{className:`username-dialog-field${A&&(N||I?.available===!1)?" is-invalid":""}`,children:[s.jsx("span",{className:"username-dialog-prefix",children:H_({username:"x"}).slice(0,-1)}),s.jsxs("div",{className:"username-dialog-input-row",children:[s.jsx("input",{id:r,type:"text",className:"input w-full",value:x,disabled:i===null||E,maxLength:Xb,autoCapitalize:"none",autoComplete:"off",spellCheck:!1,"aria-describedby":`${r}-status`,"aria-invalid":A&&(!!N||I?.available===!1)||void 0,onChange:M=>{b(Mj(M.target.value)),v(null),j("")}}),T&&!I?s.jsx(vt,{className:"username-dialog-spinner","aria-label":"Checking availability"}):T&&I?.available===!0?s.jsx(ft,{className:"username-dialog-check","aria-label":"Available"}):null]})]}),s.jsx("div",{id:`${r}-status`,role:"status","aria-live":"polite",className:"username-dialog-status",children:i===null?!w&&"Loadingâ¦":A?N?s.jsxs("span",{className:"username-dialog-error",children:[s.jsx(Co,{"aria-hidden":"true"}),N]}):I?I.available===!0?s.jsx("span",{className:"username-dialog-available",children:"Available"}):I.available===!1?s.jsxs("span",{className:"username-dialog-error",children:[s.jsx(Co,{"aria-hidden":"true"}),I.reason||"This username is already taken."]}):s.jsxs("span",{children:["Could not check availability. ",s.jsx("button",{type:"button",className:"underline",onClick:()=>{v(null),k(M=>M+1)},children:"Try again"})]}):"Checkingâ¦":"Your current username"}),w&&s.jsx("p",{role:"alert",className:"text-sm text-destructive",children:w}),s.jsx("p",{className:"username-dialog-hint",children:"3â40 characters · aâz, 0â9, hyphens"}),A&&s.jsx("p",{className:"username-dialog-notice",children:"Your old link will stop working after the change."}),s.jsxs("div",{className:"username-dialog-actions",children:[s.jsx(yt,{type:"button",variant:"secondary",disabled:E,onClick:O,children:"Cancel"}),s.jsx(yt,{type:"submit",variant:"ink",disabled:!$,isLoading:E,children:"Change"})]})]})]})}function mae({className:e="",iconOnly:t=!1,onChanged:n}){const[r,a]=f.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:e,"aria-label":"Edit username",title:"Edit username","aria-haspopup":"dialog",onClick:()=>
522a(!0),children:[s.jsx(y0,{className:t?"ico ico-13":"h-[15px] w-[15px]","aria-hidden":"true"}),!t&&"Edit"]}),r&&s.jsx(Sst,{onClose:()=>a(!1),onChanged:n})]})}const Av="w-full ge-card overflow-hidden",LS="ge-card-header flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-5 py-2.5 sm:px-6",Rv="font-heading text-[17px] font-normal tracking-[-0.018em] text-ink",Iv="ge-surface-btn h-10 gap-2 px-4 text-[13px]",Bp="input h-11 text-sm outline-2 outline-transparent hover:border-ink-light focus:outline-none disabled:cursor-not-allowed disabled:bg-cream-deep disabled:text-ink-muted";function Cst(){const{user:e,updateUser:t,logout:n}=Ut(),{addToast:r}=f.useContext(Zs),a=Ps(),i=f.useRef(null),o=f.useRef(null),[l,c]=f.useState(null),[u,d]=f.useState(""),[h,p]=f.useState(""),[m,g]=f.useState(""),[x,b]=f.useState(!1),[y,v]=f.useState(!0),[w,j]=f.useState(!1),[E,S]=f.useState(!1),[_,k]=f.useState(""),[C,N]=f.useState(!1),[A,T]=f.useState(null),[I,$]=f.useState(null),[O,U]=f.useState(!1),[F,H]=f.useState(""),[G,M]=f.useState(""),[z,W]=f.useState(""),[D,Z]=f.useState(!1),[V,L]=f.useState(!1),[K,te]=f.useState(!1),[Q,Y]=f.useState(""),[J,P]=f.useState(!1),[ee,X]=f.useState(!1),[ae,me]=f.useState(""),[q,he]=f.useState(""),[se,le]=f.useState(null),[ke,oe]=f.useState(!1);f.useEffect(()=>(q_().then(He=>{const wt=He.data.user;c(wt),d(wt.full_name||""),p(wt.email||""),g(wt.phone||"")}).catch(()=>k("We could not load your account. Refresh and try again.")).finally(()=>v(!1)),()=>window.clearTimeout(o.current)),[]),f.useEffect(()=>{let He=!1;return Nd().then(wt=>{He||T(wt||{})}).catch(()=>{He||T({})}),()=>{He=!0}},[]),f.useEffect(()=>{if(!O)return;const He=St=>{St.key==="Escape"&&U(!1)};document.addEventListener("keydown",He);const wt=window.setTimeout(()=>i.current?.focus(),0);return()=>{document.removeEventListener("keydown",He),window.clearTimeout(wt)}},[O]);const Oe=f.useMemo(()=>nu.map(He=>({connector:He,account:He.accounts.map(wt=>A?.[wt]).find(Boolean)})).filter(({account:He})=>He),[A]),Je=async He=>{if(!I){$(He.key);try{await DG(He.key),T(wt=>{const St={...wt};return He.accounts.forEach(Zt=>delete St[Zt]),St}),r(`${He.name} removed.`,"success")}catch(wt){r(wt?.response?.data?.detail?.message||"We could not remove that account. Try again.","error")}finally{$(null)}}},Ie=f.useMemo(()=>l?u!==(l.full_name||"")||h!==(l.email||"")||m!==(l.phone||""):!1,[l,u,h,m]),ue=()=>{l&&(d(l.full_name||""),p(l.email||""),g(l.phone||""),b(!1),k(""))},be=async He=>{He?.preventDefault();const wt=KY(u);if(wt){k(wt);return}j(!0),k("");try{const Zt=(await ch({full_name:u,email:h,phone:m})).data.user;t({...e,...Zt}),c(Jt=>({...Jt,...Zt})),b(!1),S(!0),window.clearTimeout(o.current),o.current=window.setTimeout(()=>S(!1),2400)}catch(St){k(St.response?.data?.detail?.message||"We could not update your account. Try again.")}finally{j(!1)}},Re=async()=>{try{await navigator.clipboard.writeText(`https://greatexperts.ai/${l.username}`),N(!0),window.setTimeout(()=>N(!1),1600)}catch{r("Could not copy the link.","error")}},Ge=async()=>{await n(),a("/login")},it=()=>{H(""),M(""),W(""),Y(""),Z(!1),L(!1),U(!0)},ut=async He=>{if(He.preventDefault(),Y(""),G.length<8){Y("Password must be at least 8 characters");return}if(!/[A-Z]/.test(G)){Y("Password must include an uppercase letter");return}if(!/[a-z]/.test(G)){Y("Password must include a lowercase letter");return}if(!/\d/.test(G)){Y("Password must include a number");return}if(G!==z){Y("Passwords do not match");return}te(!0);try{await Qxe(F,G),U(!1),r("Password changed successfully","success")}catch(wt){const St=wt.response?.data?.detail?.message||"Failed to change password";Y(St)}finally{te(!1)}},$t=!!se?.earnings?.blocked_reason;$t||se?.live_subscribers>0;const tt=async({immediate:He=!1}={})=>{X(!0),me("");try{const wt=await Fke({immediate:He});he(wt.data?.completes_at||""),oe(!0)}catch(wt){me(wt.response?.data?.detail?.message||"We could not delete your account. Try again.")}finally{X(!1)}};return y?s.jsx(il,{text:"Loading accountâ¦"}):s.jsxs("div",{className:"pb-8",children:[s.jsxs("header",{className:"ge-surface mb-6 flex flex-wrap items-center gap-x-5 gap-y-3 px-5 py-3 sm:px-7",children:[s.jsxs("h1",{className:"min-w-0 font-heading text-[28px] font-normal leading-[1.1] tracking-[-0.018em] text-ink",children:["My ",s.jsx("em",{className:"italic text-indigo",children:"account"})]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2 sm:gap-2.5",children:[s.jsxs("span",{"aria-hidden":!E,className:`mr-1 hidden items-center gap-1.5 text-[12.5px] font-semibold text-sage transition-opacity duration-200 sm:inline-flex ${E?"opacity-100":"opacity-0"}`,children:[s.jsx(ft,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Changes saved"]}),s.jsx("button",{type:"button",onClick:ue,disabled:!Ie,className:"ge-surface-btn h-10 px-4 text-[13px] disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-rule disabled:hover:bg-transparent disabled:hover:text-ink-soft",children:"Discard"}),s.jsx("button",{type:"button",onClick:be,disabled:!Ie||w,className:"inline-flex h-10 items-center whitespace-nowrap rounded-pill border-none bg-indigo px-6 text-[13px] font-semibold text-cream shadow-[inset_0_1px_0_rgba(255,255,255,0.42),0_16px_32px_-18px_rgba(61,61,245,0.85)] transition-colors duration-200 ease-standard hover:bg-indigo-deep disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-indigo",children:w?"Savingâ¦":"Save changes"})]})]}),s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsx(_a,{message:_}),s.jsxs("section",{"aria-labelledby":"personal-details-title",className:Av,children:[s.jsxs("div",{className:LS,children:[s.jsxs("span",{className:"inline-flex items-center gap-2.5",children:[s.jsx(Ci,{className:"h-[18px] w-[18px] text-indigo","aria-hidden":"true"}),s.jsx("h2",{id:"personal-details-title",className:Rv,children:"Personal details"})]}),s.jsxs("span",{className:"inline-flex items-center gap-2 text-[10.5px] font-medium uppercase tracking-[0.12em] text-ink-muted",children:[s.jsx(Zi,{className:"h-3.5 w-3.5 text-ink-light","aria-hidden":"true"}),"Private, never shown on your public profile"]})]}),s.jsxs("form",{onSubmit:be,className:"grid grid-cols-1 gap-x-5 gap-y-4 px-5 py-4 sm:grid-cols-2 sm:px-6",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"account-full-name",className:"mb-1.5 block text-[12.5px] font-medium text-ink-mid",children:"Full name"}),s.jsx("input",{id:"account-full-name",type:"text",autoComplete:"name",value:u,onChange:He=>d(He.target.value),className:Bp})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"mb-1.5 flex items-baseline justify-between gap-3",children:[s.jsx("label",{htmlFor:"account-phone",className:"text-[12.5px] font-medium text-ink-mid",children:"Phone"}),s.jsx("span",{className:"text-[11.5px] text-ink-muted",children:"Optional"})]}),s.jsx("input",{id:"account-phone",type:"tel",autoComplete:"tel",placeholder:"+48 600 000 000",value:m,onChange:He=>g(He.target.value),className:Bp})]}),s.jsxs("div",{className:"sm:col-span-2",children:[s.jsx("label",{htmlFor:"account-email",className:"mb-1.5 block text-[12.5px] font-medium text-ink-mid",children:"Email"}),x?s.jsx("input",{id:"account-email",type:"email",autoComplete:"email",value:h,onChange:He=>p(He.target.value),className:Bp}):s.jsxs("div",{className:"flex h-11 items-center gap-2.5 rounded-md border border-rule bg-ink/[0.03] pl-4 pr-1.5",children:[s.jsx("span",{id:"account-email",className:"min-w-0 flex-1 truncate text-sm text-ink-mid",children:h}),s.jsx("button",{type:"button",onClick:()=>b(!0),className:"inline-flex h-8 flex-none items-center whitespace-nowrap rounded-pill border border-rule bg-paper px-3 text-xs font-semibold text-indigo transition-colors duration-fast ease-standard hover:border-indigo/35 hover:bg-indigo/5 focus-visible:outline-none focus-visible:shadow-focus",children:"Change email"})]}),s.jsxs("p",{className:"mt-1.5 text-xs leading-relaxed text-ink-muted",children:["Used for sign-in and important account updates. Member since ",Cx(l?.created_at),"."]})]}),s.jsx("button",{type:"submit",className:"hidden","aria-hidden":"true",tabIndex:-1})]})]}),l?.username&&s.jsxs("section",{"aria-labelledby":"public-link-title",className:Av,children:[s.jsx("div",{className:LS,children:s.jsxs("span",{className:"inline-flex items-center gap-2.5",children:[s.jsx(ju,{className:"h-[18px] w-[18px] text-indigo","aria-hidden":"true"}),s.jsx("h2",{id:"public-link-title",className:Rv,children:"Your public profile link"})]})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-3 px-5 py-4 sm:px-6",children:[s.jsxs("span",{className:"break-all text-[15.5px] font-medium text-ink",children:["greatexperts.ai/",s.jsx("span",{className:"text-indigo",children:l.username})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:Re,className:Iv,children:[C?s.jsx(ft,{className:"h-[15p
522x] w-[15px]","aria-hidden":"true"}):s.jsx(ju,{className:"h-[15px] w-[15px]","aria-hidden":"true"}),C?"Copied":"Copy"]}),s.jsxs("a",{href:`/${l.username}`,target:"_blank",rel:"noopener noreferrer",className:Iv,children:[s.jsx(lwe,{className:"h-[15px] w-[15px]","aria-hidden":"true"}),"View profile"]}),s.jsx(mae,{className:Iv,onChanged:He=>c(wt=>({...wt,username:He}))})]})]})]}),Oe.length>0&&s.jsxs("section",{"aria-labelledby":"connected-accounts-title",className:Av,children:[s.jsx("div",{className:LS,children:s.jsxs("span",{className:"inline-flex items-center gap-2.5",children:[s.jsx($a,{className:"h-[18px] w-[18px] text-indigo","aria-hidden":"true"}),s.jsx("h2",{id:"connected-accounts-title",className:Rv,children:"Connected accounts"})]})}),s.jsx("ul",{className:"divide-y divide-[#E8E6DC]",children:Oe.map(({connector:He,account:wt})=>s.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-3 px-5 py-4 sm:px-6",children:[s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-3",children:[s.jsx(He.Icon,{size:26}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate text-[15px] font-medium text-ink",children:wt.name||wt.handle||He.name}),s.jsxs("span",{className:"block text-[13px] text-ink-muted",children:[He.name,wt.verified?" · Verified":""]})]})]}),s.jsxs("div",{className:"flex max-w-full items-start gap-2",children:[s.jsx(Est,{platform:He.key,disabled:I===He.key}),s.jsxs("button",{type:"button",onClick:()=>Je(He),disabled:I===He.key,className:Iv,children:[s.jsx(Qs,{className:"h-[15px] w-[15px]","aria-hidden":"true"}),I===He.key?"Removingâ¦":"Remove"]})]})]},He.key))}),s.jsxs("p",{className:"border-t border-[#E8E6DC] px-5 py-3 text-[13px] text-ink-muted sm:px-6",children:["Removing disconnects that account and deletes the stored connection details. See"," ",s.jsx("a",{href:"/data-deletion",target:"_blank",rel:"noopener noreferrer",className:"text-indigo hover:underline",children:"data deletion"})," ","for what we keep and what we never keep."]})]}),s.jsxs("section",{"aria-labelledby":"manage-account-title",className:Av,children:[s.jsxs("div",{className:"ge-card-header flex items-center gap-2.5 px-5 py-2.5 sm:px-6",children:[s.jsx(NY,{className:"h-[18px] w-[18px] text-indigo","aria-hidden":"true"}),s.jsx("h2",{id:"manage-account-title",className:Rv,children:"Manage my account"})]}),s.jsxs(Le,{to:"/myaccount/subscriptions",className:"ge-surface-row flex min-h-12 items-center gap-3.5 px-5 py-3 sm:px-6",children:[s.jsx("span",{className:"min-w-0 flex-1 text-[15px] text-ink",children:"Experts you subscribe to"}),s.jsx(hn,{className:"h-4 w-4 flex-none text-indigo","aria-hidden":"true"})]}),s.jsxs("button",{type:"button",onClick:it,className:"ge-surface-row flex min-h-12 w-full items-center gap-3.5 border-t border-rule/90 px-5 py-3 text-left focus-visible:outline-none focus-visible:shadow-focus sm:px-6",children:[s.jsx("span",{className:"min-w-0 flex-1 text-[15px] text-ink",children:"Change password"}),s.jsx(hn,{className:"h-4 w-4 flex-none text-indigo","aria-hidden":"true"})]}),s.jsxs("button",{type:"button",onClick:()=>{me(""),he(""),le(null),P(!0),Bke().then(He=>le(He.data)).catch(()=>{})},className:"flex min-h-12 w-full items-center gap-3.5 border-t border-rule/90 px-5 py-3 text-left transition-colors duration-fast ease-standard hover:bg-destructive/5 focus-visible:outline-none focus-visible:shadow-focus sm:px-6",children:[s.jsx("span",{className:"min-w-0 flex-1 text-[15px] text-destructive",children:"Delete account"}),s.jsx(hn,{className:"h-4 w-4 flex-none text-destructive","aria-hidden":"true"})]}),s.jsxs("button",{type:"button",onClick:Ge,className:"ge-surface-row flex min-h-12 w-full items-center gap-3.5 border-t border-rule/90 px-5 py-3 text-left focus-visible:outline-none focus-visible:shadow-focus sm:px-6",children:[s.jsx("span",{className:"min-w-0 flex-1 text-[15px] text-ink",children:"Log out"}),s.jsx(hn,{className:"h-4 w-4 flex-none text-indigo","aria-hidden":"true"})]})]})]}),O&&Mn.createPortal(s.jsxs("div",{className:"fixed inset-0 z-50 grid place-items-center p-4",onClick:()=>U(!1),children:[s.jsx("div",{className:"absolute inset-0 bg-ink/50"}),s.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"
522change-password-title",className:"relative max-h-[min(80dvh,40rem)] w-full max-w-md overflow-y-auto rounded-lg border border-rule bg-paper p-6 text-ink shadow-xl sm:p-8",onClick:He=>He.stopPropagation(),children:[s.jsxs("div",{className:"mb-7 flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-md bg-cream-deep",children:s.jsx(Cve,{className:"h-5 w-5 text-ink-mid","aria-hidden":"true"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{id:"change-password-title",className:"font-heading text-2xl font-medium tracking-[-0.018em] text-ink",children:"Change password"}),s.jsx("p",{className:"mt-1 text-xs leading-relaxed text-ink-muted",children:"Choose a new password for this account."})]})]}),s.jsx("button",{type:"button",onClick:()=>U(!1),"aria-label":"Close password dialog",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-pill text-ink-mid transition-[background-color,color,transform] duration-fast ease-standard hover:bg-cream-deep hover:text-ink focus-visible:outline-none focus-visible:shadow-focus active:translate-y-px",children:s.jsx(as,{className:"h-4 w-4","aria-hidden":"true"})})]}),s.jsxs("form",{onSubmit:ut,className:"space-y-5",children:[Q&&s.jsx("div",{className:"rounded-md border border-destructive/30 bg-cream-deep p-3",role:"alert",children:s.jsx("p",{className:"text-sm text-destructive",children:Q})}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"current-password",className:"mb-2 block text-sm font-medium text-ink-soft",children:"Current password"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{ref:i,id:"current-password",type:D?"text":"password",autoComplete:"current-password",value:F,onChange:He=>H(He.target.value),className:`${Bp} pr-12`,placeholder:"Enter current password",required:!0}),s.jsx("button",{type:"button",onClick:()=>Z(!D),"aria-label":D?"Hide current password":"Show current password",className:"absolute right-0 top-0 flex h-11 w-11 items-center justify-center rounded-pill text-ink-muted hover:text-ink focus-visible:outline-none focus-visible:shadow-focus",children:D?s.jsx(vb,{className:"h-4 w-4","aria-hidden":"true"}):s.jsx(Sh,{className:"h-4 w-4","aria-hidden":"true"})})]})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"new-password",className:"mb-2 block text-sm font-medium text-ink-soft",children:"New password"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{id:"new-password",type:V?"text":"password",autoComplete:"new-password",value:G,onChange:He=>M(He.target.value),className:`${Bp} pr-12`,placeholder:"Enter new password",required:!0}),s.jsx("button",{type:"button",onClick:()=>L(!V),"aria-label":V?"Hide new password":"Show new password",className:"absolute right-0 top-0 flex h-11 w-11 items-center justify-center rounded-pill text-ink-muted hover:text-ink focus-visible:outline-none focus-visible:shadow-focus",children:V?s.jsx(vb,{className:"h-4 w-4","aria-hidden":"true"}):s.jsx(Sh,{className:"h-4 w-4","aria-hidden":"true"})})]}),s.jsx("div",{className:"mt-3 space-y-1.5",children:[{text:"At least 8 characters",valid:G.length>=8},{text:"One uppercase letter",valid:/[A-Z]/.test(G)},{text:"One lowercase letter",valid:/[a-z]/.test(G)},{text:"One number",valid:/\d/.test(G)}].map((He,wt)=>s.jsxs("div",{className:`flex items-center gap-2 text-xs ${He.valid?"text-sage":"text-ink-muted"}`,children:[s.jsx("div",{className:`h-1.5 w-1.5 rounded-pill ${He.valid?"bg-sage":"bg-ink-light"}`,"aria-hidden":"true"}),He.text]},wt))})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"confirm-new-password",className:"mb-2 block text-sm font-medium text-ink-soft",children:"Confirm new password"}),s.jsx("input",{id:"confirm-new-password",type:"password",autoComplete:"new-password",value:z,onChange:He=>W(He.target.value),className:Bp,placeholder:"Confirm new password",required:!0})]}),s.jsxs("div",{className:"flex flex-col-reverse gap-3 pt-2 sm:flex-row",children:[s.jsx(yt,{variant:"secondary",className:"h-11 flex-1 justify-center whitespace-nowrap",type:"button",onClick:()=>U(!1),children:"Cancel"}
522),s.jsx("button",{type:"submit",disabled:K||!F||!G||!z||G!==z,className:"inline-flex h-11 flex-1 items-center justify-center whitespace-nowrap rounded-pill border border-indigo bg-indigo px-4 text-sm font-medium text-cream transition-[background-color,border-color,transform] duration-fast ease-standard hover:border-indigo-deep hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus active:translate-y-px disabled:cursor-not-allowed disabled:opacity-55",children:K?"Updatingâ¦":"Update password"})]})]})]})]}),document.body),J&&Mn.createPortal(s.jsxs("div",{className:"fixed inset-0 z-50 grid place-items-center p-4",onClick:()=>!ee&&P(!1),children:[s.jsx("div",{className:"absolute inset-0 bg-ink/50"}),s.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"delete-account-title",className:"relative w-full max-w-md rounded-lg border border-rule bg-paper p-6 text-ink shadow-xl sm:p-8",onClick:He=>He.stopPropagation(),children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-md bg-destructive/10",children:s.jsx(Qs,{className:"h-5 w-5 text-destructive","aria-hidden":"true"})}),s.jsx("h3",{id:"delete-account-title",className:"font-heading text-2xl font-medium tracking-[-0.018em] text-ink",children:"Delete account"})]}),ke?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"mt-5 text-sm leading-relaxed text-ink-mid",children:q?s.jsxs(s.Fragment,{children:["Your account is scheduled for deletion on"," ",s.jsx("strong",{className:"text-ink",children:Cx(q)}),". If you change your mind, just log back in before then to restore it. People subscribed to your experts keep access until their billing period ends. No further charges will be made."]}):s.jsx(s.Fragment,{children:"Your account has been deleted. Nothing is kept and there is no recovery window. People subscribed to your experts keep access until their billing period ends, and no further charges will be made."})}),s.jsx("div",{className:"mt-6 flex",children:s.jsx("button",{type:"button",onClick:async()=>{await n(),a("/")},className:"inline-flex h-11 flex-1 items-center justify-center whitespace-nowrap rounded-pill border border-indigo bg-indigo px-4 text-sm font-medium text-cream transition-colors duration-fast ease-standard hover:border-indigo-deep hover:bg-indigo-deep focus-visible:outline-none focus-visible:shadow-focus",children:"Got it, sign me out"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"mt-5 text-sm leading-relaxed text-ink-mid",children:"This deletes your experts, their knowledge, your conversations and your data. You have 30 days to change your mind: log back in any time before the deletion date to restore your account. After that, everything is permanently removed. Subscriptions stop renewing; anyone subscribed to your experts keeps access until their billing period ends."}),$t&&s.jsx("div",{className:"mt-4 rounded-md border border-destructive/30 bg-cream-deep p-3",children:s.jsx("p",{className:"text-sm leading-relaxed text-ink-soft",children:se.earnings.payout_pending?s.jsx(s.Fragment,{children:"You have a payout request in review. We cannot delete your account until it has been paid. Contact support if you need this sooner."}):s.jsxs(s.Fragment,{children:["You have"," ",s.jsxs("strong",{children:["$",se.earnings.accrued_usd.toFixed(2)]})," ","in unpaid earnings."," ",s.jsx(Le,{to:"/dashboard/creator",className:"text-indigo hover:underline",children:"Request a payout"})," ","first; once it is paid you can delete your account."]})})}),!$t&&se?.earnings?.forfeited_usd>0&&s.jsx("div",{className:"mt-4 rounded-md border border-rule bg-cream-deep p-3",children:s.jsxs("p",{className:"text-sm leading-relaxed text-ink-soft",children:["You have"," ",s.jsxs("strong",{children:["$",se.earnings.forfeited_usd.toFixed(2)]})," ","in earnings, below the"," ",s.jsxs("strong",{children:["$",se.earnings.payout_minimum_usd]})," payout minimum, so it cannot be withdrawn. Deleting your account forfeits it."]})}),se?.live_subscribers>0&&s.jsx("div",{className:"mt-4 rounded-md border border-rule bg-cream-deep p-3",children:s.jsxs("p",{className:"text-sm leading-relaxed text-ink-soft",children:[s.jsxs("strong",{children:[se.live_subscribers," ",se.live_subscribers===1?"person":"people"]})," ",se.live_subscribers===1?"subscribes":"subscribe"," to your experts. Their subscriptions stop renewing, and they keep access until their billing period ends. They are not charged again. Your account is deleted once the last billing period ends, so deleting immediately is not available."]})}),se?.platform_paid_until&&s.jsx("div",{className:"mt-4 rounded-md border border-rule bg-cream-deep p-3",children:s.jsxs("p",{className:"text-sm leading-relaxed text-ink-soft",children:["Your ",s.jsx("strong",{className:"capitalize",children:se.platform_plan})," plan is paid until"," ",s.jsx("strong",{children:Cx(se.platform_paid_until)}),". Deleting your account forfeits the remaining time; it is not refunded. If you only want to stop paying, cancel the plan instead and keep your account free."]})}),ae&&s.jsx("div",{className:"mt-4 rounded-md border border-destructive/30 bg-cream-deep p-3",role:"alert",children:s.jsx("p",{className:"text-sm text-destructive",children:ae})}),s.jsxs("div",{className:"mt-6 flex flex-col-reverse gap-3 sm:flex-row",children:[s.jsx(yt,{variant:"secondary",className:"h-11 flex-1 justify-center whitespace-nowrap",type:"button",disabled:ee,onClick:()=>P(!1),children:"Cancel"}),s.jsx("button",{type:"button",onClick:tt,disabled:ee||$t,className:"inline-flex h-11 flex-1 items-center justify-center whitespace-nowrap rounded-pill border border-destructive bg-destructive px-4 text-sm font-medium text-cream transition-colors duration-fast ease-standard hover:opacity-90 focus-visible:outline-none focus-visible:shadow-focus disabled:cursor-not-allowed disabled:opacity-55",children:ee?"Deletingâ¦":"Delete my account"})]})]})]})]}),document.body)]})}const Bg=[.5,.65,.8,1,1.25];function Tst({handle:e,url:t,zoom:n,onZoom:r,onShare:a,embedded:i=!1}){const[o,l]=f.useState(!1),c=Bg.reduce((d,h,p)=>Math.abs(h-n)<Math.abs(Bg[d]-n)?p:d,0);f.useEffect(()=>{if(!o)return;const d=setTimeout(()=>l(!1),1600);return()=>clearTimeout(d)},[o]);async function u(){try{await navigator.clipboard.writeText(t),l(!0)}catch{}}return s.jsxs("div",{className:"ppb-bar",children:[s.jsxs("span",{className:"ppb-url",children:[s.jsx("i",{className:"dot","aria-hidden":"true"}),s.jsx("span",{className:"u",title:e,children:e}),s.jsx("button",{type:"button",onClick:u,"aria-label":o?"Link copied":"Copy your link",children:o?s.jsx(ft,{className:"ico ico-13","aria-hidden":"true"}):s.jsx(ju,{className:"ico ico-13","aria-hidden":"true"})}),!i&&s.jsx(mae,{iconOnly:!0})]}),s.jsxs("div",{className:"ppb-zoom",children:[s.jsx("button",{type:"button",onClick:()=>r(Bg[c-1]),disabled:c===0,"aria-label":"Zoom out",children:s.jsx(D4,{className:"ico ico-14","aria-hidden":"true"})}),s.jsxs("span",{className:"z","aria-live":"polite",children:[Math.round(n*100),"%"]}),s.jsx("button",{type:"button",onClick:()=>r(Bg[c+1]),disabled:c===Bg.length-1,"aria-label":"Zoom in",children:s.jsx(Es,{className:"ico ico-14","aria-hidden":"true"})})]}),s.jsx("div",{className:"ppb-bar-right",children:!i&&s.jsxs("button",{type:"button",className:"ppb-btn acc",onClick:a,children:[s.jsx(Of,{className:"ico ico-14","aria-hidden":"true"}),"Share"]})})]})}const KU={mobile:{zoom:.8,label:"Mobile page preview",close:"Close mobile preview"},laptop:{zoom:.8,label:"Laptop page preview",close:"Close laptop preview"}};function Ast({isOpen:e,onClose:t,profilePath:n,config:r,profile:a,device:i="mobile"}){const o=KU[i]||KU.mobile,l=f.useRef(null),c=f.useRef(null),u=f.useRef(null),d=f.useRef(t);return f.useEffect(()=>{d.current=t},[t]),f.useEffect(()=>{if(!e)return;u.current=document.activeElement,c.current?.focus();const h=m=>{if(m.key==="Escape"&&d.current(),m.key!=="Tab")return;const g=l.current?.querySelectorAll('button:not([disabled]), iframe, [tabindex]:not
522([tabindex="-1"])');if(!g?.length)return;const x=g[0],b=g[g.length-1];m.shiftKey&&document.activeElement===x?(m.preventDefault(),b.focus()):!m.shiftKey&&document.activeElement===b&&(m.preventDefault(),x.focus())};document.addEventListener("keydown",h);const p=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",h),document.body.style.overflow=p,u.current?.focus?.()}},[e]),e?Mn.createPortal(s.jsx("div",{className:"ppb-phone-preview-backdrop",role:"presentation",onMouseDown:t,children:s.jsxs("div",{ref:l,className:`ppb-phone-preview-dialog${i==="laptop"?" is-laptop":""}`,role:"dialog","aria-modal":"true","aria-label":o.label,onMouseDown:h=>h.stopPropagation(),children:[s.jsx("button",{ref:c,type:"button",className:"ppb-phone-preview-close","aria-label":o.close,onClick:t,children:s.jsx(as,{"aria-hidden":"true"})}),s.jsx("div",{className:"ppb-phone-preview-device",children:s.jsx(Vj,{profilePath:n,config:r,profile:a,device:i==="laptop"?"laptop":"mobile",zoom:o.zoom})})]})}),document.body):null}const XU=300,JU=10,md=12;function Rst({order:e,onAdd:t,variant:n="button"}){const[r,a]=f.useState(!1),i=f.useRef(null),o=f.useRef(null),l=f.useRef(null),c=n==="rail";f.useEffect(()=>{if(!r)return;const d=m=>{!i.current?.contains(m.target)&&!l.current?.contains(m.target)&&a(!1)},h=m=>{if(m.key==="Escape"){a(!1),o.current?.focus();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(m.key)||!l.current?.contains(document.activeElement))return;const g=[...l.current.querySelectorAll('[role="menuitem"]:not(:disabled)')];if(!g.length)return;m.preventDefault();const x=Math.max(0,g.indexOf(document.activeElement)),b=m.key==="Home"?0:m.key==="End"?g.length-1:(x+(m.key==="ArrowDown"?1:-1)+g.length)%g.length;g[b].focus()},p=m=>{m.type==="scroll"&&l.current?.contains(m.target)||a(!1)};return document.addEventListener("mousedown",d),document.addEventListener("keydown",h),window.addEventListener("resize",p),window.addEventListener("scroll",p,!0),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",h),window.removeEventListener("resize",p),window.removeEventListener("scroll",p,!0)}},[r]),f.useLayoutEffect(()=>{if(!r||!c||!o.current||!l.current)return;const d=o.current.getBoundingClientRect(),h=Math.min(l.current.scrollHeight,window.innerHeight*.62),p=d.right+JU+XU<=window.innerWidth-md;let m,g;if(p)m=d.right+JU,g=Math.min(Math.max(md,d.top),window.innerHeight-h-md);else{m=Math.min(Math.max(md,d.left),window.innerWidth-XU-md);const x=d.bottom+8;g=x+h<=window.innerHeight-md?x:Math.max(md,d.top-h-8)}Object.assign(l.current.style,{top:`${Math.round(g)}px`,left:`${Math.round(m)}px`,visibility:"visible"}),document.activeElement===o.current&&l.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus()});const u=r&&s.jsx("div",{ref:l,className:`ppb-pal${c?" is-portal":""}`,style:c?{visibility:"hidden"}:void 0,role:"menu","aria-label":"Sections you can add",children:KVe.map(([d,h])=>s.jsxs("div",{children:[s.jsx("p",{className:"grp",children:h}),Object.entries(pl).filter(([p,m])=>p!=="header"&&m.group===d).map(([p,m])=>{const g=XVe(e,p);return s.jsxs("button",{type:"button",role:"menuitem",className:"ppb-pal-item",disabled:!g,onClick:()=>{a(!1),t(p)},children:[s.jsx("span",{className:"pi",children:s.jsx(m.icon,{className:"ico","aria-hidden":"true"})}),s.jsxs("span",{className:"tx",children:[s.jsx("b",{children:m.name}),s.jsx("span",{children:m.blurb})]}),!g&&s.jsx("span",{className:"added",children:m.repeatable?"Full":"Added"})]},p)})]},d))});return s.jsxs("div",{className:`ppb-add${c?" is-rail":""}`,ref:i,children:[s.jsx("button",{type:"button",ref:o,className:c?"ppb-cat":"ppb-btn acc","aria-expanded":r,"aria-label":c?"Add section":void 0,onClick:()=>a(d=>!d),children:c?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"ppb-cat-ico","aria-hidden":"true",children:s.jsx(Es,{strokeWidth:2})}),s.jsx("span",{className:"ppb-cat-label",children:"Add"})]}):s.jsxs(s.Fragment,{children:[s.jsx(Es,{className:"ico","aria-hidden":"true"}),"Add section"]})}),c&&u?Mn.createPortal(u,document.body):u]})}function Ist({items:e,selected:t,onChange:n,onOrder:r,trailing:a=null}){const[i,o]=f.useState(null),[l,c]=f.useState(null),[u,d]=f.useState("y"),h=f.useRef(null),p=f.useRef(null),m=f.useRef(null),g=zu(),x=e.map(({id:w})=>w),b=l||x;f.useEffect(()=>{const w=h.current,j=new ResizeObserver(()=>{d(getComputedStyle(w).flexDirection==="row"?"x":"y")});return j.observe(w),()=>j.disconnect()},[]);function y(w,j){const E=x.indexOf(w);if(E<0||E===j)return;const S=ZVe(x,E,j);S.some((_,k)=>_!==x[k])&&r(S)}function v(w){const j=m.current;w.type!=="pointercancel"&&j?.some((E,S)=>E!==x[S])&&r(j),m.current=null,c(null),o(null),window.setTimeout(()=>{p.current=null},0)}return s.jsxs(nTe,{as:"nav",ref:h,className:"ppb-catnav","aria-label":"Page sections",axis:u,values:b,layoutScroll:!0,onReorder:w=>
522{m.current=w,c(w)},children:[s.jsx("span",{className:"sr-only",id:"ppb-catnav-help",children:"Drag sections to reorder them. Design is pinned. Use Alt and the up or down arrow keys to move a focused section."}),b.map(w=>{const j=e.find(N=>N.id===w);if(!j)return null;const{label:E,Icon:S,pinned:_}=j,k=t===w,C=_?Dn.button:dTe;return s.jsxs(C,{...!_&&{as:"button",value:w},type:"button",layout:"position",transition:g?{duration:0}:{type:"spring",stiffness:500,damping:38,mass:.7},whileDrag:g?void 0:{scale:1.06},dragMomentum:!1,className:`ppb-cat${_?"":" is-reorderable"}${i===w?" is-dragging":""}`,style:_?void 0:{touchAction:u==="y"?"pan-x":"pan-y"},"aria-current":k?"page":void 0,"aria-pressed":k,"aria-describedby":"ppb-catnav-help","aria-keyshortcuts":_?void 0:"Alt+ArrowUp Alt+ArrowDown",title:_?"Design is pinned":"Drag to reorder",onClick:N=>{if(p.current){N.preventDefault();return}n(w)},onKeyDown:N=>{if(_||!N.altKey||N.key!=="ArrowUp"&&N.key!=="ArrowDown")return;N.preventDefault();const A=x.indexOf(w);y(w,A+(N.key==="ArrowUp"?-1:1))},onDragStart:()=>{p.current=w,m.current=x,o(w)},onDragEnd:v,children:[s.jsxs("span",{className:"ppb-cat-ico","aria-hidden":"true",children:[s.jsx(S,{strokeWidth:k?2:1.75}),!_&&s.jsx(_u,{className:"ppb-cat-drag",strokeWidth:2})]}),s.jsx("span",{className:"ppb-cat-label",children:E})]},w)}),a]})}function Pst(e,t){return gf(t).pinned?"Design":t.split("#")[0]==="contact"?"Contact":gne(e,t)}function Lst(e){return(e?.order||[]).map(t=>({id:t,label:Pst(e,t),Icon:gf(t).icon,pinned:!!gf(t).pinned}))}function Iu(e,t,n){const r=e/255,a=t/255,i=n/255,o=Math.max(r,a,i),l=Math.min(r,a,i),c=(o+l)/2;if(o===l)return[0,0,c];const u=o-l,d=c>.5?u/(2-o-l):u/(o+l);let h;return o===r?h=(a-i)/u+(a<i?6:0):o===a?h=(i-r)/u+2:h=(r-a)/u+4,[h*60,d,c]}function Wi(e,t,n){const r=(1-Math.abs(2*n-1))*t,a=r*(1-Math.abs(e/60%2-1)),i=n-r/2;let o;return e<60?o=[r,a,0]:e<120?o=[a,r,0]:e<180?o=[0,r,a]:e<240?o=[0,a,r]:e<300?o=[a,0,r]:o=[r,0,a],o.map(l=>Math.round((l+i)*255))}const Ra=(e,t,n)=>Math.min(n,Math.max(t,e)),Ia=(e,t,n)=>e.map((r,a)=>Math.round(r+(t[a]-r)*n)),b5=[61,61,245],ml=[20,20,19],Sr=[250,249,245];function Pv([e,t,n]){const r=a=>{const i=a/255;return i<=.04045?i/12.92:((i+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}function Ai(e,t){const n=Math.max(Pv(e),Pv(t)),r=Math.min(Pv(e),Pv(t));return(n+.05)/(r+.05)}function bu(e,t=[255,255,255]){const n=String(e??"").trim(),r=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(n);if(!r)return t.slice();let a=r[1];return a.length===3&&(a=`${a[0]}${a[0]}${a[1]}${a[1]}${a[2]}${a[2]}`),[parseInt(a.slice(0,2),16),parseInt(a.slice(2,4),16),parseInt(a.slice(4,6),16)]}function _f(e){return Ai(e,[255,255,255])>Ai(e,ml)}const pu=(e,t)=>Math.min(...t.map(n=>Ai(e,n)));function Mm(e,t,n=3){if(pu(e,t)>=n)return e;const[r,a,i]=Iu(...e),o=a<.06?a:Ra(a,.28,.86),l=[];for(let c=0;c<=20;c+=1){const u=c*.05,d=Wi(r,o,u);pu(d,t)>=n&&l.push({rgb:d,distance:Math.abs(u-i)})}return l.length?(l.sort((c,u)=>c.distance-u.distance),l[0].rgb):pu(ml,t)>=pu(Sr,t)?ml:Sr}function Ost(e,t=4.5){return e?`#${Mm(bu(e,b5),[Sr,[255,255,255]],t).map(r=>r.toString(16).padStart(2,"0")).join("")}`:""}function Mst(e){return pu(ml,e)>=pu(Sr,e)?ml:Sr}const Zd=e=>Ai(e,Sr)>=Ai(e,ml)?Sr:ml;function fae(e,t=4.6){if(Ai(e,Zd(e))>=t)return e;const[n,r,a]=Iu(...e),i=[];for(let o=0;o<=40;o+=1){const l=o*.025,c=Wi(n,r,l);Ai(c,Zd(c))>=t&&i.push({rgb:c,distance:Math.abs(l-a)})}return i.length?(i.sort((o,l)=>o.distance-l.distance),i[0].rgb):e}function Dst(e,t,n=3,r=4.5){const a=d=>Ai(d,t)>=n&&Ai(d,Zd(d))>=r;if(a(e))return{fill:e,on:Zd(e)};const[i,o,l]=Iu(...e),c=o<.06?o:Ra(o,.28,.86),u=[];for(let d=0;d<=40;d+=1){const h=d*.025,p=Wi(i,c,h);a(p)&&u.push({rgb:p,distance:Math.abs(h-l)})}if(!u.length){const d=_f(t)?Sr:ml;return{fill:d,on:Zd(d)}}return u.sort((d,h)=>d.distance-h.distance),{fill:u[0].rgb,on:Zd(u[0].rgb)}}function hx(e,t,n=4.6){if(pu(e,t)<n)return e;let r=0,a=1;for(let i=0;i<18;i+=1){const o=(r+a)/2,l=Ia(e,t[0],o);pu(l,t)>=n?r=o:a=o}return Ia(e,t[0],r)}function $st(e,t,n=1.32){let r=0,a=1;for(let i=0;i<18;i+=1){const o=(r+a)/2;Ai(Ia(t,e,o),t)>=n?a=o:r=o}return Ia(t,e,a)}function Fst(e,t,n,r=1.13,a=4.6){const i=u=>Ai(u,t)>=r&&Ai(u,n)>=a;if(i(e))return e;const[o,l,c]=Iu(...e);for(let u=1;u<=40;u+=1)for(const d of[-1,1]){const h=c+d*u*.02;if(h<0||h>1)continue;const p=Wi(o,l,h);if(i(p))return p}return e}const Bst=(e,t)=>
522{const n=Math.abs(e-t)%360;return Math.min(n,360-n)};function Ust(e,t,n){const a=Array.from({length:13},()=>({w:0,r:0,g:0,b:0})),i=Math.floor(n*.56);for(let h=i;h<n;h+=1)for(let p=0;p<t;p+=1){const m=(h*t+p)*4;if(e[m+3]<140)continue;const[g,x,b]=Iu(e[m],e[m+1],e[m+2]);if(b<.04||b>.96)continue;const y=x<.12?12:Math.floor(g/30)%12,v=1-Math.abs(2*b-1),w=(.45+x)*(.5+.5*v),j=a[y];j.w+=w,j.r+=e[m]*w,j.g+=e[m+1]*w,j.b+=e[m+2]*w}const o=a.reduce((h,p)=>p.w>h.w?p:h);if(!o.w)return[253,252,248];const l=[o.r/o.w,o.g/o.w,o.b/o.w],[c,u,d]=Iu(...l);return d<.46?Wi(c,u<.1?Ra(u,0,.1):Ra(u*.85,.2,.5),Ra(d,.22,.34)):Wi(c,u<.1?Ra(u,0,.08):Ra(u*.6,.14,.3),Ra(d,.84,.9))}function QU(e,t=24,n=24){const a=Array.from({length:12},()=>({w:0,h:0,s:0,l:0}));let i=0,o=0;for(let b=0;b<e.length;b+=4){if(e[b+3]<140)continue;i+=1;const[y,v,w]=Iu(e[b],e[b+1],e[b+2]);if(v<.16||w<.1||w>.93)continue;const j=v*(1-Math.abs(2*w-1));o+=j;const E=a[Math.floor(y/(360/12))%12];E.w+=j,E.h+=y*j,E.s+=v*j,E.l+=w*j}if(!i)return null;const l=Ust(e,t,n),c=_f(l);if(o/i<.06){const b=c?[255,255,255]:ml;return{accent:Ia(l,b,.42),component:Ia(l,b,.62),soft:Ia(l,[255,255,255],.5),deep:Ia(l,b,.62),base:Ia([245,243,236],l,.1),surface:l,isDarkSurface:c}}const u=a.filter(b=>b.w>0).map(b=>({w:b.w,h:b.h/b.w,s:b.s/b.w,l:b.l/b.w})).sort((b,y)=>
522y.w-b.w),d=u[0],p=u.find(b=>b!==d&&Bst(b.h,d.h)>=90&&b.w>=d.w*.35)||null||d,m=Wi(p.h,Ra(p.s*1.2,.5,.85),c?.6:.4),{h:g,s:x}=d;return{accent:Wi(g,Ra(x,.42,.78),Ra(d.l,.42,.58)),component:m,soft:Wi(g,Ra(x,.3,.55),.8),deep:Wi(g,Ra(x,.4,.7),.32),base:Ia([245,243,236],Wi(g,Ra(x,.25,.5),.72),.12),surface:l,isDarkSurface:c}}function zst(e,t,{exactSurface:n=!1,exactAccent:r=!1}={}){const a=n?e:fae(e),i=_f(a),o=Dst(t,a),l=r?t:o.fill,c=r?Zd(t):o.on,u=o.fill,d=Mst([a]),h=Fst(Ia(a,l,i?.24:.14),a,d),p=Ia(a,l,i?.52:.42),m=[a,h],g=hx(d,m,7),x=hx(d,m,4.6),b=$st(d,a),y=Mm(l,m,4.5),v=Ia(Sr,l,.12),w=Mm(l,[Sr,v],4.5),j=hx(c,[l],4.6),E=i?Sr:[28,25,23],S=i?[28,25,23]:Sr,_=hx(S,[E],4.6);return{surface:a,dark:i,accent:l,onAccent:c,accentText:y,accentStroke:u,accentMuted:j,soft:h,border:p,elevatedSoft:v,elevatedAccentText:w,ink:d,inkMid:g,inkMuted:x,rule:b,floatingSurface:E,floatingOn:S,floatingMuted:_}}const Hst=[241,240,236],qst=[214,211,204],Wst=1.6;function Vst(e){const t=Ai(e.accent,Sr)>=Wst,n=t?e.accent:ml,r=t?e.on:Sr,a=t?Ia(Sr,n,.12):Hst,i=t?Ia(Sr,n,.4):qst,o={"--pf-accent-rgb":n,"--pf-accent-on-rgb":r,"--pf-accent-stroke-rgb":Mm(n,[Sr,a],3),"--pf-accent-deep-rgb":Mm(n,[Sr,a],4.5),"--pf-component-soft-rgb":a,"--pf-component-border-rgb":i,"--pf-elevated-soft-rgb":a,"--pf-elevated-accent-text-rgb":Mm(n,[Sr,a],4.5)};return Object.fromEntries(Object.entries(o).map(([l,c])=>[l,c.join(" ")]))}const Up=24;function gae(e={},t=null,n=null){const r=n?.rgb?String(n.rgb).split(/\s+/).map(Number):bu(e?.heroSurfaceColor,[253,252,248]),a=e?.componentColorMode==="custom"?"custom":"auto";let i;if(a==="custom")i=bu(e?.componentColor,b5);else if(t?.component||t?.accent)i=t.component||t.accent;else{const[d,h,p]=Iu(...r);i=h<.06?b5:Wi(d,Ra(h+.28,.48,.82),p<.5?.7:.38)}const o=zst(r,i,{exactSurface:!0,exactAccent:a==="custom"}),l=String(e?.componentTextColor??""),c=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.test(l)?bu(l):null,u=c||o.onAccent;return{...o,onAccent:u,accentMuted:c?hx(u,[o.accent],4.6):o.accentMuted,deep:o.accentText,on:u,mode:a}}function qk(e={},t=null){const n=e?.heroSurfaceOn===!1?null:e?.heroSurfaceUrl;if(!!n||e?.autoColor===!0){const o=t?.surface||t?.base;if(o){const l=fae(o);return{rgb:l.join(" "),dark:_f(l),mode:n?"image":"match"}}}const a=e?.heroSurfaceColor||"#FDFCF8",i=bu(a,[253,252,248]);return{rgb:i.join(" "),dark:_f(i),mode:"solid"}}const sc=([e,t,n],r)=>r==null?`rgb(${e}, ${t}, ${n})`:`rgba(${e}, ${t}, ${n}, ${r})`;async function ZU(e){const t=new Image;t.crossOrigin="anonymous",t.src=e,await t.decode();const n=document.createElement("canvas");n.width=Up,n.height=Up;const r=n.getContext("2d",{willReadFrequently:!0});return r.drawImage(t,0,0,Up,Up),r.getImageData(0,0,Up,Up).data}async function Gst(e){if(!e||typeof window>"u")return null;try{return QU(await ZU(e))}catch{if(!/^https?:\/\//i.test(e))return null;try{const n=`${Hr.replace(/\/$/,"")}/users/palette-sample?src=${encodeURIComponent(e)}`;return QU(await ZU(n))}catch{return null}}}function Yst(e){return e?`radial-gradient(45% 40% at 8% 5%, ${sc(e.accent,.14)}, transparent 70%), radial-gradient(45% 45% at 95% 20%, ${sc(e.soft,.55)}, transparent 70%), radial-gradient(50% 50% at 50% 100%, ${sc(e.accent,.1)}, transparent 70%), `+sc(e.base):null}function e0(e){const[t,n]=f.useState(null);return f.useEffect(()=>{if(!e)return;let r=!0;return Promise.resolve().then(()=>{r&&n(null)}),Gst(e).then(a=>{r&&n(a)}),()=>{r=!1}},[e]),e?t:null}function Kst({cfg:e,sectionKey:t,onCfg:n}){const r=ai(),a=e.customs[t]||{text:"",links:[]},i=`ppb-custom-text-${t.replace("#","-")}`,{gripProps:o,rowProps:l}=OP((u,d,h)=>n(p=>SGe(p,t,d,h))),c={key:"links",indices:a.links.map((u,d)=>d)};return s.jsxs(s.Fragment,{children:[s.jsx(kn,{id:i,label:"Your words",icon:$4,optional:"optional",layout:"row",children:s.jsx("textarea",{id:i,rows:4,placeholder:"e.g. A few Instagram posts, a press mention, or links you want visitors to have.",value:a.text,maxLength:tI,onChange:u=>n(d=>q0(d,t,{text:u.target.value}))})}),s.jsxs(kn,{label:"Links",icon:$a,optional:`up to ${Lb}`,hint:"A price is optional.",children:[s.jsxs("div",{className:"ppb-rowlist",children:[a.links.length===0&&s.jsx("p",{className:"ppb-empty",children:"No links yet."}),a.links.map((u,d)=>{const h=l(d,c);return f.createElement("div",{...h,className:`ppb-rowcard${h.className}`,key:u.id||d},s.jsxs("div",{className:"hd",children:[s.jsx("span",{...o(d),children:s.jsx(_u,{"aria-hidden":"true"})}),s.jsx("span",{className:"n",children:`Link ${d+1}`}),s.jsx("button",{type:"button",className:"x","aria-label":`Remove ${u.label.trim()||`link ${d+1}`}`,onClick:async()=>{const p=u.label.trim()||`link ${d+1}`;await r({title:`Remove ${p}?`,description:"This link will be removed from your custom section."})&&n(m=>EGe(m,t,d))},children:s.jsx(Qs,{className:"ico ico-14","aria-hidden":"true"})})]}),s.jsx("input",{type:"text","aria-label":`Label of link ${d+1}`,placeholder:"Label",value:u.label,maxLength:60,onChange:p=>n(m=>YE(m,t,d,{label:p.target.value}))}),s.jsx("input",{type:"url","aria-label":`Address of link ${d+1}`,placeholder:"https://â¦",value:u.url,maxLength:2e3,onChange:p=>n(m=>YE(m,t,d,{url:p.target.value}))}),s.jsx(Mk,{value:u.price,currency:e.currency,label:`Link ${d+1}`,onChange:p=>n(m=>YE(m,t,d,{price:p}))}))})]}),s.jsxs("button",{type:"button",className:"ppb-btn sec sm",disabled:a.links.length>=Lb,onClick:()=>n(u=>NGe(u,t)),children:[s.jsx(Es,{className:"ico","aria-hidden":"true"}),"Add a link"]})]})]})}const Wk={text:{name:"Short answer",hint:"One line, like company or job title",icon:CY,example:"e.g. Company name"},textarea:{name:"Paragraph",hint:"A longer written answer",icon:$4,example:"e.g. What would you like help with?"},select:{name:"Dropdown",hint:"Pick one from a compact list",icon:hwe,example:"e.g. Budget"}
522,radio:{name:"Single choice",hint:"Pick one, every option visible",icon:hye,example:"e.g. Team size"},multi:{name:"Multiple choice",hint:"Tick any that apply",icon:If,example:"e.g. Which services interest you?"},checkbox:{name:"Checkbox",hint:"A single yes or no tick",icon:uwe,example:"e.g. Send me the monthly newsletter"}},Xst=qR.map(e=>{const{name:t,icon:n}=Wk[e];return{value:e,label:s.jsxs("span",{className:"ppb-cf-opt",children:[s.jsx(n,{"aria-hidden":"true"}),t]})}}),Jst=[{value:"any",label:"Anything"},{value:"text",label:"Text"},{value:"number",label:"Numbers"},{value:"phone",label:"Phone"}],Qst={any:"Letters, numbers and symbols.",text:"Letters and punctuation, no numbers.",number:"Digits only, like a team size or an order number.",phone:"Digits and spaces, with an optional + and country code first, like +44 7700 900123."},Zst={phone:{name:"Phone",icon:Ts,key:"phone"},message:{name:"Message",icon:ea,key:"message"}};function ent({cfg:e,onCfg:t}){const n=ai(),r=e.contactFields,[a,i]=f.useState(null),[o,l]=f.useState(!1),c=g3e(r),u=c>=v1,d=a==="pick"?null:r.find(w=>w.id===a&&!Cu(w)),h=w=>t(j=>({...j,contactFields:w(j.contactFields)})),p=(w,j)=>h(E=>E.map(S=>S.id===w?{...S,...j}:S)),{gripProps:m,rowProps:g}=OP((w,j,E)=>h(S=>f3e(S,j,E))),x={key:"contact-fields",indices:r.map((w,j)=>j)},b=w=>{i(w),l(!0)},y=w=>{const j=p3e(w);h(E=>[...E,j]),i(j.id)},v=async w=>{const j=w.label.trim();j&&!await n({title:`Remove "${j}"?`,description:"Visitors will stop seeing this field. Requests already received keep their answers."})||(a===w.id&&l(!1),h(E=>E.filter(S=>S.id!==w.id)))};return s.jsxs(s.Fragment,{children:[s.jsx(kn,{label:"Form fields",icon:If,optional:`${c} of ${v1}`,hint:"Drag to set the order visitors see. Email and the consent tick are always included.",trailing:s.jsxs("button",{type:"button",className:"ppb-btn sec sm ppb-cf-add",disabled:u,title:u?`Up to ${v1} fields`:void 0,onClick:()=>b("pick"),children:[s.jsx(Es,{className:"ico","aria-hidden":"true"}),"Add field"]}),children:s.jsxs("div",{className:"ppb-cf-list",children:[s.jsx(ez,{icon:qr,name:"Email",note:"Always asked"}),r.map((w,j)=>{const E=g(j,x);if(Cu(w)){const S=Zst[w.id],_=e.collect[S.key]===!0,k=S.icon;return f.createElement("div",{...E,key:w.id,className:`ppb-cf-row${_?"":" is-off"}${E.className}`},s.jsxs("div",{className:"ppb-cf-hd",children:[s.jsx("span",{...m(j),children:s.jsx(_u,{"aria-hidden":"true"})}),s.jsx("span",{className:"ppb-cf-ico",children:s.jsx(k,{"aria-hidden":"true"})}),s.jsxs("span",{className:"ppb-cf-name",children:[S.name,s.jsx("small",{children:_?"Optional for visitors":"Hidden"})]}),s.jsx("button",{type:"button",role:"switch",className:"ppb-cf-switch","aria-checked":_,"aria-label":`Ask for ${S.name.toLowerCase()}`,onClick:()=>t(C=>({...C,collect:{...C.collect,[S.key]:!_}})),children:s.jsx("span",{className:"ppb-toggle-track","aria-hidden":"true",children:s.jsx("span",{})})})]}))}return s.jsx(rnt,{field:w,drag:E,grip:m(j),onEdit:()=>b(w.id),onRemove:()=>v(w)},w.id)}),s.jsx(ez,{icon:Vh,name:"Consent tick",note:"Always shown"})]})}),s.jsxs(en,{isOpen:o,onClose:()=>l(!1),title:d?"Edit field":"Add a field",maxWidth:"max-w-lg",hideTitle:!0,className:"ppb ppb-product-dialog ppb-cf-dialog",backdropZ:"z-[10012]",contentZ:"z-[10013]",children:[s.jsxs("div",{className:"ppb-product-dialog-header",children:[s.jsxs("div",{children:[s.jsx("h2",{children:d?"Edit field":"Add a field"}),s.jsx("p",{children:d?"Changes save automatically":"Choose what visitors fill in."})]}),s.jsx("button",{type:"button","aria-label":"Close",onClick:()=>l(!1),children:s.jsx(as,{"aria-hidden":"true"})})]}),d?s.jsxs(s.Fragment,{children:[s.jsx(ant,{field:d,onPatch:w=>p(d.id,w)},d.id),s.jsxs("div",{className:"ppb-cf-dialog-foot",children:[s.jsxs("button",{type:"button",className:"ppb-cf-remove",onClick:()=>v(d),children:[s.jsx(Qs,{"aria-hidden":"true"}),"Remove field"]}),s.jsx("button",{type:"button",className:"ppb-btn acc",onClick:()=>l(!1),children:"Done"})]})]}):s.jsx(nnt,{onPick:y})]})]})}const tnt=[{value:"compact",label:"Compact"},{value:"default",label:"Default"},{value:"custom",label:"Custom"}],OS=4;function snt({cfg:e,onCfg:t}){const[n,r]=f.useState(!1),a=e.contactDividers===!0,i=e.contactSpacing||"default",o=Jw(e.contactSpacingPx),l=u=>t(d=>({...d,contactSpacingPx:Jw(u)})),c=[a?"Divider lines":null,i==="custom"?`${o}
522px apart`:i==="compact"?"Compact":null].filter(Boolean).join(" · ")||"Default";return s.jsxs("div",{className:`ppb-cf-more${n?" is-open":""}`,children:[s.jsxs("button",{type:"button",className:"ppb-cf-more-hd","aria-expanded":n,"aria-controls":"ppb-cf-more-body",onClick:()=>r(u=>!u),children:[s.jsx("span",{children:"Additional settings"}),s.jsx("small",{children:c}),s.jsx(Is,{className:"ppb-cf-more-caret","aria-hidden":"true"})]}),n&&s.jsxs("div",{className:"ppb-cf-more-body",id:"ppb-cf-more-body",children:[s.jsxs("button",{type:"button",role:"switch",className:"ppb-cf-switchrow","aria-checked":a,onClick:()=>t(u=>({...u,contactDividers:u.contactDividers!==!0})),children:[s.jsxs("span",{children:["Divider lines",s.jsx("small",{children:"A thin line between each field."})]}),s.jsx("span",{className:"ppb-toggle-track","aria-hidden":"true",children:s.jsx("span",{})})]}),s.jsxs("div",{className:"ppb-cf-more-row",children:[s.jsxs("span",{children:["Spacing",s.jsx("small",{children:"Room between the fields."})]}),s.jsx(Lj,{label:"Spacing between fields",value:i,onChange:u=>t(d=>({...d,contactSpacing:u})),options:tnt}),i==="custom"&&s.jsxs("div",{className:"ppb-cf-stepper",role:"group","aria-label":"Custom spacing in pixels",children:[s.jsx("button",{type:"button","aria-label":"Less space",disabled:o<=w1,onClick:()=>l(o-OS),children:s.jsx(D4,{"aria-hidden":"true"})}),s.jsx("input",{type:"number",inputMode:"numeric","aria-label":"Spacing in pixels",min:w1,max:zA,step:OS,value:o,onChange:u=>l(u.target.value===""?w1:u.target.value)}),s.jsx("span",{className:"ppb-cf-stepper-unit","aria-hidden":"true",children:"px"}),s.jsx("button",{type:"button","aria-label":"More space",disabled:o>=zA,onClick:()=>l(o+OS),children:s.jsx(Es,{"aria-hidden":"true"})})]})]})]})]})}function ez({icon:e,name:t,note:n}){return s.jsx("div",{className:"ppb-cf-row is-locked",children:s.jsxs("div",{className:"ppb-cf-hd",children:[s.jsx("span",{className:"ppb-cf-lock",title:"Always included",children:s.jsx(Zi,{"aria-hidden":"true"})}),s.jsx("span",{className:"ppb-cf-ico",children:s.jsx(e,{"aria-hidden":"true"})}),s.jsxs("span",{className:"ppb-cf-name",children:[t,s.jsx("small",{children:n})]})]})})}function nnt({onPick:e}){return s.jsx("div",{className:"ppb-cf-types",role:"group","aria-label":"Field type",children:qR.map((t,n)=>{const{name:r,hint:a,icon:i}=Wk[t];return s.jsxs("button",{type:"button",className:"ppb-cf-type",autoFocus:n===0,onClick:()=>e(t),children:[s.jsx("span",{className:"ppb-cf-ico",children:s.jsx(i,{"aria-hidden":"true"})}),s.jsxs("span",{className:"ppb-cf-type-text",children:[s.jsx("b",{children:r}),s.jsx("small",{children:a})]})]},t)})})}function rnt({field:e,drag:t,grip:n,onEdit:r,onRemove:a}){const i=Wk[e.type],o=i.icon,l=e.label.trim(),c=WR(e)&&!e.options.some(u=>u.trim());return s.jsx("div",{...t,className:`ppb-cf-row is-question${t.className}`,children:s.jsxs("div",{className:"ppb-cf-hd",children:[s.jsx("span",{...n,children:s.jsx(_u,{"aria-hidden":"true"})}),s.jsxs("button",{type:"button",className:"ppb-cf-summary","aria-haspopup":"dialog",onClick:r,children:[s.jsx("span",{className:"ppb-cf-ico",children:s.jsx(o,{"aria-hidden":"true"})}),s.jsxs("span",{className:"ppb-cf-name",children:[s.jsx("span",{className:l?"":"is-blank",children:l||"Untitled field"}),s.jsxs("small",{children:[i.name,e.required?" · Required":"",!l||c?" · Not on the form yet":""]})]}),s.jsx(hn,{className:"ppb-cf-caret","aria-hidden":"true"})]}),s.jsx("button",{type:"button",className:"ppb-cf-iconbtn is-danger","aria-label":`Remove ${l||"untitled field"}`,onClick:a,children:s.jsx(Qs,{"aria-hidden":"true"})})]})})}function ant({field:e,onPatch:t}){const n=Wk[e.type],r=e.label.trim(),a=WR(e),i=a&&!e.options.some(p=>p.trim()),o=`ppb-cf-label-${e.id}`,[l,c]=f.useState(null),u=(p,m)=>t({options:e.options.map((g,x)=>x===p?m:g)}),d=()=>{e.options.length>=UA||(c(e.options.length),t({options:[...e.options,""]}))},h=p=>t({options:e.options.filter((m,g)=>g!==p)});return s.jsxs("div",{className:"ppb-f ppb-cf-editor",children:[s.jsx("label",{className:"ppb-cf-lab",htmlFor:o,children:"Label"}),s.jsx("input",{id:o,type:"text",autoFocus:!r,value:e.label,maxLength:WJ,placeholder:n.example,onChange:p=>t({label:p.target.value})}),s.jsxs("div",{className:"ppb-cf-two",children:[s.jsxs("div",{children:[s.jsx("span",{className:"ppb-cf-lab",children:"Type"}),s.jsx(xu,{className:"ppb-cf-select",label:"Type",value:e.type,options:Xst,onChange:p=>t(m3e(e,p))})]}),(e.type==="text"||e.type==="textarea"||e.type==="select")&&s.jsxs("div",{children:[s.jsx("label",{className:"ppb-cf-lab",htmlFor:`ppb-cf-ph-${e.id}`,children:e.type==="select"?"Prompt":"Placeholder"}),s.jsx("input",{id:`ppb-cf-ph-${e.id}`,type:"text",value:e.placeholder,maxLength:VJ,placeholder:e.type==="select"?"Choose one":"Optional hint text",onCh
522ange:p=>t({placeholder:p.target.value})})]})]}),a&&s.jsxs("div",{className:"ppb-cf-options",children:[s.jsx("span",{className:"ppb-cf-lab",id:`ppb-cf-opts-${e.id}`,children:"Options"}),s.jsx("ul",{"aria-labelledby":`ppb-cf-opts-${e.id}`,children:e.options.map((p,m)=>s.jsxs("li",{children:[s.jsx("span",{className:`ppb-cf-bullet is-${e.type}`,"aria-hidden":"true"}),s.jsx("input",{type:"text","aria-label":`Option ${m+1}`,value:p,maxLength:GJ,placeholder:`Option ${m+1}`,autoFocus:l===m,onChange:g=>u(m,g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),d()),g.key==="Backspace"&&!p&&e.options.length>1&&(g.preventDefault(),c(Math.max(0,m-1)),h(m))}}),s.jsx("button",{type:"button",className:"ppb-cf-iconbtn",tabIndex:-1,"aria-label":`Remove option ${m+1}`,onClick:()=>h(m),children:s.jsx(as,{"aria-hidden":"true"})})]},m))}),e.options.length<UA&&s.jsxs("button",{type:"button",className:"ppb-cf-addopt",onClick:d,children:[s.jsx(Es,{"aria-hidden":"true"}),"Add option"]}),i&&s.jsx("p",{className:"ppb-cf-warn",children:"Add at least one option, or this field stays off the form."})]}),e.type==="text"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"ppb-cf-lab",children:"Accepts"}),s.jsx(Lj,{label:"Accepts",value:e.accept,onChange:p=>t({accept:p}),options:Jst}),s.jsx("p",{className:"ppb-cf-note",children:Qst[e.accept]})]}),VR(e.type)&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"ppb-cf-lab",children:"Show options"}),s.jsx(Lj,{label:"Show options",value:e.layout,onChange:p=>t({layout:p}),options:[{value:"list",label:"One per line"},{value:"chips",label:"Side by side"}]})]}),s.jsxs("button",{type:"button",role:"switch",className:"ppb-cf-switchrow","aria-checked":e.required,onClick:()=>t({required:!e.required}),children:[s.jsxs("span",{children:["Required",s.jsx("small",{children:e.type==="checkbox"?"Visitors must tick it to send.":"Visitors must answer before they can send."})]}),s.jsx("span",{className:"ppb-toggle-track","aria-hidden":"true",children:s.jsx("span",{})})]})]})}const tz={expert:{name:"Chat",rows:[["chatNow",'"Chat now" button'],["chatMini",'Small "Chat" link'],["expertProfile","Expert popup title"],["openChat",'"Open chat" button'],["floatingAskText","Ask box text (floating bar and chat)"]]},call:{name:"Call button",rows:[["callSubline","Line under the call button","Voice · free to start"],["callPill",'"Call" pill']]},lists:{name:"Tabs and lists",rows:[["tabAll",'First tab ("All")'],["categoryOther",'"Other" category'],["seeAll",'"See all"'],["showLess",'"Show less"']]},contact:{name:"Contact form",rows:[["contactTitle","Popup title"],["contactEmail","Email box"],["contactPhone","Phone box"],["contactMessage","Message box"],["contactChooseOne","Dropdown prompt"],["contactPickAny",'"pick any" hint'],["contactSentTitle","After sending: title"],["contactReplyTo",'After sending: "The reply will go to"'],["contactDone",'"Done" button'],["contactError","Error message"]]}};function MS({cfg:e,onCfg:t,groups:n,label:r="Wording",showKey:a=()=>!0}){const[i,o]=f.useState(!1),l=e.pageText||{},c=n.map(g=>({...tz[g],rows:tz[g].rows.filter(([x])=>a(x))})).filter(g=>g.rows.length),u=c.flatMap(g=>g.rows.map(([x])=>x)),d=g=>g==="floatingAskText"?e.floatingAskText===Pb?"":e.floatingAskText||"":l[g]||"",h=u.filter(g=>d(g).trim()).length,p=(g,x)=>t(b=>g==="floatingAskText"?xne(b,x):{...b,pageText:{...b.pageText,[g]:x.slice(0,qA)}}),m=`ppb-wording-${n.join("-")}`;return s.jsxs("div",{className:`ppb-f ppb-wording-card${i?" is-open":""}`,children:[s.jsxs("button",{type:"button",className:"ppb-wording-head","aria-expanded":i,"aria-controls":m,onClick:()=>o(g=>!g),children:[s.jsx(P4,{className:"ppb-f-ico",strokeWidth:2.1,"aria-hidden":"true"}),s.jsxs("span",{className:"ppb-wording-title",children:[r,s.jsx("small",{children:"Use your own words or language for our buttons and labels."})]}),s.jsx("span",{className:"ppb-wording-count",children:h?`${h} changed`:"Our wording"}),s.jsx(Is,{className:"ppb-cf-more-caret","aria-hidden":"true"})]}),i&&s.jsxs("div",{className:"ppb-wording",id:m,children:[c.map(g=>s.jsxs("fieldset",{className:"ppb-wording-group",children:[c.length>1&&s.jsx("legend",{children:g.name}),g.rows.map(([x,b,y])=>s.jsxs("label",{className:"ppb-wording-row",children:[s.jsx("span",{children:b}),s.jsx("input",{type:"text",value:d(x),maxLength:x==="floatingAskText"?sk:qA,placeholder:x==="floatingAskText"?Pb:GR[x]||y,onChange:v=>p(x,v.target.value)})]},x))]},g.name)),s.jsx("p",{className:"hint",children:"Leave a box empty to keep ours."})]})]})}function int({cfg:e,experts:t,isLoading:n,loadFailed:r,onToggle:a,onFeature:i,onReorder:o}){const l=ai(),u=Ih(e,"expert")===0,d=ont(t,e),h=d.map(C=>String(C.id)),p=new Set(Xh(t,e).map(C=>String(C.id))),m=new Map(d.map(C=>
522[String(C.id),C])),g=u?String(XR(d,e.featuredExpertId||h[0]||"")?.id??""):"",[x,b]=f.useState(null),[y,v]=f.useState(null),w=f.useRef(null),j=f.useRef(new Map),E=f.useRef(!1),S=y||h;if(f.useLayoutEffect(()=>{const C=w.current;if(!C)return;const N=C.querySelectorAll("[data-xp-id]"),A=new Map;N.forEach(I=>{const $=I.getAttribute("data-xp-id");A.set($,I.getBoundingClientRect().top)});const T=j.current;T.size&&x&&N.forEach(I=>{const $=I.getAttribute("data-xp-id"),O=T.get($),U=A.get($);if(O==null||U==null)return;const F=O-U;if(Math.abs(F)<1)return;I.style.transition="none",I.style.transform=`translateY(${F}px)`,I.offsetHeight,I.style.transition="transform 0.2s ease",I.style.transform="";const H=()=>{I.style.transition="",I.removeEventListener("transitionend",H)};I.addEventListener("transitionend",H)}),j.current=A},[S,x]),n)return s.jsx("p",{className:"ppb-empty",children:"Loading your experts."});if(r)return s.jsx("p",{className:"ppb-empty",role:"status",children:"We could not load your experts. Reload the page to try again."});if(!t.length)return s.jsxs("div",{className:"ppb-empty",children:[s.jsx("b",{children:"You have no AI expert yet"}),"Your page is waiting for the thing visitors came for."," ",s.jsx(Le,{to:tl,children:"Create my expert"})]});const _=()=>{x&&y&&y.join()!==h.join()&&o(y.filter(C=>p.has(C))),b(null),v(null)},k=(C,N,A)=>{if(!x||x===C)return;const I=(w.current?.getBoundingClientRect().top??0)+A.offsetTop,$=N>I+A.offsetHeight/2;v(O=>{const U=O||h,F=U.indexOf(x),H=U.indexOf(C);if(F<0||H<0)return U;let G=$?H+1:H;if(F<G&&(G-=1),F===G)return U;const M=U.slice();return M.splice(F,1),M.splice(G,0,x),M})};return s.jsx(kn,{label:"Your experts",icon:qh,children:s.jsx("ul",{ref:w,className:`ppb-xp${x?" is-dragging":""}`,onDragOver:C=>{if(!x||C.target!==C.currentTarget)return;C.preventDefault();const N=C.currentTarget.querySelectorAll("[data-xp-id]");if(!N.length)return;const A=N[0],T=N[N.length-1],I=C.currentTarget.getBoundingClientRect().top;C.clientY<I+A.offsetTop?k(A.dataset.xpId,-1/0,A):C.clientY>I+T.offsetTop+T.offsetHeight&&k(T.dataset.xpId,1/0,T)},children:S.map(C=>{const N=m.get(C);if(!N)return null;const A=p.has(C),T=u&&C===g,I=x===C;return s.jsxs("li",{"data-xp-id":C,className:`ppb-xli${I?" is-dragging":""}`,draggable:A,onDragStart:$=>{E.current=!1,b(C),v(h),$.dataTransfer.effectAllowed="move",$.dataTransfer.setData("text/plain",C);const O=document.createElement("div");O.style.cssText="position:fixed;top:-9999px;width:1px;height:1px;opacity:0",document.body.appendChild(O),$.dataTransfer.setDragImage(O,0,0),requestAnimationFrame(()=>{E.current=!0,O.remove()})},onDragEnd:()=>{_(),window.setTimeout(()=>{E.current=!1},0)},onDragOver:$=>{x&&($.preventDefault(),$.dataTransfer.dropEffect="move",k(C,$.clientY,$.currentTarget))},onDrop:$=>{$.preventDefault(),_()},children:[s.jsx("span",{className:"ppb-xdrag","aria-hidden":"true",children:A&&s.jsx(_u,{className:"ico"})}),s.jsxs("div",{role:u?"button":void 0,tabIndex:u?0:void 0,className:`ppb-xrow${T?" is-selected":""}${u?" is-pickable":""}`,onClick:()=>{E.current||!u||i(C)},onKeyDown:u?$=>{E.current||$.key!=="Enter"&&$.key!==" "||($.preventDefault(),i(C))}:void 0,"aria-pressed":u?T:void 0,"aria-label":u?T?`${N.name} opens the chat`:`Open chat with ${N.name}`:N.name,children:[s.jsx("span",{className:"xav","aria-hidden":"true",children:N.avatar_url?s.jsx("img",{src:N.avatar_url,alt:"",onError:$=>{$.currentTarget.style.display="none"}}):lnt(N.name)}),s.jsx("span",{className:"tx",children:s.jsx("b",{children:N.name})})]}),s.jsx("button",{type:"button",className:`ppb-xinclude${A?" is-included":""}`,onClick:async()=>{(!A||await l({title:`Remove ${N.name}?`,description:"This AI expert will be removed from your public page, but the expert itself will not be deleted."}))&&a(C)},"aria-pressed":A,"aria-label":A?`Remove ${N.name} from this page`:`Add ${N.name} to this page`,title:A?"Remove from page":"Add to page",children:A?s.jsx(ft,{className:"ico ico-14",strokeWidth:2.5,"aria-hidden":"true"}):s.jsx(Es,{className:"ico ico-15",strokeWidth:2.25,"aria-hidden":"true"})})]},C)})})})}function ont(e,t){const n=Xh(e,t),r=new Set(n.map(i=>String(i.id))),a=e.filter(i=>!r.has(String(i.id)));return[...n,...a]}const lnt=e=>String(e||"?").trim().split(/\s+/).slice(0,2).map(t=>t[0]).join("").toUpperCase(),DS=[{value:0,label:"Green pill"},{value:3,label:"Ink pill"},{value:6,label:"Green bar"},{value:5,label:"Warm bar"},{value:4,label:"Split row"},{value:1,label:"Compact"},{value:2,label:"Icon only"}],sz="Voice · 24/7";function fd(e,t,n="64, 127, 87"){const[r,a,i]=bu(e,n.split(",").map(o=>Number(o.trim())));return`rgba(${r}, ${a}, ${i}, ${t})`}function nz({style:e,name:t,color:n,label:r}){const a=r||cI(t),i=String(t||"").trim()||"this creator",o=n&&/^#[0-9a-fA-F]{6}$/i.test(n);switch(e){case 3:return s.jsxs("span",{className:"ppb-call-pill is-ink",
522style:o?{borderColor:fd(n,.45),boxShadow:"0 2px 6px rgba(0, 0, 0, 0.18)"}:void 0,children:[s.jsx(Ts,{size:9,color:o?n:"#8FCCA6","aria-hidden":"true"}),s.jsx("span",{className:"ppb-call-pill-label",children:a})]});case 6:case 5:return s.jsxs("span",{className:`ppb-call-bar${e===5?" is-warm":""}`,style:o&&e===6?{background:fd(n,.88),borderColor:fd(n,.5),boxShadow:"0 2px 8px rgba(0, 0, 0, 0.16)"}:void 0,children:[s.jsx("span",{className:"ppb-call-bar-disc",style:o&&e===5?{background:fd(n,.12),borderColor:fd(n,.25),color:n}:void 0,children:s.jsx(Ts,{size:10,"aria-hidden":"true"})}),s.jsxs("span",{className:"ppb-call-bar-copy",children:[s.jsx("span",{className:"ppb-call-bar-label",children:a}),s.jsx("span",{className:"ppb-call-bar-sub",children:sz})]})]});case 4:return s.jsxs("span",{className:"ppb-call-row",children:[s.jsxs("span",{className:"ppb-call-row-copy",children:[s.jsx("span",{className:"ppb-call-row-label",children:`${i} AI`}),s.jsx("span",{className:"ppb-call-row-sub",children:sz})]}),s.jsxs("span",{className:"ppb-call-row-pill",style:o?{background:n}:void 0,children:[s.jsx(Ts,{size:8,"aria-hidden":"true"}),"Call"]})]});case 1:return s.jsxs("span",{className:"ppb-call-compact",style:o?{borderColor:n,color:n}:void 0,children:[s.jsx(Ts,{size:8,"aria-hidden":"true"}),s.jsx("span",{className:"ppb-call-compact-label",children:a})]});case 2:return s.jsxs("span",{className:"ppb-call-social",children:[s.jsx("span",{className:"ppb-call-social-ghost"}),s.jsx("span",{className:"ppb-call-social-ghost"}),s.jsx("span",{className:"ppb-call-icon",children:s.jsx(Ts,{size:11,"aria-hidden":"true"})})]});default:return s.jsxs("span",{className:"ppb-call-pill",style:o?{background:fd(n,.88),borderColor:fd(n,.55),boxShadow:"0 2px 6px rgba(0, 0, 0, 0.16)"}:void 0,children:[s.jsx(Ts,{size:9,"aria-hidden":"true"}),s.jsx("span",{className:"ppb-call-pill-label",children:a})]})}}function cnt({value:e,onChange:t,color:n,name:r,label:a}){const{user:i}=Ut(),o=(r||i?.full_name||"").trim()||"this creator",l=DS.find(p=>p.value===e)||DS[0],[c,u]=f.useState(!1),d=f.useRef(null),h=f.useRef(null);return f.useEffect(()=>{if(!c)return;const p=g=>{d.current?.contains(g.target)||u(!1)},m=g=>{g.key==="Escape"&&u(!1)};return document.addEventListener("mousedown",p),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m)}},[c]),f.useEffect(()=>{if(!c)return;const p=requestAnimationFrame(()=>{h.current?.scrollIntoView({block:"nearest",inline:"nearest",behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})});return()=>cancelAnimationFrame(p)},[c]),s.jsxs("div",{className:`ppb-call-select${c?" is-open":""}`,ref:d,children:[s.jsxs("button",{type:"button",className:"ppb-call-trigger","aria-haspopup":"listbox","aria-expanded":c,"aria-label":`Call button style: ${l.label}`,onClick:()=>u(p=>!p),children:[s.jsx("span",{className:"ppb-call-trigger-stage","aria-hidden":"true",children:s.jsx(nz,{style:l.value,name:o,color:n,label:a})}),s.jsx("span",{className:"ppb-call-trigger-label",children:l.label}),s.jsx(Is,{className:"ico ico-14 ppb-call-caret","aria-hidden":"true"})]}),c&&s.jsx("div",{ref:h,className:"ppb-call-menu",role:"listbox","aria-label":"How the call button looks",tabIndex:-1,children:DS.map(({value:p,label:m})=>{const g=e===p;return s.jsxs("button",{type:"button",role:"option","aria-selected":g,className:`ppb-call-option${g?" on":""}`,onClick:()=>{t(p),u(!1)},children:[s.jsx("span",{className:"ppb-call-option-stage","aria-hidden":"true",children:s.jsx(nz,{style:p,name:o,color:n,label:m})}),s.jsx("span",{className:"ppb-call-option-label",children:m}),g&&s.jsx(ft,{className:"ico ico-13 ppb-call-option-check","aria-hidden":"true"})]},p)})})]})}function unt({cfg:e,onCfg:t,compact:n=!1,fallbackPhoto:r=""}){const a=ai(),{user:i}=Ut(),o=f.useRef(null),{cropSrc:l,beginCrop:c,endCrop:u}=W0(),[d,h]=f.useState(!1),[p,m]=f.useState(""),g=e.headerStyle?.photoUrl||null,x=i?.avatar_url||null,b=g||r||x,y=!g&&!!b,v=C=>{const N=C.target.files?.[0];if(C.target.value="",!N)return;if(!["image/png","image/jpeg","image/webp","image/gif"].includes(N.type)){m("Choose a PNG, JPEG, WebP, or GIF image.");return}const A=N.type==="image/gif"?Z5e:Ph;if(N.size>A){m(N.type==="image/gif"?"Animated GIFs must be 5MB or smaller.":`Page photos must be ${Lh} or smaller.`);return}if(m(""),N.type==="image/gif"){w(N);return}c(N)},w=async C=>{u(),h(!0),m("");try{const N=await Gke(C);if(!N?.url)throw new Error("The upload did not return a photo URL.");t(A=>jn(A,{photoUrl:N.url}))}catch(N){m(N.response?.data?.detail?.message||N.message||"We could not upload the photo.")}finally{h(!1)}},j=async C=>
522{if(C.stopPropagation(),!(d||!g)&&await a({title:"Remove page photo?",description:"Your account photo may appear as the fallback on your public page."})){h(!0),m("");try{await Yke(),t(N=>jn(N,{photoUrl:null}))}catch(N){m(N.response?.data?.detail?.message||N.message||"We could not remove the photo.")}finally{h(!1)}}},E=()=>{d||o.current?.click()},S=s.jsxs("div",{className:`ppb-photo-card${g?" has-photo":""}${d?" is-busy":""}${n?" is-compact":""}`,children:[s.jsxs("button",{type:"button",className:"ppb-photo-card-stage",onClick:E,disabled:d,"aria-label":g?"Replace page photo":"Upload page photo",children:[b?s.jsx("img",{src:b,alt:"",className:`ppb-photo-card-img${y?" is-fallback":""}`}):s.jsx("span",{className:"ppb-photo-card-empty","aria-hidden":"true",children:s.jsx(Nh,{className:"ico ico-20"})}),n?s.jsx("span",{className:"ppb-photo-card-veil","aria-hidden":"true",children:d?s.jsx(vt,{className:"ppb-spin"}):b?"Change":"Add"}):s.jsx("span",{className:"ppb-photo-card-edit","aria-hidden":"true",children:d?s.jsx(vt,{className:"ppb-spin"}):b?s.jsx(y0,{}):s.jsx(rc,{})})]}),g&&s.jsx("button",{type:"button",className:"ppb-photo-card-remove",disabled:d,onClick:j,"aria-label":"Remove page photo",children:"Remove"}),s.jsx("input",{ref:o,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",className:"sr-only",onChange:v})]}),_=(d||p)&&s.jsx("p",{className:`ppb-state${p?" is-error":""}`,role:"status","aria-live":"polite",children:d?"Updating your page photo.":p}),k=s.jsx(V0,{cropSrc:l,onCancel:u,onSave:w,title:"Position your page photo"});return n?s.jsxs("div",{className:"ppb-identity-photo",children:[S,_,k]}):s.jsxs(kn,{label:"Page photo",icon:Nh,layout:"row",children:[S,_,k]})}const dnt=280,hnt=700;function pnt(){const{user:e,updateUser:t}=Ut(),n=typeof e?.bio=="string"?e.bio:"",[r,a]=f.useState(n),[i,o]=f.useState(n),[l,c]=f.useState(n),[u,d]=f.useState("idle");return l!==n&&r===i&&(c(n),a(n),o(n)),f.useEffect(()=>{if(r===i)return;const h=setTimeout(()=>{d("saving"),ch({bio:r}).then(()=>{o(r),d("saved"),t({bio:r})}).catch(()=>d("error"))},hnt);return()=>clearTimeout(h)},[r,i,t]),s.jsxs("div",{className:"ppb-identity-line is-bio is-account-bio",children:[s.jsxs("span",{className:"ppb-identity-field",children:[s.jsx("label",{className:"ppb-identity-cap",htmlFor:"ppb-account-bio",children:"About you"}),s.jsx("textarea",{id:"ppb-account-bio",rows:5,placeholder:"What you do, in a sentence or tw
522o",value:r,maxLength:dnt,onChange:h=>a(h.target.value)})]}),s.jsx("span",{className:"ppb-identity-bio-state","aria-live":"polite",children:u==="error"?"Not saved":u==="saving"?"Saving":r===i&&u==="saved"?"Saved":""})]})}const mnt=[{value:"sm",label:"S",name:"Small"},{value:"md",label:"M",name:"Medium"},{value:"lg",label:"L",name:"Large"}];function fnt({label:e,value:t,onChange:n}){return s.jsx("div",{className:"ppb-sml",role:"group","aria-label":e,children:mnt.map(r=>s.jsx("button",{type:"button",className:"ppb-sml-btn","aria-pressed":t===r.value,"aria-label":r.name,title:r.name,onClick:()=>n(r.value),children:r.label},r.value))})}function Jx({label:e,value:t,onChange:n,fallback:r="#1C1917"}){const a=String(t||r).toUpperCase();return s.jsx("input",{type:"color",className:"ppb-text-color-well","aria-label":e,title:`${e}: ${a}`,value:a,onChange:i=>n(i.target.value.toUpperCase())})}function rz({sizeLabel:e,size:t,onSize:n,colorLabel:r,color:a,onColor:i,colorFallback:o}){return s.jsxs("div",{className:"ppb-identity-tools",children:[s.jsx(fnt,{label:e,value:t,onChange:n}),s.jsx(Jx,{label:r,value:a,onChange:i,fallback:o})]})}function gnt({cfg:e,onCfg:t,fallbackPhoto:n="",nameColorFallback:r="#1C1917",bioColorFallback:a="#706D66"}){const{user:i}=Ut(),o=ai(),l=f.useRef(null),[c,u]=f.useState(!1),[d,h]=f.useState(""),p=Ba(e),m=p.displayName,g=(i?.full_name||"").trim(),x=m?KY(m):null,b=p.identity==="logo"&&!!p.logoUrl,y=async w=>{const j=w.target.files?.[0];if(w.target.value="",!!j){if(!["image/png","image/jpeg","image/webp"].includes(j.type)){h("Choose a PNG, JPEG, or WebP image.");return}if(j.size>Ph){h(`Logos must be ${Lh} or smaller.`);return}u(!0),h("");try{const E=await bI(j,{maxDimension:1200,quality:.9}),S=await Wke(E);if(!S?.url)throw new Error("The upload did not return a logo URL.");t(_=>jn(_,{identity:"logo",logoUrl:S.url}))}catch(E){h(E.response?.data?.detail?.message||E.message||"We could not upload the logo.")}finally{u(!1)}}},v=async()=>{if(!(c||!p.logoUrl)&&await o({title:"Remove logo?",description:"Your name will return to the public-page header."})){u(!0),h("");try{await Vke(),t(w=>jn(w,{identity:"name",logoUrl:null}))}catch(w){h(w.response?.data?.detail?.message||w.message||"We could not remove the logo.")}finally{u(!1)}}};return s.jsxs("section",{className:"ppb-f ppb-identity","aria-label":"Profile",children:[s.jsx(unt,{cfg:e,onCfg:t,compact:!0,fallbackPhoto:n}),s.jsxs("div",{className:"ppb-identity-copy",children:[s.jsxs("div",{className:`ppb-identity-line is-name${c?" is-busy":""}`,children:[b?s.jsxs("div",{className:"ppb-identity-logo",children:[s.jsx("button",{type:"button",className:"ppb-identity-logo-replace",disabled:c,onClick:()=>l.current?.click(),"aria-label":"Replace header logo",children:s.jsx("img",{src:p.logoUrl,alt:""})}),s.jsx("button",{type:"button",className:"ppb-identity-logo-remove",disabled:c,onClick:v,"aria-label":"Remove header logo",title:"Remove logo",children:s.jsx(Qs,{className:"ico ico-14","aria-hidden":"true"})})]}):s.jsx("textarea",{id:"ppb-header-name",rows:2,value:m,placeholder:g||"Your name",maxLength:100,"aria-label":"Name on this page","aria-invalid":!!x,"aria-describedby":x?"ppb-header-state":void 0,onChange:w=>t(j=>jn(j,{displayName:w.target.value}))}),!b&&s.jsxs("button",{type:"button",className:"ppb-identity-logo-add",disabled:c,onClick:()=>l.current?.click(),"aria-label":"Upload a logo instead of your name",children:[s.jsx(rc,{className:"ico ico-14","aria-hidden":"true"}),"or logo"]}),s.jsx(rz,{sizeLabel:b?"Logo size":"Name size",size:p.nameSize,onSize:w=>t(j=>jn(j,{nameSize:w})),colorLabel:"Name colour",color:p.nameColor,onColor:w=>t(j=>jn(j,{nameColor:w})),colorFallback:r})]}),s.jsxs("div",{className:"ppb-identity-line is-bio",children:[s.jsxs("span",{className:"ppb-identity-field",children:[s.jsx("label",{className:"ppb-identity-cap",htmlFor:"ppb-header-bio",children:"Tagline"}),s.jsx("textarea",{id:"ppb-header-bio",rows:3,placeholder:`The line under your name 523A second line if you want one`,value:e.roles[0]||"",maxLength:YVe,onChange:w=>t(j=>mGe(j,w.target.value))})]}),s.jsx(rz,{sizeLabel:"Bio size",size:p.bioSize,onSize:w=>t(j=>jn(j,{bioSize:w})),colorLabel:"Bio colour",color:p.bioColor,onColor:w=>t(j=>jn(j,{bioColor:w})),colorFallback:a})]}),s.jsx(pnt,{}),(x||d)&&s.jsxs("p",{id:"ppb-header-state",className:"ppb-state is-error",role:"status","aria-live":"polite",children:[s.jsx(xr,{className:"ico ico-13","aria-hidden":"true"}),x||d]})]}),s.jsx("input",{ref:l,type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",onChange:y})]})}function xnt({label:e,title:t,points:n}){const r=f.useId(),[a,i]=f.useState(!1);return s.jsxs("span",{className:`ppb-tip${a?" is-open":""}`,onMouseLeave:()=>i(!1),children:[s.jsx("button",{type:"button",className:"ppb-tip-btn","aria-label":e,"aria-describedby":r,"aria-expanded":a,onClick:()=>i(o=>!o),onBlur:()=>i(!1),children:s.jsx(al,{strokeWidth:2.2,"aria-hidden":"true"})}),s.jsxs("span",{id:r,className:"ppb-tip-card",role:"tooltip",children:[s.jsx("strong",{children:t}),s.jsx("ul",{children:n.map(o=>s.jsx("li",{children:o},o))})]})]})}const bnt=s.jsx(xnt,{label:"Tips for a sharp background",title:"For a sharp background",points:["Upload the largest version you have. 3000 px or more on the short side stays crisp on Retina screens.","We keep every pixel you upload. If it looks soft here, the file itself is soft.","Photos with bold shapes and colour read better behind text than fine detail."]}),ynt=[{value:"match",label:"Match photo",preview:"#F5F3EC"},{value:"color",label:"Colour",preview:"conic-gradient(from 210deg, #ff5a5f, #ffae45, #f7df4e, #57c785, #36b4df, #6e6de7, #c169d8, #ff5a5f)"},{value:"image",label:"Image",Icon:b0,preview:"linear-gradient(155deg, #3a3544 0%, #6a5a78 42%, #d4b09a 100%)"}];
523function $S({value:e,onChange:t,ariaLabel:n="Colour",showMatch:r=!1,matchSelected:a=!1,onMatch:i,matchLabel:o="Match page photo",matchPhotoSrc:l=null,imageSrc:c=null,imageOn:u=!0,imageBusy:d=!1,onPickImage:h,onRemoveImage:p}){const m=f.useId(),g=f.useRef(null),[x,b]=f.useState("");f.useEffect(()=>()=>g.current?.abort(),[]);const y=async _=>{if(!window.EyeDropper||x||(_.preventDefault(),g.current))return;const k=new AbortController;g.current=k;try{const{sRGBHex:C}=await new window.EyeDropper().open({signal:k.signal});k.signal.aborted||t(C)}catch(C){!k.signal.aborted&&C.name!=="AbortError"&&b("Screen picker unavailable. Open the colour palette to choose a colour.")}finally{g.current=null}},v=String(e||"").toUpperCase(),w=typeof h=="function",j=w&&!!c&&u,E=!a&&!j&&m$.some(_=>_.toUpperCase()===v),S=!a&&!j&&!E&&!!v;return s.jsxs("div",{className:"ppb-swatches",role:"group","aria-label":n,children:[r&&s.jsxs("button",{type:"button",className:`ppb-swatch ppb-swatch-match${a?" on":""}`,"aria-label":o,"aria-pressed":a,title:o,onClick:i,children:[l?s.jsx("img",{className:"ppb-swatch-match-photo",src:l,alt:""}):s.jsx(b0,{className:"ppb-swatch-match-empty",strokeWidth:2.1,"aria-hidden":"true"}),s.jsx("span",{className:"ppb-swatch-match-badge","aria-hidden":"true",children:s.jsx($a,{strokeWidth:2.4})})]}),m$.map(_=>{const k=!a&&!j&&v===_.toUpperCase();return s.jsx("button",{type:"button",className:`ppb-swatch${k?" on":""}`,style:{background:_},"aria-label":_==="#FFFFFF"?"White (profile fade)":_,"aria-pressed":k,title:_==="#FFFFFF"?"White â solid profile fade":_,onClick:()=>t(_)},_)}),s.jsxs("label",{className:"ppb-swatch ppb-swatch-palette",title:"Open colour palette",children:[s.jsx("input",{type:"color","aria-label":`${n} palette`,value:e||"#FFFFFF",onChange:_=>t(_.target.value)}),s.jsx(Pf,{className:"ico ico-18","aria-hidden":"true"})]}),s.jsxs("label",{className:`ppb-swatch ppb-swatch-custom${S?" on":""}`,title:"Pick a colour from the screen",children:[s.jsx("span",{className:"sr-only",children:"Pick a colour from the screen"}),s.jsx("input",{type:"color",value:e||"#FFFFFF",onClick:y,onChange:_=>t(_.target.value)}),s.jsx(VT,{className:"ppb-swatch-custom-ico","aria-hidden":"true",strokeWidth:2.25,stroke:`url(#${m})`,children:s.jsx("defs",{children:s.jsxs("linearGradient",{id:m,x1:"0%",y1:"100%",x2:"100%",y2:"0%",children:[s.jsx("stop",{offset:"0%",stopColor:"#7C3AED"}),s.jsx("stop",{offset:"35%",stopColor:"#007AFF"}),s.jsx("stop",{offset:"65%",stopColor:"#16A34A"}),s.jsx("stop",{offset:"100%",stopColor:"#F97316"})]})})})]}),w&&s.jsxs("span",{className:`ppb-swatch ppb-swatch-image${j?" on":""}${d?" is-busy":""}`,children:[s.jsxs("button",{type:"button",className:"ppb-swatch-image-btn",disabled:d,"aria-label":c?j?"Replace profile image":"Use this image":"Upload profile image",title:c?j?"Replace profile image":"Use this image":"Upload image",onClick:h,children:[c?s.jsx("img",{className:"ppb-swatch-match-photo",src:c,alt:""}):s.jsx(rc,{className:"ppb-swatch-match-empty",strokeWidth:2.1,"aria-hidden":"true"}),d&&s.jsx("span",{className:"ppb-swatch-spin","aria-hidden":"true"})]}),c&&p&&s.jsx("button",{type:"button",className:"ppb-swatch-match-badge ppb-swatch-image-remove",disabled:d,"aria-label":"Remove profile image",title:"Remove image",onClick:p,children:s.jsx(Qs,{strokeWidth:2.4,"aria-hidden":"true"})})]}),x&&s.jsx("span",{role:"status",className:"ppb-screen-picker-error",children:x})]})}const vnt=[{value:"arch",label:"Arch"},{value:"blob",label:"Blob"},{value:"hex",label:"Hexagon"},{value:"circle",label:"Circle"},{value:"rounded",label:"Rounded square"},{value:"diamond",label:"Diamond"}];function wnt({cfg:e,onCfg:t,photoSrc:n=null,pane:r="all",hideProfileBackground:a=!1,componentColorFallback:i="#3D3DF5",componentTextColorFallback:o="#FAF9F5",surfaceColorFallback:l="#FDFCF8"}){const c=V=>r==="all"||r===V,u=ai(),d=e.socials,h=Ih(e,"header"),p=e.headerStyle,m=f.useRef(null),g=f.useRef(null),x=f.useRef(null),[b,y]=f.useState(null),[v,w]=f.useState(!1),[j,E]=f.useState(""),[S,_]=f.useState(!1),[k,C]=f.useState(""),[N,A]=f.useState(!1),[T,I]=f.useState(""),$=V=>{t(L=>jn(L,{heroSurfaceOn:!1,...V}))},[O,U]=f.useState(!1),F=f.useRef(null),H=f.useRef(null),{user:G}=Ut(),M=lI(e,G?.full_name||G?.name)||"Your name",z=Am.find(V=>V.id===p.font)||Am[0];Uk(aQ),f.useEffect(()=>{if(!O)return;const V=K=>{F.current?.contains(K.target)||U(!1)},L=K=>{K.key==="Escape"&&U(!1)};return document.addEventListener("mousedown",V),document.addEventListener("keydown",L),()=>{document.removeEventListener("mousedown",V),document.removeEventListener("keydown",L)}},[O]),f.useEffect(()=>{if(!O)return;const V=requestAnimationFrame(()=>{H.current?.scrollIntoView({block:"nearest",inline:"nearest",behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})});return()=>cancelAnimationFrame(V)},[O]),f.useEffect(()=>()=>{b&&URL.revokeObjectURL(b)},[b]);const W=async V=>{const L=V.target.files?.[0];if(V.target.value="",!!L){if(!["image/png","image/jpeg","image/webp"].includes(L.type)){E("Choose a PNG, JPEG, or WebP image.");return}if(L.size>Ph){E(`Banner images must be ${Lh} or smaller.`);return}E(""),y(URL.createObjectURL(await A0(L)))}},D=async V=>{y(null),w(!0),E("");try{const L=await Hke(V);if(!L?.url)throw new Error("The upload did not return a banner URL.");t(K=>jn(K,{bannerUrl:L.url}))}catch(L){E(L.response?.data?.detail?.message||L.message||"We could not upload the banner.")}finally{w(!1)}},Z=async()=>
523{if(!v&&await u({title:"Remove banner image?",description:"The banner will be removed from your public-page header."})){w(!0),E("");try{await qke(),t(V=>jn(V,{bannerUrl:null}))}catch(V){E(V.response?.data?.detail?.message||V.message||"We could not remove the banner.")}finally{w(!1)}}};return s.jsxs(s.Fragment,{children:[c("look")&&h===4&&s.jsxs(kn,{label:"Banner image",icon:b0,hint:"Wide image, 3:1 crop. PNG, JPEG, or WebP. Large photos are resized for you.",children:[s.jsx("input",{ref:m,type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",onChange:W}),s.jsxs("button",{type:"button",className:`ppb-banner-drop${p.bannerUrl?" has-img":""}${v?" is-busy":""}`,disabled:v,onClick:()=>m.current?.click(),"aria-label":p.bannerUrl?"Replace banner image":"Upload banner image",children:[p.bannerUrl?s.jsx("img",{src:p.bannerUrl,alt:"",className:"ppb-banner-drop-img"}):s.jsx("span",{className:"ppb-banner-drop-empty","aria-hidden":"true"}),s.jsxs("span",{className:"ppb-banner-drop-veil",children:[s.jsx(rc,{className:"ico ico-14","aria-hidden":"true"}),s.jsx("span",{children:v?"Updatingâ¦":p.bannerUrl?"Change":"Add banner"})]})]}),p.bannerUrl&&s.jsx("div",{className:"ppb-banner-actions",children:s.jsxs("button",{type:"button",className:"ppb-btn ghost sm danger",disabled:v,onClick:Z,children:[s.jsx(Qs,{className:"ico ico-14","aria-hidden":"true"}),"Remove"]})}),s.jsx("p",{className:`ppb-state${j?" is-error":""}`,role:"status","aria-live":"polite",children:j})]}),c("look")&&h===5&&s.jsxs(s.Fragment,{children:[s.jsx(kn,{label:"Photo shape",icon:K1e,layout:"row",children:s.jsx("div",{className:"ppb-shape-options",role:"group","aria-label":"Header photo shape",children:vnt.map(({value:V,label:L})=>{const K=p.shape===V;return s.jsxs("button",{type:"button",className:`ppb-shape-choice${K?" on":""}`,"aria-label":L,"aria-pressed":K,title:L,onClick:()=>t(te=>jn(te,{shape:V})),children:[s.jsxs("span",{className:"ppb-shape-icon","aria-hidden":"true",children:[s.jsx("span",{className:`ppb-shape-icon-cast is-${V}`,style:{background:p.shapeColor||"#E6C3B3"}}),s.jsx("span",{className:`ppb-shape-icon-face is-${V}`,children:n?s.jsx("img",{src:n,alt:"",draggable:"false"}):null})]}),s.jsx("span",{className:"ppb-shape-check","aria-hidden":"true",children:s.jsx(ft,{className:"ico ico-13"})}),s.jsx("span",{className:"sr-only",children:L})]},V)})})}),s.jsx(kn,{label:"Shadow colour",icon:tD,layout:"row",hint:"Changes the offset shape behind your photo.",children:s.jsxs("div",{className:"ppb-bg-color ppb-shape-color",children:[s.jsxs("label",{className:"ppb-bg-color-wheel",title:"Pick a shadow colour",style:{background:p.shapeColor||"#E6C3B3"},children:[s.jsx("span",{className:"sr-only",children:"Shadow colour"}),s.jsx("input",{type:"color",value:p.shapeColor||"#E6C3B3",onChange:V=>t(L=>jn(L,{shapeColor:V.target.value}))}),s.jsx(VT,{className:"ppb-bg-color-wheel-ico","aria-hidden":"true",strokeWidth:2.25})]}),s.jsx("input",{type:"text",className:"ppb-bg-color-hex",defaultValue:p.shapeColor||"#E6C3B3",maxLength:7,"aria-label":"Shadow colour hex",onKeyDown:V=>{V.key==="Enter"&&V.currentTarget.blur()},onBlur:V=>{let L=V.currentTarget.value.trim();L&&!L.startsWith("#")&&(L=`#${L}`),/^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/.test(L)?t(K=>jn(K,{shapeColor:L})):V.currentTarget.value=p.shapeColor||"#E6C3B3"}},p.shapeColor||"#E6C3B3")]})})]}),c("look")&&!a&&s.jsxs(kn,{label:"Profile background",icon:Pf,hint:"Choose a color that fills the profile or Upload an Image",children:[s.jsx($S,{value:p.autoColor||p.heroSurfaceOn!==!1&&p.heroSurfaceUrl?l:p.heroSurfaceColor||"#FFFFFF",ariaLabel:"Profile colour",showMatch:h===3||h===4,matchSelected:(h===3||h===4)&&p.autoColor===!0,onMatch:()=>$({autoColor:!0}),matchPhotoSrc:n,onChange:V=>$({autoColor:!1,heroSurfaceColor:V}),imageSrc:p.heroSurfaceUrl,imageOn:p.heroSurfaceOn!==!1,imageBusy:N,onPickImage:()=>{if(!N){if(p.heroSurfaceUrl&&p.heroSurfaceOn===!1){t(V=>jn(V,{autoColor:!1,heroSurfaceOn:!0}));return}x.current?.click()}},onRemoveImage:async()=>{if(!N&&await u({title:"Remove profile image?",description:"Your profile will return to the colour you picked."})){A(!0),I("");try{await Zke(),t(V=>jn(V,{heroSurfaceUrl:null,heroSurfaceOn:!0}))}catch(V){I(V.response?.data?.detail?.message||V.message||"Could not remove the image.")}finally{A(!1)}}}}),s.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",onChange:async V=>{const L=V.target.files?.[0];if(V.target.value="",!!L){if(!["image/png","image/jpeg","image/webp"].includes(L.type)){I("Choose a PNG, JPEG, or WebP image.");return}if(L.size>8*1024*1024){I("Profile images must be 8MB or smaller.");return}A(!0),I("");try{const K=await Qke(L);if(!K?.url)throw new Error("Upload did not return a URL.");t(te=>jn(te,{autoColor:!1,heroSurfaceUrl:K.url,heroSurfaceOn:!0}))}catch(K){I(K.response?.data?.detail?.message||K.message||"Could not upload the image.")}finally{A(!1)}}}}
523),(N||T)&&s.jsx("p",{className:`ppb-state ppb-bg-upload-note${T?" is-error":""}`,role:"status","aria-live":"polite",children:N?"Updating profile image.":T})]}),c("look")&&s.jsx(kn,{label:"Buttons & links colour",icon:tD,hint:"The photo option harmonises buttons, links and cards with your profile.",children:s.jsx($S,{value:p.componentColorMode==="custom"?p.componentColor:i,ariaLabel:"Component colour",showMatch:!0,matchLabel:"Automatic â match this profile",matchSelected:p.componentColorMode!=="custom",onMatch:()=>t(V=>jn(V,{componentColorMode:"auto"})),matchPhotoSrc:n,onChange:V=>t(L=>jn(L,{componentColorMode:"custom",componentColor:V}))})}),c("look")&&s.jsx(kn,{label:"Buttons & links text colour",icon:GT,layout:"row",optional:"picked for contrast by default",hint:"The text on buttons, links and product bars.",children:s.jsx(Jx,{label:"Buttons & links text colour",value:p.componentTextColor,fallback:o,onChange:V=>t(L=>jn(L,{componentTextColor:V}))})}),c("look")&&s.jsxs(kn,{label:s.jsxs(s.Fragment,{children:["Page background",bnt]}),icon:p0e,layout:"row",children:[s.jsx("div",{className:"ppb-bg-modes",role:"group","aria-label":"Page background type",children:ynt.map(({value:V,label:L,Icon:K,preview:te})=>{const Y=(rQ.includes(p.pageBg)?p.pageBg:"match")===V,J=V==="color"?te:V==="image"&&p.pageBgUrl?`center / cover no-repeat url("${p.pageBgUrl}"), #F5F3EC`:te;return s.jsxs("button",{type:"button",className:`ppb-bg-mode${Y?" on":""}`,"aria-pressed":Y,onClick:()=>{t(P=>jn(P,{pageBg:V})),V==="image"&&(Y||!p.pageBgUrl)&&!S&&g.current?.click()},children:[s.jsxs("span",{className:"ppb-bg-mode-face",style:{background:J},"aria-hidden":"true",children:[V==="match"&&n&&s.jsx("img",{className:"ppb-bg-mode-photo",src:n,alt:""}),s.jsx("span",{className:"ppb-bg-mode-glass",children:V==="match"?s.jsx($a,{className:"ppb-bg-mode-ico",strokeWidth:2.2}):V==="color"?s.jsx("span",{className:"ppb-bg-mode-colour-dot",style:{background:p.pageBgColor||"#F5F3EC"}}):s.jsx(K,{className:"ppb-bg-mode-ico",strokeWidth:1.75})})]}),s.jsx("span",{className:"ppb-bg-mode-label",children:L})]},V)})}),p.pageBg==="color"&&s.jsx("div",{className:"ppb-bg-swatches",children:s.jsx($S,{value:p.pageBgColor||"#F5F3EC",ariaLabel:"Background colour",onChange:V=>t(L=>jn(L,{pageBg:"color",pageBgColor:V}))})}),s.jsx("input",{ref:g,type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",onChange:async V=>{const L=V.target.files?.[0];if(V.target.value="",!!L){if(!["image/png","image/jpeg","image/webp"].includes(L.type)){C("Choose a PNG, JPEG, or WebP image.");return}if(L.size>Ph){C(`Background images must be ${Lh} or smaller.`);return}_(!0),C("");try{const K=await Kke(L);if(!K?.url)throw new Error("Upload did not return a URL.");t(te=>jn(te,{pageBg:"image",pageBgUrl:K.url}))}catch(K){C(K.response?.data?.detail?.message||K.message||"Could not upload the background.")}finally{_(!1)}}}}),p.pageBg==="image"&&s.jsxs("div",{className:"ppb-bg-upload",children:[p.pageBgUrl&&s.jsxs("div",{className:"ppb-bg-upload-stage","aria-busy":S,children:[s.jsx("button",{type:"button",className:"ppb-bg-upload-media",disabled:S,"aria-label":"Replace page background image",onClick:()=>g.current?.click(),children:s.jsx("img",{className:"ppb-bg-upload-preview",src:p.pageBgUrl,alt:""})}),s.jsxs("div",{className:"ppb-bg-upload-actions",children:[s.jsxs("button",{type:"button",className:"ppb-bg-upload-glass",disabled:S,onClick:()=>g.current?.click(),children:[s.jsx(rc,{className:"ico ico-14","aria-hidden":"true"}),S?"Updatingâ¦":"Replace image"]}),s.jsxs("button",{type:"button",className:"ppb-bg-upload-glass is-danger",disabled:S,onClick:async()=>{if(!S&&await u({title:"Remove background image?",description:"Your page background will return to Match photo."})){_(!0),C("");try{await Jke(),t(V=>jn(V,{pageBgUrl:null,pageBg:"match"}))}catch(V){C(V.response?.data?.detail?.message||V.message||"Could not remove the background.")}finally{_(!1)}}},children:[s.jsx(Qs,{className:"ico ico-14","aria-hidden":"true"}),"Remove"]})]})]}),!p.pageBgUrl&&s.jsx("div",{className:"ppb-banner-actions",children:s.jsxs("button",{type:"button",className:"ppb-btn sec sm",disabled:S,onClick:()=>g.current?.click(),children:[s.jsx(rc,{className:"ico ico-14","aria-hidden":"true"}),"Upload image"]})}
523),s.jsx("p",{className:`ppb-state ppb-bg-upload-note${k?" is-error":""}`,role:"status","aria-live":"polite",children:S?"Preparing your image.":k||"PNG, JPEG, or WebP. Wide images work best, and large photos are resized for you."})]})]}),c("look")&&s.jsx(kn,{label:"Font",icon:GT,layout:"row",children:s.jsxs("div",{className:`ppb-font-select${O?" is-open":""}`,ref:F,children:[s.jsxs("button",{type:"button",className:"ppb-font-trigger","aria-haspopup":"listbox","aria-expanded":O,onClick:()=>U(V=>!V),children:[s.jsx("span",{className:"ppb-font-trigger-name",style:{fontFamily:z.stack},children:M}),s.jsx("span",{className:"ppb-font-trigger-label",style:{fontFamily:z.stack},children:z.label}),s.jsx(Is,{className:"ico ico-14 ppb-font-caret","aria-hidden":"true"})]}),O&&s.jsx("div",{ref:H,className:"ppb-font-menu",role:"listbox","aria-label":"Page font",tabIndex:-1,children:T3e.map(V=>{const L=Am.filter(K=>(K.group||"Sans")===V);return L.length?s.jsxs("div",{className:"ppb-font-group",children:[s.jsx("p",{className:"ppb-font-group-label",children:V}),L.map(({id:K,label:te,note:Q,stack:Y})=>{const J=p.font===K;return s.jsxs("button",{type:"button",role:"option","aria-selected":J,className:`ppb-font-option${J?" on":""}`,onClick:()=>{t(P=>jn(P,{font:K})),U(!1)},children:[s.jsx("span",{className:"ppb-font-option-name",style:{fontFamily:Y},children:M}),s.jsxs("span",{className:"ppb-font-option-meta",children:[s.jsx("em",{style:{fontFamily:Y},children:te}),s.jsx("small",{children:Q})]}),J&&s.jsx(ft,{className:"ico ico-13 ppb-font-option-check","aria-hidden":"true"})]},K)})]},V):null})})]})}),c("identity")&&s.jsx(kn,{label:"Links",icon:$a,optional:`up to ${RP}`,children:s.jsx(Sne,{links:d,onCfg:t})}),c("extras")&&s.jsxs(kn,{label:"Call button",icon:Ts,layout:"row",children:[s.jsxs("div",{className:"ppb-call-style-row",children:[s.jsx(cnt,{value:Uf(e),onChange:V=>t(L=>sGe(L,V)),color:ph(e)||By,name:M,label:ak(e)}),s.jsxs("label",{className:"ppb-call-color-wheel",title:"Call button colour",style:{background:ph(e)||By},children:[s.jsx("span",{className:"sr-only",children:"Call button colour"}),s.jsx("input",{type:"color",value:ph(e)||By,onChange:V=>{const L=V.target.value.toUpperCase();t(K=>nGe(K,L===By?null:L))}}),s.jsx(VT,{className:"ppb-call-color-wheel-ico","aria-hidden":"true",strokeWidth:2.25})]})]}),s.jsx("input",{type:"text",className:"ppb-call-label-input","aria-label":"Call button text",placeholder:cI(M),value:typeof e.callLabel=="string"?e.callLabel:"",maxLength:oI,onChange:V=>t(L=>rGe(L,V.target.value))})]}),s.jsx(T0,{isOpen:!!b,imageSrc:b,onCancel:()=>y(null),onSave:D,cropShape:"rect",aspect:3,outputWidth:1920,outputFormat:"webp",title:"Position your banner"})]})}const Xj={header:[s.jsxs("div",{className:"wf center",children:[s.jsx("i",{className:"circ"}),s.jsx("i",{className:"bar s"}),s.jsx("i",{className:"bar m"})]}),s.jsx("div",{className:"wf",children:s.jsxs("div",{className:"col",children:[s.jsx("i",{className:"circ"}),s.jsxs("div",{className:"lines",children:[s.jsx("i",{className:"bar m"}),s.jsx("i",{className:"bar s"})]})]})}),s.jsxs("div",{className:"wf center",children:[s.jsx("i",{className:"port"}),s.jsx("i",{className:"bar m"})]}),s.jsxs("div",{className:"wf",children:[s.jsx("i",{className:"box strong"}),s.jsxs("div",{className:"col",children:[s.jsx("i",{className:"circ"}),s.jsx("i",{className:"bar m"})]})]}),s.jsxs("div",{className:"wf center",children:[s.jsx("i",{className:"bar h13 strong"}),s.jsx("i",{className:"circ"}),s.jsx("i",{className:"bar m"})]}),s.jsxs("div",{className:"wf center",children:[s.jsx("i",{className:"port strong"}),s.jsx("i",{className:"bar s"}),s.jsx("i",{className:"bar m"})]})],expert:[s.jsxs("div",{className:"wf",children:[s.jsx("i",{className:"bar s"}),s.jsx("i",{className:"box"}),s.jsx("i",{className:"bar"})]}),s.jsxs("div",{className:"wf",children:[s.jsxs("div",{className:"col",children:[s.jsx("i",{className:"circ"}),s.jsxs("div",{className:"lines",children:[s.jsx("i",{className:"bar m"}),s.jsx("i",{className:"bar s"})]})]}),s.jsxs("div",{className:"col",children:[s.jsx("i",{className:"circ"}),s.jsx("div",{className:"lines",children:s.jsx("i",{className:"bar m"})})]})]})],services:[s.jsxs("div",{className:"wf",children:[s.jsx("i",{className:"bar h11"}),s.jsx("i",{className:"bar h11"}),s.jsx("i",{className:"bar h11"})]}),s.jsxs("div",{className:"wf",children:[s.jsxs("div",{className:"row",children:[s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("div",{className:"row",children:[s.jsx("i",{}),s.jsx("i",{})]})]}),s.jsx("div",{className:"wf",children:s.jsxs("div",{className:"rail",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{className:"half"})]})}),s.jsxs("div",{className:"wf",children:[s.jsx("i",{className:"bar s"}),s.jsxs("div",{className:"rail",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{className:"half"})]}),s.jsx("i",{className:"bar s"})]})],media:[s.jsxs("div",{className:"wf",children:[s.jsx("i",{className:"box"}),s.jsxs("div",{className:"row short",children:[s.jsx("i",{}),s.jsx("i",{})]})]}),s.jsxs("div",{className:"wf",children:[s.jsx("i",{className:"bar h9"}),s.jsx("i",{className:"bar h9"}),s.jsx("i",{className:"bar h9"})]}),s.jsxs("div",{className:"wf",children:[s.jsx("i",{className:"bar s"}),s.jsxs("div",{className:"rail",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{className:"half"})]}),s.jsx("i",{className:"bar s"})]})],products:[s.jsxs("div",{className:"wf",children:[s.jsxs("div",{className:"col",children:[s.jsx("i",{className:"sq"}),s.jsx("i",{className:"bar"})]}),s.jsxs("div",{className:"col",children:[s.jsx("i",{className:"sq"}),s.jsx("i",{className:"bar"})]}),s.jsxs("div",{className:"col",children:[s.jsx("i",{className:"sq"}),s.jsx("i",{className:"bar"})]})]}),s.jsxs("div",{className:"wf",children:[s.jsxs("div",{className:"row",children:[s.jsx("i",{className:"box strong"}),s.jsx("i",{className:"box strong"})]}),s.jsxs("div",{className:"row short",children:[s.jsx("i",{className:"bar s strong"}),s.jsx("i",{className:"bar s strong"})]})]}),s.jsx("div",{className:"wf",children:s.jsxs("div",{className:"rail",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{className:"half"})]})}),s.jsxs("div",{className:"wf",children:[s.jsx("i",{className:"bar s"}),s.jsxs("div",{className:"rail",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{className:"half"})]}),s.jsx("i",{className:"bar s"})]})],contact:[s.jsx("div",{className:"wf",children:s.jsx("i",{className:"bar h13 strong"})}),s.jsxs("div",{className:"wf",children:[s.jsx("i",{className:"bar h7"}),s.jsx("i",{className:"bar h7"}),s.jsx("i",{className:"bar h11 strong"})]})],custom:[s.jsxs("div",{className:"wf",children:[s.jsx("i",{className:"bar"}),s.jsx("i",{className:"bar wide"}),s.jsx("i",{className:"bar s"})]}),s.jsxs("div",{className:"wf",children:[s.jsx("i",{className:"bar h10"}),s.jsx("i",{className:"bar h10"})]})]};function az({size:e="wide"}){return s.jsx("span",{className:`live-line ${e}`})}function gd({src:e,className:t}){return s.jsx("img",{src:e,alt:"",className:t,draggable:"false"})}
523function jnt({layout:e,photoSrc:t,bannerSrc:n,shape:r,shapeColor:a}){return t?e===0?s.jsx("span",{className:"wf live-preview live-centered","aria-hidden":"true",children:s.jsx(gd,{src:t,className:"live-photo circle"})}):e===1?s.jsxs("span",{className:"wf live-preview live-beside","aria-hidden":"true",children:[s.jsx(gd,{src:t,className:"live-photo circle"}),s.jsxs("span",{className:"live-copy",children:[s.jsx(az,{}),s.jsx(az,{size:"medium"})]})]}):e===2?s.jsx("span",{className:"wf live-preview live-portrait","aria-hidden":"true",children:s.jsx(gd,{src:t,className:"live-photo portrait"})}):e===3?s.jsxs("span",{className:"wf live-preview live-hero","aria-hidden":"true",children:[s.jsx(gd,{src:t,className:"live-photo hero"}),s.jsx("span",{className:"live-hero-fade"})]}):e===4?s.jsxs("span",{className:"wf live-preview live-banner","aria-hidden":"true",children:[n?s.jsx(gd,{src:n,className:"live-banner-media"}):s.jsx("span",{className:"live-banner-media is-empty"}),s.jsx("span",{className:"live-banner-wash"}),s.jsx(gd,{src:t,className:"live-photo circle"})]}):s.jsxs("span",{className:"wf live-preview live-shape","aria-hidden":"true",children:[s.jsx("span",{className:`live-shape-cast is-${r||"arch"}`,style:{background:a||"#E6C3B3"}}),s.jsx(gd,{src:t,className:`live-photo shape is-${r||"arch"}`})]}):Xj.header[e]||Xj.header[0]}function _nt({sectionKey:e,value:t,onChange:n,photoSrc:r=null,bannerSrc:a=null,shape:i="arch",shapeColor:o="#E6C3B3"}){const l=gf(e),c=e.split("#")[0],u=Xj[c]||Xj.custom;return s.jsx("div",{className:`ppb-lay${l.layouts.length>2?" three":""}`,children:l.layouts.map((d,h)=>s.jsxs("button",{type:"button",className:"ppb-lay-opt","aria-label":d,"aria-pressed":t===h,onClick:()=>n(h),children:[s.jsx("span",{className:"chk","aria-hidden":"true",children:s.jsx(ft,{className:"ico ico-13"})}),c==="header"?s.jsx(jnt,{layout:h,photoSrc:r,bannerSrc:a,shape:i,shapeColor:o}):u[h]||u[0]]},d))})}const knt=900,iz=80,y5=["","",""];function Nnt(e){return!Array.isArray(e)||e.length!==3?y5:e.map(t=>String(t||""))}function Ent({expert:e,onStartersChange:t}){const[n,r]=f.useState(y5),[a,i]=f.useState(!1),[o,l]=f.useState("loading"),[c,u]=f.useState(""),d=f.useRef(""),h=f.useRef(t);h.current=t,f.useEffect(()=>{let y=!1;return i(!1),l("loading"),kh(e.id).then(v=>{if(y)return;const w=Nnt(v?.data?.starters);r(w),d.current=w.map(j=>j.trim()).join(` 524`),i(!0),l("idle"),h.current?.(e.id,w)}).catch(()=>{y||(r(y5),d.current="",i(!0),l("idle"))}),()=>{y=!0}},[e.id]);const p=f.useCallback(async y=>{l("saving"),u("");try{await e0e(e.id,y),d.current=y.join(` 525`),l("saved")}catch(v){l("error"),u(v.response?.data?.detail?.message||v.message||"We could not save these questions. Please try again.")}},[e.id]),m=n.map(y=>y.trim()),g=m.every(Boolean)&&m.every(y=>y.length<=iz),x=a&&g&&m.join(` 526`)!==d.current;f.useEffect(()=>{if(!x)return;const y=n.map(w=>w.trim()),v=setTimeout(()=>p(y),knt);return()=>clearTimeout(v)},[x,n,p]);const b=o==="error"?c:"";return s.jsxs("div",{className:"ppb-starters-expert",children:[n.map((y,v)=>s.jsx("input",{type:"text",value:y,maxLength:iz,disabled:!a,placeholder:a?`Question ${v+1}`:"Loadingâ¦","aria-label":`${e.name||"Expert"}, question ${v+1}`,onChange:w=>{const j=w.target.value,E=n.map((S,_)=>_===v?j:S);r(E),h.current?.(e.id,E)}},v)),b||o==="loading"||o==="saving"||o==="saved"?s.jsx("p",{className:`ppb-state${b?" is-error":""}`,role:"status","aria-live":"polite",children:b?s.jsxs(s.Fragment,{children:[s.jsx(xr,{className:"ico ico-13","aria-hidden":"true"}),b]}):s.jsxs(s.Fragment,{children:[o==="loading"&&"Loading questions.",o==="saving"&&"Saving questions.",o==="saved"&&s.jsxs(s.Fragment,{children:[s.jsx(ft,{className:"ico ico-13","aria-hidden":"true"}),"Saved."]})]})}):null]})}function Snt({experts:e,value:t,onChange:n}){const[r,a]=f.useState(!1),[i,o]=f.useState(null),l=f.useRef(null),c=f.useRef(null),u=e.find(d=>String(d.id)===String(t))||e[0];return f.useEffect(()=>{if(!r)return;const d=()=>{const m=l.current?.getBoundingClientRect();m&&o({top:m.bottom+6,right:window.innerWidth-m.right})};d();const h=m=>{const g=l.current?.contains(m.target),x=c.current?.contains(m.target);!g&&!x&&a(!1)},p=m=>{m.key==="Escape"&&a(!1)};return window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),document.addEventListener("mousedown",h),document.addEventListener("keydown",p),()=>{window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0),document.removeEventListener("mousedown",h),document.removeEventListener("keydown",p)}},[r]),u?s.jsxs("div",{className:`ppb-starters-pick${r?" is-open":""}`,ref:l,children:[s.jsxs("button",{type:"button",className:"ppb-starters-pick-btn","aria-haspopup":"listbox","aria-expanded":r,"aria-label":`Edit questions for ${u.name}. Change expert.`,onClick:()=>a(d=>!d),children:[s.jsx("span",{"aria-hidden":"true",children:s.jsx(ws,{name:u.name,src:u.avatar_url,size:"sm",variant:"expert"})}),s.jsx(Is,{className:"ppb-starters-pick-caret","aria-hidden":"true",strokeWidth:2.25})]}),r&&i&&Mn.createPortal(s.jsx("div",{ref:c,className:"ppb-starters-pick-menu",role:"listbox","aria-label":"Expert whose questions to edit",style:{to
526p:i.top,right:i.right},children:e.map(d=>{const h=String(d.id)===String(u.id);return s.jsxs("button",{type:"button",role:"option","aria-selected":h,className:`ppb-starters-pick-option${h?" on":""}`,onClick:()=>{n(d.id),a(!1)},children:[s.jsx("span",{"aria-hidden":"true",children:s.jsx(ws,{name:d.name,src:d.avatar_url,size:"sm",variant:"expert"})}),s.jsx("span",{className:"ppb-starters-pick-option-name",children:d.name}),h&&s.jsx(ft,{className:"ico ico-13","aria-hidden":"true",strokeWidth:2.5})]},d.id)})}),document.body)]}):null}function Cnt({experts:e,cfg:t,onStartersChange:n}){const r=Xh(e,t),[a,i]=f.useState(()=>String(r[0]?.id||""));if(f.useEffect(()=>{if(!r.length||r.some(h=>String(h.id)===String(a)))return;const u=String(t?.featuredExpertId||""),d=r.find(h=>String(h.id)===u)||r[0];i(String(d.id))},[r,a,t?.featuredExpertId]),!r.length)return null;const o=r.find(c=>String(c.id)===String(a))||r[0],l=r.length>1;return s.jsx(kn,{label:"Edit predefined questions",icon:If,hint:l?`Shown as starter chips when someone opens chat with ${o.name}.`:"Shown as starter chips when someone opens chat.",trailing:l?s.jsx(Snt,{experts:r,value:o.id,onChange:i}):null,children:s.jsx("div",{className:"ppb-starters",children:r.map(c=>s.jsx("div",{hidden:String(c.id)!==String(o.id),children:s.jsx(Ent,{expert:c,onStartersChange:n})},c.id))})})}function Tnt({cfg:e,sectionKey:t,fallbackPhoto:n="",experts:r,expertsLoading:a,expertsFailed:i,onCfg:o,onSave:l,saveState:c="idle",autoSaveState:u="saved",previewDevice:d="desktop",previewZoom:h=1,onClose:p,onRemove:m,onStartersChange:g,hideProfileBackground:x=!1}){const{user:b}=Ut(),y=ai(),v=mn(t),w=gf(t),j=gne(e,t),E=Ba(e),S=v==="header"?E:null,_=uI(e,n||b?.avatar_url),k=v==="header"?_:null,C=Ih(e,"header"),A=(E.pageBg==="match"||E.autoColor||C===4&&!E.bannerUrl||E.componentColorMode!=="custom"&&!!_)&&(C===4&&E.bannerUrl||_)||null,T=e0(A);Uk(E.font);const I=fu(E),$=e0(I),O=qk(E,I?$:T),U=gae(E,T,O),F=V=>`#${V.map(L=>Math.round(L).toString(16).padStart(2,"0")).join("")}`,H=F(U.ink),G=F(U.inkMuted),M={"--ppb-floating-surface-rgb":U.floatingSurface.join(" "),"--ppb-floating-on-rgb":U.floatingOn.join(" "),"--ppb-floating-muted-rgb":U.floatingMuted.join(" "),"--ppb-floating-font":JR(E.font),"--ppb-floating-text-size":`${(d==="mobile"?14:16)*h}px`},z=v==="expert"?Xh(r,e):[],W=v==="expert"?XR(z,e.featuredExpertId)||z[0]:null,D=f.useRef(null);f.useEffect(()=>{D.current?.focus()},[t]);const Z=s.jsxs(kn,{label:"Layout",icon:R_,children:[s.jsx(_nt,{sectionKey:t,value:Ih(e,t),onChange:V=>o(L=>tGe(L,t,V)),photoSrc:k,bannerSrc:S?.bannerUrl,shape:S?.shape,shapeColor:S?.shapeColor}),v==="contact"&&s.jsx(snt,{cfg:e,onCfg:o})]});return s.jsxs(s.Fragment,{children:[p?s.jsxs("div",{className:"ppb-edit-hd is-actions",children:[s.jsx("button",{type:"button",ref:D,className:"back",onClick:p,"aria-label":"Back to all sections",children:s.jsx(ja,{className:"ico","aria-hidden":"true"})}),s.jsx("h2",{className:"sr-only",children:j})]}):s.jsx("h2",{className:"sr-only",ref:D,tabIndex:-1,children:j}),s.jsx("div",{className:"ppb-edit-body",children:s.jsxs("div",{className:"ppb-edit-fields",children:[v!=="header"&&s.jsx(kn,{id:"ppb-heading",label:v==="contact"?"Heading":"Section Title",icon:GT,layout:"row",optional:v==="contact"?void 0:"yours to change",hint:v==="custom"?"Use this for Instagram posts, press, or any links that are not a service or product.":void 0,children:s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("input",{id:"ppb-heading",type:"text",className:"min-w-0 flex-1",value:e.headings[t]||"",placeholder:v==="custom"?"e.g. Instagram, press, your own links":w.heading,maxLength:nj,onChange:V=>o(L=>eGe(L,t,V.target.value))}),s.jsx(Jx,{label:"Section title colour",value:e.headingColors?.[t],fallback:H,onChange:V=>o(L=>GE(L,t,V))})]})}),w.layouts?.includes("Storefront")&&s.jsx(kn,{id:"ppb-shelf-colour",label:"Category labels",icon:Pf,layout:"row",optional:"match the title by default",hint:"Colours the category names and counts, and See all in the Storefront layout.",children:s.jsx(Jx,{label:"Category label colour",value:e.headingColors?.[GA(t)],fallback:of(e,t)||H,onChange:V=>o(L=>GE(L,GA(t),V))})}),v==="header"&&s.jsx(gnt,{cfg:e,onCfg:o,fallbackPhoto:n,nameColorFallback:H,bioColorFallback:G}),v==="contact"&&s.jsxs(s.Fragment,{children:[s.jsx(kn,{id:"ppb-contact-desc",label:"Supporting line",icon:CY,layout:"row",hint:"Leave it empty and we use our wording.",children:s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx("textarea",{id:"ppb-contact-desc",rows:2,className:"min-w-0 flex-1",value:e.desc,placeholder:Gs.desc,maxLength:500,onChange:V=>o(L=>({...L,desc:V.target.value}))}),s.jsx(Jx,{label:"Supporting line colour",value:e.headingColors?.[YA(t)],fallback:G,onChange:V=>o(L=>GE(L,YA(t),V))})]})}),s.jsx(kn,{id:"ppb-contact-cta",label:"Button text",icon:jY,layout:"row",hint:"Leave it empty and we use our wording.",children:s.jsx("input",{id:"ppb-contact-cta",type:"text",value:e.contactCta??"",placeholder:tk,maxLength:tj,onChange:V=>o(L=>({...L,contactCta:V.target.value.slice(0,tj)}))})})]}),Z,v==="header"&&s.jsx(wnt,{cfg:e,onCfg:o,photoSrc:k,hideProfileBackgroun
526d:x,componentColorFallback:F(U.accent),componentTextColorFallback:F(U.on),surfaceColorFallback:F(O.rgb.split(/\s+/).map(Number))}),v==="header"&&s.jsx(MS,{cfg:e,onCfg:o,groups:["call","lists"],label:"Page wording",showKey:V=>V==="callSubline"?["row","warm","bar"].includes(KA(e)):V==="callPill"?KA(e)==="row":!0}),v==="expert"&&s.jsxs(s.Fragment,{children:[s.jsx(int,{cfg:e,experts:r,isLoading:a,loadFailed:i,onToggle:V=>o(L=>lGe(L,V)),onFeature:V=>o(L=>cGe(L,r,V)),onReorder:V=>o(L=>uGe(L,V))}),s.jsx(Cnt,{experts:r,cfg:e,onStartersChange:g}),s.jsx(kn,{label:"Floating ask bar",icon:ea,children:s.jsxs("div",{className:`ppb-floating-config${e.floatingAsk===!1?" is-off":""}`,children:[s.jsxs("div",{className:"ppb-floating-preview",style:M,"aria-label":"Floating ask bar preview",children:[s.jsx(ws,{name:W?.name||"AI expert",src:W?.avatar_url,size:"sm",variant:"expert",className:"ppb-floating-avatar"}),s.jsx("input",{type:"text",value:e.floatingAskText??Pb,maxLength:sk,disabled:e.floatingAsk===!1,"aria-label":"Floating ask bar text",placeholder:Pb,onChange:V=>o(L=>xne(L,V.target.value))}),e.floatingAskCall!==!1&&s.jsx("span",{className:"ppb-floating-phone",style:e.callColor?{backgroundColor:e.callColor}:void 0,"aria-hidden":"true",children:s.jsx(Ts,{})}),s.jsx("span",{className:"ppb-floating-send","aria-hidden":"true",children:s.jsx(rl,{})})]}),s.jsxs("div",{className:"ppb-floating-options",children:[s.jsxs("button",{type:"button",className:"ppb-floating-option",role:"switch","aria-checked":e.floatingAsk!==!1,onClick:()=>o(V=>aGe(V,V.floatingAsk===!1)),children:[s.jsxs("span",{className:"ppb-floating-option-label",children:[s.jsx(ea,{"aria-hidden":"true"}),"Show on page"]}),s.jsx("span",{className:"ppb-toggle-track","aria-hidden":"true",children:s.jsx("span",{})})]}),s.jsxs("button",{type:"button",className:"ppb-floating-option",role:"switch","aria-checked":e.floatingAskCall!==!1,onClick:()=>o(V=>iGe(V,V.floatingAskCall===!1)),children:[s.jsxs("span",{className:"ppb-floating-option-label",children:[s.jsx(Ts,{"aria-hidden":"true"}),"Include call"]}),s.jsx("span",{className:"ppb-toggle-track","aria-hidden":"true",children:s.jsx("span",{})})]})]})]})}),s.jsx(MS,{cfg:e,onCfg:o,groups:["expert"]})]}),v==="services"&&s.jsx(Cne,{cfg:e,onCfg:o}),(v==="media"||v==="products")&&s.jsx(Ene,{cfg:e,sectionKey:t,onCfg:o}),v==="contact"&&s.jsx(ent,{cfg:e,onCfg:o}),v==="contact"&&s.jsx(MS,{cfg:e,onCfg:o,groups:["contact"]}),v==="custom"&&s.jsx(Kst,{cfg:e,sectionKey:t,onCfg:o})]})}),s.jsx("section",{className:"ppb-end","aria-label":`${j} actions`,children:s.jsxs("div",{className:"ppb-end-card",children:[s.jsx("button",{type:"button",className:"ppb-end-btn",onClick:async()=>{const V=hGe(t);await y({...V,confirmLabel:"Restore defaults"})&&o(L=>pGe(L,t))},children:"Restore defaults"}),!w.pinned&&s.jsx("button",{type:"button",className:"ppb-end-btn is-danger",onClick:async()=>{await y({title:`Remove ${j}?`,description:"This section and its content will be removed from your public page."})&&m(t)},children:"Remove"}),s.jsxs("div",{className:"ppb-end-save",children:[s.jsx("span",{className:`ppb-state${u==="error"?" is-error":""}`,role:"status","aria-live":"polite",children:u==="saving"?s.jsxs(s.Fragment,{children:[s.jsx(Rf,{className:"ico ico-13","aria-hidden":"true"}),"Saving"]}):u==="error"?s.jsxs(s.Fragment,{children:[s.jsx(xr,{className:"ico ico-13","aria-hidden":"true"}),"Not saved, retrying on your next edit"]}):s.jsxs(s.Fragment,{children:[s.jsx(ft,{className:"ico ico-13","aria-hidden":"true"}),"Saved"]})}),s.jsxs("button",{type:"button",className:`ppb-end-btn is-primary${c==="saving"?" is-saving":c==="saved"?" is-saved":c==="error"?" is-error":""}`,onClick:l,disabled:c==="saving",children:[c==="saving"?s.jsx(vt,{className:"ico spin","aria-hidden":"true"}):c==="saved"?s.jsx(ft,{className:"ico","aria-hidden":"true"}):null,c==="saving"?"Savingâ¦":c==="saved"?"Saved":c==="error"?"Try again":"Save"]})]})]})})]})}function Ant({cfg:e,onSelect:t,onRevert:n,canRevert:r,onSave:a,saveState:i,autoSaveState:o,personalization:l,onPersonalizedAccept:c,profilePath:u,profile:d}){const[h,p]=f.useState(Oj),[m,g]=f.useState(!1),[x,b]=f.useState(!1),y=f.useRef(null);f.useEffect(()=>{y.current?.focus();let k=!1;return G0().then(C=>{k||p(C)}).catch(()=>{k||g(!0)}),()=>{k=!0}},[]);const v=l.state,w=()=>{b(!0),!v.template&&!["queued","running"].includes(v.status)&&l.start().catch(()=>{})},j=()=>
526{b(!1),v.template&&l.decide("discard").catch(()=>{})},E=async()=>{await c(),b(!1)},S=h?.templates||(m?lc:[]),_=S.find(k=>QA(e,k))?.id;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"ppb-edit-body",children:s.jsxs("div",{className:"ppb-templates",children:[s.jsxs("div",{className:"ppb-templates-intro",children:[s.jsxs("div",{className:"ppb-templates-copy",children:[s.jsx("h2",{ref:y,tabIndex:-1,children:"Templates"}),s.jsx("p",{children:"Choose a look for your profile. Your photos, content and sections stay yours."})]}),s.jsxs("button",{type:"button",className:"ppb-template-personalize","aria-haspopup":"dialog","aria-expanded":x,onClick:w,children:[s.jsx(Ms,{className:"ico ico-16","aria-hidden":"true"}),"Personalize On Me"]})]}),!h&&!m&&s.jsxs("p",{role:"status",children:[s.jsx(vt,{className:"ico spin","aria-hidden":"true"})," Loading templatesâ¦"]}),m&&s.jsx("p",{role:"status",children:"Showing the built-in templates. More looks could not be loaded."}),s.jsxs("div",{className:"ppb-template-grid",role:"group","aria-label":"Profile templates",children:[v.template&&s.jsx("button",{type:"button",className:"ppb-template","aria-label":"Personalized",onClick:w,"aria-pressed":QA(e,v.template),children:s.jsxs("span",{className:"ppb-template-preview",children:[s.jsx(wQ,{profilePath:u,config:C0(e,v.template),profile:d}),s.jsx("span",{className:"ppb-personalized-label",children:"Personalized"})]})}),S.map((k,C)=>{const N=k.label||`Look ${C+1}`,A=k.id===_;return s.jsx("button",{type:"button",className:"ppb-template","aria-label":`Apply ${N}`,"aria-pressed":A,onClick:()=>t(k),children:s.jsxs("span",{className:"ppb-template-preview",children:[k.thumbnail?s.jsx("img",{src:k.thumbnail,alt:"",loading:"lazy"}):s.jsx(R_,{"aria-hidden":"true"}),A&&s.jsx("span",{className:"ppb-template-selected","aria-hidden":"true",children:s.jsx(ft,{className:"ico ico-16"})})]})},k.id)})]})]})}),s.jsx("section",{className:"ppb-end","aria-label":"Templates actions",children:s.jsxs("div",{className:"ppb-end-card",children:[s.jsx("button",{type:"button",className:"ppb-end-btn ppb-template-revert",onClick:n,disabled:!r,children:"Revert original"}),s.jsxs("div",{className:"ppb-end-save",children:[s.jsx("span",{className:`ppb-state${o==="error"?" is-error":""}`,role:"status",children:o==="error"?s.jsxs(s.Fragment,{children:[s.jsx(xr,{className:"ico ico-13","aria-hidden":"true"}),"Not saved"]}):o==="saving"?"Savingâ¦":"Saved"}),s.jsx("button",{type:"button",className:"ppb-end-btn is-primary",disabled:i==="saving",onClick:a,children:i==="saving"?"Savingâ¦":i==="error"?"Try again":i==="saved"?"Saved":"Save"})]})]})}),s.jsx(jQ,{isOpen:x,onClose:j,state:v,onStart:l.start,onAccept:E,config:e,profilePath:u,profile:d})]})}const Rnt=700,Int=420,xae="gx_ppb_zoom_desktop",oz=.65,Pnt=88,Lnt=6,lz=(()=>{const e=ar({});return{...e,order:wa(e)}})();function Ont(){try{const e=Number(localStorage.getItem(xae));return e>=.5&&e<=1.25?e:oz}catch{return oz}}function Mnt(e){try{const t=JSON.parse(sessionStorage.getItem(e));return!t||!Array.isArray(t.order)||!t.headerStyle||!t.layouts?null:lf(ar(t))}catch{return null}}const Lv=mQ;function Dnt(e,t,n){if(!t)return e;if(t==="templates")return n("templates"),e;const r=mn(t==="design"||t==="enhance"?"header":t);if(!pl[r])return e;if(e.order.includes(t))return n(t),e;const a=r==="header"?"header":IP(e,r);return n(a),r==="header"?e:bne(e,r)}function $nt({embedded:e=!1,expertAvatar:t="",initialConfig:n=null,onboardingPhoto:r="",onPreviewChange:a=null,onSheetOpenChange:i=null,profileOverride:o=null,profilePathOverride:l="",wizardExpert:c=null,previewMode:u=!1,presentation:d="dashboard"}){const h=d==="dashboard",p=d==="onboarding-overlay",m=d==="onboarding"||p,{user:g}=Ut(),{addToast:x}=f.useContext(Zs),{experts:b,isLoading:y,hasLoaded:v,fetchExperts:w}=jc(),[j,E]=f.useState(!1),[S,_]=gl(),[k]=f.useState(()=>S.get("section")),[C,N]=f.useState(()=>{if(n){const We=ar(n);return{...We,order:wa(We)}}return u?lz:null}),[A,T]=f.useState(null),[I,$]=f.useState(!1),[O,U]=f.useState(null),[F,H]=f.useState(Ont),[G,M]=f.useState(!1),[z,W]=f.useState(!1),[D,Z]=f.useState(!1),[V,L]=f.useState("idle"),K=hI(!u&&!!g?.id),te=f.useRef(!1),[Q,Y]=f.useState(!1),J=`gx_ppb_original:${d}:${u?"preview":g?.id||"anonymous"}`,P=f.useMemo(()=>Mnt(J),[J]),[ee,X]=f.useState(null),ae=ee?.key===J?ee.value:P;
526function me(We){if(!(!C||QA(C,We))){if(!ae){const Dt=lf(C);X({key:J,value:Dt});try{sessionStorage.setItem(J,JSON.stringify(Dt))}catch{}}N(Dt=>C0(Dt,We))}}async function q(){if(K.state.canRevert){try{await $t("revert")}catch{x("Could not restore your design. Please try again.","error")}return}if(ae){N(We=>bQ(We,ae)),X({key:J,value:null});try{sessionStorage.removeItem(J)}catch{}}}const[he,se]=f.useState(!0),[le,ke]=f.useState(()=>u?JSON.stringify(Lv(lz,!0)):null),[oe,Oe]=f.useState({}),Je=f.useCallback((We,Dt)=>{We==null||We===""||Oe(Ds=>({...Ds,[String(We)]:Dt}))},[]),Ie=f.useCallback(We=>{We&&U(We==="design"||We==="enhance"?"header":We)},[]);f.useEffect(()=>{if(u||v||j)return;let We=!1;return w().catch(()=>{We||E(!0)}),()=>{We=!0}},[v,j,w,u]);const ue=f.useMemo(()=>vQ(b,c?.id?[c]:[]),[b,c]);f.useEffect(()=>{!C||!c?.id||N(We=>PP(We,c.id))},[C,c?.id]);const{creator:be}=Yh();f.useEffect(()=>{if(u)return;let We=!1;return $r().then(Dt=>{if(We)return;const Ds=ar(Dt?.config??{}),Ys={...Ds,order:wa(Ds)},Ks=Dt?.enabled??!0;ke(JSON.stringify(Lv(Ys,Ks))),se(Ks),N(Dnt(Ys,k,Ie))}).catch(()=>{We||$(!0)}),()=>{We=!0}},[k,Ie,u]),f.useEffect(()=>{if(u)return;let We=!1;const Dt=Ds=>{Ds.detail?.userId===g?.id&&$r().then(Ys=>{if(We||!Ys?.config)return;const Ks=ar(Ys.config);N(is=>{if(!is)return is;const es=new Set(is.items.map(Xs=>Xs.url)),Fs=Ks.items.filter(Xs=>Xs.syncedFrom&&!es.has(Xs.url));if(!Fs.length)return is;const fn=is.categories?.media||[],Gn=new Set(fn.map(Xs=>Xs.id));return{...is,items:[...is.items.map(Xs=>Fs.some(fs=>fs.featured)&&Xs.type!=="product"?{...Xs,featured:!1}:Xs),...Fs],categories:{...is.categories,media:[...fn,...(Ks.categories?.media||[]).filter(Xs=>!Gn.has(Xs.id))]},order:is.order.includes("media")?is.order:[...is.order,"media"]}})}).catch(()=>{})};return window.addEventListener("profile-media-ready",Dt),()=>{We=!0,window.removeEventListener("profile-media-ready",Dt)}},[u,g?.id]),f.useEffect(()=>{if(!S.get("section"))return;const We=new URLSearchParams(S);We.delete("section"),_(We,{replace:!0})},[S,_]);const Re=f.useRef(!1),Ge=f.useCallback(async(We,Dt=!1)=>{if(te.current&&!Dt||Re.current)return!1;if(Re.current=!0,Z(!0),W(!1),u)return ke(We),Z(!1),Re.current=!1,!0;try{return await Xl({enabled:he,config:JSON.parse(We)}),ke(We),!0}catch(Ds){return W(!0),x(Ds.response?.data?.detail?.message||"Could not save your page. Please try again.","error"),!1}finally{Re.current=!1,Z(!1)}},[x,he,u]),it=f.useMemo(()=>C?JSON.stringify(Lv(C,he)):null,[C,he]),ut=!!it&&le!==null&&it!==le;async function $t(We){if(te.current)throw new Error("A design is already saving");te.current=!0,Y(!0);try{for(;Re.current;)await new Promise(Ys=>setTimeout(Ys,25));if(it&&it!==le&&!await Ge(it,!0))throw new Error("Save failed");const Dt=await K.decide(We,We==="accept"?ae||lf(C):void 0),Ds=ar(Dt.config);if(N(Ds),ke(JSON.stringify(Lv(Ds,he))),He.current=null,We==="revert"){X({key:J,value:null});try{sessionStorage.removeItem(J)}catch{}}}finally{te.current=!1,Y(!1)}}const tt=f.useCallback(async()=>{if(!it||D)return;L("saving");const We=performance.now(),Dt=await Ge(it),Ds=Int-(performance.now()-We);Ds>0&&await new Promise(Ys=>setTimeout(Ys,Ds)),L(Dt?"saved":"error")},[D,it,Ge]);f.useEffect(()=>{if(V!=="saved")return;const We=setTimeout(()=>L("idle"),1800);return()=>clearTimeout(We)},[V]),f.useEffect(()=>{if(!ut||Q)return;const We=setTimeout(()=>Ge(it),Rnt);return()=>clearTimeout(We)},[ut,it,Ge,Q]);const He=f.useRef(null),wt=f.useRef(Ge);f.useEffect(()=>{He.current=ut?it:null,wt.current=Ge},[ut,it,Ge]),f.useEffect(()=>()=>{He.current&&wt.current(He.current)},[]);const[St,Zt]=f.useState(m&&!p),[Jt,$e]=f.useState(p),Qe=f.useRef(null),ct=f.useRef(null),ve=f.useRef(null),Ye=f.useRef(null),rt=f.useRef(0),De=f.useRef(!p),qe=f.useCallback(()=>{$e(!1),Zt(!1),p||i?.(!1)},[i,p]);f.useEffect(()=>{if(!p)return;const We=window.requestAnimationFrame(()=>Zt(!0));return()=>window.cancelAnimationFrame(We)},[p]);const ye=f.useCallback(We=>{p&&!St&&We.target===We.currentTarget&&We.propertyName==="transform"&&i?.(!1)},[i,p,St]);f.useEffect(()=>{if(De.current){De.current=!1;return}(St?ct:ve).current?.focus()},[St]);
526function Ze(){Jt&&!p&&!window.matchMedia("(max-width: 640px)").matches?$e(!1):qe()}function jt(We){Qe.current&&(We.currentTarget.setPointerCapture(We.pointerId),Ye.current=We.clientY,rt.current=0,Qe.current.style.transition="none")}function Nt(We){if(Ye.current===null||!Qe.current)return;rt.current=We.clientY-Ye.current,rt.current<-56&&!window.matchMedia("(max-width: 640px)").matches&&$e(!0);const Dt=Math.max(0,rt.current);Qe.current.style.transform=Dt?`translateY(${Dt}px)`:""}function ne(){if(Ye.current===null)return;const We=rt.current;Ye.current=null,Qe.current&&(Qe.current.style.transition="",Qe.current.style.transform=""),(We>Pnt||Math.abs(We)<Lnt)&&Ze()}function ge(We){We.key!=="Enter"&&We.key!==" "||(We.preventDefault(),Ze())}const xe=f.useCallback(We=>{H(We);try{localStorage.setItem(xae,String(We))}catch{}},[]),pe=f.useCallback(We=>{C&&(N(Dt=>bne(Dt,We)),Ie(IP(C,We)))},[C,Ie]),Ne=f.useCallback(We=>{N(Dt=>({...Dt,order:We}))},[]),Ue=f.useCallback(We=>{(C?.order||[]).includes(We)&&(Ie(We),Zt(!0))},[C,Ie]),dt=f.useMemo(()=>C?J3e(C,"",he):null,[C,he]),Xe=o||(u?{full_name:"Preview Creator",bio:"Helping people turn practical experience into clear next steps.",avatar_url:""}:g),xt=m&&r?r:Xe?.avatar_url||"",et=f.useMemo(()=>({full_name:lI(C,Xe?.full_name),bio:Xe?.bio,avatar_url:xt,expert_avatar_url:t||c?.avatar_url||"",experts:ue,startersByExpert:oe}),[C,Xe?.full_name,Xe?.bio,xt,t,c?.avatar_url,ue,oe]);f.useEffect(()=>{a?.({config:dt,profile:et})},[a,dt,et]);const st=O&&(O==="templates"||C?.order.includes(O))?O:C?.order?.[0]||null,_t=Lst(C),zt=l||(u?"/creators/farouk-lafriqui?profile_source=production&agent_mock=1":g?qd(be):""),us=u?`${window.location.origin}/preview-expert`:g?ll(be):"",ms=u?"preview-expert":g?H_(be):"";return I?s.jsxs("div",{className:"ppb-state-page",role:"alert",children:[s.jsx(xr,{className:"ico ico-20","aria-hidden":"true"}),s.jsx("h1",{children:"We could not load your page"}),s.jsx("p",{children:"Your page itself is fine. Reload to try again."}),s.jsx("button",{type:"button",className:"ppb-btn acc",onClick:()=>window.location.reload(),children:"Reload"})]}):C?s.jsx(CP,{children:s.jsxs("div",{className:`ppb${e?" is-embedded":""}${h?" is-dashboard-editor":""}${m?" is-onboarding-editor":""}${p?" is-onboarding-overlay":""}${St?" is-open":""}${Jt?" is-tall":""}`,children:[s.jsxs("aside",{className:"ppb-edit",id:"ppb-editor",ref:Qe,"aria-label":"Page editor",onTransitionEnd:ye,children:[s.jsx("button",{type:"button",ref:ct,className:"ppb-grab","aria-label":Jt?"Shrink the editor":"Close the editor",onPointerDown:jt,onPointerMove:Nt,onPointerUp:ne,onPointerCancel:ne,onKeyDown:ge,children:s.jsx("span",{className:"ppb-sheet-handle","aria-hidden":"true"})}),s.jsxs("div",{className:"ppb-edit-shell",children:[s.jsx(Ist,{items:_t,selected:st,onChange:Ie,onOrder:Ne,trailing:s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"ppb-cat","aria-pressed":st==="templates","aria-current":st==="templates"?"page":void 0,onClick:()=>Ie("templates"),children:[s.jsx("span",{className:"ppb-cat-ico","aria-hidden":"true",children:s.jsx(R_,{strokeWidth:st==="templates"?2:1.75})}),s.jsx("span",{className:"ppb-cat-label",children:"Templates"})]}),s.jsx(Rst,{order:C.order,onAdd:pe,variant:"rail"})]})}),s.jsx("div",{className:"ppb-edit-main",children:st==="templates"?s.jsx(Ant,{cfg:C,onSelect:me,onRevert:q,canRevert:!!ae||K.state.canRevert,personalization:K,onPersonalizedAccept:()=>$t("accept"),profilePath:zt,profile:et,onSave:tt,saveState:V,autoSaveState:z?"error":D||ut?"saving":"saved"}):st&&s.jsx(Tnt,{cfg:C,sectionKey:st,fallbackPhoto:r,experts:ue,expertsLoading:!u&&y&&!v&&!c?.id,expertsFailed:!u&&j&&!c?.id,onCfg:N,onSave:tt,saveState:V,autoSaveState:z?"error":D||ut?"saving":"saved",previewZoom:F,onRemove:We=>{if(N(Dt=>oGe(Dt,We)),O===We){const Dt=C.order.find(Ds=>Ds!==We);U(Dt||null)}},onStartersChange:Je,hideProfileBackground:m})})]})]}),s.jsx("button",{type:"button",className:"ppb-sheet-dismiss","aria-label":"Close editor",tabIndex:-1,onClick:qe}),p?null:s.jsx("section",{className:"ppb-canvas","aria-label":m?"Live profile preview":"Your public page",children:s.jsx("div",{className:"ppb-canvas-body",children:s.jsxs("div",{className:`ppb-canvas-stage${m?"":" is-docked"}
526`,children:[s.jsx(Vj,{profilePath:zt,config:dt,profile:et,focusKey:st==="templates"?"header":st,device:m?"mobile":"responsive",zoom:m?.66:F,onEdit:Ue}),m?null:s.jsx(Tst,{handle:ms,url:us,zoom:F,onZoom:xe,onShare:()=>M(!0),embedded:e}),m?null:s.jsxs("div",{className:"ppb-device-rail",role:"group","aria-label":"Device previews",children:[s.jsx("button",{type:"button",className:"ppb-device-preview",onClick:()=>T("mobile"),"aria-label":"Preview on phone",title:"Preview on phone",children:s.jsx(rwe,{className:"ico ico-16","aria-hidden":"true"})}),s.jsx("button",{type:"button",className:"ppb-device-preview",onClick:()=>T("laptop"),"aria-label":"Preview on laptop",title:"Preview on laptop",children:s.jsx(Rve,{className:"ico ico-16","aria-hidden":"true"})})]})]})})}),m?null:s.jsx(Ast,{isOpen:!!A,device:A||"mobile",onClose:()=>T(null),profilePath:zt,config:dt,profile:et}),s.jsxs("button",{type:"button",ref:ve,className:"ppb-fab","aria-expanded":St,"aria-controls":"ppb-editor",onClick:()=>Zt(!0),children:[s.jsx(Mu,{className:"ico ico-14","aria-hidden":"true"}),s.jsx("span",{className:"fl",children:"Edit"})]}),!e&&!u&&h&&s.jsx(kQ,{userId:g?.id,personalization:K,config:C,profile:et,profilePath:zt,onAccept:()=>$t("accept")}),!e&&s.jsx(K0,{isOpen:G,onClose:()=>M(!1),subjectName:g?.full_name||"my page",url:us,headline:"Your page is live",subline:"Anyone with this link can chat with your AI, book you and buy your work.",blurb:g?.full_name?`Chat with ${g.full_name}'s AI, see what they offer and book them.`:"Chat with my AI, see what I offer and book me."})]})}):s.jsx(C_,{className:`ppb-state-page ppb-loading-page${e?" is-embedded":""}`,label:"Loading your page"})}async function Fnt(e={}){const{search:t="",sort:n="newest",limit:r=20,offset:a=0}=e,{data:i,error:o}=await Rt.rpc("get_creators_list",{p_search:t,p_sort:n,p_limit:r,p_offset:a});if(o)throw new Error(o.message);const l=i||[],c=l.length>0?Number(l[0].total_count??l.length):0;return{status:"success",data:{creators:l,total:c}}}async function Bnt(e){return(await Se.get(`/creators/${e}`)).data}const Unt=[{value:"newest",label:"Newest"},{value:"name",label:"Name (A-Z)"},{value:"most_experts",label:"Most Experts"}],FS=12;function znt(e,t){if(t<=7)return Array.from({length:t},(r,a)=>a+1);const n=[];n.push(1),e>3&&n.push("...");for(let r=Math.max(2,e-1);r<=Math.min(t-1,e+1);r++)n.push(r);return e<t-2&&n.push("..."),n.push(t),n}function Hnt(){const e=Ps(),{user:t}=Ut(),{creator:n}=Yh(),[r,a]=f.useState([]),[i,o]=f.useState(0),[l,c]=f.useState(!0),[u,d]=f.useState(""),[h,p]=f.useState("most_experts"),[m,g]=f.useState(1);f.useEffect(()=>{g(1)},[u,h]),f.useEffect(()=>{let y=!1;c(!0);const v={sort:h,limit:FS,offset:(m-1)*FS};return u&&(v.search=u),Fnt(v).then(w=>{y||(a(w.data?.creators||[]),o(w.data?.total||0))}).catch(()=>{}).finally(()=>{y||c(!1)}),()=>{y=!0}},[h,u,m]);const x=Math.ceil(i/FS),b=y=>{g(y),window.scrollTo({top:0,behavior:"smooth"})};return s.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-8 space-y-8 min-h-full flex flex-col",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("span",{className:"font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:"COMMUNITY · CREATORS"}),s.jsx("h1",{className:"text-5xl font-bold text-slate-900 dark:text-white mt-2",children:"Creators"}),s.jsx("p",{className:"text-sm text-slate-400 dark:text-neutral-500 mt-2",children:"Discover the people behind the experts"})]}),t&&s.jsxs(Le,{to:Th(n),target:"_blank",rel:"noopener noreferrer",className:"shrink-0 inline-flex items-center gap-2 px-4 py-2.5 rounded-xl text-sm font-medium border border-rule bg-paper text-ink hover:border-indigo-soft hover:bg-indigo-wash hover:text-indigo-deep transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo",children:[s.jsx(Ci,{size:15,"aria-hidden":"true"}),"My profile"]})]}),s.jsxs("div",{className:"max-w-2xl focus-within:max-w-full transition-all duration-300 relative group",children:[s.jsx("div",{className:"absolute inset-y-0 left-5 flex items-center pointer-events-none",children:s.jsx(Fa,{className:"text-slate-400 dark:text-neutral-500 group-focus-within:text-slate-700 dark:group-focus-within:text-white transition-colors",size:20})}),s.jsx("input",{type:"text",value:u,onChange:y=>
526d(y.target.value),placeholder:"Search creators...",className:"w-full pl-14 pr-12 py-3.5 border border-slate-200 dark:border-white/10 bg-slate-50 dark:bg-white/5 rounded-xl focus:outline-none focus:ring-1 focus:ring-slate-300 dark:focus:ring-white/20 focus:bg-white dark:focus:bg-white/10 text-slate-900 dark:text-white placeholder:text-slate-400 dark:placeholder:text-neutral-500 transition-all text-sm"}),s.jsx(Ei,{children:u&&s.jsx(Dn.button,{initial:{opacity:0,scale:1},animate:{opacity:1,scale:1},exit:{opacity:0,scale:1},transition:{duration:.15},onClick:()=>d(""),className:"absolute inset-y-0 right-5 flex items-center text-slate-400 dark:text-neutral-500 hover:text-slate-700 dark:hover:text-white transition-colors",children:s.jsx(as,{size:18})})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-eyebrow text-ink-muted",children:[i," creator",i!==1?"s":"",u&&s.jsxs(s.Fragment,{children:[" matching â",u,"â"]})]}),s.jsx(Wnt,{value:h,onChange:p,options:Unt})]}),s.jsx(Ei,{mode:"wait",children:s.jsxs(Dn.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.15},className:"flex-1 flex flex-col",children:[l?s.jsx("div",{className:"text-center py-16",children:s.jsx("div",{className:"w-6 h-6 border-2 border-slate-300 dark:border-neutral-600 border-t-slate-600 dark:border-t-neutral-300 rounded-full animate-spin mx-auto"})}):r.length===0?s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-16 space-y-2",children:[s.jsx("p",{className:"text-xl font-bold text-primary-600 dark:text-primary-400",children:"No creators found"}),s.jsx("p",{className:"text-sm text-slate-400 dark:text-neutral-500",children:"Try a different search."})]}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-16",children:r.map(y=>s.jsx(qnt,{creator:y,onClick:()=>e(Th(y))},y.id))}),s.jsx("div",{className:"flex-1"}),x>1&&s.jsxs("div",{className:"flex items-center justify-center gap-1 pt-16",children:[s.jsx("button",{onClick:()=>b(m-1),disabled:m===1,className:"w-8 h-8 flex items-center justify-center rounded-xl text-slate-400 dark:text-neutral-500 hover:bg-slate-100 dark:hover:bg-neutral-800 disabled:opacity-30 transition-colors",children:s.jsx(Wh,{size:16})}),znt(m,x).map((y,v)=>y==="..."?s.jsx("span",{className:"w-8 h-8 flex items-center justify-center text-xs text-slate-400 dark:text-neutral-500",children:"..."},`dots-${v}`):s.jsx("button",{onClick:()=>b(y),className:`w-8 h-8 flex items-center justify-center rounded-xl text-xs font-medium transition-colors ${y===m?"bg-primary-600 text-white":"text-slate-500 dark:text-neutral-400 hover:bg-slate-100 dark:hover:bg-neutral-800"}`,children:y},y)),s.jsx("button",{onClick:()=>b(m+1),disabled:m===x,className:"w-8 h-8 flex items-center justify-center rounded-xl text-slate-400 dark:text-neutral-500 hover:bg-slate-100 dark:hover:bg-neutral-800 disabled:opacity-30 transition-colors",children:s.jsx(hn,{size:16})})]})]},"creators")})]})}function qnt({creator:e,onClick:t}){return s.jsxs("button",{onClick:t,className:"flex items-center gap-4 text-left group w-full",children:[s.jsx(ws,{name:e.full_name,size:"2xl",src:e.avatar_url,className:"shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"font-bold text-slate-900 dark:text-white truncate mb-1",children:e.full_name}),e.bio?s.jsx("p",{className:"text-sm text-slate-500 dark:text-neutral-400 line-clamp-2 leading-relaxed",children:e.bio}):s.jsx("p",{className:"text-sm text-slate-400 dark:text-neutral-500 italic",children:"No bio yet"}),s.jsx("p",{className:"text-xs text-slate-400 dark:text-neutral-500 mt-1.5 flex items-center gap-3 group-hover:text-primary-600 dark:group-hover:text-primary-400 transition-colors duration-300",children:e.public_expert_count>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(qh,{size:10})," ",e.public_expert_count," expert",e.public_expert_count!==1?"s":""]})})]})]})}function Wnt({value:e,onChange:t,options:n}){const[r,a]=f.useState(!1),i=f.useRef(null);f.useEffect(()=>{if(!r)return;const l=c=>{i.current&&!i.current.contains(c.target)&&a(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);const o=n.find(l=>l.value===e)?.label||"Sort";return s.jsxs("div",{className:"relative",ref:i,children:[s.jsxs("button",{onClick:()=>a(l=>!l),className:"flex items-center gap-1 text-xs text-ink-mid hover:text-ink transition-colors",children:["Sort by: ",s.jsx("span",{className:"font-medium",children:o})," ",s.jsx(Is,{size:12})]}),r&&s.jsx("div",{className:"absolute right-0 top-full mt-1 bg-white dark:bg-neutral-800 border border-slate-200 dark:border-neutral-700 rounded-xl shadow-xl z-50 min-w-[160px] p-1",children:n.map(l=>s.jsxs("button",{onClick:()=>{t(l.value),a(!1)},className:`w-full flex items-center justify-between px-3 py-2 rounded-xl text-sm transition-colors ${e===l.value?"text-primary-600 dark:text-primary-400 bg-primary-50 dark:bg-primary-900/20 font-medium":"text-slate-600 dar
526k:text-neutral-300 hover:bg-slate-50 dark:hover:bg-neutral-700"}`,children:[l.label,e===l.value&&s.jsx(ft,{size:14})]},l.value))})]})}function bae({expertName:e,widgetKey:t,onClose:n,accent:r}){const{login:a,signup:i}=Ut(),[o,l]=f.useState("signup"),[c,u]=f.useState(""),[d,h]=f.useState(""),[p,m]=f.useState(""),[g,x]=f.useState(!1),[b,y]=f.useState(!1),[v,w]=f.useState(!1),[j,E]=f.useState(""),S=o==="signup",_=d.trim()&&p&&(!S||c.trim()&&g&&b),k=async A=>{if(A.preventDefault(),!(!_||v)){w(!0),E("");try{if(S){await i(c.trim(),d.trim(),p,t?{signup_source:"external",signup_widget_key:t}:{});try{await gc({consentType:"account_creation",tosVersion:Ib,checkboxStates:{terms_privacy:g,age_18:b}})}catch{}}else await a(d.trim(),p)}catch(T){E(T?.response?.data?.detail?.message||T?.message||"Something went wrong. Please try again.")}finally{w(!1)}}},C=r?{backgroundColor:r}:void 0,N="w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-base sm:text-sm text-slate-900 placeholder:text-slate-400 outline-none focus:border-primary-500";return s.jsx("div",{className:"absolute inset-0 z-20 flex items-end sm:items-center justify-center bg-slate-900/40 p-3",children:s.jsxs("div",{className:"w-full max-w-sm rounded-2xl bg-white shadow-2xl p-5 space-y-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-semibold text-slate-900",children:S?"Create a free account to continue":"Welcome back"}),s.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:S?`Save your conversation with ${e||"this expert"} and pick it up any time.`:"Log in to continue your conversation."})]}),s.jsx("button",{type:"button",onClick:n,className:"shrink-0 w-7 h-7 rounded-lg flex items-center justify-center text-slate-400 hover:text-slate-700 hover:bg-slate-100 transition-colors","aria-label":"Close",children:s.jsx(as,{size:15})})]}),s.jsxs("form",{onSubmit:k,className:"space-y-2.5",children:[S&&s.jsx("input",{type:"text",value:c,onChange:A=>u(A.target.value),placeholder:"Your name",autoComplete:"name",maxLength:120,className:N}),s.jsx("input",{type:"email",value:d,onChange:A=>h(A.target.value),placeholder:"Email",autoComplete:"email",className:N}),s.jsx("input",{type:"password",value:p,onChange:A=>m(A.target.value),placeholder:"Password",autoComplete:S?"new-password":"current-password",className:N}),S&&s.jsxs("div",{className:"space-y-1.5 pt-1",children:[s.jsxs("label",{className:"flex items-start gap-2 text-[11px] text-slate-500 leading-snug",children:[s.jsx("input",{type:"checkbox",checked:g,onChange:A=>x(A.target.checked),className:"mt-0.5 shrink-0"}),s.jsxs("span",{children:["I agree to the"," ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Terms"})," ","and"," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Privacy Policy"})]})]}),s.jsxs("label",{className:"flex items-start gap-2 text-[11px] text-slate-500 leading-snug",children:[s.jsx("input",{type:"checkbox",checked:b,onChange:A=>y(A.target.checked),className:"mt-0.5 shrink-0"}),s.jsx("span",{children:"I am 18 years or older"})]})]}),j&&s.jsx("p",{className:"text-xs text-red-500",children:j}),s.jsxs("button",{type:"submit",disabled:!_||v,className:"w-full rounded-xl bg-primary-600 hover:bg-primary-700 disabled:opacity-40 disabled:cursor-not-allowed text-white text-sm font-semibold py-2.5 flex items-center justify-center gap-2 transition-colors",style:C,children:[v&&s.jsx(vt,{size:14,className:"animate-spin"}),S?"Sign up & continue":"Log in & continue"]})]}),s.jsxs("p",{className:"text-center text-xs text-slate-500",children:[S?"Already have an account?":"New here?"," ",s.jsx("button",{type:"button",onClick:()=>{l(S?"login":"signup"),E("")},className:"font-semibold text-primary-600 hover:underline",children:S?"Log in":"Sign up"})]}),s.jsxs("p",{className:"text-center text-[10px] text-slate-400",children:["Secured by"," ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Great Experts"})]})]})})}function Vk(e,t={}){const{ensureAnonymousSession:n,isAuthenticated:r}=Ut(),[a,i]=f.useState(!1),[o,l]=f.useState(null),[c,u]=f.useState(!1),d=Array.isArray(e?.voice_languages)?e.voice_languages:[],h=d.length>0,p=async()=>
526{if(!h)return;if(e?.require_login_to_chat&&!r){t.onLoginRequired?t.onLoginRequired():u(!0);return}if(!t.skipSession)try{await n()}catch{t.onSessionError?.();return}const x=lae(d);if(x){t.onCallStart?.(),l(x.code);return}i(!0)},m=x=>{l(null),x?.reason==="email-verification-required"&&t.onLimitReached?.(),x?.hadTurn&&x?.conversationId&&t.onConversation?.(x.conversationId),t.onCallEnd?.(x)},g=e?s.jsxs(s.Fragment,{children:[s.jsx(cae,{isOpen:a,languages:d,presentation:t.presentation,onClose:()=>i(!1),onSelect:x=>{i(!1),t.onCallStart?.(),l(x.code)}}),o&&s.jsx(oae,{expert:e,conversationId:t.conversationId||null,language:o,presentation:t.presentation,onClose:m},o),c&&!r&&s.jsx("div",{className:"fixed inset-0 z-[80]",children:s.jsx(bae,{expertName:e.name,onClose:()=>u(!1)})})]}):null;return{canCall:h,startCall:p,callUi:g}}const Vnt="data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eLoom%3c/title%3e%3cpath%20d='M24%2010.665h-7.018l6.078-3.509-1.335-2.312-6.078%203.509%203.508-6.077L16.843.94l-3.508%206.077V0h-2.67v7.018L7.156.94%204.844%202.275l3.509%206.077-6.078-3.508L.94%207.156l6.078%203.509H0v2.67h7.017L.94%2016.844l1.335%202.313%206.077-3.508-3.509%206.077%202.312%201.335%203.509-6.078V24h2.67v-7.017l3.508%206.077%202.312-1.335-3.509-6.078%206.078%203.509%201.335-2.313-6.077-3.508h7.017v-2.67H24zm-12%204.966a3.645%203.645%200%201%201%200-7.29%203.645%203.645%200%200%201%200%207.29z'/%3e%3c/svg%3e",Gnt="data:image/svg+xml,%3c!--%20License:%20Apache.%20Made%20by%20grommet:%20https://github.com/grommet/grommet-icons%20--%3e%3csvg%20width='24px'%20height='24px'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill='%231ED760'%20fill-rule='evenodd'%20d='M19.0983701,10.6382791%20C15.230178,8.34118115%208.85003755,8.12986439%205.15729493,9.25058527%20C4.56433588,9.43062856%203.93727638,9.09580812%203.75758647,8.50284907%20C3.57789655,7.90953664%203.91236362,7.28283051%204.50585273,7.10261054%20C8.74455585,5.81598127%2015.7909802,6.06440214%2020.2440037,8.70780512%20C20.7774195,9.02442687%2020.9525156,9.71332656%2020.6362472,10.2456822%20C20.3198021,10.779098%2019.6305491,10.9549008%2019.0983701,10.6382791%20M18.971686,14.0407262%20C18.7004726,14.4810283%2018.1246521,14.6190203%2017.6848801,14.3486903%20C14.4600027,12.3664473%209.54264764,11.792217%205.72728477,12.9503953%20C5.23256328,13.0998719%204.70992535,12.8208843%204.55974204,12.3270462%20C4.41061884,11.8323247%204.68978312,11.3107469%205.18362118,11.1602103%20C9.5419409,9.83771368%2014.9600247,10.4782013%2018.6638986,12.7544503%20C19.1036707,13.0253103%2019.242016,13.6013075%2018.971686,14.0407262%20M17.5034233,17.308185%20C17.2876894,17.6617342%2016.827245,17.7725165%2016.4749326,17.5571359%20C13.6571403,15.8347984%2010.1101639,15.4459119%205.93312425,16.4000177%20C5.53063298,16.4922479%205.12937851,16.2399399%205.03767834,15.8376253%20C4.94544812,15.4351341%205.19669597,15.0338796%205.60024736,14.9420027%20C10.1712973,13.8970803%2014.0923186,14.3467468%2017.2551791,16.2796943%20C17.6078449,16.4948982%2017.7189805,16.9556959%2017.5034233,17.308185%20M12,0%20C5.37267547,0%200,5.37249879%200,11.9998233%20C0,18.6278546%205.37267547,24%2012,24%20C18.6275012,24%2024,18.6278546%2024,11.9998233%20C24,5.37249879%2018.6275012,0%2012,0'/%3e%3c/svg%3e",Ynt="/assets/tiktok-BTG7h444.svg",Knt="data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eVimeo%3c/title%3e%3cpath%20d='M23.9765%206.4168c-.105%202.338-1.739%205.5429-4.894%209.6088-3.2679%204.247-6.0258%206.3699-8.2898%206.3699-1.409%200-2.578-1.294-3.553-3.881l-1.9179-7.1138c-.719-2.584-1.488-3.878-2.312-3.878-.179%200-.806.378-1.8809%201.132l-1.129-1.457a315.06%20315.06%200%20003.501-3.1279c1.579-1.368%202.765-2.085%203.5539-2.159%201.867-.18%203.016%201.1%203.447%203.838.465%202.953.789%204.789.971%205.5069.5389%202.45%201.1309%203.674%201.7759%203.674.502%200%201.256-.796%202.265-2.385%201.004-1.589%201.54-2.797%201.612-3.628.144-1.371-.395-2.061-1.614-2.061-.574%200-1.167.121-1.777.391%201.186-3.8679%203.434-5.7568%206.7619-5.6368%202.4729.06%203.6279%201.664%203.4929%204.7969z'/%3e%3c/svg%3e",Xnt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20License:%20Logo.%20Made%20by%20HashiCorp:%20https://github.com/hashicorp/design-system%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%3e%3cpath%20fill='red'%20d='M14.712%2
52604.633a1.754%201.754%200%2000-1.234-1.234C12.382%203.11%208%203.11%208%203.11s-4.382%200-5.478.289c-.6.161-1.072.634-1.234%201.234C1%205.728%201%208%201%208s0%202.283.288%203.367c.162.6.635%201.073%201.234%201.234C3.618%2012.89%208%2012.89%208%2012.89s4.382%200%205.478-.289a1.754%201.754%200%20001.234-1.234C15%2010.272%2015%208%2015%208s0-2.272-.288-3.367z'/%3e%3cpath%20fill='%23ffffff'%20d='M6.593%2010.11l3.644-2.098-3.644-2.11v4.208z'/%3e%3c/svg%3e",Jnt=/^([^\d]{1,4}?)\s?(\d[\d.,\s/a-z-]*)$/i;function Zf({children:e,className:t="text-[15px]"}){const n=String(e??"");if(/^free$/i.test(n))return s.jsx("span",{className:`shrink-0 font-semibold text-ink whitespace-nowrap ${t}`,children:n});const r=Jnt.exec(n);return s.jsxs("span",{className:`shrink-0 font-semibold text-ink tabular-nums tracking-tight whitespace-nowrap ${t}`,children:[r&&s.jsx("span",{className:"relative -top-[0.32em] text-[0.7em] font-medium text-ink-mid",children:r[1]}),r?r[2]:n]})}function Qnt({creatorId:e,creatorName:t,config:n}){const{user:r}=Ut(),[a,i]=f.useState(()=>r?.email||""),[o,l]=f.useState(()=>r?.contact||""),[c,u]=f.useState(""),[d,h]=f.useState(!1),[p,m]=f.useState({}),[g,x]=f.useState(""),[b,y]=f.useState(!1),[v,w]=f.useState(!1),[j]=f.useState(()=>crypto.randomUUID()),E=a.trim(),S=n.collect?.phone===!0,_=n.collect?.message===!0,k=n.contactFields||[],C=!k.some(T=>QJ(T,p[T.id])),N=d&&C&&ec(E)&&!b;async function A(T){if(T.preventDefault(),!!N){x(""),y(!0);try{await uK(e,{submissionId:j,contactConsent:!0,name:oQ(r?.full_name,E),email:E,phone:S&&o.trim()||null,message:_&&c.trim()||null,isBusiness:!1,answers:ZJ(k,p),source:"profile",consent:"none"}),w(!0)}catch(I){x(I.response?.data?.detail?.message||pa(n,"contactError"))}finally{y(!1)}}}return v?s.jsxs("div",{role:"status",children:[s.jsx("div",{className:"w-10 h-10 rounded-2xl bg-sage-tint text-sage flex items-center justify-center mb-3",children:s.jsx(ft,{className:"w-5 h-5","aria-hidden":"true"})}),s.jsx("h3",{className:"font-heading text-lg font-medium text-ink tracking-tight mb-1.5",children:pa(n,"contactSentTitle")}),s.jsxs("p",{className:"text-sm text-ink-mid leading-relaxed",children:[n.confirm,n.rtime?` ${n.rtime}`:""]}),s.jsxs("p",{className:"text-[13px] text-ink-muted mt-2",children:[pa(n,"contactReplyTo")," ",s.jsx("b",{className:"text-ink-mid font-medium",children:E}),"."]})]}):s.jsx(Wse,{email:a,onEmailChange:i,phone:o,onPhoneChange:l,message:c,onMessageChange:u,showPhone:S,showMessage:_,fields:n.contactFields,divided:n.contactDividers===!0,gap:YJ(n),answers:p,onAnswerChange:(T,I)=>m($=>({...$,[T]:I})),consent:d,onConsentChange:h,creatorName:t,error:g,canSubmit:N,isSending:b,cta:nk(n),onSubmit:A,emailId:"pcf-email"})}function wm({title:e,color:t=null,note:n=null,sub:r=null,subColor:a=null}){return s.jsxs("div",{className:"mb-4",children:[s.jsxs("div",{className:"flex items-end justify-between gap-3",children:[s.jsx("h2",{className:"font-heading font-medium tracking-tight text-xl sm:text-2xl text-ink",style:t?{color:t}:void 0,children:e}),n&&s.jsx("span",{className:"shrink-0 text-xs text-slate-400 pb-0.5",children:n})]}),r&&s.jsx("p",{className:"text-sm text-slate-500 mt-1 max-w-xl",style:a?{color:a}:void 0,children:r})]})}function Jj(e){return String(e.label||"").trim()||"Link"}function Znt({link:e,currency:t}){const n="inline-flex items-center gap-1.5 px-3.5 py-2 rounded-full border text-sm font-medium pf-accent-border pf-accent-wash pf-accent-text",r=S0(e.price,t),a=s.jsxs(s.Fragment,{children:[Jj(e),r&&s.jsx(Zf,{className:"text-xs",children:r})]});return e.url?s.jsx("a",{href:e.url,"data-element-ref":e.ref||e.id,"data-element-title":Jj(e),target:"_blank",rel:"noopener noreferrer",className:`${n} pf-accent-focus hover:opacity-80 transition-opacity focus-visible:outline-none`,children:a}):s.jsx("span",{className:n,children:a})}function ert({link:e,currency:t}){const n="flex items-center gap-3 w-full px-4 py-4 rounded-2xl border text-[15px] font-medium pf-component-card text-ink pf-accent-hover-border",r=S0(e.price,t),a=s.jsx("span",{className:"min-w-0 flex-1 truncate",children:Jj(e)}),i=s.jsxs(s.Fragment,{children:[a,r&&s.jsx(Zf,{className:"text-sm",children:r}),s.jsx(xn,{size:16,"aria-hidden":"true",className:"shrink-0 text-slate-400 transition-transform group-hover:translate-x-0.5"})]});return e.url?s.jsx("a",{href:e.url,"data-element-ref":e.ref||e.id,"data-element-title":Jj(e),target:"_blank",rel:"noopener noreferrer",className:`pf-accent-focus group ${n} hover:shadow-md transition-all focus-visible:outline-none`,children:i}):s.jsx("span",{className:`${n} group`,children:i})}function trt({id:e,heading:t="",headingColor:n=null,text:r="",links:a=[],layout:i=0,
526currency:o}){return!t&&!r&&!a.length?null:s.jsxs("section",{id:e,className:"mb-16 scroll-mt-24","aria-label":t||"More from this creator",children:[t&&s.jsx(wm,{title:t,color:n}),r&&s.jsx("p",{className:"text-[15px] text-ink-mid leading-relaxed whitespace-pre-line max-w-2xl",children:r}),a.length>0&&s.jsx("div",{className:`${i===1?"space-y-3":"flex flex-wrap gap-2"} ${r?"mt-4":""}`,children:a.map((l,c)=>i===1?s.jsx(ert,{link:l,currency:o},c):s.jsx(Znt,{link:l,currency:o},c))})]})}function t0({scrollRef:e,label:t="items"}){const[n,r]=f.useState(!1),[a,i]=f.useState(!1);f.useEffect(()=>{const l=e.current;if(!l)return;const c=()=>{const d=l.scrollWidth-l.clientWidth;r(l.scrollLeft>4),i(l.scrollLeft<d-4)};c(),l.addEventListener("scroll",c,{passive:!0});const u=new ResizeObserver(c);return u.observe(l),()=>{l.removeEventListener("scroll",c),u.disconnect()}},[e]);const o=l=>{const c=e.current;c&&c.scrollBy({left:l*c.clientWidth,behavior:"smooth"})};return!n&&!a?null:s.jsxs("div",{"data-preview-safe":!0,className:"flex items-center justify-end gap-1.5 mt-3",children:[s.jsx(cz,{onClick:()=>o(-1),disabled:!n,label:`Previous ${t}`,children:s.jsx(Wh,{size:17,"aria-hidden":"true"})}),s.jsx(cz,{onClick:()=>o(1),disabled:!a,label:`More ${t}`,children:s.jsx(hn,{size:17,"aria-hidden":"true"})})]})}function cz({children:e,onClick:t,disabled:n,label:r}){return s.jsx("button",{type:"button",onClick:t,disabled:n,"aria-label":r,className:"pf-component-card pf-accent-focus w-9 h-9 inline-flex items-center justify-center rounded-full border text-ink-mid transition-colors hover:text-ink pf-accent-hover-border disabled:opacity-35 disabled:hover:text-ink-mid focus-visible:outline-none",children:e})}const srt="https://open.spotify.com/embed/iframe-api/v1",uz="onSpotifyIframeApiReady";let Ug=null;function nrt({timeoutMs:e=5e3}={}){return typeof window>"u"||typeof document>"u"?Promise.reject(new Error("The Spotify player needs a browser.")):window.__spotifyIframeApi?Promise.resolve(window.__spotifyIframeApi):Ug||(Ug=new Promise((t,n)=>{const r=l=>{Ug=null,n(new Error(l))},a=setTimeout(()=>r("The Spotify player did not load in time."),e),i=window[uz];window[uz]=l=>{clearTimeout(a),window.__spotifyIframeApi=l,typeof i=="function"&&i(l),t(l)};const o=document.createElement("script");o.src=srt,o.async=!0,o.onerror=()=>{clearTimeout(a),o.remove(),r("The Spotify player script failed to load.")},document.head.appendChild(o)}),Ug)}const rrt={activeKey:null,play:()=>{},stop:()=>{},openPopup:()=>{},closePopup:()=>{}},yae=f.createContext(rrt);function art(){return f.useContext(yae)}const vae="accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture; web-share";function irt({children:e}){const[t,n]=f.useState(null),[r,a]=f.useState(null),[i,o]=f.useState(!1),l=f.useMemo(()=>({activeKey:t,play:c=>{o(!1),n(c)},stop:c=>n(u=>c===void 0||u===c?null:u),openPopup:(c,u)=>{n(null),a({item:c,embed:u}),o(!0)},closePopup:()=>o(!1)}),[t]);return s.jsxs(yae.Provider,{value:l,children:[e,s.jsx(drt,{popup:r,open:i,onClose:l.closePopup})]})}function tL({src:e,title:t,className:n="",style:r}){return s.jsx("iframe",{src:e,title:t,className:n,style:r,allow:vae,allowFullScreen:!0,referrerPolicy:"strict-origin-when-cross-origin"})}function ort({embed:e,title:t}){const n=f.useRef(null),[r,a]=f.useState(!1);return f.useEffect(()=>{const i=n.current;if(!i)return;let o=!1,l=null;const c=document.createElement("div");return i.appendChild(c),nrt().then(u=>{o||u.createController(c,{uri:e.uri,width:"100%",height:e.height},d=>{if(o){d.destroy?.();return}l=d,d.addListener?.("ready",()=>d.play?.())})}).catch(()=>{o||a(!0)}),()=>{o=!0;try{l?.destroy?.()}catch{}c.remove()}},[e.uri,e.height]),r?s.jsx(tL,{src:e.src,title:t,className:"block w-full border-0",style:{height:e.height}}):s.jsx("div",{ref:n,className:"pf-media-player-spotify w-full [&>iframe]:block [&>iframe]:w-full [&>iframe]:border-0",style:{height:e.height},"aria-label":t,role:"region"})}function wae({embed:e,title:t,compact:n=!1,portrait:r=!1}){if(e.provider==="spotify"){const a=n?Math.min(e.height,hne):e.height;return s.jsx("div",{className:"pf-component-media w-full overflow-hidden",children:s.jsx(ort,{embed:{...e,height:a},title:t})})}return s.jsx("div",{className:`relative w-full overflow-hidden bg-black ${r?"aspect-[9/16]":"aspect-video"}`,children:s.jsx(tL,{src:e.src,title:t,className:"absolute inset-0 h-full w-full border-0"})})}const lrt="https://www.instagram.com",crt=640;function urt({src:e,title:t}){const n=f.useRef(null),[r,a]=f.useState(crt);return f.useEffect(()=>{const i=o=>
526{if(o.origin!==lrt||o.source!==n.current?.contentWindow)return;let l=o.data;if(typeof l=="string")try{l=JSON.parse(l)}catch{return}const c=Number(l?.details?.height);l?.type==="MEASURE"&&c>200&&c<4e3&&a(Math.round(c))};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[]),s.jsx("div",{className:"max-h-[82vh] overflow-y-auto bg-white",children:s.jsx("iframe",{ref:n,src:e,title:t,className:"block w-full border-0",style:{height:r},allow:vae,allowFullScreen:!0,referrerPolicy:"strict-origin-when-cross-origin",scrolling:"no"})})}function drt({popup:e,open:t,onClose:n}){const r=e?.embed,a=e?.item,i=r?.provider==="tiktok"||r?.provider==="instagram",o=r?.provider==="instagram"?"max-w-[420px]":i?"max-w-[380px]":r?.provider==="spotify"?"max-w-md":"max-w-2xl";return s.jsx(en,{isOpen:t&&!!e,onClose:n,title:a?.title||"Player",hideTitle:!0,maxWidth:o,className:"overflow-hidden",children:e&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-2.5",children:[s.jsx("p",{className:"min-w-0 truncate text-sm font-semibold text-ink",children:a.title}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[a.url&&s.jsx("a",{href:a.url,target:"_blank",rel:"noopener noreferrer","aria-label":"Open in a new tab",title:"Open in a new tab",className:"rounded-full p-2 text-ink-mid transition-colors hover:bg-cream-deep hover:text-ink",children:s.jsx(Ro,{size:16,"aria-hidden":"true"})}),s.jsx("button",{type:"button",onClick:n,"aria-label":"Close player",className:"rounded-full p-2 text-ink-mid transition-colors hover:bg-cream-deep hover:text-ink",children:s.jsx(as,{size:18,"aria-hidden":"true"})})]})]}),r.provider==="instagram"?s.jsx(urt,{src:r.src,title:a.title}):i?s.jsx(tL,{src:r.src,title:a.title,className:"block w-full border-0 bg-black",style:{height:"min(78vh, 740px)"}}):s.jsx(wae,{embed:r,title:a.title})]})})}const hrt={course:uve,ebook:Ou},prt={youtube:"YouTube",spotify:"Spotify",tiktok:"TikTok",vimeo:"Vimeo",loom:"Loom",instagram:"Instagram",facebook:"Facebook",linkedin:"LinkedIn",x:"X"},mrt={youtube:Xnt,spotify:Gnt,tiktok:Ynt,vimeo:Knt,loom:Vnt,instagram:"/connector-icons/instagram.png",facebook:"/connector-icons/facebook.png",linkedin:"/connector-icons/linkedin.png",x:"/connector-icons/x.webp"},jae=5;function BS({items:e,label:t,className:n="space-y-3",pageSize:r=jae,children:a}){const[i,o]=f.useState(0),l=f.useRef(null),c=f.useRef(null),u=f.useRef(null),d=f.useRef(!1),h=Math.max(1,Math.ceil(e.length/r)),p=Math.min(i,h-1),m=p*r;return f.useEffect(()=>{if(!d.current){d.current=!0;return}l.current?.scrollIntoView({block:"start"})},[p]),f.useLayoutEffect(()=>{const g=c.current,x=u.current,b=g?.querySelector('[data-page-active="true"]');!g||!x||!b||(x.style.setProperty("--pf-page-x",`${b.offsetLeft}px`),x.style.setProperty("--pf-page-width",`${b.offsetWidth}px`),x.dataset.ready="true")},[p,h]),s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:l,className:`${n} scroll-mt-24`,children:e.slice(m,m+r).map(a)}),h>1&&s.jsx("nav",{"data-preview-safe":!0,"aria-label":`${t} pages`,className:"flex justify-center mt-4",children:s.jsxs("div",{ref:c,className:"pf-pagination",children:[s.jsx("span",{ref:u,className:"pf-pagination-slider","aria-hidden":"true"}),s.jsx(US,{onClick:()=>o(p-1),disabled:p===0,label:"Previous page",children:s.jsx(Wh,{size:16,"aria-hidden":"true"})}),Array.from({length:h},(g,x)=>s.jsx(US,{onClick:()=>o(x),active:x===p,label:`Page ${x+1} of ${h}`,children:x+1},x)),s.jsx(US,{onClick:()=>o(p+1),disabled:p===h-1,label:"Next page",children:s.jsx(hn,{size:16,"aria-hidden":"true"})})]})})]})}function US({children:e,onClick:t,active:n=!1,disabled:r=!1,label:a}){return s.jsx("button",{type:"button",onClick:t,disabled:r,"aria-label":a,"aria-current":n?"true":void 0,"data-page-active":n?"true":void 0,className:`pf-pagination-btn ${n?"is-active":""}`,children:e})}const Qx="__more__",$1=(e,t)=>t.filter(n=>!e.some(r=>r.id===n.categoryId));function dz({category:e=null,items:t=[],photos:n=null}){const r=n??t.filter(a=>a.categoryId===e?.id&&a.img).map(a=>a.img).filter((a,i,o)=>o.indexOf(a)===i).slice(0,4);return e?.img?s.jsx("img",{src:e.img,alt:"",className:"pf-category-art-img",loading:"lazy"}):r.length?s.jsx("span",{className:`pf-category-art-mosaic has-${r.length}`,"aria-hidden":"true",children:r.map(a=>s.jsx("img",{src:np(a,t.find(i=>i.img===a)?.url),onError:rp,onLoad:i=>{i.currentTarget.style.visibility=""},referrerPolicy:"no-referrer",alt:"",loading:"lazy"},a))}):s.jsx("span",{className:"pf-category-art-empty","aria-hidden":"true",children:s.jsx(cY,{size:22,strokeWidth:1.6})})}function zS({categories:e,items:t,value:n,onChange:r,label:a,color:i}){const o=sp();if(!e.length)return null;const l=$1(e,t),c=l.filter(d=>d.img).map(d=>d.img).filter((d,h,p)=>p.indexOf(d)===h).slice(0,4),u=(d,h,p,m,g,x)=>s.jsxs("button",{type:"button",className:`pf-category-card${h?" is-active":""}`,"aria-pressed":h,onClick:p,style:i?{color:i}:void 0,children:[s.jsx("span",{className:"pf-category-art",children:m}),s.jsx("span",{className:"pf-category-name",children:g}),s.jsx("span",{className:"pf-category-count",children:x})]},d);return s.jsxs("nav",{className:"pf-category-nav no-scrollbar","aria-label":`${a} categories`,children:[e.map(d=>u(d.id,n===d.id,()=>r(d.id),s.jsx(dz,{category:d,items:t}),d.name,t.filter(h=>h.categoryId===d.id).length)),l.length>0&&u(Qx,n===Qx,()=>r(Qx),s.jsx(dz,{photos:c,items:t}),o("categoryOther"),l.length)]})}function op({href:e,onClick:t,shell:n,element:r,children:a}){const i=" pf-accent-hover-border pf-accent-focus hover:shadow-md focus-visible:outline-none",o=(e||t)&&(r?.ref||r?.id)?{"data-element-ref":r.ref||r.id,"data-element-title":r.title||r.name||""}:{};return e?s.jsx("a",{...o,href:e,target:"_blank",rel:"noopener noreferrer",className:n+i,children:a}):t?s.jsx("button",{...o,type:"button",onClick:t,className:n+i,children:a}):s.jsx("div",{className:n,children:a})}const frt="pf-component-card group flex items-start gap-4 w-full text-left rounded-2xl border p-4 sm:p-5 transition-all",grt="pf-component-card group flex flex-col w-full text-left rounded-2xl border overflow-hidden transition-all";function _ae({service:e,price:t,sells:n,canContact:r,onAsk:a}){return s.jsxs(op,{href:n?e.url:null,onClick:!n&&r?a:null,element:e,shell:"pf-component-card group flex h-full w-full flex-col text-left overflow-hidden rounded-2xl border transition-all",children:[e.img&&s.jsx("span",{className:"block w-full aspect-[16/10] overflow-hidden pf-component-media",children:s.jsx("img",{src:e.img,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),s.jsxs("span",{className:"flex flex-1 flex-col p-4 sm:p-5",children:[s.jsx("span",{className:"line-clamp-2 text-[15px] font-semibold text-slate-900",children:e.name}),e.desc&&s.jsx("span",{className:"line-clamp-1 flex-1 text-sm text-slate-500 mt-1",children:e.desc}),s.jsxs("span",{className:"flex items-center justify-between gap-3 mt-4",children:[t?s.jsx(Zf,{children:t}):s.jsx("span",{}),(n||r)&&s.jsx(lp,{label:KR(e)})]})]})]})}function kae({service:e,price:t,sells:n,canContact:r,onAsk:a,hero:i=!1}){return s.jsxs(op,{href:n?e.url:null,onClick:!n&&r?a:null,element:e,shell:grt,children:[e.img&&s.jsx("span",{className:`block w-full overflow-hidden bg-cream-deep ${i?"aspect-[16/9]":"aspect-[16/10]"}`,children:s.jsx("img",{src:e.img,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),s.jsxs("span",{className:"flex flex-1 flex-col p-4 sm:p-5",children:[s.jsx("span",{className:`line-clamp-2 font-semibold text-slate-900 ${i?"text-[16px] sm:text-[17px]":"text-[15px]"}`,children:e.name}),e.desc&&s.jsx("span",{className:`${i?"line-clamp-2":"line-clamp-1"} flex-1 text-sm text-slate-500 mt-1`,children:e.desc}),s.jsxs("span",{className:"flex items-center justify-between gap-3 mt-4",children:[t?s.jsx(Zf,{children:t}):s.jsx("span",{}),(n||r)&&s.jsx(lp,{label:KR(e)})]})]})]})}const xrt="pf-component-card group flex items-center gap-3 w-full text-left rounded-2xl border p-3 transition-all",Nae="[&>*:last-child:nth-child(odd)]:col-span-2",Eae="sm:[&>*:last-child:nth-child(odd)]:col-span-2";function Gk({item:e,className:t,glyph:n}){const r=hrt[e.kind]||jb;return s.jsx("span",{className:`pf-component-media shrink-0 overflow-hidden flex items-center justify-center border border-rule ${t}`,children:e.img?s.jsx("img",{src:e.img,alt:"",className:"w-full h-full object-cover",loading:"lazy"}):s.jsx(r,{size:n,strokeWidth:1.5,className:"text-ink-light","aria-hidden":"true"})})}function brt({item:e,price:t}){return s.jsxs(op,{href:e.url||null,shell:xrt,element:e,children:[s.jsx(Gk,{item:e,className:"w-[52px] h-[52px] rounded-xl",glyph:22}),s.jsx("span",{className:"min-w-0 flex-1",children:s.jsx("span",{className:"block whitespace-pre-line [overflow-wrap:anywhere] text-[14px] font-semibold leading-snug text-ink",children:e.title})}),s.jsxs("span",{className:"flex max-w-[45%] min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-1",children:[t&&s.jsx(Zf,{children:t}),e.url&&s.jsx(lp,{item:e})]})]})}const Sae="flex-1 whitespace-pre-line [overflow-wrap:anywhere] min-h-[2.75em] text-[13px] sm:text-[14px] font-semibold leading-snug",sL="pf-product-bar flex flex-1 w-full flex-col gap-0.5 px-3.5 py-3.5 min-h-[4rem]";function lp({item:e,label:t,accent:n=!0}){return s.jsx("span",{className:`${n?"pf-accent-text":""} min-w-0 max-w-full whitespace-normal break-words text-xs font-medium`,children:t||y3e(e)})}function Cae({item:e,price:t}){return s.jsxs(op,{href:e.url||null,element:e,shell:"group flex h-full w-full flex-col text-left overflow-hidden rounded-2xl bg-white shadow-[0_1px_3px_rgba(15,23,42,0.08),0_4px_16px_rgba(15,23,42,0.06)] transition-all hover:shadow-[0_4px_20px_rgba(15,23,42,0.12)] hover:-translate-y-0.5",children:[s.jsx(Gk,{item:e,className:"w-full aspect-[4/5] shrink-0 border-0 rounded-none bg-white",glyph:36}),s.jsxs("span",{className:sL,children:[s.jsx("span",{className:Sae,children:e.title}),s.jsx("span",{className:"pf-product-bar-muted block truncate text-[12.5px] sm:text-[13px] font-medium tabular-nums",children:t||"Â "}),e.url&&s.jsx(lp,{item:e,accent:!1})]})]})}function Tae({item:e,price:t}){return s.jsxs(op,{href:e.url||null,element:e,shell:"group snap-start flex h-full w-full flex-col text-left overflow-hidden rounded-2xl bg-white shadow-[0_1px_3px_rgba(15,23,42,0.08)] transition-all hover:shadow-md",children:[s.jsx(Gk,{item:e,className:"w-full aspect-square shrink-0 border-0 rounded-none bg-white",glyph:30}),s.jsxs("span",{className:sL,children:[s.jsx("span",{className:Sae,children:e.title}),s.jsx("span",{className:"pf-product-bar-muted block truncate text-[12px] font-medium tabular-nums",children:t||"Â "}),e.url&&s.jsx(lp,{item:e,accent:!1})]})]})}function Aae({item:e,price:t}){return s.jsxs(op,{href:e.url||null,element:e,shell:"group flex w-full flex-col text-left overflow-hidden rounded-2xl bg-white shadow-[0_1px_3px_rgba(15,23,42,0.08),0_4px_16px_rgba(15,23,42,0.06)] transition-all hover:shadow-[0_4px_20px_rgba(15,23,42,0.12)] hover:-translate-y-0.5",children:[s.jsx(Gk,{item:e,className:"w-full aspect-[16/9] shrink-0 border-0 rounded-none bg-white",glyph:44}),s.jsxs("span",{className:sL,children:[s.jsx("span",{className:"whitespace-pre-line [overflow-wrap:anywhere] text-[15px] sm:text-[16
526px] font-semibold leading-snug",children:e.title}),s.jsx("span",{className:"pf-product-bar-muted block truncate text-[13px] font-medium tabular-nums",children:t||" "}),e.url&&s.jsx(lp,{item:e,accent:!1})]})]})}const eg="grid grid-flow-col gap-3 sm:gap-4 overflow-x-auto overflow-y-hidden snap-x snap-mandatory pb-2 -mx-1 px-1 no-scrollbar scroll-smooth",yrt=`${eg} auto-cols-[44%] sm:auto-cols-[calc((100%-2rem)/3.2)]`,vrt=`${eg} auto-cols-[74%] sm:auto-cols-[calc((100%-1rem)/2.2)]`,Rae=`${eg} auto-cols-[64%] sm:auto-cols-[calc((100%-2rem)/2.4)]`;function Iae({items:e,gridClass:t,renderHero:n,renderItem:r}){const[a,...i]=e;return a?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:i.length?"mb-3 sm:mb-4":void 0,children:n(a)}),i.length>0&&s.jsx("div",{className:t,children:i.map(r)})]}):null}function wrt({name:e,items:t,color:n,railClass:r,renderItem:a,renderExpanded:i,renderRail:o=null}){const l=sp(),[c,u]=f.useState(!1);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-baseline justify-between gap-3 mb-3",children:[s.jsxs("h3",{className:"min-w-0 [overflow-wrap:anywhere] text-[15px] font-semibold text-ink",style:n?{color:n}:void 0,children:[e,s.jsx("span",{className:"ml-1.5 text-sm font-normal text-ink-muted",style:n?{color:n,opacity:.7}:void 0,children:t.length})]}),t.length>2&&s.jsxs("button",{type:"button","data-preview-safe":!0,"aria-expanded":c,onClick:()=>u(d=>!d),className:"pf-accent-text pf-accent-focus inline-flex shrink-0 items-center gap-0.5 text-sm font-medium hover:opacity-80 transition-opacity focus-visible:outline-none",style:n?{color:n}:void 0,children:[l(c?"showLess":"seeAll"),s.jsx(hn,{size:14,"aria-hidden":"true",className:`transition-transform ${c?"rotate-90":""}`})]})]}),c?i(t):o?o(t):s.jsx("div",{className:r,children:t.map(a)})]})}function nL({categories:e,items:t,color:n,railClass:r,renderItem:a,renderExpanded:i,renderRail:o=null}){const l=sp(),c=e.map(d=>({id:d.id,name:d.name,items:t.filter(h=>h.categoryId===d.id)})).filter(d=>d.items.length>0);if(!c.length)return o?o(t):s.jsx("div",{className:r,children:t.map(a)});const u=t.filter(d=>!e.some(h=>h.id===d.categoryId));return u.length&&c.push({id:"loose",name:l("categoryOther"),items:u}),s.jsx("div",{className:"space-y-8",children:c.map(d=>s.jsx(wrt,{name:d.name,items:d.items,color:n,railClass:r,renderItem:a,renderExpanded:i,renderRail:o},d.id))})}function jrt({categories:e,products:t,starred:n,priceLabel:r,color:a}){const i=o=>{const l=n&&o.includes(n)?n:null,c=l?[l,...o.filter(u=>u!==l)]:o;return s.jsx(Iae,{items:c,gridClass:`grid grid-cols-2 gap-3 sm:gap-4 items-stretch ${Nae}`,renderHero:u=>s.jsx(Aae,{item:u,price:r(u.price)}),renderItem:(u,d)=>s.jsx(Cae,{item:u,price:r(u.price)},d)})};return s.jsx(nL,{categories:e,color:a,items:t,railClass:yrt,renderItem:(o,l)=>s.jsx(Tae,{item:o,price:r(o.price)},l),renderExpanded:i})}function _rt({categories:e,services:t,priceLabel:n,canContact:r,askAbout:a,color:i}){const o=(c,u,d=!1)=>{const h=n(c.price),p=c.action==="buy"&&c.url;return s.jsx(kae,{service:c,price:h,sells:p,canContact:r,onAsk:()=>a(c.name),hero:d},u)},l=c=>s.jsx(Iae,{items:c,gridClass:`grid sm:grid-cols-2 gap-3 ${Eae}`,renderHero:u=>o(u,"hero",!0),renderItem:(u,d)=>o(u,d)});return s.jsx(nL,{categories:e,color:i,items:t,railClass:vrt,renderItem:(c,u)=>{const d=n(c.price),h=c.action==="buy"&&c.url;return s.jsx(_ae,{service:c,price:d,sells:h,canContact:r,onAsk:()=>a(c.name)},u)},renderExpanded:l})}function krt({categories:e,media:t,starred:n,color:r}){const a=i=>{const o=n&&i.includes(n)?n:null,[l,...c]=o?[o,...i.filter(u=>u!==o)]:i;return l?s.jsx(w5,{featured:l,items:c,variant:"grid"}):null};return s.jsx(nL,{categories:e,color:r,items:t,railClass:Rae,renderItem:(i,o)=>s.jsx(Qj,{item:i},o),renderRail:i=>{const o=n&&i.includes(n)?n:null,l=o?i.filter(c=>c!==o):i;return s.jsx(w5,{featured:o,items:l,variant:"rail"})},renderExpanded:a})}function Pae({item:e,compact:t=!1,overlay:n=!1,tiny:r=!1}){const a=prt[e.provider],i=mrt[e.provider],o=n?"text-white/85":"text-slate-400",l=r?"text-[11px]":"text-xs";if(!a||!i)return e.meta?s.jsx("span",{className:`line-clamp-1 ${l} ${o}`,children:e.meta}):null;const c=e.duration?`${a} · ${e.duration}`:a;return s.jsxs("span",{className:`flex items-center gap-1.5 truncate ${l} ${o} ${t?"mt-0.5":"mt-1"}`,children:[s.jsx("img",{className:r?"h-3 w-3 shrink-0":t?"h-3.5 w-3.5 shrink-0":"h-4 w-4 shrink-0",src:i,alt:"","aria-hidden":"true"}),s.jsx("span",{className:"truncate",children:c})]})}function rL(e,{inline:t=!0}={}){const{activeKey:n,play:r,openPopup:a}=art(),i=AP(e);if(!i)return null;const o=VVe(e),l=t&&i.mode==="inline";return{embed:i,playing:l&&n===o,start:()=>l?r(o):a(e,i)}}function Lae({item:e,hero:t=!1,portrait:n=!1,plays:r=e.type==="video"||e.type==="podcast"}){const a=n&&!t;return s.jsxs(s.Fragment,{children:[s.jsx(_Y,{className:t?"w-10 h-10 text-slate-300":"w-7 h-7 text-slate-300","aria-hidden":"true"}),e.img&&s.jsx("img",{src:np(e.img,e.url),onError:rp,onLoad:i=>{i.currentTarget.style.visibility=""},referrerPolicy:"no-referrer",alt:"",className:"absolute inset-0 w-full h-full object-cover",loading:"lazy"}),r&&s.jsx("span",{className:`absolute flex items-center justify-center rounded-full bg-black/55 text-white transition-colors group-hover:bg-black/70 ${t?"w-14 h-14":a?"w-9 h-9":"w-11 h-11"}`,children:s.jsx(Tr,{size:t?22:a?14:18,className:"fill-current ml-0.5","aria-hidden":"true"})}),s.jsxs("span",{className:`absolute inset-x-0 bottom-0 flex flex-col justify-end bg-gradient-to-t from-black/85 via-black/50 to-transparent text-white ${t?"gap-1 px-5 pb-4 pt-20":a?"gap-0.5 px-2.5 pb-2.5 pt-12":"gap-0.5 px-3.5 pb-3 pt-14"}`,children:[s.jsx("span",{className:`line-clamp-2 font-semibold leading-snug text-white [text-shadow:0_1px_3px_rgba(0,0,0,0.6)] ${t?"text-lg":a?"text-xs":"text-sm"}`,children:e.title}),s.jsx(Pae,{item:e,overlay:!0,compact:!t,tiny:a})]})]})}const Oae="pf-component-media pf-accent-focus group relative flex w-full items-center justify-center overflow-hidden rounded-2xl text-left shadow-[0_1px_3px_rgba(15,23,42,0.08)] transition-all focus-visible:outline-none",Mae="pf-component-media pf-accent-focus group relative flex w-full items-center justify-center overflow-hidden rounded-2xl text-left shadow-[0_1px_3px_rgba(15,23,42,0.08),0_4px_16px_rgba(15,23,42,0.06)] transition-all focus-visible:outline-none",Dae=" hover:shadow-[0_4px_20px_rgba(15,23,42,0.12)] hover:-translate-y-0.5",$ae
526=e=>e?" aspect-[9/16]":" aspect-video",Nrt="group relative flex w-full flex-col justify-center overflow-hidden rounded-2xl shadow-[0_1px_3px_rgba(15,23,42,0.08)]";function Fae({item:e,playable:t,hero:n=!1,portrait:r=!1,extra:a=""}){if(t.playing){const i=t.embed.provider==="spotify"?" pf-component-media":" bg-black";return s.jsx("div",{className:`${Nrt}${i}${a}`,children:s.jsx(wae,{embed:t.embed,title:e.title,compact:!n,portrait:r})})}return s.jsx("button",{type:"button",onClick:t.start,"aria-label":`Play ${e.title}`,"data-element-ref":e.ref||e.id,"data-element-title":e.title,className:`${n?Mae:Oae}${$ae(r)}${Dae}${a}`,children:s.jsx(Lae,{item:e,hero:n,portrait:r,plays:!0})})}function Bae({item:e,hero:t=!1,portrait:n=!1,extra:r=""}){return s.jsx("a",{href:e.url||void 0,"data-element-ref":e.url?e.ref||e.id:void 0,"data-element-title":e.url?e.title:void 0,target:"_blank",rel:"noopener noreferrer",className:`${t?Mae:Oae}${$ae(n)}${Dae}${r}`,children:s.jsx(Lae,{item:e,hero:t,portrait:n})})}function Qj({item:e}){const t=rL(e),n=ff(e);return t?s.jsx(Fae,{item:e,playable:t,portrait:n,extra:" snap-start"}):s.jsx(Bae,{item:e,portrait:n,extra:" snap-start"})}function v5({item:e,fill:t=!1}){const n=rL(e),r=ff(e),a=n?s.jsx(Fae,{item:e,playable:n,hero:!0,portrait:r}):s.jsx(Bae,{item:e,hero:!0,portrait:r});return r&&!t?s.jsx("div",{className:"mx-auto w-[64%] max-w-[340px] sm:w-[48%]",children:a}):a}function Ert({children:e}){const t=f.useRef(null);return f.useLayoutEffect(()=>{const n=t.current,r=()=>{const i=n.scrollWidth>n.clientWidth+1,o=i?n.scrollLeft:n.scrollTop,l=i?n.scrollWidth-n.clientWidth-o:n.scrollHeight-n.clientHeight-o;n.style.setProperty("--fade-direction",i?"to right":"to bottom"),n.style.setProperty("--fade-start",o>1?"24px":"0px"),n.style.setProperty("--fade-end",l>1?"32px":"0px")};r();const a=new ResizeObserver(r);a.observe(n);for(const i of n.children)a.observe(i);return n.addEventListener("scroll",r,{passive:!0}),()=>{a.disconnect(),n.removeEventListener("scroll",r)}},[e]),s.jsx("div",{ref:t,className:"pf-featured-media-scroll",role:"region","aria-label":"More posts",tabIndex:0,children:e})}function w5({featured:e,items:t,variant:n="section"}){return e&&ff(e)&&t.length?s.jsx("div",{className:"pf-featured-media",children:s.jsxs("div",{className:"pf-featured-media-layout",children:[s.jsx("div",{className:"pf-featured-media-main",children:s.jsx(v5,{item:e,fill:!0})}),s.jsx("div",{className:"pf-featured-media-side",children:s.jsx(Ert,{children:t.map((r,a)=>s.jsx(Qj,{item:r},r.ref||r.id||a))})})]})}):s.jsxs(s.Fragment,{children:[e&&s.jsx("div",{className:t.length?"mb-3 sm:mb-4":void 0,children:s.jsx(v5,{item:e})}),s.jsx(Irt,{items:t,variant:n,afterHero:!!e})]})}const Srt=`${eg} auto-cols-[38%] sm:auto-cols-[calc((100%-2rem)/3)]`,Crt=`${eg} auto-cols-[38%] sm:auto-cols-[calc((100%-2rem)/3.4)]`,Trt="grid grid-cols-3 gap-3 sm:gap-4",Art=`grid grid-cols-2 gap-3 sm:gap-4 ${Nae}`,Rrt=`${eg} auto-cols-[76%] sm:auto-cols-[calc((100%-1rem)/2)]`;function Irt({items:e,variant:t="section",afterHero:n=!1}){const r=f.useRef(null),a=f.useRef(null),i=e.filter(h=>!ff(h)),o=e.filter(ff),l=t==="rail"||t==="section"&&n&&i.length>2,c=t==="rail"||o.length>3,u=l?t==="rail"?Rae:Rrt:Art,d=c?t==="rail"?Crt:Srt:Trt;return s.jsxs(s.Fragment,{children:[i.length>0&&s.jsx("div",{ref:r,className:u,children:i.map((h,p)=>s.jsx(Qj,{item:h},h.ref||h.id||p))}),t==="section"&&l&&s.jsx(t0,{scrollRef:r,label:"videos"}),o.length>0&&s.jsx("div",{ref:a,className:`${d}${i.length||n?" mt-3 sm:mt-4":""}`,children:o.map((h,p)=>s.jsx(Qj,{item:h},h.ref||h.id||p))}),t==="section"&&c&&s.jsx(t0,{scrollRef:a,label:"shorts"})]})}function Prt({item:e}){const t=rL(e,{inline:!1}),n=e.type==="video"||e.type==="podcast"?Tr:_Y,r="pf-component-card pf-accent-focus group flex items-center gap-3 rounded-2xl border p-3 pf-accent-hover-border hover:shadow-md transition-all focus-visible:outline-none",a=s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"pf-component-media relative w-16 h-12 shrink-0 rounded-lg overflow-hidden flex items-center justify-center",children:[s.jsx(n,{size:18,className:"text-slate-400","aria-hidden":"true"}),e.img&&s.jsx("img",{src:np(e.img,e.url),onError:rp,onLoad:i=>{i.currentTarget.style.visibility=""},referrerPolicy:"no-referrer",alt:"",className:"absolute inset-0 w-full h-full object-cover",loading:"lazy"})]}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block text-sm font-semibold text-slate-900 truncate pf-accent-gtext transition-colors",children:e.title}),s.jsx(Pae,{item:e,compact:!0})]}),t?s.jsx("span",{className:"pf-accent-bg flex h-8 w-8 shrink-0 items-center justify-center rounded-full shadow",children:s.jsx(Tr,{size:14,className:"fill-current ml-0.5","aria-hidden":"true"})}):s.jsx(xn,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-mid transition-transform group-hover:translate-x-0.5"})]});return t?s.jsx("button",{type:"button",onClick:t.start,"aria-label":`Play ${e.title}`,"data-element-ref":e.ref||e.id,"data-element-title":e.title,className:`${r} w-full text-left`,children:a}):s.jsx("a",{href:e.url||void 0,"data-element-ref":e.url?e.ref||e.id:void 0,"data-element-title":e.url?e.title:void 0,target:"_blank",rel:"noopener noreferrer",className:r,children:a})}function Lrt({creator:e,expertsSlot:t=null,cfg:n=null,activeTab:r="all",trackClicks:a=!1,contactThemeStyle:i=null}){const[o,l]=f.useState(!1),[c,u]=f.useState(null),[d,h]=f.useState({services:"",media:"",products:""}),p=f.useRef(null),m=f.useRef(null);if(!n)return null;const g=q=>r==="all"||r===q,x=q=>S0(q,n.currency),b=q=>{u(q),l(!0)},y=(q,he)=>af(n,q,he),v=q=>of(n,q),w=q=>Ih(n,q),j=n.steps?.services?n.services||[]:[],E=n.enabled&&n.steps?.contact,S=n.items||[],_=S.filter(q=>q.type==="product"),k=S.filter(q=>q.type!=="product"),C=(q,he)=>(n.categories?.[q]||[]).filter(se=>se.name&&he.some(le=>le.categoryId===se.id)),N=C("services",j),A=C("media",k),T=C("products",_),I=$1(N,j),$=$1(A,k),O=$1(T,_),U=(q,he,se)=>{const le=d[q];return le===Qx&&se||he.some(ke=>ke.id===le)?le:he[0]?.id||""},F=U("services",N,I.length>0),H=U("media",A,$.length>0),G=U("products",T,O.length>0),M=(q,he,se)=>q===Qx?se:q?he.filter(le=>le.categoryId===q):he,z=M(F,j,I),W=M(G,_,O),D=M(H,k,$),{featured:Z,rest:V}=x$({...n,items:D}),{featured:L,rest:K}=b$({...n,items:W}),te=b$({...n,items:_}).featured,Q=e.full_name?.split(" ")[0]||"this creator",Y=()=>s.jsxs("section",{id:"profile-services",className:"mb-16 scroll-mt-24","aria-label":y("services","Services"),children:[s.jsx(wm,{title:y("services","Services"),color:v("services")}),w("services")!==3&&s.jsx(zS,{color:Tp(n,"services"),categories:N,items:j,value:F,label:"Services",onChange:q=>h(he=>({...he,services:q}))}),w("services")===3?s.jsx(_rt,{color:Tp(n,"services"),categories:N,services:j,priceLabel:x,canContact:E,askAbout:b}):w("services")===2?s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:m,className:"grid grid-flow-col auto-cols-[86%] sm:auto-cols-[calc((100%-1rem)/2.2)] gap-3 sm:gap-4 overflow-x-auto overflow-y-hidden snap-x snap-mandatory -mt-1 pt-3 pb-2 -mx-1 px-1 no-scrollbar scroll-smooth",children:z.map((q,he)=>{const se=x(q.price),le=q.action==="buy"&&q.url;return s.jsx(_ae,{service:q,price:se,sells:le,canContact:E,onAsk:()=>b(q.name)},he)})}),z.length>2&&s.jsx(t0,{scrollRef:m,label:"services"})]}):w("services")===1?s.jsx(BS,{items:z,label:"Services",className:`grid sm:grid-cols-2 gap-3 ${Eae}`,children:(q,he)=>{const se=x(q.price),le=q.action==="buy"&&q.url;return s.jsx(kae,{service:q,price:se,sells:le,canContact:E,onAsk:()=>b(q.name)},he)}}):s.jsx(BS,{items:z,label:"Services",children:(q,he)=>{const se=x(q.price),le=q.action==="buy"&&q.url;return s.jsxs(op,{href:le?q.url:null,onClick:!le&&E?()=>b(q.name):null,element:q,shell:frt,children:[q.img&&s.jsx("span",{className:"shrink-0 w-[52px] h-[52px] rounded-xl overflow-hidden bg-cream-deep border border-rule",children:s.jsx("img",{src:q.img,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"line-clamp-2 text-[15px] font-semibold text-slate-900",children:q.name}
526),q.desc&&s.jsx("span",{className:"line-clamp-1 text-sm text-slate-500 mt-0.5",children:q.desc})]}),s.jsxs("span",{className:"flex max-w-[45%] min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-1",children:[se&&s.jsx(Zf,{children:se}),(le||E)&&s.jsx(lp,{label:KR(q)})]})]},he)}})]}),J=y("media","")||"Content",P=()=>s.jsxs("section",{id:"profile-content","data-sec":"media",className:"mb-16 scroll-mt-24","aria-label":J,children:[s.jsx(wm,{title:J,color:v("media")}),w("media")!==2&&s.jsx(zS,{color:Tp(n,"media"),categories:A,items:k,value:H,label:"Content",onChange:q=>h(he=>({...he,media:q}))}),w("media")===2?s.jsx(krt,{color:Tp(n,"media"),categories:A,media:k,starred:x$({...n,items:k}).featured}):w("media")===1?s.jsxs("div",{className:"space-y-3",children:[Z&&s.jsx(v5,{item:Z}),V.map((q,he)=>s.jsx(Prt,{item:q},he))]}):s.jsx(w5,{featured:Z,items:V})]}),ee=()=>s.jsxs("section",{id:k.length>0?"profile-products":"profile-content","data-sec":"products",className:"mb-16 scroll-mt-24","aria-label":y("products","Shop"),children:[s.jsx(wm,{title:y("products","Shop"),color:v("products")}),w("products")!==3&&s.jsx(zS,{color:Tp(n,"products"),categories:T,items:_,value:G,label:"Shop",onChange:q=>h(he=>({...he,products:q}))}),L&&w("products")!==3&&s.jsx("div",{className:K.length>0?"mb-3 sm:mb-4":void 0,children:s.jsx(Aae,{item:L,price:x(L.price)})}),w("products")===3?s.jsx(jrt,{color:Tp(n,"products"),categories:T,products:_,starred:te,priceLabel:x}):w("products")===2?s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:p,className:"grid grid-flow-col auto-cols-[86%] sm:auto-cols-[calc((100%-1rem)/2.2)] gap-3 sm:gap-4 overflow-x-auto overflow-y-hidden snap-x snap-mandatory -mt-1 pt-3 pb-2 -mx-1 px-1 no-scrollbar scroll-smooth",children:(L?K:W).map((q,he)=>s.jsx(Tae,{item:q,price:x(q.price)},he))}),(L?K:W).length>2&&s.jsx(t0,{scrollRef:p,label:"products"})]}):s.jsx(BS,{items:L?K:W,label:"Shop",pageSize:w("products")===1?6:jae,className:w("products")===1?"grid grid-cols-2 gap-3 sm:gap-4 items-stretch":"space-y-3",children:(q,he)=>w("products")===1?s.jsx(Cae,{item:q,price:x(q.price)},he):s.jsx(brt,{item:q,price:x(q.price)},he)})]}),X=nk(n),ae=()=>s.jsxs("section",{id:"profile-contact",className:"mb-16 scroll-mt-24","aria-label":y("contact","Work together"),children:[s.jsx(wm,{title:y("contact","Work together"),color:v("contact"),sub:n.desc||null,subColor:of(n,YA("contact"))}),w("contact")===1?s.jsx(Qnt,{creatorId:e.id,creatorName:e.full_name,config:n}):s.jsxs("button",{type:"button",onClick:()=>b(null),className:"pf-accent-bg pf-accent-focus w-full inline-flex items-center justify-center gap-2 px-5 py-4 rounded-2xl text-[15px] font-medium hover:opacity-90 active:scale-[0.99] transition-all focus-visible:outline-none",children:[s.jsx(qr,{size:17,"aria-hidden":"true"})," ",X]})]}),me=q=>{switch(mn(q)){case"expert":return g("experts")?t:null;case"services":return g("services")&&z.length>0?Y():null;case"media":return g("media")&&k.length>0?P():null;case"products":return g("products")&&W.length>0?ee():null;case"contact":return r==="all"&&E?ae():null;case"custom":return r==="all"?s.jsx(trt,{id:`profile-${q.replace("#","-")}`,heading:y(q,""),headingColor:v(q),text:n.customs?.[q]?.text||"",links:n.customs?.[q]?.links||[],layout:w(q),currency:n.currency}):null;default:return null}};return s.jsx(irt,{children:s.jsxs("div",{className:"[&>section:last-child]:mb-0 [&>div:last-child>section:last-child]:mb-0",onClickCapture:a?q=>{const he=q.target.closest?.("[data-element-ref]");he&&sR(aK({creatorId:e.id,elementRef:he.dataset.elementRef,title:he.dataset.elementTitle,surface:"profile"}))}:void 0,children:[wa(n).filter(q=>q!=="header").map(q=>s.jsx(f.Fragment,{children:me(q)},q)),E&&s.jsx(Vse,{isOpen:o,onClose:()=>l(!1),creatorId:e.id,creatorName:e.full_name,config:n,themeStyle:i,source:"profile",prefillMessage:c?`Hi ${Q}, I am interested in "${c}". Could you tell me more?`:""},c||"general")]})})}function hz({active:e,className:t,children:n}){const r=f.useRef(null);return f.useEffect(()=>{const a=r.current;if(!e||!a)return;const i=o=>{m5e(o.target)&&(o.preventDefault(),o.stopPropagation())};return a.addEventListener("click",i,!0),()=>a.removeEventListener("click",i,!0)},[e]),s.jsx("div",{ref:r,className:t,children:n})}function HS({own:e=!1,error:t=!1,pending:n=!1,children:r,after:a}){return e?s.jsx("div",{className:"flex min-w-0 justify-end",children:s.jsx("div",{className:"min-w-0 max-w-[86%] rounded-2xl rounded-br-sm px-3.5 py-2.5 text-sm leading-relaxed pf-accent-bg",children:r})}):s.jsx("div",{className:"flex min-w-0 justify-start",children:s.jsxs("div",{className:"w-full min-w-0",children:[s.jsx("div",{className:n?"min-w-0":`w-fit min-w-0 max-w-[86%] rounded-2xl rounded-bl-sm border px-3.5 py-2.5 text-sm leading-relaxed ${t?"border-red-200 bg-white text-red-700":"border-rule bg-paper text-ink"}`,children:r}),a]})})}function Uae({leading:e,attachments:t,action:n,children:r,textareaProps:a,inputRef:i,onSend:o,canSend:l}){return s.jsxs("div",{className:"shrink-0 bg-cream px-3 pb-2 pt-3",children:[s.jsxs("div",{className:`pf-accent-focus-within rounded-3xl border border-rule bg-paper p-2 shadow-sm ${t?"rounded-2xl":"rounded-full"}`,children:[t&&s.jsx("div",{className:"px-2 pb-2 pt-1",children:t}),s.jsxs("div",{className:"flex items-end gap-1.5",children:[e,s.jsx("textarea",{ref:i,rows:1,placeholder:"Ask anything...","aria-label":"Message",...a,className:"min-w-0 min-h-10 max-h-28 flex-1 resize-none bg-transparent px-1 py-2 text-base leading-6 text-ink outline-none placeholder:font-display placeholder:italic placeholder:text-ink-muted disabled:cursor-not-allowed disabled:opacity-60"}),n||s.jsx("button",{type:"button",onClick:o,disabled:!l,className:`grid h-10 w-10 shrink-0 place-items-center rounded-full transition-opacity ${l?"pf-accent-bg hover:opacity-90":"cursor-not-allowed bg-cream-deep text-ink-light"}`,"aria-label":"Send message",children:s.jsx(rl,{size:18,"aria-hidden":"true"})})]})]}),r]})}function Yk({name:e,className:t=""}){return s.jsx("span",{className:`inline-block max-w-[22ch] truncate align-bottom font-medium text-ink ${t}`,title:e,children:e})}function zae({name:e,typing:t}){return s.jsx("div",{"aria-live":"polite",className:"min-h-0",children:t&&s.jsxs("p",{className:"flex items-center gap-2 py-1 text-xs text-ink-muted",children:[s.jsx("span",{className:"inline-flex items-center gap-1 rounded-full border border-rule bg-paper px-2.5 py-2","aria-hidden":"true",children:[0,160,320].map(n=>s.jsx("span",{className:"h-1.5 w-1.5 animate-rec-pulse rounded-full bg-ink-muted motion-reduce:animate-none",style:{animationDelay:`${n}ms`}},n))}),s.jsx(Yk,{name:e,className:"font-normal text-ink-muted"})," is typing"]})})}const Ort="h-11 w-full rounded-xl border bg-white/80 pl-10 pr-3.5 text-sm text-ink placeholder-ink-muted transition-colors focus:border-[var(--indigo)] focus:bg-white focus:outline-none focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--indigo)_22%,transparent)]";function Hae({open:e,name:t,defaultEmail:n="",onConfirm:r,onClose:a,busy:i=!1,error:o="",accent:l=""}){const[c,u]=f.useState(""),[d,h]=f.useState({}),[p,m]=f.useState(e);e!==p&&(m(e),e&&(u(n||""),h({})));const g=b=>{b.preventDefault();const y=Yje(c);h(y.errors),!Object.keys(y.errors).length&&r({shareTranscript:!0,contactEmail:y.email,contactPhone:""})},x=q4(l);return s.jsx(en,{isOpen:e,onClose:a,title:"Talk to a real person?",hideTitle:!0,glass:!0,backdropClassName:"bg-ink/30 backdrop-blur-[3px]",maxWidth:"max-w-[420px]",className:"p-6 sm:p-7",children:s.jsxs("div",{style:x,className:"relative",children:[s.jsx("button",{type:"button",onClick:a,"aria-label":"Close",className:"absolute -right-2 -top-2 grid h-8 w-8 place-items-center rounded-full text-ink-muted transition-colors duration-base ease-out hover:bg-ink/[0.06] hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/30",children:s.jsx(as,{size:16,strokeWidth:2,"aria-hidden":"true"})}),s.jsxs("div",{className:"flex items-start gap-3.5 pr-6",children:[s.jsxs("div",{className:"relative grid h-10 w-10 shrink-0 place-items-center rounded-2xl bg-[color-mix(in_srgb,var(--indigo)_10%,transparent)] text-[var(--indigo)] ring-1 ring-inset ring-[color-mix(in_srgb,var(--indigo)_18%,transparent)]",children:[s.jsx(Ci,{size:20,strokeWidth:1.8,"aria-hidden":"true"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-2.5 w-2.5 rounded-full bg-sage ring-2 ring-paper","aria-hidden":"true"})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"font-display text-[21px] leading-tight text-ink",children:"Talk to a real person?"}),s.jsxs("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-mid",children:[s.jsx(Yk,{name:t})," sees your AI chat so far and anything you send next."]})]})]}),s.jsxs("p",{className:"mt-5 rounded-2xl bg-sage/10 px-4 py-3 text-[13px] leading-relaxed text-ink-mid ring-1 ring-inset ring-sage/25",children:[s.jsx("span",{className:"font-semibold text-ink",children:"This is a real person, not the AI."})," ","They read and reply to your messages personally."]}),s.jsxs("form",{onSubmit:g,noValidate:!0,children:[n?s.jsxs("p",{className:"mt-4 flex items-center gap-2 text-xs leading-relaxed text-ink-muted",children:[s.jsx(qr,{size:14,className:"shrink-0","aria-hidden":"true"}),s.jsxs("span",{className:"min-w-0",children:["Follow-ups go to ",s.jsx("span",{className:"break-all font-medium text-ink-mid",children:n})]})]}):s.jsxs("div",{className:"mt-5",children:[s.jsxs("label",{htmlFor:"live-contact-email",className:"flex items-center justify-between gap-3 text-[13.5px] font-semibold text-ink",children:["Where should replies go if you miss them?",s.jsx("span",{className:"rounded-full bg-ink/[0.05] px-2 py-0.5 text-[11px] font-medium text-ink-muted",children:"Optional"})]}),s.jsxs("div",{className:"relative mt-2.5",children:[s.jsx(qr,{size:15,className:"pointer-events-none absolute left-3.5 to
526p-1/2 -translate-y-1/2 text-ink-muted","aria-hidden":"true"}),s.jsx("input",{id:"live-contact-email",type:"email",inputMode:"email",autoComplete:"email",placeholder:"[email protected]",maxLength:254,value:c,onChange:b=>{u(b.target.value),h({})},"aria-invalid":!!d.email,"aria-describedby":d.email?"live-contact-email-error":void 0,className:`${Ort} ${d.email?"border-red-400":"border-ink/[0.08]"}`})]}),d.email&&s.jsx("p",{id:"live-contact-email-error",className:"mt-1 text-xs text-red-700",children:d.email})]}),o&&s.jsx("p",{className:"mt-3 text-xs text-red-700",role:"alert",children:o}),s.jsxs("div",{className:"mt-6 flex flex-col gap-1.5",children:[s.jsxs(yt,{type:"submit",size:"md",isLoading:i,children:["Request live chat",s.jsx(xn,{size:16,"aria-hidden":"true"})]}),s.jsx(yt,{type:"button",size:"md",variant:"ghost",onClick:a,children:"Stay with AI"})]}),s.jsx("p",{className:"mt-2 text-center text-[11.5px] text-ink-muted",children:"The AI pauses while you wait."})]})]})})}function qae({name:e,onStart:t,onDismiss:n,offline:r=!1,disabled:a=!1}){return s.jsxs("div",{className:"relative rounded-2xl border border-[color-mix(in_srgb,var(--indigo)_18%,transparent)] bg-[color-mix(in_srgb,var(--indigo)_5%,var(--paper))] p-4 shadow-subtle",role:"note",children:[s.jsx("button",{type:"button",onClick:n,className:"absolute right-2 top-2 grid h-8 w-8 place-items-center rounded-full text-ink-muted transition-colors hover:bg-cream focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--indigo)_40%,transparent)]","aria-label":"Dismiss suggestion",children:s.jsx(as,{size:15,"aria-hidden":"true"})}),s.jsxs("div",{className:"flex items-start gap-3 pr-8",children:[s.jsxs("span",{className:"relative grid h-10 w-10 shrink-0 place-items-center rounded-2xl bg-[color-mix(in_srgb,var(--indigo)_10%,transparent)] text-[var(--indigo)] ring-1 ring-inset ring-[color-mix(in_srgb,var(--indigo)_18%,transparent)]",children:[s.jsx(ni,{size:19,strokeWidth:1.8,"aria-hidden":"true"}),s.jsx("span",{className:`absolute -right-0.5 -top-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-paper ${r?"bg-ink-muted":"bg-sage"}`,"aria-hidden":"true"})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-[15px] font-semibold leading-snug text-ink",children:r?"Offline right now":"Chat with a real person"}),s.jsx("p",{className:"mt-0.5 text-[13px] leading-relaxed text-ink-mid",children:r?"Leave a message and they will get back to you.":s.jsxs(s.Fragment,{children:["Talk to ",s.jsx(Yk,{name:e})," directly, right here in this chat."]})})]})]}),s.jsxs(yt,{type:"button",size:"md",onClick:t,disabled:a,className:"mt-3.5 w-full",children:[r?"Leave a message":"Start live chat",s.jsx(xn,{size:16,"aria-hidden":"true"})]})]})}const pz=/^\(\d+\) /,Mrt={LIVE_CHAT_UNAVAILABLE:()=>"Live chat is offline right now.",LIVE_CHAT_QUEUE_FULL:()=>"The waiting list is full right now. Please try again in a few minutes.",RATE_LIMITED:()=>"Too many attempts. Please wait a moment and try again.",LIVE_CHAT_DISABLED:()=>"Live chat is temporarily unavailable.",LIVE_CHAT_ENDED:()=>"This live chat has ended.",LIVE_CHAT_ALREADY_OPEN:()=>"A live chat request is already open.",LIVE_CHAT_STATE_CONFLICT:()=>"This live chat has already moved on."};function mz(e,t){const n=IY(e),r=Mrt[n];return r?r(t||"This expert"):ih(e)}function Drt(e){return LY(e,"the creator")}function Wae(e,t,{onReturnToAi:n,onCreatorMessage:r,surface:a="profile"}={}){const[i,o]=f.useState(null),[l,c]=f.useState("ai"),[u,d]=f.useState(null),[h,p]=f.useState([]),[m,g]=f.useState(""),[x,b]=f.useState(!1),[y,v]=f.useState(!1),[w,j]=f.useState({position:null,minutes:null}),E=f.useRef(0),[S,_]=f.useState(!1),k=Drt(i?.creatorName),C=l!=="ai";f.useEffect(()=>{if(!e)return;let oe=!1;return o(null),xje(e,a).then(Oe=>{oe||o(Oe||null)}).catch(()=>{oe||o(null)}),()=>{oe=!0}},[e,a]);const N=f.useRef(t),A=f.useRef([]),T=f.useRef(new Set);f.useEffect(()=>{A.current=h},[h]),f.useEffect(()=>{N.current=t,A.current=[],T.current=new Set,E.current=0,c("ai"),d(null),p([]),j({position:null,minutes:null}),g(""),v(!1),_(!1)},[t]);const I=f.useCallback(oe=>{!Array.isArray(oe)||oe.length===0||p(Oe=>QT(Oe,oe))},[]),$=f.useRef(n);f.useEffect(()=>{$.current=n},[n]);const O=f.useCallback(oe=>{if(!oe)return;const Oe=oe.state||"ai";if(c(Oe),d(oe.attempt||null),Oe!=="waiting"?j({position:null,minutes:null}):("queuePosition"in oe||"typicalWaitMinutes"in oe)&&j({position:oe.queuePosition??null,minutes:oe.typicalWaitMinutes??null}),typeof oe.available=="boolean"&&o(Je=>Je&&{...Je,available:oe.available}),Oe==="ai"){const Je=A.current;A.current=[],Je.length&&$.current?.(Je.map(Ie=>({id:Ie.id,role:Ie.role,content:Ie.content,source:Ie.source||"human",revision:Ie.revision,created_at:Ie.createdAt||Ie.created_at}))),p([]),E.current=0}},[]),U=f.useCallback(async()=>
526{if(!t||!e)return;const oe=()=>N.current!==t;try{for(let Oe=0;Oe<20;Oe+=1){const Je=await jje(t,e,E.current);if(oe()||(Oe===0&&O(Je?.status),(Je?.status?.state||"ai")==="ai"))return;const Ie=Je?.messages||[];if(I(Ie),E.current=Math.max(E.current,Je?.throughRevision??Mw(Ie)),Ie.length<OY)break}}catch{}finally{oe()||_(!0)}},[O,t,e,I]),F=!!i?.enabled;f.useEffect(()=>{!F||!t||!e||U()},[t,e,F]),f.useEffect(()=>{const oe=Oe=>{Oe.detail?.conversationId===t&&U()};return window.addEventListener(XT,oe),()=>window.removeEventListener(XT,oe)},[t,U]);const H=f.useCallback(oe=>{if(oe?.event!=="summary"&&!(oe?.event==="message"&&T.current.has(oe.revision))){if(oe?.event==="read"){oe.actor==="creator"&&typeof oe.readRevision=="number"&&d(Oe=>Oe&&Oe.id===oe.attemptId?{...Oe,creatorReadRevision:Math.max(Oe.creatorReadRevision||0,oe.readRevision)}:Oe);return}U()}},[U]),{status:G,peerTyping:M,sendTyping:z}=Ow(t?`live-chat:conv:${t}`:null,{onSignal:H,onReconcile:U,onSendTyping:oe=>Oje(t,e,oe),enabled:C,typingSide:"visitor"}),W=f.useCallback(async oe=>{const Oe=t;b(!0),g("");try{const Je=await oe();return N.current!==Oe?!1:(O(Je),v(!1),!0)}catch(Je){return N.current===Oe&&(g(mz(Je,k)),U()),!1}finally{b(!1)}},[O,t,k,U]),D=f.useCallback(({shareTranscript:oe=!1,contactEmail:Oe="",contactPhone:Je=""}={})=>W(()=>bje(t,e,{shareTranscript:oe,surface:a,contactEmail:Oe,contactPhone:Je,pageUrl:Hje(a,window.location.href,document.referrer)})),[t,e,W,a]),Z=f.useCallback(()=>W(()=>yje(t,e)),[t,e,W]),V=f.useCallback(()=>W(()=>vje(t,e)),[t,e,W]),L=f.useRef(0),[K,te]=f.useState(()=>!document.hidden);f.useEffect(()=>{const oe=()=>te(!document.hidden);return document.addEventListener("visibilitychange",oe),()=>document.removeEventListener("visibilitychange",oe)},[]),f.useEffect(()=>{L.current=0},[t]);const Q=Uje(h);f.useEffect(()=>{if(!K||!t||Q<=L.current)return;const oe=setTimeout(()=>{L.current=Q,_je(t,e,Q).catch(()=>{})},1e3);return()=>clearTimeout(oe)},[t,Q,e,K]);const Y=a==="embed"&&window.parent!==window,J=f.useCallback(oe=>{if(Y)try{window.parent.postMessage({type:"ge:sound",kind:oe},"*")}catch{}else i1(oe)},[Y]),P=f.useRef(r);f.useEffect(()=>{P.current=r},[r]);const ee=f.useRef(null),X=f.useRef(null);f.useEffect(()=>{X.current=null},[t]),f.useEffect(()=>{if(!S){ee.current=null;return}const oe=ee.current;if(ee.current=Math.max(oe??0,Q),oe===null||Q<=oe)return;J("message");const Oe=A.current.filter(Je=>Je.role==="creator").at(-1);Oe&&P.current?.(Oe,k)},[J,Q,k,S]),f.useEffect(()=>{const oe=X.current;X.current=l,oe==="waiting"&&l==="human"&&J("joined")},[J,l]);const[ae,me]=f.useState(0),q=f.useRef(null);f.useEffect(()=>{if(!(Y||!S)){if(K){q.current=null,me(0);return}q.current===null&&(q.current=Q),me(h.filter(oe=>oe.role==="creator"&&(oe.revision||0)>q.current).length)}},[Q,Y,h,S,K]),f.useEffect(()=>{if(!ae)return;const oe=document.title.replace(pz,"");return document.title=`(${ae}) ${oe}`,()=>{document.title=document.title.replace(pz,"")}},[ae]);const[he,se]=f.useState(""),le=f.useCallback(async oe=>{if(!u?.id)return;se("");const Oe=u;d({...u,rating:oe});try{const Je=await kje(t,e,u.id,oe);Je?.id&&N.current===t&&d(Je)}catch{if(N.current!==t)return;d(Oe),se("Your rating could not be saved. Please try again.")}},[u,t,e]),ke=f.useCallback(async oe=>{const Oe=W4(oe);if(Oe)return g(Oe),!1;const Je=crypto.randomUUID(),Ie=oe.trim();g(""),p(ue=>[...ue,{id:Je,clientMessageId:Je,role:"user",source:"human",content:Ie,_pending:!0}]);try{const ue=await wje(t,e,Je,Ie);return N.current!==t||(v(!1),typeof ue?.message?.revision=="number"&&T.current.add(ue.message.revision),ue?.message?I([{...ue.message,clientMessageId:Je}]):await U()),!0}catch(ue){return N.current!==t||(p(be=>be.filter(Re=>Re.id!==Je)),v(!0),g(mz(ue,k)),U()),!1}},[t,e,I,k,U]);return{config:i,name:k,state:l,active:C,attempt:u,startRevision:C?u?.startRevision:void 0,messages:h,error:m,busy:x,reconnecting:G!=="connected"&&y,seenMessageId:zje(h,u),queuePosition:w.position,typicalWaitMinutes:w.minutes,rate:le,ratingError:he,request:D,cancel:Z,resume:V,send:ke,creatorTyping:l==="human"&&M,sendTyping:z,clearError:()=>g("")}}function Vae(e,t,n,r){const[a,i]=f.useState({}),[o,l]=f.useState(!1);f.useEffect(()=>{const m=g=>{g.detail?.expertId===r&&l(!0)};return window.addEventListener(KT,m),()=>window.removeEventListener(KT,m)},[r]);const c=e.at(-1),u=c?.role==="assistant"&&!c._isStreaming&&!c._isError&&!!c.content,d=[...e].reverse().find(m=>m.role==="user"),h=!!(t.config?.enabled&&t.state==="ai"&&n&&u&&d),p=a[n];return h&&o?(l(!1),(p?.id!==d.id||p?.dismissed)&&i(m=>({...m,[n]:{id:d.id}}))):h&&!p&&Wje(d.content,t.name)&&i(m=>({...m,[n]:{id:d.id}})),{show:h&&p?.id===d?.id&&!p?.dismissed,dismiss:()=>i(m=>({...m,[n]:{...p,dismissed:!0}}))}}function Gae({state:e,onSend:t,disabled:n=!1,accentStyle:r,error:a="",reconnecting:i=!1,onTyping:o}){const[l,c]=f.useState(""),[u,d]=f.useState(""),h=f.useRef(null),p=!n&&!!l.trim(),m=[...l].length,g=m>JT*.9,x=u||a;if(e==="resolved")return null;const b=async()=>
526{if(!p)return;const y=W4(l);if(y){d(y);return}d(""),o?.(!1);const v=l;c(""),await t(v)||c(j=>j||v),h.current?.focus()};return s.jsx(Uae,{inputRef:h,textareaProps:{value:l,disabled:n,placeholder:e==="waiting"?"Add a note while you wait...":"Write a message...","aria-label":"Message",onChange:y=>{c(y.target.value),d(""),o?.(!!y.target.value.trim())},onBlur:()=>o?.(!1),onKeyDown:y=>{y.key!=="Enter"||y.shiftKey||y.nativeEvent?.isComposing||(y.preventDefault(),b())}},action:s.jsx("button",{type:"button",onClick:b,disabled:!p,className:`grid h-10 w-10 shrink-0 place-items-center rounded-full transition-opacity ${p?"pf-accent-bg hover:opacity-90":"cursor-not-allowed bg-cream-deep text-ink-light"}`,style:p?r:void 0,"aria-label":"Send message",children:s.jsx(rl,{size:18,"aria-hidden":"true"})}),children:(g||i||x)&&s.jsxs("div",{className:"px-2 pt-1.5 text-[11px] leading-4",children:[g&&s.jsxs("p",{className:"text-ink-muted",children:[m.toLocaleString()," / ",JT.toLocaleString()]}),i&&s.jsx("p",{className:"text-ink-mid",children:"Reconnecting..."}),x&&s.jsx("p",{className:"text-red-700",role:"alert",children:x})]})})}function Yae({onEnd:e,disabled:t=!1,accent:n="",placement:r="bottom"}){const[a,i]=f.useState(!1),o=q4(n);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`flex shrink-0 items-center justify-between gap-3 ${r==="top"?"border-b":"border-t"} border-rule bg-cream px-4 py-2 text-xs text-ink-mid`,style:o,children:[s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2",children:[s.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-sage","aria-hidden":"true"}),s.jsx("span",{className:"truncate",children:"Live chat"})]}),s.jsx("button",{type:"button",onClick:()=>i(!0),disabled:t,className:"shrink-0 rounded-sm font-semibold text-[var(--indigo)] underline underline-offset-2 transition-opacity hover:opacity-75 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--indigo)_40%,transparent)]",children:"End chat and return to AI"})]}),s.jsx(en,{isOpen:a,onClose:()=>i(!1),title:"End this live chat?",hideTitle:!0,glass:!0,backdropClassName:"bg-ink/30 backdrop-blur-[3px]",maxWidth:"max-w-[420px]",className:"p-6 sm:p-7",children:s.jsxs("div",{style:o,children:[s.jsxs("div",{className:"flex items-start gap-3.5",children:[s.jsx("div",{className:"grid h-10 w-10 shrink-0 place-items-center rounded-2xl bg-[color-mix(in_srgb,var(--indigo)_10%,transparent)] text-[var(--indigo)] ring-1 ring-inset ring-[color-mix(in_srgb,var(--indigo)_18%,transparent)]",children:s.jsx(qh,{size:20,strokeWidth:1.8,"aria-hidden":"true"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"font-display text-[21px] leading-tight text-ink",children:"End this live chat?"}),s.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-mid",children:"This conversation stays here to read. You will go back to the AI assistant."})]})]}),s.jsxs("div",{className:"mt-6 flex flex-col gap-1.5",children:[s.jsx(yt,{type:"button",size:"md",onClick:()=>{i(!1),e()},children:"End chat and return to AI"}),s.jsx(yt,{type:"button",size:"md",variant:"ghost",onClick:()=>i(!1),children:"Keep chatting"})]})]})})]})}const fz="inline-flex items-center gap-1 rounded-sm text-xs font-semibold text-[var(--indigo)] underline underline-offset-2 transition-opacity hover:opacity-75 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--indigo)_40%,transparent)]",$rt=new Set(["expired","declined","idle"]),Frt=new Set(["resolved","idle"]),Brt={declined:()=>"They could not take this chat",expired:()=>"Your request expired",cancelled:()=>"You returned to the AI",idle:e=>e?`Chat ended after ${e} minutes without messages`:"Chat ended after a quiet spell"};function Dm({variant:e,name:t,terminalReason:n,idleMinutes:r=null,onAction:a,disabled:i=!1,queuePosition:o=null,typicalWaitMinutes:l=null,onLeaveMessage:c=null,rating:u=null,onRate:d=null,ratingError:h=""}){if(e==="joined")return s.jsxs("div",{className:"flex items-center gap-3 py-1 text-xs text-ink-mid",children:[s.jsx("span",{className:"h-px flex-1 bg-rule"}),s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(ft,{size:13,strokeWidth:2.2,"aria-hidden":"true"}),s.jsx(Yk,{name:t,className:"text-ink-mid"})," joined"]}),s.jsx("span",{className:"h-px flex-1 bg-rule"})]});const p=e==="waiting",m=p?ah:ft,g=p?"Waiting for a reply...":Brt[
526n]?.(r)||"This live chat has ended",x=p?"The AI is paused while you wait. There is no guaranteed response time.":n==="idle"?"You can read it here, start a new live chat later or continue with the AI.":"You can read this conversation here. The AI stays paused until you choose to return.",b=p?"Cancel and return to AI":"Continue with AI",y=[];if(p&&o===1)y.push("You are next.");else if(p&&o>1){const j=o-1;y.push(`${j} ${j===1?"person":"people"} ahead of you.`)}p&&l>0&&y.push(`Usually replies in about ${l} min.`);const v=!p&&$rt.has(n)&&c,w=!p&&Frt.has(n)&&d;return s.jsx("div",{className:"rounded-2xl border border-rule bg-paper px-4 py-3.5",children:s.jsxs("div",{className:"min-w-0",children:[s.jsxs("p",{className:"flex items-center gap-2 text-sm font-semibold text-ink",children:[s.jsx(m,{size:16,strokeWidth:2,className:"shrink-0 text-ink-mid","aria-hidden":"true"}),g]}),y.length>0&&s.jsx("p",{className:"mt-1 text-xs font-medium leading-relaxed text-ink","aria-live":"polite",children:y.join(" ")}),s.jsx("p",{className:"mt-1 text-xs leading-relaxed text-ink-mid",children:x}),w&&s.jsxs("div",{className:"mt-3 border-t border-rule pt-3",children:[s.jsx("p",{className:"text-xs font-medium text-ink",id:"live-chat-rating-label",children:"How was your live chat?"}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",role:"group","aria-labelledby":"live-chat-rating-label",children:[[["up",eo,"Good"],["down",wc,"Not good"]].map(([j,E,S])=>s.jsx("button",{type:"button",onClick:()=>d(j),"aria-pressed":u===j,"aria-label":S,title:S,className:`grid h-8 w-8 place-items-center rounded-full border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--indigo)_40%,transparent)] ${u===j?"border-[var(--indigo)] bg-[color-mix(in_srgb,var(--indigo)_8%,transparent)] text-[var(--indigo)]":"border-rule text-ink-mid hover:bg-cream"}`,children:s.jsx(E,{size:14,"aria-hidden":"true"})},j)),s.jsx("span",{className:"ml-1 text-xs text-ink-muted","aria-live":"polite",children:h?s.jsx("span",{className:"text-red-700",children:h}):u?"Thanks for the feedback":""})]})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-1",children:[s.jsxs("button",{type:"button",onClick:a,disabled:i,className:fz,children:[b,s.jsx(xn,{size:13,"aria-hidden":"true"})]}),v&&s.jsx("button",{type:"button",onClick:c,className:fz,children:"Leave a message"})]})]})})}function j5({name:e,available:t=!0,onClick:n,onOffline:r=null,disabled:a=!1,className:i="",labelClassName:o="",iconClassName:l="",style:c,iconSize:u=14}){const d=!t,h=d?!r:a,p=`Live chat with ${e}, ${d?"offline":"online"}`;let m=p;return d?m=r?`${e} is offline. Leave a message`:"Offline right now":a&&(m="Send a message first, then you can ask for a live chat"),s.jsxs("button",{type:"button",onClick:d?r:n,disabled:h,className:`${i} disabled:cursor-not-allowed disabled:opacity-50`,style:c,"aria-label":p,title:m,children:[s.jsxs("span",{className:"relative inline-flex shrink-0",children:[s.jsx(ni,{size:u,strokeWidth:1.9,className:l,"aria-hidden":"true"}),s.jsx("span",{className:`absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full ring-2 ring-paper ${d?"bg-ink-muted":"bg-sage"}`,"aria-hidden":"true"})]}),s.jsx("span",{className:o,children:"Live chat"})]})}function Kae(e){const[t,n]=f.useState(null);return f.useEffect(()=>{if(!e)return;let r=!1;return cK(e).then(a=>{r||n(a?.enabled?e:null)}).catch(()=>{r||n(null)}),()=>{r=!0}},[e]),!e||t!==e?null:()=>U0(e,{notice:"Live chat is not available right now. Leave a message here instead."})}const gz="shrink-0 rounded-full px-4 py-2 text-xs font-medium transition-colors";function Xae({expert:e,signedIn:t=!1,onAuthenticate:n,checkoutTarget:r="_self"}){const a=e?.subscription?.price_usd,i=a?`$${Number(a).toFixed(2)}/mo`:null;return s.jsx("div",{className:"shrink-0 bg-cream px-3 pb-2 pt-3",children:s.jsxs("div",{role:"status",className:"flex items-center gap-3 rounded-full border border-rule bg-paper py-2 pl-4 pr-2 shadow-sm",children:[s.jsxs("p",{className:"min-w-0 flex-1 truncate text-xs text-ink-mid",children:[s.jsx("span",{className:"font-medium text-ink",children:"Free messages used."})," ",i?`${i} to keep chatting.`:"Subscribe to keep chatting."]}),t?s.jsx(Hk,{expert:e,checkoutTarget:r,label:"Subscribe",className:`${gz} inline-flex items-center gap-1.5 bg-indigo text-cream hover:bg-indigo-deep disabled:opacity-60`}):s.jsx("button",{type:"button",onClick:n,className:`${gz} bg-indigo text-cream hover:bg-indigo-deep`,children:"Subscribe"})]})})}
526async function Urt(){return(await Se.get("/payments/packs")).data}async function zrt(e){return(await Se.post("/payments/checkout",{pack:e})).data}async function Hrt(e){return(await Se.post("/payments/checkout/confirm",{session_id:e})).data}async function Jae(e){return(await Se.post("/payments/checkout/confirm-subscription",{session_id:e})).data}const xz=16;function Qae(e,t,n=!0){const r=f.useRef(null),a=f.useRef(null);return f.useLayoutEffect(()=>{const i=e.current,o=r.current;if(!i||!o)return;let l=null;for(let p=t.length-1;p>=0;p--)if(t[p].role==="user"){l=t[p].id;break}const c=t.some(p=>p._isStreaming)&&l!=null&&l!==a.current;c&&(a.current=l);const u=a.current,d=u!=null?i.querySelector(`[data-message-id="${CSS.escape(String(u))}"]`):null;if(!d){a.current=null,o.style.height="0px",i.scrollTop=i.scrollHeight;return}const h=o.getBoundingClientRect().top-d.getBoundingClientRect().top;if(o.style.height=`${Math.max(0,i.clientHeight-xz-h)}px`,c){const p=d.getBoundingClientRect().top-i.getBoundingClientRect().top+i.scrollTop-xz,m=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;i.scrollTo({top:p,behavior:m?"auto":"smooth"})}},[e,t,n]),r}const _5="pf-accent-focus pf-accent-hover-wash grid h-10 w-10 shrink-0 place-items-center rounded-lg text-ink transition-colors duration-base ease-out focus-visible:outline-none";function k5(e){return`gx_saas_pending:${e}`}function qrt(e){try{const t=sessionStorage.getItem(k5(e));return t?JSON.parse(t):null}catch{return null}}const Zx=f.memo(function({message:t,expertId:n,creatorName:r=""}){const a=Array.isArray(t.attachments)?t.attachments:[];if(t.role==="user")return s.jsx("div",{"data-message-id":t.id,className:t._pending?"opacity-60":void 0,children:s.jsxs(HS,{own:!0,children:[t.content&&s.jsx("p",{className:"whitespace-pre-wrap break-words",children:t.content}),a.length>0&&s.jsx("div",{className:"mt-1.5 space-y-1 text-xs opacity-90",children:a.map(o=>s.jsxs("p",{children:["ð ",o.file_name]},o.id))})]})});if(t.role==="creator")return s.jsxs("div",{children:[s.jsx(zse,{name:r}),s.jsx(HS,{children:s.jsx("p",{className:"whitespace-pre-wrap break-words",children:t.content})})]});const i=!t.content&&!t._isError;return s.jsx(HS,{pending:i,error:t._isError,after:s.jsx(Wb,{blocks:t.blocks,expertId:n,messageId:t.id,surface:"profile"}),children:i?s.jsx(Pk,{size:20}):s.jsx(Qf,{content:t.content,isStreaming:!!t._isStreaming})})});function Wrt({value:e,onChange:t,onSend:n,onStop:r,disabled:a,isStreaming:i,inputRef:o,onStartCall:l,placeholder:c,expertId:u}){const{attachments:d,addFiles:h,removeAttachment:p,clearAttachments:m,openFilePicker:g,fileInputRef:x,readyAttachments:b,hasUploading:y}=pae(u||null),v=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),_())},w=!!e.trim(),j=b.length>0,E=(w||j)&&!a&&!y,S=!w&&!j&&!!l&&!a&&!i,_=()=>{E&&(n(e,b),m())};return s.jsx(Uae,{inputRef:o,onSend:_,canSend:E,textareaProps:{value:e,onChange:k=>t(k.target.value.slice(0,2e3)),onKeyDown:v,disabled:a,placeholder:c||"Ask anything...",maxLength:2e3},attachments:d.length>0?s.jsx(x5,{attachments:d,onRemove:p}):null,leading:s.jsx("button",{type:"button",onClick:g,disabled:a||i,"aria-label":"Attach files",title:"Attach files",className:"grid h-10 w-10 shrink-0 place-items-center rounded-full text-ink-mid transition-colors hover:bg-cream-deep hover:text-ink disabled:cursor-not-allowed disabled:opacity-40",children:s.jsx(Es,{size:20,strokeWidth:1.9,"aria-hidden":"true"})}),action:i&&r?s.jsx("button",{type:"button",onClick:r,className:"grid h-10 w-10 shrink-0 place-items-center rounded-full pf-accent-bg transition-opacity hover:opacity-90","aria-label":"Stop generating",children:s.jsx(ku,{className:"h-3.5 w-3.5",fill:"currentColor",strokeWidth:0})}):S?s.jsxs("button",{type:"button",onClick:l,className:"inline-flex h-10 shrink-0 items-center gap-2 rounded-full bg-sage px-4 text-sm font-semibold text-cream transition-colors hover:bg-sage-deep active:scale-[0.98]","aria-label":"Start a voice call with this AI expert",title:"Talk to this AI expert",children:[s.jsx(Ts,{size:17,strokeWidth:1.85,"aria-hidden":"true"}),s.jsx("span",{children:"Call"})]}):null,children:s.jsx("input",{ref:x,type:"file",multiple:!0,accept:uae,className:"hidden",onChange:k=>{k.target.files?.length>0&&h(k.target.files),k.target.value=""}})})}function Vrt({onLogin:e}){return s.jsxs("footer",{className:"shrink-0 bg-cream px-3 pb-3 text-center text-[10px] leading-4 text-ink-muted",children:[s.jsxs("p",{children:["AI Chat. Messages and AI replies may be reviewed by this expertâs owner for audience insights. Donât share sensitive personal information."," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-ink",children:"Privacy"})," · ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-ink",children:"Terms"})]}),e?s.jsxs("p",{className:"mt-0.5",children:["Have an account?"," ",s.jsx("button",{type:"button",onClick:e,className:"pf-accent-text pf-accent-focus rounded-sm font-medium underline underline-offset-2 transition-opacity hover:opacity-75 focus-visible:outline-none",children:"Log in"})]}):null]})}function Zae(){return s.jsxs("p",{className:"truncate text-[11px] leading-tight text-ink-muted",children:["Powered by"," ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",className:"underline decoration-ink-light underline-offset-2 hover:text-ink",children:"Great Experts"})]})}
526function Grt({expert:e}){return e?s.jsx("section",{id:"profile-chat","aria-label":`Preview conversation with ${e.name}`,className:"mb-16",children:s.jsxs("div",{className:"pf-component-chat relative flex h-[min(540px,70vh)] min-h-[420px] flex-col overflow-hidden rounded-3xl border border-rule bg-cream text-ink isolate",style:{"--pf-accent-rgb":"27 42 92","--pf-accent-on-rgb":"250 249 245"},inert:!0,children:[s.jsx("header",{className:"relative z-10 shrink-0 bg-cream",children:s.jsxs("div",{className:"flex min-h-[4.75rem] items-center gap-1.5 px-3 py-3",children:[s.jsx("div",{className:"grid h-12 w-12 shrink-0 place-items-center overflow-hidden rounded-full bg-cream-deep ring-1 ring-black/[0.06]",children:e.avatar_url?s.jsx("img",{src:e.avatar_url,alt:"",className:"h-full w-full object-cover"}):s.jsx(Ms,{size:20,className:"pf-accent-text","aria-hidden":"true"})}),s.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[s.jsx("p",{className:"truncate text-sm font-semibold leading-tight text-ink",children:e.name}),s.jsx(Zae,{})]}),s.jsx("span",{className:_5,"aria-hidden":"true",children:s.jsx(xl,{size:26,strokeWidth:1.35})})]})}),s.jsxs("div",{className:"no-scrollbar min-h-0 flex-1 space-y-3 overflow-hidden bg-cream px-4 py-4",children:[s.jsx(Zx,{message:{role:"user",content:jo.question}}),s.jsx(Zx,{message:{role:"assistant",content:DJe}}),s.jsx("img",{src:jo.productImage,alt:jo.answerProduct,className:"block aspect-[128/109] w-[72%] max-w-[220px] rounded-2xl border border-rule bg-paper object-cover object-top"})]}),s.jsx("div",{className:"shrink-0 bg-cream px-3 pb-2 pt-3",children:s.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-rule bg-paper p-2 pl-4 shadow-sm",children:[s.jsx("span",{className:"flex-1 font-display text-base italic text-ink-muted",children:"Ask anything..."}),s.jsxs("span",{className:"flex h-10 shrink-0 items-center gap-1.5 rounded-full bg-[#407f57] px-4 text-sm font-semibold text-[#faf9f5]","aria-hidden":"true",children:[s.jsx(Ts,{size:16,strokeWidth:1.85})," Call"]})]})}),s.jsx("footer",{className:"shrink-0 bg-cream px-3 pb-3 text-center text-[10px] leading-4 text-ink-muted",children:"Preview conversation · no messages will be sent"})]})}):null}function Yrt({expert:e,seedMessage:t="",seedNonce:n=0,previewStarters:r=null}){const a=sp(),{user:i,isAuthenticated:o,isAnonymous:l,ensureAnonymousSession:c,resetAnonymousSession:u,getAnonymousStatus:d,updateBalance:h,updateUser:p}=Ut(),m=e?.id||null,g=f.useRef(qrt(m)),x=f.useRef(!!g.current),[b,y]=f.useState(!1),[v,w]=f.useState([]),[j,E]=f.useState(null),[S,_]=f.useState([]),[k,C]=f.useState(!1),[N,A]=f.useState(!1),[T,I]=f.useState("chat"),[$,O]=f.useState(""),[U,F]=f.useState(!1),[H,G]=f.useState(g.current?.mode||null),[M,z]=f.useState(g.current?.mode==="gate"),[W,D]=f.useState(!1),[Z,V]=f.useState(null),[L,K]=f.useState(null),[te,Q]=f.useState(""),[Y,J]=f.useState(null),P=f.useRef(g.current),ee=f.useRef(null),X=f.useRef(null),ae=f.useRef(null),me=f.useRef(0),q=T==="history",he=!!e?.require_login_to_chat&&!o,{isStreaming:se,startStream:le,stopStream:ke}=eL(m,j,w,"profile-panel"),oe=Wae(m,j,{onReturnToAi:ye=>w(Ze=>{const jt=new Set(Ze.map(Nt=>Nt.id));return[...Ze,...ye.filter(Nt=>!jt.has(Nt.id))]})}),[Oe,Je]=f.useState(!1),Ie=MY(v,oe),ue=Kae(oe.config?.enabled||oe.active?m:null),be=oe.config?.available!==!1,Re=!be&&!!ue&&!oe.active,Ge=()=>{be?Je(!0):ue?.()},it=Vae(v,oe,j,m),ut=async()=>{if(!m)return;const ye=await F_(m,{force:!0});_(ye?.data?.conversations||[])},$t=async(ye=null)=>{if(!m)return;const Ze=await Nb(m,ye);w(Ze?.data?.messages||[]),E(Ze?.data?.conversation_id||ye||null),F(!!Ze?.data?.creator_summary_consent)};f.useEffect(()=>{if(!m)return;let ye=!1;return(async()=>{try{if(await c(),ye)return;await $t(),await ut(),ye||y(!0)}catch(Ze){if(Ze.response?.data?.detail?.code==="ANONYMOUS_SESSION_EXPIRED")try{if(await u(),ye)return;await $t(),await ut(),ye||y(!0);return}catch{}ye||Q(Ze.message||"Chat could not be opened.")}})(),()=>{ye=!0}},[m]),f.useEffect(()=>{const ye=async()=>{try{await c()}catch{}G("login")};return window.addEventListener("gs:open-saas-login",ye),()=>window.removeEventListener("gs:open-saas-login",ye)},[c]);const tt=Array.isArray(r)&&r.length===3?r.join(` 527`):"";f.useEffect(()=>{if(tt){J(tt.split(` 528`));return}if(J(null),!m)return;let ye=!1;return kh(m).then(Ze=>{if(ye)return;const jt=Ze?.data?.starters;Array.isArray(jt)&&jt.length>0&&J(jt)}).catch(()=>{}),()=>{ye=!0}},[m,tt]);const He=Qae(ee,v,b);f.useEffect(()=>{const ye=ee.current;ye&&(ye.scrollTop=ye.scrollHeight)},[oe.messages,oe.state,oe.creatorTyping]),f.useEffect(()=>{if(!N)return;const ye=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=ye}},[N]),f.useEffect(()=>{if(N)return;const ye=ee.current;if(!ye)return;const Ze=jt=>{const{scrollTop:Nt,scrollHeight:ne,clientHeight:ge}=ye,xe=ne-ge,pe=jt.deltaY;if(Math.abs(pe)<.5)return;const Ne=xe>1,Ue=Nt<=1,dt=Nt>=xe-1;if(Ne&&!(pe<0&&Ue||pe>0&&dt))return;const Xe=ye.closest(".pf-page-scroll");Xe&&(Xe.scrollTop+=pe,jt.preventDefault())};return ye.addEventListener("wheel",Ze,{passive:!1}),()=>ye.removeEventListener("wheel",Ze)},[N,v.length,b]),f.useEffect(()=>{if(T!=="history")return;const ye=Ze=>{Ze.key==="Escape"&&(I("chat"),ae.current?.focus())};return window.addEventListener("keydown",ye),()=>window.removeEventListener("keydown",ye)},[T]);const wt=ye=>{ye&&E(ye),ut().catch(()=>{})},St=ye=>{P.current=ye;try{sessionStorage.setItem(k5(m),JSON.stringify(ye))}catch{}},Zt=(ye,Ze=[])=>
528{le(ye,Ze,v,wt,h,null,{saasProfile:!0,creatorSummaryConsent:U,onAuthRequired:jt=>{const Nt=jt.error?.code==="LOGIN_REQUIRED"?"login-required":"gate";St({content:jt.content,attachments:jt.attachments,conversationId:j,mode:Nt}),Nt==="gate"&&z(!0),G(Nt)},onExpertSubscriptionRequired:()=>{D(!0),z(!0),o||(ve.current=!0,G("register"))},onTermsRequired:jt=>{St({content:jt.content,attachments:jt.attachments,conversationId:j,mode:"terms"}),G("terms")}})},Jt=(ye="",Ze=[])=>{const jt=String(ye??"").trim(),Nt=Array.isArray(Ze)?Ze:[];if(!(!jt&&Nt.length===0||se)&&!oe.active){if(!b){K({content:jt,attachments:Nt}),O("");return}if(!W){if(M){G("gate");return}if(he){St({content:jt,attachments:Nt,conversationId:j,mode:"login-required"}),O(""),G("login-required");return}if(o&&i?.terms_current===!1){St({content:jt,attachments:Nt,conversationId:j,mode:"terms"}),O(""),G("terms");return}O(""),Zt(jt,Nt)}}};f.useEffect(()=>{!b||!L||(Zt(L.content,L.attachments),K(null))},[b,L]),f.useEffect(()=>{if(!n||n===me.current)return;const ye=String(t||"").trim();ye&&(me.current=n,A(!0),I("chat"),Jt(ye,[]))},[n,t]);const $e=async()=>{if(se||!b)return;const ye=await X4(m);E(ye?.data?.conversation?.id||null),w(ye?.data?.messages||[]),F(!!ye?.data?.conversation?.creator_summary_consent),I("chat"),await ut(),X.current?.focus()},Qe=async()=>{I("history"),C(!0);try{await ut()}finally{C(!1)}},ct=async ye=>{if(se||ye===j){I("chat");return}await $t(ye),I("chat")},ve=f.useRef(!1);f.useEffect(()=>{const ye=new URLSearchParams(window.location.search);if(ye.get("subscribed")!=="1")return;const Ze=ye.get("session_id");ve.current=!1,ye.delete("subscribed"),ye.delete("expert_id"),ye.delete("session_id");const jt=ye.toString();window.history.replaceState({},"",`${window.location.pathname}${jt?`?${jt}`:""}`),(async()=>{if(Ze)try{await Jae(Ze)}catch{}D(!1),z(!1)})()},[]),f.useEffect(()=>{!ve.current||!W||!o||(ve.current=!1,QP(m,{target:"_self",returnPath:`${window.location.pathname}${window.location.search}`}).catch(()=>{}))},[W,o,m]);const Ye=async(ye={})=>{ye.authenticated!==!1&&p({terms_current:!0}),z(!1),G(null);const Ze=P.current;P.current=null;try{sessionStorage.removeItem(k5(m))}catch{}Ze?.conversationId&&Ze.conversationId!==j&&await $t(Ze.conversationId),Ze&&V(Ze),ut().catch(()=>{})};f.useEffect(()=>{if(!(!b||!o||!x.current)){if(x.current=!1,i?.terms_current===!1){G("terms");return}Ye()}},[b,o,i?.terms_current]),f.useEffect(()=>{if(!b||o||!x.current||!m)return;let ye=!1;return d(m).then(Ze=>{ye||!Ze?.data?.email_captured||(x.current=!1,Ye({authenticated:!1}))}).catch(()=>{}),()=>{ye=!0}},[b,o,m,d]),f.useEffect(()=>{Z&&(Z.conversationId&&Z.conversationId!==j||(Zt(Z.content,Z.attachments),V(null)))},[Z,j]);const{canCall:rt,startCall:De,callUi:qe}=Vk(e,{conversationId:j,onConversation:ye=>{ye&&E(ye),$t(ye).catch(()=>{}),ut().catch(()=>{})},onLimitReached:()=>G("gate"),onLoginRequired:()=>G("login-required")});return e?s.jsxs("section",{id:"profile-chat","aria-label":`Chat with ${e.name}`,className:N?"fixed inset-0 z-50 bg-cream p-0 sm:p-5":"mb-16",children:[s.jsxs("div",{className:`pf-component-chat relative flex flex-col overflow-hidden bg-cream text-ink isolate ${N?"mx-auto h-full max-w-6xl rounded-none sm:rounded-3xl sm:border sm:border-rule":"h-[min(540px,70vh)] min-h-[420px] rounded-3xl border border-rule"}`,children:[s.jsx("header",{className:"relative z-40 shrink-0 bg-cream",children:s.jsxs("div",{className:"flex min-h-[4.75rem] items-center gap-1.5 px-3 py-3",children:[s.jsx("div",{className:"grid h-12 w-12 shrink-0 place-items-center overflow-hidden rounded-full bg-cream-deep ring-1 ring-black/[0.06]",children:e.avatar_url?s.jsx("img",{src:e.avatar_url,alt:e.name||"Expert",className:"h-full w-full object-cover",onError:ye=>{ye.currentTarget.style.display="none"}}):s.jsx(Ms,{size:20,className:"pf-accent-text","aria-hidden":"true"})}),s.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[s.jsx("p",{className:"truncate text-sm font-semibold leading-tight text-ink",children:e.name}),e?.show_badge!==!1&&s.jsx(Zae,{})]}),s.jsx(Ik,{expert:e,messages:v,source:"profile",className:"pf-accent-focus pf-accent-hover-wash hidden sm:inline-flex h-10 max-w-[38%] shrink-0 items-center gap-1.5 rounded-xl border border-rule bg-transparent px-2.5 text-xs font-semibold text-ink transition-colors duration-base ease-out pf-accent-hover-border focus-visible:outline-none sm:px-3",labelClassName:"truncate",iconClassName:"h-3 w-3 pf-accent-text",silent:!!oe.config?.enabled&&!Re}),oe.config?.enabled&&!oe.active&&!Re&&s.jsx(j5,{name:oe.name,available:be,onClick:()=>Je(!0),onOffline:ue,disabled:!j||!b,className:"pf-accent-focus pf-accent-hover-wash hidden sm:inline-flex h-10 max-w-[38%] shrink-0 items-center gap-1.5 rounded-xl border border-rule bg-transparent px-2.5 text-xs font-semibold text-ink transition-colors duration-base ease-out pf-accent-hover-border focus-visible:outline-none sm:px-3",labelClassName:"truncate",iconClassName:"pf-accent-text"}),s.jsx("button",{type:"button",onClick:()=>A(ye=>!ye),className:`${_5} hidden sm:grid`,"aria-label":N?"Exit full screen":"Full screen",title:N?"Exit full screen":"Full screen","aria-pressed":N,children:N?s.jsx(qT,{size:20,strokeWidth:1.7,"aria-hidden":"true"}):s.jsx(HT,{size:20,strokeWidth:1.7,"aria-hidden":"true"})}),s.jsx("button",{ref:ae,type:"button",onClick:q?()=>I("chat"):Qe,className:_5,"aria-label":"Menu","aria-controls":"profile-conversations-drawer","aria-expanded":q,title:"Menu",children:s.jsx(xl,{size:26,strokeWidth:1.35,"aria-hidden":"true"})})]})}),s.jsx("button",{type:"button",onClick:()=>I("chat"),className:`absolute inset-0 z-20 bg-ink/40 backdrop-blur-sm transition-opacity duration-base ease-out motion-reduce:transition-none ${q?"pointer-events-auto opacity-100":"pointer-events-none opacity-0"}`,"aria-label":"Close conversations",tabIndex:q?0:-1}),s.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[s.jsxs("div",{ref:ee,className:"no-scrollbar min-h-0 flex-1 space-y-3 overflow-x-hidden overflow-y-auto bg-cream px-4 py-4",children:[!b&&!te&&s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx(vt,{size:18,className:"animate-spin text-ink-muted motion-reduce:animate-none"})}),te&&s.jsx("p",{className:"rounded-xl border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:te}),b&&!te&&v.length===0&&s.jsx(Zx,{message:{id:"profile-greeting",role:"assistant",content:String(e.greeting||"").trim()||`Hi, I'm ${e.name}. Ask me anything â I'm here to help.`}}),b&&Ie.map(ye=>s.jsx(Zx,{message:ye,expertId:m,creatorName:oe.name},ye.id)),b&&it.show&&(be||ue)&&s.jsx(qae,{name:oe.name,offline:!be,onStart:Ge,onDismiss:it.dismiss}),oe.state==="waiting"&&s.jsx(Dm,{variant:"waiting",name:oe.name,onAction:oe.cancel,disabled:oe.busy,queuePosition:oe.queuePosition,typicalWaitMinutes:oe.typicalWaitMinutes}),oe.state==="human"&&s.jsx(Dm,{variant:"joined",name:oe.name}),oe.messages.map(ye=>s.jsxs(f.Fragment,{children:[s.jsx(Zx,{message:ye,expertId:m,creatorName:oe.name}),ye.id===oe.seenMessageId&&s.jsx("p",{className:"-mt-2 text-right text-[11px] text-ink-muted",children:"Seen"})]},ye.id)),oe.state==="human"&&s.jsx(zae,{name:oe.name,typing:oe.creatorTyping}),oe.state==="resolved"&&s.jsx(Dm,{variant:"ended",name:oe.name,terminalReason:oe.attempt?.terminalReason,idleMinutes:oe.config?.idleMinutes,onAction:oe.resume,disabled:oe.busy,onLeaveMessage:ue,rating:oe.attempt?.rating,onRate:oe.rate,ratingError:oe.ratingError}),b&&!se&&!oe.active&&Array.isArray(Y)&&Y.length>0&&!v.some(ye=>ye.role==="user")&&s.jsx("div",{className:"flex flex-col items-end gap-2 pt-1",children:Y.map(ye=>s.jsx("button",{type:"button",onClick:()=>Jt(ye,[]),disabled:M||q,className:"pf-accent-focus pf-starter-chip max-w-[86%] rounded-2xl px-3.5 py-2.5 text-left text-sm font-medium leading-relaxed focus-visible:outline-none",children:ye},ye))}),s.jsx("div",{ref:He,"aria-hidden":"true"})]}),oe.state==="human"&&s.jsx(Yae,{onEnd:oe.resume,disabled:oe.busy}),oe.active?s.jsx(Gae,{state:oe.state,onSend:oe.send,disabled:q,error:oe.error,reconnecting:oe.reconnecting,onTyping:oe.sendTyping}):W?s.jsx(Xae,{expert:e,signedIn:o,onAuthenticate:()=>G("register")}):s.jsx(Wrt,{value:$,onChange:O,onSend:(ye,Ze)=>Jt(ye,Ze),onStop:ke,disabled:!b||se||M||q,isStreaming:se,inputRef:X,onStartCall:b&&rt?De:void 0,placeholder:he?"Log in to start chatting...":a("chatPlaceholder"),expertId:m}),s.jsx(Vrt,{onLogin:o?void 0:()=>G("login")}),s.jsxs("aside",{id:"profile-conversations-drawer",role:"dialog","aria-modal":q?"true":void 0,"aria-label":"Menu","aria-hidden":!q,inert:!q,className:"absolute inset-y-0 right-0 z-30 flex w-[min(80%,18rem)] flex-col border-l border-rule bg-cream px-4 py-5 transition-transform duration-base ease-out will-change-transform motion-reduce:transition-none sm:w-[60%]",style:{transform:q?"translateX(0)":"translateX(100%)"},children:[s.jsxs("div",{className:"mb-4 flex flex-col gap-2 sm:hidden",children:[(!oe.config?.enabled||Re)&&s.jsx("button",{type:"button",onClick:()=>{U0(e.id),I("chat")},className:"pf-accent-focus inline-flex h-11 w-full items-center justify-center gap-2 rounded-xl border border-rule bg-paper text-sm font-semibold text-ink transition-colors hover:bg-cream-deep",children:"Contact"}),oe.config?.enabled&&!oe.active&&!Re&&s.jsx(j5,{name:oe.name,available:be,onClick:()=>{I("chat"),Je(!0)},onOffline:ue&&(()=>{I("chat"),ue()}),disabled:!j||!b,className:"pf-accent-focus inline-flex h-11 w-full items-center justify-center gap-2 rounded-xl border border-rule bg-paper text-sm font-semibold text-ink transition-colors hover:bg-cream-deep",iconSize:18}),s.jsx("button",{type:"button",onClick:()=>{A(ye=>!ye),I("chat")},className:"pf-accent-focus inline-flex h-11 w-full items-center justify-center gap-2 rounded-xl border border-rule bg-paper text-sm font-semibold text-ink transition-colors hover:bg-cream-deep","aria-pressed":N,children:N?s.jsxs(s.Fragment,{children:[s.jsx(qT,{size:18,strokeWidth:1.7,"aria-hidden":"true"}),"Exit full screen"]}):s.jsxs(s.Fragment,{children:[s.jsx(HT,{size:18,strokeWidth:1.7,"aria-hidden":"true"}),"Expand"]})})]}),s.jsx("h2",{className:"font-sans text-base font-semibold text-ink sm:text-lg",children:"Conversations"}),s.jsxs("button",{type:"button",onClick:$e,disabled:!b||se,className:"mt-4 inline-flex h-12 w-full shrink-0 items-center justify-center gap-1 rounded-lg px-2 text-xs font-semibold transition-[filter] duration-base ease-out hover:brightness-90 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-60 sm:gap-2 sm:px-4 sm:text-sm pf-accent-bg pf-accent-focus","aria-label":"New conversation",children:[s.jsx(Es,{size:17,strokeWidth:1.8,"aria-hidden":"true"}),s.jsx("span",{children:"New conversation"})]}),k?s.jsx("div",{className:"flex justify-center py-12",children:s.jsx(vt,{size:18,className:"animate-spin text-ink-muted motion-reduce:animate-none"})}):S.length===0?s.jsxs("div",{className:"px-2 py-12 text-center",children:[s.jsx("p",{className:"text-sm font-medium text-ink",children:"No conversations yet"}),s.jsx("p",{className:"mt-1 text-xs text-ink-muted",children:"Start a new chat whenever you're ready."})]}):s.jsxs("div",{className:"mt-5 min-h-0 flex-1 overflow-y-auto overscroll-contain",children:[s.jsx("p",{className:"px-1 text-xs font-medium text-ink-muted",children:"Recent"}),s.jsx("div",{className:"mt-2 space-y-1",children:S.map(ye=>s.jsx("button",{type:"button",onClick:()=>ct(ye.id),className:`pf-accent-focus block min-h-11 w-full truncate rounded-lg px-3 py-2.5 text-left text-sm font-medium transition-colors duration-base ease-out focus-visible:outline-none ${ye.id===j?"bg-ink/[0.07] text-ink":"text-ink-mid hover:bg-ink/[0.04]"}`,"aria-current":ye.id===j?"true":void 0,children:ye.title||"New conversation"},ye.id))})]})]})]})]}),s.jsx(Hae,{open:Oe,name:oe.name,defaultEmail:o&&!l?i?.email:"",busy:oe.busy,error:oe.error,onClose:()=>{Je(!1),oe.clearError()},onConfirm:async ye=>{await oe.request(ye)&&Je(!1)}}),s.jsx(FR,{open:!!H,mode:H||"login",expertId:m,conversationId:P.current?.conversationId||j,hasPendingQuestion:!!P.current,pendingAttachmentIds:(P.current?.attachments||[]).map(ye=>
528ye.id).filter(Boolean),onClose:()=>G(null),onSuccess:Ye}),qe,s.jsx("span",{className:"sr-only",children:l?"Anonymous chat session":"Account chat session"})]}):null}const tg=function(e,t){let a=e;const i=px[t];let o=null,l=0,c=null;const u=[],d={},h=function(_,k){l=a*4+17,o=(function(C){const N=new Array(C);for(let A=0;A<C;A+=1){N[A]=new Array(C);for(let T=0;T<C;T+=1)N[A][T]=null}return N})(l),p(0,0),p(l-7,0),p(0,l-7),x(),g(),y(_,k),a>=7&&b(_),c==null&&(c=j(a,i,u)),v(c,k)},p=function(_,k){for(let C=-1;C<=7;C+=1)if(!(_+C<=-1||l<=_+C))for(let N=-1;N<=7;N+=1)k+N<=-1||l<=k+N||(0<=C&&C<=6&&(N==0||N==6)||0<=N&&N<=6&&(C==0||C==6)||2<=C&&C<=4&&2<=N&&N<=4?o[_+C][k+N]=!0:o[_+C][k+N]=!1)},m=function(){let _=0,k=0;for(let C=0;C<8;C+=1){h(!0,C);const N=Mc.getLostPoint(d);(C==0||_>N)&&(_=N,k=C)}return k},g=function(){for(let _=8;_<l-8;_+=1)o[_][6]==null&&(o[_][6]=_%2==0);for(let _=8;_<l-8;_+=1)o[6][_]==null&&(o[6][_]=_%2==0)},x=function(){const _=Mc.getPatternPosition(a);for(let k=0;k<_.length;k+=1)for(let C=0;C<_.length;C+=1){const N=_[k],A=_[C];if(o[N][A]==null)for(let T=-2;T<=2;T+=1)for(let I=-2;I<=2;I+=1)T==-2||T==2||I==-2||I==2||T==0&&I==0?o[N+T][A+I]=!0:o[N+T][A+I]=!1}},b=function(_){const k=Mc.getBCHTypeNumber(a);for(let C=0;C<18;C+=1){const N=!_&&(k>>C&1)==1;o[Math.floor(C/3)][C%3+l-8-3]=N}for(let C=0;C<18;C+=1){const N=!_&&(k>>C&1)==1;o[C%3+l-8-3][Math.floor(C/3)]=N}},y=function(_,k){const C=i<<3|k,N=Mc.getBCHTypeInfo(C);for(let A=0;A<15;A+=1){const T=!_&&(N>>A&1)==1;A<6?o[A][8]=T:A<8?o[A+1][8]=T:o[l-15+A][8]=T}for(let A=0;A<15;A+=1){const T=!_&&(N>>A&1)==1;A<8?o[8][l-A-1]=T:A<9?o[8][15-A-1+1]=T:o[8][15-A-1]=T}o[l-8][8]=!_},v=function(_,k){let C=-1,N=l-1,A=7,T=0;const I=Mc.getMaskFunction(k);for(let $=l-1;$>0;$-=2)for($==6&&($-=1);;){for(let O=0;O<2;O+=1)if(o[N][$-O]==null){let U=!1;T<_.length&&(U=(_[T]>>>A&1)==1),I(N,$-O)&&(U=!U),o[N][$-O]=U,A-=1,A==-1&&(T+=1,A=7)}if(N+=C,N<0||l<=N){N-=C,C=-C;break}}},w=function(_,k){let C=0,N=0,A=0;const T=new Array(k.length),I=new Array(k.length);for(let F=0;F<k.length;F+=1){const H=k[F].dataCount,G=k[F].totalCount-H;N=Math.max(N,H),A=Math.max(A,G),T[F]=new Array(H);for(let D=0;D<T[F].length;D+=1)T[F][D]=255&_.getBuffer()[D+C];C+=H;const M=Mc.getErrorCorrectPolynomial(G),W=s0(T[F],M.getLength()-1).mod(M);I[F]=new Array(M.getLength()-1);for(let D=0;D<I[F].length;D+=1){const Z=D+W.getLength()-I[F].length;I[F][D]=Z>=0?W.getAt(Z):0}}let $=0;for(let F=0;F<k.length;F+=1)$+=k[F].totalCount;const O=new Array($);let U=0;for(let F=0;F<N;F+=1)for(let H=0;H<k.length;H+=1)F<T[H].length&&(O[U]=T[H][F],U+=1);for(let F=0;F<A;F+=1)for(let H=0;H<k.length;H+=1)F<I[H].length&&(O[U]=I[H][F],U+=1);return O},j=function(_,k,C){const N=bz.getRSBlocks(_,k),A=yz();for(let I=0;I<C.length;I+=1){const $=C[I];A.put($.getMode(),4),A.put($.getLength(),Mc.getLengthInBits($.getMode(),_)),$.write(A)}let T=0;for(let I=0;I<N.length;I+=1)T+=N[I].dataCount;if(A.getLengthInBits()>T*8)throw"code length overflow. ("+A.getLengthInBits()+">"+T*8+")";for(A.getLengthInBits()+4<=T*8&&A.put(0,4);A.getLengthInBits()%8!=0;)A.putBit(!1);for(;!(A.getLengthInBits()>=T*8||(A.put(236,8),A.getLengthInBits()>=T*8));)A.put(17,8);return w(A,N)};d.addData=function(_,k){k=k||"Byte";let C=null;switch(k){case"Numeric":C=Krt(_);break;case"Alphanumeric":C=Xrt(_);break;case"Byte":C=Jrt(_);break;case"Kanji":C=Qrt(_);break;default:throw"mode:"+k}u.push(C),c=null},d.isDark=function(_,k){if(_<0||l<=_||k<0||l<=k)throw _+","+k;return o[_][k]},d.getModuleCount=function(){return l},d.make=function(){if(a<1){let _=1;for(;_<40;_++){const k=bz.getRSBlocks(_,i),C=yz();for(let A=0;A<u.length;A++){const T=u[A];C.put(T.getMode(),4),C.put(T.getLength(),Mc.getLengthInBits(T.getMode(),_)),T.write(C)}let N=0;for(let A=0;A<k.length;A++)N+=k[A].dataCount;if(C.getLengthInBits()<=N*8)break}a=_}h(!1,m())},d.createTableTag=function(_,k){_=_||2,k=typeof k>"u"?_*4:k;let C="";C+='<table style="',C+=" border-width: 0px; border-style: none;",C+=" border-collapse: collapse;",C+=" padding: 0px; margin: "+k+"px;",C+='">',C+="<tbody>";for(let N=0;N<d.getModuleCount();N+=1){C+="<tr>";for(let A=0;A<d.getModuleCount();A+=1)C+='<td style="',C+=" border-width: 0px; border-style: none;",C+=" border-collapse: collapse;",C+=" padding: 0px; margin: 0px;",C+=" width: "+_+"px;",C+=" height: "+_+"px;",C+=" background-color: ",C+=d.isDark(N,A)?"#000000":"#ffffff",C+=";",C+='"/>';C+="</tr>"}return C+="</tbody>",C+="</table>",C},d.createSvgTag=function(_,k,C,N){let A={};typeof arguments[0]=="object"&&(A=arguments[0],_=A.cellSize,k=A.margin,C=A.alt,N=A.title),_=_||2,k=typeof k>"u"?_*4:k,C=typeof C=="string"?{text:C}:C||{},C.text=C.text||null,C.id=C.text?C.id||"qrcode-description":null,N=typeof N=="string"?{text:N}:N||{},N.text=N.text||null,N.id=N.text?N.id||"qrcode-title":null;const T=d.getModuleCount()*_+k*2;let I,$,O,U,F="",H;for(H="l"+_+",0 0,"+_+" -"+_+",0 0,-"+_+"z ",F+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',F+=A.scalable?"":' width="'+T+'px" height="'+T+'px"',F+=' viewB
528ox="0 0 '+T+" "+T+'" ',F+=' preserveAspectRatio="xMinYMin meet"',F+=N.text||C.text?' role="img" aria-labelledby="'+E([N.id,C.id].join(" ").trim())+'"':"",F+=">",F+=N.text?'<title id="'+E(N.id)+'">'+E(N.text)+"</title>":"",F+=C.text?'<description id="'+E(C.id)+'">'+E(C.text)+"</description>":"",F+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',F+='<path d="',O=0;O<d.getModuleCount();O+=1)for(U=O*_+k,I=0;I<d.getModuleCount();I+=1)d.isDark(O,I)&&($=I*_+k,F+="M"+$+","+U+H);return F+='" stroke="transparent" fill="black"/>',F+="</svg>",F},d.createDataURL=function(_,k){_=_||2,k=typeof k>"u"?_*4:k;const C=d.getModuleCount()*_+k*2,N=k,A=C-k;return sat(C,C,function(T,I){if(N<=T&&T<A&&N<=I&&I<A){const $=Math.floor((T-N)/_),O=Math.floor((I-N)/_);return d.isDark(O,$)?0:1}else return 1})},d.createImgTag=function(_,k,C){_=_||2,k=typeof k>"u"?_*4:k;const N=d.getModuleCount()*_+k*2;let A="";return A+="<img",A+=' src="',A+=d.createDataURL(_,k),A+='"',A+=' width="',A+=N,A+='"',A+=' height="',A+=N,A+='"',C&&(A+=' alt="',A+=E(C),A+='"'),A+="/>",A};const E=function(_){let k="";for(let C=0;C<_.length;C+=1){const N=_.charAt(C);switch(N){case"<":k+="<";break;case">":k+=">";break;case"&":k+="&";break;case'"':k+=""";break;default:k+=N;break}}return k},S=function(_){_=typeof _>"u"?2:_;const C=d.getModuleCount()*1+_*2,N=_,A=C-_;let T,I,$,O,U;const F={"ââ":"â","â ":"â"," â":"â"," ":" "},H={"ââ":"â","â ":"â"," â":" "," ":" "};let G="";for(T=0;T<C;T+=2){for($=Math.floor((T-N)/1),O=Math.floor((T+1-N)/1),I=0;I<C;I+=1)U="â",N<=I&&I<A&&N<=T&&T<A&&d.isDark($,Math.floor((I-N)/1))&&(U=" "),N<=I&&I<A&&N<=T+1&&T+1<A&&d.isDark(O,Math.floor((I-N)/1))?U+=" ":U+="â",G+=_<1&&T+1>=A?H[U]:F[U];G+=` 529`}return C%2&&_>0?G.substring(0,G.length-C-1)+Array(C+1).join("â"):G.substring(0,G.length-1)};return d.createASCII=function(_,k){if(_=_||1,_<2)return S(k);_-=1,k=typeof k>"u"?_*2:k;const C=d.getModuleCount()*_+k*2,N=k,A=C-k;let T,I,$,O;const U=Array(_+1).join("ââ"),F=Array(_+1).join(" ");let H="",G="";for(T=0;T<C;T+=1){for($=Math.floor((T-N)/_),G="",I=0;I<C;I+=1)O=1,N<=I&&I<A&&N<=T&&T<A&&d.isDark($,Math.floor((I-N)/_))&&(O=0),G+=O?U:F;for($=0;$<_;$+=1)H+=G+` 530`}return H.substring(0,H.length-1)},d.renderTo2dContext=function(_,k){k=k||2;const C=d.getModuleCount();for(let N=0;N<C;N++)for(let A=0;A<C;A++)_.fillStyle=d.isDark(N,A)?"black":"white",_.fillRect(A*k,N*k,k,k)},d};tg.stringToBytes=function(e){const t=[];for(let n=0;n<e.length;n+=1){const r=e.charCodeAt(n);t.push(r&255)}return t};tg.createStringToBytes=function(e,t){const n=(function(){const a=eat(e),i=function(){const c=a.read();if(c==-1)throw"eof";return c};let o=0;const l={};for(;;){const c=a.read();if(c==-1)break;const u=i(),d=i(),h=i(),p=String.fromCharCode(c<<8|u),m=d<<8|h;l[p]=m,o+=1}if(o!=t)throw o+" != "+t;return l})(),r=63;return function(a){const i=[];for(let o=0;o<a.length;o+=1){const l=a.charCodeAt(o);if(l<128)i.push(l);else{const c=n[a.charAt(o)];typeof c=="number"?(c&255)==c?i.push(c):(i.push(c>>>8),i.push(c&255)):i.push(r)}}return i}};const da={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},px={L:1,M:0,Q:3,H:2},Oc={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Mc=(function(){const e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t=1335,n=7973,r=21522,a={},i=function(o){let l=0;for(;o!=0;)l+=1,o>>>=1;return l};return a.getBCHTypeInfo=function(o){let l=o<<10;for(;i(l)-i(t)>=0;)l^=t<<i(l)-i(t);return(o<<10|l)^r},a.getBCHTypeNumber=function(o){let l=o<<12;for(;i(l)-i(n)>=0;)l^=n<<i(l)-i(n);return o<<12|l},a.getPatternPosition=function(o){return e[o-1]},a.getMaskFunction=function(o){switch(o){case Oc.PATTERN000:return function(l,c){return(l+c)%2==0};case Oc.PATTERN001:return function(l,c){return l%2==0}
530;case Oc.PATTERN010:return function(l,c){return c%3==0};case Oc.PATTERN011:return function(l,c){return(l+c)%3==0};case Oc.PATTERN100:return function(l,c){return(Math.floor(l/2)+Math.floor(c/3))%2==0};case Oc.PATTERN101:return function(l,c){return l*c%2+l*c%3==0};case Oc.PATTERN110:return function(l,c){return(l*c%2+l*c%3)%2==0};case Oc.PATTERN111:return function(l,c){return(l*c%3+(l+c)%2)%2==0};default:throw"bad maskPattern:"+o}},a.getErrorCorrectPolynomial=function(o){let l=s0([1],0);for(let c=0;c<o;c+=1)l=l.multiply(s0([1,Jc.gexp(c)],0));return l},a.getLengthInBits=function(o,l){if(1<=l&&l<10)switch(o){case da.MODE_NUMBER:return 10;case da.MODE_ALPHA_NUM:return 9;case da.MODE_8BIT_BYTE:return 8;case da.MODE_KANJI:return 8;default:throw"mode:"+o}else if(l<27)switch(o){case da.MODE_NUMBER:return 12;case da.MODE_ALPHA_NUM:return 11;case da.MODE_8BIT_BYTE:return 16;case da.MODE_KANJI:return 10;default:throw"mode:"+o}else if(l<41)switch(o){case da.MODE_NUMBER:return 14;case da.MODE_ALPHA_NUM:return 13;case da.MODE_8BIT_BYTE:return 16;case da.MODE_KANJI:return 12;default:throw"mode:"+o}else throw"type:"+l},a.getLostPoint=function(o){const l=o.getModuleCount();let c=0;for(let h=0;h<l;h+=1)for(let p=0;p<l;p+=1){let m=0;const g=o.isDark(h,p);for(let x=-1;x<=1;x+=1)if(!(h+x<0||l<=h+x))for(let b=-1;b<=1;b+=1)p+b<0||l<=p+b||x==0&&b==0||g==o.isDark(h+x,p+b)&&(m+=1);m>5&&(c+=3+m-5)}for(let h=0;h<l-1;h+=1)for(let p=0;p<l-1;p+=1){let m=0;o.isDark(h,p)&&(m+=1),o.isDark(h+1,p)&&(m+=1),o.isDark(h,p+1)&&(m+=1),o.isDark(h+1,p+1)&&(m+=1),(m==0||m==4)&&(c+=3)}for(let h=0;h<l;h+=1)for(let p=0;p<l-6;p+=1)o.isDark(h,p)&&!o.isDark(h,p+1)&&o.isDark(h,p+2)&&o.isDark(h,p+3)&&o.isDark(h,p+4)&&!o.isDark(h,p+5)&&o.isDark(h,p+6)&&(c+=40);for(let h=0;h<l;h+=1)for(let p=0;p<l-6;p+=1)o.isDark(p,h)&&!o.isDark(p+1,h)&&o.isDark(p+2,h)&&o.isDark(p+3,h)&&o.isDark(p+4,h)&&!o.isDark(p+5,h)&&o.isDark(p+6,h)&&(c+=40);let u=0;for(let h=0;h<l;h+=1)for(let p=0;p<l;p+=1)o.isDark(p,h)&&(u+=1);const d=Math.abs(100*u/l/l-50)/5;return c+=d*10,c},a})(),Jc=(function(){const e=new Array(256),t=new Array(256);for(let r=0;r<8;r+=1)e[r]=1<<r;for(let r=8;r<256;r+=1)e[r]=e[r-4]^e[r-5]^e[r-6]^e[r-8];for(let r=0;r<255;r+=1)t[e[r]]=r;const n={};return n.glog=function(r){if(r<1)throw"glog("+r+")";return t[r]},n.gexp=function(r){for(;r<0;)r+=255;for(;r>=256;)r-=255;return e[r]},n})(),s0=function(e,t){if(typeof e.length>"u")throw e.length+"/"+t;const n=(function(){let a=0;for(;a<e.length&&e[a]==0;)a+=1;const i=new Array(e.length-a+t);for(let o=0;o<e.length-a;o+=1)i[o]=e[o+a];return i})(),r={};return r.getAt=function(a){return n[a]},r.getLength=function(){return n.length},r.multiply=function(a){const i=new Array(r.getLength()+a.getLength()-1);for(let o=0;o<r.getLength();o+=1)for(let l=0;l<a.getLength();l+=1)i[o+l]^=Jc.gexp(Jc.glog(r.getAt(o))+Jc.glog(a.getAt(l)));return s0(i,0)},r.mod=function(a){if(r.getLength()-a.getLength()<0)return r;const i=Jc.glog(r.getAt(0))-Jc.glog(a.getAt(0)),o=new Array(r.getLength());for(let l=0;l<r.getLength();l+=1)o[l]=r.getAt(l);for(let l=0;l<a.getLength();l+=1)o[l]^=Jc.gexp(Jc.glog(a.getAt(l))+i);return s0(o,0).mod(a)},r},bz=(function(){const e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(a,i){const o={};return o.totalCount=a,o.dataCount=i,o},n={},r=function(a,i){switch(i){case px.L:return e[(a-1)*4+0];case px.M:return e[(a-1)*4+1];case px.Q:return e[(a-1)*4+2];case px.H:return e[(a-1)*4+3];default:return}};return n.getRSBlocks=function(a,i){const o=r(a,i);if(typeof o>"u")throw"bad rs block @ typeNumber:"+a+"/errorCorrectionLevel:"+i;const l=o.length/3,c=[];for(let u=0;u<l;u+=1){const d=o[u*3+0],h=o[u*3+1],p=o[u*3+2];for(let m=0;m<d;m+=1)c.push(t(h,p))}return c},n})(),yz=function(){const e=[];let t=0;const n={};return n.getBuffer=function(){return e},n.getAt=function(r){const a=Math.floor(r/8);return(e[a]>>>7-r%8&1)==1},n.put=function(r,a){for(let i=0;i<a;i+=1)n.putBit((r>>>a-i-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(r){const a=Math.floor(t/8);e.length<=a&&e.push(0),r&&(e[a]|=128>>>t%8),t+=1},n},Krt=function(e){const t=da.MODE_NUMBER,n=e,r={};r.getMode=function(){return t},r.getLength=function(o){return n.length},r.write=function(o){const l=n;let c=0;for(;c+2<l.length;)o.put(a(l.substring(c,c+3)),10),c+=3;c<l.length&&(l.length-c==1?o.put(a(l.substring(c,c+1)),4):l.length-c==2&&o.put(a(l.substring(c,c+2)),7))};const a=function(o){let l=0;for(let c=0;c<o.length;c+=1)l=l*10+i(o.charAt(c));return l}
530,i=function(o){if("0"<=o&&o<="9")return o.charCodeAt(0)-48;throw"illegal char :"+o};return r},Xrt=function(e){const t=da.MODE_ALPHA_NUM,n=e,r={};r.getMode=function(){return t},r.getLength=function(i){return n.length},r.write=function(i){const o=n;let l=0;for(;l+1<o.length;)i.put(a(o.charAt(l))*45+a(o.charAt(l+1)),11),l+=2;l<o.length&&i.put(a(o.charAt(l)),6)};const a=function(i){if("0"<=i&&i<="9")return i.charCodeAt(0)-48;if("A"<=i&&i<="Z")return i.charCodeAt(0)-65+10;switch(i){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+i}};return r},Jrt=function(e){const t=da.MODE_8BIT_BYTE,n=tg.stringToBytes(e),r={};return r.getMode=function(){return t},r.getLength=function(a){return n.length},r.write=function(a){for(let i=0;i<n.length;i+=1)a.put(n[i],8)},r},Qrt=function(e){const t=da.MODE_KANJI,n=tg.stringToBytes;(function(i,o){const l=n(i);if(l.length!=2||(l[0]<<8|l[1])!=o)throw"sjis not supported."})("å",38726);const r=n(e),a={};return a.getMode=function(){return t},a.getLength=function(i){return~~(r.length/2)},a.write=function(i){const o=r;let l=0;for(;l+1<o.length;){let c=(255&o[l])<<8|255&o[l+1];if(33088<=c&&c<=40956)c-=33088;else if(57408<=c&&c<=60351)c-=49472;else throw"illegal char at "+(l+1)+"/"+c;c=(c>>>8&255)*192+(c&255),i.put(c,13),l+=2}if(l<o.length)throw"illegal char at "+(l+1)},a},eie=function(){const e=[],t={};return t.writeByte=function(n){e.push(n&255)},t.writeShort=function(n){t.writeByte(n),t.writeByte(n>>>8)},t.writeBytes=function(n,r,a){r=r||0,a=a||n.length;for(let i=0;i<a;i+=1)t.writeByte(n[i+r])},t.writeString=function(n){for(let r=0;r<n.length;r+=1)t.writeByte(n.charCodeAt(r))},t.toByteArray=function(){return e},t.toString=function(){let n="";n+="[";for(let r=0;r<e.length;r+=1)r>0&&(n+=","),n+=e[r];return n+="]",n},t},Zrt=function(){let e=0,t=0,n=0,r="";const a={},i=function(l){r+=String.fromCharCode(o(l&63))},o=function(l){if(l<0)throw"n:"+l;if(l<26)return 65+l;if(l<52)return 97+(l-26);if(l<62)return 48+(l-52);if(l==62)return 43;if(l==63)return 47;throw"n:"+l};return a.writeByte=function(l){for(e=e<<8|l&255,t+=8,n+=1;t>=6;)i(e>>>t-6),t-=6},a.flush=function(){if(t>0&&(i(e<<6-t),e=0,t=0),n%3!=0){const l=3-n%3;for(let c=0;c<l;c+=1)r+="="}},a.toString=function(){return r},a},eat=function(e){const t=e;let n=0,r=0,a=0;const i={};i.read=function(){for(;a<8;){if(n>=t.length){if(a==0)return-1;throw"unexpected end of file./"+a}const c=t.charAt(n);if(n+=1,c=="=")return a=0,-1;if(c.match(/^\s$/))continue;r=r<<6|o(c.charCodeAt(0)),a+=6}const l=r>>>a-8&255;return a-=8,l};const o=function(l){if(65<=l&&l<=90)return l-65;if(97<=l&&l<=122)return l-97+26;if(48<=l&&l<=57)return l-48+52;if(l==43)return 62;if(l==47)return 63;throw"c:"+l};return i},tat=function(e,t){const n=e,r=t,a=new Array(e*t),i={};i.setPixel=function(u,d,h){a[d*n+u]=h},i.write=function(u){u.writeString("GIF87a"),u.writeShort(n),u.writeShort(r),u.writeByte(128),u.writeByte(0),u.writeByte(0),u.writeByte(0),u.writeByte(0),u.writeByte(0),u.writeByte(255),u.writeByte(255),u.writeByte(255),u.writeString(","),u.writeShort(0),u.writeShort(0),u.writeShort(n),u.writeShort(r),u.writeByte(0);const d=2,h=l(d);u.writeByte(d);let p=0;for(;h.length-p>255;)u.writeByte(255),u.writeBytes(h,p,255),p+=255;u.writeByte(h.length-p),u.writeBytes(h,p,h.length-p),u.writeByte(0),u.writeString(";")};const o=function(u){const d=u;let h=0,p=0;const m={};return m.write=function(g,x){if(g>>>x)throw"length over";for(;h+x>=8;)d.writeByte(255&(g<<h|p)),x-=8-h,g>>>=8-h,p=0,h=0;p=g<<h|p,h=h+x},m.flush=function(){h>0&&d.writeByte(p)},m},l=function(u){const d=1<<u,h=(1<<u)+1;let p=u+1;const m=c();for(let v=0;v<d;v+=1)m.add(String.fromCharCode(v));m.add(String.fromCharCode(d)),m.add(String.fromCharCode(h));const g=eie(),x=o(g);x.write(d,p);let b=0,y=String.fromCharCode(a[b]);for(b+=1;b<a.length;){const v=String.fromCharCode(a[b]);b+=1,m.contains(y+v)?y=y+v:(x.write(m.indexOf(y),p),m.size()<4095&&(m.size()==1<<p&&(p+=1),m.add(y+v)),y=v)}return x.write(m.indexOf(y),p),x.write(h,p),x.flush(),g.toByteArray()},c=function(){const u={};let d=0;const h={};return h.add=function(p){if(h.contains(p))throw"dup key:"+p;u[p]=d,d+=1},h.size=function(){return d},h.indexOf=function(p){return u[p]},h.contains=function(p){return typeof u[p]<"u"},h};return i},sat=function(e,t,n){const r=tat(e,t);for(let l=0;l<t;l+=1)for(let c=0;c<e;
530c+=1)r.setPixel(c,l,n(c,l));const a=eie();r.write(a);const i=Zrt(),o=a.toByteArray();for(let l=0;l<o.length;l+=1)i.writeByte(o[l]);return i.flush(),"data:image/gif;base64,"+i};tg.stringToBytes;function nat(e){return f.useMemo(()=>{const t=tg(0,"M");t.addData(e),t.make();const n=t.getModuleCount();let r="";for(let a=0;a<n;a+=1)for(let i=0;i<n;i+=1)t.isDark(a,i)&&(r+=`M${i} ${a}h1v1h-1z`);return{d:r,count:n}},[e])}function rat({url:e,dodge:t=!1,force:n=!1}){const{d:r,count:a}=nat(e);return s.jsxs("div",{className:`absolute bottom-5 right-5 z-[45] w-40 rounded-2xl border border-black/10 bg-white p-3 shadow-[0_8px_30px_rgba(20,20,19,0.16)] ${n?"block":"hidden lg:block"}${t?" 2xl:right-[19.5rem]":""}`,children:[s.jsx("p",{className:"text-[13px] font-semibold leading-snug text-[#1C1917]",children:"Open on your phone"}),s.jsxs("svg",{viewBox:`0 0 ${a} ${a}`,role:"img","aria-label":"QR code that opens this page",className:"mt-2.5 block w-full rounded-md",shapeRendering:"crispEdges",children:[s.jsx("rect",{width:a,height:a,fill:"#FFFFFF"}),s.jsx("path",{d:r,fill:"#1C1917"})]})]})}function aat({size:e=24,className:t=""}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",className:t,"aria-hidden":"true",focusable:"false",children:[s.jsx("g",{transform:"translate(-1.5 2) scale(0.8)",children:s.jsx("path",{fill:"currentColor",stroke:"none",d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),s.jsx("path",{d:"M13.4 8.6a3.2 3.2 0 0 1 3.2 3.2"}),s.jsx("path",{d:"M13.4 5.4a6.4 6.4 0 0 1 6.4 6.4"}),s.jsx("path",{d:"M13.4 2.4a9.4 9.4 0 0 1 9.4 9.4"})]})}const iat=[64,127,87];function ao(e,t,n=iat){const[r,a,i]=bu(e,n);return`rgba(${r}, ${a}, ${i}, ${t})`}function oat(e){return{"--call-color":e,"--call-color-88":ao(e,.88),"--call-color-94":ao(e,.94),"--call-color-55":ao(e,.55),"--call-color-65":ao(e,.65),"--call-color-50":ao(e,.5),"--call-color-60":ao(e,.6),"--call-color-40":ao(e,.4),"--call-color-75":ao(e,.75),"--call-color-12":ao(e,.12),"--call-color-25":ao(e,.25)}}function vz({expert:e,creatorName:t,variant:n=0,color:r=null,label:a=""}){const{isAuthenticated:i}=Ut(),o=sp(),[l,c]=f.useState(!1),{startCall:u,callUi:d}=Vk(e,{onLimitReached:()=>c(!0),onSessionError:()=>c(!0)});if(!e)return null;const h=(t||"").trim()||"this creator",p=a||cI(t),m=u,g=aj[n]||aj[0],x=o("callSubline")||(i?"Voice · 24/7 available and instant":"Voice · free to start"),b="transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/70 focus-visible:ring-offset-0",y=r?oat(r):void 0,v=r?_f(bu(r))?"#FFFFFF":"#141413":void 0,w=r?{background:r,color:v}:void 0,j=r?{borderColor:r,color:r}:void 0,E=r?{"--call-tint":ao(r,.12)}:void 0,S=(k=!1)=>s.jsxs("button",{type:"button",onClick:m,"aria-label":`Start a voice call with ${e.name}`,className:`pf-call-bar-glass mt-4 w-full min-h-[70px] rounded-2xl flex items-center gap-3.5 px-4 py-3 text-left active:scale-[0.99] ${k?"is-warm":""} ${b}`,style:y,children:[s.jsx("span",{className:"pf-call-bar-disc shrink-0 w-10 h-10 rounded-full flex items-center justify-center",style:{color:k?void 0:v},children:s.jsx(aat,{size:22,className:k||v?"":"text-[#E8F0EA]"})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{style:{color:k?void 0:v},className:`block text-[17px] sm:text-lg font-bold tracking-tight ${k?"text-ink":"text-white"}`,children:p}),s.jsx("span",{style:{color:k?void 0:v},className:`block text-xs sm:text-[13px] mt-0.5 ${k?"text-ink-mid":"text-white/80"}`,children:x})]})]}),_=({tone:k="sage"})=>{const C=k==="ink";return s.jsxs("button",{type:"button",onClick:m,"aria-label":`${p}, voice line open 24/7`,className:`pf-call-glass mt-4 w-full max-w-xl mx-auto min-h-[56px] px-6 py-3 rounded-full flex items-center justify-center gap-2.5 text-base font-semibold tracking-tight leading-snug text-center text-white active:scale-[0.99] ${C?"is-ink":"is-sage"} ${b}`,style:{...y,color:C?void 0:v},children:[s.jsx(Ts,{size:18,className:`shrink-0 ${C?"text-[#A3C4B0]":v?"":"text-white/90"}`,strokeWidth:2,"aria-hidden":"true"}),s.jsx("span",{className:"min-w-0 [text-wrap:balance]",children:p})]})};return s.jsxs(s.Fragment,{children:[g==="icon"?s.jsx("button",{type:"button",onClick:m,"aria-label":p,title:p,className:`w-11 h-11 flex items-center justify-center rounded-full pf-call-icon ${b}`,style:y,children:s.jsx(Ts,{size:24,"aria-hidden":"true"})}):g==="compact"?s.jsxs("button",{type:"button",onClick:m,"aria-label":p,className:`pf-call-compact mt-4 inline-flex items-center gap-2 min-h-[42px] px-5 py-2 rounded-full text-center leading-snug border border-sage text-sm font-medium text-sage-deep hover:bg-sage-tint active:scale-[0.98] ${b}`,style:{...j,...E},children:[s.jsx(Ts,{size:16,className:"shrink-0","aria-hidden":"true"}),p]}):g==="ink"?_({tone:"ink"}):g==="row"?s.jsxs("button",{type:"button",onClick:m,"aria-label":`Start a voice call with ${e.name}`,className:`mt-4 w-full flex items-center gap-3 bg-paper border border-rule rounded-2xl pl-4 pr-2.5 py-2.5 text-left hover:shadow-card active:scale-[0.995] ${b}`,children:[s.jsxs("span",{className:"flex-1 min-w-0",children:[s.jsxs("span",{className:"block text-[15px] font-semibold tracking-tight text-ink",children:[h," AI"]}),s.jsx("span",{className:"block text-[11.5px] text-ink-muted mt-0.5",children:x})]}
530),s.jsxs("span",{className:"shrink-0 h-[42px] px-4 rounded-full bg-sage text-white text-sm font-semibold inline-flex items-center gap-1.5",style:w,children:[s.jsx(Ts,{size:16,"aria-hidden":"true"}),o("callPill")]})]}):g==="warm"?S(!0):g==="bar"?S(!1):_({tone:"sage"}),l&&!i&&s.jsx("div",{className:"fixed inset-0 z-[80]",children:s.jsx(bae,{expertName:e.name,onClose:()=>c(!1)})}),d]})}function lat({size:e=22}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:s.jsx("path",{d:"M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-5.2 1.74 2.89 2.89 0 0 1 2.31-4.64 2.93 2.93 0 0 1 .88.13V9.4a6.84 6.84 0 0 0-1-.05A6.33 6.33 0 0 0 5 20.1a6.34 6.34 0 0 0 10.86-4.43v-7a8.16 8.16 0 0 0 4.77 1.52v-3.4a4.85 4.85 0 0 1-1-.1z"})})}const wz={instagram:Eve,youtube:z4,tiktok:lat,x:g0,linkedin:pY,facebook:oY,whatsapp:k_,spotify:E4,github:ove,calendly:N_,web:vc},jz={instagram:"#E1306C",youtube:"#FF0000",tiktok:"#FE2C55",x:"#000000",linkedin:"#0A66C2",facebook:"#1877F2",github:"#000000",calendly:"#006BFF"};function cat({socials:e=[],website:t="",contact:n="",leading:r=null,tone:a="default",className:i="",iconSize:o=26}){const l=p=>{const{key:m,label:g}=Gb(p);return{href:p,key:m,Icon:wz[m]||wz.web,label:g}},c=e.map(l);t&&c.push(l(t));const u=(n||"").trim();if(/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u)&&c.push({href:`mailto:${u}`,key:"mail",Icon:qr,label:`Email ${u}`}),c.length===0&&!r)return null;const d=a==="onPhoto",h=d?"w-11 h-11 flex items-center justify-center rounded-full text-cream/95 hover:text-white hover:bg-white/15 transition-colors":"w-11 h-11 flex items-center justify-center rounded-full pf-accent-icon transition-colors";return s.jsxs("nav",{"aria-label":"Links",className:`flex flex-wrap items-center justify-center gap-1 ${d?"mt-3":"mt-3.5"}${i?` ${i}`:""}`,children:[r,c.map((p,m)=>s.jsx("a",{href:p.href,target:p.href.startsWith("mailto:")?void 0:"_blank",rel:"noopener noreferrer","aria-label":p.label,title:p.label,className:h,style:!d&&jz[p.key]?{"--pf-brand-hover":jz[p.key]}:void 0,children:p.key==="x"?s.jsx(p.Icon,{size:o,color:"currentColor","aria-hidden":"true"}):s.jsx(p.Icon,{size:o,"aria-hidden":"true"})},`${p.href}-${m}`))]})}const aL=Dn.div,uat={sm:"text-[1.25rem] sm:text-[1.375rem] leading-snug",md:"text-[1.625rem] sm:text-[1.875rem] leading-tight",lg:"text-[2rem] sm:text-[2.5rem] leading-tight"},dat={sm:"pf-profile-logo-sm",md:"pf-profile-logo-md",lg:"pf-profile-logo-lg"},hat={sm:"text-[12px] sm:text-[14px] leading-5 sm:leading-6",md:"text-[13px] sm:text-[16px] leading-5 sm:leading-6",lg:"text-[15px] sm:text-[18px] leading-6 sm:leading-7"},pat={sm:"text-[12px] sm:text-[14px] leading-relaxed",md:"text-[13px] sm:text-[16px] leading-relaxed",lg:"text-[15px] sm:text-[18px] leading-6 sm:leading-7"};function Ov(e,t){const n=VA.includes(e)?e:"md";return t[n]}function mat({creator:e,identity:t,logoUrl:n,className:r,nameType:a,logoType:i,color:o}){const[l,c]=f.useState(!1),u=t==="logo"&&!!n&&!l;return s.jsx("h1",{className:`${r} ${u?"":`${a} whitespace-pre-wrap`}`,style:!u&&o?{color:o}:void 0,children:u?s.jsx("img",{src:n,alt:e.full_name,className:`pf-profile-logo ${i}`,onError:()=>c(!0)}):e.full_name})}function iL({src:e,name:t,initialsClass:n="text-4xl"}){return e?s.jsx("img",{src:e,alt:t,className:"w-full h-full object-cover"}):s.jsx("div",{className:`w-full h-full flex items-center justify-center font-heading font-medium text-cream ${n}`,children:FY(t)||"?"})}function Kk({creator:e,roles:t,split:n=!1,nameClass:r="",nameSize:a="md",bioSize:i="md",nameColor:o=null,bioColor:l=null,identity:c="name",logoUrl:u=null,showName:d=!0,showRoles:h=!0,bioRef:p,bioOverflows:m,bioExpanded:g,onToggleBio:x,socials:b,callExpert:y,callVariant:v,callColor:w,callLabel:j,callInRow:E,darkSurface:S=!1,heroMode:_=!1}){const k=Ov(a,uat),C=Ov(a,dat),N=Ov(i,hat),A=Ov(i,pat),T="mt-2.5",I=_?"mt-2":"mt-2.5",$=l?{color:l}:void 0,O=t.length===1?t[0]:t.join(" · ");return s.jsxs("div",{className:n?"pf-hero-body is-split min-w-0 flex-1 flex flex-col justify-center items-center text-center":"pf-hero-body w-full flex flex-col items-center text-center",children:[d&&s.jsx(mat,{creator:e,identity:c,logoUrl:u,className:r,nameType:k,logoType:C,color:o},u||"name"),h&&O&&s.jsx("p",{className:`${T} ${N} text-center text-ink-muted whitespace-pre-wrap`,style:$,children:O}),e.bio&&s.jsxs(s.Fragment,{children:[s.jsx("p",{ref:p,className:`text-ink-mid ${A} ${t.length?I:T} text-center whitespace-pre-wrap max-w-xl mx-auto ${g?"":"line-clamp-3"}`,style:$,children:e.bio}
530),(m||g)&&s.jsx("button",{type:"button","data-preview-safe":!0,onClick:x,"aria-expanded":g,"aria-label":g?"Show less":"Show full description",title:g?"Show less":"Show full description",className:"mt-1 w-11 h-8 flex items-center justify-center rounded-full transition-colors text-slate-400 pf-accent-hover-text pf-accent-hover-wash",children:s.jsx(Is,{size:18,"aria-hidden":"true",className:`transition-transform duration-300 ${g?"rotate-180":""}`})})]}),s.jsx("div",{children:s.jsx(cat,{socials:b,website:e.website,contact:e.contact,tone:S?"onPhoto":"default",iconSize:_?28:26,className:n?"pf-hero-socials-split":"",leading:E?s.jsx(vz,{expert:y,creatorName:e.full_name,variant:2,color:w,label:j}):null})}),!E&&s.jsx(vz,{expert:y,creatorName:e.full_name,variant:v,color:w,label:j})]})}const oL=e=>e?{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}}:{initial:{opacity:0,y:18},animate:{opacity:1,y:0},transition:{duration:.5,ease:[.16,1,.3,1]}},_z={arch:"w-44 sm:w-56 aspect-[4/5] rounded-t-full rounded-b-2xl",blob:"w-44 h-44 sm:w-56 sm:h-56 ph-blob",hex:"w-44 h-44 sm:w-52 sm:h-52 ph-hex",circle:"w-44 h-44 sm:w-56 sm:h-56 rounded-full",rounded:"w-44 h-44 sm:w-56 sm:h-56 rounded-[2rem] sm:rounded-[2.75rem]",diamond:"w-44 h-44 sm:w-52 sm:h-52 ph-diamond"};function fat({layout:e,creator:t,photoSrc:n,heroRef:r,...a}){const i=e===1,o=e===2;return s.jsxs("div",{ref:r,"data-sec":"header",className:`pf-classic-hero${i?" is-split":""} relative mb-8 pt-10 sm:pt-12 flex ${i?"flex-row items-center text-center gap-3 sm:gap-6":"flex-col items-center text-center"}`,children:[s.jsx("div",{className:`shrink-0 overflow-hidden bg-ink ring-1 ring-ink/10 ${o?"w-full max-w-[300px] aspect-[4/5] rounded-2xl":i?"rounded-full w-20 h-20 min-[360px]:w-24 min-[360px]:h-24 sm:w-56 sm:h-56":"rounded-full w-44 h-44 sm:w-56 sm:h-56"}`,children:s.jsx(iL,{src:n,name:t.full_name,initialsClass:o?"text-6xl":"text-6xl sm:text-7xl"})}),s.jsx(Kk,{creator:t,split:i,nameClass:`font-heading font-medium tracking-tight text-ink ${o?"mt-4":""} ${i?"mt-0":o?"":"mt-4 sm:mt-5"}`,...a})]})}function gat({creator:e,photoSrc:t,palette:n=null,headerStyle:r=null,heroRef:a,reduceMotion:i,accentVars:o,bleed:l=!1,...c}){const u=qk(r,n),d=!!fu(r),h={...o||{},"--ph-surface-rgb":u.rgb},p="linear-gradient(to bottom, black 0%, black 30%, rgba(0,0,0,.97) 36%, rgba(0,0,0,.92) 42%, rgba(0,0,0,.84) 48%, rgba(0,0,0,.72) 54%, rgba(0,0,0,.58) 60%, rgba(0,0,0,.42) 66%, rgba(0,0,0,.28) 71%, rgba(0,0,0,.16) 75%, rgba(0,0,0,.07) 79%, rgba(0,0,0,.02) 83%, transparent 88%)";return s.jsx("div",{ref:a,"data-sec":"header","data-hero-surface":u.mode,"data-hero-tone":u.dark?"dark":"light",className:"relative mb-8",style:h,children:s.jsxs(aL,{...oL(i),className:`relative${l?"":" -mx-4 sm:-mx-10 -mt-8 sm:-mt-10"}`,style:{background:d?"transparent":"rgb(var(--ph-surface-rgb))"},children:[s.jsxs("div",{className:"relative",style:d?{WebkitMaskImage:p,maskImage:p}:void 0,children:[s.jsx("img",{src:t,alt:e.full_name,className:"block w-full aspect-square object-cover object-top"}),d?null:s.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 pointer-events-none",style:{background:"linear-gradient(to bottom, rgb(var(--ph-surface-rgb) / 0) 30%, rgb(var(--ph-surface-rgb) / .03) 36%, rgb(var(--ph-surface-rgb) / .08) 42%, rgb(var(--ph-surface-rgb) / .16) 48%, rgb(var(--ph-surface-rgb) / .28) 54%, rgb(var(--ph-surface-rgb) / .42) 60%, rgb(var(--ph-surface-rgb) / .58) 66%, rgb(var(--ph-surface-rgb) / .72) 71%, rgb(var(--ph-surface-rgb) / .84) 75%, rgb(var(--ph-surface-rgb) / .93) 79%, rgb(var(--ph-surface-rgb) / .98) 83%, rgb(var(--ph-surface-rgb) / 1) 88%)"}})]}),s.jsx("div",{className:"relative z-[1] -mt-[18%] px-5 pb-2 sm:px-10 sm:pb-4 text-center",children:s.jsx(Kk,{creator:e,...c,darkSurface:u.dark,heroMode:!0,nameClass:"font-heading font-medium tracking-tight text-ink"})})]})})}function xat({bannerUrl:e,creator:t,photoSrc:n,palette:r,headerStyle:a=null,heroRef:i,reduceMotion:o,accentVars:l,bleed:c=!1,...u}){const d=qk(a,r),h=!!fu(a),p=`rgb(${d.rgb.replace(/ /g,", ")})`,m=h?"transparent":d.mode==="match"&&r?`linear-gradient(135deg, ${sc(r.soft)} 0%, ${sc(r.accent,.55)} 48%, ${sc(r.deep,.35)} 100%)`:p;return s.jsxs("div",{ref:i,"data-sec":"header","data-hero-tone":d.dark?"dark":"light",className:"relative mb-8",style:{...l||{},"--ph-surface-rgb":d.rgb},children:[s.jsx(aL,{...oL(o),className:`relative h-36 sm:h-48${c?"":" -mx-4 sm:-mx-10 -mt-8 sm:-mt-10"}`,style:{background:h?"transparent":p},children:s.jsx("div",{className:"absolute inset-0 overflow-hidden",style:{WebkitMaskImage:"linear-gradient(to bottom, black 0%, black 28%, rgba(0,0,0,.96) 38%, rgba(0,0,0,.88) 48%, rgba(0,0,0,.72) 58%, rgba(0,0,0,.52) 68%, rgba(0,0,0,.32) 78%, rgba(0,0,0,.14) 88%, rgba(0,0,0,.04) 95%, transparent 100%)",maskImage:"linear-gradient(to bottom, black 0%, black 28%, rgba(0,0,0,.96) 38%, rgba(0,0,0,.88) 48%, rgba(0,0,0,.72) 58%, rgba(0,0,0,.52) 68%, rgba(0,0,0,.32) 78%, rgba(0,0,0,.14) 88%, rgba(0,0,0,.04) 95%, transparent 100%)",background:m},children:e?s.jsx("img",{src:e,alt:"",className:"w-full h-full object-cover"}):null})}),s.jsxs("div",{className:"relative -mt-14 sm:-mt-16 flex flex-col items-center text-center",children:[s.jsx("div",{className:`shrink-0 overflow-hidden bg-ink rounded-full w-24 h-24 sm:w-32 sm:h-32 shadow-elevation ring-4 ${d.dark?"ring-white/15":"ring-paper"}`,children:s.jsx(iL,{src:n,name:t.full_name})}),s.jsx(Kk,{creator:t,darkSurface:d.dark,nameClass:"font-heading font-medium tracking-tight mt-4 text-ink",...u})]})]})}function bat({shape:e,shapeColor:t,creator:n,photoSrc:r,heroRef:a,reduceMotion:i,accentVars:o,...l}){const c=_z[e]||_z.arch,u=e==="hex"||e==="diamond";return s.jsxs("div",{ref:a,"data-sec":"header",className:"relative mb-8 pt-10 sm:pt-12 flex flex-col items-center text-center",style:o,children:[s.jsxs(aL,{...oL(i),className:"relative mb-4",children:[s.jsx("div",{"aria-hidden":"true",className:`absolute inset-0 translate-x-3 translate-y-3 ${c}`,style:{background:t||"#E6C3B3"}}),s.jsx("div",{className:`relative overflow-hidden bg-ink ${u?"":"ring-1 ring-ink/10"} ${c}`,children:s.jsx(iL,{src:r,name:n.full_name,initialsClass:"text-6xl"})})]}),s.jsx(Kk,{creator:n,nameClass:"font-heading font-medium tracking-tight text-ink mt-4",...l})]})}function yat({layout:e=0,headerStyle:t=null,palette:n=null,creator:r,roles:a=[],socials:i=[],callExpert:o=null,callVariant:l=0,callColor:c=null,callLabel:u="",callInRow:d=!1,bi
530oRef:h,bioOverflows:p=!1,bioExpanded:m=!1,onToggleBio:g,heroRef:x,reduceMotion:b=!1,bleed:y=!1}){const v=Ba({headerStyle:t}),w=uI({headerStyle:v},r?.avatar_url||r?.expert_avatar_url),j=e===3&&!w?0:e,E=e0(fu(v)),S=fu(v)?E:n,_=n?{"--ph-accent":sc(n.deep),"--ph-soft":sc(n.soft)}:void 0,k={roles:a,socials:i,callExpert:o,callVariant:l,callColor:c,callLabel:u,callInRow:d,bioRef:h,bioOverflows:p,bioExpanded:m,onToggleBio:g,nameSize:v.nameSize,bioSize:v.bioSize,nameColor:v.nameColor,bioColor:v.bioColor,identity:v.identity,logoUrl:v.logoUrl};return j===3?s.jsx(gat,{creator:r,photoSrc:w,palette:S,headerStyle:v,roles:a,heroRef:x,reduceMotion:b,accentVars:_,bleed:y,...k}):j===4?s.jsx(xat,{bannerUrl:v.bannerUrl,creator:r,photoSrc:w,palette:S,headerStyle:v,heroRef:x,reduceMotion:b,accentVars:_,bleed:y,...k}):j===5?s.jsx(bat,{shape:v.shape,shapeColor:v.shapeColor,creator:r,photoSrc:w,heroRef:x,reduceMotion:b,accentVars:_,...k}):s.jsx(fat,{layout:j,creator:r,photoSrc:w,heroRef:x,...k})}function vat({tabs:e,active:t,onChange:n,dark:r=!1,compactLabels:a=null}){const i=f.useRef(null),o=f.useRef(null),l=zu();f.useLayoutEffect(()=>{const u=i.current,d=o.current;if(!u||!d)return;const h=()=>{const m=u.querySelector('[role="tab"][aria-selected="true"]');m&&(d.style.setProperty("--pf-tab-x",`${m.offsetLeft}px`),d.style.setProperty("--pf-tab-width",`${m.offsetWidth}px`),d.dataset.ready="true")};h();const p=new ResizeObserver(h);return p.observe(u),u.querySelectorAll('[role="tab"]').forEach(m=>p.observe(m)),()=>p.disconnect()},[t,e]),f.useEffect(()=>{const u=i.current,d=u?.querySelector('[role="tab"][aria-selected="true"]');if(!u||!d)return;const h=Math.max(0,u.scrollWidth-u.clientWidth),p=d.offsetLeft+d.offsetWidth/2-u.clientWidth/2,m=Math.min(h,Math.max(0,p));Math.abs(u.scrollLeft-m)>1&&u.scrollTo({left:m,behavior:l?"auto":"smooth"})},[t,l]);const c=u=>{const d=e.findIndex(p=>p.key===t);let h=-1;u.key==="ArrowRight"?h=(d+1)%e.length:u.key==="ArrowLeft"?h=(d-1+e.length)%e.length:u.key==="Home"?h=0:u.key==="End"&&(h=e.length-1),!(h<0)&&(u.preventDefault(),n(e[h].key),i.current?.querySelectorAll('[role="tab"]')[h]?.focus())};return s.jsxs("div",{ref:i,role:"tablist","aria-label":"Profile sections","data-preview-safe":!0,onKeyDown:c,className:`pf-tabs ${r?"is-dark":"is-light"} flex w-full overflow-x-auto overflow-y-hidden no-scrollbar`,children:[s.jsx("span",{ref:o,className:"pf-tab-slider","aria-hidden":"true"}),e.map(u=>{const d=t===u.key;return s.jsx("button",{type:"button",role:"tab","aria-selected":d,"aria-controls":"profile-sections","aria-label":u.label,tabIndex:d?0:-1,onClick:()=>n(u.key),className:`pf-tab${d?" is-active":""} min-h-11 shrink-0 px-4 py-2.5 text-sm whitespace-nowrap sm:flex-1`,children:u.mobileLabel&&a===!0?s.jsx("span",{"aria-hidden":"true",children:u.mobileLabel}):u.mobileLabel&&a===!1?s.jsx("span",{"aria-hidden":"true",children:u.label}):u.mobileLabel?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"sm:hidden","aria-hidden":"true",children:u.mobileLabel}),s.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:u.label})]}):u.label},u.key)})]})}function wat({creator:e,onDismiss:t}){return s.jsxs("aside",{"aria-label":"Create your profile",className:"relative w-full rounded-2xl border border-rule bg-paper shadow-2xl px-4 pt-5 pb-4 text-center",children:[s.jsx("button",{type:"button",onClick:t,"aria-label":"Dismiss",className:"absolute top-1 right-1 w-10 h-10 flex items-center justify-center rounded-full text-slate-400 hover:text-ink hover:bg-cream-deep transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo",children:s.jsx(as,{size:16,"aria-hidden":"true"})}),s.jsxs("div",{className:"flex items-center justify-center -space-x-3 mb-3","aria-hidden":"true",children:[s.jsx("span",{className:"flex rounded-full p-0.5 bg-paper",children:s.jsx(ws,{name:e.full_name,size:"xl",src:e.avatar_url})}),s.jsx("span",{className:"flex items-center justify-center w-12 h-12 rounded-full bg-paper border border-rule shadow-sm",children:s.jsx(bn,{variant:"markFlat",height:22})})]}),s.jsx("p",{className:"font-heading font-medium text-base text-ink leading-snug",children:"Now imagine this page is yours"}),s.jsx("p",{className:"text-xs text-slate-500 leading-relaxed mt-1.5",children:"Your posts, your voice, your offers. Set up in minutes."}),s.jsx(Le,{to:Me.CREATE_EXPERT,className:"mt-4 w-full inline-flex items-center justify-center px-4 py-3 rounded-xl text-sm font-medium bg-indigo text-cream hover:bg-indigo-deep transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo focus-visible:ring-offset-2",children:"Create your profile"})]})}async function jat(e,{getCreator:t,getConfig:n}){const[r,a]=await Promise.allSettled([t(e),n(e)]);return{data:r.status==="fulfilled"?r.value?.data??null:null,config:a.status==="fulfilled"?a.value:null,notFound:r.status==="rejected"}}function _at(e,t,n=null){if(!t||typeof t!="object")return null;const r=String(t.id||e||""),a=n?.id===r&&(n.username||n.slug)||"",i=String(t.username||"").trim()||String(t.slug||"").trim()||String(a).trim();return{user:{id:r,username:i,slug:i,full_name:String(t.full_name||t.name||"Your profile"),bio:typeof t.bio=="string"?t.bio:"",avatar_url:typeof t.avatar_url=="string"?t.avatar_url:""},experts:Array.isArray(t.experts)?t.experts:[]}}
530const kz=Dn.div,Nz="gx_profile_nudge_dismissed",tie=j1;function Ez(e,{duration:t=1600,block:n="center"}={}){if(!e)return;const r=e.closest(".overflow-y-auto")||document.scrollingElement;if(!r){e.scrollIntoView({behavior:"smooth",block:n});return}const a=r===document.scrollingElement?{top:0}:r.getBoundingClientRect(),i=e.getBoundingClientRect(),o=r.scrollTop,l=i.top-a.top+o,c=r===document.scrollingElement?window.innerHeight:r.clientHeight,u=n==="start"?l:Math.max(0,l-(c-i.height)/2),d=Math.max(0,r.scrollHeight-c),p=Math.min(d,Math.max(0,u))-o;if(Math.abs(p)<2)return;const m=performance.now(),g=b=>b<.5?4*b*b*b:1-(-2*b+2)**3/2,x=b=>{const y=Math.min(1,(b-m)/t);r.scrollTop=o+p*g(y),y<1&&requestAnimationFrame(x)};requestAnimationFrame(x)}function Sz(){const{id:e,slug:t}=Ef(),n=e||t,[r]=gl(),a=r.get("preview")==="1",i=a&&r.get("preview_source")==="parent",o=a&&r.get("agent_mock")==="1",l=a?r.get("device"):null,c=l==="mobile"?!0:l==="desktop"||l==="laptop"?!1:null,u=a?r.get("chrome"):null;f.useEffect(()=>{if(u!=="iphone")return;const pt=document.documentElement;return pt.classList.add("device-preview-mobile"),()=>pt.classList.remove("device-preview-mobile")},[u]);const{user:d,isLoading:h}=Ut(),{creator:p}=Yh(),m=!!d,[g,x]=f.useState(null),[b,y]=f.useState(!0),[v,w]=f.useState(!1),[j,E]=f.useState(null),[S,_]=f.useState(null),[k,C]=f.useState(null),[N,A]=f.useState(null),[T,I]=f.useState(null),$=f.useRef(null),[O,U]=f.useState(!1),[F,H]=f.useState(!1),[G,M]=f.useState("all"),[z,W]=f.useState(""),[D,Z]=f.useState({text:"",nonce:0}),V=f.useRef(null),[L,K]=f.useState(!1),te=f.useRef(null),[Q,Y]=f.useState(!1),[J,P]=f.useState(!1),[ee,X]=f.useState(()=>{try{return localStorage.getItem(Nz)==="1"}catch{return!1}}),ae=f.useRef(0),me=f.useRef(null),q=!!d?.id&&n===d.id,he=f.useRef(null),se=zu(),le=a&&N||k,ke=Ih(le||{},"header"),oe=Ba(le||{}),Oe=a&&T&&(T.avatar_url||T.expert_avatar_url)||g?.user?.avatar_url,Je=uI(le||{},Oe),ue=(oe.pageBg==="match"||oe.autoColor||ke===4&&!oe.bannerUrl||oe.componentColorMode!=="custom"&&!!Je)&&(ke===4&&oe.bannerUrl||Je)||null,be=e0(ue),Re=e0(fu(oe)),Ge=V3e(oe,Yst(be))||tie,it=JR(oe.font);Uk(oe.font),f.useEffect(()=>{if(!a||window.parent===window)return;const pt=Ot=>{if(Dx(Ot,mI)&&A(Ot.data.config),Dx(Ot,fI)){const Hs=Ot.data.profile;if(I(Hs),i){const vn=_at(n,Hs,p);vn&&(x(vn),w(!1),y(!1))}}};return window.addEventListener("message",pt),window.parent.postMessage({type:pI},window.location.origin),()=>window.removeEventListener("message",pt)},[a,n,i,p]),f.useEffect(()=>{if(!a||window.parent===window)return;let pt,Ot,Hs=null;const vn=on=>{if(!Dx(on,yQ))return;const $n=p5e(on.data.key);if(!$n)return;clearTimeout(pt);let oi=0;const Pe=()=>{const At=document.querySelector($n);if(!At){++oi<10&&(pt=setTimeout(Pe,60));return}At.scrollIntoView({behavior:se?"auto":"smooth",block:"start"}),clearTimeout(Ot),Hs?.classList.remove("pf-flash"),At.classList.remove("pf-flash"),At.offsetWidth,At.classList.add("pf-flash"),Hs=At,Ot=setTimeout(()=>At.classList.remove("pf-flash"),1800)};Pe()};return window.addEventListener("message",vn),()=>{window.removeEventListener("message",vn),clearTimeout(pt),clearTimeout(Ot)}},[a,se]),f.useEffect(()=>{if(i)return;const pt=++ae.current;return Promise.resolve().then(()=>{pt===ae.current&&(y(!0),w(!1),x(null),C(null),E(null),_(null),Z({text:"",nonce:0}),M("all"))}),jat(n,{getCreator:Bnt,getConfig:yD}).then(Ot=>{pt===ae.current&&(C(Ot.config),Ot.notFound?w(!0):x(Ot.data),y(!1))}),()=>{pt===ae.current&&(ae.current+=1)}},[n,i]),f.useEffect(()=>{if(i)return;let pt=!1;const Ot=Hs=>{Hs.detail?.userId===g?.user?.id&&yD(n).then(vn=>{pt||C(vn)}).catch(()=>{})};return window.addEventListener("profile-media-ready",Ot),()=>{pt=!0,window.removeEventListener("profile-media-ready",Ot)}},[n,i,g?.user?.id]),f.useEffect(()=>{!v||!q||(x({user:d,experts:[]}),w(!1))},[v,q,d]),f.useEffect(()=>{const pt=g?.user?.id;h||b||v||a||!pt||d?.id===pt||me.current!==pt&&(me.current=pt,sR(K_e({creatorId:pt,sessionKey:Y_e()})))},[h,g,b,a,v,d?.id]),f.useEffect(()=>{const pt=$.current;pt&&U(pt.scrollHeight>pt.clientHeight+1)},[g,T]),f.useEffect(()=>{const pt=V.current;
530if(!pt)return;const Ot=new IntersectionObserver(([Hs])=>K(!Hs.isIntersecting));return Ot.observe(pt),()=>Ot.disconnect()},[g]),f.useEffect(()=>{const pt=te.current;if(!pt)return;const Ot=new IntersectionObserver(([Hs])=>Y(Hs.isIntersecting));return Ot.observe(pt),()=>Ot.disconnect()},[g]),f.useEffect(()=>{let pt=null,Ot=!1;const Hs=()=>{const on=document.getElementById("profile-chat");return!on||Ot?!1:(pt=new IntersectionObserver(([$n])=>P($n.isIntersecting&&$n.intersectionRatio>.12),{threshold:[0,.12,.25,.5]}),pt.observe(on),!0)};if(Hs())return()=>{Ot=!0,pt?.disconnect()};P(!1);const vn=setInterval(()=>{Hs()&&clearInterval(vn)},120);return()=>{Ot=!0,clearInterval(vn),pt?.disconnect()}},[g,le,S]),f.useEffect(()=>{const pt=window.location.hash.slice(1);if(!pt||!le)return;const Ot=document.getElementById(pt);if(!Ot)return;const Hs=Ot.closest(".overflow-y-auto")||document.scrollingElement;let vn=-1,on=0;const $n=()=>{Ot.scrollIntoView({block:"start"});const At=Hs?.scrollHeight??0;(At===vn||++on>12)&&clearInterval(oi),vn=At};$n();const oi=setInterval($n,120);Ot.classList.add("pf-flash");const Pe=setTimeout(()=>Ot.classList.remove("pf-flash"),1800);return()=>{clearInterval(oi),clearTimeout(Pe)}},[le]),f.useEffect(()=>(j?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[j]);const ut=vQ(g?.experts||[],a&&Array.isArray(T?.experts)?T.experts:[]),$t=wa(le||{}),tt=pt=>$t.some(Ot=>mn(Ot)===pt),He=Xh(ut,le),wt=XR(He,le?.featuredExpertId||(le?.profileExperts?.length?He[0]?.id:"")),St=a?v3e:Qw,Zt=tt("expert")?St(wt)?wt:He.find(St)||null:null,Jt=Vk(Zt),$e={background:Ge,font:it,isPreview:a,previewDevice:l};if(b||!g&&q)return s.jsx(qS,{...$e,background:"#FFFFFF",children:s.jsx(C_,{className:"grid h-full place-items-center px-6",label:"Loading profile"})});if(v||!g)return s.jsxs(qS,{...$e,children:[s.jsx(vs,{title:"Creator not found",description:"This creator doesn't exist or has no public content.",noIndex:!0}),s.jsxs("div",{className:"max-w-3xl mx-auto px-4 pt-24 text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-white border border-rule rounded-xl mb-4",children:s.jsx(F4,{className:"w-8 h-8 text-slate-400"})}),s.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Creator not found"}),s.jsx("p",{className:"text-slate-500 mb-6",children:"This creator doesn't exist or has no public content."}),s.jsx(Le,{to:"/creators",className:"text-sm text-indigo-deep hover:underline",children:"Back to Creators"})]})]});const Qe=a&&T?{...g.user,...typeof T.full_name=="string"?{full_name:T.full_name}:{},...typeof T.bio=="string"?{bio:T.bio}:{},...typeof T.avatar_url=="string"?{avatar_url:T.avatar_url}:{},...typeof T.expert_avatar_url=="string"?{expert_avatar_url:T.expert_avatar_url}:{}}:g.user,ct={...Qe,full_name:lI(le||{},Qe?.full_name)},ve=!!(d?.id&&ct?.id&&d.id===ct.id),Ye=ZR(ct.full_name).split(" ")[0]||"this creator",rt=ke,De=Uf(le||{}),qe=ph(le||{}),ye=ak(le||{}),Ze=KA(le||{})==="icon",jt=(le?.roles||[]).map(pt=>eI(pt,140)).filter(Boolean).slice(0,3),Nt=qk(oe,fu(oe)?Re:be),ne=`rgb(${Nt.rgb.replace(/ /g,", ")})`,ge=Nt.dark===!0,xe=gae(oe,be,Nt),pe={"--pf-accent-rgb":xe.accent.join(" "),"--pf-accent-deep-rgb":xe.deep.join(" "),"--pf-accent-on-rgb":xe.on.join(" "),"--pf-accent-stroke-rgb":xe.accentStroke.join(" "),"--pf-accent-muted-rgb":xe.accentMuted.join(" "),"--pf-component-soft-rgb":xe.soft.join(" "),"--pf-component-border-rgb":xe.border.join(" "),"--pf-elevated-soft-rgb":xe.elevatedSoft.join(" "),"--pf-elevated-accent-text-rgb":xe.elevatedAccentText.join(" "),"--pf-ink-rgb":xe.ink.join(" "),"--pf-ink-mid-rgb":xe.inkMid.join(" "),"--pf-ink-muted-rgb":xe.inkMuted.join(" "),"--pf-rule-rgb":xe.rule.join(" "),"--pf-product-bar-rgb":xe.accent.join(" "),"--pf-product-bar-on-rgb":xe.on.join(" "),"--pf-floating-surface-rgb":xe.floatingSurface.join(" "),"--pf-floating-on-rgb":xe.floatingOn.join(" "),"--pf-floating-muted-rgb":xe.floatingMuted.join(" ")},Ne=le?.items||[],Ue=tt("services")&&le?.steps?.services&&(le.services||[]).length>0,dt=tt("products")&&Ne.some(pt=>pt.type==="product"),Xe=tt("media")&&Ne.some(pt=>["video","podcast","post","resource"].includes(pt.type)),xt=(pt,Ot)=>
530af(le||{},pt,Ot),et=pt=>{switch(mn(pt)){case"expert":return He.length>0?{key:"experts",label:xt("expert",WA)}:null;case"services":return Ue?{key:"services",label:xt("services","Services")}:null;case"media":return Xe?{key:"media",label:xt("media","Content")}:null;case"products":return dt?{key:"products",label:xt("products","Shop")}:null;default:return null}},st=new Set,_t=wa(le||{}).map(et).filter(pt=>!pt||st.has(pt.key)?!1:(st.add(pt.key),!0)),zt=_t.length>=2,us=(pt="")=>{const Ot=String(pt||"").trim();M("all"),P(!0),Ot&&(Z(Hs=>({text:Ot,nonce:Hs.nonce+1})),W("")),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const Hs=document.getElementById("profile-chat");se?Hs?.scrollIntoView({block:"center"}):Ez(Hs,{duration:1600,block:"center"}),Ot||setTimeout(()=>{Hs?.querySelector("input, textarea")?.focus({preventScroll:!0})},se?0:1650)})})},ms=pt=>{pt?.preventDefault?.();const Ot=z.trim();if(!Ot){us();return}us(Ot)},We=()=>{Jt.canCall?Jt.startCall():us()},Dt=pt=>se?{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15}}:{initial:{opacity:0,y:pt},animate:{opacity:1,y:0},exit:{opacity:0,y:pt},transition:{duration:.32,ease:"easeOut"}},Ds=()=>{X(!0);try{localStorage.setItem(Nz,"1")}catch{}},Ys=pt=>{pt?.id&&(E(null),Z({text:"",nonce:0}),_(pt.id),M("all"),P(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const Ot=document.getElementById("profile-chat");se?Ot?.scrollIntoView({block:"start"}):Ez(Ot,{duration:760,block:"start"})})}))},Ks=Ih(le||{},"expert"),{expert:is,visible:es}=w3e(He,wt,S,Ks),Fs=He.filter(pt=>pt.id!==wt?.id),fn=Ks===1?He.length>0:He.length>=2,Gn=Fs.length>2,Xs=z3e(le||{}),fs=pa(le,"chatNow"),Lt=pt=>s.jsx("div",{className:"space-y-3",children:pt.map(Ot=>s.jsx(kat,{expert:Ot,clamp:Xs,chatLabel:fs,onClick:()=>E(Ot),onChat:()=>Ys(Ot)},Ot.id))}),yr=af(le||{},"expert",WA),ta=yr,Js=fn&&s.jsx("section",{"aria-label":ta,className:"mb-16",children:Ks===1||Fs.length<=2?Lt(Ks===1?He:Fs):s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:he,className:`gap-3 sm:gap-4 -mt-2 pt-5 ${Gn?"grid grid-flow-col auto-cols-[82%] sm:auto-cols-[calc((100%-1rem)/2)] overflow-x-auto overflow-y-hidden snap-x snap-mandatory pb-2 -mx-1 px-1 no-scrollbar scroll-smooth":"grid grid-cols-2"}`,children:Fs.map(pt=>s.jsx(Nat,{expert:pt,clamp:Xs,chatLabel:pa(le,"chatMini"),onClick:()=>E(pt),onChat:()=>Ys(pt)},pt.id))}),Gn&&s.jsx(t0,{scrollRef:he,label:"experts"})]})}),vr=He.length>0&&s.jsxs("div",{"data-sec":"expert",className:"scroll-mt-24",children:[s.jsx(wm,{title:yr,color:of(le||{},"expert")}),es&&(o?s.jsx(Grt,{expert:is},is.id):s.jsx(Yrt,{expert:is,creatorName:ct.full_name,seedMessage:D.text,seedNonce:D.nonce,previewStarters:a?h5e(T?.startersByExpert,is.id):null},is.id)),Js]}),er=es&&tt("expert"),Ha=L&&!Q&&!J&&er&&(Ue||dt||Xe)&&le?.floatingAsk!==!1,to=s.jsx(Ei,{children:Ha&&s.jsx(kz,{...Dt(24),className:"absolute bottom-5 inset-x-0 z-50 flex justify-center px-4 pointer-events-none",children:s.jsxs("form",{"data-preview-safe":!0,onSubmit:ms,className:"pf-floating-ask pointer-events-auto w-full max-w-md
530sm:max-w-lg flex items-center gap-2 pl-2 pr-2 py-2 rounded-full backdrop-blur-md border",children:[s.jsx(ws,{name:is.name,size:"md",variant:"expert",src:is.avatar_url,className:"shrink-0"}),s.jsx("input",{type:"text",value:z,onChange:pt=>W(pt.target.value),placeholder:sj(le||{}),"aria-label":"Ask anything",className:"pf-floating-input flex-1 min-w-0 bg-transparent text-left italic text-sm sm:text-base px-1.5 py-1.5 rounded-full outline-none focus-visible:ring-0"}),Zt&&le?.floatingAskCall!==!1&&s.jsx("button",{type:"button",onClick:We,"aria-label":`Start a voice call with ${Zt.name}`,title:`Talk to ${Zt.name}`,className:"shrink-0 w-11 h-11 inline-flex items-center justify-center rounded-full bg-sage text-cream hover:bg-sage-deep active:scale-[0.97] transition-all",style:qe?{background:qe}:void 0,children:s.jsx(Ts,{size:18,strokeWidth:1.85,"aria-hidden":"true"})}),s.jsx("button",{type:"submit","aria-label":z.trim()?`Send message to ${Ye}'s AI`:`Open chat with ${Ye}'s AI`,className:"pf-floating-submit shrink-0 w-11 h-11 inline-flex items-center justify-center rounded-full active:scale-[0.97] transition-all disabled:opacity-50",children:s.jsx(rl,{size:18,"aria-hidden":"true"})})]})},"floating-ask")}),Ec=!m&&!ee&&s.jsx(Ei,{children:(L||Q)&&s.jsx(kz,{...Dt(40),className:`absolute z-40 justify-center inset-x-4 bottom-6 2xl:inset-x-auto 2xl:right-8 2xl:bottom-8 2xl:w-60 ${Q?"flex":"hidden 2xl:flex"}`,children:s.jsx("div",{className:"w-full max-w-xs",children:s.jsx(wat,{creator:ct,onDismiss:Ds})})})}),ii={...le?.pageText||{},chatPlaceholder:sj(le||{})};return s.jsx(kP.Provider,{value:ii,children:s.jsxs(qS,{...$e,ownerView:ve&&!a,themeStyle:pe,overlay:s.jsxs(hz,{active:a,children:[to,Ec,(!a||l==="laptop")&&s.jsx(rat,{url:ll(ct),dodge:!m&&!ee&&(L||Q),force:l==="laptop"})]}),children:[s.jsxs(hz,{active:a,className:"pf-page-wrap max-w-2xl mx-auto px-4 sm:px-8 pt-12 pb-8 sm:pt-16 sm:pb-12",children:[s.jsx(vs,{title:or.creator.title(ct.full_name),description:or.creator.description(ct.full_name),path:Th(ct),ogImage:or.creator.image(ct.username||ct.slug||ct.id)}),(()=>{const pt=rt===3||rt===4,Ot=fu(oe),Hs=Ot?`url("${String(Ot).replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`:"",vn={background:ne,"--pf-surface":ne,...Hs?{"--pf-ground-image":Hs}:{}},on=s.jsxs(s.Fragment,{children:[zt&&s.jsx("div",{className:`pf-tabs-wrap py-2 mb-8 ${pt?"px-4 sm:px-10":"-mx-4 sm:-mx-10 px-4 sm:px-10"}${Ot?" pf-tabs-wrap--ground":""}`,style:Ot?void 0:{background:ne},children:s.jsx(vat,{tabs:[{key:"all",label:pa(le,"tabAll")},..._t],active:G,onChange:M,dark:ge,compactLabels:c})}),s.jsx("div",{id:"profile-sections",role:"tabpanel","aria-label":"Profile content",children:s.jsx(Lrt,{creator:ct,expertsSlot:vr,cfg:le,activeTab:G,trackClicks:!h&&!a&&!ve,contactThemeStyle:Vst(xe)})}),s.jsx("div",{ref:te,className:"h-px","aria-hidden":"true"}),!m&&ct?.show_badge!==!1&&s.jsxs("footer",{className:"mt-10 pt-6 border-t border-rule flex flex-col sm:flex-row items-center justify-between gap-4",children:[s.jsxs("p",{className:"text-xs text-slate-400",children:["Powered by"," ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",className:"font-semibold transition-colors text-slate-500 pf-accent-hover-text",children:"Great Experts"})]}),s.jsxs(Le,{to:Me.CREATE_EXPERT,target:a?"_blank":void 0,rel:a?"noopener noreferrer":void 0,className:"inline-flex items-center gap-1.5 px-3.5 py-2 rounded-xl text-sm font-medium border transition-colors border-rule text-slate-600 pf-accent-hover-border pf-accent-hover-text",children:[s.jsx(Ms,{size:14,className:"pf-accent-text","aria-hidden":"true"})," Create your own Expert"]})]})]});return s.jsxs("div",{className:"pf-page-card-shell",children:[s.jsxs("header",{className:"pf-chrome",children:[s.jsx(Le,{to:"/",target:a?"_blank":void 0,rel:a?"noopener noreferrer":void 0,"aria-label":"Great Experts home",className:"pf-chrome-btn",children:s.jsx("img",{src:"/brand/ge-mark.png",alt:"",className:"pf-chrome-ge",width:33,height:33,draggable:!1})}),s.jsxs("div",{className:"pf-chrome-actions",children:[ve&&!a&&s.jsx(Le,{to:Me.PUBLIC_PAGE,"aria-label":"Edit my page",title:"Edit my page",className:"pf-chrome-btn pf-chrome-btn--edit",children:s.jsx(Mu,{size:17,strokeWidth:2.1,"aria-hidden":"true"})}),s.jsx(Eat,{url:ll(ct),subjectName:ct.full_name,preview:a})]})]}),s.jsxs("div",{className:`pf-page-card relative${pt?" pf-page-card--bleed":" px-4 sm:px-10 py-8 sm:py-10"}${ge?" pf-page-card--dark":""}`,"data-pf-tone":ge?"dark":"light","data-component-color":xe.mode,style:vn,children:[Ot&&s.jsx("div",{className:"pf-card-ground-wrap","aria-hidden":"true",children:s.jsx("div",{className:"pf-card-ground"})}),s.jsxs("div",{className:"pf-card-ground-content",children:[s.jsx(yat,{heroRef:V,layout:rt,headerStyle:oe,palette:be,creator:ct,roles:jt,socials:le?.socials||[],callExpert:Zt,callVariant:De,callColor:qe,callLabel:ye,callInRow:Ze,bio
530Ref:$,bioOverflows:O,bioExpanded:F,onToggleBio:()=>H($n=>!$n),reduceMotion:se,bleed:pt}),pt?s.jsx("div",{className:"px-4 sm:px-10 pb-8 sm:pb-10",children:on}):on]})]})]})})()]}),Jt.callUi,j&&s.jsx(en,{isOpen:!0,onClose:()=>E(null),title:pa(le,"expertProfile"),children:s.jsxs("div",{className:"p-6 relative",children:[s.jsx("div",{className:"flex items-center justify-between mb-6",children:s.jsx(X0,{expert:j})}),s.jsxs("div",{className:"text-center mb-6",children:[s.jsx("div",{className:"mx-auto mb-4",children:s.jsx(ws,{name:j.name,size:"2xl",variant:"expert",src:j.avatar_url})}),s.jsx("h3",{className:"text-2xl font-bold text-slate-900 dark:text-white mb-1",children:j.name}),j.tagline&&s.jsx("p",{className:"text-sm text-slate-500 dark:text-neutral-400",children:j.tagline})]}),j.description&&s.jsxs("div",{className:"rounded-xl bg-slate-50 dark:bg-white/5 mb-6 relative",children:[s.jsx("div",{className:"p-4 max-h-40 overflow-y-auto custom-scrollbar",children:s.jsx("p",{className:"text-sm leading-relaxed text-slate-600 dark:text-neutral-300",children:j.description})}),(j.description?.length||0)>300&&s.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-paper to-transparent rounded-b-xl pointer-events-none"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-6 mb-6 text-sm text-slate-500 dark:text-neutral-400",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ea,{size:14})," ",j.answer_count||0," answers"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(eo,{size:14})," ",j.thumbs_up||0]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(wc,{size:14})," ",j.thumbs_down||0]})]}),s.jsxs("button",{onClick:()=>Ys(j),className:"pf-accent-bg w-full py-3 rounded-md font-medium flex items-center justify-center gap-2 hover:opacity-90 transition-opacity duration-300 ease-standard",children:[s.jsx(ea,{size:18})," ",pa(le,"openChat")]})]})})]})})}function qS({overlay:e=null,background:t=tie,font:n=null,isPreview:r=!1,previewDevice:a=null,ownerView:i=!1,themeStyle:o=null,children:l}){const c=r?` no-scrollbar${a==="mobile"?" pf-preview-mobile":a==="desktop"||a==="laptop"?" pf-preview-desktop":""}`:"";return s.jsx("div",{className:`h-[100dvh] flex overflow-hidden pf-page-root${i?" pf-page-root--owner":" bg-paper"}`,style:o||void 0,children:s.jsxs("div",{className:"relative flex-1 min-w-0 h-full",children:[s.jsx("div",{className:`pf-page-scroll h-full overflow-y-auto animate-fade-in ${n?"pf-page-font":""}${i?" pf-page-scroll--owner":""}${c}`,style:n?{background:t,fontFamily:n}:{background:t},children:l}),e]})})}function sie({expert:e,size:t}){return s.jsx(ws,{name:e.name,size:t,variant:"expert",src:e.avatar_url,className:"shrink-0"})}
530function kat({expert:e,clamp:t="line-clamp-2",featured:n=!1,chatLabel:r="Chat now",onClick:a,onChat:i}){const o=s.jsxs("button",{type:"button",onClick:a,"aria-label":`View ${e.name}'s profile`,className:`pf-accent-focus flex gap-3 sm:gap-4 min-w-0 flex-1 text-left rounded-xl focus-visible:outline-none ${n?"items-start":"items-center"}`,children:[s.jsx(sie,{expert:e,size:"2xl"}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"flex items-center gap-1.5",children:s.jsx("h3",{className:"font-heading font-medium text-base sm:text-lg text-ink truncate",children:e.name})}),s.jsx("span",{className:`${t||"block"} text-sm text-slate-500 leading-relaxed mt-0.5`,children:e.description||e.tagline})]})]}),l=s.jsx("button",{type:"button",onClick:i,className:`pf-accent-bg px-4 sm:px-5 py-3 rounded-full text-sm font-medium hover:opacity-90 active:scale-[0.98] transition-all whitespace-nowrap ${n?"w-full sm:w-auto":"shrink-0 hidden sm:block"}`,children:r});return n?s.jsxs("div",{className:"pf-component-card rounded-2xl border p-4 sm:p-5 pf-accent-hover-border hover:shadow-md transition-all",children:[o,s.jsx("div",{className:"mt-4 flex sm:justify-end",children:l})]}):s.jsxs("div",{className:"pf-component-card rounded-2xl border p-4 sm:p-5 pf-accent-hover-border hover:shadow-md transition-all",children:[s.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[o,l]}),s.jsx("div",{className:"mt-3 sm:hidden",children:s.jsx("button",{type:"button",onClick:i,className:"pf-accent-bg w-full py-3 rounded-full text-sm font-medium active:scale-[0.98] transition-all",children:r})})]})}function Nat({expert:e,clamp:t="line-clamp-2",chatLabel:n="Chat",onClick:r,onChat:a}){return s.jsxs("div",{className:"pf-component-card snap-start h-full flex flex-col rounded-2xl border p-4 pf-accent-hover-border hover:shadow-md hover:-translate-y-0.5 transition-all",children:[s.jsxs("button",{type:"button",onClick:r,"aria-label":`View ${e.name}'s profile`,className:"pf-accent-focus text-left rounded-xl focus-visible:outline-none",children:[s.jsx(sie,{expert:e,size:"xl"}),s.jsx("span",{className:"flex items-center gap-1.5 mt-2.5",children:s.jsx("h3",{className:"font-heading font-medium text-[15px] text-ink truncate",children:e.name})}),s.jsx("span",{className:`${t||"block"} text-xs text-slate-500 leading-relaxed mt-1`,children:e.description||e.tagline})]}),s.jsxs("button",{type:"button",onClick:a,"aria-label":`Chat with ${e.name}`,className:"pf-accent-text pf-accent-focus mt-auto pt-3 -ml-2 self-start inline-flex items-center gap-1.5 px-2 py-2 rounded-lg text-sm font-medium hover:opacity-80 transition-colors",children:[n," ",s.jsx(xn,{size:14,"aria-hidden":"true"})]})]})}function Eat({url:e,subjectName:t="this page",preview:n=!1}){const[r,a]=f.useState(!1),i=ZR(t)||"this page";return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":"Share this profile",title:"Share this profile",className:"pf-chrome-btn",children:s.jsx(Q1e,{size:17,strokeWidth:2.1,"aria-hidden":"true"})}),s.jsx(K0,{isOpen:r,onClose:()=>a(!1),subjectName:i,url:e,headline:n?"Your page is live":`Share ${i}`,subline:n?"Anyone with this link can chat with your AI, book you and buy your work.":`Know someone who'd find this useful? Send ${i} their way.`,blurb:`Chat with ${i}'s AI, see what they offer and book them.`})]})}async function Sat(){return(await Se.post("/payments/payouts")).data}function Cat({isOpen:e,onClose:t,amountUsd:n,onSuccess:r}){const[a,i]=f.useState("confirm"),[o,l]=f.useState(""),c=()=>{i("confirm"),l("")},u=()=>{a==="success"&&r?.(),t(),setTimeout(c,250)},d=async()=>{i("submitting");try{await Sat(),i("success")}catch(m){l(m.response?.data?.detail?.message||"Something went wrong. Please try again later."),i("error")}},h="inline-flex items-center justify-center gap-2 px-6 py-2.5 rounded-md text-sm font-medium bg-indigo text-cream hover:bg-indigo-deep transition-colors duration-300 ease-standard disabled:opacity-60 disabled:cursor-not-allowed",p="inline-flex items-center justify-center px-6 py-2.5 rounded-md text-sm font-medium bg-indigo-wash text-indigo-deep border border-indigo hover:bg-indigo hover:text-cream transition-colors duration-300 ease-standard disabled:opacity-60 disabled:cursor-not-allowed";return s.jsxs(en,{isOpen:e,onClose:u,title:a==="success"?void 0:"Request payout",children:[(a==="confirm"||a==="submitting")&&s.jsxs("div",{children:[s.jsxs("p",{className:"text-sm text-ink",children:["You are requesting a payout of"," ",s.jsxs("span",{className:"font-medium text-indigo-deep",style:{fontFeatureSettings:'"tnum" 1, "lnum" 1'},children:["$",Number(n||0).toFixed(2)]})," ","â your full accrued balance."]}),s.jsx("p",{className:"mt-3 text-xs text-ink-muted",children:"Payouts are reviewed and processed manually by our team. You can submit one payout request every 30 days."}),s.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[s.jsx("button",{type:"button",onClick:u,disabled:a==="submitting",className:p,children:"Cancel"}),s.jsxs("button",{type:"button",onClick:d,disabled:a==="submitting",className:h,children:[a==="submitting"&&s.jsx(vt,{className:"w-4 h-4 animate-spin"}),a==="submitting"?"Submittingâ¦":"Confirm request"]})]})]}),a==="success"&&s.jsxs("div",{className:"text-center pt-2",children:[s.jsxs("div",{className:"flex items-center justify-center gap-3",children:[s.jsx("span",{className:"inline-flex items-center justify-center w-11 h-11 rounded-full bg-indigo-wash shrink-0",children:s.jsx(pc,{className:"w-5 h-5 text-indigo"})}),s.jsx("h2",{className:"font-heading text-2xl sm:text-3xl font-medium text-ink tracking-tight",children:"Payout request received"})]}),s.jsx("p",{className:"mt-5 text-ink-mid",children:"Your request has been sent to our Finance Team."}),s.jsx("p",{className:"mt-4 text-ink-mid",children:"You'll get an email shortly with the next steps. Make sure to check your spam folder, just in case."}),s.jsxs("p",{className:"mt-4 text-ink-mid",children:["No email after a few days?",s.jsx("br",{}),"Email"," ",s.jsx("a",{href:"mailto:[email protected]",className:"text-indigo underline hover:text-indigo-deep",children:"[email protected]"}),"."]}),s.jsxs("button",{type:"button",onClick:u,className:"mt-7 w-full inline-flex items-center justify-center gap-2 px-6 py-3.5 rounded-full text-sm font-medium bg-indigo text-cream hover:bg-indigo-deep transition-colors duration-300 ease-standard",children:[s.jsx(pc,{className:"w-4 h-4"}),"Got it - back to Earnings"]})]}),a==="error"&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-ink",children:o}),s.jsx("div",{className:"mt-6 flex justify-end",children:s.jsx("button",{type:"button",onClick:u,className:p,children:"Close"})})]})]})}const nie="off",Tat="no-data",N5="data";function Aat(e){const t=e?.monetization;return t?t.paid_access_enabled?t.has_activity_ever?N5:Tat:nie:N5}const lL=[{value:"today",label:"Today",csv:"today",title:"Today"},{value:"7d",label:"7 days",csv:"last-7-days",title:"Last 7 days"},{value:"this_month",label:"This month",csv:"this-month",title:"This month"},{value:"last_month",label:"Last month",csv:"last-month",title:"Last month"},{value:"all_time",label:"All time",csv:"all-time",title:"All time"}],Rat=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2});function rr(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Wl(e){return Rat.format(rr(e))}
530function Id(e){return rr(e).toLocaleString("en-US")}function Zj(e){return typeof e!="number"||!Number.isFinite(e)?null:Math.max(0,Math.min(100,Math.round(e/5*100)))}function Iat(e,t){const n=new Map((t||[]).map(a=>[a.expert_id,a])),r=(e||[]).map(a=>{const i=n.get(a.id);return n.delete(a.id),{id:a.id,name:a.name||"Untitled expert",avatar_url:a.avatar_url||"",earnings:rr(a.earnings),answers:rr(a.answers),rating:typeof a.thumbs_score=="number"?a.thumbs_score:null,subscribers:rr(i?.active_subscribers),mrr:rr(i?.mrr_usd)}});for(const a of n.values())r.push({id:a.expert_id,name:a.expert_name||"Untitled expert",avatar_url:"",earnings:0,answers:0,rating:null,subscribers:rr(a.active_subscribers),mrr:rr(a.mrr_usd)});return r}function Pat(e,t,n){const r=n==="asc"?1:-1,a=(i,o)=>i.name.localeCompare(o.name);return[...e||[]].sort((i,o)=>{if(t==="name")return a(i,o)*r;const l=i[t],c=o[t],u=l==null,d=c==null;return u&&d?a(i,o):u?1:d?-1:l===c?a(i,o):(l-c)*r})}function rie(e,t,n){return!e||!t?"Pick both a start and an end date.":e>t?"The start date has to come before the end date.":n&&(e>n||t>n)?"Dates cannot be in the future.":null}function Lat(e){if(e==null)return"";const t=String(e);return/[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function Tn(...e){return e.map(Lat).join(",")}function Oat(e,t,n){const r=e?.earnings||{},a=e?.activity||{},i=e?.quality||{},o=e?.subscription_insights||{},l=r.split||{},c=[];return c.push(Tn("Earnings Report",t)),c.push(""),c.push(Tn("Earnings")),c.push(Tn("Total earned (USD)",rr(r.total_earned).toFixed(2))),c.push(Tn("Subscriptions total (what subscribers paid, USD)",rr(l.subscription_gross).toFixed(2))),c.push(Tn("Pending payout (USD)",rr(r.pending_payout).toFixed(2))),c.push(Tn("Delivered answers",rr(r.answers))),c.push(""),c.push(Tn("Subscriptions")),c.push(Tn("Active subscribers",rr(o.active_subscribers))),c.push(Tn("Monthly recurring (USD)",rr(o.mrr_usd).toFixed(2))),c.push(Tn("New in period",rr(o.new_in_period))),c.push(Tn("Cancelled in period",rr(o.canceled_in_period))),c.push(Tn("Churn in period",typeof o.churn_pct=="number"?`${o.churn_pct.toFixed(1)}%`:"n/a")),c.push(""),c.push(Tn("Activity")),c.push(Tn("Active experts",rr(a.active_experts))),c.push(Tn("Drafts",rr(a.drafts))),c.push(Tn("Questions answered",rr(a.questions_answered))),c.push(""),c.push(Tn("Answer feedback")),i.threshold_met?(c.push(Tn("Helpful",`${Zj(i.score)}%`)),c.push(Tn("Score (out of 5)",i.score)),c.push(Tn("Rated answers",rr(i.rated_count)))):c.push(Tn("Status",`Not available yet. ${rr(i.rated_count)} rated answers so far (needs 100)`)),c.push(""),c.push(Tn("By expert")),!n||n.length===0?c.push(Tn("No experts in this period.")):(c.push(Tn("Name","Earned (USD)","Subscriptions","MRR (USD)","Rating","Answers")),n.forEach(u=>{c.push(Tn(u.name,u.earnings.toFixed(2),u.subscribers,u.mrr.toFixed(2),u.rating===null?"":`${Zj(u.rating)}%`,u.answers))})),c.join(` 531`)}const Mat=e=>["inline-flex flex-none items-center box-border whitespace-nowrap rounded-pill","h-9 px-3.5 text-[13px] cursor-pointer border-none","transition-colors duration-200 ease-standard","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo focus-visible:ring-offset-1",e?"bg-paper text-ink font-semibold shadow-[0_1px_2px_rgba(20,20,19,0.12)]":"bg-transparent text-ink-mid font-medium hover:text-ink"].join(" "),Cz="h-[26px] w-[110px] border-none bg-transparent p-0 text-[12.5px] font-medium text-ink focus:outline-none focus-visible:outline-none";function Dat({value:e,customStart:t,customEnd:n,todayIso:r,onChange:a,disabled:i=!1}){const o=e==="custom",l=o?rie(t,n,r):null;return s.jsxs("div",{className:"w-full box-border px-3.5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-3",children:[s.jsx("span",{className:"flex-none text-[12px] font-semibold uppercase tracking-[0.1em] text-ink-mid",children:"Select period"}),s.jsx("span",{"aria-hidden":"true",className:"hidden flex-1 h-px min-w-3 bg-rule/90 sm:block"}),s.jsxs("div",{role:"group","aria-label":"Earnings period",className:"ge-surface flex flex-none flex-wrap items-center gap-[3px] rounded-pill p-1",children:[lL.map(c=>s.jsx("button",{type:"button",disabled:i,"aria-pressed":c.value===e,title:c.title,onClick:()=>a({period:c.value}),className:`${Mat(c.value===e)} disabled:cursor-not-allowed disabled:opacity-60`,children:c.label},c.value)),s.jsx("button",{type:"button",disabled:i,"aria-pressed":o,onClick:()=>a({period:"custom"}),className:["inline-flex flex-none items-center box-border whitespace-nowrap rounded-pill","h-9 px-3.5 text-[13px] font-medium cursor-pointer","transition-colors duration-200 ease-standard","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-60",o?"border border-indigo/35 bg-indigo/10 text-indigo":"border border-transparent bg-transparent text-ink-soft hover:text-indigo"].join(" "),children:"Custom"})]}),o&&s.jsxs("div",{className:"flex flex-none items-center gap-2 h-9 box-border rounded-pill border border-indigo/30 bg-indigo-wash/80 px-3.5 sm:ml-auto",children:[s.jsx(q0e,{className:"w-[15px] h-[15px] flex-none text-ink-muted","aria-hidden":"true"}),s.jsx("input",{type:"date","aria-label":"From",value:t||"",max:r,onChange:c=>a({period:"custom",customStart:c.target.value}),className:Cz}),s.jsx("span",{"aria-hidden":"true",className:"flex-none text-[12.5px] text-ink-light",children:"â"}),s.jsx("input",{type:"date","aria-label":"To",value:n||"",min:t||void 0,max:r,onChange:c=>a({period:"custom",customEnd:c.target.value}),className:Cz})]})]}),l&&s.jsx("p",{role:"alert",className:"mt-2 text-[12.5px] text-destructive",children:l})]})}function fi({label:e,value:t,note:n,accent:r=!1,valueIndigo:a=r,size:i="lg",onClick:o,ariaLabel:l,actionLabel:c,onAction:u,className:d=""}){const h=i==="lg",p=o?"button":"div",m=o?"span":"button",g=h?["ge-surface px-[22px] py-5",r?"border-[rgba(61,61,245,0.22)] bg-[rgba(238,238,252,0.82)]":""].join(" "):"rounded-xl border border-rule bg-[rgba(253,252,248,0.72)] px-5 py-4";return s.jsxs(p,{type:o?"button":void 0,onClick:o,"aria-label":o?l||e:void 0,className:`flex flex-col items-start gap-2.5 ${g} ${d} ${o?"w-full cursor-pointer text-left transition-colors hover:border-indigo/30 hover:bg-indigo-wash focu
531s-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo/40":""}`,children:[s.jsx("span",{className:"ge-surface-eyebrow",children:e}),s.jsx("span",{className:`font-heading font-normal leading-[0.98] tracking-[-0.03em] ${h?"text-[34px] sm:text-[38px]":"text-[22px]"} ${a?"text-indigo":"text-ink"}`,style:{fontFeatureSettings:'"tnum" 1, "lnum" 1'},children:t}),(n||c&&u)&&s.jsxs("div",{className:"earnings-stat-footer mt-auto flex w-full min-w-0 items-end gap-2",children:[n&&s.jsx("span",{className:`earnings-stat-note min-w-0 flex-1 leading-[1.45] text-ink-muted ${h?"text-[11.5px]":"text-[12.5px]"}`,title:typeof n=="string"?n:void 0,children:n}),c&&(u||o)&&s.jsxs(m,{type:o?void 0:"button",onClick:o?void 0:u,className:"earnings-stat-action shrink-0 text-xs font-semibold text-indigo hover:text-indigo-deep hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo/40",children:[c,s.jsx("span",{className:"ml-1","aria-hidden":"true",children:"â"})]})]})]})}const WS=[{key:"name",label:"By expert",align:"left",width:"auto"},{key:"earnings",label:"Earned",align:"center",width:"104px"},{key:"subscribers",label:"Subscriptions",align:"center",width:"120px"},{key:"mrr",label:"MRR",align:"center",width:"100px"},{key:"rating",label:"Rating",align:"center",width:"92px"}],$at={asc:"ascending",desc:"descending"};function Fat({rows:e,sort:t,dir:n,onSort:r}){return s.jsx("div",{className:"ge-surface w-full overflow-x-auto overflow-y-hidden",children:s.jsxs("table",{className:"w-full min-w-[660px] border-collapse text-left",children:[s.jsx("caption",{className:"sr-only",children:"Earnings, subscriptions and rating for each of your experts"}),s.jsx("colgroup",{children:WS.map(a=>s.jsx("col",{style:{width:a.width}},a.key))}),s.jsx("thead",{children:s.jsx("tr",{className:"bg-[rgba(20,20,19,0.04)]",children:WS.map(a=>{const i=t===a.key;return s.jsx("th",{scope:"col","aria-sort":i?$at[n]:"none",className:`px-3 py-3 first:pl-6 last:pr-6 font-normal ${a.align==="left"?"text-left":"text-center"}`,children:s.jsxs("button",{type:"button",onClick:()=>r(a.key),className:`inline-flex items-center gap-1 border-none bg-transparent p-0 text-[12px] font-semibold uppercase tracking-[0.1em] cursor-pointer transition-colors duration-200 ease-standard rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo ${i?"text-indigo":"text-ink-muted hover:text-ink-mid"}`,children:[a.label,s.jsx("span",{"aria-hidden":"true",className:"w-2",children:i?n==="desc"?"â":"â":""})]})},a.key)})})}),s.jsxs("tbody",{children:[e.length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:WS.length,className:"px-6 py-8 text-center text-[13.5px] text-ink-muted",children:"No experts earned in this period."})}),e.map(a=>{const i=Zj(a.rating);return s.jsxs("tr",{className:"border-t border-rule/90",children:[s.jsx("th",{scope:"row",className:"min-w-0 px-3 py-2.5 pl-6 font-normal",children:s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx(ws,{name:a.name,src:a.avatar_url,size:"sm",variant:"expert"}),s.jsx("span",{className:"min-w-0 truncate text-[14px] text-ink",title:a.name,children:a.name})]})}),s.jsx("td",{className:"px-3 py-2.5 text-center text-[14px] font-medium text-ink tabular-nums",children:Wl(a.earnings)}),s.jsx("td",{className:"px-3 py-2.5 text-center text-[13.5px] text-ink-mid tabular-nums",children:a.subscribers}),s.jsx("td",{className:"px-3 py-2.5 text-center text-[13.5px] text-ink-mid tabular-nums",children:Wl(a.mrr)}),s.jsx("td",{className:"px-3 py-2.5 pr-6 text-center text-[13.5px] text-ink-mid tabular-nums",children:i===null?s.jsx("span",{className:"text-ink-light",title:"No ratings yet",children:"â"}):s.jsxs("span",{className:"inline-flex items-center justify-center gap-1.5",children:[s.jsx(eo,{className:"w-[13px] h-[13px] flex-none text-indigo","aria-hidden":"true"}),i,"%"]})})]},a.id)})]})]})})}function Bat(e){const[t,n]=String(e||"").split("-").map(Number);return!t||!n?"â":new Date(t,n-1,1).toLocaleString("en-US",{month:"short"})}function Uat({data:e}){const t=e||[],n=Math.max(...t.map(a=>a.earnings||0),0),r=(()=>{const a=new Date;return`${a.getFullYear()}
531-${String(a.getMonth()+1).padStart(2,"0")}`})();return s.jsxs("div",{className:"ge-surface flex h-full flex-col justify-between gap-3 px-6 py-5",children:[s.jsx("span",{className:"ge-surface-eyebrow",children:"Last 6 months"}),t.length===0?s.jsx("p",{className:"py-6 text-[13px] text-ink-muted",children:"No earnings history yet."}):t.map(a=>{const i=a.earnings||0,o=n>0&&i>0?Math.max(Math.round(i/n*100),5):0,l=a.month===r;return s.jsxs("div",{className:"grid grid-cols-[44px_minmax(0,1fr)_76px] items-center gap-4",children:[s.jsx("span",{className:`text-[11.5px] uppercase tracking-[0.1em] ${l?"font-semibold text-indigo":"font-medium text-ink-muted"}`,children:Bat(a.month)}),s.jsx("span",{className:"block h-2.5 overflow-hidden rounded-pill bg-[rgba(20,20,19,0.06)]",children:s.jsx("span",{className:`block h-full rounded-pill ${l?"bg-indigo":"bg-indigo/35"}`,style:{width:`${o}%`}})}),s.jsx("span",{className:`text-right text-[13px] tabular-nums ${l?"font-semibold text-ink":"font-normal text-ink-mid"}`,children:Wl(i)})]},a.month)})]})}function zat({score:e,ratedCount:t,thresholdMet:n}){const r=n?Zj(e):null,a=r===null?0:r,i=Id(t);return s.jsxs("div",{className:"ge-surface relative flex h-full flex-col items-stretch gap-3.5 px-6 py-5",children:[s.jsx("span",{className:"ge-surface-eyebrow",children:"Answer feedback"}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-3",children:[s.jsx("div",{role:"img","aria-label":r===null?`Answer feedback not available yet. ${i} of 100 rated answers so far.`:`${r}% of ${i} rated answers were helpful.`,className:"flex h-[118px] w-[118px] flex-none items-center justify-center rounded-full",style:{background:`conic-gradient(#3D3DF5 0 ${a}%, rgba(20,20,19,0.09) ${a}% 100%)`},children:s.jsx("span",{className:"flex h-[100px] w-[100px] items-center justify-center rounded-full bg-paper",children:s.jsxs("span",{className:"flex flex-col items-center gap-px",children:[s.jsx(eo,{className:"w-[17px] h-[17px] text-indigo","aria-hidden":"true"}),s.jsx("span",{className:"font-heading text-[32px] font-normal leading-[0.95] tracking-[-0.03em] text-ink",style:{fontFeatureSettings:'"tnum" 1, "lnum" 1'},children:r===null?"â":`${r}%`})]})})}),s.jsx("span",{className:"text-center text-[12px] text-ink-muted text-balance",children:r===null?`Activates after 100 rated answers · ${i} so far`:`From ${i} rated answers`})]})]})}const Hat=["A language teacher giving extra practice between lessons","A business coach selling their frameworks to people who cannot book time","A personal trainer selling support between sessions","A nutritionist selling their recipe knowledge instead of the recipe book","A course creator adding an AI Expert as an extra paid option to a 12 week plan","An author selling access to what is in their book"];function qat({state:e,hasExperts:t=!0,priceLink:n,expertLink:r,profileLink:a}){const{addToast:i}=f.useContext(Zs),[o,l]=f.useState(!1),c=e===nie,u=c&&!t,d=c?ea:Y0e,h=u?"You have no AI Experts yet":c?"Your AI Experts are free right now":"Paid access is on, waiting for your first subscriber",p=u?"Build one, give it a monthly price, and everything it earns shows up on this page.":c?"Anyone visiting your profile can talk to them. You can switch to paid access anytime, and then only people with an active monthly subscription can unlock them.":"Your earnings will show up here as soon as someone subscribes. The fastest way to get there is sharing it with the audience you already have.",m=async(g,x)=>{try{await navigator.clipboard.writeText(g),i(`${x} copied.`,"success")}catch{i(`Could not copy. The link is ${g}`,"error")}};return s.jsxs("div",{className:"w-full max-w-[640px] max-h-full overflow-y-auto box-border rounded-[18px] border border-indigo/20 bg-indigo-wash/[0.94] px-6 pb-[26px] pt-7 shadow-[0_10px_26px_-20px_rgba(61,61,245,0.4)] backdrop-blur-md",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(d,{className:"w-5 h-5 flex-none text-indigo","aria-hidden":"true"}),s.jsx("h2",{className:"font-heading text-[17px] font-normal leading-[1.25] text-ink text-balance",children:h})]}),s.jsxs("div",{className:"mt-3.5 flex flex-col items-start gap-4 pl-8",children:[s.jsx("p",{className:"text-[13.5px] leading-[1.6] text-ink-mid",children:p}),u?s.jsx(Le,{to:"/experts/new",className:"inline-flex cursor-pointer whitespace-nowrap rounded-pill bg-indigo px-5 py-2.5 text-[13.5px] font-semibold text-cream transition-colors duration-200 ease-standard hover:bg-indigo-deep",children:"Create my first AI Expert"}):c?s.jsxs("div",{className:"w-full flex flex-col gap-2",children:[s.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-4",children:[s.jsxs("button",{type:"button",onClick:()=>l(g=>!g),"aria-expanded":o,className:"inline-flex items-center gap-2 border-none bg-transparent p-0 font-heading text-[14.5px] font-normal tracking-[-0.01em] text-ink cursor-pointer transition-colors duration-200 ease-standard hover:text-indigo rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo",children:["See when this might be useful",s.jsx(Is,{"aria-hidden":"true",className:`w-[13px] h-[13px] flex-none text-indigo transition-transform duration-200 ease-standard ${o?"rotate-180":""}`})]}),s.jsx(Le,{to:n,className:"flex-none whitespace-nowrap text-[13.5px] font-semibold text-indigo hover:text-indigo-deep hover:underline",children:"Set paid access"})]}),o&&s.jsxs("ul",{className:"flex max-h-[min(44vh,240px)] flex-col gap-2.5 overflow-y-auto rounded-[14px] border border-rule bg-white px-[18px] py-3.5 shadow-[0_1px_2px_rgba(20,20,19,0.04)]",children:[Hat.map(g=>s.jsxs("li",{className:"flex items-start gap-2.5",children:[s.jsx("span",{"aria-hidden":"true",className:"mt-[7px] h-1 w-1 flex-none rounded-full bg-indigo"}),s.jsx("span",{className:"flex-1 text-[12.5px] leading-[1.55] text-ink-mid",children:g})]},g)),s.jsx("li",{className:"mt-1 border-t border-rule/90 pt-3 text-[12.5px] leading-[1.55] text-ink-mid",children:s.jsx("span",{className:"font-medium text-ink",children:"You keep 70% of every subscription to your AI Expert."})})]})]}):s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[r?s.jsx("button",{type:"button",onClick:()=>
531m(r,"AI Expert link"),className:"cursor-pointer whitespace-nowrap rounded-pill border-none bg-indigo px-5 py-2.5 text-[13.5px] font-semibold text-cream transition-colors duration-200 ease-standard hover:bg-indigo-deep focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo focus-visible:ring-offset-2",children:"Copy AI Expert link"}):s.jsx(Le,{to:"/experts/new",className:"inline-flex cursor-pointer whitespace-nowrap rounded-pill bg-indigo px-5 py-2.5 text-[13.5px] font-semibold text-cream transition-colors duration-200 ease-standard hover:bg-indigo-deep",children:"Create your first expert"}),s.jsx("button",{type:"button",onClick:()=>m(a,"Profile link"),className:"cursor-pointer whitespace-nowrap rounded-pill border border-indigo/40 bg-transparent px-5 py-2.5 text-[13.5px] font-semibold text-indigo transition-colors duration-200 ease-standard hover:border-indigo hover:bg-indigo/[0.08] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo focus-visible:ring-offset-2",children:"Copy profile link"})]})]})]})}const Wat=["january","february","march","april","may","june","july","august","september","october","november","december"];function E5(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function Tz(){return E5(new Date)}function Vat(){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-01`}function Gat(e,t,n){if(e==="custom")return t&&n?`${t}-to-${n}`:"custom";const r=new Date,a=i=>`${Wat[i.getMonth()]}-${i.getFullYear()}`;return e==="today"?`today-${E5(r)}`:e==="this_month"?a(r):e==="last_month"?a(new Date(r.getFullYear(),r.getMonth()-1,1)):e==="7d"?`last-7-days-${E5(r)}`:lL.find(i=>i.value===e)?.csv||e}function Yat(e,t,n){if(e==="custom"){if(!t||!n)return"Custom range";const r=a=>new Date(`${a}T00:00:00`).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return`${r(t)} â ${r(n)}`}return lL.find(r=>r.value===e)?.title||e}const Kat=(()=>{const e=new Date,t=[0,0,120,480,890,3422.21],n=[];for(let r=5;r>=0;r--){const a=new Date(e.getFullYear(),e.getMonth()-r,1);n.push({month:`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}`,earnings:t[5-r]})}return{earnings:{total_earned:3422.21,answers:487,pending_payout:3422.21,split:{subscription_earnings:3422.21,subscription_gross:4888.87}},activity:{active_experts:3,drafts:1,questions_answered:487},quality:{score:4.6,rated_count:142,threshold_met:!0,zone:"great"},top_experts:[{id:"demo-1",name:"Dr. Maya Chen",avatar_url:null,earnings:1599.65,answers:228,thumbs_score:4.7},{id:"demo-2",name:"Marcus Webb",avatar_url:null,earnings:1056.8,answers:151,thumbs_score:4.5},{id:"demo-3",name:"Sofia Reyes",avatar_url:null,earnings:765.76,answers:108,thumbs_score:4.6}],earnings_6mo:n,monetization:{paid_access_enabled:!0,has_activity_ever:!0,has_current_price:!0},subscription_insights:{active_subscribers:12,mrr_usd:179.88,new_in_period:4,canceled_in_period:1,churn_pct:8.3,by_expert:[{expert_id:"demo-1",expert_name:"Dr. Maya Chen",active_subscribers:6,mrr_usd:89.94},{expert_id:"demo-2",expert_name:"Marcus Webb",active_subscribers:4,mrr_usd:59.96},{expert_id:"demo-3",expert_name:"Sofia Reyes",active_subscribers:2,mrr_usd:29.98}]},payout:{minimum_usd:50,eligible:!1,reason:"below_minimum",last_request_at:null,next_eligible_at:null,pending_request:null}}})();function Xat(){const{isAuthenticated:e,isLoading:t}=Ut(),{creator:n}=Yh(),[r,a]=f.useState("this_month"),[i,o]=f.useState(Vat),[l,c]=f.useState(Tz),[u,d]=f.useState(null),[h,p]=f.useState(null),[m,g]=f.useState(!0),[x,b]=f.useState(!1),[y,v]=f.useState(0),[w,j]=f.useState("earnings"),[E,S]=f.useState("desc"),_=f.useMemo(()=>Tz(),[]),k=r==="custom"?rie(i,l,_):null;f.useEffect(()=>{if(t||!e||k)return;let J=!1;return g(!0),p(null),xI(r,i,l).then(P=>{J||d(P.data)}).catch(P=>{J||p(P.response?.data?.detail?.message||"Could not load your earnings.")}).finally(()=>{J||g(!1)}),()=>{J=!0}},[r,i,l,t,e,y,k]);const C=({period:J,customStart:P,customEnd:ee})=>{J!==void 0&&a(J),P!==void 0&&o(P),ee!==void 0&&c(ee)},N=e?u:Kat,A=e&&m,T=f.useMemo(()=>Iat(N?.top_experts,N?.subscription_insights?.by_expert),[N]),I=f.useMemo(()=>Pat(T,w,E),[T,w,E]),$=J=>{if(J===w){S(P=>P==="desc"?"asc":"desc");return}j(J),S(J==="name"?"asc":"desc")},O=()=>{if(!N)return;const J=Oat(N,Yat(r,i,l),I),P=new Blob(["\uFEFF"+J],{type:"text/csv;charset=utf-8;"}),ee=URL.createObjectURL(P),X=document.createElement("a");X.href=ee,X.download=`greatexperts-earnings-${Gat(r,i,l)}.csv`,document.body.appendChild(X),X.click(),document.body.removeChild(X),URL.revokeObjectURL(ee)};if(A&&!N)return s.jsx(il,{fullPage:!0,text:"Loading your earningsâ¦"});if(h&&!N)return s.jsxs("div",{className:"mx-auto max-w-lg px-4 py-16 text-center",children:[s.jsx("p",{className:"text-sm text-destructive",children:h}),s.jsx("button",{type:"button",onClick:()=>v(J=>J+1),className:"ge-surface-btn mt-5",children:"Try again"})]});if(!N)return null;const{earnings:U,activity:F,quality:H,earnings_6mo:G,subscription_insights:M}=N,z=N.payout??{eligible:!1,reason:"below_minimum",pending_request:null},W=U.split||{},D=Aat(N),Z=D!==N5,V=N.top_experts?.[0],L=N.top_experts?.length||0,K=L===0?"/expert
531s/new":L===1?`/experts/${V.id}/edit?section=money`:"/lab/experts",te=z.eligible?null:z.reason==="pending_request"&&z.pending_request?`Your payout request of ${Wl(z.pending_request.amount_usd)} is in review.`:z.reason==="cooldown"&&z.next_eligible_at?`You can request your next payout on ${new Date(z.next_eligible_at).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})}.`:`You can request a payout once your balance reaches ${Wl(z.minimum_usd??50)}.`,Q=M?`${Id(M.new_in_period)} new, ${Id(M.canceled_in_period)} cancelled`:"No subscribers yet",Y=s.jsxs("div",{className:`flex w-full flex-col items-center gap-6 transition-opacity duration-200 ${A?"opacity-60":"opacity-100"}`,children:[e&&s.jsx(Dat,{value:r,customStart:i,customEnd:l,todayIso:_,onChange:C,disabled:Z}),s.jsxs("div",{className:"grid w-full grid-cols-[repeat(auto-fit,minmax(210px,1fr))] gap-3.5",children:[s.jsx(fi,{accent:!0,label:"Pending payout",value:Wl(U.pending_payout),note:`Payout from ${Wl(z.minimum_usd??50)}`}),s.jsx(fi,{label:"Total earned",value:Wl(U.total_earned),note:"Your 70% share, after fees"}),s.jsx(fi,{label:"Active subscribers",value:Id(M?.active_subscribers),note:Q}),s.jsx(fi,{label:"Subscriptions total",value:Wl(W.subscription_gross),note:"What subscribers paid. You keep 70%"})]}),s.jsx(Fat,{rows:I,sort:w,dir:E,onSort:$}),s.jsxs("div",{className:"grid w-full items-stretch gap-3.5 lg:grid-cols-[minmax(0,1fr)_276px]",children:[s.jsx(Uat,{data:G}),s.jsx(zat,{score:H?.score,ratedCount:H?.rated_count,thresholdMet:!!H?.threshold_met})]}),s.jsxs("div",{className:"grid w-full grid-cols-[repeat(auto-fit,minmax(210px,1fr))] gap-3.5",children:[s.jsx(fi,{size:"sm",label:"Questions answered",value:Id(F?.questions_answered),note:"In the selected period"}),s.jsx(fi,{size:"sm",label:"Active experts",value:Id(F?.active_experts),note:"Published and answering"}),s.jsx(fi,{size:"sm",label:"Drafts",value:Id(F?.drafts),note:"Not published yet"})]})]});return s.jsxs("div",{className:"pb-8",children:[!e&&s.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-4 rounded-xl border border-indigo-tint bg-indigo-wash px-5 py-4 sm:px-6 sm:py-5",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"ge-surface-eyebrow",children:"Sample data · 24 days"}),s.jsx("p",{className:"mt-1.5 font-heading text-lg font-normal tracking-tight text-ink text-balance sm:text-2xl",children:"This is what your earnings could look like."}),s.jsx("p",{className:"mt-1.5 text-sm text-ink-mid text-balance",children:"Share your knowledge as an AI expert and get paid for every answer."})]}),s.jsx(Le,{to:"/experts/new",className:"inline-flex shrink-0 items-center justify-center rounded-pill bg-indigo px-6 py-2.5 text-sm font-semibold text-cream transition-colors duration-200 ease-standard hover:bg-indigo-deep",children:"Become a creator"})]}),s.jsxs("header",{className:"ge-surface mb-6 flex flex-wrap items-center gap-x-5 gap-y-3 px-5 py-3 sm:px-7",children:[s.jsxs("h1",{className:"min-w-0 font-heading text-[28px] font-normal leading-[1.1] tracking-[-0.018em] text-ink",children:["Your ",s.jsx("em",{className:"italic text-indigo",children:"earnings"})]}),e&&s.jsxs("div",{className:"ml-auto flex items-center gap-2 sm:gap-2.5",children:[s.jsxs("button",{type:"button",onClick:O,disabled:Z,className:"ge-surface-btn h-10 gap-2 px-3.5 text-[13px] disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-rule disabled:hover:bg-transparent disabled:hover:text-ink-soft",children:[s.jsx(Eh,{className:"w-4 h-4","aria-hidden":"true"}),s.jsx("span",{className:"hidden sm:inline",children:"Export CSV"}),s.jsx("span",{className:"sm:hidden",children:"CSV"})]}),s.jsx("button",{type:"button",onClick:()=>b(!0),disabled:Z||A||!z.eligible,title:te||void 0,className:"inline-flex h-10 items-center whitespace-nowrap rounded-pill border-none bg-indigo px-6 text-[13px] font-semibold text-cream shadow-[inset_0_1px_0_rgba(255,255,255,0.42),0_16px_32px_-18px_rgba(61,61,245,0.85)] transition-colors duration-200 ease-standard hover:bg-indigo-deep disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-indigo",children:"Request payout"})]})]}),h&&s.jsxs("div",{className:"mb-5 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-destructive/30 bg-destructive/5 px-4 py-3",children:[s.jsxs("p",{className:"text-[13px] text-destructive",children:[h," Showing the last figures loaded."]}),s.jsx("button",{type:"button",onClick:()=>v(J=>J+1),className:"ge-surface-btn h-9 px-4 text-[13px]",children:"Retry"})]}),Z?s.jsxs("div",{className:"relative",children:[s.jsx("div",{inert:!0,"aria-hidden":"true",className:"pointer-events-none max-h-[min(560px,calc(100vh-300px))] select-none overflow-hidden opacity-30 blur-[9px] saturate-[0.2]",children:Y}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-2 sm:p-4",children:s.jsx(qat,{state:D,hasExperts:L>0,priceLink:K,expertLink:V&&typeof window<"u"?`${window.location.origin}/experts/${V.id}/chat`:null,profileLink:ll(n)})})]}):Y,s.jsxs("p",{className:"pt-8 text-center text-xs text-ink-muted",children:["Need help? ",s.jsx(Le,{to:"/faq",className:"text-indigo hover:text-indigo-deep hover:underline",children:"Visit the FAQ"}),"."]}),s.jsx(Cat,{isOpen:x,onClose:()=>b(!1),amountUsd:U.pending_payout,onSuccess:()=>v(J=>J+1)})]})}const VS="inline-flex min-h-11 items-center text-sm text-ink-mid transition-colors duration-base ease-standard hover:text-indigo",Jat={a:({href:e="",children:t})=>{if(e.startsWith("/"))return s.jsx(Le,{to:e,children:t});const n=/^https?:/.test(e);return s.jsx("a",{href:e,...n&&{target:"_blank",rel:"noopener noreferrer"},children:t})}};function cL({title:e,accent:t,meta:n,content:r,children:a}){return s.jsxs("div",{className:"min-h-screen bg-cream px-5 pb-[72px] pt-[30px] sm:px-8 lg:px-14",children:[a,s.jsxs("header",{className:"mx-auto mb-[46px] flex max-w-[820px] items-center justify-between gap-6",children:[s.jsx(Le,{to:"/",className:"inline-flex","aria-label":"Great Experts home",children:s.jsx(bn,{height:38})}),s.jsx(Le,{to:"/",className:"text-[13.5px] font-medium text-ink-mid transition-colors duration-base ease-standard hover:text-indigo",children:"Back to home"})]}),s.jsxs("div",{className:"mx-auto flex max-w-[820px] flex-col gap-3",children:[s.jsxs("h1",{className:"font-heading text-[32px] font-normal leading-[1.06] tracking-[-0.02em] text-ink sm:text-[44px]",children:[e," ",s.jsx("em",{className:"italic text-indigo",children:t})]}),n&&s.jsx("p",{className:"text-sm text-[#77746C]",children:n})]}),s.jsx("div",{className:"legal-prose mx-auto mt-[38px] max-w-[820px]",children:s.jsx(Qf,{content:r,extraComponents:Jat})}),s.jsxs("footer",{className:"mx-auto mt-[60px] flex max-w-[820px] flex-wrap items-center justify-between gap-x-7 gap-y-2 border-t border-rule pt-[26px]",children:[s.jsx(bn,{height:38}),s.jsxs("nav",{className:"flex flex-wrap items-center gap-x-6 gap-y-1","aria-label":"Legal",children:[s.jsx(Le,{to:"/",className:VS,children:"Home"}),s.jsx(Le,{to:"/terms",className:VS,children:"Terms & Conditions"}),s.jsx(Le,{to:"/privacy",className:VS,children:"Privacy Policy"})]})]})]})}const Qat=`--- 532 533## Part I - General 534 535## 1. Who we are, and what this Policy covers 536 537Great Experts is a platform on which named human creators build AI-powered expert agents grounded in their own knowledge, publish them on public profile pages and in Platform discovery, embed them on external websites, and interact with their audiences - including by voice. 538 539The Platform is operated by Great Spirits Limited, a company incorporated in the Abu Dhabi Global Market ("ADGM"), Abu Dhabi, United Arab Emirates ("we", "us", "our"). This Policy explains what personal data we handle, why, on what legal basis, for how long, and what you can do about it. 540 541This Policy is incorporated into the [Terms and Conditions](/terms) and uses their defined terms - Expert, Creator, User, Visitor, Restricted Mode, Creator Materials, Knowledge Source, Connected Account, Lead, Lead Sharing Level, Interaction Signals, Widget, Public Profile, Voice Services, Creator Voice Model, Creator Subscription. Where a term is capitalised and not defined here, it has the meaning given in the Terms. 542 543It is organised the same way the Terms are, because different people need different parts of it: 544 545* Part I - general, applying to everyone; 546* Part A - if you visit a Public Profile, chat with an Expert, leave a Lead, or hold a Creator Subscription; 547* Part B - if you are a Creator publishing an Expert or a Public Profile; 548* Part C - common provisions: legal bases, sharing, transfers, retention, security, and your rights. 549 550**A note on what comes next.** As the Platform develops, Creators may be able to enable further interactive features - scheduling, commerce, Digital Products and their delivery and support, memberships, community experiences, or integrations with services they already use. Where such a feature involves processing personal data beyond what is described here, this Policy or a notice specific to that feature will explain what is processed and why, before the feature operates on your data. Terms B.15 governs whether such a feature carries a fee; this Policy governs what happens to the data it touches. Neither is a licence to start doing something new with data already collected: an extension of purpose is a change under C.10, with the notice that section requires. 551 552## 2. The short version 553
554This summary is not a substitute for the rest of the Policy, but nothing below contradicts it. 555 556| What | Position | 557| --- | --- | 558| Talking to an Expert | You are always told it is an AI. Your questions and its Answers are processed to run the conversation. They are never used to train any AI model - ours or anyone else's. | 559| Talking without an account | Possible. No account is created, no persistent profile is built, and data collection is limited to running the session. See A.2. | 560| Voice | We do not intentionally store or retain voice recordings once they have been processed. Audio is processed to produce speech and text, with only the transient buffering any voice system requires, and the text transcript is what is kept. See A.4. | 561| Leaving your contact details | Only if you choose to, and only with your consent at the point of submission. You choose how much of the conversation goes with it. From that moment the Creator is an independent controller. See A.5. | 562| What the Creator can see | The questions and AI replies in conversations with their Expert; anything attached to a Lead; plus Interaction Signals. We do not separately attach your contact or account identity, but anything you type in the chat is part of the conversation. Internal system and tool messages are not shown. See A.3, A.5 and A.6. | 563| Embedded Experts on other websites | At rest the Widget stores nothing on your device and calls no third party. On interaction it uses session storage and shows its own notice. No advertising or marketing trackers. See A.8. | 564| Selling your data | We do not sell personal data and we do not share it for cross-context behavioural advertising. | 565| Where we are, and where your data is | We are a company in the Abu Dhabi Global Market, United Arab Emirates. The servers your data sits on are in the United States. Those are two different questions and C.5 answers both, including what it means if you are in the EEA or the United Kingdom. | 566 567## 3. Who is responsible for what 568 569This is the part most often got wrong on a platform of this kind, so it is stated plainly. There are three distinct situations. 570 571**3.1 We are the controller.** For everything that makes the Platform work: your account, your interactions with Experts, conversation content while it is on the Platform, Interaction Signals, security and abuse prevention, billing and payouts, support, and product analytics. This Policy governs that processing. 572 573**3.2 The Creator becomes an independent controller - for Leads only, and only from delivery.** When you choose to send your contact details to a Creator, that data is transferred to that Creator, who from that moment decides for themselves what to do with it, under their own privacy notice. We are not their processor for it, and this Policy stops governing their use of it. A Creator cannot enable Lead capture without publishing and linking a privacy notice of their own; the interface identifies the Creator and links to that notice before you submit. What the Creator may and may not do with a Lead is set out in Terms B.8 and is binding on them. 574 575**3.3 We remain a controller for our own copy.** Delivering a Lead does not make us forget it. We continue to process Lead information for operating the Platform, security and fraud prevention, billing, support, analytics, and compliance - the purposes described in this Policy - independently of what the Creator does with their copy. 576 577**3.4 Creators are not our processors, and we are not theirs.** Neither party processes the other's data on instruction. Each answers for its own processing. Where a Creator acts as a business and their own compliance obligations require a written arrangement with us for the Platform services they buy, a Data Processing Addendum is available. 578 579**3.5 Third parties we do not control.** Outbound Links take you off the Platform. Booking tools, merchant checkouts, and linked websites operate under their own privacy notices. We are not a party to what happens there. 580 581--- 582 583## Part A - If you visit, chat, call, or subscribe 584 585## A.1 What we collect about you 586 587Depending on how you use the Platform: 588 589* **Conversation data** - the questions you ask an Expert, the Answers it returns, and transcripts of voice sessions. 590* **Contact data** - only if you choose to leave a Lead: the contact details you type, and any message you write. 591* **Account data** - if you register: email address, authentication identifiers (including where you sign in with Google), the confirmation that you are 18 or older, the version of the Terms and this Policy that you accepted, your preferences, and your conversation history. 592* **Subscription and payment data** - if you take a Creator Subscription: the subscription record, its status and history. Card details are handled by our payment processor and do not reach our systems. 593* **Interaction Signals** - link clicks, booking events, the source you arrived from, and aggregate usage statistics. 594* **Technical data** - IP address, device and browser characteristics, timestamps, language, and error and performance diagnostics. 595* **Support data** - what you send us if you contact support or report content. 596 597We do not ask for special category data, we do not want it, and Experts are not designed to elicit it. If you volunteer it in a conversation - about your health, for example, when speaking to a wellness Expert - it is processed as part of the conversation content and is subject to the same rules, and to any additional protection the applicable law gives it. 598 599## A.2 If you are not signed in (Restricted Mode) 600 601You can use an Expert without an account. Terms A.2 calls this Restricted Mode; here is what it means for your data. No account is created. No persistent profile is built about you and we do not attempt to identify you across sessions or across Creators. Collection is limited to what is needed to run the session, keep it secure, and provide the features you use. 602 603In practice we process, for the duration of the session and the retention periods in C.6: the conversation content; a session identifier held in your browser's session storage; your IP address and basic technical data, for security, abuse prevention and rate control; and Interaction Signals. Where you leave a Lead or join a voice call, A.5 and A.4 apply. 604 605What we do not do in Restricted Mode: build an advertising or marketing profile; combine your session with any other session; sell or share your data for advertising; or place any third-party advertising or marketing tracker. 606 607## A.3 Conversations, and what is never done with them 608 609Your questions and the Expert's Answers are processed to generate the Answer, to keep the conversation coherent within the session, to make your history available to you if you have an account, to operate safety and abuse systems, and to produce aggregated analytics for the Creator and for us. 610 611They are never used to train any AI model - ours or a third party's. This is not a preference we could change quietly: it is Section C.2 of the Terms, and it is written into our
611contracts with the processors who handle conversation data. Model providers who process conversations on our behalf do so under zero-retention or no-training terms; Annex 1 identifies them. 612 613Aggregated and anonymised analytics - counts, durations, topic groupings, quality and safety telemetry - are produced from conversation data and are used to operate and improve the service and to give Creators insight. Once aggregated, that output no longer identifies you and is not model training. 614 615We may use aggregated, anonymised, and non-identifiable operational insights to improve the Platform itself - latency, routing quality, retrieval quality, safety systems, and product performance - but never to train foundation AI models, and never to build or improve another Creator's Expert. The distinction is deliberate and is the line we hold: improving how the Platform runs is not the same as using what you said to make a model better. 616 617Different AI providers and different models may process different conversations, depending on availability, performance, the language involved, and the Creator's configuration. Every provider that processes conversation data is bound by the restrictions in C.2 and is identified in Annex 1. 618 619**A word about accuracy.** AI-generated Answers may be inaccurate or incomplete, and they should not be relied upon without independent verification where accuracy matters. This is a property of the technology, not a defect of a particular Expert, and Terms A.8 states it in full. 620 621The Creator can review the questions and AI replies in conversations with their Expert to understand what their audience needs and how their Expert responded. That view may include an AI-generated topic and summary of the conversation, shown alongside the messages themselves. We do not separately attach your contact details or account identity to that view, but anything you type in the chat is part of the conversation and can be seen. Internal system and tool messages are not included. This access applies independently of whether you leave a Lead; the chat interface gives notice before you send a message. If you leave a Lead, A.5 explains which information is additionally attached to that contact request. 622 623The Platform also derives anonymous, aggregated audience insights for the Creator from conversation content: common topics, themes their Expert could not fully answer, and interest in the Creator's published offerings. A named theme or interest figure is only shown once several different people are behind it - never fewer than three - so no line in those insights can point to an individual, and no contact details or account identity accompany them. These insights are not a Lead and contain nothing beyond what was typed into the chat. 624 625## A.4 Voice 626 627Where a Creator has enabled Voice Services, you can speak to an Expert and it can answer in synthetic speech, using either the Creator's own cloned voice or a Platform voice. You are told at the start of the session that you are talking to an AI, and a visible indicator stays present throughout. 628 629We do not intentionally store or retain voice recordings once they have been processed to provide the service. Your speech is transmitted and processed to convert it to text and to synthesise the reply, including by third-party providers acting on our behalf under contract, and it is not stored by us afterwards. Transient technical buffering necessary to carry and process the audio is unavoidable in any voice system; beyond that, no recording is kept. 630 631Where automatic translation is enabled, the transcript may be machine-translated; the source-language transcript prevails. Voice output is labelled as AI-generated in the interface and in the transcript. Voice Services must not be used for emergency communications. 632 633## A.5 Leaving your contact details: the handover 634 635During a conversation an Expert may offer to pass your question to the Creator. This is always your choice, you are never required to do it, and nothing is transferred until you consent at the point of submission. Before you submit, the interface names the Creator who will receive it and links to that Creator's privacy notice. In the same step you confirm that you are 18 or older. 636 637You choose how much goes with your contact details - the Lead Sharing Level: 638 639* the full transcript of your conversation with the Expert;
640* an AI-generated summary of it - a summary is provided for convenience and may omit detail contained in the original conversation; or 641* your contact details and the message you type, and nothing else from the conversation. 642 643Once delivered, the Creator processes your data as an independent controller under their own privacy notice (see 3.2). The Creator is bound by Terms B.8 to use it only for responding to your enquiry and compatible purposes, to establish their own lawful basis before any marketing - receipt of a Lead is not by itself marketing consent - to honour requests you address to them, and not to sell or share it. They are also forbidden from prompting an Expert to extract more conversation content than you chose. If you want your data removed from the Creator's systems, address that to the Creator; we will pass on a request and identify the Creator to you, but we cannot execute it inside their systems. 644 645Once a Lead has been transferred, communication between you and the Creator takes place outside the Platform unless the Platform expressly provides otherwise. We do not see, route, or hold that correspondence, and we are not responsible for it. 646 647We keep our own copy on the basis described in 3.3 and for the periods in C.6. 648 649Separately from any Lead, the relevant Creator can review conversations with their Expert, including an AI-generated topic and summary, and receives anonymous aggregated audience insights, all as described in A.3. Your Lead Sharing Level controls only what is attached to a contact request; it does not restrict that conversation review. The chat interface gives notice of the review before you send a message. 650 651One consequence of how Creator plans work should be stated openly. Creator plans may include an allowance of stored contacts. Where a Creator exceeds it, Leads keep being captured, but the Creator sees only the most recent ones; the rest are held by us and disclosed to that Creator only if they upgrade. This means we may hold your contact details for a period during which the Creator you sent them to cannot see them. Leads held in this state are retained for no longer than 12 months from capture; if the Creator has not upgraded by then, they are deleted. Where a Creator's plan publishes no stored-contact allowance, every Lead you leave is visible to that Creator and this paragraph has no work to do. 652 653## A.6 Interaction Signals 654 655Separately from anything you say to an Expert, using a Public Profile or Widget generates Interaction Signals: which links you clicked, whether you booked an appointment, which source you arrived from, and aggregate usage statistics. These are made available to the Creator whose surface you used, independently of any Lead Sharing Level and independently of whether you leave a Lead at all. 656 657Interaction Signals never contain the content of your conversation with an Expert. No Lead Sharing Level restricts or extends them. They exist so that a Creator can tell whether their profile works; they are not used to build an advertising profile of you and are not shared with advertising networks. 658 659## A.7 Accounts, subscriptions, and payments 660 661If you register, we process your account data to authenticate you, to keep your conversation history and preferences available to you, and to operate any Creator Subscription you hold. At registration you confirm you are 18 or older and accept the Terms and this Policy; we record that confirmation together with the versions accepted, because it is the evidence that you agreed. 662 663Payments are processed by our payment processor. We receive the transaction record - amount, currency, status, time, the subscription it relates to - and not your card number. The payment processor is an independent controller for its own fraud-prevention and regulatory purposes and processes your data under its own notice; it is identified in Annex 1. 664 665## A.8 The Widget on other people's websites 666 667Where a Creator has embedded an Expert on an external site, the Widget is engineered so that the host site does not need a consent banner of its own. In its resting state it stores n
667othing on your device and calls no third party. It is only when you interact with it that it uses session storage - the minimum needed to run a conversation - and at that point it presents our information notice inside the Widget itself. 668 669From Widget interactions we collect first-party usage and performance data: Interaction Signals, aggregated conversation analytics, and quality and safety telemetry. Where the law applicable to you requires consent for any of that, the Widget obtains it through its own in-widget notice and consent flow, not through the host site's banner. No third-party advertising or marketing trackers run on embedded surfaces. 670 671The host website is a separate service with its own privacy notice. Your use of the Widget is governed by this Policy; your use of the site around it is not. 672 673Cookies and equivalent storage used on the Platform and in the Widget are described in the Cookie Policy, which forms part of this Policy. In outline: we use what is strictly necessary to run the session, to authenticate you, and to keep the service secure. Depending on where you are, we ask for your consent before storing or accessing anything on your device that is not strictly necessary, and you can change or withdraw that choice at any time through the controls we provide. We do not place third-party advertising or marketing trackers on any surface. The Cookie Policy is published alongside this Policy. 674 675## A.9 Age 676 677The Platform is for people aged 18 and over. It is not directed at children, it carries no adult content, and Creators are forbidden from directing a Public Profile, an Expert, or a Widget at children. 678 679Registered Users and Creators confirm they are 18 or older when they create an account, in the same step in which they accept the Terms and this Policy. Visitors in Restricted Mode create no account; where they leave a Lead or join a voice call, they confirm in that step that they are 18 or older (A.5, Terms A.2). Beyond these declarations we do not verify age, and we do not profile Visitors in order to estimate it - doing so would require building exactly the persistent profile that Restricted Mode is designed not to build. 680 681If we learn that a registered account holder is under 18, we suspend the account, ask for verification, and close it and delete the associated personal data if verification is not provided. If we learn that a Lead or a conversation came from someone under 18, we delete what we hold and notify the Creator who received it, who is required to delete it too. You can tell us at [[email protected]](mailto:[email protected]). 682 683--- 684 685## Part B - If you are a Creator 686 687## B.1 Your account and your business data 688 689We process your registration and identity data, your plan and billing records, your payout details and any verification data required for them, your support history, and the operational record of your Experts and surfaces. Subscription and plan history is also processed to administer our offer and yours - migrating you between plans, applying allowances, invoicing and reconciling, and telling you about changes to the services you use. Where you publish as a business, some of this is not personal data at all; where you publish as an individual, it is, and this Policy applies to it. 690 691Your Public Profile is public. Information you choose to publish on it - your name, your description, your links, your Expert and what it is configured to say - is intended to be publicly accessible, and may be crawled, indexed, cached, and surfaced by search engines and other automated systems, unless technical controls we provide state otherwise. Treat it as you would any other page you publish on the open web, and do not put on it anything you would not want found. 692 693## B.2 Creator Materials and Knowledge Sources 694 695What you upload or connect - documents, transcripts, your own social content, your website, text you write in the Platform - is processed to configure and operate your Expert: stored, indexed, retrieved from, and used to ground the Answers your Expert gives within its scope. It is not used to train any AI model, to build any other Expert, or to build competing products. Terms B.2 and C.2 are the operative provisions; this Policy does not add to them or subtract from them. 696 697Your materials may contain other people's personal data - a client name in a transcript, a face in a photograph, a third party mentioned in a post. You warrant in Terms B.3.2 that you are entitled to use what you upload, and you are responsible for reviewing imported material and removing what you are not entitled to use. For that content you are the controller and we process it to deliver the Platform to you. 698 699## B.3 Connected Accounts 700 701When you authorise a Connected Account, we hold the access tokens for it and retrieve your own content from it. We retrieve only the content necessary to operate the features you have enabled, and no more. Where you enable synchronisation, we retrieve new content on an ongoing basis until you disconnect the account or switch synchronisation off. We access third-party platforms only through connectors you have authorised. Imported content is filtered to your own material; comments and third-party-authored content are excluded. 702 703Disconnecting an account revokes the token and stops retrieval. It does not by itself delete content already imported - use the deletion controls in your dashboard, or ask us. Deleting imported content from the Platform has no effect on the original content held on the third-party platform, which remains under that platform's control and its own terms; if you want it removed there, you have to remove it there. 704 705## B.4 Your voice 706 707A Creator Voice Model may be generated only from recordings of your own voice. We process the samples you provide to build the model and the model itself to voice your Experts. Your voice is biometric-adjacent data and is treated accordingly: it is used for no purpose other than operating your own Experts, it is never used to voice anyone else's Expert, and it is never used to train a general model. Voice Models are not licensed, sold, transferred, or made available for use by any third party, except to the processors identified in Annex 1 and only to the extent necessary to operate your own Experts. 708 709You can disable the model from your dashboard at any time, with immediate effect for new sessions, and you can request deleti
709on; deleted models and samples are removed from active systems within 30 days. Your consent to creation and use of the model is captured in the cloning flow and logged under B.5. 710 711## B.5 Consent and attestation logs 712 713For each upload, each account or website connection, and each voice-cloning flow, we record and retain the evidence that you consented and attested: UTC timestamp, your user identifier, IP address, the version of the Terms in force, a SHA-256 checksum of uploaded files, the identifier of the connected source, and the state of each required confirmation. These records are retained for at least 3 years, or longer where the law or a claim requires it. 714 715This log exists to protect both of us. If someone claims that material in your Expert infringes their rights, it is the record of what you declared and when. It is retained on the basis of our legitimate interest in defending claims and yours in being able to show what you agreed. 716 717## B.6 Leads: your obligations as an independent controller 718 719From the moment a Lead reaches you, you are its controller. We are not your processor for it. Before Lead capture can be enabled you must publish and link a privacy notice of your own covering Leads, in the location we designate. Terms B.8.2 sets out what you must do: use the data only for responding to the enquiry and compatible purposes; establish your own lawful basis before any marketing communication, because receipt of a Lead is not marketing consent; honour data subject requests addressed to you; keep it secure; and not sell or share it except to processors under contract. 720 721If a person asks us to delete their data and it has already been delivered to you, we delete our copy and pass the request on; executing it in your systems is your responsibility. If we learn that a Lead came from a person under 18, we will notify you and you must delete it. 722 723## B.7 Analytics available to you 724 725Through your dashboard you have access to: Interaction Signals from your surfaces; conversation counts, topics, summaries, and the visitor/AI messages from conversations with your Experts; your Lead data; performance analytics on your Experts; and your transaction and payout records. Conversation insights do not separately attach the visitor's contact or account identity, and exclude internal system and tool messages; information typed by the visitor remains part of the conversation. You must not use conversation insights to identify a visitor or for unsolicited marketing. 726 727## B.8 Payouts, verification, and tax reporting 728 729Payouts are processed by third-party payout processors under their own terms. They carry out identity and anti-money-laundering verification and may require identity documents; they act as independent controllers for that verification and for their own regulatory obligations. We receive the outcome and the transaction records. 730 731We may be required to collect and report seller information to tax authorities under platform-reporting rules, including DAC7 where it applies. That is a legal obligation and is not something you can opt out of while receiving payouts. 732 733--- 734 735## Part C - Common provisions 736 737## C.1 Why we are allowed to process your data 738 739Where the GDPR, the UK GDPR, or the ADGM Data Protection Regulations apply, our legal bases are as follows. 740 741| What we do | Legal basis | 742| --- | --- | 743| Run a conversation with an Expert you chose to use; deliver an Answer | Performance of a contract, or the steps you requested before entering one. For Visitors with no account, our legitimate interest in providing the service you asked for. | 744| Operate your account, subscription, and billing | Performance of a contract. | 745| Transfer a Lead to a Creator | Your consent, given at the point of submission. You may withdraw it, though a transfer already made cannot be recalled from the Creator by us. | 746| Voice interaction and transcription | Performance of a contract, on your initiation of the call. | 747| Interaction Signals and product analytics | Legitimate interests - understanding whether the service works, giving Creators insight into their own surfaces - balanced against your interests, and never used to build an advertising profile. Where consent is required for the storage or access involved, it is obtained through the in-widget or on-site notice. | 748| Security, abuse prevention, rate control, moderation | Legitimate interests in protecting the Platform, Creators, and users; and legal obligation where applicable. | 749| Consent and attestation logs (B.5) | Legitimate interests in establishing and defending legal claims; legal obligation where applicable. | 750| Tax and platform reporting, sanctions screening, responding to authorities | Legal obligation. | 751| Support and complaint handling | Performance of a contract, and legitimate interests. | 752 753Where we rely on legitimate interests you may object, and we will stop unless we can show compelling grounds that override your interests, or the processing is needed for legal claims. Where we rely on consent you may withdraw it at any time, without affecting what was lawful before withdrawal. 754 755## C.2 We do not train models on your data 756 757Creator Materials are never used to train any other Expert or any AI model, ours or a third party's. User and Visitor questions are never used to train any model. Making content available as a Knowledge Source is retrieval and grounding so that an Expert can answer within its scope; it is not model training. Aggregated, anonymised analytics are not model training either. 758 759These restrictions are reflected in our agreements with sub-processors, including model providers. If this were ever to change, it would require an explicit decision, an amendment to Terms C.2, an amendment to this Policy, and advance notice to you under C.11 - it will not happen by way of a quiet redefinition of "improving the service". 760 761## C.3 Who we share data with 762 763We do not sell personal data and we do not share it for cross-context behavioural advertising. We share it in five situations only. 764 765* **Sub-processors** who run parts of the service for us, under contract, on our instructions, and subject to the restrictions in C.2. They are listed in Annex 1. 766* **Creators**, where you chose to send them a Lead, and Interaction Signals from their own surfaces (Part A.5, A.6). 767* **Independent controllers** with their own relationship to you: the payment processor, payout processors, and identity-verification providers, for their own regulatory and fraud-prevention purposes. 768* **Authorities and advisers**, where we are legally required to disclose, or where disclosure is necessary to establish, exercise, or defend legal claims. 769* **An acquirer**, in the event of a merger, acquisition, or transfer of the business or its assets - in which case this Policy continues to apply until you are given notice of any change, and material changes follow C.11. 770 771The current sub-processor list is published in Annex 1 and updated there. Where we add or replace a sub-processor that processes personal data, we announce the change to Creators at least 30 days before the new sub-processor begins processing, except where an immediate replacement is required for security or continuity, in which case we announce it as soon as reasonably possible. Creators with a Data Processing Addendum additionally have the objection rights it provides. 772 773## C.4 Government and legal requests 774 775We disclose personal data to public authorities, courts, or law enforcement only where we are required to do so by applicable law, or where disclosure is necessary to establish, exercise, or defend legal claims. We assess each request against the law said to authorise it, and we decline requests that are not properly founded. 776 777Where we are legally permitted to do so, we notify the person concerned before disclosing, and a Creator before disclosing data relating to their surfaces, so that they have the opportunity to seek protection. Where we are prohibited from notifying, we do not. 778
779Because our infrastructure is in the United States, a request may also be served on a provider rather than on us. Our contracts require providers to notify us where they are permitted to, and to challenge requests that are unlawful or overbroad. Where they are prohibited from notifying us, we will not know, and we say so here rather than implying a visibility we do not have. 780 781## C.5 Where your data is, and how it gets there 782 783Two questions are often run together and are worth separating. Who controls your data: Great Spirits Limited, a company established in the Abu Dhabi Global Market, United Arab Emirates. Where your data physically sits: the United States. Our infrastructure - the servers on which the Platform runs, the databases in which your conversations, account and Lead data are stored, and the services that process them - is hosted in the United States, and most of our sub-processors are United States companies. Annex 1 states the location of each. 784 785**If you are in the EEA or the United Kingdom.** When you use the Platform, you are dealing with a controller established outside your jurisdiction, and your data is processed on infrastructure in the United States. Two distinct legal questions follow, and they have different answers. 786 787* **Our own processing.** Great Spirits Limited is directly subject to the GDPR and the UK GDPR in respect of the services it offers to you, because it offers them to people in those territories. 788* **Our onward disclosures to sub-processors.** When we pass your data to a processor in the United States, that is a transfer by a controller subject to the GDPR to a recipient in a third country, and it requires an Article 46 mechanism. For a sub-processor certified under the EU-US Data Privacy Framework, and its UK Extension, the adequacy decision covering that Framework is the mechanism, for the categories of data the certification covers. For any sub-processor not certified, or where the certification does not cover the data in question, we use the Standard Contractual Clauses with the UK Addendum, supported by a transfer impact assessment. Annex 1 records which route applies to each. 789 790**United States government access.** This is the substance behind the paperwork, and it deserves a straight answer rather than a clause. Hosting in the United States means US law can reach the data. Providers subject to United States surveillance law may be compelled to disclose data they hold, and the CLOUD Act can reach data held by a US provider wherever the servers are. We do not have a way to make that untrue, and we will not pretend otherwise. What we do: we contract with providers on terms that require them to challenge unlawful or overbroad requests, to disclose the minimum required, and to notify us where they are permitted to; we hold data encrypted in transit and at rest; we keep only what Section C.6 says we keep; and we handle requests addressed to us as set out in C.4. 791 792**If you are in Switzerland**, the Swiss-US Data Privacy Framework applies to certified sub-processors on the same basis. 793 794**If you are in the United States.** Your data is processed in your own country. Depending on where you live and on our size, state privacy laws may give you rights of access, deletion, correction, and portability, and a right to opt out of sale or sharing and of targeted advertising. We do not sell personal data, we do not share it for cross-context behavioural advertising, and we serve no targeted advertising, so the opt-out rights have nothing to attach to - but the access, deletion, and correction rights are honoured under C.8 regardless of where you live. 795 796**A note on data residency.** Everything runs in the United States today, and this is the adopted position: no plan description, sales material, or enterprise agreement may state or imply otherwise. If we later offer processing in another region - the European Union in particular, which enterprise buyers ask about - we will say so here and describe what runs where. Until then, no representation is made that any data is held outside the United States. 797 798## C.6 How long we keep things 799
800The periods below are our adopted retention policy. 801 802| Data | Period | Why | 803| --- | --- | --- | 804| Conversation content - registered Users | For as long as the account exists, then deleted within 30 days of closure. Users can delete individual conversations at any time. | It is your history and its value to you is that it persists. Deletion control sits with you. | 805| Conversation content - Restricted Mode | 90 days from the end of the session. | No account exists to hold it against. Long enough for abuse investigation and for the Creator's aggregate analytics to be produced; short enough to be proportionate. | 806| Voice audio | Not retained beyond the transient buffering required to process it. | See A.4. | 807| Voice transcripts | As for conversation content, on the same basis. | The transcript is the record of the interaction. | 808| Leads delivered to a Creator - our copy | 24 months from delivery, or until the Creator's account closes, whichever is earlier. | Operation, billing, dispute resolution, and abuse investigation. The Creator's own copy is governed by the Creator. | 809| Leads held above a Creator's stored-contact allowance and not disclosed | 12 months from capture, then deleted, with advance notice to the Creator. | Terms B.10.2. Data collected for a recipient who cannot see it cannot be held indefinitely. | 810| Interaction Signals | 24 months, then aggregated irreversibly. | Creators need year-on-year comparison; the identifiable form does not need to survive it. | 811| Account data | For as long as the account exists, then deleted within 30 days of closure, except where a longer period is required below. | Contract. | 812| Creator Materials and Creator Voice Models | Removed from active systems within 30 days of deletion or account closure. | Terms B.7.4 and B.14. | 813| Consent, conversation-sharing choice, and attestation logs (B.5) | At least 3 years, longer where a claim or the law requires. | Evidence of consent, privacy choices, and attestation; defence of claims. | 814| Billing, payout, and tax records | As required by applicable accounting and tax law, typically 5 to 7 years. | Legal obligation. | 815| Copyright complaint records | 3 years. | Terms C.3. | 816| Security and access logs | 12 months. | Security and abuse investigation. | 817| Support correspondence | 24 months from resolution. | Continuity of support and defence of complaints. | 818 819Where a period expires but the data is needed for an ongoing legal claim, an investigation, or a regulatory obligation, we retain it for as long as that need lasts and no longer. Backups are overwritten on their own cycle; data deleted from active systems persists in backups until that cycle completes, and is not restored to active systems except where necessary for disaster recovery. 820 821If a Creator deletes an Expert or closes their account, conversations associated with that Expert remain subject to the retention periods in this table, unless they are deleted earlier through functionality available to the person concerned or because the law requires it. Deleting an Expert removes it from service; it is not, by itself, a deletion request on behalf of everyone who ever spoke to it. 822 823## C.7 Security 824 825We apply technical and organisational measures appropriate to the risk: encryption in transit and at rest, access control on a need-to-know basis, logging of administrative access, segregation of environments, and contractual security obligations on our sub-processors. Our infrastructure is hosted in the United States (C.5). No system is perfectly secure, and we do not claim otherwise. 826 827Access to conversation data by sub-processors is limited to what is technically necessary to deliver the functionality requested, for the duration necessary to deliver it. No sub-processor receives conversation data for a purpose of its own, and none is permitted to use it to train a model (C.2). 828 829If a personal data breach occurs that is likely to result in a risk to your rights, we notify the competent supervisory authority within the time the applicable law requires, and we notify you directly where the risk is high. 830 831## C.8 Your rights 832 833Subject to the conditions of the law applicable to you, you have the right to: know what we hold and get a copy of it; have inaccurate data corrected; have data deleted; restrict processing; object to processing based on legitimate interests, including at any time to direct marketing; receive data you gave us in a portable format; and withdraw consent where processing rests on it. 834 835To exercise any of these, write to [[email protected]](mailto:[email protected]). We respond within one month, extendable by two further months for c
835omplex requests, and we will tell you if we need the extension. We do not charge, unless a request is manifestly unfounded or excessive. We may need to verify who you are, and we will ask for no more than is necessary to do that. 836 837Two practical limits, stated plainly rather than buried. First, if your data has already been delivered to a Creator as a Lead, we can delete our copy and pass your request on, but we cannot reach into the Creator's own systems - address that request to the Creator, whose identity and privacy notice were shown to you before you submitted, and whom we will identify to you on request. Second, if you used the Platform in Restricted Mode we may hold no information that lets us connect a request to your session; in that case we will tell you so rather than ask you for identifying data we do not otherwise have. 838 839You may also complain to a supervisory authority - in the EEA or the United Kingdom, the authority in your country of residence or place of work; in the ADGM, the Office of Data Protection (contact via [www.adgm.com](https://www.adgm.com), under Operating in ADGM - Office of Data Protection). 840 841We would rather you came to us first, but nothing requires you to. 842 843## C.9 Automated decisions 844 845An Expert generates Answers automatically. That is the service you asked for, and it does not produce a legal or similarly significant effect on you within the meaning of Article 22 GDPR: an Expert answers questions, it does not decide anything about you. 846 847Automated systems also operate moderation, rate limiting, fraud detection, and the visibility ranking of Experts. Where an automated measure affects a Creator - a restriction, a change of ranking zone, a suspension - Terms B.11.2 and B.12.3 give a route to human review, and we mean it: a person looks at it and can reverse it. 848 849We do not carry out profiling for advertising, and we do not sell or share personal data for behavioural advertising. 850 851## C.10 Changes to this Policy 852 853We will update this Policy as the product changes. Registered Users and Creators are notified by email or in-product. Material changes take effect no less than 30 days after notice, and Creators acting in a trade or profession receive at least the notice period required for business users under the Terms. Changes required by law may take effect sooner where the law demands it. 854 855Every version is dated and the previous version remains available. Where a change would extend what we do with data already collected, we will say so specifically rather than relying on a general statement that the Policy has been updated. 856 857## C.11 Contact 858 859Great Spirits Limited · Abu Dhabi Global Market, Al Maryah Island, Abu Dhabi, United Arab Emirates · [[email protected]](mailto:[email protected]) 860 861## Annex 1 - Sub-processors 862 863The current list of our sub-processors - who they are, what they do for us, where they process personal data, and the transfer mechanism relied on for each - is published at [greatexperts.ai/legal/subprocessors](https://greatexperts.ai/legal/subprocessors) and is updated there. Changes to the list are announced in accordance with Section C.3. Every sub-processor that processes conversation data is contractually bound by the restrictions in Section C.2, and the speech providers are contractually bound not to retain audio beyond the transient processing described in A.4. 864`;function Zat(){return s.jsx(cL,{title:"Privacy",accent:"Policy",meta:"Effe
864ctive 1 September 2026. Companion to the Terms and Conditions of the same date.",content:Qat,children:s.jsx(vs,{title:"Privacy Policy | Great Experts",description:"Great Experts privacy policy. How we collect, use, and protect your personal data under ADGM jurisdiction.",path:"/privacy"})})}const eit=`## What this page is for 865 866When you connect a social account to Great Experts, we store a small summary of 867that public account so your AI expert can be built from your own content. This 868page explains exactly what we keep, how to delete it yourself, and how to make 869us delete it. 870 871Deletion is immediate. Nothing is queued for later. 872 873## What we store when you connect an account 874 875Connecting an account proves you own it. That is the only reason we ask. 876 877We store: 878 879- The account or Page name, and its username or handle 880- The account's public identifier and profile link 881- The profile picture URL, where the platform provides one 882- The date you connected it 883 884We do **not** store: 885 886- Your password. We never see it. 887- Your access token. It is used once to confirm you own the account, then 888 discarded. We cannot act on your account afterwards, and we cannot post, 889 message, comment, or read your private data. 890- Anything from your personal Facebook profile. On Facebook we work with Pages 891 you manage, never your profile. 892 893## Delete it yourself, at any time 894 895**In Great Experts** 896 8971. Sign in and open [My account](/myaccount) 8982. Find the account under **Connected accounts** 8993. Click **Remove** 900 901The stored summary is deleted straight away. You can reconnect later if you 902change your mind. 903 904You can also remove a connection from the connector step while building an 905expert, using the same **Remove** action. 906 907**From Facebook** 908 9091. Open Facebook **Settings and privacy** â **Settings** 9102. Go to **Business integrations** 9113. Find **Great Experts Connectors** and choose **Remove** 912 913**From Instagram** 914 9151. Open Instagram **Settings and privacy** 9162. Go to **Apps and websites** 9173. Find **Great Experts** and choose **Remove** 918 919Removing the app from Facebook or Instagram notifies us automatically, and we 920delete the stored summary when that notification arrives. You do not need to do 921anything else. 922 923## Ask us to delete it 924 925If you would rather we handle it, email 926[[email protected]](mailto:[email protected]) from the address on your 927Great Experts account, telling us which connected account to remove. We will 928confirm once it is done. 929 930## Delete your whole account 931 932To remove everything, not just one connection, open 933[My account](/myaccount) and choose **Delete account** under **Manage my 934account**. 935 936Your account stays recoverable for 30 days: log back in any time before the 937deletion date and you can restore it. After that everything is permanently 938removed, including your experts, their knowledge, your uploads, and any 939connected social accounts. 940 941Two things worth knowing before you do it: 942 943- Anyone subscribed to your experts keeps access until their current billing 944 period ends. They are not charged again. 945- If you have earnings you can still withdraw, request that payout first. We 946 will ask you to before closing the account, so the money is not lost. 947 948## If you arrived here from a deletion request 949 950Facebook and Instagram send us a deletion request when you ask them to remove 951your data from an app. We act on those the moment they arrive: the stored public 952account summary is deleted synchronously, and no copy is kept. 953 954Because we hold no access tokens and no private account data, there is nothing 955further to revoke on your behalf. If you want written confirmation for your 956records, email 957[[email protected]](mailto:[email protected]). 958 959## Related 960 961- [Privacy Policy](/privacy) 962- [Terms and Conditions](/terms) 963`;function tit(){return s.jsx(cL,{title:"Data",accent:"deletion",meta:"How to remove a connected social account from Great Experts, and what we delete when you do.",content:eit,children:s.jsx(vs,{title:"Data Deletion | Great Experts",description:"How to delete a connected Facebook Page or Instagram account from Great Experts, what we store, and what we never store.",path:"/data-deletion"})})}const sit=`--- 964 965## Part I - General Provisions 966 967## 1. What Great Experts is, and what these Terms cover 968 969Great Experts is a platform on which named human creators build AI-powered expert agents grounded in their own knowledge, publish them on public profile pages and in Platform discovery, embed them on external websites, and interact with their audiences - including by voice - while retaining ownership of their content. 970 971These Terms and Conditions ("Terms") govern access to and use of the Great Experts platform (the "Platform"). The Platform is operated by Great Spirits Limited, a company incorporated in the Abu Dhabi Global Market ("ADGM"), Abu Dhabi, United Arab Emirates ("we", "us", "our"). 972 973These Terms consist of: 974 975* Part I - General Provisions, applying to everyone; 976* Section A - Terms for Users and Visitors, applying to people who visit Public Profiles, chat with Experts, or purchase subscriptions; 977* Section B - Terms for Creators, applying to people and entities that build and publish Experts and profile pages; 978* Section C - Common Provisions, applying to everyone. 979 980If you act in both capacities, both Sections apply to the respective activity. By accessing or using the Platform in any capacity, you agree to these Terms. The Privacy Policy, available at [https://greatexperts.ai/privacy](/privacy), is incorporated by reference. 981 982## 2. Definitions 983 984**Answer:** A single response delivered by an Expert to a question. 985 986**AnswerCap:** The maximum aggregate number of free-to-user Answers included in a Creator Studio plan, applied at the level of the Creator's account across all Creator Studio surfaces - per billing cycle on paid plans, and as a one-time lifetime allowance on the free plan. 987 988**Connected Account:** A social media, video, or website source that a Creator links to the Platform through an authorised connector integration for the purpose of importing and synchronising the Creator's own content. 989 990**Creator:** An individual or entity that has registered on the Platform to build and publish one or more Experts and/or a Public Profile. 991 992**Creator Materials:** All files, documents, transcripts, Social Content (whether exported or imported through a Connected Account), voice samples, links, configurations, and other content provided by a Creator as a Knowledge Source or otherwise for the purpose of configuring or operating an Expert or a Public Profile. 993 994**Creator Studio:** The Platform's subscription service (SaaS) for Creators, enabling Public Profiles, deployment of Experts via Widget and share-links, lead capture, and related tools, under the plans and pricing published on the Platform. 995 996**Creator Subscription:** A recurring subscription purchased by a User for direct private access to a Creator's Expert, at a monthly price set by the Creator within the bounds published on the Platform. 997 998**Creator Voice Model:** A synthetic voice model generated exclusively from voice samples of the Creator's own voice. 999 1000**Digital Product:** Digital content, digital services, software features, downloadable materials, or other digital offerings made available by a Creator through the Platform. 1001 1002**Excluded Categories:** The categories of goods, services, and content listed in Section B.4 that must not be linked to, promoted, or offered on any Platform surface. 1003 1004**Expert:** An AI-powered question-answering agent built by a Creator on the Platform, bounded to that Creator's Creator Materials. 1005 1006**Interaction Signals:** Non-conversational usage signals generated by a User's or Visitor's interaction with a Public Profile or Widget - such as link clicks, booking events, and traffic source - which are made available to the Creator independently of any Lead Sharing Level. 1007 1008**Knowledge Source:** A source of content that a Creator makes available to an Expert so that the Expert can answer from it - including uploaded files and documents, Social Content imported through a Connected Account, a website the Creator owns or c
1008ontrols, and content written by the Creator on the Platform. Making content available as a Knowledge Source is retrieval and grounding for the purpose of answering within the Expert's scope; it does not involve training any AI model (Section C.2). 1009 1010**Lead:** Personal data of a User or Visitor (contact details together with, depending on the Lead Sharing Level, a message, a summary, or a transcript) captured through an interaction with an Expert and made available to the relevant Creator. 1011 1012**Lead Sharing Level:** The level of conversation content a User or Visitor chooses to attach to a Lead: (a) full conversation transcript; (b) AI-generated summary of the conversation; or (c) contact details together with the User's message only. 1013 1014**Outbound Link:** A hyperlink placed by a Creator on a Public Profile or Widget that leads to a third-party website or service (including e-commerce stores and booking tools). 1015 1016**Platform Monetisation Services:** Any optional monetisation feature supported by the Platform, whether or not it involves a sale - including Creator Subscriptions and any future sales of Digital Products, paid content, digital downloads, memberships, courses and events, paid workflows, premium or usage-billed features, and transaction services. The Platform Monetisation Services available as at the Effective Date are those described in Sections A.9 and B.15. 1017 1018**Predefined Voice:** A synthetic voice made available by the Platform under licence from a third-party provider, not derived from the Creator's voice. 1019 1020**Public Profile:** A Creator's public-facing page hosted by the Platform (including link-in-bio pages), which may contain Outbound Links, booking links, content, and an interactive Expert. 1021 1022**Restricted Mode:** The interaction mode described in Section A.2 that applies to Visitors who are not signed in. 1023 1024**Social Content:** Content published by the Creator on their own social media accounts (posts, captions, transcripts of the Creator's own video or audio), excluding comments and any content authored by third parties. 1025 1026**User:** An individual with a registered account who interacts with Experts. 1027 1028**Visitor:** An individual who accesses a Public Profile or Widget without a registered account. 1029 1030**Voice Services:** Features enabling voice interaction with Experts, including speech-to-text input, text-to-speech output, voice calls, and automatic translation of spoken Answers. 1031 1032**Widget:** The embeddable interface through which a Creator's Expert can be accessed on an external website. 1033 1034## 3. Eligibility and accounts 1035 1036**3.1 Age.** You must be at least 18 years of age to use the Platform in any capacity - to interact with an Expert, to leave a Lead, to join a voice call, to register an account, to make any purchase, or to publish as a Creator. When you register an account you confirm, in the same step in which you accept these Terms and the Privacy Policy, that you are 18 or older; that confirmation is recorded together with the version of these Terms you accepted. Visitors who are not signed in interact in Restricted Mode (Section A.2), where no account is created; a Visitor who leaves a Lead or joins a voice call confirms being 18 or older as part of that step (Sections A.2 and A.7.1). The Platform is not directed at children, and Creators must not direct their Public Profiles, Experts, or Widgets at children. Section A.2 sets out what we do, and do not, do to enforce this. 1037 1038**3.2 Capacity.** By using the Platform you confirm you are legally capable of entering into a binding agreement. If you act on behalf of an entity, you confirm you have authority to bind it. 1039 1040**3.3 Accounts.** You agree to provide accurate registration information, keep your credentials secure, notify us promptly at [[email protected]](mailto:[email protected]) of suspected unauthorised access, and accept responsibility for activity under your account. 1041 1042**3.4 Consumers and business users.** Where you use the Platform as a consumer (for purposes outside your trade, business, craft, or profession), nothing in these Terms limits mandatory consumer rights available to you under the law of your habitual residence, and any provision of these Terms that conflicts with such mandatory rights does not apply to you to the extent of the conflict. Creators may be consumers in their relationship with us where they act outside a trade or profession; such Creators retain their mandatory consumer rights against us. 1043 1044## 4. Acceptable use (everyone) 1045 1046You agree not to use the Platform to: 1047 1048* post, upload, transmit, or link to unlawful, abusive, defamatory, obscene, or misleading content; 1049* infringe intellectual property, privacy, personality, or other rights of any third party; 1050* reverse engineer, scrape, or extract data from the Platform unless authorised by us; 1051* circumvent, manipulate, or disable safety, moderation, rate-limiting, verification, or quality systems, including through prompt injection or any technique designed to bypass automated controls;
1052* impersonate any person, User, Creator, or Expert, or misrepresent an affiliation; 1053* clone, or attempt to clone, the voice or likeness of any person other than yourself; 1054* introduce malware or interfere with the operation of the Platform; 1055* use the Platform for any purpose that violates applicable law. 1056 1057Violation may result in content removal, feature restriction, suspension, or termination in accordance with Section B.12 (for Creators) and Section C.6 (generally). 1058 1059## 5. AI disclosure and synthetic content 1060 1061Every Expert is an AI system, and you are told so. Disclosure does not depend on the interaction mode, the surface on which the Expert appears, or the jurisdiction in which you are located: 1062 1063* in text interaction, the Expert identifies itself as an AI system before the interaction begins and remains visibly labelled as AI throughout; 1064* in voice interaction, the disclosure is made at the start of the session and a visible AI indicator remains present for its duration; 1065* output generated by the Platform in synthetic voice is labelled as AI-generated in the interface and in the transcript, and is marked in machine-readable form where the applicable law so requires; 1066* automatic translations of Answers are identified as machine-generated. 1067 1068You are never speaking with the Creator personally when interacting with an Expert, including where the Expert uses the Creator's cloned voice. 1069 1070Creators must not configure, describe, or market an Expert in a way that presents it as a human being, obscures its AI nature, or removes, weakens, contradicts, or conceals any disclosure or label described in this Section. Doing so is a material breach and a ground for action under Section B.12. 1071 1072Great Experts applies this disclosure standard across the Platform irrespective of whether a particular interaction would independently require disclosure under applicable law. Where the applicable law requires more, that law prevails. 1073 1074--- 1075 1076## Section A - Terms for Users and Visitors 1077 1078## A.1 Public Profiles and what happens on them 1079 1080A Public Profile is a page operated by a Creator on Platform infrastructure. It may contain the Creator's links, content, booking options, and an interactive Expert. The Expert answers on the basis of the Creator's Creator Materials and identifies itself as an AI system in accordance with Section 5. You are never speaking with the Creator personally when interacting with an Expert, including when the Expert uses the Creator's cloned voice. 1081 1082## A.2 Restricted Mode and minors 1083 1084Visitors who are not signed in interact in Restricted Mode: interaction is session-based, no account is created, no persistent profile is built, and data collection is limited to what is necessary to operate the session and provide the features described below, as set out in the Privacy Policy. 1085 1086In Restricted Mode you may: chat with an Expert; leave a Lead (Section A.7); and, where the Creator has enabled it, make voice calls. Purchases and subscriptions require a registered account and are available only to persons aged 18 or over. Your interaction is not individually rate-limited: it draws on the relevant Creator's plan allowances (Section B.10.2), and where an allowance is exhausted the corresponding feature pauses until it is restored. We may introduce fair-use limits applying per Visitor, and will publish them on the Platform if we do. 1087 1088**Registered accounts.** Creating an account adds functionality that Restricted Mode does not provide: your conversation history with an Expert is retained and available to you, you may hold Creator Subscriptions (Section A.9), and
1088your preferences are saved to your account. What is retained, for how long, and how to delete it is described in the Privacy Policy. 1089 1090**Age.** Section 3.1 makes 18 a condition of using the Platform in any capacity, and every registered User and Creator confirms it at registration. A Visitor who browses or chats in Restricted Mode gives no confirmation, because no account is created; where a Visitor leaves a Lead or joins a voice call, the same 18-or-older confirmation is taken as part of that step (Section A.7.1). Beyond these declarations we do not verify age, and we do not profile Visitors in order to estimate it. The Platform is not directed at children, it carries no adult content, and Creators must not direct a Public Profile, an Expert, or a Widget at children. If we become aware that a registered account holder is under 18, we suspend the account, request age verification, and - if verification fails or is not provided within a reasonable period - close the account and delete the personal data associated with it in accordance with the Privacy Policy. If we become aware that a Lead or a conversation originates from a person under 18, we delete the personal data we hold and notify the Creator who received it; a Creator so notified must delete it. 1091 1092## A.3 Outbound Links - we are not the seller 1093 1094Public Profiles may contain Outbound Links to third-party stores, booking tools, and services. When you follow an Outbound Link, you leave the Platform. Any purchase, booking, subscription, or other transaction you enter into on a linked site is concluded exclusively between you and the relevant third party (the merchant, the booking provider, or the Creator, as applicable). We are not a party to such transactions, do not process their payments, do not hold the goods or provide the services, and are not responsible for their performance, quality, delivery, cancellation, or refunds. The identity of the seller or service provider is stated on the linked site; if it is not, do not transact and report the link to us. 1095 1096The Creator may receive a commission or other consideration in connection with transactions originating from Outbound Links; we do not charge commission on such transactions. Where an Expert's recommendation relates to a link from which the Creator derives consideration, this is disclosed as described in Section A.4. 1097 1098## A.4 Shopping assistance by Experts 1099 1100An Expert on a Public Profile may answer product questions and point you to the Creator's offers or Outbound Links. The following applies to all shopping assistance: 1101 1102* The Expert is an AI system; its suggestions are informational and generated from Creator Materials. They are not professional advice and not an inspection of the goods. 1103* Where the Creator has a commercial interest in a recommended link (own product, affiliate commission, sponsorship), the interaction discloses this commercial interest. 1104* Final product descriptions, prices, availability, and terms are those stated by the seller on the destination site, which prevail over anything the Expert says. 1105* We do not warrant that any recommended product is suitable for you. 1106 1107## A.5 Bookings 1108 1109Booking links (e.g., calendar scheduling tools) create an appointment or engagement solely between you and the Creator. The Creator alone is responsible for the appointment, its performance, cancellation, rescheduling, and any payment collected for it. The scheduling tool is a third-party service operating under its own terms. 1110 1111## A.6 Voice interaction 1112 1113Where Voice Services are available: 1114 1115* **You are always talking to an AI.** Section 5 governs disclosure; in a voice session the disclosure is made at the start and a visible indicator remains present throughout. The Expert may speak with a Creator Voice Model (the Creator's cloned voice, used with the Creator's express, logged authorisation) or with a Predefined Voice. 1116* **Transcript as record.** Every voice interaction is automatically transcribed into the chat. The transcript is the record of the interaction and is subject to the same terms as text Answers. We do not intentionally store or retain voice recordings once they have been processed to provide the service; audio is processed to produce speech and text, including by third-party processing providers acting on our behalf, and beyond the transient buffering that carrying and processing audio requires, no recording is kept. The Privacy Policy describes this in full. 1117* **Automatic translation.** Spoken Answers may be automatically translated into other languages, including in the Creator's cloned voice. Translations are machine-generated; the source-language transcript prevails in case of discrepancy. Creators may disable individual languages, so availability varies by Expert. 1118* **Synthetic content.** Voice output generated by the Platform is synthetic content and is labelled as such under Section 5. 1119* **No emergency use.** Voice Services must not be used for emergency communications of any kind. 1120 1121## A.7 Leads - contacting the Creator through the Expert 1122 1123**A.7.1 Lead Sharing Levels.** During a conversation, the Expert may offer to pass your question to the Creator. If you choose this, you select a Lead Sharing Level: 1124 1125* **Full transcript** - the Creator receives your contact details and the full transcript of your conversation with the Expert;
1126* **Summary** - the Creator receives your contact details and an AI-generated summary of the conversation. A summary is provided for convenience and may omit detail contained in the original conversation; 1127* **Contact details and your message only** - the Creator receives your contact details and the message you type, and nothing else from the conversation. 1128 1129Whatever level you choose, your contact details and the content you selected are transferred to the Creator only once you consent to that transfer at the point of submission; in the same step you confirm that you are 18 or older. Before you submit, the interface identifies the Creator and links to the Creator's privacy notice. From the moment of transfer the Creator processes that data as an independent data controller under the Creator's own privacy notice, as described in the Privacy Policy. You are never required to leave a Lead in order to use an Expert. 1130 1131**A.7.2 Creator conversation access.** Separately from leaving a Lead, the relevant Creator can review the questions and AI replies in conversations with their Expert to understand audience needs and how the Expert responded. The Creator view does not separately attach your contact details or account identity, but anything you type in the chat is part of the conversation and can be seen. Internal system and tool messages are excluded. The chat interface gives notice of this access before you send a message. Your Lead Sharing Level controls what is additionally attached to a contact request; it does not restrict this conversation-insights view. 1132 1133**A.7.3 Interaction Signals.** Separately from anything you say to an Expert, your use of a Public Profile or Widget generates Interaction Signals - non-conversational usage data such as which links you clicked, whether you booked an appointment, which source you arrived from, and aggregate usage statistics. Interaction Signals are available to the Creator independently of any Lead Sharing Level, and independently of whether you leave a Lead at all. They never contain the content of your conversation with an Expert, and no Lead Sharing Level either restricts or extends them. The Privacy Policy describes what is collected and on what basis. 1134 1135## A.8 Answers, boundaries, and no professional advice 1136 1137Every Expert is scope-bounded to its Creator Materials by design: the Platform is designed to answer from those materials, and where a question falls outside that scope the Expert states that it cannot answer rather than drawing on outside sources. This is an architectural constraint, not a content policy, and we apply it to every Expert. It is a design commitment, not a warranty of faultless operation: AI systems can err. AI-generated Answers may contain mistakes; verify important information independently. 1138 1139Nothing on the Platform constitutes medical, legal, investment, financial, tax, or other regulated professional advice, and no professional-client relationship is created. Experts covering regulated domains are labelled accordingly. For decisions with material personal, financial, or legal consequences, consult a licensed professional. We do not verify Creator credentials; Creators operating in regulated domains bear sole responsibility for compliance (Section B.13). 1140 1141## A.9 User payments 1142 1143**Free access.** Chatting with Experts on Public Profiles and Widgets is free of charge for Users and Visitors. Availability is bounded by the relevant Creator's plan allowances (Section B.10.2) and by any fair-use limits we publish. We do not sell Answers to Users. 1144 1145**Creator Subscriptions.** Users may subscribe to a Creator's Expert for direct private access. The Creator sets the monthly price within the published boun
1145ds (minimum USD 5.00, maximum USD 10,000). If the Creator changes the price, the new price applies to you only from your next billing cycle, and you will be notified before it takes effect; you may cancel before the new price applies. Creators may offer 0-10 free preview Answers. 1146 1147**Billing.** Payments are processed by our payment processor. Prices are stated inclusive of applicable consumption taxes where required by the law of your residence. 1148 1149## A.10 Consumer rights: withdrawal, refunds, complaints 1150 1151**A.10.1 Right of withdrawal (EU/EEA consumers).** If you are a consumer in the EU/EEA, you have the right to withdraw from a distance contract within 14 days without giving reasons. For digital services (Creator Subscriptions): 1152 1153* By starting to use the service within the withdrawal period, you expressly request immediate performance and acknowledge that, for ongoing services, you owe a proportionate amount for what was delivered before withdrawal. 1154* If you withdraw from a subscription within 14 days of purchase, we refund the price less a proportionate amount for the period elapsed. 1155* To withdraw, contact [[email protected]](mailto:[email protected]) with an unequivocal statement; you may use the model withdrawal form annexed to Directive 2011/83/EU but are not required to. 1156 1157**A.10.2 Refunds (all users).** Beyond mandatory rights: subscription cancellations take effect at the end of the current billing cycle with no refund for the current cycle except where mandatory law provides otherwise. Technical failures attributable to the Platform that prevent delivery of a paid service are remedied by credit or proportionate refund. We do not refund on the basis of dissatisfaction with Answer quality; use the rating system. 1158 1159**A.10.3 Legal guarantee of conformity.** For consumers in the EU/EEA, the statutory guarantee of conformity for digital content and digital services applies. If the service is not in conformity, you may request that it be brought into conformity, or a proportionate price reduction, or termination, under the conditions of applicable law. 1160 1161**A.10.4 Complaints and ADR.** Complaints go to [[email protected]](mailto:[email protected]); we acknowledge within 5 business days and respond substantively within 30 days. EU consumers may also use alternative dispute resolution entities available in their member state. Nothing prevents a consumer from bringing proceedings before the courts of their habitual residence. 1162 1163## A.11 Reporting content; our moderation decisions 1164 1165Anyone may report content on the Platform (including a Public Profile, an Expert's behaviour, or a link) at [[email protected]](mailto:[email protected]) or via in-product reporting where available. Reports should identify the content, its location, and the reason. We review reports diligently and non-arbitrarily. Where we remove or restrict content following a report or on our own initiative, we provide the affected person with a statement of reasons identifying the content concerned, the ground (law or these Terms, with the specific provision), and the channel for submitting explanations, except where prohibited by law or where the content is manifestly illegal spam at scale. Copyright complaints follow the dedicated procedure in Section C.3. 1166 1167--- 1168 1169## Section B - Terms for Creators 1170 1171## B.1 What you get 1172 1173Depending on your plan, the Platform provides you with: a Public Profile (link-in-bio page) with links, booking integration, and an interactive Expert; presence in Platform discovery, where enabled; Creator Studio deployment surfaces (Widget on your own or third-party sites, share-links); lead capture with Lead Sharing Levels and Interaction Signals; Voice Services including voice cloning and automatic translation; and access to the Platform Monetisation Services, which as at the Effective Date means one-to-one Creator Subscriptions (Outbound Links and bookings carry no Platform commission). Plans - including a free plan and paid plans billed monthly or annually - with their prices, features, limits, and configuration parameters (including Answer, voice-minute, contact, language, and Expert allowances) are published on the Platform and form part of these Terms. 1174 1175## B.2 Your content: ownership and our operating licence 1176 1177You retain full intellectual property rights in your Creator Materials, including voice samples and the resulting Creator Voice Model. To operate the service, you grant Great Spirits Limited a
1177non-exclusive, worldwide, royalty-free licence, for the duration of your use of the Platform plus the wind-down periods stated in these Terms, to host, index, process, store, reproduce, and display your Creator Materials and Public Profile solely for the purposes of: operating your Experts and Public Profile; retrieving from and grounding Answers in your Creator Materials, within your Experts' bounded scope; displaying your profile metadata; providing Voice Services you have enabled; and delivering Leads you have configured. This licence does not permit us to use your Creator Materials to train other Experts or any AI model, to build competing products, or for any purpose not listed here. On deletion, Section B.14 applies. 1178 1179## B.3 Knowledge sources and upload requirements 1180 1181**B.3.1 Knowledge sources.** You may make the following available to your Expert as Knowledge Sources: 1182 1183* files and documents you upload; 1184* your own Social Content, either exported and uploaded by you or imported through a Connected Account you authorise (e.g., your Instagram or YouTube account). Where you connect an account, we retrieve only your own content from it, and - where you enable synchronisation - we refresh that content on an ongoing basis (for example, importing your new posts) until you disconnect the account or disable synchronisation in your dashboard; 1185* the content of a website you own or control, which we may crawl and periodically re-crawl at your direction. 1186 1187We access third-party platforms only through connector integrations you have authorised; we do not otherwise scrape social platforms. Social Content must exclude comments and any third-party-authored content; imported content is filtered to your own posts, and you are responsible for reviewing imported material and removing anything you are not entitled to use. You are responsible for complying with the terms of each platform you connect or export from. 1188 1189**B.3.2 Attestations at upload and connection.** Before any upload, and when connecting a Connected Account or website, you must confirm: (i) Authorship & Rights - you created the material or hold a licence permitting this use; (ii) Derivative Works - you permit its use to operate AI Experts under these Terms; (iii) No Third-Party Claims - to your best knowledge it infringes no third-party rights, and you accept responsibility and indemnify us per Section C.5. For Social Content you additionally confirm the source contains only your own content and no third-party personal data beyond incidental appearances you are entitled to use. These attestations apply on a continuing basis to content imported through a Connected Account for as long as synchronisation remains enabled. An optional identity-verification confirmation is available. 1190 1191**B.3.3 Consent logging.** For each upload and each account or website connection we record and retain for at least 3 years (or longer where law requires): UTC timestamp, your user ID, IP address, accepted Terms version, SHA-256 checksum (for uploaded files), the connected source identifier (for Connected Accounts), and the state of each required checkbox. This log is the evidentiary record of your consent. 1192 1193**B.3.4 Prohibited knowledge-source content.** You must not upload or import material that infringes third-party IP; contains personal data of individuals who have not consented (beyond incidental appearances you are entitled to use); constitutes regulated advice you are not licensed to give; or is unlawful, defamatory, or obscene. Music, third-party likenesses, and licensed elements inside your Social Content are your responsibility under your attestation; we rely on your declaration and do not pre-clear rights. 1194 1195## B.4 Excluded Categories and conduct grounds 1196 1197**B.4.1 Excluded Categories (closed list).** You must not link to, promote, advertise, or offer on any Platform surface: 1198 1199* sexual or adult content and services; 1200* gambling, betting, and lotteries; 1201* weapons, ammunition, and explosives;
1202* narcotics, controlled substances, and related paraphernalia; 1203* financial or investment services requiring a licence - including crypto-asset offerings, lending, and investment advice - where the required licence is not held; 1204* products marketed with medical, therapeutic, or diagnostic claims lacking the required authorisation; 1205* multi-level marketing, "get-rich-quick", and recruitment-based earning schemes; 1206* counterfeit goods; 1207* content infringing third-party rights; 1208* content inciting hatred or violence; 1209* circumvention services, surveillance software, or hacking-for-hire; 1210* any goods or services illegal in the jurisdiction where they are offered or where your audience is targeted. 1211 1212**B.4.2 Conduct grounds (open).** Independently of the list above, we may act under Section B.12 where your conduct on or off the Platform involves fraud, impersonation, circumvention of limits or verification, manipulation of ratings or traffic, or conduct seriously damaging the Platform's integrity or reputation. The closed list governs what may be linked or offered; conduct grounds govern how you behave. 1213 1214## B.5 Outbound Links and disclosure 1215 1216You are responsible for every Outbound Link on your surfaces: its legality, its accuracy, and the identity of the seller behind it. We charge no commission on transactions originating from Outbound Links or otherwise concluded with your own audience outside the Platform's payment rails. Where your own commercial interest (your product, an affiliate commission, a sponsorship) applies to a link recommended by your Expert, the interaction will disclose a commercial interest, and you must not configure your Expert to conceal or misstate it. You must ensure that any affiliate or advertising relationships behind your links comply with disclosure laws applicable to your audience. 1217 1218## B.6 Bookings 1219 1220Where you connect a scheduling tool, appointments are contracts between you and the person booking. You are solely responsible for performance, cancellation, refunds, and any payment collected through the tool. You must ensure your booking flow identifies you as the counterparty. 1221 1222## B.7 Voice Services for Creators 1223 1224**B.7.1 Own voice only.** You may create a Creator Voice Model exclusively from samples of your own voice. Cloning, or attempting to clone, any other person's voice - living or deceased - is strictly prohibited, is a material breach triggering immediate termination under Section B.12.4, and may be referred to competent authorities. 1225 1226**B.7.2 Consent and logging.** Your express consent to creation and use of the Creator Voice Model is captured during the cloning flow and logged per Section B.3.3, including checksums of the samples. Completing the flow is your confirmation that the samples contain only your voice. We may require verification that the voice is yours, before or after activation, and may suspend the model pending verification. 1227 1228**B.7.3 What the voice can do.** Your Creator Voice Model voices only your own Experts. Where you enable automatic translation, your cloned voice may speak languages you do not speak, rendering machine translations of your Expert's Answers. You acknowledge this risk and can disable individual languages at any time in your dashboard. 1229 1230**B.7.4 Kill switch.** You may immediately disable your Creator Voice Model at any time from your dashboard; disabling takes effect for new sessions at once. You may separately request deletion; deleted models and samples are removed from active systems within 30 days. 1231 1232**B.7.5 Predefined Voices.** Predefined Voices are licensed from third-party providers for use within the Platform only; you acquire no rights in them beyond that use and may not extract or reuse them outside the Platform. 1233 1234**B.7.6 Synthetic content labelling.** Voice output is labelled as AI-generated and voice sessions begin with a disclosure, as required by Section 5. You must not remove, obscure, or contradict these disclosures in your configuration, your Expert's persona, or your marketing. 1235 1236## B.8 Leads and your role as data controller 1237 1238**B.8.1 Independent controller.** From the moment a Lead is delivered to you, you are an independent data controller of the personal data it contains. We are not your processor for that data, and our Privacy Policy stops applying to your subsequent use of it. 1239 1240**B.8.2 Your obligations.** You must: (a) maintain and link a privacy notice of your own that covers Leads, in the location we designate on your profile settings - Leads are not enabled without it; (b) use Lead data only for responding to the person's inquiry and purposes compatible with it; (c) establish your own lawful basis before any marketing communication - receipt of a Lead is not, by itself, marketing consent; (d) honour data subject requests addressed to you; (e) implement appropriate security; and (f) not sell or share Lead data with third parties except processors under contract. 1241 1242**B.8.3 Lead Sharing Levels, conversation insights, and Interaction Signals.** The person chooses what conversation content is attached to their Lead (full transcript, summary, or contact details plus their message). Separately, the Platform may show you the visitor and AI messages from conversations with your Experts for audience insights. We do not separately attach the visitor's contact or account identity, but information typed by the visitor remains part of the conversation; internal system and tool messages are excluded. The Platform may al
1242so provide you with anonymous aggregated audience insights derived from conversation content, such as common topics and interest in your offerings; these are shown only above a minimum-people threshold. You must not use conversation insights or aggregated audience insights to identify a visitor, enrich a Lead beyond what the person submitted, or send unsolicited marketing. Interaction Signals (clicks, bookings, traffic source) are provided independently and never contain conversation content. 1243 1244**B.8.4 Responsibility.** You bear full responsibility for your processing of Leads and indemnify us per Section C.5 against claims arising from it. 1245 1246## B.9 Embedding on external websites 1247 1248**B.9.1 Where you may embed.** You may embed the Widget on any website within your plan's limits. You need not pre-verify domains with us, but Section B.9.3 applies without limitation. 1249 1250**B.9.2 Your warranties.** For every site where your Widget appears, you warrant that: the site's content and operation are lawful in the jurisdictions it targets; the site does not fall within, promote, or monetise Excluded Categories; the site does not present the Widget in a misleading context (including implying the Expert is human or endorses the host site); and you have the right to place the Widget there. 1251 1252**B.9.3 Our right to disable.** We may disable the Widget on any domain immediately and without prior notice where we determine, in our reasonable discretion, that the host site or its use of the Widget violates law, public decency, these Terms, or your warranties above. We will provide you a statement of reasons and an explanations channel per Section B.12; disabling a domain does not by itself suspend your account. 1253 1254**B.9.4 Privacy architecture of the Widget.** The Widget is engineered so that the host site does not need its own consent banner for it: in its resting state the Widget stores nothing on the visitor's device and calls no third parties; upon interaction it uses session storage necessary to run the conversation; and our information notice is presented inside the Widget. In addition, the Platform collects first-party usage and performance data from Widget interactions - such as Interaction Signals, aggregated conversation analytics, and quality and safety telemetry - to provide you with insights and to operate and improve the service, as described in the Privacy Policy. Where the law applicable to a visitor requires consent for any such collection, the Widget obtains that consent through its own in-widget notice and consent flow. No third-party advertising or marketing trackers run on embedded surfaces. You must not wrap, modify, or instrument the Widget in a way that defeats this architecture or its notices. 1255 1256## B.10 Creator Studio (SaaS): plans, AnswerCap, trial, lifecycle 1257 1258**B.10.1 Service and plans.** Creator Studio is offered in a free plan and in paid plans billed as recurring subscriptions, monthly or annually in advance per the cycle you select, at the plan prices published on the Platform. Enterprise plans may be governed by a separate written agreement, which prevails over this Section to the extent of any conflict. We may introduce, discontinue, or modify Creator Studio plans, features, usage limits, allowances, pricing structures, optional modules, and optional services. Material changes affecting existing subscribers are communicated in advance in accordance with Section C.7, and a change to the price of your plan applies to you only from your next billing cycle. 1259 1260**B.10.2 Plan allowances.** Each plan includes published allowances for: free-to-user Answers (the AnswerCap), voice minutes (with a per-call duration limit), stored contacts (Leads), available call languages, and the number of Experts. The AnswerCap and the voice-minute pool apply per account, across all your Creator Studio surfaces. On paid plans, included Answers and voice minutes are allocated for each billing cycle and unused amounts do not carry over; when an allowance is exhausted, the corresponding feature pauses on all your surfaces until the next cycle allocation or an upgrade. On the free plan, the allowances are a one-time lifetime allocation: they do not renew, there is no further allocation, and when an allowance is exhausted the corresponding feature remains paused until you take a paid plan. Whenever a feature is paused, your Public Profile stays published and the Expert states that it is currently unavailable rather than answering. Persons holding an active
1260Creator Subscription to your Expert are never subject to the AnswerCap. Section B.10.3 sets out how these limits apply to each surface on the free plan. 1261 1262**Stored contacts.** Reaching your stored-contact allowance does not stop Lead capture. Leads continue to be captured, and the Leads disclosed to you are the most recent ones, up to the number published for your plan; the interface shows how many further Leads are held and that upgrading releases them. Leads held above your allowance are retained and released to you on upgrade; they are not disclosed to you in the meantime, and they are retained for no longer than 12 months from capture - if you have not upgraded by then, they are deleted, and you are notified in advance that this will happen. The same rule applies where the allowance is exceeded as a result of a downgrade. 1263 1264**B.10.3 The free plan: what limits it, and how.** The free plan is subject to two limits of different kinds, applying to two different surfaces. Neither requires a payment method. 1265 1266* **Your Public Profile is limited by volume, not by time.** You may publish a Public Profile with an Expert on the free plan and keep it published for as long as you wish. The Expert answers until the free-plan Answer allowance is exhausted; from that point it states that it is currently unavailable, while the Profile itself remains published. There is no date on which a Public Profile expires. 1267* **Your Widget is limited by time, not by volume.** Deployment of the Widget on an external website is available on the free plan for 7 days from the creation of your account. At the end of that period the Widget is disabled on every domain and cannot be re-enabled on the free plan, however many Answers remain in your allowance. Continued deployment of the Widget requires a paid plan. 1268 1269The two limits operate independently, with one point of contact: both surfaces draw on the same account-level Answer allowance, so if that allowance is exhausted before the seventh day, the Widget stops answering at that point as well. Paid plans may require a valid payment method. Where you are a consumer, Section A.10.1 applies to you in your relationship with us. 1270 1271**B.10.4 Fees, withdrawal, cancellation.** Subscriptions are billed monthly or annually in advance, per the billing cycle you select. By starting a subscription you request immediate performance. Consumers in the EU/EEA may withdraw within 14 days of the first charge with a refund reduced proportionately for the period already provided; all subscribers may cancel anytime, effective at the end of the prepaid period without refund for the current cycle except where mandatory law provides otherwise. Technical failures consuming an Answer without delivery are credited automatically. 1272 1273**B.10.5 Downgrade.** On downgrade, all deployed embed locations and share-links are disabled; you then select which to reactivate within the new plan's limits. 1274 1275**B.10.6 Lapse and downgrade to the free plan.** If a paid subscription is not renewed, your account moves to the free plan at the end of the prepaid period: surfaces and Experts exceeding free-plan allowances are disabled, Widget deployments are disabled, and paid-plan features cease. Moving to the free plan does not create a new free-plan allocation: the free-plan allowances are a one-time lifetime allocation under B.10.2, so if yours has already been consumed the corresponding features remain paused until you take a paid plan again. Stored Leads are not deleted; those exceeding the free-plan allowance are held and not disclosed to you until you upgrade, in accordance with B.10.2. Export what you wish to retain before the end of the prepaid period; Section B.14 governs Creator Materials, which are not deleted by lapse alone. 1276 1277## B.11 Visibility, ranking, and data access 1278 1279**B.11.1 Ranking parameters.** Where the Platform ranks or features Experts and Public Profiles (search, discovery), the main parameters determining ranking are, in order of significance: (1) User quality ratings (minimum 20 ratings over a rolling 30-day window; until then, default standard visibility); (2) relevance of the Expert's declared scope to the query or context;
1279 (3) recency and consistency of activity. Paid placement, where offered, is always labelled as such. Ratings affect visibility only, never your revenue share. 1280 1281**B.11.2 Rating zones.** Experts with sustained high ratings are featured in discovery; Experts falling below the published thresholds are hidden from discovery and have 30 days to recover before removal from discovery surfaces. Zone changes are automated; you may contest a zone decision through the Section B.12.3 channel and obtain human review. 1282 1283**B.11.3 Data access.** Through your dashboard you have access to: your Creator Materials; Interaction Signals and conversation analytics from your surfaces; topics, summaries, and visitor/AI messages from conversations with your Experts; Lead data; performance analytics on your Experts; and your transaction and payout records. Conversation insights do not separately attach visitor contact or account identity, but include information typed in the chat; internal system and tool messages are excluded. We retain access to platform operational data. After termination, Section B.14 and the Privacy Policy govern residual access. 1284 1285## B.12 Enforcement: restriction, suspension, termination 1286 1287**B.12.1 Grounds.** We may restrict, suspend, or terminate your services or account where: you breach these Terms (including Excluded Categories, voice cloning rules, Lead obligations, embed warranties); your content or conduct violates law or public decency; we are required by law or a competent authority; or repeated infringement occurs. 1288 1289**B.12.2 Immediate action with reasons.** Where the violation is serious or ongoing harm is likely, we act immediately - disabling the specific Expert, surface, domain, feature, or account. In every case we provide you, at or before the time the measure takes effect (or without undue delay where prior notice would defeat the measure's purpose or is prohibited), a statement of reasons: the facts, the provision breached, and the scope and duration of the measure. 1290 1291**B.12.3 Explanations and review.** You may submit explanations to [[email protected]](mailto:[email protected]). A human reviews your submission; we may reinstate, modify, or maintain the measure and will inform you of the outcome. Manifest bad faith or repetitive submissions may be handled summarily. 1292 1293**B.12.4 Termination of the whole relationship.** Full termination of our services to you takes effect 30 days after a statement of reasons on a durable medium, except that termination is immediate where: required by law or a regulatory obligation; you have repeatedly infringed these Terms; or an imperative reason under law justifies it (including fraud, voice-cloning abuse, or child-safety violations). During any notice period you may request payout of accrued earnings. 1294 1295**B.12.5 No refund for cause.** Fees are not refunded for periods during which services are disabled for cause under this Section. 1296 1297## B.13 Regulated domains 1298 1299You are solely responsible for ensuring your Expert, Public Profile, links, and the advice or content they provide comply with the laws, regulations, and professional standards of every jurisdiction you operate in or target - including licensing regimes and, for health-related Experts, obligations under the EU Artificial Intelligence Act. We may require a separate addendum as a condition of operating in a regulated domain, and we accept no liability for regulatory consequences of your regulated-domain activity. Medical-domain Experts carry a disclaimer at the point of interaction; its presence implies no verification of your credentials by us. 1300 1301## B.14 Closing your account; data and voice wind-down 1302 1303You may close your account anytime from your account settings, or via [[email protected]](mailto:[email protected]). On closure: your Creator Materials, including voice samples and Creator Voice Models, are removed from active systems within 30 days, and any Connected Accounts are disconnected; existing subscribers under Creator Subscriptions retain access through their current billing cycle; accrued unpaid earnings are paid in the next regular payout cycle, and where a withdrawable balance is outstanding we ask you to request that payout before closing so it is not lost; and your Public Profile and Widgets are taken down. You may request an export of your Creator Materials before or within 30 days after closure (Section C.9). 1304 1305## B.15 Earnings, payouts, taxes 1306 1307As at the Effective Date of these Terms, Creator Subscriptions are the only Platform Monet
1307isation Service on which we charge commission. Earnings accrue from Creator Subscriptions routed through the Platform: you receive 70% of the gross subscription price, and we retain 30% as the platform commission; payout-processor fees are borne by you from your share. Sales you conclude with your own audience through Outbound Links or booking tools carry no Platform commission and do not pass through our payment rails. 1308 1309We may make additional Platform Monetisation Services available in future, and such services may carry a commission or transaction-based fee. Any such service is optional for the Creator: it applies to you only if you choose to take it up, and its introduction and its rates are subject to prior notice in accordance with Section C.7. We do not apply commission retroactively to earnings already accrued, and we do not impose commission on a transaction that does not pass through the Platform's payment rails. 1310 1311We may determine which Platform Monetisation Services are available to particular Creators, on the basis of product availability, eligibility criteria, compliance requirements, or other conditions published on the Platform. Availability may therefore differ between Creators, plans, and territories, and a service may be released in stages. 1312 1313Payouts are processed by one or more third-party Payout Processors under their own terms, eligibility, verification (KYC), holds, and reserves; we are not liable for Payout Processor decisions, holds, or delays. Payouts are available on request no more than once every 30 days, subject to a USD 50 minimum threshold, denominated in USD, with currency conversion costs borne by you. We never retroactively reduce accrued earnings on a change of rates. We may withhold, offset, or claw back earnings generated by invalid activity or reversed by refunds and chargebacks; you bear your proportionate share of reversed transactions. Payment disputes must be raised within 30 days. 1314 1315You are solely responsible for your taxes in every relevant jurisdiction; we may be required to collect and report seller information to tax authorities under platform-reporting rules (including DAC7 where applicable), and you agree to provide the information required for such compliance; failure to provide it may result in withholding of payouts or suspension where the law so requires. 1316 1317--- 1318 1319## Section C - Common Provisions 1320 1321## C.1 Platform IP 1322 1323All non-user-generated Platform assets - name, logo, code, automated moderation and safety systems, UI, documentation, and Predefined Voices - are owned by or licensed to Great Spirits Limited. Unauthorised use is prohibited. 1324 1325## C.2 No training on your data 1326 1327Creator Materials are never used to train any other Expert or any AI model, ours or third-party. User and Visitor questions are never used to train any model. These restrictions are reflected in our agreements with sub-processors. For the avoidance of doubt, making content available as a Knowledge Source under Section B.3 is retrieval and grounding for the purpose of answering within your Expert's scope, and is not model training. Aggregated, anonymised analytics (Sections B.9.4 and B.11.3) are not model training and do not fall within this restriction. 1328 1329## C.3 Copyright complaints 1330 1331Copyright notices go to [[email protected]](mailto:[email protected]) with: your identity and contact details; identification and proof of ownership of the work; identification and location of the allegedly infringing material; a good-faith statement; and a statement of accuracy and authority. We acknowledge within 5 business days, classify by risk (high: suspension pending investigation with prompt notice; medium: review with notice in due course; low: closure with explanation), give the affected Creator 5 business days to counter-notice with human assessment, reinstate where a credible counter-notice stands unopposed by legal requirement, and retain records for 3 years. Repeat infringers are terminated under Section B.12.4. 1332 1333## C.4 Disclaimers and liability 1334 1335**C.4.1 Availability.** We do not warrant uninterrupted or error-free operation and may modify or discontinue features per Section C.7. 1336
1337**C.4.2 Content.** Answers are generated from Creator Materials; we do not warrant their accuracy, completeness, currency, or suitability. Third-party sites reached by Outbound Links are outside our control. 1338 1339**C.4.3 Liability.** Nothing in these Terms excludes or limits liability that cannot be excluded by law - including liability for death or personal injury caused by negligence, for fraud, for intentional misconduct or gross negligence, or mandatory consumer liability. Subject to that, to the maximum extent permitted: we are not liable for indirect, incidental, special, consequential, or punitive damages, loss of profits, business, data, or goodwill; and our total aggregate liability is capped at the greater of the amounts you paid us in the 3 months preceding the claim or USD 100. This cap does not apply to consumers where the law of their habitual residence prohibits such a cap. 1340 1341## C.5 Indemnification 1342 1343You indemnify Great Spirits Limited and its officers, directors, employees, affiliates, licensors, and agents against claims, losses, and expenses (including legal fees) arising from: your breach of these Terms; your Creator Materials (including IP claims, Social Content rights, and content imported through Connected Accounts); your Outbound Links and the transactions behind them; your processing of Leads; your embeds and host sites; misrepresentation of credentials; Answers based on materials you provided; and your tax liabilities. For consumers, this clause applies only to the extent permitted by mandatory law. 1344 1345## C.6 Suspension and termination (Users) 1346 1347We may suspend or terminate a User account for material breach, fraud, abuse of the Platform, or legal requirement, with a statement of reasons except where prohibited. Users may close their account anytime; any active Creator Subscription at self-initiated closure runs to the end of its current billing cycle and is handled per Section A.10.2. 1348 1349## C.7 Changes to these Terms and to features 1350 1351We may update these Terms and Platform features. Registered users receive notice by email and/or in-product. Business users (Creators acting in a trade or profession) receive at least 15 days' notice before changes take effect, extended where the change requires technical adaptation; changes to revenue share, payout mechanics, or data use carry at least 30 days' notice. Consumers receive reasonable advance notice, at least 30 days for material changes. Continued use after the effective date is acceptance; if you do not agree, stop using the Platform and close your account before the effective date. Immediate changes are permitted only where required by law or to address unforeseen and imminent danger. 1352 1353## C.8 Force majeure 1354 1355Neither party is liable for failure or delay caused by circumstances beyond its reasonable control (natural disasters, war, governmental action, sanctions, outages, third-party infrastructure failure). If a force majeure event exceeds 60 days, either party may terminate the affected services on written notice; accrued Creator earnings are paid in the next regular cycle. 1356 1357## C.9 Data portability 1358 1359Creators may request an export of their Creator Materials (files and associated metadata) in a commonly used, machine-readable format; we deliver within 30 days. Platform-generated data (ratings, routing logs, aggregated analytics) is excluded except where law provides broader rights. 1360 1361## C.10 Governing law and disputes 1362 1363These Terms are governed by the laws of the Abu Dhabi Global Market. Disputes are subject first to good-faith negotiation and, if unresolved within 30 days, to the jurisdiction of the ADGM Courts - except that, if you are a consumer, you may bring proceedings in the courts of your habitual residence, proceedings against you may be brought only there, and you enjoy the mandatory protections of that law regardless of the choice of ADGM law. 1364 1365## C.11 Notices; sanctions; general 1366 1367**Notices.** From us: email to your registered address or in-product, deemed received 24 hours after sending absent delivery failure. From you: [[email protected]](mailto:[email protected]), deemed received the next business day upon our written acknowledgement. Keep your email current. 1368 1369**Sanctions.** You may not use the Platform if located in, resident in, or acting for any person in a jurisdiction under comprehensive sanctions (UAE, OFAC, OFSI, EU, UN) or if designated on a sanctions list. We may suspend access where a sanctions obligation applies. 1370 1371**General.** These Terms with the Privacy Policy and any addenda are the entire agreement; severability, no-waiver, and our right of assignment (yours only with consent) apply; the English version prevails over translations. 1372 1373**Survival.** Sections B.2 (residual licence for wind-down), B.8 (your controller obligations for Leads already received), C.1, C.3-C.5, C.10, C.11, and data-retention obligations survive termination. 1374 1375## C.12 Contact 1376 1377Great Spirits Limited · Abu Dhabi Global Market, Al Maryah Island, Abu Dhabi, UAE · [[email protected]](mailto:[email protected]) 1378 1379Great Experts is a product of Great Spirits Limited. The Platform operates at greatexperts.ai. All legal and contractual obligations under these Terms are obligations of Great Spirits Limited. 1380`;function nit(){return s.jsx(cL,{title:"Terms and",accent:"Conditions",meta:"Effe
1380ctive 1 September 2026. Supersedes the terms published 13 July 2026.",content:sit,children:s.jsx(vs,{title:"Terms & Conditions | Great Experts",description:"Great Experts terms of service. Your agreement when using the platform operated by Great Spirits Limited (ADGM).",path:"/terms"})})}const GS=[{id:"getting-started",title:"Getting Started",items:[{q:"What is Great Experts?",a:"A chat platform where you talk to AI experts built from real people's knowledge. Each expert only answers from what their creator uploaded â no guessing."},{q:"How do I sign up?",a:`You have two options. The quickest way is "Sign in with Google" â one click, no password. You can also sign up with your name, email, and a password (you'll need to confirm it). Apple sign-in is coming soon for Mac and iOS users.`}]},{id:"experts",title:"Experts",items:[{q:`Why does an expert say "I don't know"?`,a:"Because it's honest. Each expert only knows what its creator uploaded â documents, videos, articles. If your question is outside that knowledge, it won't guess. That's the point: no made-up answers. Try rephrasing, or find a different expert whose training covers your topic."}]},{id:"becoming-creator",title:"Becoming a Creator",items:[{q:"How do I create my own expert?",a:"Click Create Expert from the menu. Five steps: Profile (name, tagline, description), Knowledge (upload documents, videos, articles), Score (get a quality check), Style (how your expert speaks), and Test (chat with it yourself). Takes about 10 minutes for a first version."},{q:"What can I upload as knowledge?",a:"PDFs, Word docs, text files, articles, YouTube videos, your own writing. Text-heavy sources score higher than video alone. The more high-quality material, the better your expert."},{q:"Does Great Experts own my knowledge?",a:"No. You own what you upload. We don't train other models or other experts on your materials. This is explicit in our Terms."}]},{id:"privacy-safety",title:"Privacy & Safety",items:[{q:"Are my chats private?",a:"Yes. Other users don't see them. We don't build a public profile of you based on what you ask."},{q:"Do experts learn from what I say?",a:"No. Experts only know what their creator uploaded before you arrived. Nothing you say in chat becomes part of the expert's knowledge."},{q:"Do you train AI models on my data?",a:"No. Your conversations aren't used to train any AI model â not ours, not a third party's."},{q:"An expert said something alarming â what do I do?",a:"Email [email protected] with the chat link and what you saw. Our moderation system reviews flagged content. Serious violations get experts removed."}]},{id:"technical",title:"Technical & Troubleshooting",items:[{q:"I found a bug. Where do I report it?",a:"Email [email protected] with a description and, if possible, a screenshot. We're in alpha and fixing things fast â every bug report helps."},{q:"Can I use Great Experts on my phone?",a:"Yes, through the mobile web. Native iOS and Android apps are coming soon."},{q:"What languages are supported?",a:"The platform interface is in English at launch. Individual experts can respond in other languages if you ask. Full multi-language UI is coming soon."},{q:"My expert's answer is different from last time â why?",a:"Experts don't give identical answers to identical questions â that's how language models work. If the content is wrong or the style has shifted dramatically, let the creator know through their profile."}]}];function rit(){const[e,t]=f.useState(!1),[n,r]=f.useState([]),[a,i]=f.useState(""),[o,l]=f.useState(!1),[c,u]=f.useState(""),[d,h]=f.useState({name:"",avatar_url:""}),p=f.useRef(null),m=f.useRef(null);f.useEffect(()=>{let y=!1;return Se.get("/faq/expert").then(v=>{!y&&v?.data&&h(v.data)}).catch(()=>{}),()=>{y=!0}},[]),f.useEffect(()=>{e&&p.current&&(p.current.scrollTop=p.current.scrollHeight)},[n,o,e]),f.useEffect(()=>{e&&m.current&&m.current.focus()},[e]);const g=async()=>{const y=a.trim();if(!y||o)return;const v=n.slice(-10);r([...n,{role:"user",content:y},{role:"assistant",content:"",_isStreaming:!0}]),i(""),u(""),l(!0);const w=E=>{r(S=>{const _=S.slice(),k=_[_.length-1];return k&&k.role==="assistant"&&(_[_.length-1]={...k,content:k.content+E}),_})},j=()=>{r(E=>{const S=E.slice(),_=S[S.length-1];if(_&&_.role==="assistant"&&_._isStreaming){const{_isStreaming:k,...C}=_;S[S.length-1]=C}return S})};try{const E=await fetch(`${Hr}/faq/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:y,history:v})});if(!E.ok){let N;try{N=await E.json()}catch{}const A=N?.detail?.message||(typeof N?.detail=="string"?N.detail:null)||`Request failed (${E.status})`;throw new Error(A)}const S=E.body.getReader(),_=new TextDecoder;let k="",C=!1;for(;!C;){const{value:N,done:A}=await S.read();if(A)break;k+=_.decode(N,{stream:!0});const T=k.split(` 1381 1382`);k=T.pop()??"";for(const I of T){const $=I.trimStart();if(!$.startsWith("data: "))continue;const O=$.slice(6);if(O==="[DONE]"){C=!0;break}
1382w(O.replace(/\\n/g,` 1383`))}}j()}catch(E){j(),u(E.message||"Something went wrong. Please try again.")}finally{l(!1)}},x=y=>{y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),g())},b=!e&&n.length===0;return s.jsx("div",{className:"fixed bottom-5 right-5 sm:bottom-6 sm:right-6 z-50",children:s.jsx(Ei,{mode:"wait",initial:!1,children:e?s.jsxs(Dn.div,{initial:{opacity:0,y:16,scale:1},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:12,scale:1},transition:{duration:.18,ease:"easeOut"},className:"w-[calc(100vw-2.5rem)] sm:w-[380px] h-[min(560px,calc(100vh-3rem))] rounded-2xl border border-slate-200 dark:border-white/10 bg-white dark:bg-neutral-950 shadow-2xl shadow-slate-900/10 dark:shadow-black/40 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-slate-200 dark:border-white/10 bg-slate-50 dark:bg-white/[0.02]",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-primary-100 dark:bg-primary-500/20 flex items-center justify-center shrink-0 overflow-hidden",children:d.avatar_url?s.jsx("img",{src:d.avatar_url,alt:d.name||"FAQ expert",className:"w-full h-full object-cover",onError:y=>{y.currentTarget.style.display="none"}}):s.jsx(Ms,{size:16,className:"text-primary-600 dark:text-primary-400"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-sm font-medium text-slate-900 dark:text-white leading-tight",children:"Ask our FAQ expert"}),s.jsx("p",{className:"text-[11px] text-slate-500 dark:text-neutral-400 leading-tight",children:"Quick answers to common questions"})]}),s.jsx("button",{type:"button",onClick:()=>t(!1),className:"w-8 h-8 rounded-lg flex items-center justify-center text-slate-500 dark:text-neutral-400 hover:bg-slate-100 dark:hover:bg-white/5 hover:text-slate-900 dark:hover:text-white transition-colors","aria-label":"Minimize",children:s.jsx(as,{size:16})})]}),s.jsxs("div",{ref:p,className:"flex-1 overflow-y-auto px-4 py-4 space-y-3",children:[n.length===0&&!o&&s.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-primary-100 dark:bg-primary-500/15 flex items-center justify-center mb-3 overflow-hidden",children:d.avatar_url?s.jsx("img",{src:d.avatar_url,alt:d.name||"FAQ expert",className:"w-full h-full object-cover",onError:y=>{y.currentTarget.style.display="none"}}):s.jsx(Ms,{size:20,className:"text-primary-600 dark:text-primary-400"})}),s.jsx("p",{className:"text-sm font-medium text-slate-900 dark:text-white mb-1",children:"How can I help?"}),s.jsx("p",{className:"text-xs text-slate-500 dark:text-neutral-400 leading-relaxed",children:"Ask anything about Great Experts â creators, privacy, and more."})]}),n.map((y,v)=>s.jsx("div",{className:`flex ${y.role==="user"?"justify-end":"justify-start"}`,children:y.role==="user"?s.jsx("div",{className:"max-w-[85%] px-3.5 py-2 rounded-2xl rounded-br-sm text-sm leading-relaxed whitespace-pre-wrap break-words bg-primary-600 text-white",children:y.content}):y._isStreaming&&!y.content?s.jsxs("div",{className:"px-3.5 py-2.5 rounded-2xl rounded-bl-sm bg-slate-100 dark:bg-white/5 text-slate-500 dark:text-neutral-400 text-sm inline-flex items-center gap-1",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current animate-bounce",style:{animationDelay:"0ms"}}),s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current animate-bounce",style:{animationDelay:"150ms"}}),s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current animate-bounce",style:{animationDelay:"300ms"}})]}):s.jsx("div",{className:"max-w-[85%] px-3.5 py-2 rounded-2xl rounded-bl-sm text-sm leading-relaxed break-words bg-slate-100 dark:bg-white/5 text-slate-900 dark:text-white",children:s.jsx(Qf,{content:y.content,isStreaming:!!y._isStreaming})})},v)),c&&s.jsx("div",{className:"text-xs text-red-500 px-2",children:c})]}),s.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5 border-t border-slate-200 dark:border-white/10 bg-slate-50 dark:bg-white/[0.02]",children:[s.jsx("textarea",{ref:m,value:a,onChange:y=>i(y.target.value),onKeyDown:x,rows:1,disabled:o,placeholder:"Ask a questionâ¦",className:"flex-1 resize-none bg-transparent text-sm text-slate-900 dark:text-white placeholder:text-slate-400 dark:placeholder:text-neutral-500 outline-none px-2 py-2 min-h-[34px] max-h-[120px]"}),s.jsx("button",{type:"button",onClick:g,disabled:!a.trim()||o,className:"shrink-0 w-9 h-9 rounded-xl bg-primary-600 hover:bg-primary-700 disabled:opacity-40 disabled:cursor-not-allowed text-white flex items-center justify-center transition-colors","aria-label":"Send",children:s.jsx($u,{size:15})})]})]},"panel"):s.jsxs(Dn.button,{type:"button",onClick:()=>t(!0),initial:{opacity:0,y:10,scale:1}
1383,animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:1},transition:{duration:.18,ease:"easeOut"},whileHover:{scale:1.04},whileTap:{scale:1},className:"flex items-center gap-2 pl-4 pr-5 h-12 rounded-full bg-primary-600 hover:bg-primary-700 text-white shadow-lg shadow-primary-900/20 dark:shadow-black/40 transition-colors","aria-label":"Open FAQ chat",children:[s.jsx(ni,{size:18}),s.jsx("span",{className:"text-sm font-medium",children:"Ask AI"}),!b&&n.length>0&&s.jsx("span",{className:"ml-1 w-2 h-2 rounded-full bg-white/80","aria-hidden":"true"})]},"pill")})})}function ait(){const[e,t]=f.useState(""),[n,r]=f.useState(null),a=f.useMemo(()=>{const o=e.trim().toLowerCase();return o?GS.map(l=>({...l,items:l.items.filter(c=>c.q.toLowerCase().includes(o)||c.a.toLowerCase().includes(o))})).filter(l=>l.items.length>0):GS},[e]),i=f.useMemo(()=>a.reduce((o,l)=>o+l.items.length,0),[a]);return s.jsxs("div",{className:"min-h-screen bg-paper px-3 sm:px-4 py-12 sm:py-16",children:[s.jsx(vs,{title:"FAQ | Great Experts",description:"Answers to common questions about Great Experts: how AI experts work, how packs are billed, knowledge sources, and creator earnings.",path:"/faq"}),s.jsxs("div",{className:"max-w-3xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h1",{className:"text-4xl sm:text-5xl font-bold text-slate-900 dark:text-white mb-2",children:"GREAT EXPERTS"}),s.jsxs("h2",{className:"text-xl sm:text-2xl font-light mb-4",children:[s.jsx("span",{className:"text-slate-500 dark:text-neutral-400",children:"Frequently Asked "}),s.jsx("span",{className:"text-primary-600 dark:text-primary-400",children:"Questions"})]}),s.jsx("p",{className:"text-sm text-slate-400 dark:text-neutral-500",children:"Last Updated: 17 April 2026"})]}),s.jsxs("div",{className:"relative mb-10",children:[s.jsx("input",{type:"text",value:e,onChange:o=>t(o.target.value),placeholder:"Search questions...",className:"w-full px-5 py-3.5 border border-slate-200 dark:border-white/10 bg-slate-50 dark:bg-white/5 rounded-xl focus:outline-none focus:ring-1 focus:ring-slate-300 dark:focus:ring-white/20 focus:bg-white dark:focus:bg-white/10 text-slate-900 dark:text-white placeholder:text-slate-400 dark:placeholder:text-neutral-500 transition-all text-sm"}),e&&s.jsxs("p",{className:"text-xs text-slate-400 dark:text-neutral-500 mt-2 px-1 text-center",children:[i," ",i===1?"match":"matches"]})]}),!e&&s.jsx("div",{className:"flex flex-wrap justify-center gap-2 mb-12",children:GS.map(o=>s.jsx("a",{href:`#${o.id}`,className:"inline-flex items-center px-4 py-1.5 rounded-full text-xs font-medium border border-slate-200 dark:border-white/10 text-slate-600 dark:text-neutral-300 hover:border-slate-400 dark:hover:border-white/30 hover:text-slate-900 dark:hover:text-white transition-colors",children:o.title},o.id))}),a.length===0?s.jsxs("div",{className:"text-center py-16 space-y-3",children:[s.jsx("p",{className:"text-xl font-semibold text-slate-300 dark:text-neutral-700",children:"No matching questions"}),s.jsx("p",{className:"text-sm text-slate-400 dark:text-neutral-500",children:"Try different keywords or clear the search."})]}):s.jsx("div",{className:"space-y-12",children:a.map(o=>s.jsxs("section",{id:o.id,className:"scroll-mt-20",children:[s.jsx("h3",{className:"text-xl sm:text-2xl font-bold text-slate-900 dark:text-white mb-5",children:o.title}),s.jsx("div",{className:"space-y-3",children:o.items.map((l,c)=>{const u=`${o.id}-${c}`,d=n===u;return s.jsxs("div",{className:`rounded-xl border transition-colors ${d?"border-slate-300 dark:border-white/20 bg-slate-50 dark:bg-white/[0.03]":"border-slate-200 dark:border-white/10 bg-white dark:bg-transparent hover:border-slate-300 dark:hover:border-white/20"}`,children:[s.jsxs("button",{onClick:()=>r(d?null:u),className:"w-full flex items-center justify-between gap-4 px-5 py-4 text-left",children:[s.jsx("span",{className:"text-sm sm:text-base font-medium text-slate-500 dark:text-neutral-400",children:l.q}),s.jsx(Dn.span,{animate:{rotate:d?180:0},transition:{duration:.2},className:"shrink-0 text-slate-400 dark:text-neutral-500",children:s.jsx(Is,{size:18})})]}),s.jsx(Ei,{initial:!1,children:d&&s.jsx(Dn.div,{initial:{height:0,opacity:0}
1383,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"overflow-hidden",children:s.jsx("div",{className:"px-5 pb-5 pt-1 text-sm leading-relaxed text-slate-600 dark:text-neutral-400",children:l.a})})})]},u)})})]},o.id))}),s.jsxs("div",{className:"mt-16 rounded-lg border border-rule bg-gradient-to-br from-indigo-tint via-paper to-peach-tint shadow-card p-6 sm:p-8 text-center",children:[s.jsx("h3",{className:"font-heading text-xl font-medium text-ink tracking-tight mb-1",children:"Still have questions?"}),s.jsx("p",{className:"text-sm text-ink-mid mb-4",children:"We usually reply within 24-72 business hours."}),s.jsx("a",{href:"mailto:[email protected]",className:"inline-flex items-center px-6 py-2.5 rounded-md text-sm font-medium bg-indigo-wash text-indigo-deep border border-indigo hover:bg-indigo hover:text-cream transition-colors duration-300 ease-standard",children:"[email protected]"})]})]}),s.jsx(rit,{})]})}function iit({planName:e,keepCount:t,embedded:n,saving:r,onCancel:a,onConfirm:i}){const[o,l]=f.useState([]),c=h=>{l(p=>p.includes(h)?p.filter(m=>m!==h):p.length>=t?p:[...p,h])},u=o.length===t&&!r,d=n.filter(h=>!o.includes(h.expert_id));return Mn.createPortal(s.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-slate-900/50 p-4",children:s.jsxs("div",{className:"w-full max-w-lg max-h-[90vh] overflow-y-auto rounded-2xl bg-white dark:bg-neutral-900 shadow-2xl",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3 px-5 py-4 border-b border-slate-100 dark:border-neutral-800",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-base font-semibold text-slate-900 dark:text-white",children:["Choose what to keep on ",e]}),s.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:[e," covers ",t," embedded expert",t===1?"":"s",". You have ",n.length,"."]})]}),s.jsx("button",{type:"button",onClick:a,className:"w-8 h-8 shrink-0 rounded-lg flex items-center justify-center text-slate-400 hover:bg-slate-100 dark:hover:bg-neutral-800","aria-label":"Close",children:s.jsx(as,{size:16})})]}),s.jsx("div",{className:"p-5 space-y-2",children:n.map(h=>{const p=o.includes(h.expert_id),m=!p&&o.length>=t;return s.jsxs("label",{className:`flex items-center gap-3 rounded-xl border p-3 cursor-pointer transition-colors ${p?"border-primary-500 bg-primary-50 dark:bg-primary-900/15":`border-slate-200 dark:border-neutral-700 ${m?"opacity-50 cursor-not-allowed":"hover:border-slate-300"}`}`,children:[s.jsx("input",{type:"checkbox",checked:p,disabled:m,onChange:()=>c(h.expert_id),className:"w-4 h-4 shrink-0 accent-primary-600"}),h.avatar_url?s.jsx("img",{src:h.avatar_url,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}):s.jsx("span",{className:"w-8 h-8 rounded-full bg-slate-200 dark:bg-neutral-700 shrink-0"}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block text-sm font-medium text-slate-900 dark:text-white truncate",children:h.name}),s.jsx("span",{className:"block text-[11px] text-slate-400 truncate",children:h.domain})]})]},h.expert_id)})}),d.length>0&&o.length===t&&s.jsxs("div",{className:"mx-5 mb-4 rounded-xl border border-amber-200 dark:border-amber-900/40 bg-amber-50 dark:bg-amber-900/15 p-3 flex gap-2.5",children:[s.jsx(xr,{className:"w-4 h-4 text-amber-600 shrink-0 mt-0.5","aria-hidden":"true"}),s.jsxs("p",{className:"text-xs text-amber-900 dark:text-amber-200",children:[d.map(h=>h.name).join(", ")," lose",d.length===1?"s":""," its embed permanently. The snippet on ",d.length===1?"that website":"those websites"," stops working and can't be restored â you'd add the expert again and paste a new one."]})]}),s.jsxs("div",{className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-slate-100 dark:border-neutral-800",children:[s.jsx("button",{type:"button",onClick:a,className:"rounded-xl px-4 py-2.5 text-sm font-medium text-slate-500 hover:text-slate-900 dark:hover:text-white transition-colors",children:"Keep my plan"}),s.jsxs("button",{type:"button",onClick:()=>i(o),disabled:!u,className:"inline-flex items-center gap-2 rounded-xl bg-primary-600 hover:bg-primary-700 disabled:opacity-50 text-white text-sm font-semibold px-4 py-2.5 transition-colors",children:[r&&s.jsx(vt,{className:"w-4 h-4 animate-spin"}),o.length===t?`Switch to ${e}`:`Choose ${t-o.length} more`]})]})]})}),document.body)}
1383const zg=[{id:"lite",name:"Lite",price:9.99,blurb:"When your page starts working.",features:["500 answers + 60 voice min / month","100 contacts","Embed 1 expert on your site","7-day free trial"]},{id:"starter",name:"Starter",price:19.99,highlight:!0,blurb:"For selling sessions and products.",features:["1200 answers + 200 voice min / month","500 contacts · 3 call languages","2 experts, both embeddable","7-day free trial"]},{id:"pro",name:"Pro",price:59.99,blurb:"For a full brand presence.",features:["3000 answers + 700 voice min / month","2000 contacts · 20 call languages","4 experts · cloned voice · no badge","7-day free trial"]}],YS={lite:"Lite",starter:"Starter",practitioner:"Starter",pro:"Pro"},oit={trialing:"Free trial",active:"Active",past_due:"Payment due",canceled:"Canceled",incomplete:"Incomplete",unpaid:"Unpaid",unlimited:"Team · Unlimited"};function Az(e){if(!e)return null;try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return null}}function lit({showHeading:e=!0,manageOnly:t=!1}){const{addToast:n}=f.useContext(Zs),r=Ps(),[a,i]=f.useState(null),[o,l]=f.useState(""),[c,u]=f.useState(!1),[d,h]=f.useState(null),[p,m]=f.useState(null),g=()=>Eu().then(k=>i(k.data)).catch(()=>i({active:!1}));f.useEffect(()=>{g()},[]);const x=async(k,C="monthly")=>{l(k);try{const N=await $R(k,C),A=N?.data||N;if(!A?.client_secret||!A?.session_id||!A?.publishable_key)throw new Error("Checkout session missing client credentials");h({clientSecret:A.client_secret,sessionId:A.session_id,publishableKey:A.publishable_key})}catch(N){const A=N?.response?.data?.detail?.code;n(N?.response?.data?.detail?.message||(A==="PAYMENTS_DISABLED"?"Payments are not available right now.":"Could not start checkout."),"error")}finally{l("")}},b=async k=>{l(k);try{await DR(k),await g(),n(`${YS[k]||k} activated â your free trial is on. No card needed.`,"success")}catch(C){if(C?.response?.data?.detail?.code==="TRIAL_ALREADY_USED"){await x(k);return}n(C?.response?.data?.detail?.message||"Could not activate the plan.","error")}finally{l("")}},y=f.useCallback(async k=>{h(null),r(`/checkout/success?session_id=${encodeURIComponent(k)}&kind=creator_subscription`)},[r]),v=async(k,C=null)=>{l(k);try{await wJ(k,C),m(null),await g(),n(`Switched to ${YS[k]||k}.`,"success")}catch(N){const A=N?.response?.data?.detail;if(A?.code==="CHOOSE_EMBEDS_TO_KEEP"){m({plan:k,keepCount:A.keep_count,embedded:A.embedded||[]});return}n(A?.message||"Could not switch plan.","error")}finally{l("")}},w=async()=>{l("cancel");try{await vJ(),await g(),n("Your plan will cancel at the end of the period.","success")}catch(k){n(k?.response?.data?.detail?.message||"Could not cancel.","error")}finally{l(""),u(!1)}},j=e?s.jsxs("div",{children:[s.jsx("span",{className:"font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:"EMBEDDING"}),s.jsx("h2",{className:"font-heading text-xl font-medium text-ink tracking-tight mt-1",children:"Your embedding plan"})]}):null;if(a===null)return s.jsxs("section",{className:"space-y-4",children:[j,s.jsx("div",{className:"flex items-center justify-center py-8 rounded-lg border border-rule bg-paper",children:s.jsx(vt,{className:"w-5 h-5 animate-spin text-ink-light"})})]});if(a.active){const k=zg.find($=>$.id===a.plan)||zg[0],C=zg.filter($=>$.id!==k.id),N=!!a.unlimited,A=!!a.trial?.active,T=Az(a.trial_end&&a.status==="trialing"?a.trial_end:a.current_period_end),I=Az(a.embeds_purge_at);return s.jsxs("section",{className:"space-y-4",children:[j,s.jsxs("div",{className:"rounded-lg border border-rule bg-paper p-6",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-base font-semibold text-ink",children:k.name}),s.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] uppercase tracking-eyebrow font-mono font-medium border bg-indigo-wash text-indigo-deep border-indigo-tint",children:oit[a.status]||a.status})]}),s.jsx("p",{className:"text-xs text-ink-muted mt-1",children:N?s.jsxs(s.Fragment,{children:["Full Pro access for your team · ",a.embedded_count,"/",a.max_experts," experts embedded"]}):s.jsxs(s.Fragment,{children:["$",k.price,"/mo · ",a.embedded_count,"/",a.max_experts," experts embedded",T&&s.jsxs(s.Fragment,{children:[" · ",a.cancel_at_period_end?"Cancels":a.status==="trialing"?"Trial ends":"Renews"," ",T]})]})}),A&&s.jsxs("p",{className:"text-xs mt-1 font-medium text-indigo-deep",children:[a.trial.days_left===0?"Your free trial ends today":`${a.trial.days_left} day${a.trial.days_left===1?"":"s"} left in your free trial`," ","· no card on file â subscribe to keep ",k.name," after it ends."]})]}),!N&&s.jsxs("div",{className:"flex flex-wrap items-center gap-3 shrink-0",children:[A&&s.jsxs("button",{type:"button",onClick:()=>x(k.id),disabled:!!o,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-sm font-medium bg-ink text-cream hover:bg-ink-soft transition-colors disabled:opacity-50",children:[o===k.id?s.jsx(vt,{size:14,className:"animate-spin"}):null,"Subscribe now ($",k.price,"/mo)"]}),C.map($=>s.jsxs("button",{type:"button",onClick:()=>v($.id),disabled:!!o,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-sm font-medium bg-indigo text-cream hover:bg-indigo-deep transition-colors disabled:opacity-50",children:[o===$.id?s.jsx(vt,{size:14,className:"animate-spin"}):null,"Switch to ",$.name," ($",$.price,"/mo)"]},$.id)),c?s.jsxs("span",{className:"inline-flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-ink-mid",children:"Cancel at period end?"}),s.jsxs("button",{type:"button",onClick:w,disabled:o==="cancel",className:"inline-flex items-center gap-1 font-semibold text-destructive hover:opacity-80",children:[o==="c
1383ancel"?s.jsx(vt,{size:13,className:"animate-spin"}):null," Yes, cancel"]}),s.jsx("button",{type:"button",onClick:()=>u(!1),className:"text-ink-mid hover:text-ink",children:"Keep"})]}):!a.cancel_at_period_end&&s.jsx("button",{type:"button",onClick:()=>u(!0),disabled:!!o,className:"text-sm font-medium text-ink-mid hover:text-destructive transition-colors",children:"Cancel plan"})]})]}),a.cancel_at_period_end&&s.jsxs("p",{className:"mt-3 text-xs text-amber-600 dark:text-amber-400",children:["Set to cancel â your embeds stop working after ",T,I&&s.jsxs(s.Fragment,{children:[", and are removed for good on ",I]}),"."]})]}),p&&s.jsx(iit,{planName:YS[p.plan]||p.plan,keepCount:p.keepCount,embedded:p.embedded,saving:o===p.plan,onCancel:()=>m(null),onConfirm:$=>v(p.plan,$)})]})}const E=a.trial?.expired&&zg.find(k=>k.id===a.trial.plan)||null,S=E&&s.jsxs("div",{className:"rounded-lg border border-amber-200 dark:border-amber-900/40 bg-amber-50 dark:bg-amber-950/30 p-4 flex items-center justify-between gap-3 flex-wrap",children:[s.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-200",children:["Your ",E.name," free trial has ended â you're on the Free plan now. Everything you set up is safe; subscribe to unlock ",E.name," again."]}),s.jsxs("button",{type:"button",onClick:()=>x(E.id),disabled:!!o,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-sm font-medium bg-indigo text-cream hover:bg-indigo-deep transition-colors disabled:opacity-50",children:[o===E.id?s.jsx(vt,{size:14,className:"animate-spin"}):null,"Subscribe to ",E.name," ($",E.price,"/mo)"]})]});if(t)return s.jsxs("section",{className:"space-y-4",children:[j,S,s.jsxs("div",{className:"rounded-lg border border-rule bg-paper p-5 flex items-center justify-between gap-3 flex-wrap",children:[s.jsx("p",{className:"text-sm text-ink-mid",children:"You don't have an embedding plan yet."}),s.jsx(Le,{to:"/pricing?for=creators",className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-sm font-medium bg-indigo text-cream hover:bg-indigo-deep transition-colors",children:"Browse plans"})]})]});const _=!!a.trial?.used;return s.jsxs("section",{className:"space-y-6",children:[j,S,e&&s.jsx("p",{className:"text-sm text-ink-mid",children:_?"Pick the plan to unlock â billing starts when you subscribe.":"Start with a 7-day free trial â no credit card needed. Your plan activates instantly."}),s.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-5",children:zg.map(k=>{const C=!!k.highlight,N=o===k.id;return s.jsxs("div",{className:`relative rounded-lg border p-6 flex flex-col ${C?"border-indigo bg-paper shadow-elevation":"border-rule bg-paper shadow-card"}`,children:[C&&s.jsx("span",{className:"absolute -top-2.5 left-1/2 -translate-x-1/2 bg-indigo text-cream font-mono text-[10px] font-medium uppercase tracking-eyebrow px-3 py-1 rounded-pill",children:"Most popular"}),s.jsx("div",{className:"font-mono text-[11px] font-medium text-ink-muted uppercase tracking-eyebrow mb-2",children:k.name}),s.jsxs("div",{className:"font-heading text-3xl font-medium text-ink tracking-tight",style:{fontFeatureSettings:'"tnum" 1, "lnum" 1'},children:["$",k.price,s.jsx("span",{className:"text-base text-ink-mid font-normal",children:"/mo"})]}),s.jsx("div",{className:"mt-1 text-sm text-ink-mid",children:k.blurb}),s.jsx("ul",{className:"mt-6 space-y-2 text-sm text-ink flex-1",children:k.features.map(A=>s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(ft,{className:"w-4 h-4 mt-0.5 text-indigo shrink-0"}),A]},A))}),s.jsxs("button",{type:"button",onClick:()=>_?x(k.id):b(k.id),disabled:!!o,className:`mt-6 inline-flex items-center justify-center gap-2 py-2.5 rounded-md text-sm font-medium transition-colors disabled:opacity-60 ${C?"bg-indigo text-cream hover:bg-indigo-deep":"bg-ink text-cream hover:bg-ink-soft"}`,children:[N?s.jsx(vt,{className:"w-4 h-4 animate-spin"}):null,N?_?"Opening checkoutâ¦":"Activatingâ¦":_?"Subscribe":"Start 7-day free trial"]})]},k.id)})}),s.jsx("p",{className:"text-xs text-ink-muted",children:_?"Secure checkout by Stripe. Cancel anytime.":"No card required â the trial starts the moment you pick a plan. Cancel anytime."}),d&&s.jsx(MR,{clientSecret:d.clientSecret,sessionId:d.sessionId,publishableKey:d.publishableKey,title:"Subscribe to your plan",onComplete:y,onClose:()=>h(null)})]})}const Rz=3;function cit(){const{columns:e,rows:t}=Rke;return s.jsxs("div",{className:"mt-[34px] overflow-hidden rounded-[24px] border-[1.5px] border-cream-tint bg-paper",children:[s.jsx("div",{className:"px-6 pb-6 pt-8 sm:px-[26px] sm:pt-[34px]",children:s.jsxs("h2",{className:"m-0 font-heading text-[clamp(24px,2.6vw,38px)] font-medium leading-[1.08] tracking-[-0.02em] text-ink",children:["All plans, ",s.jsx("em",{className:"not-italic text-indigo",children:"side by side."})]})}),s.jsxs("div",{className:"overflow-x-auto px-4 pb-6 sm:px-[22px]",children:[s.jsxs("table",{className:"w-full min-w-[940px] table-fixed border-collapse text-left",children:[s.jsx("thead",{children:s.jsx("tr",{children:e.map((n,r)=>s.jsx("th",{scope:"col",className:`border-b-[1.5px] border-ink-light/60 py-[15px] text-sm font-bold ${r===0?"pl-[18px] pr-4 text-left text-ink-muted":`px-3 text-center ${r===Rz?"rounded-t-xl bg-indigo/[0.08] text-indigo":"text-ink"}`}`,children:n},n))})}),s.jsx("tbody",{children:t.map(([n,...r])=>s.jsxs("tr",{children:[s.jsx("th",{scope:"row",className:"border-b border-rule py-3.5 pl-[18px] pr-4 text-left text-sm font-semibold text-ink",children:n}),r.map((a,i)=>s.jsx("td",{className:`border-b border-rule px-3 py-3.5 text-center text-sm leading-[1.4] ${i+1===Rz?"bg-indigo/[0.07] font-semibold text-ink":"font-normal text-ink-mid"}`,children:a},`${n}-${e[i+1]}`))]},n))})]}),s.jsxs("div",{className:"mt-[22px] flex items-center gap-3.5 rounded-2xl border border-rule bg-cream-deep px-[18px] py-4",children:[s.jsx(Vh,{
1383className:"h-[21px] w-[21px] shrink-0 text-indigo",strokeWidth:1.7,"aria-hidden":"true"}),s.jsx("span",{"aria-hidden":"true",className:"h-[21px] w-px shrink-0 bg-rule"}),s.jsxs("span",{className:"text-sm leading-[1.5] text-ink-mid",children:[s.jsx("strong",{className:"font-semibold text-ink",children:"Secure checkout by Stripe."})," The free trial needs no card at all, and we never store your card details."]})]})]})]})}function uit(){return s.jsxs("section",{id:"billing-questions",className:"mx-auto mb-7 flex max-w-[1340px] scroll-mt-24 flex-col gap-[26px] px-5 pb-7 pt-11 sm:px-0",children:[s.jsxs("h2",{className:"m-0 text-center font-heading text-[clamp(30px,3.2vw,46px)] font-medium leading-[1.06] tracking-[-0.02em] text-ink",children:["Pricing ",s.jsx("em",{className:"not-italic text-indigo",children:"FAQ."})]}),s.jsx("div",{className:"flex flex-col gap-2.5",children:Pke.map(e=>s.jsxs("details",{name:"ge-faq",className:"ge-acc rounded-[18px] border border-rule bg-white shadow-subtle transition-colors duration-base ease-standard hover:border-indigo/30 open:border-indigo/40 open:bg-[#F4F4FD]",children:[s.jsxs("summary",{className:"flex items-center gap-4 px-5 py-5 sm:px-6 sm:py-[22px]",children:[s.jsx("span",{className:"shrink-0 font-mono text-[11px] font-medium tracking-[0.16em] text-ink-light",children:e.n}),s.jsx("span",{className:"flex-1 pr-2 font-heading text-[17px] font-medium leading-[1.3] tracking-[-0.015em] text-ink sm:pr-4 sm:text-[20px]",children:e.q}),s.jsx("span",{className:"ge-acc-sign flex h-[30px] w-[30px] shrink-0 items-center justify-center rounded-pill border border-rule bg-[#F4F4FD] text-[17px] font-medium leading-none text-indigo",children:s.jsx(Es,{className:"h-4 w-4","aria-hidden":"true"})})]}),s.jsx("div",{className:"ge-acc-body px-5 pb-6 sm:pl-14 sm:pr-[26px]",children:s.jsx("p",{className:"m-0 max-w-[86ch] text-[15px] leading-[1.6] text-ink-mid sm:text-base",children:e.a})})]},e.n))})]})}function dit({profiles:e}){const t=Nc();return s.jsxs("section",{className:"relative mx-auto mb-7 grid max-w-[1340px] grid-cols-1 overflow-hidden rounded-[28px] border-[1.5px] border-cream-tint bg-[#F4F4FD]/90 lg:min-h-[320px] lg:grid-cols-[minmax(0,1.35fr)_minmax(200px,420px)] xl:min-h-[340px] xl:grid-cols-[minmax(0,1.4fr)_minmax(230px,420px)]",children:[s.jsxs("div",{className:"z-[2] flex flex-col items-center justify-center gap-[22px] p-6 text-center sm:p-10",children:[s.jsxs("h2",{className:"m-0 text-balance font-heading text-[clamp(28px,3.3vw,52px)] font-medium leading-[1.06] tracking-[-0.02em] text-ink",children:["Start with the plan ",s.jsx("em",{className:"not-italic text-indigo",children:"that fits today."})]}),s.jsxs("div",{className:"mt-5 flex w-full flex-col items-stretch justify-center gap-3 sm:flex-row",children:[s.jsxs(Le,{...t,className:"ge-cta relative isolate inline-flex min-w-0 flex-1 items-center justify-center overflow-hidden rounded-pill border border-white/40 bg-indigo px-[22px] py-[18px] text-center text-[13px] font-semibold uppercase leading-[1.35] tracking-[0.1em] text-cream transition-transform duration-base ease-standard hover:-translate-y-0.5 active:translate-y-0 sm:max-w-[250px]",children:[s.jsx("span",{className:"relative z-[2]",children:"Create my profile with AI Expert"}),s.jsx("span",{"aria-hidden":"true",className:"ge-sheen pointer-events-none absolute -bottom-[20%] -top-[20%] left-[-60%] z-[1] w-[38%] -skew-x-[18deg] bg-gradient-to-r from-transparent via-white/40 to-transparent"})]}),s.jsx("a",{href:Qm,target:"_blank",rel:"noopener noreferrer",className:"inline-flex min-w-0 flex-1 items-center justify-center rounded-pill border-[1.5px] border-ink/20 bg-white/60 px-[22px] py-[18px] text-center text-[13px] font-semibold uppercase leading-[1.35] tracking-[0.1em] text-ink transition-colors duration-base ease-standard hover:border-ink hover:bg-white sm:max-w-[250px]",children:"Not sure yet? Let's talk"})]})]}),s.jsx(Dne,{profiles:e,framed:!0})]})}const Iz={starter:"Starter",standard:"Standard",power:"Power"},hit="standard";function pit(){const{isAuthenticated:e,balance:t}=Ut(),n=Ps(),{addToast:r}=f.useContext(Zs),[a,i]=f.useState([]),[o,l]=f.useState(!0),[c,u]=f.useState(null);f.useEffect(()=>{Urt().then(h=>i(h.data.packs)).catch(()=>r("Could not load pricing.","error")).finally(()=>l(!1))},[r]);const d=async h=>{if(!e){n("/login?redirect=/pricing?for=users");return}u(h);try{const p=await zrt(h);window.location.assign(p.data.url)}catch(p){const m=p.response?.data?.detail?.code;r(m==="PAYMENTS_DISABLED"?"Payments are not enabled in this environment yet.":"Could not start checkout. Please try again.","error"),u(null)}};return s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"mx-auto mb-10 max-w-lg text-center text-sm text-ink-mid",children:["Pay only for what you ask. No subscription, no card on file. Eac
1383h pack is valid for 90 days.",t&&s.jsxs("span",{className:"mt-3 block font-mono text-[10px] uppercase tracking-eyebrow text-ink-muted",children:[t.answers," answer",t.answers===1?"":"s"," on your account"]})]}),o?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(vt,{className:"h-6 w-6 animate-spin text-ink-light"})}):s.jsx("div",{className:"grid w-full gap-5 sm:grid-cols-3",children:a.map(h=>{const p=h.code===hit,m=c===h.code;return s.jsxs("div",{className:`relative flex flex-col rounded-2xl border bg-paper p-6 ${p?"border-indigo shadow-elevation":"border-rule shadow-card"}`,children:[p&&s.jsx("span",{className:"absolute -top-2.5 left-1/2 -translate-x-1/2 rounded-pill bg-indigo px-3 py-1 font-mono text-[10px] font-medium uppercase tracking-eyebrow text-cream",children:"Most popular"}),s.jsx("div",{className:"mb-2 font-mono text-[11px] font-medium uppercase tracking-eyebrow text-ink-muted",children:Iz[h.code]??h.code}),s.jsxs("div",{className:"font-heading text-3xl font-medium tracking-tight text-ink",style:{fontFeatureSettings:'"tnum" 1, "lnum" 1'},children:["$",h.price_usd.toFixed(2)]}),s.jsxs("div",{className:"mt-1 text-sm text-ink-mid",children:[h.answers," answers · $",h.price_per_answer_usd.toFixed(3)," each"]}),s.jsxs("ul",{className:"mt-6 flex-1 space-y-2 text-sm text-ink",children:[s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(ft,{className:"mt-0.5 h-4 w-4 shrink-0 text-indigo"}),h.answers," answers across every expert"]}),s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(ft,{className:"mt-0.5 h-4 w-4 shrink-0 text-indigo"}),"Valid for ",h.valid_days," days"]}),s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(ft,{className:"mt-0.5 h-4 w-4 shrink-0 text-indigo"}),"No subscription, no card saved"]})]}),s.jsxs("button",{type:"button",onClick:()=>d(h.code),disabled:m,className:`mt-6 inline-flex items-center justify-center gap-2 rounded-md py-2.5 text-sm font-medium transition-colors disabled:opacity-60 ${p?"bg-indigo text-cream hover:bg-indigo-deep":"bg-ink text-cream hover:bg-ink-soft"}`,children:[m?s.jsx(vt,{className:"h-4 w-4 animate-spin"}):null,m?"Redirectingâ¦":`Buy ${Iz[h.code]??h.code}`]})]},h.code)})})]})}function mit({audience:e}){const t=e==="creators";return s.jsxs("section",{id:"checkout",className:"mx-auto mb-7 max-w-[1080px] scroll-mt-24 rounded-[26px] border border-rule bg-paper px-5 py-10 shadow-card sm:px-10",children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.jsx("span",{className:"font-mono text-[11px] font-medium uppercase tracking-eyebrow text-ink-muted",children:"Checkout"}),s.jsx("h2",{className:"mt-2 font-heading text-2xl font-medium tracking-tight text-ink sm:text-3xl",children:t?s.jsxs(s.Fragment,{children:["Embed on ",s.jsx("em",{className:"not-italic text-indigo",children:"your website."})]}):s.jsxs(s.Fragment,{children:["Buy ",s.jsx("em",{className:"not-italic text-indigo",children:"answers."})]})})]}),t?s.jsx(lit,{showHeading:!1}):s.jsx(pit,{})]})}function fit(){const[e]=gl(),t=Nc(),{isAuthenticated:n}=Ut(),[r,a]=f.useState("annual"),i=e.get("for"),o=i==="users"?"users":i?"creators":null,l=o==="creators"&&!n?null:o,[c,u]=f.useState([]);return f.useEffect(()=>{const d=Une();d.length&&u(d),zne().then(h=>{h.length&&u(h)}).catch(h=>console.error("Landing profiles failed to load:",h))},[]),s.jsxs("div",{className:"relative -mx-4 -mb-4 bg-cream text-ink lg:-mx-6 lg:-mb-6",children:[s.jsx(vs,{title:or.pricing.title,description:or.pricing.description,path:"/pricing",ogImage:or.pricing.image}),s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 top-0 z-0 h-[1100px] bg-[radial-gradient(900px_620px_at_8%_-6%,rgba(61,61,245,0.10)_0%,rgba(61,61,245,0)_62%),radial-gradient(820px_560px_at_96%_2%,rgba(230,195,179,0.30)_0%,rgba(230,195,179,0)_64%)]"}),s.jsx("div",{className:"sticky top-0 z-30 px-4 pt-3 sm:px-6 sm:pt-4 lg:px-10",children:s.jsx(Ine,{})}),s.jsxs("div",{className:"relative z-[1] px-4 sm:px-6 lg:px-10",children:[s.jsxs("section",{id:"pricing",className:"mx-auto mb-7 mt-8 max-w-[1340px] scroll-mt-24 rounded-[28px] border-[1.5px] border-indigo/20 bg-indigo-wash/55 p-6 shadow-[0_22px_50px_-28px_rgba(20,20,19,0.24),inset_0_1px_0_rgba(255,255,255,0.8)] backdrop-blur-xl backdrop-saturate-150 sm:mt-12 sm:p-10 min-[1180px]:p-8 min-[1440px]:p-14",children:[s.jsxs("div",{className:"mb-8 flex flex-col items-center gap-4 text-center sm:mb-10",children:[s.jsxs("h1",{className:"m-0 max-w-[26ch] font-heading text-[clamp(28px,4vw,56px)] font-medium leading-[1.1] tracking-[-0.02em] text-ink",children:["Pick your ",s.jsx("em",{className:"not-italic text-indigo",children:"plan."})]}),s.jsxs("p",{className:"m-0 text-[17px] font-normal leading-[1.55] text-ink-mid sm:text-lg",children:[s.jsx("strong",{className:"font-semibold text-ink",children:"0% commission, always."})," You keep 100% of what you earn."]}),s.jsx(One,{billing:r,onChange:a})]}),s.jsx(Mne,{billing:r,ctaProps:t}),s.jsx(cit,{}),s.jsxs("p",{className:"mx-auto mt-6 max-w-none text-balance text-center text-[14.5px] font-normal leading-[1.6] text-ink-mid",children:["Want people to pay for access instead? You set the price, we handle the payments, and you keep 70%."," ",s.jsx(Le,{to:gr.earnings,className:"font-semibold text-indigo hover:text-indigo-deep",children:"See how it works â"})]})]}),l&&s.jsx(mit,{audience:l}),s.jsx(uit,{}),s.jsx(dit,{profiles:c}),s.jsx($ne,{})]}),s.jsx(Fne,{}),s.jsx(FP,{})]})}const Pz=["free","lite","starter","pro"],Mv={free:{name:"Free",monthly:null,annual:null},lite:{name:"Lite",monthly:9.99,annual:8.29},starter:{name:"Starter",monthly:19.99,annual:16.59},pro:{name:"Pro",monthly:59.99,annual:49.99}},git={free:[{label:"Answers",from:"500 lifetime",to:"500 a month"},{label:"Voice minutes",from:"15",to:"60"},{label:"Contacts",from:"10",to:"100"},{label:"Embed on your site",from:"No",to:"Yes"}],lite:[{label:"Answers a month",from:"500",to:"1200"},{label:"Voice minutes",from:"60",to:"200"},{label:"Contacts",from:"100",to:"500"},{label:"AI Experts",from:"1",to:"2"}],starter:[{label:"Answers a month",from:"1200",to:"3000"},{label:"Voice minutes",from:"200",to:"700"},{label:"Contacts",from:"500",to:"2000"},{label:"AI Experts + cloned voice",from:"2",to:"4"}]},xit={free:{headline:"Give your audience a better experience",note:"Lite resets your limits every month, so your visitors always get an answer. You can also embed your expert on your own site."},lite:{headline:"Give your audience room to go deeper",note:"Starter adds answers, voice minutes, a second expert, three call languages, and so much more."},starter:{headline:"Make it a full brand presence",note:'Pro adds four experts, your cloned voice, 20 call languages, and removes the "Powered by" badge.'}},aie="box-border rounded-[26px] border backdrop-blur-xl shadow-[inset_0_1px_0_rgba(255,255,255,0.95),0_20px_44px_-24px_rgba(60,50,12
13830,0.4)]",iie=`${aie} border-[rgba(232,230,220,0.95)] bg-[rgba(244,244,253,0.78)]`,zp=`${aie} border-[rgba(61,61,245,0.22)] bg-[rgba(238,238,252,0.82)]`;function Lz(e){if(!e)return null;try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})}catch{return null}}function Hp(e){return`$${Number(e).toFixed(2)}`}function bit({label:e,used:t,cap:n,unit:r}){if(n==null)return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-baseline justify-between gap-3.5",children:[s.jsx("span",{className:"text-[13.5px] font-medium text-ink",children:e}),s.jsxs("span",{className:"flex-none text-[13px] whitespace-nowrap text-ink-muted",children:[s.jsxs("span",{className:"font-semibold text-ink",children:[t,r?` ${r}`:""," used"]})," ","· Unlimited"]})]}),s.jsx("div",{className:"h-2.5 rounded-pill bg-[rgba(20,20,19,0.06)] overflow-hidden",children:s.jsx("div",{className:"h-full w-full rounded-pill bg-gradient-to-r from-[#A6A6F2] via-[#A6A6F2] to-[rgba(166,166,242,0.15)]"})})]});const a=Math.min(100,Math.round(t/Math.max(n,1)*100)),i=a>=100,o=Math.max(0,n-t),l=i?"text-indigo":"text-ink";return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-baseline justify-between gap-3.5",children:[s.jsx("span",{className:`text-[13.5px] font-medium ${l}`,children:e}),s.jsxs("span",{className:"flex-none text-[13px] whitespace-nowrap text-ink-muted",children:[s.jsxs("span",{className:`font-semibold ${l}`,children:[o,r?` ${r}`:""," left"]})," ","of ",n,r?` ${r}`:""," · ",a,"% used"]})]}),s.jsx("div",{className:"h-2.5 rounded-pill bg-[rgba(20,20,19,0.06)] overflow-hidden",children:s.jsx("div",{className:`h-full rounded-pill ${i?"bg-indigo":"bg-[#A6A6F2]"}`,style:{width:`${a}%`}})})]})}function Oz(){return s.jsx("div",{className:"flex flex-col gap-3","aria-label":"Loading usage",children:["w-16","w-20","w-14","w-24"].map(e=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex items-baseline justify-between gap-3.5",children:[s.jsx(gt,{className:`h-[13px] ${e} rounded-pill`}),s.jsx(gt,{className:"h-[12px] w-[132px] rounded-pill"})]}),s.jsx(gt,{className:"h-2.5 w-full rounded-pill"})]},e))})}function Dv({label:e,value:t,big:n,note:r,link:a}){return s.jsxs("div",{className:`${iie} flex flex-col items-start gap-2 px-5 py-3.5`,children:[s.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-ink-mid",children:e}),s.jsx("span",{className:`font-heading font-normal tracking-tight text-ink leading-none ${n?"text-[clamp(26px,3.4vh,34px)]":"text-[clamp(19px,2.4vh,23px)]"}`,children:t}),r&&!a&&s.jsx("span",{className:"text-[11.5px] leading-snug text-ink-muted",children:r}),r&&a&&s.jsx(Le,{to:a,className:"text-[11.5px] leading-snug font-semibold text-indigo border-b border-current hover:text-indigo-deep transition-colors",children:r})]})}function yit(){const{addToast:e}=f.useContext(Zs),[t,n]=f.useState(null),[r,a]=f.useState(null),[i,o]=f.useState(null),[l,c]=f.useState(""),[u,d]=f.useState(!1),[h,p]=f.useState(!1),[m,g]=f.useState(null),x=()=>Promise.all([Eu().then(V=>n(V.data)),VTe().then(V=>a(V.data)).catch(()=>a(null))]).catch(()=>n({active:!1,trial:{}}));f.useEffect(()=>{x()},[]),f.useEffect(()=>{xI("this_month").then(V=>{const L=V.data;o({earned:L?.earnings?.total_earned??0,paidAccess:!!L?.monetization?.paid_access_enabled})}).catch(()=>o(null))},[]);const b=t?.unlimited?"pro":t?.active?t.plan:"free",y=Mv[b]||Mv.free,v=!!t?.trial?.active,w=!!t?.trial?.used,j=!!t?.trial?.expired,E=!!t?.active&&!v&&!t?.unlimited,S=Pz[Pz.indexOf(b)+1]||null,_=S?Mv[S]:null,k=git[b]||[],C=xit[b]||{},N=r?.limits||t?.limits||{},A=r?.usage||{},T=N.answers_window==="lifetime",I=[{label:"Answers",used:A.answers_used??0,cap:N.answers_quota},{label:"Voice min.",used:Math.floor((A.voice_seconds_used??0)/60),cap:N.voice_seconds_quota==null?null:Math.round(N.voice_seconds_quota/60),unit:N.voice_seconds_quota==null?"min":""},{label:"Contacts",used:A.contacts_count??0,cap:N.contacts_max},{label:"AI Experts",used:A.experts_count??0,cap:N.max_experts}],$=async V=>{c(V);try{const L=await $R(V),K=L?.data||L;g({clientSecret:K.client_secret,sessionId:K.session_id,publishableKey:K.publishable_key})}catch(L){e(L?.response?.data?.detail?.message||"Could not start checkout.","error")}finally{c("")}},O=async()=>
1383{if(S){if(b==="free"&&!w){c(S);try{await DR(S),await x(),e(`${_.name} activated â your free trial is on. No card needed.`,"success")}catch(V){V?.response?.data?.detail?.code==="TRIAL_ALREADY_USED"?await $(S):e(V?.response?.data?.detail?.message||"Could not activate the plan.","error")}finally{c("")}return}if(b==="free"){await $(S);return}if(E&&!u){d(!0);return}c(S);try{await wJ(S),await x(),e(`You're on ${_.name} now.`,"success")}catch(V){e(V?.response?.data?.detail?.message||"Could not change the plan.","error")}finally{c(""),d(!1)}}},U=async()=>{c("cancel");try{await vJ(),await x(),e("Your plan will end at the close of the period.","success")}catch(V){e(V?.response?.data?.detail?.message||"Could not cancel.","error")}finally{c(""),p(!1)}};if(t===null)return s.jsxs("section",{className:"space-y-3.5","aria-label":"Loading your plan",children:[s.jsxs("div",{className:"grid gap-3.5 lg:grid-cols-2 items-stretch",children:[s.jsxs("div",{className:`${zp} flex flex-col gap-4 px-6 py-5`,children:[s.jsxs("div",{className:"flex items-baseline gap-3.5",children:[s.jsx(gt,{className:"h-7 w-24 rounded-pill"}),s.jsx(gt,{className:"h-4 w-28 rounded-pill"})]}),s.jsxs("div",{className:"flex flex-col gap-2.5 pb-3.5 border-b border-[rgba(61,61,245,0.16)]",children:[s.jsx(gt,{className:"h-3 w-full rounded-pill"}),s.jsx(gt,{className:"h-3 w-4/5 rounded-pill"}),s.jsx(gt,{className:"h-3 w-3/5 rounded-pill"})]}),s.jsx(Oz,{})]}),s.jsxs("div",{className:`${zp} flex flex-col gap-4 px-6 py-5`,children:[s.jsx(gt,{className:"h-6 w-3/4 rounded-pill"}),s.jsx(gt,{className:"h-3 w-full rounded-pill"}),s.jsxs("div",{className:"flex flex-col gap-2.5 my-auto",children:[s.jsx(gt,{className:"h-3.5 w-full rounded-pill"}),s.jsx(gt,{className:"h-3.5 w-full rounded-pill"}),s.jsx(gt,{className:"h-3.5 w-full rounded-pill"}),s.jsx(gt,{className:"h-3.5 w-full rounded-pill"})]}),s.jsx(gt,{className:"h-[72px] w-full rounded-xl"})]})]}),s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3.5",children:[0,1,2,3].map(V=>s.jsxs("div",{className:`${iie} flex flex-col gap-2.5 px-5 py-3.5`,children:[s.jsx(gt,{className:"h-3 w-24 rounded-pill"}),s.jsx(gt,{className:"h-7 w-16 rounded-pill"})]},V))})]});const F=Lz(t.trial_end&&t.status==="trialing"?t.trial_end:t.current_period_end),H=t.unlimited?"Team account":v?"Free trial â no card on file":E?`${Hp(y.monthly)} / month`:"No payment, no renewal",G=E?t.cancel_at_period_end?"Ends":"Renews":"Access",M=t.unlimited?"Unlimited":v?`Until ${Lz(t.trial?.ends_at)||F}`:E?F:"For as long as you want",z=v?`${t.trial.days_left} day${t.trial.days_left===1?"":"s"} left`:j?"Ended â plans bill on subscribe":w?"Used":"7 days free on any paid plan",W=t.unlimited||T?"Lifetime usage":v?"Usage during your trial":"Usage this month",D=t.unlimited?"Your team account has no plan limits â these are lifetime totals.":T?"These limits don't renew. When you hit them, your AI Expert pauses until you upgrade your plan.":v?`Your trial includes the full ${y.name} allowance.`:"Limits reset on the first day of each billing cycle.",Z=b==="free"&&!w?`Try ${_?.name} free for 7 days`:`Upgrade to ${_?.name}`;return s.jsxs("section",{className:"space-y-3.5",children:[j&&!t.active&&s.jsxs("div",{className:"rounded-[18px] border border-amber-200 dark:border-amber-900/40 bg-amber-50 dark:bg-amber-950/30 px-5 py-3.5 text-sm text-amber-900 dark:text-amber-200",children:["Your ",Mv[t.trial.plan]?.name||t.trial.plan," free trial has ended â you're on the Free plan now. Everything you set up is safe; subscribe below to unlock it again."]}),s.jsxs("div",{className:"grid gap-3.5 lg:grid-cols-2 items-stretch",children:[s.jsxs("div",{className:`${zp} flex flex-col min-w-0 gap-2 px-6 py-5`,children:[s.jsxs("div",{className:"flex items-baseline gap-3.5 flex-wrap",children:[s.jsx("span",{className:"font-heading font-normal text-[clamp(24px,3vh,30px)] leading-tight tracking-tight text-ink",children:y.name}),s.jsx("span",{className:"font-heading text-base text-ink-mid",children:t.unlimited?"Team · Unlimited":v?"Free trial":E?`${Hp(y.monthly)} / month`:""})]}),s.jsxs("div",{className:"flex flex-col gap-1.5 mt-2 pb-3.5 border-b border-[rgba(61,61,245,0.16)]",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3.5",children:[s.jsx("span",{className:"text-[12.5px] text-ink-muted",children:"Billing"}),s.jsx("span",{className:"text-[13px] font-medium text-right text-ink",children:H})]}),s.jsxs("div",{className:"flex items-center justify-between gap-3.5",children:[s.jsx("span",{className:"text-[12.5px] text-ink-muted",children:G}),s.jsx("span",{className:"text-[13px] font-medium text-right text-ink",children:M})]}),!t.unlimited&&s.jsxs("div",{className:"flex items-center justify-between gap-3.5",children:[s.jsx("span",{className:"text-[12.5px] text-ink-muted",children:"Free trial"}),s.jsx("span",{className:`text-[13px] font-medium text-right ${v?"text-indigo":"text-ink"}`,children:z})]}),v&&y.monthly&&s.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-3.5 flex-wrap",children:[s.jsxs("span",{className:"text-[12.5px] leading-snug text-ink-muted",children:["Keep ",y.name," for ",Hp(y.monthly),"/month. Your plan starts today."]}),s.jsxs("button",{type:"button",onClick:()=>$(b),disabled:!!l,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-pill text-[13px] font-semibold bg-indigo text-cream hover:bg-indigo-deep transition-colors disabled:opacity-50 whitespace-nowrap",children:[l===b?s.jsx(vt,{size:14,className:"animate-spin"}):null,"Pay now"]})]})]}),s.jsxs("div",{className:"mt-2 flex flex-col gap-1",children:[s.jsx("span",{className:"text-[11.5px] font-semibold uppercase tracking-[0.12em] text-ink-mid",children:W}),s.jsx("span",{className:"text-[12.5px] leading-normal text-ink-muted",children:D})]}),s.jsx("div",{className:"mt-2.5 flex flex-col gap-3",children:r?I.map(V=>s.jsx(bit,{label:V.label,used:V.used,cap:V.cap,unit:V.unit},V.label)):s.jsx(Oz,{})})]}),S&&!t.unlimited?s.jsxs("div",{className:`${zp} relative overflow-hidden flex flex-col min-w-0 gap-2 px-6 pt-5 pb-4`,children:[s.jsx("span",{className:"font-heading font-normal text-[clamp(21px,2.7vh,26px)] leading-snug tracking-tight text-ink",children:C.headline}),s.jsx("span",{className:"text-[13.5px] leading-relaxed text-ink-mid",children:C.note}),s.jsxs("div",{className:"w-full max-w-[520px] my-auto py-2.5 flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-baseline gap-3 text-[10px] font-semibold uppercase tracking-[0.12em] text-ink-muted",children:[s.jsx("span",{className:"flex-1 min-w-0"}),s.jsxs("span",{className:"flex-none min-w-[96px] text-right whitespace-nowrap",children:[y.name," · now"]}),s.jsx("span",{className:"flex-none w-3.5"}),s.jsx("span",{className:"flex-none min-w-[82px] text-left text-indigo",children:_.name})]}),k.map(V=>s.jsxs("div",{className:"flex items-center gap-3 py-1.5 border-t border-[rgba(232,230,220,0.9)]",children:[s.jsx("span",{className:"flex-1 min-w-0 text-[13.5px] text-ink-mid",children:V.label}),s.jsx("span",{className:"flex-none min-w-[96px] text-right text-[13px] text-ink-muted whitespace-nowrap",children:V.from}),s.jsx(xn,{className:"flex-none w-3.5 h-3.5 text-indigo",strokeWidth:1.8}),s.jsx("span",{className:"flex-none min-w-[82px] text-left text-sm font-semibold text-ink whitespace-nowrap",children:V.to})]},V.label))]}),s.jsxs("div",{className:"-mx-6 -mb-4 px-6 py-5 flex items-center justify-between gap-4 bg-indigo shadow-[inset_0_1px_0_rgba(255,255,255,0.22)]",children:[s.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[s.jsxs("span",{className:"font-heading font-normal text-[clamp(22px,2.8vh,28px)] leading-none tracking-tight text-paper",children:[Hp(_.annual)," / month"]}),s.jsxs("span",{className:"text-[12.5px] text-[rgba(253,252,248,0.78)]",children:["Billed annually, or ",Hp(_.monthly)," monthly"]})]}),s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsxs("button",{type:"button",onClick:O,disabled:!!l,className:`inline-flex items-center justify-center h-[50px] px-7 rounded-pill text-[14.5px] font-bold whitespace-nowrap shadow-[0_14px_28px_-14px_rgba(20,20,19,0.55)] transition-colors disabled:opacity-60 ${u?"bg-ink text-cream hover:bg-ink-soft":"bg-paper text-indigo hover:bg-white hover:text-indigo-deep"}`,children:[l===S?s.jsx(vt,{className:"w-4 h-4 animate-spin mr-2"}):null,u?"Confirm â prorated today":Z]}),s.jsx("span",{className:"text-[10.5px] text-[rgba(253,252,248,0.72)] whitespace-nowrap",children:u?s.jsxs("button",{type:"button",onClick:()=>d(!1),className:"underline",children:["Keep ",y.name," instead"]}):"17% off with annual billing"})]})]})]}):s.jsxs("div",{className:`${zp} flex flex-col min-w-0 gap-2 px-6 py-5`,children:[s.jsx("span",{className:"font-heading font-normal text-[clamp(21px,2.7vh,26px)] leading-snug tracking-tight text-ink",children:"Everything is unlocked"}),s.jsx("span",{className:"text-[13.5px] leading-relaxed text-ink-mid",children:t.unlimited?"Your team account carries full Pro access with no plan limits.":"You're on the top plan â this is what your account includes, every month."}),s.jsxs("div",{className:"w-full max-w-[520px] my-auto py-2.5 flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-baseline gap-3 text-[10px] font-semibold uppercase tracking-[0.12em] text-ink-muted",children:[s.jsx("span",{className:"flex-1 min-w-0"}),s.jsxs("span",{className:"flex-none text-indigo",children:["Included · ",t.unlimited?"Team":y.name]})]}),[{label:"Answers a month",value:N.answers_quota??"Unlimited"},{label:"Voice minutes a month",value:N.voice_seconds_quota==null?"Unlimited":Math.round(N.voice_seconds_quota/60)},{label:"Max call length",value:N.call_max_seconds==null?"Unlimited":`${Math.round(N.call_max_seconds/60)} min`},{label:"Contacts",value:N.contacts_max??"Unlimited"},{label:"AI Experts",value:N.max_experts??"Unlimited"},{label:"Call languages",value:N.call_languages_max??"All"},{label:"Cloned voice",value:N.cloned_voice?"Included":"â"},{label:'"Powered by" badge',value:N.powered_by_badge?"Shown":"Off"}].map(V=>s.jsxs("div",{className:"flex items-center gap-3 py-1.5 border-t border-[rgba(232,230,220,0.9)]",children:[s.jsx("span",{className:"flex-1 min-w-0 text-[13.5px] text-ink-mid",children:V.label}),s.jsx("span",{className:"flex-none text-sm font-semibold text-ink whitespace-nowrap",children:V.value})]},V.label))]})]})]}),s.jsxs("div",{className:"flex items-center gap-2.5 pt-3.5",children:[s.jsx(yb,{className:"flex-none w-[18px] h-[18px] text-indigo",strokeWidth:1.6}),s.jsx("span",{className:"font-heading font-normal text-[17px] leading-tight tracking-tight text-ink",children:"What your Expert did for your business, not just what it used up"})]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3.5",children:[s.jsx(Dv,{label:"Conversations",value:r?String(A.answers_used??0):"â",big:!0}),s.jsx(Dv,{label:"Leads captured",value:r?String(A.contacts_count??0):"â",big:!0,note:"all visible"}),i?.paidAccess?s.jsx(Dv,{label:"Your earnings",value:Hp(i.earned),big:!0,note:"Your 70% share"}):s.jsx(Dv,{label:"Your earnings",value:"Not set up",note:"Set up paid access",link:"/dashboard/creator"}),s.jsxs(Le,{to:"/dashboard/leads",className:`${zp} flex flex-col items-start justify-start gap-2 px-5 py-3.5 hover:bg-[rgba(232,232,251,0.95)] hover:border-[rgba(61,61,245,0.4)] transition-colors`,children:[s.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-indigo",children:"See more"}),s.jsxs("span",{className:"font-heading font-normal text-[clamp(19px,2.4vh,23px)] leading-tight tracking-tight text-ink",children:["Insights & Leads"," ",s.jsx(xn,{className:"inline w-[15px] h-[15px] -mt-0.5 text-indigo",strokeWidth:1.8})]})]})]}),t.active&&!t.unlimited&&!t.cancel_at_period_end&&s.jsxs("div",{className:"flex items-center gap-3.5 pt-2 px-1",children:[h?s.jsxs("span",{className:"inline-flex items-center gap-2 text-[12.5px]",children:[s.jsxs("span",{className:"text-ink-mid",children:["Cancel at ",v?"trial":"period"," end?"]}),s.jsxs("button",{type:"button",onClick:U,disabled:l==="cancel",className:"inline-flex items-center gap-1 font-semibold text-destructive hover:opacity-80",children:[l==="cancel"?s.jsx(vt,{className:"w-3 h-3 animate-spin"}):null," Yes, cancel"]}),s.jsx("button",{type:"button",onClick:()=>p(!1),className:"text-ink-mid hover:text-ink",children:"Keep"})]}):s.jsx("button",{type:"button",onClick:()=>p(!0),className:"text-[12.5px] font-semibold text-ink-muted hover:text-destructive transition-colors",children:"Cancel plan"}),s.jsx("span",{className:"flex-none w-px h-3 bg-[rgba(20,20,19,0.14)]"}),s.jsx("span",{className:"text-[12.5px] font-medium text-ink-muted",children:v?"Your access continues until the end of the trial.":"Your access continues until the end of the paid period."})]}),t.cancel_at_period_end&&s.jsxs("p",{className:"text-xs text-amber-600 dar
1383k:text-amber-400 px-1",children:["Set to cancel â your plan ends ",F,"."]}),m&&s.jsx(MR,{clientSecret:m.clientSecret,sessionId:m.sessionId,publishableKey:m.publishableKey,title:"Subscribe to your plan",onComplete:()=>{g(null),x()},onClose:()=>g(null)})]})}function F1(e){return e?new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):"â"}function oie(e){return e.price_usd!=null?`$${Number(e.price_usd).toFixed(2)}`:null}function vit(e){const t=oie(e),n=e.status==="active"||e.status==="past_due";return n&&e.cancel_at_period_end?`Cancelled, access until ${F1(e.current_period_end)}`:e.status==="past_due"?`${t?`${t} per month, `:""}payment failed â retrying`:n?`${t?`${t} per month, `:""}renews ${F1(e.current_period_end)}`:`Cancelled, access ended ${F1(e.canceled_at||e.current_period_end)}`}function wit(){const{addToast:e}=f.useContext(Zs),{logout:t}=Ut(),n=Ps(),[r,a]=f.useState(!0),[i,o]=f.useState([]),[l,c]=f.useState(null),[u,d]=f.useState(null),[h,p]=f.useState(()=>{try{return localStorage.getItem("subs-list-collapsed")==="1"}catch{return!1}}),m=()=>{p(y=>{try{localStorage.setItem("subs-list-collapsed",y?"0":"1")}catch{}return!y})},g=async()=>{try{const y=await UU();o(y.data.subscriptions||[])}catch{e("Could not load your subscriptions.","error")}};f.useEffect(()=>{let y=!1;return a(!0),UU().then(v=>{y||o(v.data.subscriptions||[])}).catch(()=>e("Could not load your subscriptions.","error")).finally(()=>{y||a(!1)}),()=>{y=!0}},[e]);const x=async()=>{if(!u?.sub)return;const y=u.sub;c(y.id);try{await Ttt(y.id),e("Subscription will end at the period end.","success"),d(null),await g()}catch(v){e(v.response?.data?.detail?.message||"Could not cancel subscription.","error")}finally{c(null)}},b=async()=>{if(!u?.sub)return;const y=u.sub;c(y.id);try{const v=await aae(y.expert_id);window.location.assign(v.data.url)}catch(v){const w=v.response?.data?.detail?.code;e(v.response?.data?.detail?.message||(w==="PAYMENTS_DISABLED"?"Subscriptions are not enabled in this environment yet.":"Could not start checkout."),"error"),c(null)}};return s.jsxs("div",{className:"pb-8 space-y-7",children:[s.jsxs("header",{className:"ge-surface flex flex-wrap items-center gap-x-5 gap-y-3 px-5 py-3 sm:px-7",children:[s.jsxs("h1",{className:"min-w-0 font-heading text-[28px] font-normal leading-[1.1] tracking-[-0.018em] text-ink",children:["Your ",s.jsx("em",{className:"italic text-indigo",children:"subscription plan"})]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2 sm:gap-2.5",children:[s.jsx(Le,{to:"/pricing?for=creators",className:"ge-surface-btn h-10 px-4 text-[13px]",children:"See all plans"}),s.jsx("button",{type:"button","aria-label":"Log out",title:"Log out",onClick:()=>{n(Me.HOME),t()},className:"ge-surface-btn ge-surface-btn-icon h-10 w-10 shrink-0",children:s.jsx(L4,{className:"w-[18px] h-[18px]",strokeWidth:1.6})})]})]}),s.jsx(yit,{}),r?s.jsxs("div",{className:"ge-surface flex flex-col overflow-hidden","aria-label":"Loading subscriptions",children:[s.jsxs("div",{className:"flex flex-col gap-2 px-6 pt-4 pb-[18px] border-b border-[rgba(232,230,220,0.9)] bg-[rgba(238,238,252,0.55)]",children:[s.jsx(gt,{className:"h-[17px] w-44 rounded-pill"}),s.jsx(gt,{className:"h-3 w-3/4 rounded-pill"})]}),["w-36","w-44"].map(y=>s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 border-b border-[rgba(232,230,220,0.9)] last:border-b-0",children:[s.jsx(gt,{className:"h-10 w-10 rounded-full"}),s.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[s.jsx(gt,{className:`h-[15px] ${y} rounded-pill`}),s.jsx(gt,{className:"h-3 w-56 rounded-pill"})]}),s.jsx(gt,{className:"h-[38px] w-24 rounded-pill"})]},y))]}):s.jsxs("div",{className:"ge-surface flex flex-col overflow-hidden",children:[s.jsxs("button",{type:"button",onClick:m,"aria-expanded":!h,className:`w-full text-left flex items-baseline justify-between gap-4 flex-wrap gap-y-2 px-6 pt-4 bg-[rgba(238,238,252,0.55)] transition-colors hover:bg-[rgba(238,238,252,0.85)] ${h?"pb-4":"pb-[18px] border-b border-[rgba(232,230,220,0.9)]"}`,children:[s.jsxs("span",{className:"inline-flex items-center gap-2.5",children:[s.jsx(mY,{className:"flex-none w-[18px] h-[18px] text-indigo",strokeWidth:1.6}),s.jsxs("span",{className:"font-heading font-normal text-[17px] leading-tight tracking-tight text-ink",children:["Subscribed ",s.jsx("em",{className:"italic text-indigo",children:"Experts"})]}),i.length>0&&s.jsxs("span",{className:"font-mono text-[11px] font-medium text-ink-muted",children:["(",i.length,")"]})]}),s.jsx(Is,{className:`flex-none w-[18px] h-[18px] self-center ml-auto text-ink-muted transition-transform duration-200 ${h?"-rotate-90":""}`,strokeWidth:1.8}),!h&&s.jsx("span",{className:"w-full -mt-0.5 text-[13px] leading-relaxed text-ink-muted",children:"Each subscription unlocks unlimited chat with that AI Expert. Cancel anytime and
1383your access continues until the end of the paid period."})]}),!h&&i.length===0&&s.jsxs("div",{className:"px-6 py-6 flex flex-col gap-3",children:[s.jsxs("span",{className:"flex items-center gap-2.5",children:[s.jsx(Ci,{className:"flex-none w-5 h-5 text-indigo",strokeWidth:1.5}),s.jsx("span",{className:"font-heading font-normal text-[16px] leading-snug text-ink",children:"No subscriptions yet"})]}),s.jsx("span",{className:"pl-[30px] pr-5 max-w-[640px] text-[13.5px] leading-relaxed text-ink-mid",children:"When you subscribe to someone's AI Expert, it shows up here with the price and renewal date. Each subscription unlocks unlimited chat, and if you cancel, your access continues until the end of the paid period."})]}),!h&&i.map((y,v)=>{const w=y.status==="active"||y.status==="past_due",j=w&&!y.cancel_at_period_end,E=!w;return s.jsxs("div",{className:`min-h-[clamp(56px,8vh,80px)] flex items-center gap-4 px-6 py-3 ${v===i.length-1?"":"border-b border-[rgba(232,230,220,0.9)]"}`,children:[s.jsx(Le,{to:`/experts/${y.expert_id}/chat`,className:`shrink-0 ${w?"":"opacity-55 grayscale"}`,children:s.jsx(ws,{name:y.expert_name,src:y.expert_avatar_url,size:"md",variant:"expert"})}),s.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[s.jsx(Le,{to:`/experts/${y.expert_id}/chat`,className:"text-[15.5px] font-medium text-ink truncate hover:text-indigo transition-colors",children:y.expert_name}),s.jsx("span",{className:"text-[13px] text-ink-muted truncate",children:vit(y)})]}),j&&s.jsx("button",{type:"button",onClick:()=>d({type:"cancel",sub:y}),disabled:l===y.id,className:"flex-none inline-flex items-center h-[38px] px-[18px] rounded-pill border border-rule text-[13px] font-semibold text-ink-mid whitespace-nowrap hover:border-destructive/40 hover:text-destructive transition-colors disabled:opacity-60",children:"Cancel"}),E&&s.jsx("button",{type:"button",onClick:()=>d({type:"resume",sub:y}),disabled:l===y.id,className:"flex-none inline-flex items-center h-[38px] px-[18px] rounded-pill bg-indigo text-[13px] font-semibold text-cream whitespace-nowrap shadow-[inset_0_1px_0_rgba(255,255,255,0.42),0_14px_28px_-16px_rgba(61,61,245,0.8)] hover:bg-indigo-deep transition-colors disabled:opacity-60",children:"Subscribe again"})]},y.id)})]}),u&&Mn.createPortal(s.jsx(jit,{dialog:u,isPending:l===u.sub.id,onClose:()=>d(null),onConfirm:u.type==="cancel"?x:b}),document.body)]})}function jit({dialog:e,isPending:t,onClose:n,onConfirm:r}){const{sub:a,type:i}=e,o=oie(a),l=i==="cancel";return s.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-6 sm:p-10 bg-[rgba(20,20,19,0.28)]",onClick:c=>{!t&&c.target===c.currentTarget&&n()},children:s.jsxs("div",{className:"w-full max-w-[440px] flex flex-col gap-4 px-6 pt-6 pb-5 rounded-[22px] border border-[rgba(232,230,220,0.95)] bg-[rgba(244,244,253,0.92)] backdrop-blur-xl shadow-[inset_0_1px_0_rgba(255,255,255,0.95),0_30px_70px_-28px_rgba(60,50,120,0.5)]",onClick:c=>c.stopPropagation(),children:[s.jsx("span",{className:"font-heading font-normal text-[21px] leading-normal tracking-tight text-ink",children:l?s.jsxs(s.Fragment,{children:["Are you sure you want to cancel your subscription to ",a.expert_name,"?"]}):s.jsxs(s.Fragment,{children:["Subscribe to ",a.expert_name," again?"]})}),s.jsx("span",{className:"text-[13px] leading-relaxed text-ink-mid",children:l?`Your access continues until ${F1(a.current_period_end)}. No partial refund for the remaining days, and you can resubscribe anytime.`:`Your subscription restarts${o?` at ${o} per month`:""}. You'll finish on Stripe's secure checkout.`}),s.jsxs("span",{className:"flex items-center justify-end gap-2.5 flex-wrap",children:[s.jsx("button",{type:"button",onClick:n,disabled:t,className:"inline-flex items-center h-10 px-[18px] rounded-pill border border-[rgba(20,20,19,0.16)] bg-white text-[13px] font-semibold text-ink-soft whitespace-nowrap hover:bg-[rgba(61,61,245,0.07)] hover:border-indigo hover:text-indigo transition-colors disabled:opacity-60",children:l?"Keep subscription":"Not now"}),s.jsxs("button",{type:"button",onClick:r,disabled:t,className:`inline-flex items-center gap-2 h-10 px-5 rounded-pill text-[13px] font-semibold text-cream whitespace-nowrap transition-colors disabled:opacity-60 ${l?"bg-destructive hover:opacity-90":"bg-indigo hover:bg-indigo-deep shadow-[inset_0_1px_0_rgba(255,255,255,0.42),0_16px_32px_-18px_rgba(61,61,245,0.85)]"}`,children:[t&&s.jsx(vt,{className:"w-4 h-4 animate-spin"}),t?l?"Cancellingâ¦":"Redirectingâ¦":l?"Cancel subscription":"Subscribe"]})]})]})})}function Mz(e,t,n){const r=new Blob([t],{type:n}),a=URL.createObjectURL(r),i=document.createElement("a");i.href=a,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(a)}function Dz(e){return`"${(e==null?"":String(e)).replace(/"/g,'""')}"`}function _it(e){const t=["index","timestamp","role","content"],n=(e.messages||[]).map((r,a)=>[a+1,r.created_at,r.role,r.content].map(Dz).join(","));return[t.map(Dz).join(","),...n].join(`\r 1384`)}function kit(){const e=Ps(),[t,n]=f.useState("checking"),[r,a]=f.useState(""),[i,o]=f.useState(""),[l,c]=f.useState(null),[u,d]=f.useState(""),[h,p]=f.useState(!1);f.useEffect(()=>{let b=!0;return HY().then(y=>{b&&(y?n("allowed"):window.history.length>1?e(-1):e(Me.DASHBOARD,{replace:!0}))}).catch(y=>{b&&(a(y.message),n("error"))}),()=>{b=!1}},[e]);async function m(b){b.preventDefault();const y=i.trim();if(y){d(""),p(!0),c(null);try{c(await x_e(y))}catch(v){d(v.message||"Failed to load chat.")}finally{p(!1)}}}function g(){Mz(`${l.chat_id}.json`,JSON.stringify(l,null,2),"application/json")}function x(){Mz(`${l.chat_id}.csv`,_it(l),"text/csv")}return t==="checking"?s.jsx(il,{fullPage:!0,text:"Checking accessâ¦"}):t==="error"?s.jsxs("div",{className:"internal-page internal-tool-page",children:[s.jsx(vs,{title:"Internal · Chat export",path:Me.INTERNAL_CHATS,noIndex:!0}),s.jsxs("section",{className:"internal-surface internal-tool-card",children:[s.jsx("h1",{className:"internal-section-title",children:"Couldnât verify access"}),s.jsx(_a,{message:r,className:"internal-alert"}),s.jsxs("p",{className:"internal-section-note",children:["If this persists, the ",s.jsx("code",{className:"font-mono",children:"export_
1384chat_for_internal"})," function may not be deployed to this database yet."]})]})]}):s.jsxs("div",{className:"internal-page internal-tool-page",children:[s.jsx(vs,{title:"Internal · Chat export",path:Me.INTERNAL_CHATS,noIndex:!0}),s.jsxs("header",{children:[s.jsx("h1",{className:"internal-page__title",children:"Chat export"}),s.jsxs("p",{className:"internal-page__description",children:["Paste a chat ",s.jsx("code",{className:"font-mono",children:"conv_â¦"})," ID to review the transcript and export it for debugging AI responses."]})]}),s.jsxs("section",{className:"internal-surface internal-tool-card",children:[s.jsxs("form",{onSubmit:m,className:"internal-chat-form",children:[s.jsxs("label",{className:"internal-tool-label",htmlFor:"internal-chat-id",children:[s.jsx("span",{children:"Chat ID"}),s.jsxs("span",{className:"internal-search",children:[s.jsx(Fa,{"aria-hidden":"true"}),s.jsx("input",{id:"internal-chat-id",placeholder:"conv_â¦",value:i,onChange:b=>o(b.target.value),autoComplete:"off",spellCheck:!1})]})]}),s.jsx("div",{className:"internal-chat-form__actions",children:s.jsxs("button",{type:"submit",className:"internal-primary-action",disabled:!i.trim()||h,children:[h&&s.jsx(vt,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),h?"Loadingâ¦":"Load chat"]})})]}),u&&s.jsx(_a,{message:u,className:"internal-alert"})]}),l&&s.jsxs("section",{className:"internal-surface internal-tool-card",children:[s.jsxs("div",{className:"internal-tool-card__header",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"internal-tool-card__title",children:l.title||"(untitled)"}),s.jsxs("p",{className:"internal-tool-card__meta",children:[l.type," · ",l.message_count," message",l.message_count===1?"":"s"," ·"," ",l.chat_id]})]}),s.jsxs("div",{className:"internal-tool-card__actions",children:[s.jsxs("button",{type:"button",className:"internal-secondary-action",onClick:g,children:[s.jsx(Eh,{"aria-hidden":"true"})," Download JSON"]}),s.jsxs("button",{type:"button",className:"internal-secondary-action",onClick:x,children:[s.jsx(Eh,{"aria-hidden":"true"})," Download CSV"]})]})]}),l.message_count===0?s.jsxs("div",{className:"internal-empty",children:[s.jsx("strong",{children:"No messages."}),s.jsx("span",{children:"This chat exists but has no messages yet."})]}):s.jsx("ul",{className:"internal-messages",children:l.messages.map((b,y)=>s.jsxs("li",{className:"internal-message",children:[s.jsxs("div",{className:"internal-message__meta",children:[s.jsx("span",{className:"internal-message__role",children:b.role}),s.jsx("span",{className:"internal-message__date",children:b.created_at})]}),s.jsx("p",{className:"internal-message__content",children:b.content})]},y))})]})]})}const e_=864e5,Nit={day:{label:"day",average:7},week:{label:"week",average:4},month:{label:"month",average:3}};function Eit(e){return e===0||e>90?"month":e>31?"week":"day"}function $v(e,t){const n=new Date(t),r=n.getUTCFullYear(),a=n.getUTCMonth();if(e==="month")return Date.UTC(r,a,1);const i=Date.UTC(r,a,n.getUTCDate());return e==="week"?i-(n.getUTCDay()+6)%7*e_:i}function Sit(e,t){if(e==="month"){const n=new Date(t);return Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,1)}return t+(e==="week"?7:1)*e_}const Cit=e=>new Date(e).toISOString().slice(0,10);function Xk(e,t,n,r=Date.now()){const a=Eit(t),i=new Map;e.flatMap(u=>
1384Array.isArray(u)?u:[]).forEach(u=>{i.set(u.bucket,{...i.get(u.bucket),...u})});const o=$v(a,r);let l;if(t===0){const u=[...i.keys()].sort()[0];l=u?$v(a,Date.parse(`${u}T00:00:00Z`)):o}else a==="day"?l=$v(a,r-Math.max(1,t-1)*e_):l=$v(a,r-t*e_);const c=[];for(let u=l;u<=o&&c.length<400;u=Sit(a,u)){const d=Cit(u),h=i.get(d);c.push({bucket:d,time:u,...Object.fromEntries(n.map(p=>[p,Number(h?.[p]||0)]))})}return{unit:a,points:c,now:r}}function lie(e,t){return Math.max(1,Math.min(Nit[e].average,Math.round(t/4)))}function cie(e,t){return e.map((n,r)=>{const a=e.slice(Math.max(0,r-t+1),r+1);return a.reduce((i,o)=>i+o,0)/a.length})}function uie(e){const t=e.slice(0,-1),n=Math.floor(t.length/2);if(n<1)return null;const r=t.slice(-n).reduce((i,o)=>i+o,0),a=t.slice(-n*2,-n).reduce((i,o)=>i+o,0);return a?{half:n,change:(r-a)/a*100}:{half:n,change:null}}function Tit(e,t){const n=e/t,r=10**Math.floor(Math.log10(n)),a=n/r,i=[1,2,2.5,5,10].find(l=>a<=l),o=Math.max(1,i*r);return{max:o*Math.ceil(e/o),step:o}}function die(e){return e>0?[4,5,3].map(t=>Tit(e,t)).reduce((t,n)=>n.max<t.max?n:t):{max:4,step:1}}function Jk(e){const t=e.length;if(!t)return"";const[n]=e;if(t===1)return`M${n.x} ${n.y}`;const r=[],a=[];for(let c=0;c<t-1;c+=1)r[c]=e[c+1].x-e[c].x,a[c]=(e[c+1].y-e[c].y)/r[c];const i=[a[0]];for(let c=1;c<t-1;c+=1){const[u,d]=[a[c-1],a[c]];i[c]=u*d<=0?0:3*(r[c-1]+r[c])/((2*r[c]+r[c-1])/u+(r[c]+2*r[c-1])/d)}i[t-1]=a[t-2];const o=c=>c.toFixed(2);let l=`M${o(n.x)} ${o(n.y)}`;for(let c=0;c<t-1;c+=1){const[u,d]=[e[c],e[c+1]],h=r[c]/3;l+=` C${o(u.x+h)} ${o(u.y+i[c]*h)} ${o(d.x-h)} ${o(d.y-i[c+1]*h)} ${o(d.x)} ${o(d.y)}`}return l}const Ait=[{key:"profiles",label:"Profiles",noun:["new profile","new profiles"],empty:"No new profiles yet"},{key:"embeds",label:"Embedded",noun:["new website","new websites"],empty:"No new embeds yet"},{key:"conversations",label:"Conversations",noun:["conversation","conversations"],empty:"No conversations yet"}],Rit=[34,52,40,64,46,58,38,70,50,60,44,56],KS=280,li={top:14,right:4,bottom:30,left:40},Iit=420,hie=new Intl.NumberFormat("en-US"),Pit=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}),pie=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",timeZone:"UTC"}),Lit=new Intl.DateTimeFormat("en",{weekday:"short",month:"short",day:"numeric",timeZone:"UTC"}),Oit=new Intl.DateTimeFormat("en",{month:"short",year:"2-digit",timeZone:"UTC"}),Mit=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",timeZone:"UTC"}),Dit=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}),$it=new Intl.DateTimeFormat("en",{month:"long",year:"numeric",timeZone:"UTC"});function Fit(e,t){return e==="month"?Oit.format(t):pie.format(t)}function $z(e,t){return e==="month"?$it.format(t):e==="week"?`Week of ${pie.format(t)}`:Lit.format(t)}function mie(e,[t,n]){return`${hie.format(e)} ${e===1?t:n}`}function Bit(e){const[t,n]=f.useState(0);return f.useEffect(()=>{const r=e.current;if(!r)return;const a=new ResizeObserver(([i])=>n(Math.round(i.contentRect.width)));return a.observe(r),()=>a.disconnect()},[e]),t}function Uit({result:e,unit:t}){if(!e||e.change===null)return s.jsx("span",{className:"internal-trend__change","data-direction":"none",children:"No prior data"});const n=Math.round(e.change),r=n>0?"up":n<0?"down":"flat",a=r==="down"?R4:Af;return s.jsxs("span",{className:"internal-trend__change","data-direction":r,title:`Last ${mie(e.half,[t,`${t}s`])} vs the ${e.half} before`,children:[r!=="flat"&&s.jsx(a,{"aria-hidden":"true"}),r==="flat"?"Flat":`${Math.abs(n)}%`]})}function zit({series:e,metrics:t=Ait,title:n="Growth",titleId:r="overview-activity-title",days:a,totals:i,unavailable:o=[]}){const[l,c]=f.useState(t[0].key),u=t.map(({key:Q})=>Q).join("|"),[d,h]=f.useState(null),[p,m]=f.useState(!1),g=f.useRef(null),x=Bit(g),b=f.useMemo(()=>Xk(e,a,u.split("|")),[e,a,u]),{unit:y,points:v}=b,w=t.find(({key:Q})=>Q===l)||t[0],j=v.map(Q=>Q[l]),E=o.includes(l),S=!E&&j.some(Q=>Q>0),_=lie(y,v.length),k=cie(j,_),C=Object.fromEntries(t.map(({key:Q})=>[Q,uie(v.map(Y=>Y[Q]))]));f.useEffect(()=>{if(!x||p)return;let Q=0;const Y=requestAnimationFrame(()=>{Q=requestAnimationFrame(()=>m(!0))});return()=>{cancelAnimationFrame(Y),cancelAnimationFrame(Q)}},[x,p]);const N=Math.max(0,x-li.left-li.right),A=KS-li.top-li.bottom,{max:T,step:I}=die(Math.max(...j,...k,0)),$=v.length?N/v.length:0,O=Math.max(2,Math.min(28,$*.62)),U=Q=>li.left+$*Q+$/2,F=Q=>li.top+A-Q/T*A,H=Array.from({length:Math.round(T/I)+1},(Q,Y)=>Y*I),G=_>1?Jk(k.map((Q,Y)=>({x:U(Y),y:F(Q)}))):"",M=Math.min(v.length,x<420?3:5),z=M<=1?[0]:[...new Set(Array.from({length:M},(Q,Y)=>Math.round(Y*(v.length-1)/(M-1))))],W=v.length-1,D=d===null?null:v[d],Z=D?Math.min(Math.max(U(d),84),x-84):0,V=Q=>{const Y=Q.currentTarget.getBoundingClientRect(),J=Math.floor((Q.clientX-Y.left-li.left)/$);return Math.max(0,Math.min(W,J))},L=Q=>{const Y={ArrowLeft:-1,ArrowRight:1};if(Q.key==="Home")h(0);else if(Q.key==="End")h(W);else if(Y[Q.key])h(J=>Math.max(0,Math.min(W,(J??W)+Y[Q.key])));else return;Q.preventDefault()},K=v.length?`${Mit.format(v[0].time)} â ${Dit.format(b.now)}`:"",te=y==="day"?"Per day":y==="week"?"Per week":"Per month";return s.jsxs("section",{className:"internal-surface internal-trend","aria-labelledby":r,children:[s.jsxs("div",{className:"internal-trend__header",children:[s.jsxs("div",{className:"internal-trend__title",children:[s.jsx("h2",{className:"internal-overview-card__title",id:r,children:n}),K&&s.jsx("p",{className:"internal-trend__range",children:K})]}),s.jsx("div",{className:"internal-trend__tabs",role:"group","aria-label":"Chart metric",children:t.map(({key:Q,label:Y})=>s.jsxs("button",{type:"button","aria-pressed":l===Q,onClick:()=>c(Q),children:[s.jsx("span",{className:"internal-trend__tab-label",children:Y}),s.jsx("span",{className:"internal-trend__tab-value",children:o.includes(Q)?"â":hie.format(i?.[Q]??v.reduce((J,P)=>J+P[Q],0))}),!o.includes(Q)&&s.jsx(Uit,{result:C[Q],unit:y})]},Q))})]}),s.jsx("div",{className:"internal-trend__canvas",ref:g,"data-ready":p,children:S&&x>0?s.jsxs(s.Fragment,{children:[s.jsxs("svg",{width:x,height:KS,role:"group",tabIndex:0,"aria-label":`${w.label} ${te.toLowerCase()}. Use the arrow keys to read each ${y}.`,onPointerMove:Q=>h(V(Q)),onPointerLeave:()=>h(null),onFocus:()=>h(W),onBlur:()=>h(null),onKeyDown:L,children:[H.map(Q=>s.jsxs("g",{children:[s.jsx("line",{className:"internal-trend__grid",x1:li.left,x2:x-li.right,y1:F(Q),y2:F(Q),"data-base":Q===0}),s.jsx("text",{className:"internal-trend__axis",x:li.left-10,y:F(Q),textAnchor:"end",dominantBaseline:"middle",children:Pit.format(Q)})]},Q)),D&&s.jsx("line",{className:"internal-trend__guide",x1:U(d),x2:U(d),y1:li.top,y2:li.top+A}),s.jsx("g",{className:"internal-trend__bars",children:v.map((Q,Y)=>s.jsx("rect",{x:U(Y)-O/2,y:li.top,width:O,height:A,rx:Math.min(3,O/3),"data-active":d===Y,"data-dimmed":d!==null&&d!==Y,"data-partial":Y===W,style:{transform:`scaleY(${p?Q[l]/T:0})`,transitionDelay:`${v.length>1?Math.round(Y/W*Iit):0}ms`}},Y))}),G&&s.jsx("path",{className:"internal-trend__line",d:G,pathLength:"1"},`${l}-${a}-${v.length}`),D&&_>1&&s.jsx("circle",{className:"internal-trend__dot",cx:U(d),cy:F(k[d]),r:"4.5"}),z.map(Q=>s.jsx("text",{className:"internal-trend__axis",x:U(Q),y:KS-8,textAnchor:Q===0&&z.length>
13841?"start":Q===W&&z.length>1?"end":"middle",dx:Q===0&&z.length>1?-$/2:Q===W&&z.length>1?$/2:0,children:Fit(y,v[Q].time)},Q))]}),s.jsx("div",{className:"internal-trend__tooltip","data-visible":!!D,style:{transform:`translate(${Z}px, 0) translateX(-50%)`},"aria-hidden":"true",children:D&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"internal-trend__tooltip-date",children:[$z(y,D.time),d===W?" · so far":""]}),s.jsx("strong",{children:mie(D[l],w.noun)})]})})]}):s.jsxs("div",{className:"internal-trend__empty",children:[s.jsx("div",{className:"internal-trend__ghost","aria-hidden":"true",children:Rit.map((Q,Y)=>s.jsx("span",{style:{height:`${Q}%`}},Y))}),s.jsxs("div",{className:"internal-trend__empty-copy",children:[s.jsx("span",{className:"internal-trend__empty-icon",children:s.jsx(X0e,{"aria-hidden":"true"})}),s.jsx("strong",{children:E?"Not available yet":w.empty}),s.jsx("span",{children:E?"This series appears once the latest database update is live.":"Try a longer period to see earlier activity."})]})]})}),s.jsxs("div",{className:"internal-trend__legend","data-empty":!S||void 0,"aria-hidden":!S||void 0,children:[s.jsxs("span",{children:[s.jsx("i",{className:"internal-trend__key internal-trend__key--bar"}),te]}),s.jsxs("span",{children:[s.jsx("i",{className:"internal-trend__key internal-trend__key--partial"}),"Current ",y]}),_>1&&s.jsxs("span",{children:[s.jsx("svg",{className:"internal-trend__key internal-trend__key--line",viewBox:"0 0 20 12","aria-hidden":"true",children:s.jsx("path",{d:"M1 10 C5 10 7 3 11 5 S16 2 19 2"})}),_,"-",y," average"]})]}),s.jsxs("table",{className:"sr-only",children:[s.jsxs("caption",{children:[w.label," ",te.toLowerCase()]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Period"}),s.jsx("th",{children:w.label})]})}),s.jsx("tbody",{children:v.map(Q=>s.jsxs("tr",{children:[s.jsx("td",{children:$z(y,Q.time)}),s.jsx("td",{children:Q[l]})]},Q.bucket))})]})]})}const XS={hosted:{label:"On GreatExperts",hint:"Profile pages, the app and voice calls"},embed:{label:"On creators' sites",hint:"The chat widget embedded on their website"}},Hit=["profile","platform","voice"];function qit(e){if(e.some(({key:r})=>r==="hosted"))return e;const t=e.filter(({key:r})=>Hit.includes(r)),n=r=>t.reduce((a,i)=>i[r]===null||i[r]===void 0?null:a+Number(i[r]),0);return[{key:"hosted",conversations:n("conversations"),previous:n("previous"),creators:null},...e.filter(({key:r})=>r==="embed")]}const B1=new Intl.NumberFormat("en-US");function Fz(e,t){if(!t)return 0;const n=e/t*100;return n>0&&n<1?"<1":Math.round(n)}function Bz({current:e,previous:t}){if(t==null)return null;if(!t)return e?s.jsx("span",{className:"internal-trend__change","data-direction":"none",children:"New"}):null;const n=Math.round((e-t)/t*100),r=n>0?"up":n<0?"down":"flat",a=r==="down"?R4:Af;return s.jsxs("span",{className:"internal-trend__change","data-direction":r,title:`${B1.format(t)} in the period before`,children:[r!=="flat"&&s.jsx(a,{"aria-hidden":"true"}),r==="flat"?"Flat":`${Math.abs(n)}%`]})}function Wit({data:e,periodPhrase:t,comparedWith:n}){const r=qit(e?.channels||[]).filter(({key:l})=>XS[l]),a=r.reduce((l,{conversations:c})=>l+Number(c||0),0),i=r.some(({previous:l})=>l==null)?null:r.reduce((l,{previous:c})=>l+Number(c),0),o=e?a?"Hosted vs. embedded":"No chats in this period":"Not available yet";return s.jsxs("section",{className:"internal-surface internal-overview-card internal-channels","aria-labelledby":"overview-channels-title",children:[s.jsxs("div",{className:"internal-overview-card__header",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"internal-overview-card__title",id:"overview-channels-title",children:"Where chats happen"}),s.jsx("p",{className:"internal-section-note",children:o})]}),a>0&&s.jsxs("p",{className:"internal-channels__total",title:`Conversations ${t}${n?`, compared with ${n}`:""}`,children:[s.jsx(Bz,{current:a,previous:i}),s.jsx("strong",{children:B1.format(a)}),s.jsxs("span",{className:"sr-only",children:["conversations ",t]})]})]}),a>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"internal-channels__bar",role:"img","aria-label":r.map(({key:l,conversations:c})=>`${XS[l].label} ${Fz(Number(c||0),a)}%`).join(", "),children:r.map(({key:l,conversations:c})=>Number(c)>0?s.jsx("span",{"data-channel":l,style:{flexGrow:Number(c)}},l):null)}),s.jsx("ul",{className:"internal-channels__list",children:r.map(({key:l,conversations:c,previous:u,creators:d})=>{const{label:h,hint:p}=XS[l],m=Number(c||0),g=d==null?null:Number(d);return s.jsxs("li",{title:p,children:[s.jsx("span",{className:"internal-channels__swatch","data-channel":l,"aria-hidden":"true"}),s.jsxs("span",{className:"internal-channels__copy",children:[s.jsx("span",{className:"internal-channels__label",children:h}),g!==null&&s.jsx("span",{className:"internal-channels__meta",children:g?`${B1.format(g)} creator${g===1?"":"s"}`:"No creators yet"})]}),s.jsx("span",{className:"internal-channels__change",children:s.jsx(Bz,{current:m,previous:u})}),s.jsxs("span",{className:"internal-channels__share",children:[Fz(m,a),"%"]}),s.jsx("strong",{className:"internal-channels__count",children:B1.format(m)})]},l)})})]})]})}const uL=[{value:1,label:"24h",long:"last 24 hours"},{value:7,label:"7d",long:"last 7 days"},{value:30,label:"30d",long:"last 30 days"},{value:90,label:"90d",long:"last 90 days"},{value:365,label:"12mo",long:"last 12 months"},{value:0,label:"All",long:"all time"}],kf=[{key:"free",label:"Free"},{key:"lite",label:"Lite"},{key:"starter",label:"Starter"},{key:"pro",label:"Pro"}],fie=Object.fromEntries(kf.map(({key:e,label:t})=>[e,t]));function Vl(e){return e!=null}function Ns(e){return Vl(e)?new Intl.NumberFormat("en-US").format(Number(e)):"â"}function Fr(e,t){if(!Vl(e)||!Number(t))return null;const n=Number(e)/Number(t)*100;return`${n<10&&n>0?n.toFixed(1):Math.round(n)}%`}function n0(e){const t=uL.find(({value:n})=>n===e);return t?t.long.charAt(0).toUpperCase()+t.long.slice(1):""}
1384function dL({value:e,onChange:t}){return s.jsx("div",{className:"internal-period",role:"group","aria-label":"Reporting period",children:uL.map(n=>s.jsx("button",{type:"button","aria-pressed":e===n.value,"aria-label":`Show ${n.long}`,onClick:()=>t(n.value),children:n.label},n.value))})}function Fv({icon:e,label:t,value:n,chip:r,chipTone:a="neutral",visual:i,description:o}){return s.jsxs("div",{className:"internal-kpi",children:[s.jsxs("p",{className:"internal-kpi__label",children:[t,s.jsx("span",{className:"internal-kpi__icon",children:s.jsx(e,{"aria-hidden":"true"})})]}),s.jsx("p",{className:"internal-kpi__value",children:Ns(n)}),r&&s.jsx("span",{className:"internal-kpi__chip","data-tone":a,children:r}),i&&s.jsx("div",{className:"internal-kpi__visual",children:i}),o&&s.jsx("p",{className:"sr-only",children:o})]})}function Vit({values:e,replayKey:t}){if(e.length<2)return null;const n=96,r=44,a=Math.min(...e),i=Math.max(1,Math.max(...e)-a),o=e.map((c,u)=>({x:u/(e.length-1)*n,y:4+(1-(c-a)/i)*(r-8)})),l=Jk(o);return s.jsx("svg",{className:"internal-kpi__spark",width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":"true",children:s.jsx("path",{className:"internal-kpi__spark-line",d:l,pathLength:"1"},`line-${t}`)})}function t_({segments:e,total:t,label:n}){const r=Math.max(1,Number(t||0)),a=e.reduce((i,{key:o,value:l,tone:c})=>{const u=i.length?i[i.length-1].end:0,d=Math.min(100-u,Number(l||0)/r*100);return[...i,{key:o,tone:c,percent:d,start:u,end:u+d}]},[]);return s.jsxs("svg",{className:"internal-kpi__ring",viewBox:"0 0 52 52","aria-hidden":"true",children:[s.jsx("circle",{className:"internal-kpi__ring-track",cx:"26",cy:"26",r:"21",pathLength:"100"}),a.map(({key:i,tone:o,percent:l,start:c})=>l>0?s.jsx("circle",{className:`internal-kpi__ring-fill internal-kpi__ring-fill--${o}`,cx:"26",cy:"26",r:"21",pathLength:"100",style:{strokeDasharray:`${l} ${100-l}`,strokeDashoffset:-c}},i):null),s.jsx("text",{x:"26",y:"26",textAnchor:"middle",dominantBaseline:"central",children:n})]})}function Vu({id:e,title:t,note:n,action:r}){return s.jsxs("div",{className:"internal-overview-card__header",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"internal-overview-card__title",id:e,children:t}),n&&s.jsx("p",{className:"internal-section-note",children:n})]}),r]})}function Qk({to:e,children:t}){return s.jsxs(Le,{to:e,className:"internal-text-action internal-overview-card__action",children:[t,s.jsx(xn,{"aria-hidden":"true"})]})}function Git({summary:e,followup:t,titleId:n="overview-leads-title"}){const r=e?.conversations,a=e?.leads,i=t?.followed_up,o=Number(t?.booked_calls||0),l=Math.max(1,Number(r||0),Number(a||0)),c=Number(r)>0&&Vl(a)?Fr(a,r):null,u=[{label:"Chats",value:r},{label:"Leads",value:a,step:Fr(a,r),stepOf:"chats",tip:"Contact requests visitors sent to a creator, through a chat or the contact form on the creator's profile."},{label:"Followed up",value:i,step:Fr(i,t?.leads),stepOf:"leads",tip:`Leads the creator acted on: contacted, replied, booked a call or marked not relevant. The rest are still New.${o>0?` ${Ns(o)} booked a call.`:""}`}];return s.jsxs("section",{className:"internal-surface internal-overview-card internal-leads","aria-labelledby":n,children:[s.jsxs("div",{className:"internal-leads__head",children:[s.jsxs("div",{className:"internal-leads__title",children:[s.jsx("h2",{className:"internal-overview-card__title",id:n,children:"Lead funnel"}),s.jsx("span",{children:"Chat-to-lead"})]}),s.jsxs("p",{className:"internal-leads__rate",title:"Leads divided by chats in this period",children:[s.jsx("strong",{children:c||"â"}),s.jsx("span",{className:"sr-only",children:"chat-to-lead rate"})]})]}),s.jsx("ol",{className:"internal-leadflow",children:u.map(({label:d,value:h,step:p,stepOf:m,tip:g})=>s.jsxs("li",{className:"internal-leadflow__stage",children:[p&&s.jsx("span",{className:"internal-leadflow__step","aria-hidden":"true",children:p}),s.jsx("span",{className:"internal-leadflow__track","aria-hidden":"true",children:Number(h)>0&&s.jsx("span",{style:{height:`${Number(h)/l*100}%`}})}),s.jsxs("span",{className:"internal-leadflow__foot",children:[s.jsxs("strong",{className:"internal-leadflow__value",children:[Ns(h),p&&s.jsxs("span",{className:"sr-only",children:[", ",p," of ",m]})]}),s.jsx("span",{className:"internal-leadflow__label",children:d}),g&&s.jsx("span",{className:"internal-leadflow__info",children:s.jsx(Ru,{label:`What counts as ${d.toLowerCase()}`,width:240,tone:"indigo",children:g})})]})]},d))})]})}const JS=new Intl.RelativeTimeFormat("en",{numeric:"auto",style:"short"});function Yit(e){const t=new Date(e).getTime();if(Number.isNaN(t))return"â";
1384const n=Math.round((t-Date.now())/6e4);if(Math.abs(n)<60)return JS.format(n,"minute");const r=Math.round(n/60);if(Math.abs(r)<24)return JS.format(r,"hour");const a=Math.round(r/24);return Math.abs(a)<30?JS.format(a,"day"):new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}).format(new Date(e))}function Kit({mix:e,total:t}){const n=kf.map(o=>({...o,count:Number(e?.[o.key]||0)})),r=n.reduce((o,l)=>o+l.count,0),a=r-n[0].count,i=Fr(a,t||r);return s.jsxs("section",{className:"internal-surface internal-overview-card","aria-labelledby":"overview-plans-title",children:[s.jsx(Vu,{id:"overview-plans-title",title:"Plans",note:r?`${i?`${i} paid · `:""}${Ns(a)} ${a===1?"account":"accounts"}`:"No accounts",action:s.jsx(Qk,{to:`${Me.INTERNAL}?view=subscriptions`,children:"Subscriptions"})}),s.jsx("div",{className:"internal-plan-bar",role:"img","aria-label":n.map(({label:o,count:l})=>`${o} ${Ns(l)}`).join(", "),children:n.map(({key:o,count:l})=>l>0?s.jsx("span",{className:`internal-plan-tone--${o}`,style:{flexGrow:l}},o):null)}),s.jsx("ul",{className:"internal-plan-legend",children:n.map(({key:o,label:l,count:c})=>s.jsxs("li",{children:[s.jsx("span",{className:`internal-plan-item__swatch internal-plan-tone--${o}`,"aria-hidden":"true"}),s.jsx("span",{className:"internal-plan-legend__label",children:l}),s.jsx("span",{className:"internal-plan-legend__share",children:Fr(c,r)||"0%"}),s.jsx("strong",{children:Ns(c)})]},o))})]})}function Uz({title:e,titleId:t,note:n,users:r,empty:a,days:i,renderValue:o,renderMeta:l}){return s.jsxs("section",{className:"internal-surface internal-overview-card internal-overview-card--list","aria-labelledby":t,children:[s.jsx(Vu,{id:t,title:e,note:n,action:s.jsx(Qk,{to:Me.INTERNAL_USERS,children:"All users"})}),r.length?s.jsx("ol",{className:"internal-people",children:r.map(c=>{const u=c.profile_name||c.full_name||c.username||"Profile not set";return s.jsx("li",{children:s.jsxs(Le,{to:`${Me.INTERNAL_USERS}/${encodeURIComponent(c.id)}`,state:{user:c,days:i},className:"internal-people__row",children:[s.jsx(ws,{name:u,src:c.profile_avatar_url,size:"sm"}),s.jsxs("span",{className:"internal-people__copy",children:[s.jsx("span",{className:"internal-people__name",children:u}),s.jsxs("span",{className:"internal-people__meta",children:[c.username?`@${c.username}`:"No handle"," · ",fie[c.plan]||"Free",l?` · ${l(c)}`:""]})]}),s.jsx("span",{className:"internal-people__value",children:o(c)}),s.jsx(hn,{className:"internal-people__chevron","aria-hidden":"true"})]})},c.id)})}):s.jsx("p",{className:"internal-people__empty",children:a})]})}function Xit(){const[e,t]=f.useState(30),[n,r]=f.useState(null),[a,i]=f.useState(null),[o,l]=f.useState(null),[c,u]=f.useState(null),[d,h]=f.useState(null),[p,m]=f.useState(""),[g,x]=f.useState(null),b=g!==e;f.useEffect(()=>{let T=!0;return Promise.allSettled([h_e({days:e}),qY({days:e}),g_e({days:e}),f_e({days:e}),m_e({days:e})]).then(([I,$,O,U,F])=>{T&&(I.status==="fulfilled"&&r(I.value),i($.status==="fulfilled"?$.value:null),h(O.status==="fulfilled"?O.value:null),l(U.status==="fulfilled"?U.value:null),u(F.status==="fulfilled"?F.value:null),m(I.status==="rejected"?I.reason?.message||"Failed to load the overview.":""),x(e))}),()=>{T=!1}},[e]);const y=uL.find(({value:T})=>T===e),v=n?.summary,w=Vl(v?.active_users)?v:null,j=v?.total_users,E=Number(j)>0&&Vl(v?.total_experts)?(Number(v.total_experts)/Number(j)).toFixed(1):null,S=kf.slice(1).map(T=>({...T,count:Number(n?.subscription_mix?.[T.key]||0)})).reduce((T,I)=>I.count>(T?.count||0)?I:T,null),_=f.useMemo(()=>{if(!a||g===null)return[];const{points:T}=Xk([a.trend],g,["users"]);let I=Number(a.total_users||0)-Number(a.new_users||0);return T.map($=>(I+=$.users,I))},[a,g]),k=n?.top_lead_users||[],C=Math.max(1,...k.map(T=>Number(T.leads_count||0))),N=e===0?"All time":y.long.charAt(0).toUpperCase()+y.long.slice(1),A=e===0?"all time":`in ${y.long.replace("last ","")}`;return s.jsxs("div",{className:"internal-page internal-overview","data-loading":b,children:[s.jsxs("header",{className:"internal-overview__header",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"internal-page__title",children:"Weâll make it, team!"}),s.jsxs("p",{className:"internal-page__description",children:["Growth, activity, and plans across GreatExperts",e===0?", all time.":` over the ${y.long}.`]})]}
1384),s.jsx(dL,{value:e,onChange:t})]}),s.jsx("div",{className:"internal-table-loading internal-overview__progress","data-loading":b,"aria-hidden":"true"}),p&&s.jsx(_a,{message:p,className:"internal-alert"}),s.jsxs("div",{"aria-busy":b,children:[s.jsxs("section",{className:"internal-kpis","aria-label":"Key numbers",children:[s.jsx(Fv,{icon:B4,label:"Users",value:j,chip:Vl(v?.new_users)?`+${Ns(v.new_users)}`:null,chipTone:Number(v?.new_users)>0?"positive":"neutral",visual:s.jsx(Vit,{values:_,replayKey:g}),description:Vl(v?.new_users)?`${Ns(v.new_users)} new ${A}.`:null}),s.jsx(Fv,{icon:d0e,label:"Active users",value:w?.active_users,chip:Vl(w?.active_users)&&Number(j)>0?`of ${Ns(j)} users`:null,visual:Vl(w?.active_users)&&Number(j)>0?s.jsx(t_,{total:j,segments:[{key:"active",value:w.active_users,tone:"indigo"}],label:Fr(w.active_users,j)}):null,description:Fr(w?.active_users,j)&&`${Fr(w.active_users,j)} of users were active ${A}.`}),s.jsx(Fv,{icon:Rw,label:"Paid users",value:v?.paid_subscribers,chip:S?`Top: ${S.label}`:null,visual:Number(j)>0?s.jsx(t_,{total:j,segments:kf.slice(1).map(({key:T})=>({key:T,value:n?.subscription_mix?.[T],tone:T})),label:Fr(v?.paid_subscribers,j)}):null,description:Fr(v?.paid_subscribers,j)&&`${Fr(v.paid_subscribers,j)} of users pay for a plan.${S?` ${S.label} is the most common paid plan.`:""}`}),s.jsx(Fv,{icon:Ms,label:"Experts",value:v?.total_experts,chip:E?`${E} / user`:null,description:E?`${E} experts per user on average.`:null})]}),s.jsxs("div",{className:"internal-overview-grid internal-overview-grid--lead",children:[s.jsx(zit,{series:[n?.conversation_trend,a?.trend,o?.trend],days:g??e,totals:{profiles:a?.new_profiles,conversations:w?.conversations,embeds:o?.new_websites},unavailable:[!a&&"profiles",!w&&"conversations",!o&&"embeds"].filter(Boolean)}),s.jsx(Git,{summary:w,followup:c})]}),s.jsxs("div",{className:"internal-overview-grid",children:[s.jsx(Kit,{mix:n?.subscription_mix,total:j}),s.jsx(Wit,{data:d,periodPhrase:e===0?"across all time":`in the ${y.long}`,comparedWith:e===0?null:`the ${y.long.replace("last ","")} before`})]}),s.jsxs("div",{className:"internal-overview-grid",children:[s.jsx(Uz,{title:"New users",titleId:"overview-newest-title",note:"Latest sign-ups",users:n?.newest_users||[],empty:"No accounts yet.",days:e,renderValue:T=>s.jsx("span",{className:"internal-people__time",children:Yit(T.created_at)})}),s.jsx(Uz,{title:"Top leads",titleId:"overview-leads-rank-title",note:`Ranked by leads · ${N}`,users:k,empty:n?.top_lead_users?"No leads in this period yet.":"Lead data is unavailable right now.",days:e,renderMeta:T=>{const I=Number(T.conversations_count||0);return I?`${Ns(I)} ${I===1?"chat":"chats"}`:"No chats"},renderValue:T=>{const I=Number(T.leads_count||0);return s.jsxs("span",{className:"internal-people__leads",children:[s.jsx("span",{className:"internal-people__leads-bar","aria-hidden":"true",children:s.jsx("span",{style:{transform:`scaleX(${I/C})`}})}),s.jsx("strong",{children:Ns(I)}),s.jsx("span",{children:I===1?"lead":"leads"})]})}})]})]})]})}const zz=kf.slice(1),Jit=8,Qit={paying:"Paying",trial:"On trial",comped:"Offered"},Zit=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",timeZone:"UTC"});function eot(e){return e?e.is_local?"comped":e.status==="trialing"?"trial":"paying":null}function tot(e,t){if(!t)return null;const n=Zit.format(new Date(t));return e==="paying"?`Paid to ${n}`:`Ends ${n}`}function sot(e,t){if(!Array.isArray(e))return null;const n=e.find(({plan:r})=>r===t)||{};return Number(n.paying||0)+Number(n.trial||0)+Number(n.comped||0)}async function not(e){const t=await D_({plan:e,limit:Jit,rankBy:"newest"}),n=t?.users||[],r=n.length?await K4(n.map(({id:a})=>a)):{};return{users:n,subs:r,total:Number(t?.total_matching||0)}}function rot({byPlan:e}){const[t,n]=f.useState("pro"),[r,a]=f.useState(null),[i,o]=f.useState(""),[l,c]=f.useState(0),u=r?.plan!==t&&!i;f.useEffect(()=>{let m=!0;return not(t).then(g=>{m&&(a({plan:t,...g}),o(""))}).catch(g=>{m&&o(g.message||"Unable to load accounts.")}),()=>{m=!1}},[t,l]);const d=m=>{m===t&&!i||(o(""),m===t?c(g=>g+1):n(m))},h=r?.users||[],p=zz.find(({key:m})=>m===t)?.label;return s.jsxs("section",{className:"internal-surface internal-overview-card internal-plan-people","aria-labelledby":"subs-people-title","data-loading":u,children:[s.jsx(Vu,{id:"subs-people-title",title:"People by plan",note:"Newest accounts first",action:s.jsx("div",{className:"internal-period internal-plan-people__picker",role:"group","aria-label":"Plan",children:zz.map(({key:m,label:g})=>{const x=sot(e,m);return s.jsxs("button",{type:"button","aria-pressed":t===m,onClick:()=>d(m),children:[s.jsx("span",{className:`internal-plan-dot internal-plan-tone--${m}`,"aria-hidden":"true"}),g,x!==null&&s.jsx("span",{className:"internal-plan-people__count",children:Ns(x)})]},m)})})}),s.jsx("div",{className:"internal-plan-people__body","aria-busy":u,children:i?s.jsxs("p",{className:"internal-people__empty",children:[i," Pick the plan again to retry."]}):!u&&!h.length?s.jsxs("p",{className:"internal-people__empty",children:["No one is on ",p," yet."]}):s.jsx("ol",{className:"internal-people internal-plan-people__list",children:h.map(m=>{const g=m.profile_name||m.full_name||m.username||"Profile not set",x=r?.subs?.[m.id],b=eot(x),y=tot(b,x?.ends_at);return s.jsx("li",{children:s.jsxs(Le,{to:`${Me.INTERNAL_USERS}/${encodeURIComponent(m.id)}`,className:"internal-people__row",children:[s.jsx(ws,{name:g,src:m.profile_avatar_url,size:"sm"}),s.jsxs("span",{className:"internal-people__copy",children:[s.jsx("span",{className:"internal-people__name",children:g}),s.jsx("span",{className:"internal-people__meta",children:m.username?`@${m.username}`:m.email})]}),s.jsxs("span",{className:"internal-subs-next__value",children:[b?s.jsx("span",{className:"internal-subs__tag","data-source":b,children:Qit[b]}):r?.subs&&s.jsx("span",{children:"No live plan"}),y&&s.jsx("span",{children:y})]}),s.jsx(hn,{className:"internal-people__chevron","aria-hidden":"true"})]})},m.id)})})}),s.jsxs("div",{className:"internal-plan-people__foot",children:[s.jsx("p",{className:"internal-plan-people__more",children:r&&!i&&r.total>h.length?`${Ns(h.length)} of ${Ns(r.total)} shown`:""}),s.jsxs(Qk,{to:`${Me.INTERNAL_USERS}?plan=${t}`,children:["Show more",s.jsxs("span",{className:"sr-only",children:[" ",p," users"]})]})]})]})}const Hi=[{key:"paying",label:"Paying",tip:"Billed through Stripe. The only plans that bring in money."},{key:"trial",label:"On trial",tip:"Card-less trial. Drops to Free when it ends unless they pay."},{key:"comped",label:"Offered",tip:"Plan the team offered for free, until its end date."}],aot=Object.fromEntries(Hi.map(({key:e,label:t})=>[e,t])),iot=kf.slice(1),oot=14,S5=new Intl.DateTimeFormat("en",{weekday:"short",month:"short",day:"numeric",timeZone:"UTC"}),QS=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",timeZone:"UTC"}),lot=new Intl.DateTimeFormat("en",{month:"short",year:"2-digit",timeZone:"UTC"}),cot=new Intl.DateTimeFormat("en",{month:"long",year:"numeric",timeZone:"UTC"});function ZS(e,t,n=!1){const r=new Date(`${t}T00:00:00Z`);return e==="month"?(n?cot:lot).format(r):e==="week"?n?`Week of ${QS.format(r)}`:QS.format(r):(n?S5:QS).format(r)}function uot(e,t){const n=(e+.5)/t;if(n<.25)return"start";if(n>.75)return"end"}function dot({trend:e,unit:t}){const[n,r]=f.useState(null),a=e||[];if(!a.length)return s.jsx("p",{className:"internal-subs-trend__empty",children:"No history for this period yet."});const i=a.map(p=>Hi.reduce((m,{key:g})=>m+Number(p[g]||0),0)),{max:o,step:l}=die(Math.max(1,...i)),c=Array.from({length:Math.round(o/l)+1},(p,m)=>m*l),u=a.length-1,d=[...new Set([0,Math.round(u/2),u])],h=a.length>1?Hi.map(({key:p})=>({key:p,d:Jk(a.map((m,g)=>({x:(g+.5)/a.length*100,y:100-Number(m[p]||0)/o*100})))})):[];return s.jsxs("div",{className:"internal-subs-trend",children:[s.jsxs("div",{className:"internal-subs-trend__plot",children:[s.jsx("div",{className:"internal-subs-trend__grid","aria-hidden":"true",children:c.map(p=>s.jsx("span",{style:{"--at":`${p/o*100}%`},children:s.jsx("em",{children:Ns(p)})},p))}),s.jsx("ol",{className:"internal-subs-trend__columns",tabIndex:0,"aria-label":`Live plans per ${t}. Use the arrow keys to read each ${t}.`,onFocus:()=>r(p=>p??u),onBlur:()=>r(null),onKeyDown:p=>{const m={ArrowLeft:-1,ArrowRight:1};if(p.key==="Home")r(0);else if(p.key==="End")r(u);else if(m[p.key])r(g=>Math.max(0,Math.min(u,(g??u)+m[p.key])));else return;p.preventDefault()},children:a.map((p,m)=>s.jsxs("li",{"data-active":n===m||void 0,children:[s.jsx("span",{className:"internal-subs-trend__stack",style:{height:`${i[m]/o*100}%`},"aria-hidden":"true",children:Hi.map(({key:g})=>Number(p[g])>0?s.jsx("span",{"data-source":g,style:{flexGrow:Number(p[g])}},g):null)}),s.jsxs("span",{className:"internal-subs-trend__tip","aria-hidden":"true","data-edge":uot(m,a.length),children:[s.jsxs("strong",{children:[ZS(t,p.bucket,!0),m===u?" · now":""]}),Hi.map(({key:g,label:x})=>s.jsxs("span",{children:[s.jsx("i",{"data-source":g}),x,s.jsx("b",{children:Ns(p[g])})]},g)),s.jsxs("span",{className:"internal-subs-trend__tip-total",children:[s.jsx("i",{"data-total":!0}),"All live plans",s.jsx("b",{children:Ns(i[m])})]})]})]},p.bucket))}),s.jsx("p",{className:"sr-only","aria-live":"polite",children:n===null?"":`${ZS(t,a[n].bucket,!0)}: ${gie({paying:Number(a[n].paying||0),trial:Number(a[n].trial||0),comped:Number(a[n].comped||0)})}, ${Ns(i[n])} live in total`}),h.length>0&&s.jsx("svg",{className:"internal-subs-trend__lines",viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",children:h.map(({key:p,d:m})=>s.jsx("path",{"data-source":p,d:m,vectorEffect:"non-scaling-stroke"},p))}),Hi.map(({key:p})=>s.jsx("span",{className:"internal-subs-trend__end","data-source":p,"aria-hidden":"true",style:{"--x":`${(u+.5)/a.length*100}%`,"--y":`${Number(a[u][p]||0)/o*100}%`}},p))]}),s.jsx("div",{className:"internal-subs-trend__axis","aria-hidden":"true",children:d.map(p=>s.jsx("span",{style:{"--at":`${(p+.5)/a.length*100}%`},"data-edge":p===0?"start":p===u?"end":void 0,children:ZS(t,a[p].bucket)},p))}),s.jsx("div",{className:"internal-subs-trend__legend","aria-hidden":"true",children:Hi.map(({key:p,label:m})=>s.jsxs("span",{children:[s.jsx("i",{"data-source":p}),m]},p))})]})}function hot(e){const t=Math.ceil((new Date(e).getTime()-Date.now())/864e5);return t<=0?"Ends today":t===1?"Ends tomorrow":`Ends in ${t} days`}function pot(e){const t=Object.fromEntries((e||[]).map(r=>[r.day,r])),n=new Date;return n.setUTCHours(0,0,0,0),Array.from({length:oot+1},(r,a)=>{const i=new Date(n.getTime()+a*864e5),o=i.toISOString().slice(0,10),l=t[o]||{},c=Number(l.trial||0),u=Number(l.comped||0),d=Number(l.paying||0);return{key:o,day:i,trial:c,comped:u,paying:d,total:c+u+d}})}function gie(e){const t=Hi.filter(({key:n})=>
1384e[n]>0).map(({key:n,label:r})=>`${Ns(e[n])} ${r.toLowerCase()}`);return t.length?t.join(", "):"nothing ends"}function mot({live:e,trend:t,unit:n}){const r=Number(e?.total||0),a=Number(e?.paying||0),i=[Number(e?.past_due)>0&&`${Ns(e.past_due)} past due`,Number(e?.canceling)>0&&`${Ns(e.canceling)} set to cancel`].filter(Boolean);return s.jsxs("section",{className:"internal-surface internal-overview-card internal-subs-pays","aria-labelledby":"subs-pays-title",children:[s.jsx(Vu,{id:"subs-pays-title",title:"Billing mix",note:e?r?a?`${Ns(a)} of ${Ns(r)} live plans ${a===1?"is":"are"} billed through Stripe`:`No plans billed through Stripe yet · ${Ns(r)} live`:"No live plans yet.":"Not available yet.",action:s.jsx(Qk,{to:Me.INTERNAL_USERS,children:"All users"})}),s.jsxs("div",{className:"internal-subs-pays__body",children:[s.jsxs("div",{className:"internal-subs-pays__panel",children:[s.jsx("h3",{className:"internal-subs-pays__panel-title",children:"Over time"}),s.jsx(dot,{trend:t,unit:n})]}),s.jsxs("div",{className:"internal-subs-pays__panel",children:[s.jsx("h3",{className:"internal-subs-pays__panel-title",children:"Today"}),s.jsxs("div",{className:"internal-subs-chart",children:[s.jsx("ol",{className:"internal-subs-chart__rows",children:Hi.map(({key:o,label:l,tip:c})=>{const u=Number(e?.[o]||0),d=r?Fr(u,r)||"0%":"â";return s.jsxs("li",{"data-source":o,tabIndex:0,"aria-label":`${l}: ${Ns(e?.[o])} plans, ${d} of live plans`,children:[s.jsxs("span",{className:"internal-subs-chart__label",children:[s.jsx("span",{className:"internal-subs__swatch","data-source":o,"aria-hidden":"true"}),l,s.jsx("span",{className:"internal-subs__info",children:s.jsx(Ru,{label:`What counts as ${l.toLowerCase()}`,width:240,tone:"indigo",children:c})})]}),s.jsxs("span",{className:"internal-subs-chart__track","aria-hidden":"true",children:[u>0&&s.jsx("span",{className:"internal-subs-chart__bar",style:{width:`${u/Math.max(1,r)*100}%`}}),s.jsxs("span",{className:"internal-subs-chart__tip",children:[Ns(e?.[o])," ",l.toLowerCase()," · ",d," of live plans"]})]}),s.jsxs("span",{className:"internal-subs-chart__value","aria-hidden":"true",children:[s.jsx("strong",{children:Ns(e?.[o])}),s.jsx("span",{children:d})]})]},o)})}),s.jsx("div",{className:"internal-subs-chart__axis","aria-hidden":"true",children:[0,25,50,75,100].map(o=>s.jsxs("span",{style:{"--tick":`${o}%`},children:[o,"%"]},o))})]})]})]}),i.length>0&&s.jsx("p",{className:"internal-subs-pays__alerts",children:i.map(o=>s.jsx("span",{children:o},o))})]})}function fot({ending:e}){const t=pot(e),n=t.slice(0,8).reduce((a,i)=>a+i.total,0),r=Math.max(1,...t.map(a=>a.total));return s.jsxs("section",{className:"internal-surface internal-overview-card internal-subs-ending","aria-labelledby":"subs-ending-title",children:[s.jsx(Vu,{id:"subs-ending-title",title:"Ending soon",note:"Trials, offers and cancellations, next 14 days",action:s.jsxs("p",{className:"internal-subs__figure",children:[s.jsx("strong",{children:Ns(n)}),s.jsx("span",{children:"this week"})]})}),s.jsx("ol",{className:"internal-subs-ending__days","aria-label":"Plans ending per day",children:t.map(({key:a,day:i,trial:o,comped:l,paying:c,total:u})=>s.jsxs("li",{title:`${S5.format(i)}: ${gie({trial:o,comped:l,paying:c})}`,children:[s.jsx("span",{className:"internal-subs-ending__column","aria-hidden":"true",children:u>0&&s.jsxs("span",{className:"internal-subs-ending__stack",style:{height:`${u/r*100}%`},children:[c>0&&s.jsx("span",{"data-source":"paying",style:{flexGrow:c}}),l>0&&s.jsx("span",{"data-source":"comped",style:{flexGrow:l}}),o>0&&s.jsx("span",{"data-source":"trial",style:{flexGrow:o}})]})}),s.jsxs("span",{className:"sr-only",children:[S5.format(i),": ",Ns(u)," ending"]})]},a))}),s.jsxs("div",{className:"internal-subs-ending__axis","aria-hidden":"true",children:[s.jsx("span",{children:"Today"}),s.jsx("span",{children:"+7 days"}),s.jsx("span",{children:"+14 days"})]})]})}function got({period:e,days:t}){const n=Number(e?.converted||0),r=Number(e?.expired||0),a=n+r,i=a?Fr(n,a):null,o=[{key:"started",label:"Trials started",value:e?.trials_started},{key:"converted",label:"Became paying",value:e?.converted},{key:"expired",label:"Ended on Free",value:e?.expired}];return s.jsxs("section",{className:"internal-surface internal-overview-card internal-subs-outcomes","aria-labelledby":"subs-outcomes-title",children:[s.jsx(Vu,{id:"subs-outcomes-title",title:"Trial outcomes",note:n0(t)}),s.jsxs("div",{className:"internal-subs-outcomes__body",children:[s.jsxs("div",{className:"internal-subs-outcomes__ring",children:[s.jsx(t_,{total:Math.max(1,a),segments:[{key:"converted",value:n,tone:"indigo"}],label:i||"â"}),s.jsx("span",{children:"of finished trials converted"})]}),s.jsx("dl",{className:"internal-subs-outcomes__rows",children:o.map(({key:l,label:c,value:u})=>s.jsxs("div",{"data-row":l,children:[s.jsx("dt",{children:c}),s.jsx("dd",{children:Ns(u)})]},l))})]})]})}function xot({byPlan:e}){const t=iot.map(({key:r,label:a})=>{const i=(e||[]).find(({plan:o})=>o===r)||{};return{key:r,label:a,paying:Number(i.paying||0),trial:Number(i.trial||0),comped:Number(i.comped||0)}}),n=Math.max(1,...t.flatMap(r=>Hi.map(({key:a})=>r[a])));return s.jsxs("section",{className:"internal-surface internal-overview-card internal-subs-matrix-card","aria-labelledby":"subs-matrix-title",children:[s.jsx(Vu,{id:"subs-matrix-title",title:"Plan by source",note:"Where each paid planâs accounts come from"}),s.jsxs("table",{className:"internal-subs-matrix",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",children:s.jsx("span",{className:"sr-only",children:"Plan"})}),Hi.map(({key:r,label:a})=>s.jsx("th",{scope:"col",children:a},r)),s.jsx("th",{scope:"col",className:"internal-subs-matrix__total",children:"Total"})]})}),s.jsx("tbody",{children:t.map(r=>s.jsxs("tr",{children:[s.jsxs("th",{scope:"row",children:[s.jsx("span",{className:`internal-plan-item__swatch internal-plan-tone--${r.key}`,"aria-hidden":"true"}),r.label]}),Hi.map(({key:a})=>s.jsx("td",{"data-empty":!r[a]||void 0,style:{"--heat":r[a]/n},children:Ns(r[a])},a)),s.jsx("td",{className:"internal-subs-matrix__total",children:Ns(r.paying+r.trial+r.comped)})]},r.key))})]})]})}function bot({items:e}){return s.jsxs("section",{className:"internal-surface internal-overview-card internal-overview-card--list","aria-labelledby":"subs-next-title",children:[s.jsx(Vu,{id:"subs-next-title",title:"Reach out first",note:"Plans ending soonest, before they drop to Free"}),e?.length?s.jsx("ol",{className:"internal-people",children:e.map(t=>{const n=t.profile_name||t.username||"Profile not set",r=!!t.username&&t.username===n,a=t.username&&!r?`@${t.username} · `:"";return s.jsx("li",{children:s.jsxs(Le,{to:`${Me.INTERNAL_USERS}/${encodeURIComponent(t.user_id)}`,className:"internal-people__row",children:[s.jsx(ws,{name:n,src:t.profile_avatar_url,size:"sm"}),s.jsxs("span",{className:"internal-people__copy",children:[s.jsx("span",{className:"internal-people__name",children:r?`@${n}`:n}),s.jsxs("span",{className:"internal-people__meta",children:[a,fie[t.plan]||t.plan," plan"]})]}),s.jsxs("span",{className:"internal-subs-next__value",children:[s.jsx("span",{className:"internal-subs__tag","data-source":t.source,children:aot[t.source]}),s.jsx("span",{children:hot(t.ends_at)})]}),s.jsx(hn,{className:"internal-people__chevron","aria-hidden":"true"})]})},t.user_id)})}):s.jsx("p",{className:"internal-people__empty",children:"Nothing ends in the next 14 days."})]})}function yot(){const[e,t]=f.useState(30),[n,r]=f.useState(null),[a,i]=f.useState(""),[o,l]=f.useState(null),c=o!==e;return f.useEffect(()=>{let u=!0;return p_e({days:e}).then(d=>{u&&(r(d),i(""))}).catch(d=>{u&&i(d.message||"Failed to load subscriptions.")}).finally(()=>{u&&l(e)}
1384),()=>{u=!1}},[e]),s.jsxs("div",{className:"internal-page internal-overview internal-subs","data-loading":c,children:[s.jsxs("header",{className:"internal-overview__header",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"internal-page__title",children:"Subscriptions"}),s.jsxs("p",{className:"internal-page__description",children:["Who pays, whoâs trying, and what ends next · ",n0(e)]})]}),s.jsx(dL,{value:e,onChange:t})]}),s.jsx("div",{className:"internal-table-loading internal-overview__progress","data-loading":c,"aria-hidden":"true"}),a&&s.jsx(_a,{message:a,className:"internal-alert"}),s.jsxs("div",{"aria-busy":c,children:[s.jsx("div",{className:"internal-overview-grid internal-subs-grid--hero",children:s.jsx(mot,{live:n?.live,trend:n?.trend,unit:n?.unit||"day"})}),s.jsx("div",{className:"internal-overview-grid internal-subs-grid--hero",children:s.jsx(rot,{byPlan:n?.by_plan})}),s.jsxs("div",{className:"internal-overview-grid internal-subs-grid--lead",children:[s.jsx(fot,{ending:n?.ending}),s.jsx(got,{period:n?.period,days:o??e})]}),s.jsxs("div",{className:"internal-overview-grid",children:[s.jsx(xot,{byPlan:n?.by_plan}),s.jsx(bot,{items:n?.ending_soon})]})]})]})}function vot({icon:e,label:t,complete:n,detail:r}){return s.jsxs("li",{className:"internal-profile-signal","data-complete":n,children:[s.jsx("span",{className:"internal-profile-signal__icon",children:s.jsx(e,{"aria-hidden":"true"})}),s.jsxs("span",{className:"internal-profile-signal__copy",children:[s.jsx("strong",{children:t}),s.jsx("span",{children:r})]}),n?s.jsx(pc,{className:"internal-profile-signal__state","aria-label":"Complete"}):s.jsx(fye,{className:"internal-profile-signal__state","aria-label":"Not added"})]})}const eC=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function xie({user:e,label:t}){const n=e.has_picture??!!e.profile_avatar_url,r=n?"Added":e.has_preset_picture?"Preset, not replaced":"Not added",a=Number(e.social_links_count||0),i=Number(e.knowledge_sources_count||0),o=Number(e.voice_clone_count||0),l=Number(e.experts_count||0),c=Number(e.public_experts_count||0),u=Number(e.priced_experts_count||0),d=[{icon:Nh,label:"Picture",complete:n,detail:r},{icon:si,label:"Bio",complete:!!e.has_bio,detail:e.has_bio?"Added":"Not added"},{icon:Of,label:"Social media",complete:a>0,detail:a?eC(a,"link"):"Not added"},{icon:tY,label:"Knowledge",complete:i>0,detail:i?eC(i,"source"):"Not added"},{icon:bb,label:"Voice clone",complete:o>0,detail:o?eC(o,"expert"):"Not added"},{icon:Ms,label:"Experts",complete:l>0,detail:l?`${l} total · ${c} public`:"None created"},{icon:S0e,label:"Expert pricing",complete:u>0,detail:u?`${u} priced`:"Not set"}];return s.jsx("ul",{className:"internal-profile-signals","aria-label":t,children:d.map(h=>s.jsx(vot,{...h},h.label))})}const Hg=12,eh={free:{label:"Free",tone:"free"},lite:{label:"Lite",tone:"lite"},starter:{label:"Starter",tone:"starter"},pro:{label:"Pro",tone:"pro"}},bie={users:["Users","Search every account and understand where each person is in their journey."]};function s_(e){return e==null?"â":new Intl.NumberFormat("en-US").format(Number(e))}function C5(e){return e?new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"}).format(new Date(e)):"â"}function wot({tone:e}){return s.jsx("span",{className:`internal-plan-item__swatch internal-plan-tone--${e}`,"aria-hidden":"true"})}function Hz({user:e}){if(!e)return null;const t=e.profile_name||e.username||"Profile not set",n=e.profile_avatar_url||"",r=eh[e.plan]||eh.free;return s.jsxs("div",{className:"internal-user-detail",children:[s.jsxs("div",{className:"internal-user-detail__grid",children:[s.jsxs("div",{className:"internal-user-detail__person",children:[s.jsx(ws,{name:t,src:n,size:"xl"}),s.jsxs("div",{className:"internal-user-detail__copy",children:[s.jsxs("div",{className:"internal-user-detail__heading",children:[s.jsx("h3",{children:t}),e.is_internal&&s.jsx("span",{className:"internal-internal-label",children:"Internal"})]}),s.jsx("p",{className:"internal-user-detail__handle",children:e.username?`@${e.username}`:"No profile handle"}),s.jsx("p",{className:"internal-user-detail__bio",children:e.bio||"No profile bio yet."}),s.jsxs("p",{className:"internal-user-detail__meta",children:[e.email," · ",r.label," plan · joined ",C5(e.created_at)]})]})]}),e.username?s.jsxs(Le,{to:`/${e.username}`,target:"_blank",rel:"noreferrer",className:"internal-secondary-action",children:["View profile ",s.jsx(Ro,{"aria-hidden":"true"})]}):s.jsx("span",{className:"internal-section-note",children:"No profile handle"})]}),s.jsx(xie,{user:e,label:`Profile readiness for ${t}`})]})}function jot({users:e,selectedId:t,onSelect:n,focus:r="users"}){const a=(o,l)=>{const c=o.profile_name||o.username||"Profile not set";return s.jsxs("button",{type:"button",className:"internal-user-trigger",onClick:()=>
1384n(l?null:o.id),"aria-expanded":l,"aria-label":`${l?"Close":"Open"} profile summary for ${c}`,children:[s.jsx(ws,{name:c,src:o.profile_avatar_url,size:"sm"}),s.jsxs("span",{className:"internal-user-copy",children:[s.jsx("span",{className:"internal-user-name",children:c}),s.jsx("span",{className:"internal-user-handle",children:o.username?`@${o.username}`:"No profile handle"})]})]})},i=o=>{const l=eh[o.plan]||eh.free;return s.jsxs("span",{className:"internal-plan-label",children:[s.jsx(wot,{tone:l.tone}),l.label]})};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"internal-users-table-wrap",children:s.jsxs("table",{className:"internal-users-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Profile"}),s.jsx("th",{children:"Plan"}),s.jsx("th",{children:"Readiness"}),s.jsx("th",{children:"Experts"}),s.jsx("th",{children:"Joined"}),s.jsx("th",{children:"Status"})]})}),s.jsx("tbody",{children:e.map(o=>{const l=t===o.id,c=eh[o.plan]||eh.free,u=Math.max(0,Math.min(100,Number(o.profile_completion||0)));return s.jsxs(f.Fragment,{children:[s.jsxs("tr",{"aria-selected":l,children:[s.jsx("td",{children:a(o,l)}),s.jsx("td",{children:i(o)}),s.jsx("td",{children:s.jsxs("span",{className:"internal-profile-cell",children:[s.jsxs("span",{className:"internal-profile-cell__value",children:[u,"%"]}),s.jsx("span",{className:"internal-profile-cell__track",children:s.jsx("span",{className:`internal-profile-cell__fill internal-plan-tone--${c.tone}`,style:{transform:`scaleX(${u/100})`}})})]})}),s.jsx("td",{children:s_(o.experts_count)}),s.jsx("td",{children:C5(o.created_at)}),s.jsx("td",{children:s.jsxs("span",{className:"internal-status-label",children:[s.jsx("span",{className:`internal-status-dot internal-status-dot--${o.account_completed?"complete":"setup"}`,"aria-hidden":"true"}),o.account_completed?"Complete":"Setup"]})})]}),l&&s.jsx("tr",{children:s.jsx("td",{colSpan:"6",children:s.jsx(Hz,{user:o,focus:r})})})]},o.id)})})]})}),s.jsx("div",{className:"internal-users-mobile",children:e.map(o=>{const l=t===o.id;return s.jsxs("article",{className:"internal-user-card",children:[s.jsxs("div",{className:"internal-user-card__top",children:[a(o,l),s.jsx("span",{className:"internal-user-card__plan",children:i(o)})]}),s.jsxs("dl",{className:"internal-user-card__facts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Readiness"}),s.jsxs("dd",{children:[Number(o.profile_completion||0),"%"]})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Experts"}),s.jsx("dd",{children:s_(o.experts_count)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Joined"}),s.jsx("dd",{children:C5(o.created_at)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Status"}),s.jsx("dd",{children:o.account_completed?"Complete":"Setup"})]})]}),l&&s.jsx(Hz,{user:o,focus:r})]},o.id)})}),e.length===0&&s.jsxs("div",{className:"internal-empty",children:[s.jsx("strong",{children:"No users found."}),s.jsx("span",{children:"Adjust the search or plan filter to see more accounts."})]})]})}function _ot({view:e}){const[t,n]=f.useState(""),[r,a]=f.useState("all"),[i,o]=f.useState(1),[l,c]=f.useState(0),[u,d]=f.useState(null),[h,p]=f.useState(null),[m,g]=f.useState(""),[x,b]=f.useState(!0);f.useEffect(()=>{let S=!0;const _=setTimeout(async()=>{b(!0),g("");try{const k=await M_({search:t,plan:r,days:i,limit:Hg,offset:l});S&&p(k)}catch(k){S&&g(k.message||"Failed to load dashboard.")}finally{S&&b(!1)}},t?280:0);return()=>{S=!1,clearTimeout(_)}},[t,r,i,l]);const y=f.useMemo(()=>h?.users?.find(S=>S.id===u),[h,u]),[v,w]=bie[e],j=Number(h?.total_matching||0),E=l+Hg<j;return s.jsxs("div",{className:"internal-page",children:[s.jsxs("header",{className:"internal-page__header",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"internal-page__title",children:v}),s.jsx("p",{className:"internal-page__description",children:w})]}),s.jsxs("div",{className:"internal-page__controls",children:[s.jsxs("label",{className:"internal-search",children:[s.jsx("span",{className:"sr-only",children:"Search users, experts, or emails"}),s.jsx(Fa,{"aria-hidden":"true"}),s.jsx("input",{value:t,onChange:S=>{n(S.target.value),c(0)},placeholder:"Search users, handles, or emails"})]}),s.jsxs("label",{className:"internal-select-wrap",children:[s.jsx("span",{className:"sr-only",children:"Reporting period"}),s.jsx(Ex,{"aria-hidden":"true"}),s.jsxs("select",{value:i,onChange:S=>{o(Number(S.target.value)),c(0)},children:[s.jsx("option",{value:1,children:"Last 24 hours"}),s.jsx("option",{value:7,children:"Last 7 days"}),s.jsx("option",{value:30,children:"Last 30 days"}),s.jsx("option",{value:90,children:"Last 90 days"}),s.jsx("option",{value:365,children:"Last 12 months"}),s.jsx("option",{value:0,children:"All time"})]}),s.jsx(Is,{"aria-hidden":"true"})]})]})]}),m&&s.jsx(_a,{message:m,className:"internal-alert"}),s.jsxs("section",{className:"internal-surface internal-table-section",children:[s.jsxs("div",{className:"internal-table-header",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"internal-section-title",children:v}),s.jsxs("p",{className:"internal-section-note",children:[s_(j)," matching account",j===1?"":"s"]})]}),s.jsx("div",{className:"internal-table-actions",children:s.jsxs("select",{value:r,onChange:S=>{a(S.target.value),c(0)},className:"internal-filter-select","aria-label":"Filter by plan",children:[s.jsx("option",{value:"all",children:"All plans"}),Object.entries(eh).map(([S,_])=>s.jsx("option",{value:S,children:_.label},S))]})})]}),s.jsx("div",{className:"internal-table-loading","data-loading":x,"aria-hidden":"true"}),s.jsx("div",{"aria-busy":x,"aria-live":"polite",children:s.jsx(jot,{users:h?.users||[],selectedId:u,onSelect:d,focus:e})}),s.jsxs("footer",{className:"internal-pagination",children:[s.jsx("span",{children:j?`${l+1}â${Math.min(l+Hg,j)} of ${s_(j)}`:"0 results"}),s.jsxs("div",{className:"internal-pagination__buttons",children:[s.jsx("button",{type:"button",disabled:l===0||x,onClick:()=>{c(Math.max(0,l-Hg)),d(null)},className:"internal-icon-button","aria-label":"Previous page",children:s.jsx(ja,{"aria-hidden":"true"})}),s.jsx("button",{type:"button",disabled:!E||x,onClick:()=>{c(l+Hg),d(null)},className:"internal-icon-button","aria-label":"Next page",children:s.jsx(xn,{"aria-hidden":"true"})})]})]})]}),y&&s.jsxs("span",{className:"sr-only",children:["Selected profile: ",y.profile_name]})]})}function kot(){const[e]=gl(),t=e.get("view")||"overview";return t==="profiles"?s.jsx(Pn,{to:Me.INTERNAL_USERS,replace:!0}):t==="subscriptions"?s.jsx(yot,{}):bie[t]?s.jsx(_ot,{view:t},t):s.jsx(Xit,{})}const Not=/(?:^|[\s._+-])(test|testing|dummy|sandbox|demo|fake)(?:\d+)?(?=$|[\s._+-])
1384/i,Eot=/^(anna|gosia)(?:[._-][a-z]+)*\+[^@]+$/i,Sot=new Set(["example.com","example.org","example.net"]);function yie(e={}){const t=String(e.email||"").trim().toLowerCase(),[n="",r=""]=t.split("@");if(e.is_internal===!0)return{kind:"team",label:"Team account",reason:"Marked as internal in the account record."};if(r==="greatspire.io"||Eot.test(n))return{kind:"team",label:"Likely team account",reason:r==="greatspire.io"?"Email uses the Greatspire team domain. This is an automatic hint.":"Email matches an Anna or Gosia plus alias. This is an automatic hint."};if(Sot.has(r)||r.endsWith(".test")||r.endsWith(".invalid"))return{kind:"test",label:"Possible test account",reason:"Email uses a reserved example or testing domain."};const a=[["Email",n],["Name",e.full_name],["Profile name",e.profile_name],["Handle",e.username]];for(const[i,o]of a){const l=String(o||"").match(Not);if(l)return{kind:"test",label:"Possible test account",reason:`${i} contains â${l[1].toLowerCase()}â. This is an automatic hint.`}}return null}function qz({user:e}){const t=yie(e);if(!t)return null;const n=`${t.label}: ${t.reason}`;return s.jsx("span",{className:"internal-account-signal","data-kind":t.kind,role:"img","aria-label":n,title:n,children:s.jsx("img",{src:"/brand/logo-mark-indigo.svg",alt:"","aria-hidden":"true",width:"22",height:"22"})})}const Cot=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",timeZone:"UTC"}),Tot=new Intl.DateTimeFormat("en",{month:"short",year:"2-digit",timeZone:"UTC"});function Aot({points:e,unit:t,loading:n}){if(n)return s.jsxs("div",{className:"internal-quick__chart","aria-hidden":"true",children:[s.jsx("span",{className:"internal-quick__loading"}),s.jsx("span",{className:"internal-quick__axis",children:s.jsx("span",{children:"Â "})})]});const r=e.map(o=>o.conversations),a=Math.max(1,...r),i=o=>(t==="month"?Tot:Cot).format(new Date(o.time));return s.jsxs("div",{className:"internal-quick__chart",children:[s.jsx("span",{className:"internal-quick__columns",role:"img","aria-label":`Chats per ${t}: ${r.join(", ")}`,children:r.map((o,l)=>s.jsx("span",{"data-empty":o===0||void 0,title:`${i(e[l])}: ${Ns(o)} ${o===1?"chat":"chats"}`,style:o>0?{height:`${Math.max(10,o/a*100)}%`}:void 0},e[l].bucket))}),s.jsxs("span",{className:"internal-quick__axis","aria-hidden":"true",children:[s.jsx("span",{children:e.length?i(e[0]):"Â "}),e.length>1&&s.jsx("span",{children:i(e[e.length-1])})]})]})}function Wz({user:e,days:t}){const[n,r]=f.useState(null),[a,i]=f.useState(null);f.useEffect(()=>{let v=!0;return WY({userId:e.id,days:t,hint:e}).then(w=>{v&&r(w?.engagement_trend||[])}).catch(()=>{v&&r([])}),VY({userId:e.id,days:t}).then(w=>{v&&i(w||{})}).catch(()=>{v&&i({})}),()=>{v=!1}},[e,t]);const o=yie(e),l=Number(e.conversations_count||0),c=Number(e.messages_count||0),u=Number(e.leads_count||0),d=a?.profile_visitors,h=a?.booked_calls,p=a===null,{unit:m,points:g}=Xk([n||[]],t,["conversations","messages"]),x=Number(d||0),b=Number(h||0),y=[{key:"visitors",label:"Visitors",value:p?null:d,share:x?Math.min(1,l/x):0,note:p?"Â ":x?`${Fr(Math.min(l,x),x)} chat rate`:"No profile visits"},{key:"leads",label:"Leads",value:e.leads_count,share:Math.max(l,u)?u/Math.max(l,u):0,note:u?u>l?"Mostly from the contact form":`${Fr(u,l)} of chats`:"None yet"},{key:"booked",label:"Booked calls",value:p?null:h,share:u?Math.min(1,b/u):0,note:p?"Â ":b?`${Fr(b,u)} of leads`:"None yet"}];return s.jsxs("div",{className:"internal-quick",children:[o&&s.jsx("p",{className:"internal-account-explanation",children:s.jsxs("span",{children:[s.jsxs("strong",{children:[o.label,"."]})," ",o.reason]})}),s.jsxs("div",{className:"internal-quick__head",children:[s.jsx("p",{className:"internal-quick__title",children:n0(t)}),s.jsxs(Le,{to:`${Me.INTERNAL_USERS}/${encodeURIComponent(e.id)}`,state:{user:e,days:t},className:"internal-quick__open",children:["Open profile ",s.jsx(xn,{"aria-hidden":"true"})]})]}),s.jsxs("section",{className:"internal-quick__activity","aria-label":"Activity",children:[s.jsxs("dl",{className:"internal-quick__figures",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Chats"}),s.jsx("dd",{children:Ns(e.conversations_count)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Messages"}),s.jsx("dd",{children:Ns(e.messages_count)}),s.jsx("span",{children:l?e.messages_count==null?"Â ":`${(c/l).toFixed(1)} per chat`:"No chats yet"})]})]}),s.jsx(Aot,{points:g,unit:m,loading:n===null})]}),s.jsx("section",{className:"internal-quick__outcomes","aria-label":"Funnel","data-loading":p||void 0,children:s.jsx("dl",{children:y.map(({key:v,label:w,value:j,share:E,note:S})=>s.jsxs("div",{className:"internal-quick__outcome",children:[s.jsx("dt",{children:w}),s.jsx("dd",{children:Ns(j)}),s.jsx("span",{className:"internal-quick__meter","aria-hidden":"true",children:s.jsx("span",{style:{width:`${Math.min(1,E)*100}%`}})}),s.jsx("span",{className:"internal-quick__note",children:S})]},v))})})]})}function tC({label:e,value:t,options:n,onChange:r,prefix:a,icon:i,className:o=""}){const[l,c]=f.useState(!1),[u,d]=f.useState(!1),[h,p]=f.useState(0),m=f.useRef(null),g=f.useRef(null),x=f.useRef(null),b=f.useId(),y=Math.max(0,n.findIndex(_=>_.value===t)),v=n[y];f.useEffect(()=>{if(!l)return;const _=k=>{m.current?.contains(k.target)||c(!1)};return document.addEventListener("pointerdown",_),()=>document.removeEventListener("pointerdown",_)},[l]),f.useEffect(()=>{l&&x.current?.focus()},[l]);const w=_=>{d(_),p(y),c(!0)},j=(_=!0)=>{c(!1),_&&g.current?.focus()},E=_=>{const k=n[_];k&&k.value!==t&&r(k.value),j()},S=_=>{const k=n.length-1,C={ArrowDown:()=>p(N=>
1384Math.min(k,N+1)),ArrowUp:()=>p(N=>Math.max(0,N-1)),Home:()=>p(0),End:()=>p(k),Enter:()=>E(h)," ":()=>E(h),Escape:()=>j()};if(_.key==="Tab"){j(!1);return}C[_.key]&&(_.preventDefault(),C[_.key]())};return s.jsxs("div",{ref:m,className:`internal-ranking-control internal-filter-select ${o}`,"data-open":l,children:[s.jsxs("button",{ref:g,type:"button",className:"internal-filter-select__trigger","aria-haspopup":"listbox","aria-expanded":l,"aria-controls":b,"aria-label":`${e}: ${v?.label}`,onClick:_=>l?j():w(_.detail===0),onKeyDown:_=>{(_.key==="ArrowDown"||_.key==="ArrowUp")&&(_.preventDefault(),w(!0))},children:[i?s.jsx(i,{className:"internal-filter-select__icon","aria-hidden":"true"}):null,a?s.jsx("span",{className:"internal-filter-select__prefix",children:a}):null,s.jsx("span",{className:"internal-filter-select__value",children:v?.label}),s.jsx(Is,{className:"internal-filter-select__chevron","aria-hidden":"true"})]}),s.jsx("ul",{ref:x,id:b,role:"listbox",tabIndex:-1,"aria-label":e,"aria-activedescendant":l?`${b}-${h}`:void 0,className:"internal-filter-select__list","data-instant":u,onKeyDown:S,children:n.map((_,k)=>s.jsxs("li",{id:`${b}-${k}`,role:"option","aria-selected":_.value===t,"data-active":k===h,onPointerEnter:()=>p(k),onClick:()=>E(k),children:[s.jsx("span",{children:_.label}),_.value===t?s.jsx(ft,{"aria-hidden":"true"}):null]},_.value))})]})}function hL({className:e="",labelledBy:t,onClose:n,children:r}){const a=f.useRef(null);return f.useEffect(()=>{const i=a.current;if(i)return i.showModal(),()=>{i.open&&i.close()}},[]),s.jsx("dialog",{ref:a,className:e,"aria-labelledby":t,onCancel:i=>{i.preventDefault(),n()},onClick:i=>{i.target===i.currentTarget&&n()},children:r})}const Rot=["lite","starter","pro"];function Vz(e=30,t=new Date){const n=new Date(t);return n.setDate(n.getDate()+e),n.toISOString().slice(0,10)}function Iot(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e||""))return null;const t=new Date(`${e}T23:59:59.000Z`);return Number.isNaN(t.getTime())?null:t.toISOString()}function Pot(e){if(!e)return"";const t=[];e.action==="grant"?(e.updated&&t.push(`${e.updated} extended`),e.revived&&t.push(`${e.revived} trial${e.revived===1?"":"s"} revived`),e.inserted&&t.push(`${e.inserted} new trial${e.inserted===1?"":"s"}`)):e.expired&&t.push(`${e.expired} expired`),e.skipped&&t.push(`${e.skipped} skipped (nothing to change)`);let n=t.length?t.join(", ")+".":"Nothing changed.";const r=Array.isArray(e.stripe_user_ids)?e.stripe_user_ids.length:0;return r&&(n+=` ${r} ${r===1?"has":"have"} a Stripe subscription: our copy was changed, but Stripe itself was not touched.`),n}function Gz(e){return e.profile_name||e.full_name||e.username||"Profile not set"}function vie({sub:e,expired:t=!1,fallbackPlan:n,reserveGift:r=!1}){const a=e?.plan||(e===void 0?n:null)||"free",i=!!e?.is_local;return s.jsxs("span",{className:"internal-plan-label",children:[s.jsx("i",{className:`internal-plan-dot internal-plan-tone--${a}`,"aria-hidden":"true"}),s.jsxs("span",{children:[a.charAt(0).toUpperCase()+a.slice(1),!e&&t?" (expired)":""]}),i||r?s.jsxs("span",{className:"internal-plan-gift",title:i?"Plan offered by the team":void 0,"data-hidden":!i||void 0,children:[s.jsx(uY,{"aria-hidden":"true"}),i?s.jsx("span",{className:"sr-only",children:"offered by the team"}):null]}):null]})}function Lot({mode:e,users:t,onClose:n,onDone:r}){const[a,i]=f.useState("pro"),[o,l]=f.useState(()=>Vz(30)),[c,u]=f.useState(!1),[d,h]=f.useState(""),p=e==="grant",m=Iot(o),g=async x=>{x.preventDefault(),u(!0),h("");try{const b=await __e({userIds:t.map(y=>y.id),action:e,plan:p?a:null,endsAt:p?m:null});r(Pot(b))}catch(b){h(b.message||"Failed to update subscriptions."),u(!1)}};return s.jsx(hL,{className:"internal-preset-dialog internal-subscription-dialog",labelledBy:"internal-subscription-dialog-title",onClose:c?()=>{}:n,children:s.jsxs("form",{onSubmit:g,className:"internal-subscription-dialog__form",children:[s.jsxs("div",{className:"internal-preset-dialog__header",children:[s.jsxs("div",{children:[s.jsx("h2",{id:"internal-subscription-dialog-title",children:p?"Change subscription":"Expire subscription"}),s.jsx("p",{children:p?"Comp these accounts on a plan until the chosen date. Accounts with a longer entitlement keep it.":"Ends access now. Accounts on Free are skipped. Stripe subscriptions are not cancelled in Stripe."})]}),s.jsx("button",{type:"button",className:"internal-icon-button","aria-label":"Close",onClick:n,disabled:c,
1384children:s.jsx(as,{"aria-hidden":"true"})})]}),s.jsxs("div",{className:"internal-preset-dialog__content",children:[p?s.jsxs("div",{className:"internal-subscription-fields",children:[s.jsxs("label",{className:"internal-field",children:[s.jsx("span",{className:"internal-field__label",children:"Plan"}),s.jsxs("span",{className:"internal-select-wrap",children:[s.jsx("select",{value:a,onChange:x=>i(x.target.value),children:Rot.map(x=>s.jsx("option",{value:x,children:x.charAt(0).toUpperCase()+x.slice(1)},x))}),s.jsx(Is,{"aria-hidden":"true"})]})]}),s.jsxs("label",{className:"internal-field",children:[s.jsx("span",{className:"internal-field__label",children:"Access until (end of day, UTC)"}),s.jsx("input",{className:"internal-control",type:"date",required:!0,value:o,min:Vz(1),onChange:x=>l(x.target.value)})]})]}):null,s.jsxs("p",{className:"internal-field__label",children:[t.length," selected"]}),s.jsx("ul",{className:"internal-subscription-userlist",children:t.map(x=>s.jsxs("li",{children:[s.jsx(ws,{name:Gz(x),src:x.profile_avatar_url,size:"sm"}),s.jsxs("span",{className:"internal-user-copy",children:[s.jsx("span",{className:"internal-user-name",children:Gz(x)}),s.jsx("span",{className:"internal-user-handle",children:x.username?`@${x.username}`:x.email})]})]},x.id))}),d?s.jsx(_a,{message:d,className:"internal-alert"}):null]}),s.jsxs("div",{className:"internal-preset-dialog__footer",children:[s.jsx("button",{type:"button",className:"internal-secondary-action",onClick:n,disabled:c,children:"Cancel"}),s.jsx("button",{type:"submit",className:p?"internal-primary-action":"internal-danger-action",disabled:c||p&&!m,children:c?"Applyingâ¦":p?`Apply to ${t.length}`:`Expire ${t.length}`})]})]})})}const Oot="https://us.posthog.com/project/597305/dashboard",Yz=[10,50,100,500],Kz=[{value:"all",label:"All plans"},{value:"free",label:"Free"},{value:"lite",label:"Lite"},{value:"starter",label:"Starter"},{value:"pro",label:"Pro"},{value:"expired",label:"Expired"}],Xz=[{value:"all",label:"All profiles"},{value:"complete",label:"Complete"},{value:"incomplete",label:"Incomplete"},{value:"picture",label:"Has picture"},{value:"no_picture",label:"No picture"},{value:"social",label:"Has social links"},{value:"no_social",label:"No social links"},{value:"knowledge",label:"Has knowledge"},{value:"no_knowledge",label:"No knowledge"},{value:"voice",label:"Has voice clone"},{value:"no_voice",label:"No voice clone"}],Jz=[{value:"conversations",label:"Chats"},{value:"messages",label:"Messages"},{value:"leads",label:"Leads"},{value:"contacts",label:"Contacts"},{value:"experts",label:"Experts"},{value:"recent",label:"Recent activity"},{value:"newest",label:"Newest first"},{value:"oldest",label:"Oldest first"}],Qz={conversations:{key:"conversations_count",label:"Chats"},messages:{key:"messages_count",label:"Messages"},leads:{key:"leads_count",label:"Leads"},contacts:{key:"contacts_count",label:"Contacts"},experts:{key:"experts_count",label:"Experts"},recent:{key:"last_active_at",label:"Last active",isDate:!0},newest:{key:"created_at",label:"Created",isDate:!0},oldest:{key:"created_at",label:"Created",isDate:!0}};function eb(e){return e==null?"â":new Intl.NumberFormat("en-US").format(Number(e))}function Zz(e){if(!e)return"â";const t=new Date(e);return Number.isNaN(t.getTime())?"â":new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"}).format(t)}function Mot(e){const t=Number(e.experts_count||0);if(!t)return s.jsx("span",{className:"internal-ranking-muted",children:"None"});const n=Number(e.public_experts_count||0);return n===t?`${eb(t)} live`:`${eb(n)} of ${eb(t)} live`}function Dot(e){if(!e)return"â";const t=new Date(e);if(Number.isNaN(t.getTime()))return"â";const n=t.getFullYear()===new Date().getFullYear();return new Intl.DateTimeFormat("en",{month:"short",day:"numeric",...n?{}:{year:"numeric"}}).format(t)}const eH={external:{label:"via embed",tip:"Signed up inside an expert widget on a creator's website"}};function $ot({user:e}){if(e.has_picture===void 0)return s.jsx("span",{className:"internal-ranking-muted",children:"â"});const t=[{key:"picture",icon:Nh,on:e.has_picture,yes:"Picture",n
1384o:e.has_preset_picture?"Preset picture, not replaced yet":"No picture"},{key:"social",icon:eY,on:Number(e.social_links_count)>0,yes:`${e.social_links_count} social ${Number(e.social_links_count)===1?"link":"links"}`,no:"No social links"},{key:"knowledge",icon:tY,on:Number(e.knowledge_sources_count)>0,yes:`${e.knowledge_sources_count} knowledge sources`,no:"No knowledge"},{key:"voice",icon:bb,on:Number(e.voice_clone_count)>0,yes:"Voice clone",no:"No voice clone"}];return s.jsx("span",{className:"internal-profile-icons","aria-label":`Profile: ${t.map(({on:n,yes:r,no:a})=>n?r:a).join(", ")}`,role:"img",children:t.map(({key:n,icon:r,on:a,yes:i,no:o})=>s.jsx("span",{"data-on":!!a,title:a?i:o,children:s.jsx(r,{"aria-hidden":"true"})},n))})}function tH(e){return e.profile_name||e.full_name||e.username||"Profile not set"}function Fot({summary:e}){const t=Number(e?.total_users||0),n=Number(e?.active_users||0),r=Math.max(0,t-n),a=[{value:"active",label:"Active",count:n,tone:"active",tip:"Had at least one chat, message or lead in this period."},{value:"inactive",label:"Idle",count:r,tone:"inactive",tip:"No chats, messages or leads in this period."}];return s.jsxs("section",{className:"internal-surface internal-overview-card internal-user-activity","aria-labelledby":"users-activity-title",children:[s.jsxs("div",{className:"internal-user-activity__head",children:[s.jsx("h2",{className:"internal-overview-card__title",id:"users-activity-title",children:"Activity"}),e?s.jsx(t_,{total:t,segments:[{key:"active",value:n,tone:"indigo"}],label:Fr(n,t)||"0%"}):null]}),e?s.jsxs(s.Fragment,{children:[s.jsx("ul",{className:"internal-user-activity__rows",children:a.map(({value:i,label:o,count:l,tone:c,tip:u})=>s.jsxs("li",{"data-tone":c,children:[s.jsx("i",{"aria-hidden":"true"}),s.jsxs("span",{className:"internal-user-activity__label",children:[o,s.jsx("span",{className:"internal-leadflow__info",children:s.jsx(Ru,{label:`What ${o.toLowerCase()} means`,width:220,tone:"indigo",children:u})})]}),s.jsx("strong",{children:Ns(l)})]},i))}),s.jsxs("dl",{className:"internal-rail-stats",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Chats"}),s.jsx("dd",{children:Ns(e.conversations)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Leads"}),s.jsx("dd",{children:Ns(e.leads)})]})]})]}):s.jsx("p",{className:"internal-section-note",children:"Not available yet"})]})}function Bot({data:e,totalUsers:t}){const n=!!e&&e.new_users!==void 0&&e.new_users!==null,r=f.useMemo(()=>n?Xk([e.trend],e.days,["users"]):null,[n,e]),a=r?r.points.map(x=>x.users):[],i=r?lie(r.unit,a.length):1,o=cie(a,i),l=Math.max(1,...a,...o),c=i>1&&a.length>1?Jk(o.map((x,b)=>({x:(b+.5)/a.length*100,y:100-x/l*100}))):"",u=uie(a),d=u?.change===null||u?.change===void 0?null:Math.round(u.change),h=d===null?"none":d>0?"up":d<0?"down":"flat",p=h==="down"?R4:Af,m=n?e.new_users:null,g=Fr(m,t);return s.jsxs("section",{className:"internal-surface internal-overview-card internal-signups","aria-labelledby":"users-signups-title",children:[s.jsxs("div",{className:"internal-user-activity__head",children:[s.jsx("h2",{className:"internal-overview-card__title",id:"users-signups-title",children:"New users"}),n&&d!==null?s.jsxs("span",{className:"internal-trend__change","data-direction":h,title:`Last ${u.half} ${r.unit}${u.half===1?"":"s"} vs the ${u.half} before`,children:[h!=="flat"&&s.jsx(p,{"aria-hidden":"true"}),h==="flat"?"Flat":`${Math.abs(d)}%`]}):null]}),n?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"internal-rail-figure",title:g?`${g} of all users`:void 0,children:s.jsx("strong",{children:Ns(m)})}),s.jsxs("div",{className:"internal-signups__chart","aria-hidden":"true",children:[s.jsx("div",{className:"internal-signups__bars",children:a.map((x,b)=>s.jsx("span",{"data-partial":b===a.length-1,style:{transform:`scaleY(${x/l})`}},r.points[b].bucket))}),c&&s.jsx("svg",{className:"internal-signups__trend",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:s.jsx("path",{d:c,vectorEffect:"non-scaling-stroke"})})]}),s.jsxs("p",{className:"internal-signups__axis","aria-hidden":"true",children:[s.jsx("span",{children:r.points.length?zot(r.points[0].time):""}),s.jsx("span",{children:"Today"})]})]}):s.jsx("p",{className:"internal-section-note",children:"Available after the next database update."})]})}const Uot=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",timeZone:"UTC"}),zot=e=>Uot.format(e),Hot=180,wie="(min-width: 60rem)",qot=e=>{const t=window.matchMedia(wie);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},Wot=()=>window.matchMedia(wie).matches;function Vot({users:e,rankBy:t,days:n,subs:r}){const[a,i]=f.useState(null),[o,l]=f.useState(null),c=f.useRef(0);f.useEffect(()=>()=>clearTimeout(c.current),[]);const u=m=>{const g=a;i(g===m?null:m),g&&(clearTimeout(c.current),l(g),c.current=setTimeout(()=>l(null),Hot))},d=f.useSyncExternalStore(qot,Wot,()=>!0),h=m=>m===a?"open":m===o?"closing":null,p=Qz[t]||Qz.conversations;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"internal-ranking-table-wrap",children:s.jsxs("table",{className:"internal-ranking-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"User"}),s.jsx("th",{children:"Plan"}),s.jsx("th",{children:s.jsxs("span",{className:"internal-th-with-info",children:["Profile",s.jsx("span",{className:"internal-leadflow__info",children:s.jsx(Ru,{label:"What the profile icons mean",width:240,tone:"indigo",children:"Picture, social links, knowledge and voice clone. A filled
1384icon means the profile has it; a dashed one means it doesn't yet. A preset picture counts once the user replaces it with their own. Complete profiles have all four."})})]})}),s.jsx("th",{children:"Experts"}),s.jsx("th",{children:"Joined"}),s.jsx("th",{children:"Public page"}),s.jsx("th",{children:s.jsx("span",{className:"sr-only",children:"Account marker"})})]})}),s.jsx("tbody",{children:e.map(m=>{const g=tH(m),x=a===m.id,b=`internal-quick-${m.id}`;return s.jsxs(f.Fragment,{children:[s.jsxs("tr",{className:"internal-ranking-row","data-selected":!!h(m.id),onClick:()=>u(m.id),children:[s.jsx("td",{children:s.jsxs("button",{type:"button",className:"internal-ranking-user internal-ranking-user--toggle","aria-expanded":x,"aria-controls":b,onClick:y=>{y.stopPropagation(),u(m.id)},children:[s.jsx(ws,{name:g,src:m.profile_avatar_url,size:"sm"}),s.jsxs("span",{className:"internal-user-copy",children:[s.jsx("span",{className:"internal-user-name",title:g,children:g}),s.jsx("span",{className:"internal-user-handle",children:m.username?`@${m.username}`:m.email})]}),s.jsx(Is,{className:"internal-ranking-user__chevron","aria-hidden":"true"})]})}),s.jsx("td",{children:s.jsx(vie,{sub:r[m.id],fallbackPlan:m.plan,expired:m.subscription_status==="expired",reserveGift:!0})}),s.jsx("td",{children:s.jsx($ot,{user:m})}),s.jsx("td",{children:Mot(m)}),s.jsx("td",{children:s.jsxs("span",{className:"internal-ranking-plan",children:[s.jsx("span",{title:Zz(m.created_at),children:Dot(m.created_at)}),m.signup_source==="external"?s.jsx("span",{className:"internal-ranking-sub",title:eH.external.tip,children:eH.external.label}):null]})}),s.jsx("td",{children:m.username?s.jsx("a",{className:"internal-public-link",href:`/${m.username}`,target:"_blank",rel:"noreferrer",title:`Open greatexperts.ai/${m.username}`,"aria-label":`Open ${g}'s public page in a new tab`,onClick:y=>y.stopPropagation(),children:s.jsx(Ro,{"aria-hidden":"true"})}):s.jsx("span",{className:"internal-ranking-muted",title:"No public page yet",children:"â"})}),s.jsx("td",{className:"internal-account-marker-cell",children:s.jsx(qz,{user:m})})]}),d&&h(m.id)&&s.jsx("tr",{className:"internal-ranking-expand",id:b,children:s.jsx("td",{colSpan:7,children:s.jsx("div",{className:"internal-quick-reveal","data-state":h(m.id),children:s.jsx("div",{className:"internal-quick-reveal__inner",children:s.jsx(Wz,{user:m,days:n})})})})})]},m.id)})})]})}),s.jsx("div",{className:"internal-ranking-mobile",children:e.map(m=>{const g=tH(m),x=p.isDate?Zz(m[p.key]):eb(m[p.key]),b=a===m.id;return s.jsxs("article",{className:"internal-ranking-card","data-open":!!h(m.id),children:[s.jsxs("button",{type:"button",className:"internal-ranking-card__trigger","aria-expanded":b,"aria-controls":`internal-quick-m-${m.id}`,onClick:()=>u(m.id),children:[s.jsx(ws,{name:g,src:m.profile_avatar_url,size:"sm"}),s.jsxs("span",{className:"internal-user-copy",children:[s.jsx("span",{className:"internal-user-name",children:g}),s.jsx("span",{className:"internal-user-handle",children:m.username?`@${m.username}`:m.email})]}),s.jsxs("span",{className:"internal-ranking-card__metric",children:[s.jsx("strong",{children:x}),s.jsx("small",{children:p.label})]}),s.jsx(Is,{className:"internal-ranking-user__chevron","aria-hidden":"true"}),s.jsx("span",{className:"internal-account-marker-slot",children:s.jsx(qz,{user:m})})]}),!d&&h(m.id)&&s.jsx("div",{id:`internal-quick-m-${m.id}`,className:"internal-quick-reveal","data-state":h(m.id),children:s.jsx("div",{className:"internal-quick-reveal__inner internal-ranking-card__quick",children:s.jsx(Wz,{user:m,days:n})})})]},m.id)})})]})}function Got(){const[e]=gl(),[t,n]=f.useState(""),[r,a]=f.useState(30),[i,o]=f.useState(()=>{const F=e.get("plan");return Kz.some(({value:H})=>H===F)?F:"all"}),[l,c]=f.useState(()=>{const F=e.get("profile");return Xz.some(({value:H})=>H===F)?F:"all"}),[u,d]=f.useState("newest"),[h,p]=f.useState(0),[m,g]=f.useState(Yz[0]),[x,b]=f.useState(null),[y,v]=f.useState(""),[w,j]=f.useState(!0),[E,S]=f.useState({}),[_,k]=f.useState(null);f.useEffect(()=>{let F=!0;return qY({days:r}).then(H=>{F&&k(H?{...H,days:r}:null)}
1384).catch(()=>{F&&k(null)}),()=>{F=!1}},[r]),f.useEffect(()=>{let F=!0;const H=setTimeout(async()=>{j(!0),v("");try{const G=await D_({search:t,plan:i,profile:l,days:r,limit:m,offset:h,rankBy:u,activity:"all"});F&&b(G)}catch(G){F&&v(G.message||"Failed to load user analytics.")}finally{F&&j(!1)}},t?280:0);return()=>{F=!1,clearTimeout(H)}},[r,h,m,i,l,u,t]);const C=f.useMemo(()=>(x?.users||[]).map(F=>F.id),[x]);f.useEffect(()=>{if(!C.length)return;let F=!0;return K4(C).then(H=>{F&&S(G=>({...G,...Object.fromEntries(C.map(M=>[M,H[M]||null]))}))}).catch(H=>{F&&v(H.message||"Failed to load subscriptions.")}),()=>{F=!1}},[C]);const N=x?.users||[],A=Number(x?.total_matching||0),T=h+m<A,I=x?.summary||{},$=x&&x.analytics_available!==!1,O=(Jz.find(F=>F.value===u)?.label||"Conversations").toLowerCase(),U=()=>{n(""),o("all"),c("all"),p(0)};return s.jsxs("div",{className:"internal-page internal-overview internal-users-analytics-page",children:[s.jsx(vs,{title:"Internal · Users",path:Me.INTERNAL_USERS,noIndex:!0}),s.jsxs("header",{className:"internal-overview__header",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"internal-page__title",children:"Users"}),s.jsxs("p",{className:"internal-page__description",children:["Every account, its activity and its plan · ",n0(r)]})]}),s.jsxs("div",{className:"internal-users-header-actions",children:[s.jsxs("a",{className:"internal-secondary-action internal-secondary-action--accent",href:Oot,target:"_blank",rel:"noreferrer",children:["PostHog ",s.jsx(Ro,{"aria-hidden":"true"})]}),s.jsx(dL,{value:r,onChange:F=>{a(F),p(0)}})]})]}),y?s.jsx(_a,{message:y,className:"internal-alert"}):null,x?.analytics_available===!1?s.jsx("p",{className:"internal-users-data-note",role:"status",children:"Engagement metrics appear once this environment has the user-analytics migration."}):null,s.jsxs("div",{className:"internal-users-layout",children:[s.jsxs("aside",{className:"internal-users-rail","aria-label":"User summary",children:[s.jsx(Fot,{summary:$?I:null}),s.jsx(Bot,{data:_,totalUsers:$?I.total_users:null})]}),s.jsxs("section",{className:"internal-surface internal-ranking-section","aria-labelledby":"internal-ranking-title",children:[s.jsxs("div",{className:"internal-ranking-header",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"internal-overview-card__title",id:"internal-ranking-title",children:"All users"}),s.jsxs("p",{className:"internal-section-note",children:[u==="newest"||u==="oldest"?O.charAt(0).toUpperCase()+O.slice(1):`Sorted by ${O}`," · ",n0(r)]})]}),s.jsxs("div",{className:"internal-ranking-controls",children:[s.jsxs("label",{className:"internal-search internal-ranking-search",children:[s.jsx("span",{className:"sr-only",children:"Search by name, email, handle, user ID or expert ID"}),s.jsx(Fa,{"aria-hidden":"true"}),s.jsx("input",{value:t,onChange:F=>{n(F.target.value),p(0)},placeholder:"Search name, email or ID"})]}),s.jsx(tC,{className:"internal-ranking-control--primary",label:"Sort by",prefix:"Sort by",value:u,options:Jz,onChange:F=>{d(F),p(0)}}),s.jsx(tC,{label:"Filter by plan",value:i,options:Kz,onChange:F=>{o(F),p(0)}}),s.jsx(tC,{label:"Filter by profile",value:l,options:Xz,onChange:F=>{c(F),p(0)}})]})]}),s.jsx("div",{className:"internal-table-loading","data-loading":w,"aria-hidden":"true"}),s.jsxs("div",{"aria-busy":w,"aria-live":"polite",children:[s.jsx(Vot,{users:N,rankBy:u,days:r,subs:E}),!w&&N.length===0?s.jsxs("div",{className:"internal-empty",children:[s.jsx("strong",{children:"No users match these filters"}),s.jsx("button",{type:"button",className:"internal-text-action",onClick:U,children:"Clear filters"})]}):null]}),s.jsxs("footer",{className:"internal-pagination",children:[s.jsxs("label",{className:"internal-pagination__size",children:["Rows",s.jsx("select",{value:m,onChange:F=>{g(Number(F.target.value)),p(0)},children:Yz.map(F=>s.jsx("option",{value:F,children:F},F))})]}),s.jsx("span",{className:"internal-pagination__range",children:A?`${h+1}â${Math.min(h+m,A)} of ${eb(A)} users`:"0 users"}),s.jsxs("div",{className:"internal-pagination__buttons",children:[s.jsx("button",{type:"button",className:"internal-icon-button","aria-label":"Previous page",disabled:h===0||w,onClick:()=>p(Math.max(0,h-m)),children:s.jsx(ja,{"aria-hidden":"true"})}),s.jsx("button",{type:"button",className:"internal-icon-button","aria-label":"Next page",disabled:!T||w,onClick:()=>p(h+m),children:s.jsx(xn,{"aria-hidden":"true"})})]})]})]})]})]})}function uc(e){return e==null?"â":new Intl.NumberFormat("en-US").format(Number(e))}function mx(e){if(!e)return"â";const t=new Date(e);return Number.isNaN(t.getTime())?"â":new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"}).format(t)}function Yot(e){return e?.profile_name||e?.full_name||e?.username||"Profile not set"}function Kot(e){const t=new Date(`${e}T00:00:00`);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}).format(t)}function jie({icon:e,label:t,value:n,suffix:r=""}){return s.jsxs("div",{className:"internal-users-metric",children:[s.jsxs("p",{className:"internal-users-metric__label",children:[s.jsx(e,{"aria-hidden":"true"}),t]}),s.jsxs("p",{className:"internal-users-metric__value",children:[uc(n),n!=null?r:""]})]})}function Xot(){return s.jsxs("div",{className:"internal-chart-legend","aria-label":"Chart series",children:[s.jsxs("span",{children:[s.jsx("i",{className:"internal-chart-key internal-chart-key--conversations"}),"Conversations"]}),s.jsxs("span",{children:[s.jsx("i",{className:"internal-chart-key internal-chart-key--messages"}),"Messages"]})]})}function sH(e,t,n,r,a,i,o){if(!e.length)return"";const l=r-i*2,c=a-o*2;return e.map((u,d)=>{const h=e.length===1?r/2:i+d/(e.length-1)*l,p=o+c-Number(u[t]||0)/n*c;return`${d===0?"M":"L"}${h.toFixed(2)} ${p.toFixed(2)}`}).join(" ")}function Jot({points:e,titleId:t="internal-engagement-title"}){const n=Array.isArray(e)?e:[],r=n.some(h=>Number(h.conversations||0)>0||Number(h.messages||0)>0),a=720,i=250,o=36,l=28,c=Math.max(1,...n.map(h=>Number(h.conversations||0))),u=Math.max(1,...n.map(h=>Number(h.messages||0))),d=n.length<=5?n.map((h,p)=>p):[0,Math.round((n.length-1)*.25),Math.round((n.length-1)*.5),Math.round((n.length-1)*.75),n.length-1];return s.jsxs("section",{className:"internal-surface internal-engagement-chart","aria-labelledby":t,children:[s.jsxs("div",{className:"internal-users-panel-heading",children:[s.jsx("h2",{className:"internal-section-title",id:t,children:"Engagement over time"}),s.jsx(Xot,{})]}),r?s.jsxs("div",{className:"internal-engagement-chart__canvas",children:[s.jsxs("svg",{viewBox:`0 0 ${a} ${i}`,role:"img","aria-label":"Conversations and messages over the selected reporting period",children:[[0,.25,.5,.75,1].map(h=>{const p=l+(i-l*2)*h;return s.jsx("line",{className:"internal-chart-gridline",x1:o,x2:a-o,y1:p,y2:p},h)}),s.jsxs("text",{className:"internal-chart-scale internal-chart-scale--conversations",x:o,y:16,children:[uc(c)," conversations"]}),s.jsxs("text",{className:"internal-chart-scale internal-chart-scale--messages",x:a-o,y:16,textAnchor:"end",children:[uc(u)," messages"]}),s.jsx("path",{className:"internal-chart-line internal-chart-line--conversations",d:sH(n,"conversations",c,a,i,o,l)}),s.jsx("path",{className:"internal-chart-line internal-chart-line--messages",d:sH(n,"messages",u,a,i,o,l)}),d.map(h=>
1384{const p=n.length===1?a/2:o+h/(n.length-1)*(a-o*2);return s.jsx("text",{className:"internal-chart-label",x:p,y:i-4,textAnchor:"middle",children:Kot(n[h]?.bucket)},`${n[h]?.bucket}-${h}`)})]}),s.jsx("div",{className:"sr-only",children:s.jsxs("table",{children:[s.jsx("caption",{children:"Engagement over time"}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Period"}),s.jsx("th",{children:"Conversations"}),s.jsx("th",{children:"Messages"})]})}),s.jsx("tbody",{children:n.map(h=>s.jsxs("tr",{children:[s.jsx("td",{children:h.bucket}),s.jsx("td",{children:h.conversations}),s.jsx("td",{children:h.messages})]},h.bucket))})]})})]}):s.jsxs("div",{className:"internal-chart-empty",children:[s.jsx(ni,{"aria-hidden":"true"}),s.jsx("strong",{children:"No engagement data for this period."}),s.jsx("span",{children:"Conversations and messages will appear as activity arrives."})]})]})}function Qot({summary:e,titleId:t="internal-audience-flow-title"}){const n=[{label:"Conversations",value:e?.conversations,icon:ni},{label:"Leads",value:e?.leads,icon:TY},{label:"Contacts",value:e?.contacts,icon:qr}];return s.jsxs("section",{className:"internal-surface internal-audience-flow","aria-labelledby":t,children:[s.jsxs("div",{children:[s.jsx("h2",{className:"internal-section-title",id:t,children:"Audience flow"}),s.jsx("p",{className:"internal-section-note",children:"From conversation to a unique requester."})]}),s.jsx("ol",{className:"internal-audience-flow__list",children:n.map(({label:r,value:a,icon:i},o)=>s.jsxs("li",{children:[s.jsxs("div",{className:"internal-audience-flow__stage",children:[s.jsx(i,{"aria-hidden":"true"}),s.jsx("span",{children:r}),s.jsx("strong",{children:uc(a)})]}),o<n.length-1?s.jsx(xn,{className:"internal-audience-flow__arrow","aria-hidden":"true"}):null]},r))}),s.jsx("p",{className:"internal-audience-flow__definition",children:"Leads are contact-request submissions. Contacts are distinct requester emails."})]})}function Zot(e){return e?Math.round(Number(e)/60):0}const elt=[["profile","Public profile"],["embed","Embedded on their site"],["platform","Great Experts app"],["voice","Voice call"],["other","Other"]];function tlt({usage:e,loading:t}){const n=e?.conversation_sources||{},r=Array.isArray(e?.embeds)?e.embeds:[],a=Array.isArray(e?.top_offerings)?e.top_offerings:[],i=[{label:"Profile visitors",value:e?.profile_visitors,icon:Sh},{label:"Products pitched",value:e?.recommendations,icon:Mf},{label:"Product clicks",value:e?.product_clicks,icon:jY},{label:"Booked calls",value:e?.booked_calls,icon:kY},{label:"Voice conversations",value:e?.voice_conversations,icon:Qr},{label:"Voice minutes",value:e?Zot(e.voice_seconds):null,icon:Qr},{label:"Answers generated",value:e?.answers,icon:$u},{label:"Active embeds",value:e?r.length:null,icon:vc}];return s.jsxs("section",{className:"internal-surface internal-user-account internal-user-usage","aria-labelledby":"internal-user-usage-title","aria-busy":t,children:[s.jsxs("div",{children:[s.jsx("h2",{className:"internal-section-title",id:"internal-user-usage-title",children:"Usage insights"}),s.jsx("p",{className:"internal-section-note",children:"What this creator's audience does, over the selected period. Same rules as their Leads Insights tab."})]}),s.jsx("div",{className:"internal-users-metrics internal-user-usage__tiles",children:i.map(o=>s.jsx(jie,{...o},o.label))}),s.jsxs("div",{className:"internal-user-usage__grid",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"internal-user-usage__subtitle",children:"Where conversations start"}),s.jsx("dl",{className:"internal-user-account__facts internal-user-usage__facts",children:elt.map(([o,l])=>s.jsxs("div",{children:[s.jsx("dt",{children:l}),s.jsx("dd",{children:uc(e?Number(n[o]||0):null)})]},o))})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"internal-user-usage__subtitle",children:"Embeds"}),r.length?s.jsx("ul",{className:"internal-user-usage__list",children:r.map(o=>s.jsxs("li",{children:[s.jsxs("span",{className:"internal-user-usage__embed",children:[s.jsx("span",{className:"internal-user-usage__embed-domain",children:o.domain}),s.jsx("span",{className:"internal-user-usage__embed-expert",children:o.expert_name})]}),s.jsxs("span",{className:"internal-user-usage__embed-date",children:["since ",mx(o.created_at)]})]},`${o.domain}-${o.created_at}`))}):s.jsx("p",{className:"internal-user-usage__empty",children:"No embed set up."})]})]}),s.jsx("h3",{className:"internal-user-usage__subtitle",children:"Top offerings"}),a.length?s.jsx("div",{className:"internal-ranking-table-wrap internal-user-usage__table",children:s.jsxs("table",{className:"internal-ranking-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Offering"}),s.jsx("th",{children:"Pitched"}),s.jsx("th",{children:"Clicks"})]})}),s.jsx("tbody",{children:a.map(o=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("span",{className:"internal-user-name",children:o.title||o.ref})}),s.jsx("td",{children:uc(o.recommendations)}),s.jsx("td",{children:uc(o.clicks)})]},o.ref))})]})}):s.jsx("p",{className:"internal-user-usage__empty",children:"No offerings were pitched or clicked in this period."})]})}const slt=[{value:1,label:"Last 24 hours"},{value:7,label:"Last 7 days"},{value:30,label:"Last 30 days"},{value:90,label:"Last 90 days"},{value:365,label:"Last 12 months"},{value:0,label:"All time"}];function nlt(e){return e?`${e.charAt(0).toUpperCase()}${e.slice(1)}`:"Free"}function rlt(){const{userId:e=""}=Ef(),t=an(),[n]=f.useState(()=>t.state?.user||null),[r,a]=f.useState(()=>Number(t.state?.days??30)),[i,o]=f.useState(()=>n?{analytics_available:null,user:n,engagement_trend:[]}:null),[l,c]=f.useState(""),[u,d]=f.useState(!0),[h,p]=f.useState(null),[m,g]=f.useState(0),[x,b]=f.useState(null),[y,v]=f.useState(""),[w,j]=f.useState(null),[E,S]=f.useState(!0);f.useEffect(()=>{let O=!0;return VY({userId:decodeURIComponent(e),days:r}).then(U=>{O&&j(U)}).catch(U=>{O&&c(U.message||"Failed to load usage insights.")}).finally(()=>{O&&S(!1)}),()=>{O=!1}},[r,e]),f.useEffect(()=>{const O=decodeURIComponent(e);let U=!0;return K4([O]).then(F=>{U&&p(F[O]||null)}
1384).catch(F=>{U&&c(F.message||"Failed to load subscription.")}),()=>{U=!1}},[m,e]),f.useEffect(()=>{let O=!0;return WY({userId:decodeURIComponent(e),days:r,hint:n}).then(U=>{O&&o(U)}).catch(U=>{O&&c(U.message||"Failed to load this userâs analytics.")}).finally(()=>{O&&d(!1)}),()=>{O=!1}},[r,n,e]);const _=i?.user||n,k=Yot(_),[C,N]=f.useState(void 0),A=_?.email||_?.username||"";f.useEffect(()=>{if(!A)return;const O=decodeURIComponent(e);let U=!0;return M_({search:A,days:0,limit:20}).then(F=>{U&&N((F?.users||[]).find(H=>H.id===O)||null)}).catch(()=>{U&&N(null)}),()=>{U=!1}},[A,e]);const T=_?[{label:"Conversations",value:_.conversations_count,icon:ni},{label:"Messages",value:_.messages_count,icon:$u},{label:"Leads",value:_.leads_count,icon:TY},{label:"Contacts",value:_.contacts_count,icon:qr},{label:"Experts",value:_.experts_count,icon:Ms},{label:"Profile readiness",value:_.profile_completion,suffix:"%",icon:QM}]:[],I=_?{conversations:_.conversations_count,leads:_.leads_count,contacts:_.contacts_count}:{},$=_?[{label:"Joined",value:mx(_.created_at),icon:Ex},{label:"Public experts",value:uc(_.public_experts_count),icon:Ms},{label:"Knowledge sources",value:uc(_.knowledge_sources_count),icon:Ci},{label:"Last active",value:mx(_.last_active_at),icon:ah}]:[];return!_&&!u?s.jsxs("div",{className:"internal-page internal-user-analytics-page",children:[s.jsx(vs,{title:"Internal · User analytics",path:`${Me.INTERNAL_USERS}/${encodeURIComponent(e)}`,noIndex:!0}),s.jsxs(Le,{to:Me.INTERNAL_USERS,className:"internal-user-detail-back",children:[s.jsx(ja,{"aria-hidden":"true"}),"All users"]}),s.jsx(_a,{message:l||"This user could not be found.",className:"internal-alert"})]}):s.jsxs("div",{className:"internal-page internal-user-analytics-page",children:[s.jsx(vs,{title:`Internal · ${k}`,path:`${Me.INTERNAL_USERS}/${encodeURIComponent(e)}`,noIndex:!0}),s.jsxs("div",{className:"internal-user-detail-toolbar",children:[s.jsxs(Le,{to:Me.INTERNAL_USERS,className:"internal-user-detail-back",children:[s.jsx(ja,{"aria-hidden":"true"}),"All users"]}),s.jsxs("label",{className:"internal-select-wrap internal-user-detail-period",children:[s.jsx("span",{className:"sr-only",children:"Reporting period"}),s.jsx(Ex,{"aria-hidden":"true"}),s.jsx("select",{value:r,disabled:i?.analytics_available===!1,onChange:O=>{d(!0),c(""),a(Number(O.target.value))},children:slt.map(O=>s.jsx("option",{value:O.value,children:O.label},O.value))}),s.jsx(Is,{"aria-hidden":"true"})]})]}),l?s.jsx(_a,{message:l,className:"internal-alert"}):null,y?s.jsxs("p",{className:"internal-users-data-note",role:"status",children:[y," ",s.jsx("button",{type:"button",className:"internal-link-button",onClick:()=>v(""),children:"Dismiss"})]}):null,s.jsxs("section",{className:"internal-user-hero","aria-labelledby":"internal-user-name",children:[s.jsxs("div",{className:"internal-user-hero__copy",children:[s.jsx("p",{className:"internal-user-hero__eyebrow",children:"User analytics"}),s.jsx("h1",{className:"internal-page__title",id:"internal-user-name",children:k}),s.jsx("p",{className:"internal-user-hero__handle",children:_?.username?`@${_.username}`:"No public handle"}),s.jsxs("div",{className:"internal-user-hero__meta",children:[s.jsxs("span",{children:[s.jsx(qr,{"aria-hidden":"true"}),_?.email||"No email available"]}),s.jsxs("span",{children:[s.jsx(ah,{"aria-hidden":"true"}),"Last active ",mx(_?.last_active_at)]})]}),_?.username?s.jsxs(Le,{to:`/${_.username}`,target:"_blank",rel:"noreferrer",className:"internal-text-action",children:["View public profile ",s.jsx(Ro,{"aria-hidden":"true"})]}):null]}),s.jsx("div",{className:"internal-user-hero__avatar-frame",children:s.jsx(ws,{name:k,src:_?.profile_avatar_url,size:"3xl",className:"internal-user-hero__avatar"})})]}),s.jsx("section",{className:"internal-surface internal-users-metrics internal-user-detail-metrics","aria-label":`${k} analytics summary`,"aria-busy":u,children:T.map(O=>s.jsx(jie,{...O},O.label))}),i?.analytics_available===!1?s.jsx("p",{className:"internal-users-data-note",role:"status",children:"This environment has not received the single-user analytics migration yet. The user snapshot is available, while period controls and engagement history remain paused."}):null,s.jsxs("div",{className:"internal-users-analytics-grid internal-user-detail-analytics-grid",children:[s.jsx(Jot,{points:i?.engagement_trend||[],titleId:"internal-user-engagement-title"}),s.jsx(Qot,{summary:I,titleId:"internal-user-audience-flow-title"})]}),s.jsx(tlt,{usage:w,loading:E}),s.jsxs("section",{className:"internal-surface internal-user-account","aria-labelledby":"internal-user-profile-title",children:[s.jsx("h2",{className:"internal-section-title",id:"internal-user-profile-title",children:"Profile readiness"}),s.jsx("p",{className:"internal-section-note",children:"What this user has added to their public profile."}),C?s.jsx(xie,{user:C,label:`Profile readiness for ${k}`}):s.jsx("p",{className:"internal-section-note",children:C===void 0?"Loading profileâ¦":"Profile details are not available for this account."})]}),s.jsxs("section",{className:"internal-surface internal-user-account","aria-labelledby":"internal-user-account-title",children:[s.jsx("h2",{className:"internal-section-title",id:"internal-user-account-title",children:"Account details"}),s.jsx("dl",{className:"internal-user-account__facts",children:$.map(({label:O,value:U,icon:F})=>s.jsxs("div",{children:[s.jsxs("dt",{children:[s.jsx(F,{"aria-hidden":"true"}),O]}),s.jsx("dd",{children:U})]},O))})]}),s.jsxs("section",{className:"internal-surface internal-user-account internal-user-subscription","aria-labelledby":"internal-user-subscription-title",children:[s.jsxs("div",{className:"internal-users-panel-heading",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"internal-section-title",id:"internal-user-subscription-title",children:"Subscription"}),s.jsx("p",{className:"internal-section-note",children:"Comp, extend, or end this account's plan. Changes apply immediately."})]}),s.jsxs("div",{className:"internal-user-subscription__actions",children:[s.jsxs("button",{type:"button",className:"internal-primary-action",onClick:()=>b("grant"),children:[s.jsx(BT,{"aria-hidden":"true"}),"Change subscription"]}),h?s.jsxs("button",{type:"button",className:"internal-danger-action",onClick:()=>b("expire"),children:[s.jsx(z0e,{"aria-hidden":"true"}),"Expire now"]}):null]})]}),s.jsxs("dl",{className:"internal-user-account__facts",children:[s.jsxs("div",{children:[s.jsxs("dt",{children:[s.jsx(QM,{"aria-hidden":"true"}),"Plan"]}),s.jsx("dd",{children:s.jsx(vie,{sub:h,expired:_?.subscription_status==="expired"})})]}),s.jsxs("div",{children:[s.jsxs("dt",{children:[s.jsx(Ex,{"aria-hidden":"true"}),"Access until"]}),s.jsx("dd",{children:h?.ends_at?mx(h.ends_at):"No active subscription"})]}),s.jsxs("div",{children:[s.jsxs("dt",{children:[s.jsx(ah,{"aria-hidden":"true"}),"Status"]}),s.jsx("dd",{children:h?`${nlt(h.status)}${h.is_local?", comped (no Stripe)":", via Stripe"}`:_?.subscription_status==="expired"?"Expired":"Never subscribed"})]})]})]}),x&&_?s.jsx(Lot,{mode:x,users:[_],onClose:()=>b(null),onDone:O=>{b(null),v(O),g(U=>U+1)}}):null]})}function alt(e){return Array.isArray(e?.templates)?e.templates.map(t=>({...t,thumbnail:t.thumbnail||"",design:t.design&&typeof t.design=="object"?t.design:{},designText:JSON.stringify(t.design||{},null,2)})):[]}function ilt({preset:e}){return e.kind==="custom"?s.jsxs("div",{className:"ce-tpl-custom-preview","aria-hidden":"true",children:[s.jsxs("div",{className:"ce-tpl-custom-atmosphere",children:[s.jsx("span",{className:"ce-tpl-custom-cloud ce-tpl-custom-cloud--peach"}),s.jsx("span",{className:"ce-tpl-custom-cloud ce-tpl-custom-cloud--violet"}),s.jsx("span",{className:"ce-tpl-custom-cloud ce-tpl-custom-cloud--iris"}),s.jsx("span",{className:"ce-tpl-custom-cloud ce-tpl-custom-cloud--tide-a"}),s.jsx("span",{className:"ce-tpl-custom-cloud ce-tpl-custom-cloud--tide-b"}),s.jsx("span",{className:"ce-tpl-custom-cloud ce-tpl-custom-cloud--tide-c"})]}),s.jsx("div",{className:"ce-tpl-custom-avatar",children:s.jsx(Es,{size:24,strokeWidth:1.7})}),s.jsx("strong",{children:e.label}),s.jsx("p",{children:"Build your profile from scratch"})]}):e.thumbnail?s.jsx("img",{src:e.thumbnail,alt:"",draggable:"false"}):s.jsx("div",{className:"internal-preset-preview__fallback",children:s.jsx("span",{children:"No thumbnail"})})}function olt({preset:e,index:t,busy:n,dragging:r,onDragStart:a,onDragEnter:i,onDragEnd:o,onToggleIncluded:l,onPreview:c,onOpenSettings:u}){return s.jsxs(Dn.article,{layout:"position",animate:{scale:r?1.015:1},transition:{layout:{duration:.16,ease:[.22,1,.36,1]},scale:{duration:.12,ease:"easeOut"}},className:"internal-preset-card","data-enabled":e.enabled,"data-dragging":r,draggable:!n,title:"Drag card to reorder",onDragStart:d=>a(d,e.id),onDragEnter:()=>i(e.id),onDragOver:d=>{d.preventDefault(),d.dataTransfer.dropEffect="move"},onDrop:d=>{d.preventDefault()},onDragEnd:o,children:[s.jsxs("div",{className:"internal-preset-preview",children:[s.jsxs("button",{type:"button",className:"internal-preset-preview__button",onClick:()=>c(e.id),disabled:n||!e.enabled,"aria-label":`Preview ${e.label} in the profile creation journey`,children:[s.jsx(ilt,{preset:e}),s.jsxs("span",{className:"internal-preset-preview__action","aria-hidden":"true",children:[s.jsx(Sh,{})," Preview"]})]}),s.jsx("span",{className:"internal-preset-position","aria-label":`Position ${t+1}`,children:t+1}),s.jsx("button",{type:"button",className:"internal-preset-inclusion","data-included":e.enabled,"aria-pressed":e.enabled,"aria-label":`${e.enabled?"Exclude":"Include"} ${e.label} ${e.enabled?"from":"in"} the journey`,title:e.enabled?"Included in journey":"Not included in journey",onClick:()=>l(e),disabled:n,children:s.jsx(ft,{"aria-hidden":"true"})})]}),s.jsxs("div",{className:"internal-preset-card__caption",children:[s.jsxs("h2",{children:[e.label,e.isLocal?s.jsx("small",{className:"internal-preset-local-badge",children:"Local"}):null]}),s.jsx("button",{type:"button",className:"internal-preset-card__settings",onClick:()=>u(e),disabled:n,"aria-label":`Open advanced settings for ${e.label}`,title:"Advanced settings",children:s.jsx(EY,{strokeWidth:2.5,"aria-hidden":"true"})})]})]})}function llt({thumbnail:e}){const[t,n]=f.useState(!1);return!e||t?s.jsxs("div",{className:"internal-preset-image-picker__placeholder",children:[s.jsx(b0,{"aria-hidden":"true"}),s.jsx("span",{children:"No image"})]}):s.jsx("img",{src:e,alt:"",onError:()=>n(!0)})}function clt({preset:e,busy:t,imageUploading:n,imageError:r,saveError:a,onChange:i,onImageUpload:o,onSave:l,onDelete:c,onClose:u}){const d=f.useRef(null),h=t||n;return s.jsxs(hL,{className:"internal-preset-dialog",labelledBy:"internal-preset-dialog-title",onClose:u,children:[s.jsxs("div",{className:"internal-preset-dialog__header",children:[s.jsxs("div",{children:[s.jsx("h2",{id:"internal-preset-dialog-title",children:e.isNew?"Add template":"Advanced settings"}),s.jsx("p",{children:e.isNew?"Start with a name, card image, and design JSON. No profile link needed.":e.label}),ac&&(e.isNew||e.isLocal)?s.jsx("p",{children:"Saved only in this browser. Shared presets are not changed."}):null]}),s.jsx("button",{type:"button",className:"internal-icon-button",onClick:u,disabled:h,"aria-label":"Close template editor",children:s.jsx(as,{"aria-hidden":"true"})})]}),s.jsxs("div",{className:"internal-preset-dialog__content",children:[a?s.jsx("div",{role:"alert",children:s.jsx(_a,{message:a})}
1384):null,s.jsxs("div",{className:"internal-preset-editor","data-has-card-image":e.kind!=="custom",children:[e.kind!=="custom"?s.jsxs("div",{className:"internal-preset-image-editor",children:[s.jsx("span",{className:"internal-preset-image-editor__label",children:"Card image"}),s.jsxs("button",{type:"button",className:"internal-preset-image-picker__preview","data-uploading":n,onClick:()=>d.current?.click(),disabled:h,"aria-label":e.thumbnail?"Change card image":"Choose card image",children:[s.jsx(llt,{thumbnail:e.thumbnail},e.thumbnail||"empty"),s.jsx("span",{className:"internal-preset-image-picker__edit","aria-hidden":"true",children:n?s.jsx(vt,{className:"animate-spin"}):s.jsx(Mu,{})})]}),s.jsx("p",{className:"internal-preset-image-editor__help",children:"Maximum 5 MB"}),s.jsx("input",{ref:d,type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",onChange:p=>{const m=p.target.files?.[0];p.target.value="",m&&o(m)},disabled:h}),r?s.jsx("p",{className:"internal-preset-image-error",role:"alert",children:r}):null]}):null,s.jsxs("div",{className:"internal-preset-editor__controls",children:[s.jsxs("div",{className:"internal-preset-fields",children:[s.jsxs("label",{className:"internal-tool-label",children:[s.jsx("span",{children:"Name"}),s.jsx("input",{className:"internal-control",value:e.label,maxLength:80,autoFocus:e.isNew,placeholder:"Template name",onChange:p=>i({label:p.target.value}),disabled:h})]}),e.kind!=="custom"?s.jsxs("label",{className:"internal-tool-label",children:[s.jsx("span",{children:"Image URL"}),s.jsx("input",{className:"internal-control",value:e.thumbnail,onChange:p=>i({thumbnail:p.target.value}),placeholder:"https://⦠or /create-expert/â¦",disabled:h})]}):null]}),e.kind!=="custom"?s.jsxs("details",{className:"internal-preset-design-details",open:!0,children:[s.jsx("summary",{children:"JSON"}),s.jsxs("label",{children:[s.jsx("span",{className:"sr-only",children:"JSON"}),s.jsx("textarea",{className:"internal-control internal-preset-json",value:e.designText,onChange:p=>i({designText:p.target.value}),spellCheck:!1,disabled:h})]})]}):null,e.sourceProfile?s.jsxs("a",{className:"internal-text-action",href:e.sourceProfile,target:"_blank",rel:"noreferrer",children:[s.jsx(Ro,{"aria-hidden":"true"})," Open source profile"]}):null]})]})]}),s.jsxs("div",{className:"internal-preset-dialog__footer",children:[!e.isSystem&&!e.isNew?s.jsxs("button",{type:"button",className:"internal-danger-action",onClick:c,disabled:h,children:[s.jsx(Qs,{"aria-hidden":"true"})," Delete preset"]}):s.jsx("span",{}),s.jsxs("div",{children:[s.jsx("button",{type:"button",className:"internal-secondary-action",onClick:u,disabled:h,children:"Cancel"}),s.jsx("button",{type:"button",className:"internal-primary-action",onClick:l,disabled:h,children:t?"Savingâ¦":e.isNew?"Create template":"Save"})]})]})]})}function ult({templates:e,defaultId:t,initialId:n,onClose:r}){const[a,i]=f.useState(n||t);return s.jsxs(hL,{className:"internal-journey-preview-dialog",labelledBy:"internal-journey-preview-title",onClose:r,children:[s.jsxs("div",{className:"internal-journey-preview-bar",children:[s.jsxs("div",{children:[s.jsx("strong",{id:"internal-journey-preview-title",children:"Journey preview"}),s.jsx("span",{children:"Nothing is saved here."})]}),s.jsxs("button",{type:"button",className:"internal-secondary-action",onClick:r,children:[s.jsx(as,{"aria-hidden":"true"})," Close preview"]})]}),s.jsx("div",{className:"internal-journey-preview-stage",children:s.jsx(zk,{templates:e,defaultId:t,selectedId:a,ready:!0,onSelect:o=>i(o.id),onBack:r,onContinue:r,onSkip:r})})]})}function dlt(){const[e,t]=f.useState([]),[n,r]=f.useState("loading"),[a,i]=f.useState(""),[o,l]=f.useState(""),[c,u]=f.useState(""),[d,h]=f.useState(""),[p,m]=f.useState(""),[g,x]=f.useState(null),[b,y]=f.useState(!1),[v,w]=f.useState(""),[j,E]=f.useState(""),[S,_]=f.useState(""),[k,C]=f.useState(""),[N,A]=f.useState(!1),T=f.useRef([]),I=f.useRef(""),$=f.useRef([]),O=f.useRef(""),U=f.useRef(!1),F=Y=>{const J=alt(Y);T.current=J,t(J)},H=f.useMemo(()=>e.filter(({enabled:Y})=>Y),[e]),G=H[0]?.id||"";f.useEffect(()=>{let Y=!0;return b_e().then(J=>{Y&&(F(J),r("ready"))}).catch(J=>{Y&&(l(J.message||"Failed to load profile presets."),r("error"))}),()=>{Y=!1}},[]),f.useEffect(()=>{if(!c)return;const Y=window.setTimeout(()=>u(""),5e3);return()=>window.clearTimeout(Y)},[c]);const M=(Y=G)=>{const J=H.some(P=>P.id===Y)?Y:G;J&&(C(J),A(!0))},z=async(Y,J)=>{T.current=Y,t(Y),i("order"),l(""),u("");try{F(await v_e(Y.map(({id:P})=>P))),u(ac?"Order saved locally for this browserâs journey preview.":"Order saved. The journey now uses this
1384sequence.")}catch(P){T.current=J,t(J),l(P.message||"Failed to reorder presets.")}finally{i("")}},W=(Y,J)=>{Y.dataTransfer.effectAllowed="move",Y.dataTransfer.setData("text/plain",J);const P=document.createElement("span");P.setAttribute("aria-hidden","true"),Object.assign(P.style,{position:"fixed",inset:"0 auto auto 0",width:"1px",height:"1px",opacity:"0",pointerEvents:"none"}),document.body.appendChild(P),Y.dataTransfer.setDragImage(P,0,0),requestAnimationFrame(()=>P.remove()),I.current=J,$.current=T.current,O.current=J,U.current=!1,_(J)},D=Y=>{const J=I.current;!J||J===Y||O.current===Y||(O.current=Y,t(P=>{const ee=P.findIndex(({id:q})=>q===J),X=P.findIndex(({id:q})=>q===Y);if(ee<0||X<0||ee===X)return P;const ae=[...P],[me]=ae.splice(ee,1);return ae.splice(X,0,me),T.current=ae,U.current=!0,ae}))},Z=()=>{const Y=$.current,J=T.current,P=U.current&&Y.map(({id:ee})=>ee).join("|")!==J.map(({id:ee})=>ee).join("|");I.current="",$.current=[],O.current="",U.current=!1,_(""),P&&z(J,Y)},V=async Y=>{const J=!Y.enabled;i(Y.id),l(""),u("");try{F(await hD({...Y,enabled:J,isDefault:J?Y.isDefault:!1})),u(`${Y.label} ${J?"included in":"removed from"} ${Y.isLocal?"the local journey preview":"the journey"}.`)}catch(P){l(P.message||"Failed to update journey inclusion.")}finally{i("")}},L=async Y=>{if(!["image/png","image/jpeg","image/webp"].includes(Y.type)){w("Choose a PNG, JPEG, or WebP image.");return}if(Y.size>5*1024*1024){w("Card images must be 5 MB or smaller.");return}y(!0),w("");try{if(ac&&(g?.isNew||g?.isLocal)){const ee=await bI(Y,{maxDimension:1200,compressAbove:204800}),X=await new Promise((ae,me)=>{const q=new FileReader;q.onload=()=>ae(q.result),q.onerror=()=>me(new Error("Could not read the card image.")),q.readAsDataURL(ee)});x(ae=>ae&&{...ae,thumbnail:X});return}const J=await aR(Y),P=J?.url||J?.data?.url;if(!P)throw new Error("Upload did not return an image URL.");x(ee=>ee&&{...ee,thumbnail:P})}catch(J){w(J.response?.data?.detail?.message||J.message||"Could not upload the card image.")}finally{y(!1)}},K=async()=>{if(!(!g||a||b)){i(g.id),E(""),l(""),u("");try{const Y=g.label.trim();if(!Y||Y.length>80)throw new Error("Preset names must be between 1 and 80 characters.");const J=g.kind==="custom"?{}:JSON.parse(g.designText);if(!J||typeof J!="object"||Array.isArray(J))throw new Error("JSON must be an object.");if(new TextEncoder().encode(JSON.stringify(J)).length>5e4)throw new Error("Design JSON must be an object smaller than 50 KB.");const P=g.isNew?y_e:hD;F(await P({...g,label:Y,design:J})),u(`${Y} ${ac&&(g.isNew||g.isLocal)?"saved locally in this browser":g.isNew?"created and added to the journey":"saved"}.`),x(null)}catch(Y){E(Y instanceof SyntaxError?"JSON is not valid.":Y.message)}finally{i("")}}},te=async Y=>{if(Y.preventDefault(),!!d.trim()){i("import"),l(""),u("");try{const J=await w_e(d.trim(),p.trim());F(J),h(""),m(""),u(J.screenshotCaptured?"Profile look and screenshot imported and added to the end.":"Profile look imported with its existing image; automatic screenshot was unavailable.")}catch(J){l(J.message||"Failed to import that profile.")}finally{i("")}}},Q=async()=>{if(g&&window.confirm(`Delete â${g.label}â? This cannot be undone.`)){i(g.id),l(""),u("");try{F(await j_e(g.id)),x(null),u("Preset deleted.")}catch(Y){E(Y.message||"Failed to delete that preset.")}finally{i("")}}};return n==="loading"?s.jsx(il,{fullPage:!0,text:"Loading profile presetsâ¦"}):s.jsxs("div",{className:"internal-page internal-presets-page",children:[s.jsx(vs,{title:"Internal · Profile presets",path:Me.INTERNAL_PROFILE_PRESETS,noIndex:!0}),s.jsxs("header",{className:"internal-presets-header",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"internal-page__title",children:"Profile presets"}),s.jsx("p",{className:"internal-page__description",children:"Drag cards into journey order. The first included card is selected by default."})]}),s.jsxs("button",{type:"button",className:"internal-secondary-action internal-preview-action",onClick:()=>M(),disabled:!!a||H.length===0,children:[s.jsx(Sh,{"aria-hidden":"true"})," Preview journey"]})]}),s.jsxs("section",{className:"internal-surface internal-preset-import",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"internal-section-title",children:"Import from a profile"}),s.jsx("p",{className:"internal-section-note",children:"Paste a public profile URL or handle to add its visual style and capture its card image."})]}),s.jsxs("form",{onSubmit:te,className:"internal-preset-import__form",children:[s.jsxs("label",{className:"internal-tool-label",children:[s.jsx("span",{children:"Profile link or handle"}),s.jsx("input",{className:"internal-control",value:d,onChange:Y=>h(Y.target.value),placeholder:"https://greatexperts.ai/profile-handle",disabled:!!a})]}),s.jsxs("label",{className:"internal-tool-label",children:[s.jsxs("span",{children:["Preset name ",s.jsx("small",{children:"optional"})]}),s.jsx("input",{className:"internal-control",value:p,maxLength:80,onChange:Y=>m(Y.target.value),placeholder:"Uses profile name when empty",disabled:!!a})]}),s.jsxs("button",{type:"submit",className:"internal-primary-action",disabled:!!a||!d.trim(),children:[a==="import"?s.jsx(vt,{className:"animate-spin","aria-hidden":"true"}):s.jsx(Es,{"aria-hidden":"true"}),"Add preset"]})]})]}),o?s.jsx(_a,{message:o,className:"internal-alert"}):null,c?s.jsxs("p",{className:"internal-preset-notice",role:"status",children:[s.jsx("span",{className:"internal-preset-notice__icon","aria-hidden":"true",children:s.jsx(ft,{})}),s.jsx("span",{children:c})]}):null,n==="error"?null:s.jsxs("section",{className:"internal-preset-list","aria-label":"Profile presets",children:[s.jsxs("button",{type:"button",className:"internal-preset-add",disabled:!!a,onClick:()=>{w(""),E(""),x({id:"new-template",isNew:!0,kind:"preset",label:"",thumbnail:"",designText:"{}"})},children:[s.jsx("span",{className:"internal-preset-add__icon",children:s.jsx(Es,{"aria-hidden":"true"})}),s.jsx("strong",{children:"Add template"}),s.jsx("span",{children:"Start from scratch"})]}),e.map((Y,J)=>s.jsx(olt,{preset:Y,index:J,busy:!!a,dragging:S===Y.id,onDragStart:W,onDragEnter:D,onDragEnd:Z,onToggleIncluded:V,onPreview:M,onOpenSettings:P=>{w(""),E(""),x({...P})}},Y.id))]}),g?s.jsx(clt,{preset:g,busy:!!a,imageUploading:b,imageError:v,saveError:j,onChange:Y=>x(J=>({...J,...Y})),onImageUpload:L,onSave:K,onDelete:Q,onClose:()=>{!a&&!b&&x(null)}}):null,N?s.jsx(ult,{templates:H,defaultId:G,initialId:k,onClose:()=>A(!1)}):null]})}function hlt(e){const t=window.location.origin,n=/^https?:\/\//.test(Hr)?` api-base="${Hr}"`:"";return`<great-experts-chat widget-key="${e}"${n}></great-experts-chat> 1385<script async src="${t}/widget/widget.js"><\/script>`}function plt(){const[e]=gl(),t=e.get("kind")==="subscription",n=e.get("kind")==="creator_subscription",r=e.get("kind")==="creator_unlimited",a=n||r,i=e.get("expert_id"),o=e.get("session_id"),{refreshBalance:l,balance:c,updateBalance:u}=Ut(),[d]=f.useState(c?.answers??null),[h,p]=f.useState(!t&&!a),[m,g]=f.useState(null),[x,b]=f.useState(t&&!o?"active":"confirming"),[y,v]=f.useState(a&&!o?"active":"confirming"),[w,j]=f.useState(null),[E,S]=f.useState(null),[_,k]=f.useState(!1),C=f.useRef(!1),N=async()=>
1385{if(C.current)return;C.current=!0;let T=null;try{T=JSON.parse(sessionStorage.getItem("pending_embed")||"null")}catch{T=null}if(T?.expertId){if(sessionStorage.removeItem("pending_embed"),!T.domain){S("Your plan is active â add your website from the expert's Embed settings.");return}try{const $=(await x0(T.expertId,T.domain))?.data?.key_id;$?j(hlt($)):S("Your plan is active â finish your embed from the expert's Embed settings.")}catch{S("Your plan is active â finish your embed from the expert's Embed settings.")}}},A=async()=>{try{await navigator.clipboard.writeText(w),k(!0),setTimeout(()=>k(!1),2e3)}catch{}};return f.useEffect(()=>{if(t||a)return;let T=!1,I=0;const $=async()=>{I+=1;let O=null,U=!1;if(o)try{O=(await Hrt(o)).data.balance,O&&u(O),U=!0}catch{O=await l()}else O=await l();if(T)return;const F=O&&typeof d=="number"&&O.answers>d;if(U||!o||F){p(!1);return}I<6?setTimeout($,I===1?800:2e3):p(!1)};return $(),()=>{T=!0}},[d,l,o,u,t,a]),f.useEffect(()=>{r&&Promise.resolve().then(N)},[r]),f.useEffect(()=>{if(!n||!o)return;let T=!1,I=0;const $=async()=>{I+=1;try{const O=await yJ(o);if(T)return;if(O.status==="success"){v("active"),N();return}I<5?setTimeout($,I===1?1e3:2500):v("activating")}catch{if(T)return;I<5?setTimeout($,I===1?1e3:2500):v("activating")}};return $(),()=>{T=!0}},[n,o]),f.useEffect(()=>{if(!t||!i)return;let T=!1;return FT(i).then(I=>{T||g(I.data.expert)}).catch(()=>{}),()=>{T=!0}},[t,i]),f.useEffect(()=>{if(!t||!o)return;let T=!1,I=0;const $=async()=>{I+=1;try{await Jae(o),T||b("active");return}catch{if(T)return;I<5?setTimeout($,I===1?1e3:2500):b("activating")}};return $(),()=>{T=!0}},[t,o]),s.jsx("div",{className:"min-h-[calc(100dvh-8rem)] flex items-center justify-center px-4 py-16",children:s.jsxs("div",{className:"w-full max-w-md text-center",children:[s.jsx("div",{className:"flex justify-center mb-5",children:s.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-full bg-indigo-wash border border-indigo-tint text-indigo-deep",children:s.jsx(pc,{className:"w-7 h-7"})})}),a?s.jsxs(s.Fragment,{children:[!r&&y==="confirming"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"block font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:"FINALIZING PLAN"}),s.jsx("h1",{className:"font-heading text-2xl font-medium text-ink tracking-tight mt-2",children:"Almost there"}),s.jsx("p",{className:"mt-3 text-ink-mid",children:"We're activating your plan â your 7-day free trial is starting."}),s.jsxs("div",{className:"mt-8 inline-flex items-center gap-2 px-6 py-3 rounded-md bg-ink border border-ink text-sm font-medium text-cream",children:[s.jsx(vt,{className:"w-4 h-4 animate-spin"})," Confirming with Stripeâ¦"]})]}),y!=="confirming"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"block font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:r?"TEAM · UNLIMITED":y==="active"?"TRIAL STARTED":"PAYMENT METHOD SAVED"}),s.jsx("h1",{className:"font-heading text-2xl font-medium text-ink tracking-tight mt-2",children:r?"Your embed is active":y==="active"?"Your plan is active":"Your plan is activating"}),s.jsxs("p",{className:"mt-3 text-ink-mid",children:[r?"Full Pro embedding is included with your team accessâno trial or payment method is attached.":"Your 7-day free trial has started â you won't be charged until it ends, and you can cancel anytime.",!w&&" Add your embed from any expertâs page."]}),w&&s.jsxs("div",{className:"mt-6 max-w-lg mx-auto text-left",children:[s.jsx("p",{className:"text-sm font-medium text-ink mb-2",children:"Your expert is ready to embed â paste this where you want the chat:"}),s.jsxs("div",{className:"relative",children:[s.jsx("pre",{className:"text-[11px] leading-relaxed bg-ink text-cream rounded-lg p-4 pr-12 overflow-x-auto whitespace-pre-wrap break-all",children:w}),s.jsx("button",{type:"button",onClick:A,"aria-label":"Copy snippet",className:"absolute top-2.5 right-2.5 w-8 h-8 rounded-lg grid place-items-center bg-white/10 text-cream hover:bg-white/20 transition-colors",children:_?s.jsx(ft,{className:"w-4 h-4 text-green-400"}):s.jsx(ju,{className:"w-4 h-4"})})]})]}),E&&s.jsx("p",{className:"mt-4 text-sm text-amber-600",children:E}),s.jsxs("div",{className:"mt-8 flex flex-col sm:flex-row items-center justify-center gap-3",children:[s.jsx(Le,{to:"/experts",className:"inline-flex items-center gap-2 px-6 py-3.5 rounded-md text-sm font-medium bg-indigo text-cream hover:bg-indigo-deep transition-colors duration-300 ease-standard",children:"Go to My experts"}),!w&&s.jsx(Le,{to:"/profile",className:"inline-flex items-center gap-2 px-6 py-3.5 rounded-md text-sm font-medium bg-indigo-wash text-indigo-deep border border-indigo hover:bg-indigo hover:text-cream transition-colors duration-300 ease-standard",children:"Set your domain"})]})]})]}):t?s.jsxs(s.Fragment,{children:[x==="confirming"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"block font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:"FINALIZING SUBSCRIPTION"}),s.jsx("h1",{className:"font-heading text-2xl font-medium text-ink tracking-tight mt-2",children:"Almost there"}),s.jsx("p",{className:"mt-3 text-ink-mid",children:"Your payment went through â we're activating your subscription now."}
1385),s.jsxs("div",{className:"mt-8 inline-flex items-center gap-2 px-6 py-3 rounded-md bg-ink border border-ink text-sm font-medium text-cream",children:[s.jsx(vt,{className:"w-4 h-4 animate-spin"}),"Confirming with Stripeâ¦"]})]}),x==="active"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"block font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:"SUBSCRIPTION ACTIVE"}),s.jsxs("h1",{className:"font-heading text-2xl font-medium text-ink tracking-tight mt-2",children:["You're subscribed",m?.name?s.jsxs(s.Fragment,{children:[" to ",s.jsx("em",{className:"font-display italic text-indigo",children:m.name})]}):""]}),s.jsx("p",{className:"mt-3 text-ink-mid",children:"You now have unlimited 1-on-1 chat with this expert for the next 30 days. It renews automatically each month until you cancel, and Stripe will email you a receipt for every renewal."})]}),x==="activating"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"block font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:"PAYMENT RECEIVED"}),s.jsx("h1",{className:"font-heading text-2xl font-medium text-ink tracking-tight mt-2",children:"Your subscription is activating"}),s.jsxs("p",{className:"mt-3 text-ink-mid",children:["Your payment went through and your subscription",m?.name?s.jsxs(s.Fragment,{children:[" to ",s.jsx("em",{className:"font-display italic text-indigo",children:m.name})]}):""," ","is being set up. This can take a minute or two â it will appear under Manage subscriptions shortly."]})]}),x!=="confirming"&&s.jsxs("div",{className:"mt-8 flex flex-col sm:flex-row items-center justify-center gap-3",children:[i&&s.jsx(Le,{to:`/experts/${i}/chat`,className:"inline-flex items-center gap-2 px-6 py-3.5 rounded-md text-sm font-medium bg-indigo text-cream hover:bg-indigo-deep transition-colors duration-300 ease-standard",children:"Chat now"}),s.jsx(Le,{to:"/myaccount/subscriptions",className:"inline-flex items-center gap-2 px-6 py-3.5 rounded-md text-sm font-medium bg-indigo-wash text-indigo-deep border border-indigo hover:bg-indigo hover:text-cream transition-colors duration-300 ease-standard",children:"Manage subscriptions"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"block font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:"PURCHASE COMPLETE"}),s.jsx("h1",{className:"font-heading text-2xl font-medium text-ink tracking-tight mt-2",children:"Thanks for your purchase"}),s.jsx("p",{className:"mt-3 text-ink-mid",children:"Your answers will be available on your account in a moment. Stripe will email you a receipt."}),s.jsx("div",{className:"mt-8 inline-flex items-center gap-2 px-6 py-3 rounded-md bg-ink border border-ink text-sm font-medium text-cream",children:h?s.jsxs(s.Fragment,{children:[s.jsx(vt,{className:"w-4 h-4 animate-spin"}),"Confirming with Stripeâ¦"]}):s.jsxs("span",{children:[c?c.answers:"â"," answers on your account"]})}),s.jsx("div",{className:"mt-8 flex justify-center",children:s.jsx(Le,{to:"/dashboard",className:"inline-flex items-center gap-2 px-6 py-3.5 rounded-md text-sm font-medium bg-indigo-wash text-indigo-deep border border-indigo hover:bg-indigo hover:text-cream transition-colors duration-300 ease-standard",children:"Back to dashboard"})})]})]})})}function mlt(){return s.jsxs("div",{className:"max-w-md mx-auto px-4 py-16 text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-full bg-cream-deep border border-rule text-ink-mid mb-5",children:s.jsx(zT,{className:"w-7 h-7"})}),s.jsx("span",{className:"font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:"CHECKOUT CANCELED"}),s.jsx("h1",{className:"font-heading text-2xl font-medium text-ink tracking-tight mt-2",children:"No charge was made"}),s.jsx("p",{className:"mt-3 text-ink-mid",children:"You can pick a pack any time."}),s.jsxs("div",{className:"mt-8 flex items-center justify-center gap-3",children:[s.jsx(Le,{to:"/pricing?for=users",className:"inline-flex items-center justify-center px-5 py-2.5 rounded-pill text-sm font-medium bg-indigo text-cream hover:bg-indigo-deep transition-colors",children:"Back to pricing"}),s.jsx(Le,{to:"/dashboard",className:"inline-flex items-center justify-center px-5 py-2.5 rounded-pill text-sm font-medium text-ink-mid hover:bg-cream-deep hover:text-ink transition-colors",children:"Dashboard"})]})]})}function flt(){return s.jsx("div",{className:"min-h-screen bg-cream flex items-center justify-center px-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-cream-deep border border-rule rounded-md mb-5",children:s.jsx(Jye,{className:"w-8 h-8 text-ink-light"})}),s.jsx("span",{className:"font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:"PAGE NOT FOUND"}),s.jsx("h1",{className:"font-heading text-5xl font-medium text-ink tracking-tight mt-2 mb-2",children:"404"}),s.jsx("p",{className:"text-base text-ink-mid mb-6",children:"The page you're looking for doesn't exist."}),s.jsx(Le,{to:Me.HOME,children:s.jsx(yt,{children:"Go home"})})]})})}const glt={confirm:{Icon:eD,eyebrow:"EMAIL PREFERENCES",title:"Unsubscribe from our emails?",body:()=>"You will stop getting tips and updates from Great Experts. Emails about your account, leads and payouts still arrive."},unsubscribed:{Icon:eD,eyebrow:"UNSUBSCRIBED",title:"You're unsubscribed",body:e=>`We won't send tips or updates to ${e} anymore. Emails about your account, leads and payouts still arrive.`},resubscribed:{Icon:Gve,eyebrow:"SUBSCRIBED",title:"You're back on the list",body:e=>`${e} will keep getting tips and updates from Great Experts.`},invalid:{Icon:Co,eyebrow:"LINK NOT VALID",title:"This link is not val
1385id",body:()=>"The unsubscribe link is incomplete or has been changed. Open the email again and use the link at the bottom, or write to [email protected]."},error:{Icon:Co,eyebrow:"SOMETHING WENT WRONG",title:"We could not process this",body:()=>"Please try the link again in a moment. If it keeps failing, write to [email protected] and we will do it by hand."}};function xlt(){const[e]=gl(),t=e.get("uid")||"",n=e.get("sig")||"",[r,a]=f.useState(t&&n?"confirm":"invalid"),[i,o]=f.useState(""),[l,c]=f.useState(!1),u=async h=>{c(!0);try{const{data:p}=await Se.post("/consent/marketing-emails",{uid:t,sig:n,subscribed:h});o(p.email_masked),a(h?"resubscribed":"unsubscribed")}catch(p){a([400,404,422].includes(p.response?.status)?"invalid":"error")}finally{c(!1)}},d=glt[r];return s.jsxs("div",{className:"min-h-screen bg-cream flex items-center justify-center px-4 py-10",children:[s.jsx(vs,{title:"Email preferences | Great Experts",path:"/unsubscribe",noIndex:!0}),s.jsxs("div",{className:"w-full max-w-[440px] bg-paper border border-rule rounded-lg px-9 py-10 text-center",children:[s.jsx(bn,{height:30,className:"mx-auto mb-7"}),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 bg-cream-deep border border-rule rounded-md mb-4",children:s.jsx(d.Icon,{className:"w-6 h-6 text-ink-light"})}),s.jsx("span",{className:"block font-mono text-[11px] uppercase tracking-eyebrow font-medium text-ink-muted",children:d.eyebrow}),s.jsx("h1",{className:"font-heading text-3xl font-medium text-ink tracking-tight mt-2 mb-3",children:d.title}),s.jsx("p",{className:"text-sm leading-relaxed text-ink-mid mb-7",children:d.body(i||"this address")}),s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[r==="confirm"&&s.jsx(yt,{isLoading:l,onClick:()=>u(!1),children:"Unsubscribe"}),r==="unsubscribed"&&s.jsx(yt,{variant:"secondary",isLoading:l,onClick:()=>u(!0),children:"Changed my mind, resubscribe"}),r==="error"&&s.jsx(yt,{isLoading:l,onClick:()=>u(!1),children:"Try again"}),s.jsx(Le,{to:"/",className:"text-sm text-ink-muted hover:text-ink underline-offset-4 hover:underline",children:"Back to Great Experts"})]})]})]})]})}const Dc="/experts/new",xd=e=>"$"+Math.round(e).toLocaleString("en-US"),blt=e=>"$"+(Math.round(e*100)/100).toFixed(2),nH=e=>Number(e).toLocaleString("en-US");function ylt(){const[e,t]=f.useState(!1),[n,r]=f.useState(!1),[a,i]=f.useState(!1),[o,l]=f.useState(500),[c,u]=f.useState(19.99),[d,h]=f.useState(1e4),p=f.useRef(null),m=f.useRef(null),g=f.useRef(null),x=o*c,b=x*.7,y=d*.088,v=y,w=b+v;f.useEffect(()=>{const E=g.current;if(!E)return;const S=()=>{if(r(E.scrollTop>8),p.current&&m.current){const _=p.current.getBoundingClientRect().bottom,k=m.current.getBoundingClientRect().top,C=window.innerHeight;i(_<0&&k>C*.3)}};return E.addEventListener("scroll",S,{passive:!0}),S(),()=>E.removeEventListener("scroll",S)},[]),f.useEffect(()=>{const E=g.current,S=new IntersectionObserver(_=>{_.forEach(k=>{k.isIntersecting&&(k.target.classList.add("is-visible"),S.unobserve(k.target))})},{root:E,threshold:.12});return E?.querySelectorAll(".reveal").forEach(_=>S.observe(_)),()=>S.disconnect()},[]);const j=()=>t(!1);return s.jsxs("div",{ref:g,className:"creator-landing-page",style:{position:"fixed",inset:0,overflowY:"auto",overflowX:"hidden",scrollBehavior:"smooth"},children:[s.jsx(vs,{title:"Great Experts for Creators | Be the expert they actually ask.",description:"Turn your knowledge into a Great Expert AI. Reach people who actually want answers, get paid when they do, and never lose your voice in the process.",path:"/forcreators"}),s.jsx("header",{className:`nav${n?" is-scrolled":""}`,id:"nav",children:s.jsxs("div",{className:"container nav__row",children:[s.jsx(Le,{className:"logo",to:"/","aria-label":"Great Experts home",children:s.jsx(bn,{variant:"flat",height:40})}),s.jsxs("nav",{className:"nav__links","aria-label":"Primary",children:[s.jsx("a",{href:"#patterns",children:"Use cases"}),s.jsx("a",{href:"#how",children:"How it works"}),s.jsx("a",{href:"#earn",children:"How you earn"}),s.jsx("a",{href:"#calc",children:"Calculator"}),s.jsx("a",{href:"#faq",children:"FAQ"}),s.jsxs(Le,{className:"nav__cta",to:Dc,children:["Build my expert",s.jsx(xn,{className:"icon",size:16})]})]}),s.jsx("button",{className:"nav__burger","aria-label":"Open menu",onClick:()=>t(!0),children:s.jsx(xl,{className:"icon",size:22})})]})}),s.jsx("div",{className:`mobile-menu${e?" is-open":""}`,id:"mobile-menu",role:"dialog","aria-modal":"true",onClick:E=>{E.target===E.currentTarget&&j()},children:s.jsxs("div",{className:"mobile-menu__panel",children:[s.jsxs("div",{className:"mobile-menu__head",children:[s.jsx(Le,{className:"logo",to:"/",onClick:j,children:s.jsx(bn,{variant:"flat",height:28})}),s.jsx("button",{className:"mobile-menu__close","aria-label":"Close menu",onClick:j,children:s.jsx(as,{className:"icon",size:22})})]}),s.jsxs("div",{className:"mobile-menu__links",onClick:j,children:[s.jsx("a",{href:"#patterns",children:"Use cases"}),s.jsx("a",{href:"#how",children:"How it works"}),s.jsx("a",{href:"#earn",children:"How you earn"}),s.jsx("a",{href:"#calc",children:"Calculator"}),s.jsx("a",{href:"#faq",children:"FAQ"})]}),s.jsx("div",{className:"mobile-menu__cta",children:s.jsxs(Le,{className:"btn btn--primary btn--full btn--lg",to:Dc,onClick:j,children:["Build my expert in 5 minutes",s.jsx(xn,{className:"icon arrow",size:18})]})})]})}),s.jsxs("main",{children:[s.jsx("section",{className:"hero",ref:p,children:s.jsxs("div",{className:"container hero__inner",children:[s.jsxs("span",{className:"hero__pill",children:[s.jsx("span",{className:"hero__pill-dot",children:s.jsx("svg",{style:{width:11,height:11}
1385,viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("circle",{cx:"12",cy:"12",r:"6"})})}),s.jsx("span",{children:"For creators · live in 5 minutes, no code"})]}),s.jsxs("h1",{children:[s.jsx("span",{className:"line",children:"Be the expert"}),s.jsxs("span",{className:"line",children:["they actually ",s.jsx("em",{children:"ask."})]})]}),s.jsxs("p",{className:"hero__sub",children:["Your method just learned to talk back. Turn your ",s.jsx("em",{children:"book"}),", your ",s.jsx("em",{children:"course"}),", or your ",s.jsx("em",{children:"playbook"})," into an expert that answers in your voice - from your material, about their specific case."]}),s.jsxs("div",{className:"hero__ctas",children:[s.jsxs(Le,{className:"btn btn--primary btn--lg",to:Dc,children:["Build my expert in 5 minutes",s.jsx(xn,{className:"icon arrow",size:18})]}),s.jsxs("a",{className:"btn btn--soft btn--lg",href:"#patterns",children:["See six creator patterns",s.jsx(g0e,{className:"icon arrow",size:18})]})]}),s.jsxs("div",{className:"hero__meta",children:[s.jsxs("span",{children:[s.jsx(ft,{size:14})," No code"]}),s.jsxs("span",{children:[s.jsx(ft,{size:14})," Upload what you already have"]}),s.jsxs("span",{children:[s.jsx(ft,{size:14})," Two ways to earn from one asset"]})]}),s.jsxs("div",{className:"hero__float",children:[s.jsxs("span",{className:"hero__avatar",children:[s.jsx("span",{className:"hero__avatar-dot av-leaf",children:s.jsx(Vwe,{size:14})}),"The Coach"]}),s.jsxs("span",{className:"hero__avatar",children:[s.jsx("span",{className:"hero__avatar-dot av-keto",children:s.jsx(Ou,{size:14})}),"The Author"]}),s.jsxs("span",{className:"hero__avatar",children:[s.jsx("span",{className:"hero__avatar-dot av-time",children:s.jsx(eye,{size:14})}),"The Recipe Creator"]}),s.jsxs("span",{className:"hero__avatar",children:[s.jsx("span",{className:"hero__avatar-dot av-money",children:s.jsx(Cwe,{size:14})}),"The Consultant"]}),s.jsxs("span",{className:"hero__avatar",children:[s.jsx("span",{className:"hero__avatar-dot av-brain",children:s.jsx(k0e,{size:14})}),"The Course Creator"]}),s.jsxs("span",{className:"hero__avatar",children:[s.jsx("span",{className:"hero__avatar-dot av-niche",children:s.jsx(SY,{size:14})}),"The Niche Specialist"]})]})]})}),s.jsx("section",{className:"stats","aria-label":"Platform activity",children:s.jsxs("div",{className:"container stats__row",children:[s.jsxs("div",{className:"stats__item",children:[s.jsx("div",{className:"stats__num",children:"47"}),s.jsx("div",{className:"stats__label",children:"Experts live"})]}),s.jsxs("div",{className:"stats__item",children:[s.jsx("div",{className:"stats__num",children:"23"}),s.jsx("div",{className:"stats__label",children:"Creators earning"})]}),s.jsxs("div",{className:"stats__item",children:[s.jsxs("div",{className:"stats__num",children:["$",s.jsx("span",{style:{fontVariantNumeric:"tabular-nums"},children:"18,400"})]}),s.jsx("div",{className:"stats__label",children:"Paid out · last 30 days"})]}),s.jsxs("div",{className:"stats__item",children:[s.jsxs("div",{className:"stats__num",children:["70",s.jsx("sup",{children:"%"})]}),s.jsx("div",{className:"stats__label",children:"Creator share · gross of fees"})]}),s.jsxs("div",{className:"stats__item",children:[s.jsxs("div",{className:"stats__num",children:["14",s.jsx("sup",{children:"min"})]}),s.jsx("div",{className:"stats__label",children:"Avg time to first live expert"})]})]})}),s.jsx("section",{className:"section",id:"setup",style:{padding:"48px 0"},children:s.jsx("div",{className:"container",children:s.jsxs("div",{className:"setup",children:[s.jsxs("div",{className:"setup__copy",children:[s.jsx("span",{className:"eyebrow",children:"First time here"}),s.jsxs("h2",{className:"h-section",children:["A new way to ",s.jsx("em",{children:"show up"})," for your audience."]}),s.jsx("p",{className:"lede",children:"Great Experts brings specialist AI experts into one place - each one built from a real creator's work. This is the creator side: how your method becomes an expert your audience can ask."}),s.jsxs("ul",{className:"setup__list",children:[s.jsxs("li",{children:[s.jsx("span",{className:"setup__bullet",children:"i."}),s.jsxs("div",{children:[s.jsx("strong",{children:"Alongside what you already sell â not instead of it."})," Your course still sells. Your book still sells. The expert is a new layer that answers the questions your static content can't."]})]}),s.jsxs("li",{children:[s.jsx("span",{className:"setup__bullet",children:"ii."}),s.jsx("div",{children:"Any language they speak. You write once, in your language. Your audience asks in theirs â Polish, Spanish, Portuguese, Japanese â and your expert answers back in their language, in your voice."})]}),s.jsxs("li",{children:[s.jsx("span",{className:"setup__bullet",children:"iii."}),s.jsxs("div",{children:[s.jsx("strong",{children:"Earn from AI, not around it."})," The big models trained on the open web and kept all the value. Here, every question your expert answers pays you."]})]}),s.jsxs("li",{children:[s.jsx("span",{className:"setup__bullet",children:"iv."}),s.jsxs("div",{children:[s.jsx("strong",{children:"You stay in the loop."})," The expert only answers from what you upload. Outside scope, it says so. Your reputation never gets compromised by a hallucinated answer."]}
1385)]})]})]}),s.jsxs("aside",{className:"setup__aside",children:[s.jsxs("div",{className:"setup__card",children:[s.jsx("div",{className:"setup__card-eyebrow",children:"In one paragraph"}),s.jsxs("p",{children:["Upload what you already have - ",s.jsx("strong",{children:"your book, your course, your playbook, your protocols."})," We turn it into an expert that only answers from your material. Your audience asks questions and it responds in your voice. You earn two ways: a ",s.jsx("em",{children:"monthly subscription"})," from your audience, or ",s.jsx("em",{children:"per answer"})," when the platform sends public questions your way."]})]}),s.jsx("div",{className:"setup__quote",children:s.jsx("span",{className:"serif",children:'"Not replacing long-form learning. Answering on top of it."'})})]})]})})}),s.jsx("section",{className:"section section--paper",id:"patterns",style:{padding:"32px 0"},children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head",children:[s.jsx("span",{className:"eyebrow",children:"What creators are actually building"}),s.jsxs("h2",{className:"h-section",children:["Six patterns we see ",s.jsx("em",{children:"over and over."})]}),s.jsxs("p",{className:"lede",children:["Not sure where you fit? Find the version closest to what you do.",s.jsx("br",{}),"Choose the format that fits what you already make. The setup is the same.",s.jsx("br",{}),"The difference is how your expert gets used and how you earn."]})]}),s.jsxs("div",{className:"rows",children:[s.jsxs("article",{className:"row reveal",children:[s.jsxs("div",{className:"row__num",children:["N",s.jsx("sup",{children:"o"})," 01"]}),s.jsxs("div",{className:"row__head",children:[s.jsx("div",{className:"row__cat",children:"Coach"}),s.jsxs("h3",{children:["Between-session support, ",s.jsx("em",{children:"at scale."})]}),s.jsx("p",{className:"row__sub",children:"Fitness · therapy · nutrition · business · life · career"})]}),s.jsxs("div",{className:"row__body",children:[s.jsx("p",{className:"row__lede",children:"Your client messages at 11pm after a bad day. Your expert answers in your method, in your voice â right then, not next Tuesday at 2pm. Grounding technique for panic. A food swap for a craving. A reframe for a spiral. The specific thing you'd have said."}),s.jsxs("div",{className:"row__detail",children:[s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"What you upload"}),s.jsx("p",{children:'Your protocols, scripts, recorded voice notes, emergency grounding exercises, "if client says X, answer Y" decision rules.'})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"How this earns"}),s.jsxs("p",{children:["Add-on to existing clients at ",s.jsx("strong",{children:"$49/mo"}),". Or self-serve 6-week program at ",s.jsx("strong",{children:"$149"})," (no live calls). Or free lead-magnet â book the paid intake."]})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"Why it works"}),s.jsx("p",{children:"Scale one person's method to 50 clients. Homework logs, check-ins, FAQs â handled. You step in for the hard calls."})]})]})]})]}),s.jsxs("article",{className:"row reveal",children:[s.jsxs("div",{className:"row__num",children:["N",s.jsx("sup",{children:"o"})," 02"]}),s.jsxs("div",{className:"row__head",children:[s.jsx("div",{className:"row__cat",children:"Author"}),s.jsxs("h3",{children:["Make your book ",s.jsx("em",{children:"ask-able."})]}),s.jsx("p",{className:"row__sub",children:"Nonfiction · business · memoir-with-method · academic"})]}),s.jsxs("div",{className:"row__body",children:[s.jsx("p",{className:"row__lede",children:`Readers finish your book and want to apply it to their specific situation. "How does chapter 4 apply if I'm a single parent?" Your expert answers from the book, in your framing â not an internet paraphrase. Journalists fact-check a claim. Podcasters prep for interviews. Course buyers get clarifications at 2am.`}),s.jsxs("div",{className:"row__detail",children:[s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"What you upload"}),s.jsx("p",{children:"The book (full text), your blog archive, transcripts of your talks and interviews, your FAQ, a list of things you explicitly won't opine on."})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"How this earns"}),s.jsxs("p",{children:["Reader subscription ",s.jsx("strong",{children:"$9â19/mo"})," for ongoing access. Free preview (3 answers) converts cold readers. Per-answer income from public discovery."]})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"Why it works"}),s.jsx("p",{children:"The expert quotes you verbatim where it matters. It doesn't extrapolate into opinions you never wrote. Your voice stays yours."})]})]})]})]}),s.jsxs("article",{className:"row reveal",children:[s.jsxs("div",{className:"row__num",children:["N",s.jsx("sup",{children:"o"})," 03"]}
1385),s.jsxs("div",{className:"row__head",children:[s.jsx("div",{className:"row__cat",children:"Recipe / Product Creator"}),s.jsxs("h3",{children:["Personal answers, from your ",s.jsx("em",{children:"actual library."})]}),s.jsx("p",{className:"row__sub",children:"Food · skincare · fitness gear · home · any product-driven niche"})]}),s.jsxs("div",{className:"row__body",children:[s.jsx("p",{className:"row__lede",children:`"I have chicken and spinach and 25 minutes â what do I make?" Your expert answers with your recipes. Not an internet average. Yours â the ones you've actually tested, photographed, and stand behind. Someone asks about dry skin in winter â your expert walks them through your routine, with your products. They get a personal answer; you get the sale.`}),s.jsxs("div",{className:"row__detail",children:[s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"What you upload"}),s.jsx("p",{children:"Your full recipe / product database, cooking or tutorial video transcripts, ingredient subs, your curated product list, seasonal protocols."})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"How this earns"}),s.jsxs("p",{children:["Subscription ",s.jsx("strong",{children:"$7.49â$14.99/mo"})," for meal-plan or routine-planning access. Per-answer income from public discovery. Affiliate commissions stay with you."]})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"Why it works"}),s.jsx("p",{children:"Dietary restrictions get routed through your protocols, not Googled. Answers stay on-brand because the knowledge is on-brand."})]})]})]})]}),s.jsxs("article",{className:"row reveal",children:[s.jsxs("div",{className:"row__num",children:["N",s.jsx("sup",{children:"o"})," 04"]}),s.jsxs("div",{className:"row__head",children:[s.jsx("div",{className:"row__cat",children:"Specialist Consultant"}),s.jsxs("h3",{children:["Scale your 1-on-1 ",s.jsx("em",{children:"without giving it away."})]}),s.jsx("p",{className:"row__sub",children:"Tax · legal · financial planning · HR · M&A · regulated domains"})]}),s.jsxs("div",{className:"row__body",children:[s.jsx("p",{className:"row__lede",children:"You sell $400/hr advice. You can't take every call, and not every caller needs an hour. Your expert handles the first layer â jurisdiction-specific answers from your actual playbook â and routes the complex cases back to you as qualified, pre-briefed leads. Clients between engagements keep access at a subscription price."}),s.jsxs("div",{className:"row__detail",children:[s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"What you upload"}),s.jsx("p",{children:'Your playbook, anonymized case notes, jurisdiction regs you track, your standard intake questions, your "when to call a human" triggers.'})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"How this earns"}),s.jsxs("p",{children:["Higher-priced subscription ",s.jsx("strong",{children:"$49â149/mo"})," for recurring clients. Free triage converts cold visitors. Keep it subscription-only to protect your price floor."]})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"Why it works"}),s.jsx("p",{children:"Your playbook stays yours. The expert only cites from your uploads. No hallucinated case law. Your name and license are safe."})]})]})]})]}),s.jsxs("article",{className:"row reveal",children:[s.jsxs("div",{className:"row__num",children:["N",s.jsx("sup",{children:"o"})," 05"]}),s.jsxs("div",{className:"row__head",children:[s.jsx("div",{className:"row__cat",children:"Course Creator"}),s.jsxs("h3",{children:["A 24/7 ",s.jsx("em",{children:"teaching assistant."})]}),s.jsx("p",{className:"row__sub",children:"Online courses · cohorts · bootcamps · professional training"})]}),s.jsxs("div",{className:"row__body",children:[s.jsx("p",{className:"row__lede",children:"Students hit a confusing lesson at midnight. Your expert explains it in your words, with your examples, using your framing. If they missed a prerequisite, it points them back to lesson 3 instead of bluffing an answer. Homework gets a first-pass check against your rubric. You grade the edge cases, not the copy-paste ones."}),s.jsxs("div",{className:"row__detail",children:[s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"What you upload"}),s.jsx("p",{children:"All course materials (video transcripts, slides, workbooks), your grading rubrics, a library of common student questions and your canonical answers, prerequisites map."})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"How this earns"}),s.jsxs("p",{children:["Bundle with the course ",s.jsx("strong",{children:"$299 + $19/mo expert"})," for 6 months. Standalone subscription for alumni. Per-answer income for non-students."]})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"Why it works"}),s.jsx("p",{children:"More students get answers without you hiring anyone. Your course keeps earning long after launch."})]})]})]})]}),s.jsxs("article",{className:"row reveal",children:[s.jsxs("div",{className:"row__num",children:["N",s.jsx("sup",{children:"o"})," 06"]}),s.jsxs("div",{className:"row__head",children:[s.jsx("div",{className:"row__cat",children:"Niche Specialist"}),s.jsxs("h3",{children:["Rare knowledge, ",s.jsx("em",{children:"no audience required."})]}),s.jsx("p",{className:"row__sub",children:"Researchers · analysts · practitioners in narrow domains · ex-operators"})]}),s.jsxs("div",{className:"row__body",children:[s.jsx("p",{className:"row__lede",children:"You know obscure things. Semiconductor lithography. Pre-1975 copyright edge cases. Rehabilitation protocols for a specific injury. A regional regulatory regime. You don't have followers and don't want to build them. Users search our public directory and find the expert whose domain fits â yours."}),s.jsxs("div",{className:"row__detail",children:[s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"What you upload"}),s.jsx("p",{children:"Papers, research notes, analyses, case write-ups, the stuff in your head that took ten years to accumulate. Plus a tight domain definition so the Moderator routes accurately."})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"How this earns"}),s.jsxs("p",{children:["Per-answer: ",s.jsx("strong",{children:"$0.088"})," per delivered answer, fixed. The platform brings the questions. No audience, no funnel, no personal brand."]})]}),s.jsxs("div",{className:"row__detail-block",children:[s.jsx("div",{className:"row__detail-eyebrow",children:"Why it works"}),s.jsx("p",{children:"Tight scope wins. The narrower and more defensible your expert's domain, the more relevant routing, the higher ratings, the more volume."})]})]})]})]})]}),s.jsxs("div",{className:"whisper-cta",style:{marginTop:64,flexWrap:"nowrap"},children:[s.jsxs("div",{className:"whisper-cta__text",style:{flex:"1 1 auto",minWidth:0},children:[s.jsx("span",{className:"whisper-cta__mark",children:s.jsx(Ms,{size:16})}),s.jsxs("span",{style:{textWrap:"pretty"},children:["Found yourself? Build your expert.",s.jsx("br",{}),"Most creators have their expert up and running in an afternoon."]})]}),s.jsxs(Le,{className:"btn btn--primary",to:Dc,style:{flexShrink:0},children:["Build my expert in 5 minutes",s.jsx(xn,{className:"icon arrow",size:16})]})]})]})}),s.jsx("section",{className:"section",id:"how",style:{padding:"16px 0 48px"},children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head section__head--center",children:[s.jsx("span",{className:"eyebrow",children:"How it works"}),s.jsx("h2",{className:"h-section h-section--center",children:"Three steps. No code. Live before your next coffee."})]}),s.jsxs("div",{className:"steps",children:[s.jsxs("div",{className:"step reveal",children:[s.jsxs("div",{className:"step__n",children:["01",s.jsx("sup",{children:"/ Upload"})]}),s.jsx("h3",{children:"Upload what you know"}
1385),s.jsx("p",{children:"Drag in your book, your course, your playbook, your recipe archive, your research, your voice notes. Anything that captures how you think and what you know. We build your expert from it. It can only answer from what you gave it. No hallucinations."})]}),s.jsxs("div",{className:"step reveal",children:[s.jsxs("div",{className:"step__n",children:["02",s.jsx("sup",{children:"/ Define"})]}),s.jsx("h3",{children:"Define scope and voice"}),s.jsx("p",{children:`Tell the expert what it covers and what it doesn't. Add tone notes â warmer, more clinical, shorter answers, always ask a clarifying question first. Set "refuse" triggers (crisis language, legal advice you don't give, anything out of scope).`})]}),s.jsxs("div",{className:"step reveal",children:[s.jsxs("div",{className:"step__n",children:["03",s.jsx("sup",{children:"/ Launch"})]}),s.jsx("h3",{children:"Launch it"}),s.jsx("p",{children:"Choose your mode: 1-on-1 subscription for your audience, public per-answer access for discovery, or both. Share the link or let the platform surface you. The dashboard shows what people actually asked and how they rated the answers. Improve weekly."})]})]})]})}),s.jsx("section",{className:"section section--paper",id:"earn",style:{padding:"56px 0"},children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head",children:[s.jsx("span",{className:"eyebrow",children:"How you make money"}),s.jsxs("h2",{className:"h-section",children:["Two revenue streams off the ",s.jsx("em",{children:"same expert asset."})]}),s.jsx("p",{className:"lede",children:"Most creators run both. Some run just one. Pick what fits your audience shape."})]}),s.jsxs("div",{className:"streams",children:[s.jsxs("div",{className:"stream stream--sub",children:[s.jsxs("div",{className:"stream__head",children:[s.jsx("div",{className:"stream__tag",children:"Stream 1"}),s.jsx("h3",{children:"Subscriptions"}),s.jsx("p",{className:"stream__hint",children:"Best if you have an audience."})]}),s.jsxs("div",{className:"stream__body",children:[s.jsxs("p",{children:["Your audience pays monthly for unlimited 1-on-1 access to your expert. ",s.jsx("strong",{children:"You set the price."})," Floor $7.49/mo, no ceiling. You keep ",s.jsx("strong",{children:"70%"}),". Stripe fees come out of our 30%, not yours."]}),s.jsxs("div",{className:"stream__math",children:[s.jsx("div",{className:"stream__math-eyebrow",children:"Typical math"}),s.jsxs("div",{className:"stream__math-row",children:["Coach ",s.jsx("span",{children:"$49/mo"})]}),s.jsxs("div",{className:"stream__math-row",children:["Author ",s.jsx("span",{children:"$14/mo"})]}),s.jsxs("div",{className:"stream__math-row",children:["Consultant ",s.jsx("span",{children:"$99/mo"})]}),s.jsxs("div",{className:"stream__math-row",children:["Food creator ",s.jsx("span",{children:"$9.99/mo"})]}),s.jsxs("div",{className:"stream__math-bottom",children:[s.jsx("strong",{children:"500 subs à $19.99/mo"})," ",s.jsx("span",{children:"â $7,000/mo MRR"})]})]})]})]}),s.jsxs("div",{className:"stream stream--per",children:[s.jsxs("div",{className:"stream__head",children:[s.jsx("div",{className:"stream__tag",children:"Stream 2"}),s.jsx("h3",{children:"Per-answer"}),s.jsx("p",{className:"stream__hint",children:"Best if you have niche knowledge, no audience."})]}),s.jsxs("div",{className:"stream__body",children:[s.jsxs("p",{children:["Your expert is discoverable in our public directory. When someone asks a question in your domain, your expert answers. You earn ",s.jsx("strong",{children:"$0.088 per delivered answer"})," â fixed, no tiers, no quality haircut. The platform brings the questions to you."]}),s.jsxs("div",{className:"stream__math",children:[s.jsx("div",{className:"stream__math-eyebrow",children:"Typical math"}),s.jsxs("div",{className:"stream__math-row",children:["Per answer ",s.jsx("span",{children:"$0.088"})]}),s.jsxs("div",{className:"stream__math-row",children:["Floor rate ",s.jsx("span",{children:"fixed forever"})]}),s.jsxs("div",{className:"stream__math-row",children:["Quality bonus ",s.jsx("span",{children:"visibility, not pay"})]}),s.jsxs("div",{className:"stream__math-row",children:["Audience required ",s.jsx("span",{children:"none"})]}),s.jsxs("div",{className:"stream__math-bottom",children:[s.jsx("strong",{children:"57,000 answers/mo"})," ",s.jsx("span",{children:"â $5,000/mo"})]})]})]})]})]}),s.jsxs("div",{className:"stack-note",children:[s.jsx("div",{className:"stack-note__icon",children:s.jsx(Ms,{size:18})}),s.jsxs("div",{children:[s.jsx("strong",{children:"Stack both â that's the default."}),"Subscription traffic from your audience ",s.jsx("em",{children:"and"})," per-answer income from public discovery. One asset, two streams. If your subscription is premium and you don't want users bypassing it via cheap per-answer access, turn off per-answer access â subscription-only."]})]}),s.jsxs("div",{className:"calc",id:"calc",children:[s.jsxs("div",{className:"calc__head",children:[s.jsx("span",{className:"micro",children:"Earnings calculator"}),s.jsx("h3",{style:{color:"var(--accent-soft)"},children:"Run the numbers - How much you can earn?"}),s.jsx("p",{className:"calc__hint",children:"Drag the sliders. The math updates live. Your 70% share is gross of Stripe fees."})]}),s.jsxs("div",{className:"calc__grid",children:[s.jsxs("div",{className:"calc__col",children:[s.jsxs("div",{className:"calc__col-head",children:[s.jsx("div",{className:"calc__col-tag",children:"Subscription stream"}),s.jsx("h4",{children:"Audience à price"})]}),s.jsxs("div",{className:"calc__field",children:[s.jsxs("div",{className:"calc__field-row",children:[s.jsx("label",{htmlFor:"calc-subs",children:"Subscribers"}),s.jsx("output",{id:"calc-subs-out",children:nH(o)})]}),s.jsx("input",{type:"range",id:"calc-subs",min:0,max:5e3,step:10,value:o,onChange:E=>l(Number(E.target.value))})]}),s.jsxs("div",{className:"calc__field",children:[s.jsxs("div",{className:"calc__field-row",children:[s.jsx("label",{htmlFor:"calc-price",children:"Price / month"}),s.jsx("output",{id:"calc-price-out",children:blt(c)})]}),s.jsx("input",{type:"range",id:"calc-price",min:7.49,max:199,step:.5,value:c,onChange:E=>u(Number(E.target.value))})]}),s.jsxs("div",{className:"calc__readout",children:[s.jsxs("div",{className:"calc__readout-row",children:[s.jsx("span",{children:"Gross / mo"}),s.jsx("strong",{children:xd(x)})]}),s.jsxs("div",{className:"calc__readout-row calc__readout-row--big",children:[s.jsx("span",{children:"Your 70% / mo"}),s.jsx("strong",{children:xd(b)})]}),s.jsxs("div",{className:"calc__readout-row calc__readout-row--small",children:[s.jsx("span",{children:"Annualized"}),s.jsx("span",{children:xd(b*12)})]})]})]}),s.jsxs("div",{className:"calc__col",children:[s.jsxs("div",{className:"calc__col-head",children:[s.jsx("div",{className:"calc__col-tag",children:"Per-answer stream"}),s.jsx("h4",{children:"Routed volume à $0.088"})]}),s.jsxs("div",{className:"calc__field",children:[s.jsxs("div",{className:"calc__field-row",children:[s.jsx("label",{htmlFor:"calc-answers",children:"Answers / month"}),s.jsx("output",{id:"calc-answers-out",children:nH(d)})]}),s.jsx("input",{type:"range",id:"calc-answers",min:0,max:1e5,step:500,value:d,onChange:E=>h(Number(E.target.value))})]}),s.jsxs("div",{className:"calc__field",children:[s.jsxs("div",{className:"calc__field-row",children:[s.jsx("label",{children:"Rate / answer"}),s.jsx("output",{style:{opacity:.7},children:"$0.088 â fixed"})]}),s.jsx("input",{type:"range",disabled:!0,value:50,min:0,max:100,readOnly:!0})]}),s.jsxs("div",{className:"calc__readout",children:[s.jsxs("div",{className:"calc__readout-row",children:[s.jsx("span",{children:"Gross / mo"}),s.jsx("strong",{children:xd(y)})]}),s.jsxs("div",{className:"calc__readout-row calc__readout-row--big",children:[s.jsx("span",{children:"Your share / mo"}),s.jsx("strong",{children:xd(v)})]}),s.jsxs("div",{className:"calc__readout-row calc__readout-row--small",children:[s.jsx("span",{children:"Annualized"}),s.jsx("span",{children:xd(v*12)})]})]})]}),s.jsxs("div",{className:"calc__total",children:[s.jsxs("div",{className:"calc__total-row",children:[s.jsx("span",{className:"micro",children:"Combined / month"}),s.jsx("strong",{children:xd(w)})]}),s.jsxs("div",{className:"calc__total-foot",children:["Stack both is the default. ",s.jsx("span",{className:"serif",children:"Most creators land on a mix."})]})]})]})]}),s.jsxs("div",{className:"dontpromise",style:{marginTop:48},children:[s.jsx("h4",{children:"What we don't do"}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("strong",{children:"No earnings multipliers"}),' or "Founding Creator" tiers. Everyone earns the same rate from day one.']}),s.jsxs("li",{children:[s.jsx("strong",{children:"No quality-adjusted payout."})," Rating controls visibility. Per-answer rate is fixed."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"No lock-in."})," Your knowledge stays yours. Export and delete any time. Written into terms."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"No training on your content for competing experts."})," Your uploads never train anyone else's expert."]})]})]})]})}),s.jsx("section",{className:"section",style:{padding:"32px 0 64px"},children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head section__head--center",children:[s.jsx("span",{className:"eyebrow",children:"The four things creators ask first"}),s.jsxs("h2",{className:"h-section h-section--center",children:["The honest answers, ",s.jsx("em",{children:"up front."})]})]}),s.jsxs("div",{className:"anchor",children:[s.jsxs("div",{className:"anchor__item reveal",children:[s.jsx("div",{className:"anchor__num",children:"i."}),s.jsx("h3",{children:'"Will my expert hallucinate and embarrass me?"'}),s.jsxs("p",{children:[s.jsx("strong",{children:"No."})," Your expert can only answer from knowledge you uploaded. If a user asks something outside that scope, it says so instead of inventing an answer. No made-up statistics, no invented citations, no confident extrapolation. This is the single thing that separates a real expert asset from a general chatbot with your name on it."]})]}),s.jsxs("div",{className:"anchor__item reveal",children:[s.jsx("div",{className:"anchor__num",children:"ii."}),s.jsx("h3",{children:'"What happens to the knowledge I upload?"'}),s.jsxs("p",{children:["It stays yours. We don't train competing experts on it. We don't share it, sell it, or expose it. ",s.jsx("strong",{children:"If you leave, you export and we delete."})," Written into our terms."]})]}),s.jsxs("div",{className:"anchor__item reveal",children:[s.jsx("div",{className:"anchor__num",children:"iii."}),s.jsx("h3",{children:'"Is the payout really clean?"'}),s.jsxs("p",{children:["Yes. ",s.jsx("strong",{children:"70% to you, 30% to us, Stripe fees absorbed from our 30%."})," Set $19.99/mo and you see $13.99 per subscriber every cycle. Per-
1385answer rate of $0.088 is identical regardless of rating zone or volume."]})]}),s.jsxs("div",{className:"anchor__item reveal",children:[s.jsx("div",{className:"anchor__num",children:"iv."}),s.jsx("h3",{children:'"How hard is the build?"'}),s.jsxs("p",{children:["If you can use Substack, Notion, or Google Drive, you can build an expert. ",s.jsx("strong",{children:"No code."})," Upload materials, define scope and behaviour, deploy. Most creators have a live expert in under an hour."]})]})]})]})}),s.jsx("section",{className:"section section--paper",id:"faq",style:{padding:"56px 0"},children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head section__head--center",children:[s.jsx("span",{className:"eyebrow",children:"Frequently asked"}),s.jsxs("h2",{className:"h-section h-section--center",children:["A few more questions ",s.jsx("em",{children:"answered."})]})]}),s.jsx("div",{className:"faq",children:[{n:"01",q:"Which use case pattern should I start with?",a:s.jsxs("p",{children:["Pick the one closest to what you already sell. ",s.jsx("strong",{children:"Coaches"})," â between-session support. ",s.jsx("strong",{children:"Authors"})," â ask-the-book. ",s.jsx("strong",{children:"Consultants"})," â triage plus method subscription. ",s.jsx("strong",{children:"Course creators"})," â TA-for-students. ",s.jsx("strong",{children:"Niche specialists"})," â skip subscription, go per-answer. You can evolve later â the expert asset is the same."]})},{n:"02",q:"How long does it actually take to build?",a:s.jsxs("p",{children:["Depends on how organized your knowledge is. If your book is a PDF and your protocols are in Notion, ",s.jsx("strong",{children:"under an hour."})," If you've got 200 hours of video to transcribe, a day or two. Most creators ship a usable v1 in an afternoon and tune it over the first two weeks."]})},{n:"03",q:"What if my expert starts answering in a way that doesn't sound like me?",a:s.jsxs("p",{children:[`You tune it. Voice notes, sample answers you'd give, "rewrite this better" feedback in the dashboard. The system learns your phrasing and your no-go answers. `,s.jsx("em",{children:"Week-one tuning matters more than launch week."})]})},{n:"04",q:"Will my expert hallucinate and embarrass me?",a:s.jsxs("p",{children:["No. ",s.jsx("strong",{children:"Bounded to your uploads."}),` Outside scope = "I don't know" instead of a guess. This is architectural, not a policy we could change our minds on.`]})},{n:"05",q:"Can one expert earn in both streams?",a:s.jsxs("p",{children:["Yes â that's the default. Subscribers get 1-on-1 access; public users pay per answer. ",s.jsx("strong",{children:"One asset, two streams."})," Turn off per-answer only if subscription is premium and bypass is a concern."]})},{n:"06",q:"How much can I actually earn?",a:s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Depends on audience size and domain fit."}),s.jsxs("p",{children:[s.jsx("strong",{children:"Subscription:"})," price à subs à 70%. E.g. $19.99 à 500 = $7,000/mo. ",s.jsx("strong",{children:"Per-answer:"})," answers à $0.088. E.g. 57,000 answers = $5,000/mo. Most land on a mix â try the calculator above for your shape."]})]})},{n:"07",q:"What happens to my knowledge?",a:s.jsxs("p",{children:["It stays yours. We are never using it to train competing experts. ",s.jsx("strong",{children:"Export and delete any time."})," It's added in our terms."]})},{n:"08",q:"When do payouts arrive?",a:s.jsxs("p",{children:[s.jsx("strong",{children:"2â7 business days"})," depending on country. KYC at onboarding."]})},{n:"09",q:"What if my expert gets low ratings?",a:s.jsxs("p",{children:["Quality zones gate visibility, not earnings. ",s.jsx("strong",{children:"Red zone = hidden immediately"})," with 30 days to recover. Existing subscriptions continue through the grace period. There's no Founding Creator program â everyone earns the same rate from day one."]})}].map(E=>s.jsxs("details",{className:"faq__item",children:[s.jsxs("summary",{children:[s.jsx("span",{className:"faq__num",children:E.n}),s.jsx("span",{className:"faq__q",children:E.q}),s.jsx("span",{className:"faq__chevron",children:s.jsx(Is,{size:20})})]}),s.jsx("div",{className:"faq__answer",children:E.a})]},E.n))})]})}),s.jsx("section",{className:"section",style:{padding:"0 0 16px"},ref:m,children:s.jsx("div",{className:"container",children:s.jsx("div",{className:"final-cta","data-cta-variant":"glow",children:s.jsxs("div",{className:"final-cta__inner",children:[s.jsxs("h2",{children:["Turn what you know into ",s.jsx("span",{style:{color:"var(--accent)",fontStyle:"italic"},children:"an expert"})," your audience can ask."]}),s.jsx("p",{children:"Most creators have a live expert super fast. 20 beta creators onboarded. Both monetization paths available day one."}),s.jsxs(Le,{className:"btn btn--accent btn--lg",to:Dc,children:["Build my expert in 5 minutes",s.jsx(xn,{className:"icon arrow",size:18})]}),s.jsxs("div",{className:"final-cta__meta",style:{display:"flex",marginTop:12},children:[s.jsxs("span",{children:[s.jsx(ft,{size:14})," No code"]}),s.jsxs("span",{children:[s.jsx(ft,{size:14})," 70% creator share"]}),s.jsxs("span",{children:[s.jsx(ft,{size:14})," Knowledge stays yours"]})]}),s.jsxs("p",{style:{marginTop:20,fontSize:13.5,color:"var(--accent-deep)"},children:["Here to ask questions instead of answer them?"," ",s.jsx(Le,{to:"/",style:{color:"var(--accent-deep)",borderBottom:"1px solid currentColor",paddingBottom:"1px",fontWeight:500},children:"Go to Great Experts as a user â"})]})]})})})})]}),s.jsx("footer",{className:"footer",children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"footer__top",children:[s.jsxs("div",{className:"footer__brand",children:[s.jsx(Le,{className:"logo",to:"/","aria-label":"Great Experts home",children:s.jsx(bn,{variant:"flat",height:40})}),s.jsxs("p",{children:[s.jsx("strong",{children:"Create"})," your expert.",s.jsx("br",{}),s.jsx("strong",{children:"Let"})," it work.",s.jsx("br",{}),s.jsx("strong",{children:"Watch"})," it earn."]})]}
1385),s.jsxs("div",{className:"footer__col",children:[s.jsx("h5",{children:"Product"}),s.jsxs("ul",{children:[s.jsx("li",{children:s.jsx("a",{href:"#how",children:"How it works"})}),s.jsx("li",{children:s.jsx(Le,{to:"/pricing",children:"Pricing"})})]})]}),s.jsxs("div",{className:"footer__col",children:[s.jsx("h5",{children:"For creators"}),s.jsxs("ul",{children:[s.jsx("li",{children:s.jsx(Le,{to:Dc,children:"Build an expert"})}),s.jsx("li",{children:s.jsx(Le,{to:Dc,children:"Upload knowledge"})})]})]}),s.jsxs("div",{className:"footer__col",children:[s.jsx("h5",{children:"Company"}),s.jsxs("ul",{children:[s.jsx("li",{children:s.jsx(Le,{to:"/faq",children:"FAQ"})}),s.jsx("li",{children:s.jsx(Le,{to:"/terms",children:"Terms & Conditions"})}),s.jsx("li",{children:s.jsx(Le,{to:"/privacy",children:"Privacy Policy"})})]})]})]}),s.jsx("div",{className:"footer__copy",children:"© 2026 Great Experts · Great Spirits Limited (ADGM)"})]})}),s.jsxs("div",{className:`sticky-cta${a?" is-visible":""}`,id:"sticky-cta","aria-hidden":a?"false":"true",children:[s.jsxs(Le,{className:"sticky-cta__btn",to:Dc,children:["Build my expert in 5 minutes",s.jsx(xn,{className:"icon arrow",size:16})]}),s.jsx("div",{className:"sticky-cta__sub",children:"No code · 70% creator share"})]})]})}const qg="/experts/new",rH="/explore/experts";function vlt(){return s.jsx("svg",{width:"0",height:"0",style:{position:"absolute",overflow:"hidden"},"aria-hidden":"true",children:s.jsxs("defs",{children:[s.jsx("symbol",{id:"i-check",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),s.jsx("symbol",{id:"i-arrow-right",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M5 12h14M13 5l7 7-7 7"})}),s.jsx("symbol",{id:"i-arrow-down",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M12 5v14M5 12l7 7 7-7"})}),s.jsx("symbol",{id:"i-chevron-down",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"6 9 12 15 18 9"})}),s.jsxs("symbol",{id:"i-x",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),s.jsxs("symbol",{id:"i-menu",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),s.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),s.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),s.jsxs("symbol",{id:"i-shield",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"}),s.jsx("path",{d:"m9 12 2 2 4-4"})]}),s.jsx("symbol",{id:"i-heart",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.29 1.51 4.04 3 5.5l7 7Z"})}),s.jsxs("symbol",{id:"i-leaf",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19.2 2.96a1 1 0 0 1 1.8.66c0 1.68-.3 3.3-.7 4.74C18.6 13.5 17 16.66 11 20Z"}),s.jsx("path",{d:"M2 21c0-3 1.85-5.36 5.08-6"})]}),s.jsxs("symbol",{id:"i-sun",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"4"}),s.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})]}),s.jsx("symbol",{id:"i-moon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),s.jsxs("symbol",{id:"i-users",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"9",cy:"7",r:"4"}),s.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75"})]}),s.jsx("symbol",{id:"i-message",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),s.jsx("symbol",{id:"i-book",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"})}),s.jsxs("symbol",{id:"i-feather",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M20.24 12.24a6 6 0 0 0-8.49-8.49L5 10.5V19h8.5l6.74-6.74Z"}),s.jsx("line",{x1:"16",y1:"8",x2:"2",y2:"22"}),s.jsx("line",{x1:"17.5",y1:"15",x2:"9",y2:"15"})]}),s.jsxs("symbol",{id:"i-mic",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"9",y:"2",width:"6",height:"11",rx:"3"}),s.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),s.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]}),s.jsxs("symbol",{id:"i-video",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("polygon",{points:"23 7 16 12 23 17 23 7"}),s.jsx("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2"})]}),s.jsxs("symbol",{id:"i-file",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"})]}),s.jsxs("symbol",{id:"i-edit",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),s.jsxs("symbol",{id:"i-clock",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),s.jsxs("symbol",{id:"i-globe",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),s.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),s.jsxs("symbol",{id:"i-compass",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polygon",{points:"16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"})]}),s.jsx("symbol",{id:"i-spark",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"})}),s.jsxs("symbol",{id:"i-lock",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),s.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),s.jsx("symbol",{id:"i-key",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m21 2-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0 3 3L22 7l-3-3m-3.5 3.5L19 4"})}),s.jsxs("symbol",{id:"i-eye-off",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),s.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}),s.jsxs("symbol",{id:"i-trash",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("polyline",{points:"3 6 5 6 21 6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),s.jsxs("symbol",{id:"i-download",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s.jsx("polyline",{points:"7 10 12 15 17 10"}),s.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),s.jsxs("symbol",{id:"i-route",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"6",cy:"19",r:"3"}),s.jsx("path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"}),s.jsx("circle",{cx:"18",cy:"5",r:"3"})]}),s.jsx("symbol",{id:"i-wand",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M15 4V2M15 16v-2M8 9h2M20 9h2M17.8 11.8 19 13M15 9h0M17.8 6.2 19 5M3 21l9-9M12.2 6.2 11 5"})}),s.jsxs("symbol",{id:"i-coin",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M15 9.354a4 4 0 1 0 0 5.292"})]}),s.jsxs("symbol",{id:"i-package",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M16.5 9.4 7.55 4.24"}),s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),s.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"})]}),s.jsxs("symbol",{id:"i-target",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("circle",{cx:"12",cy:"12",r:"6"}),s.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),s.jsx("symbol",{id:"i-bookmark",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),s.jsxs("symbol",{id:"i-graduation",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M22 10v6M2 10l10-5 10 5-10 5z"}),s.jsx("path",{d:"M6 12v5c0 2 2 3 6 3s6-1 6-3v-5"})]}),s.jsxs("symbol",{id:"i-briefcase",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"2",y:"7",width:"20",height:"14",rx:"2",ry:"2"}),s.jsx("path",{d:"M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"})]}),s.jsxs("symbol",{id:"i-flower",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5"}),s.jsx("path",{d:"M12 7.5V9M7.5 12H9M12 16.5V15M16.5 12H15"})]}),s.jsxs("symbol",{id:"i-no",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})]}),s.jsxs("symbol",{id:"i-info",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M12 16v-4M12 8h.01"})]}),s.jsx("symbol",{id:"i-phone",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),s.jsxs("symbol",{id:"i-anchor",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"5",r:"3"}),s.jsx("line",{x1:"12",y1:"22",x2:"12",y2:"8"}),s.jsx("path",{d:"M5 12H2a10 10 0 0 0 20 0h-3"})]})]})})}function mt({id:e,style:t}){return s.jsx("svg",{style:t,children:s.jsx("use",{href:`#${e}`})})}function aH({text:e,attribution:t,avatarSrc:n,avatarAlt:r}){return s.jsxs("div",{className:"why__quote",children:[s.jsx("span",{className:"why__quote-mark",children:"â"}),s.jsx("p",{children:e}),s.jsxs("span",{className:"why__quote-attr",children:[s.jsx("img",{className:"why__quote-avatar",src:n,alt:r}),t]})]})}function wlt(){const[e,t]=f.useState(!1),[n,r]=f.useState(!1),a=f.useRef(null);f.useEffect(()=>{const o=a.current;if(!o)return;const l=()=>r(o.scrollTop>8);return o.addEventListener("scroll",l,{passive:!0}
1385),l(),()=>o.removeEventListener("scroll",l)},[]),f.useEffect(()=>{const o=a.current;if(!o)return;const l=new IntersectionObserver(c=>{c.forEach(u=>{u.isIntersecting&&(u.target.classList.add("is-visible"),l.unobserve(u.target))})},{root:o,threshold:.1});return o.querySelectorAll(".reveal").forEach(c=>l.observe(c)),()=>l.disconnect()},[]);const i=()=>t(!1);return s.jsxs("div",{ref:a,className:"practitioner-landing-page",style:{position:"fixed",inset:0,overflowY:"auto",overflowX:"hidden",scrollBehavior:"smooth"},children:[s.jsx(vs,{title:"Great Experts for Practitioners | Your wisdom is worth more than your calendar",description:"A new way for therapists, coaches, and somatic practitioners to extend their practice â an AI expert built from your own voice, grounded in your library, held to your boundaries.",path:"/forpractitioners"}),s.jsx(vlt,{}),s.jsx("header",{className:`nav${n?" is-scrolled":""}`,id:"nav",children:s.jsxs("div",{className:"container nav__row",children:[s.jsx(Le,{className:"logo",to:"/","aria-label":"Great Experts home",children:s.jsx(bn,{variant:"flat",height:40})}),s.jsxs("nav",{className:"nav__links","aria-label":"Primary",children:[s.jsx("a",{href:"#why",children:"Why join"}),s.jsx("a",{href:"#what",children:"What it is"}),s.jsx("a",{href:"#moments",children:"Client journey"}),s.jsx("a",{href:"#earn",children:"How you earn"}),s.jsx("a",{href:"#who",children:"Who it's for"}),s.jsx("a",{href:"#faq",children:"FAQ"}),s.jsx(Le,{className:"nav__cta",to:qg,children:"Build my Expert"})]}),s.jsx("button",{className:"nav__burger","aria-label":"Open menu",onClick:()=>t(!0),children:s.jsx(mt,{id:"i-menu",style:{width:"22px",height:"22px"}})})]})}),s.jsx("div",{className:`mobile-menu${e?" is-open":""}`,id:"mobile-menu",role:"dialog","aria-modal":"true",onClick:o=>{o.target===o.currentTarget&&i()},children:s.jsxs("div",{className:"mobile-menu__panel",children:[s.jsxs("div",{className:"mobile-menu__head",children:[s.jsx(Le,{className:"logo",to:"/",onClick:i,children:s.jsx(bn,{variant:"flat",height:28})}),s.jsx("button",{className:"mobile-menu__close","aria-label":"Close menu",onClick:i,children:s.jsx(mt,{id:"i-x",style:{width:"22px",height:"22px"}})})]}),s.jsxs("div",{className:"mobile-menu__links",onClick:i,children:[s.jsx("a",{href:"#why",children:"Why join"}),s.jsx("a",{href:"#what",children:"What it is"}),s.jsx("a",{href:"#moments",children:"Client journey"}),s.jsx("a",{href:"#earn",children:"How you earn"}),s.jsx("a",{href:"#who",children:"Who it's for"}),s.jsx("a",{href:"#faq",children:"FAQ"})]}),s.jsx("div",{className:"mobile-menu__cta",children:s.jsxs(Le,{className:"btn btn--primary btn--full btn--lg",to:qg,onClick:i,children:["Build my assistant",s.jsx(mt,{id:"i-arrow-right",style:{width:"18px",height:"18px"}})]})})]})}),s.jsxs("main",{children:[s.jsx("section",{className:"hero",children:s.jsx("div",{className:"container hero__inner",children:s.jsxs("div",{className:"hero__layout",children:[s.jsxs("div",{children:[s.jsxs("span",{className:"hero__pill",children:[s.jsx("span",{className:"hero__pill-dot",children:s.jsx("svg",{style:{width:"11px",height:"11px"},viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("circle",{cx:"12",cy:"12",r:"6"})})}),s.jsxs("span",{children:["For practitioners ",s.jsx("em",{children:"·"})," live in 30 minutes, no code"]})]}),s.jsxs("h1",{children:[s.jsx("span",{className:"line",children:"You shouldn't trade"}),s.jsxs("span",{className:"line",children:[s.jsx("em",{children:"hours"})," for impact."]})]}),s.jsx("p",{className:"hero__sub",children:"Your wisdom is worth more than your calendar. Build an AI Expert that extends you - answers from your method, holds your boundaries, and sends the hard cases home to you."}),s.jsxs("div",{className:"hero__ctas",children:[s.jsx(Le,{className:"btn btn--primary btn--lg",to:qg,children:"Build my AI Expert"}),s.jsxs("a",{className:"btn btn--soft btn--lg",href:"#what",children:["See how it works",s.jsx(mt,{id:"i-arrow-down",style:{width:"16px",height:"16px"}})]})]}),s.jsxs("div",{className:"hero__meta",children:[s.jsxs("span",{children:[s.jsx(mt,{id:"i-check"})," No coding"]}),s.jsxs("span",{children:[s.jsx(mt,{id:"i-check"})," Launch in 30 minutes"]}),s.jsxs("span",{children:[s.jsx(mt,{id:"i-check"})," Keep 70% of earnings"]}),s.jsxs("span",{children:[s.jsx(mt,{id:"i-check"})," Available 24/7"]}),s.jsxs("span",{children:[s.jsx(mt,{id:"i-check"})," Replies in any language"]})]})]}),s.jsxs("aside",{className:"hero__preview","aria-label":"Sample assistant exchange",children:[s.jsxs("div",{className:"hero__preview-head",children:[s.jsx("div",{className:"hero__preview-avatar",children:"M"}),s.jsxs("div",{className:"hero__preview-meta",children:[s.jsx("div",{className:"hero__preview-name",children:"Maya â Somatic Therapy Expert"}),s.jsx("div",{className:"hero__preview-role",children:"Trained on Maya's protocols"})]}),s.jsx("span",{className:"hero__preview-status",children:"Online"})]}),s.jsxs("div",{className:"hero__msg hero__msg--user",children:[s.jsx("div",{className:"hero__msg-bubble",children:"It's 11:42pm. I'm spiralling about the conversation tomorrow with my mom. Help."}),s.jsx("div",{className:"hero__msg-time",children:"Sun · 11:42 PM"})]}),s.jsxs("div",{className:"hero__msg hero__msg--assistant",children:[s.jsx("div",{className:"hero__msg-bubble",children:"I hear you. Before we plan, let's settle the body. Try the 4-7-8 breath we worked on in our second session â feet flat, hand on belly. Three rounds. Then come back and tell me what your body is asking for tonight."}),s.jsxs("span",{className:"hero__msg-cite",children:[s.jsx(mt,{id:"i-bookmark",style:{width:"11px",height:"11px"}}),'From your "Pre-conflict grounding" protocol']}),s.jsx("div",{className:"hero__msg-time",children:"Sun · 11:42 PM"})]}),s.jsxs("div",{className:"hero__preview-foot",children:[s.jsxs("span",{children:[s.jsx("strong",{children:"You"})," set the boundaries."]}),s.jsx("span",{children:"If urgent â human handoff"})]})]})]})})}),s.jsx("section",{className:"trust","aria-label":"Built for",children:s.jsx("div",{className:"container trust__row",children:s.jsxs("div",{className:"trust__group",children:[s.jsx("span",{className:"trust__label",children:"Built for"}),s.jsxs("div",{className:"trust__pills",children:[s.jsxs("span",{className:"trust__pill",children:[s.jsx(mt,{id:"i-leaf"}),"Wellness practitioners"]}),s.jsxs("span",{className:"trust__pill",children:[s.jsx(mt,{id:"i-compass"}),"Coaches"]}),s.jsxs("span",{className:"trust__pill",children:[s.jsx(mt,{id:"i-heart"}),"Therapists"]}),s.jsxs("span",{className:"trust__pill",children:[s.jsx(mt,{id:"i-flower"}),"Healers"]}),s.jsxs("span",{className:"trust__pill",children:[s.jsx(mt,{id:"i-graduation"}),"Educators"]}),s.jsxs("span",{className:"trust__pill",children:[s.jsx(mt,{id:"i-briefcase"}),"Consultants"]}),s.jsxs("span",{className:"trust__pill",children:[s.jsx(mt,{id:"i-mic"}),"Podcasters"]})]})]})})}),s.jsx("section",{className:"section",id:"why",children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"why",children:[s.jsxs("div",{className:"why__copy",children:[s.jsx("span",{className:"eyebrow",children:"Why practitioners join"}),s.jsxs("h2",{className:"h-section",children:["You were never meant to reach ",s.jsx("em",{children:"just one room."})]}),s.jsx("p",{className:"lede",children:"Right now, you only earn when everything lines up: a client books, you show up live, your calendar has space, your energy holds. That's a fragile system, and it puts a ceiling on how far your wisdom can reach."}),s.jsx("p",{className:"lede",style:{marginTop:"16px"},children:"Great Experts changes that. Your knowledge gets a way to show up when you can't."}),s.jsx("p",{className:"lede",style:{marginTop:"16px"},children:"And it reaches people who needed you, but could never book you due to different timezone, different language, different budget."})]}),s.jsxs("div",{className:"why__panels",children:[s.jsxs("div",{className:"why__panel why__panel--was",children:[s.jsx("span",{className:"why__panel-tag",children:"Was"}),s.jsx("h4",{children:"Your wisdom, trapped in time."}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx(mt,{id:"i-clock"}),s.jsx("span",{children:"Income only when a client books"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-clock"}),s.jsx("span",{children:"Only when you show up live"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-clock"}),s.jsx("span",{children:"Only when calendar has space"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-clock"}),s.jsx("span",{children:"Only when your energy is high"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-clock"}),s.jsx("span",{children:"Only when you're actively working"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-clock"}),s.jsx("span",{children:"Only in your language"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-clock"}),s.jsx("span",{children:"Only in your time zone"})]})]})]}),s.jsxs("div",{className:"why__panel why__panel--now",children:[s.jsx("span",{className:"why__panel-tag",children:"Now"}),s.jsx("h4",{children:"Your wisdom, available anytime"}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),s.jsx("span",{children:"Between sessions â at the moment of need"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),s.jsx("span",{children:"After programs end â integration support"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),s.jsx("span",{children:"While you sleep, travel, rest"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),s.jsx("span",{children:"When you're fully booked"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),s.jsx("span",{children:"Around the world, in any language"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),s.jsx("span",{children:"To anyone, anywhere in the world"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),s.jsx("span",{children:"In their language, not just yours"})]})]})]})]})]}),s.jsxs("div",{className:"why__quotes",children:[s.jsx(aH,{text:s.jsxs(s.Fragment,{children:["I explored it for the first time and by the end of the week I already knew â this is the thing I wished I'd had when I started. A way to share my knowledge with clients, ",s.jsx("span",{className:"serif",children:"in their language,"})," even when I'm not there."]}),attribution:"â Vanda do Nascimento, Behavioral Management Therapist and Mindfulness Teacher · 25 yrs in practice",avatarSrc:"/practitioners/vanda-portrait.jpeg",avatarAlt:"Vanda do Nascimento"}),s.jsx(aH,{text:s.jsxs(s.Fragment,{children:["What impressed me most is how human the experience can feel when experts are trained with depth, intention, and real healing frameworks. It gives creators the ability to build experiences that truly reflect their ",s.jsx("span",{className:"serif",children:"voices, methodology, and philosophy."})]}),attribution:"â Shahnaz Hassan, Human Behavior & Emotional Dynamics · 20 yrs in practice",avatarSrc:"/practitioners/shahnaz-portrait.png",avatarAlt:"Shahnaz Hassan"})]})]})}),s.jsx("section",{className:"section section--paper",id:"what",children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head",children:[s.jsx("span",{className:"eyebrow",children:"What it is"}),s.jsxs("h2",{className:"h-section",style:{maxWidth:"none",whiteSpace:"nowrap"},children:["Build your own ",s.jsxs("em",{children:["AI Expert",s.jsx("span",{style:{color:"rgb(20, 20, 19)"},children:" - a digital version of YOU"})]}),"."]}),s.jsx("p",{className:"lede",style:{maxWidth:"980px"},children:"Upload the materials you already use. The Expert learns your approach and responds in alignment with your philosophy. No coding. No technical setup. No team required."})]}),s.jsxs("div",{className:"what",children:[s.jsx("div",{className:"what__copy",children:s.jsxs("ul",{className:"what__points",children:[s.jsxs("li",{children:[s.jsx("span",{className:"what__point-num",children:"i."}),s.jsxs("div",{className:"what__point-body",children:[s.jsx("strong",{children:"It learns from what you've already written."}),s.jsx("p",{children:"Your worksheets. Your meditations. Your therapy tools, coaching frameworks, PDFs, course lessons, client resources, journals, scripts, video and audio transcripts. Whatever holds your method."})]})]}),s.jsxs("li",{children:[s.jsx("span",{className:"what__point-num",children:"ii."}),s.jsxs("div",{className:"what__point-body",children:[s.jsx("strong",{children:"It answers in your voice â only from what you taught it."}),s.jsx("p",{children:"Outside scope, it says so. No invented advice. No internet paraphrase. The reputation you've spent years building is never compromised by a hallucinated answer."})]})]}),s.jsxs("li",{children:[s.jsx("span",{className:"what__point-num",children:"iii."}),s.jsxs("div",{className:"what__point-body",children:[s.jsx("strong",{children:"It enhances your practice â it doesn't replace it."}),s.jsx("p",{children:"This is support technology. The hard calls still come to you. Your Expert carries the structured, recurring work â so you have more energy for the moments that need a human."})]})]}),s.jsxs("li",{children:[s.jsx("span",{className:"what__point-num",children:"iv."}),s.jsxs("div",{className:"what__point-body",children:[s.jsx("strong",{children:"You can change anything, anytime."}
1385),s.jsx("p",{children:"Add a new protocol. Tighten a boundary. Update a script. Your Expert updates with you - not with us. Your method is a living document, and it stays that way."})]})]}),s.jsxs("li",{children:[s.jsx("span",{className:"what__point-num",children:"v."}),s.jsxs("div",{className:"what__point-body",children:[s.jsx("strong",{children:"It speaks every language â so your reach has no borders."}),s.jsx("p",{children:"Your clients don't need to speak your language to benefit from your expertise. Your Expert responds in whatever language they write in â your knowledge, delivered to anyone, anywhere."})]})]})]})}),s.jsxs("aside",{className:"uploads","aria-label":"Sample upload list",children:[s.jsxs("div",{className:"uploads__head",children:[s.jsx("div",{className:"uploads__title",children:"Maya's knowledge library"}),s.jsx("div",{className:"uploads__count",children:"42 files · 218 MB"})]}),s.jsxs("div",{className:"uploads__list",children:[s.jsxs("div",{className:"uploads__item",children:[s.jsx("span",{className:"uploads__icon uploads__icon--pdf",children:"PDF"}),s.jsxs("div",{className:"uploads__name",children:["Somatic intake protocol â v3",s.jsx("small",{children:"14 pages · indexed 2 days ago"})]}),s.jsx("span",{className:"uploads__check",children:s.jsx(mt,{id:"i-check"})})]}),s.jsxs("div",{className:"uploads__item",children:[s.jsx("span",{className:"uploads__icon uploads__icon--doc",children:"DOC"}),s.jsxs("div",{className:"uploads__name",children:["Pre-session prep worksheet",s.jsx("small",{children:"4 pages · used by 87% of clients"})]}),s.jsx("span",{className:"uploads__check",children:s.jsx(mt,{id:"i-check"})})]}),s.jsxs("div",{className:"uploads__item",children:[s.jsx("span",{className:"uploads__icon uploads__icon--yt",children:"YT"}),s.jsxs("div",{className:"uploads__name",children:["Polyvagal foundations · 8-part series",s.jsx("small",{children:"YouTube · CC enabled · auto-transcribed"})]}),s.jsx("span",{className:"uploads__check",children:s.jsx(mt,{id:"i-check"})})]}),s.jsxs("div",{className:"uploads__item",children:[s.jsx("span",{className:"uploads__icon uploads__icon--doc",children:"DOC"}),s.jsxs("div",{className:"uploads__name",children:["Client progress check-in template",s.jsx("small",{children:"2 pages · used after every session"})]}),s.jsx("span",{className:"uploads__check",children:s.jsx(mt,{id:"i-check"})})]}),s.jsxs("div",{className:"uploads__item",children:[s.jsx("span",{className:"uploads__icon uploads__icon--note",children:"TXT"}),s.jsxs("div",{className:"uploads__name",children:['"If client says X, answer Y" â 60 cases',s.jsx("small",{children:"your decision rules"})]}),s.jsx("span",{className:"uploads__check",children:s.jsx(mt,{id:"i-check"})})]}),s.jsxs("div",{className:"uploads__item",children:[s.jsx("span",{className:"uploads__icon uploads__icon--pdf",children:"PDF"}),s.jsxs("div",{className:"uploads__name",children:["Integration prompts (after-session)",s.jsx("small",{children:"52 prompts"})]}),s.jsx("span",{className:"uploads__check",children:s.jsx(mt,{id:"i-check"})})]}),s.jsxs("div",{className:"uploads__item",children:[s.jsx("span",{className:"uploads__icon uploads__icon--pdf",children:"PDF"}),s.jsxs("div",{className:"uploads__name",children:["Somatic release sequences",s.jsx("small",{children:"12 protocols · session guides"})]}),s.jsx("span",{className:"uploads__check",children:s.jsx(mt,{id:"i-check"})})]})]}),s.jsxs("div",{className:"uploads__foot",children:[s.jsxs("span",{children:[s.jsx("strong",{children:"Drag & drop"})," · auto-indexed in seconds"]}),s.jsx("span",{className:"uploads__foot-status",children:"Live · v1.4"})]})]})]})]})}),s.jsx("section",{className:"section",id:"different",children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head section__head--center",children:[s.jsx("span",{className:"eyebrow",children:"Why this is different"}),s.jsxs("h2",{className:"h-section h-section--center",children:["Generic AI gives generic answers.",` 1386`,s.jsx("em",{children:"Your Expert gives yours."})]}),s.jsx("p",{className:"lede",children:"ChatGPT, Claude and most AI tools pull from broad public knowledge. That can be useful â but it's not your method, not your philosophy, not your client process."})]}),s.jsxs("div",{className:"diff",children:[s.jsxs("div",{className:"diff__col diff__col--generic",children:[s.jsxs("div",{className:"diff__head",children:[s.jsx("span",{className:"diff__icon",children:s.jsx(mt,{id:"i-globe"})}),s.jsx("h3",{className:"diff__title",children:"Generic AI"})]}),s.jsx("p",{className:"diff__lede",children:"Pulls from the open web. Confident, agreeable, sometimes right. No idea who you are or what you teach."}),s.jsxs("ul",{className:"diff__list",children:[s.jsxs("li",{children:[s.jsx(mt,{id:"i-no"}),"Trained on the public internet"]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-no"}),"No knowledge of your method"]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-no"}),"Will invent advice when uncertain"]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-no"}),'Tone is "everyone" â not yours']}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-no"}),"Doesn't know your boundaries"]})]}),s.jsxs("div",{className:"diff__sample",children:[s.jsx("span",{className:"diff__sample-tag",children:"Same question, ChatGPT"}),'"Anxiety can be managed through deep breathing, exercise, and mindfulness. You may also wish to consider speaking with a licensed therapist."']})]}),s.jsxs("div",{className:"diff__col diff__col--yours",children:[s.jsxs("div",{className:"diff__head",children:[s.jsx("span",{className:"diff__icon",children:s.jsx(mt,{id:"i-spark"})}),s.jsxs("h3",{className:"diff__title",children:["Your ",s.jsx("em",{children:"Expert"})]})]}),s.jsx("p",{className:"diff__lede",children:"Answers only from what you uploaded. In your voice, your framing, your sequencing. The next best thing to you, in the moment."}),s.jsxs("ul",{className:"diff__list",children:[s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),"Trained on ",s.jsx("strong",{children:"your frameworks"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),"Speaks in your ",s.jsx("strong",{children:"tone and in any language"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),"Stays inside your ",s.jsx("strong",{children:"scope and ethics"})]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),"Refers to human you when needed"]}),s.jsxs("li",{children:[s.jsx(mt,{id:"i-check"}),"Cites the chapter, lesson, or note it pulled from"]})]}),s.jsxs("div",{className:"diff__sample",children:[s.jsx("span",{className:"diff__sample-tag",children:"SAME QUESTION, MAYA'S EXPERT"}),`"Before we name it 'anxiety' â let's locate it. Where in your body does it live tonight? In our work we treat the sensation as the doorway. Once we know the doorway, I can walk you through the sequence we used last Tuesday."`]})]})]})]})}),s.jsx("section",{className:"section section--cream-deep",id:"moments",children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head section__head--center",children:[s.jsx("span",{className:"eyebrow",children:"Support clients between sessions"}),s.jsxs("h2",{className:"h-section h-section--center",style:{maxWidth:"22ch",fontSize:"clamp(34px, 5vw, 64px)",fontWeight:400,width:"860px"},children:["Imagine every client accessing your guidance when they need it most. ",s.jsx("em",{children:"In any language. Any time zone."})]}),s.jsx("p",{className:"lede",children:"Three moments your Expert holds â so the work doesn't end when the call does, and doesn't start cold the next time you meet."})]}),s.jsxs("div",{className:"moments",children:[s.jsxs("article",{className:"moment moment--before reveal",children:[s.jsxs("div",{className:"moment__head",children:[s.jsx("h3",{className:"moment__when",children:"Before sessions"}),s.jsx("span",{className:"moment__time",children:"â intake & prep"})]}),s.jsxs("ul",{className:"moment__list",children:[s.jsxs("li",{children:[s.jsx("span",{className:"moment__list-icon",children:s.jsx(mt,{id:"i-edit"})}),s.jsxs("div",{className:"moment__list-body",children:[s.jsx("strong",{children:"Intake & assessment"}),"Walks new clients through your standard intake â at their pace, in their words."]})]}),s.jsxs("li",{children:[s.jsx("span",{className:"moment__list-icon",children:s.jsx(mt,{id:"i-compass"})}),s.jsxs("div",{className:"moment__list-body",children:[s.jsx("strong",{children:"Understanding your method"}),`"What is somatic work? What should I expect?" Answered the way you'd answer it.`]})]}),s.jsxs("li",{children:[s.jsx("span",{className:"moment__list-icon",children:s.jsx(mt,{id:"i-bookmark"})}),s.jsxs("div",{className:"moment__list-body",children:[s.jsx("strong",{children:"Topic preparation"}),"Helps clients arrive with what they want to bring â not blank, not overwhelmed."]})]})]}),s.jsxs("div",{className:"moment__sample",children:[s.jsx("span",{className:"moment__sample-q",children:"A client asks"}),`"I've never done this work before. What if I freeze up in the first session?"`]})]}),s.jsxs("article",{className:"moment moment--between reveal",children:[s.jsxs("div",{className:"moment__head",children:[s.jsx("h3",{className:"moment__when",children:"Between sessions"}),s.jsx("span",{className:"moment__time",children:"â the hardest hours"})]}),s.jsxs("ul",{className:"moment__list",children:[s.jsxs("li",{children:[s.jsx("span",{className:"moment__list-icon",children:s.jsx(mt,{id:"i-anchor"})}),s.jsxs("div",{className:"moment__list-body",children:[s.jsx("strong",{children:"Grounding tools"}),"Your protocols delivered in the moment â not from memory, not from Google."]})]}),s.jsxs("li",{children:[s.jsx("span",{className:"moment__list-icon",children:s.jsx(mt,{id:"i-feather"})}),s.jsxs("div",{className:"moment__list-body",children:[s.jsx("strong",{children:"Journaling prompts"}),"Reflection scaffolds that line up with what the client is actually working through."]})]}),s.jsxs("li",{children:[s.jsx("span",{className:"moment__list-icon",children:s.jsx(mt,{id:"i-target"})}),s.jsxs("div",{className:"moment__list-body",children:[s.jsx("strong",{children:"Accountability check-ins"}),'"How did the practice go this week?" â gentle, on cadence, never nagging.']})]})]}),s.jsxs("div",{className:"moment__sample",children:[s.jsx("span",{className:"moment__sample-q",children:"A client asks at 11pm"}),`"I'm triggered right now. What grounding tool would help?"`]})]}),s.jsxs("article",{className:"moment moment--after reveal",children:[s.jsxs("div",{className:"moment__head",children:[s.jsx("h3",{className:"moment__when",children:"After sessions"}),s.jsx("span",{className:"moment__time",children:"â integration"})]}),s.jsxs("ul",{className:"moment__list",children:[s.jsxs("li",{children:[s.jsx("span",{className:"moment__list-icon",children:s.jsx(mt,{id:"i-leaf"})}),s.jsxs("div",{className:"moment__list-body",children:[s.jsx("strong",{children:"Integration prompts"}),'"What do I want to carry forward from today?" â guided, in your sequencing.']})]}),s.jsxs("li",{children:[s.jsx("span",{className:"moment__list-icon",children:s.jsx(mt,{id:"i-clock"})}),s.jsx("div",{className:"moment__list-body",children:"Reminders & habit support Practice cues, gentle nudges. The Expert remembers what you assigned."})]}),s.jsxs("li",{children:[s.jsx("span",{className:"moment__list-icon",children:s.jsx(mt,{id:"i-route"})}),s.jsxs("div",{className:"moment__list-body",children:[s.jsx("strong",{children:"Next-step guid
1386ance"}),"Points to the right module, the right worksheet, the right reflection â never invents."]})]})]}),s.jsxs("div",{className:"moment__sample",children:[s.jsx("span",{className:"moment__sample-q",children:"A client asks the next morning"}),`"What should I integrate from yesterday's session?"`]})]})]}),s.jsx("p",{className:"moments-note",children:`And for new leads â "Is this practitioner right for me?" â the Expert builds trust, answers honestly, and points them to your booking link when they're ready.`})]})}),s.jsx("section",{className:"section",id:"earn",children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head",children:[s.jsx("span",{className:"eyebrow",children:"Earn beyond 1:1 sessions"}),s.jsxs("h2",{className:"h-section",style:{maxWidth:"none"},children:["Your wisdom should create income ",s.jsx("em",{children:"beyond your hours, your borders, your language."})]}),s.jsx("p",{className:"lede",children:"Same Expert, several gentle ways for it to support your practice financially. Pick the ones that fit your shape â none, one, or all."})]}),s.jsxs("div",{className:"earn",children:[s.jsxs("div",{className:"earn__card reveal",children:[s.jsx("span",{className:"earn__icon",children:s.jsx(mt,{id:"i-key"})}),s.jsxs("h3",{children:["Paid AI ",s.jsx("em",{children:"access"})]}),s.jsx("p",{children:"Users pay to consult your Expert directly. Full access â your protocols, your tools, your library â without booking time on your calendar."}),s.jsxs("div",{className:"earn__example",children:[s.jsx("strong",{children:"$9â$29/mo"})," · self-serve · for people who want your method but don't need (or can't afford) 1:1"]})]}),s.jsxs("div",{className:"earn__card reveal",children:[s.jsx("span",{className:"earn__icon",children:s.jsx(mt,{id:"i-heart"})}),s.jsxs("h3",{children:["Monthly ",s.jsx("em",{children:"membership"})]}),s.jsx("p",{children:"Ongoing access for subscribers â your existing clients, your community, your alumni. The space holds them between programs and after they finish."}),s.jsxs("div",{className:"earn__example",children:[s.jsx("strong",{children:"$19â$49/mo"})," · the soft container after the structured work ends"]})]}),s.jsxs("div",{className:"earn__card reveal",children:[s.jsx("span",{className:"earn__icon",children:s.jsx(mt,{id:"i-package"})}),s.jsxs("h3",{children:["Program ",s.jsx("em",{children:"enhancement"})]}),s.jsx("p",{children:"Bundle the Expert inside your courses, retreats or coaching containers. The work continues between sessions â your students retain more, you scale further."}),s.jsxs("div",{className:"earn__example",children:[s.jsx("strong",{children:"Course + Expert"})," · raises completion rates and word-of-mouth"]})]}),s.jsxs("div",{className:"earn__card reveal",children:[s.jsx("span",{className:"earn__icon",children:s.jsx(mt,{id:"i-wand"})}),s.jsxs("h3",{children:["Warm lead ",s.jsx("em",{children:"generation"})]}),s.jsx("p",{children:"Let new visitors experience your value before booking. Three free exchanges, then the Expert introduces your 1:1 work â only when it's the right fit."}),s.jsxs("div",{className:"earn__example",children:[s.jsx("strong",{children:"Free preview"})," · converts cold visitors into qualified, pre-briefed leads"]})]})]}),s.jsx("div",{className:"stack-note",children:s.jsxs("div",{className:"stack-note__inner",children:[s.jsx("span",{className:"stack-note__icon",children:s.jsx(mt,{id:"i-spark"})}),s.jsxs("p",{style:{width:"787.312px"},children:["Every visitor gets 20 free questions - no sign-up friction, no pitch. Just a real taste of what it's like to have you in their corner.",` 1387 1388`,"When they're ready for more, they subscribe. One month of unlimited access to you, starting at $7.49. You set the price. You keep 70%."]})]})}),s.jsxs("div",{className:"honest",children:[s.jsxs("h4",{children:[s.jsx(mt,{id:"i-info"}),"What we don't promise"]}),s.jsx("p",{className:"honest__lede",children:"Honesty before hype â here's where we stop short."}),s.jsxs("ul",{children:[s.jsxs("li",{children:["This isn't passive.",` 1389`,"A good Expert takes care to set up â and care to maintain. We help, but the wisdom is yours to tend."]}),s.jsxs("li",{children:["Discovery isn't guaranteed.",`
1390`,"If you have an audience, your Expert earns from day one. If you don't, it's a longer build â and that's honest."]}),s.jsxs("li",{children:["You won't replace your 1:1.",` 1391`,"The Expert extends your practice â it doesn't compete with the relationship clients book you for."]}),s.jsxs("li",{children:["No magic earnings number.",` 1392`,"Revenue depends on your audience, price, and how well-tuned your Expert is. We won't pretend otherwise."]})]})]})]})}),s.jsx("section",{className:"section section--paper",children:s.jsx("div",{className:"container",children:s.jsxs("div",{className:"safety",children:[s.jsxs("div",{className:"safety__copy",children:[s.jsx("span",{className:"eyebrow",children:"Safe, ethical, under your control"}),s.jsxs("h2",{className:"h-section",children:["Built for professionals who care about ",s.jsx("em",{children:"trust."})]}),s.jsx("p",{children:"You decide what your Expert can and cannot do. The defaults are conservative â designed for people whose reputation depends on the answer being right, or honest about not knowing."}),s.jsxs("p",{children:["This is ",s.jsx("strong",{children:"support technology"}),", not a replacement for human care. Crisis routing, scope refusals, and human handoff are first-class features â not afterthoughts."]}),s.jsx("p",{children:"If you're a known practitioner â your name is protected. No one can build an Expert in your likeness without your consent. Takedown on request, no questions asked."})]}),s.jsxs("aside",{className:"boundaries","aria-label":"Sample boundary panel",children:[s.jsxs("div",{className:"boundaries__head",children:[s.jsx("div",{className:"boundaries__title",children:"Boundaries · Maya's Expert"}),s.jsx("span",{className:"boundaries__hint",children:"Your dashboard"})]}),s.jsxs("ul",{className:"boundaries__list",children:[s.jsxs("li",{className:"boundaries__row",children:[s.jsx("span",{className:"boundaries__row-icon",children:s.jsx(mt,{id:"i-no"})}),s.jsxs("span",{className:"boundaries__row-text",children:[s.jsx("strong",{children:"No diagnosis"}),s.jsx("small",{children:"Refuses to label conditions or interpret symptoms"})]}),s.jsx("span",{className:"boundaries__toggle"})]}),s.jsxs("li",{className:"boundaries__row",children:[s.jsx("span",{className:"boundaries__row-icon",children:s.jsx(mt,{id:"i-phone"})}),s.jsxs("span",{className:"boundaries__row-text",children:[s.jsx("strong",{children:"Crisis support routing"}),s.jsx("small",{children:"If keywords detected â handoff to human + hotlines"})]}),s.jsx("span",{className:"boundaries__toggle"})]}),s.jsxs("li",{className:"boundaries__row",children:[s.jsx("span",{className:"boundaries__row-icon",children:s.jsx(mt,{id:"i-no"})}),s.jsxs("span",{className:"boundaries__row-text",children:[s.jsx("strong",{children:"No medical claims"}),s.jsx("small",{children:"Defers to licensed professionals; never prescribes"})]}),s.jsx("span",{className:"boundaries__toggle"})]}),s.jsxs("li",{className:"boundaries__row",children:[s.jsx("span",{className:"boundaries__row-icon",children:s.jsx(mt,{id:"i-users"})}),s.jsxs("span",{className:"boundaries__row-text",children:[s.jsx("strong",{children:'"Refer to human" triggers'}),s.jsx("small",{children:"Trauma anniversaries, processing stuck loops, family violence"})]}),s.jsx("span",{className:"boundaries__toggle"})]}),s.jsxs("li",{className:"boundaries__row",children:[s.jsx("span",{className:"boundaries__row-icon",children:s.jsx(mt,{id:"i-target"})}),s.jsxs("span",{className:"boundaries__row-text",children:[s.jsx("strong",{children:"Stay within method"}),s.jsx("small",{children:"Polyvagal + IFS only. No CBT, no parts w
1392ork outside your scope."})]}),s.jsx("span",{className:"boundaries__toggle"})]}),s.jsxs("li",{className:"boundaries__row",children:[s.jsx("span",{className:"boundaries__row-icon",children:s.jsx(mt,{id:"i-anchor"})}),s.jsxs("span",{className:"boundaries__row-text",children:[s.jsx("strong",{children:"Maintain professional limits"}),s.jsx("small",{children:"No counter-transference roleplay, no late-night dependence loops"})]}),s.jsx("span",{className:"boundaries__toggle"})]})]}),s.jsxs("p",{className:"boundaries__foot",children:[s.jsx("strong",{children:"Defaults are conservative."})," Loosen what fits your practice. Tighten what doesn't. The boundaries you set are visible to your client at the start of every session."]})]})]})})}),s.jsx("section",{className:"section section--paper",children:s.jsx("div",{className:"container",children:s.jsxs("div",{className:"sovereign",children:[s.jsxs("div",{className:"sovereign__copy",children:[s.jsx("span",{className:"eyebrow",children:"Your knowledge stays yours"}),s.jsxs("h2",{className:"h-section",children:["Your ",s.jsx("em",{children:"life's work"})," remains protected."]}),s.jsx("p",{children:"We do not train public AI models on your materials. Your uploads remain private, owned by you, used only for your Expert, removable anytime. Your expertise is your asset â and we treat it that way."}),s.jsx("p",{style:{fontSize:"15px",color:"var(--ink-muted)"},children:"Written into our terms. Verifiable in your dashboard. Honored on the day you decide to leave. Private means private. Not disclosable to anyone â not even by subpoena."})]}),s.jsxs("div",{className:"sovereign__pledges",children:[s.jsxs("div",{className:"sovereign__pledge",children:[s.jsx("span",{className:"sovereign__pledge-icon",children:s.jsx(mt,{id:"i-lock"})}),s.jsx("h4",{children:"Private by default"}),s.jsx("p",{children:"End-to-end encrypted at rest. Your library is visible only to you and your Expert."})]}),s.jsxs("div",{className:"sovereign__pledge",children:[s.jsx("span",{className:"sovereign__pledge-icon",children:s.jsx(mt,{id:"i-eye-off"})}),s.jsx("h4",{children:"No model training"}),s.jsx("p",{children:"Your uploads never train competing experts, public AI models, or our own foundation systems."})]}),s.jsxs("div",{className:"sovereign__pledge",children:[s.jsx("span",{className:"sovereign__pledge-icon",children:s.jsx(mt,{id:"i-key"})}),s.jsx("h4",{children:"You own it"}),s.jsx("p",{children:"Every protocol, prompt, recording, transcript. Yours on day one. Yours when you leave."})]}),s.jsxs("div",{className:"sovereign__pledge",children:[s.jsx("span",{className:"sovereign__pledge-icon",children:s.jsx(mt,{id:"i-trash"})}),s.jsx("h4",{children:"Removable, on demand"}),s.jsx("p",{children:"Export everything as a clean archive. Then we delete â no shadow copies, no retention drama."})]})]})]})})}),s.jsx("section",{className:"section",id:"who",children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head",children:[s.jsx("span",{className:"eyebrow",children:"Who this is for"}),s.jsxs("h2",{className:"h-section",style:{maxWidth:"none",whiteSpace:"nowrap"},children:["Six practices we see ",s.jsx("em",{children:"over and over."})]}),s.jsx("p",{className:"lede",children:"Pick the one closest to you. The build is the same; the value, language and ethics are different."})]}),s.jsxs("div",{className:"archetypes",children:[s.jsxs("article",{className:"arche arche--wellness reveal",children:[s.jsx("span",{className:"arche__icon",children:s.jsx(mt,{id:"i-leaf"})}),s.jsxs("div",{className:"arche__body",children:[s.jsx("h3",{className:"arche__role",children:"Wellness practitioners"}),s.jsx("p",{className:"arche__sub",children:"Extend your healing work beyond the appointment. Recovery, ritual, repetition â all carry forward."}),s.jsx("p",{className:"arche__use",children:"Post-treatment integration, seasonal protocols, gentle reminders for the daily practice."})]})]}),s.jsxs("article",{className:"arche arche--coach reveal",children:[s.jsx("span",{className:"arche__icon",children:s.jsx(mt,{id:"i-compass"})}),s.jsxs("div",{className:"arche__body",children:[s.jsx("h3",{className:"arche__role",children:"Coaches"}),s.jsxs("p",{className:"arche__sub",children:["Deliver daily coaching ",s.jsx("em",{children:"without"})," daily calls. Your method, repeatable. Your energy, conserved."]}),s.jsx("p",{className:"arche__use",children:"Accountability cadence, frameworks on demand, integration after every milestone."})]})]}),s.jsxs("article",{className:"arche arche--therapist reveal",children:[s.jsx("span",{className:"arche__icon",children:s.jsx(mt,{id:"i-heart"})}),s.jsxs("div",{className:"arche__body",children:[s.jsx("h3",{className:"arche__role",children:"Therapists"}),s.jsx("p",{className:"arche__sub",children:"Support clients between sessions. Hold the space when 11pm comes and you're not there."}),s.jsx("p",{className:"arche__use",children:"Grounding protocols, journaling prompts, between-session check-ins. Crisis routing built in."})]})]}),s.jsxs("article",{className:"arche arche--educator reveal",children:[s.jsx("span",{className:"arche__icon",children:s.jsx(mt,{id:"i-graduation"})}),s.jsxs("div",{className:"arche__body",children:[s.jsx("h3",{className:"arche__role",children:"Educators & mentors"}),s.jsx("p",{className:"arche__sub",children:"Turn your teachings into accessible support â for students who need clarification at midnight, in any language."}
1392),s.jsx("p",{className:"arche__use",children:"Lesson re-explainers, prerequisite check, bilingual support. Yours, not Wikipedia's."})]})]}),s.jsxs("article",{className:"arche arche--consultant reveal",children:[s.jsx("span",{className:"arche__icon",children:s.jsx(mt,{id:"i-briefcase"})}),s.jsxs("div",{className:"arche__body",children:[s.jsx("h3",{className:"arche__role",children:"Consultants & specialists"}),s.jsx("p",{className:"arche__sub",children:"Scale expertise without more meetings. The first triage layer for the work that doesn't need a full hour."}),s.jsx("p",{className:"arche__use",children:"Playbook answers, jurisdiction-specific guidance, qualified handoff for the complex cases."})]})]}),s.jsxs("article",{className:"arche arche--podcaster reveal",children:[s.jsx("span",{className:"arche__icon",children:s.jsx(mt,{id:"i-mic"})}),s.jsxs("div",{className:"arche__body",children:[s.jsx("h3",{className:"arche__role",children:"Podcasters"}),s.jsx("p",{className:"arche__sub",children:"You've said it already â somewhere. Now your listeners can find it, any time, in any language."}),s.jsx("p",{className:"arche__use",children:"Back catalogue search, episode context, listener support between releases."})]})]})]})]})}),s.jsx("section",{className:"section section--paper",children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head section__head--center",children:[s.jsx("span",{className:"eyebrow",children:"Imagine this"}),s.jsxs("h2",{className:"h-section h-section--center",children:["A different sentence in your ",s.jsx("em",{children:"own mouth."})]})]}),s.jsxs("div",{className:"imagine",children:[s.jsxs("div",{className:"imagine__cell",children:[s.jsx("span",{className:"imagine__from",children:"Instead of"}),s.jsx("p",{className:"imagine__from-text",children:'"I only earn when I work."'}),s.jsx("span",{className:"imagine__to",children:"You say"}),s.jsx("p",{className:"imagine__to-text",children:"My knowledge earns every day, every hour, non-stop."})]}),s.jsxs("div",{className:"imagine__cell",children:[s.jsx("span",{className:"imagine__from",children:"Instead of"}),s.jsx("p",{className:"imagine__from-text",children:`"I'm fully booked and exhausted."`}),s.jsx("span",{className:"imagine__to",children:"You say"}),s.jsx("p",{className:"imagine__to-text",children:"My clients are supported between sessions."})]}),s.jsxs("div",{className:"imagine__cell",children:[s.jsx("span",{className:"imagine__from",children:"Instead of"}),s.jsx("p",{className:"imagine__from-text",children:'"I keep repeating the same advice."'}),s.jsx("span",{className:"imagine__to",children:"You say"}),s.jsx("p",{className:"imagine__to-text",children:"My method scales â and stays mine."})]})]})]})}),s.jsx("section",{className:"section",children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head section__head--center",children:[s.jsx("span",{className:"eyebrow",children:"How it works"}),s.jsxs("h2",{className:"h-section h-section--center",children:["Three steps. ",s.jsx("em",{children:"No code."})," Live in under an hour."]})]}),s.jsxs("div",{className:"steps",children:[s.jsxs("div",{className:"step reveal",children:[s.jsxs("div",{className:"step__n",children:["01",s.jsx("sup",{children:"/ Upload"})]}),s.jsx("h3",{children:"Bring your materials"}),s.jsx("p",{children:"Drag in worksheets, meditations, frameworks, transcripts, voice notes â whatever holds your method. We index it. Your Expert is bound to it. It can't answer outside what you gave it."})]}),s.jsxs("div",{className:"step reveal",children:[s.jsxs("div",{className:"step__n",children:["02",s.jsx("sup",{children:"/ Tune"})]}),s.jsx("h3",{children:"Set scope & voice"}),s.jsx("p",{children:"Define what's in scope and what isn't. Tone notes â warmer, calmer, shorter answers, always ask first. Boundary triggers for crisis language and anything outside your practice. Conservative defaults; loosen as you trust."})]}),s.jsxs("div",{className:"step reveal",children:[s.jsxs("div",{className:"step__n",children:["03",s.jsx("sup",{children:"/ Open"})]}),s.jsx("h3",{children:"Open the doors"}),s.jsx("p",{children:"Share the link with clients. Add it to your existing programs. Embed a free preview on your site. The dashboard shows what people asked, how the Expert answered, how they rated it. You tune weekly."})]})]})]})}),s.jsx("section",{className:"section section--cream-deep",id:"faq",children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"section__head section__head--center",children:[s.jsx("span",{className:"eyebrow",children:"A few questions answered"}),s.jsxs("h2",{className:"h-section h-section--center",children:["The honest answers, ",s.jsx("em",{children:"up front."})]})]}),s.jsxs("div",{className:"faq",children:[s.jsxs("details",{className:"faq__item",open:!0,children:[s.jsxs("summary",{children:[s.jsx("span",{className:"faq__num",children:"01"}),s.jsx("span",{className:"faq__q",children:"Do I need tech skills?"}),s.jsx("span",{className:"faq__chevron",children:s.jsx(mt,{id:"i-chevron-down"})})]}),s.jsx("div",{className:"faq__answer",children:s.jsx("p",{children:"No. If you can upload files to Google Drive, Substack or Notion, you can build your Expert. The whole interface is drag-and-drop and a few prompts. No code, no terminal, no team."})})]}),s.jsxs("details",{className:"faq__item",children:[s.jsxs("summary",{children:[s.jsx("span",{className:"faq__num",children:"02"}),s.jsx("span",{className:"faq__q",children:"How long does setup take?"}),s.jsx("span",{className:"faq__chevron",children:s.jsx(mt,{id:"i-chevron-down"})})]}),s.jsx("div",{className:"faq__answer",children:s.jsx("p",{children:"Most practitioners launch a usable expert in under 30 minutes. If your materials are already organised (PDFs, a few transcripts), expect 30 minutes. If you have hours of un-transcribed audio or video, plan for an afternoon. We auto-transcribe, you tune."})})]}),s.jsxs("details",{className:"faq__item",children:[s.jsxs("summary",{children:[s.jsx("span",{className:"faq__num",children:"03"}),s.jsx("span",{className:"faq__q",children:"Will this replace me?"}),s.jsx("span",{className:"faq__chevron",children:s.jsx(mt,{id:"i-chevron-down"})})]}),s.jsx("div",{className:"faq__answer",children:s.jsx("p",{children:"No. The Expert carries the structured, recurring work â between-session support, intake, integration prompts, FAQ â so you can pour your energy into the moments only a human can hold. Practitioners who use it well find their 1:1 work gets better, not less in demand."})})]}),s.jsxs("details",{className:"faq__item",children:[s.jsxs("summary",{children:[s.jsx("span",{className:"faq__num",children:"04"}),s.jsx("span",{className:"faq__q",children:"Can I edit my Expert later?"}),s.jsx("span",{className:"faq__chevron",children:s.jsx(mt,{id:"i-chevron-down"})})]}),s.jsx("div",{className:"faq__answer",children:s.jsx("p",{children:"Yes â and you should. Update materials, tighten scope, change the tone, add a new boundary, retire a protocol. The Expert updates with you, in real time. Most practitioners spend 20 minutes a week tuning theirs in the first month, then a couple of times a month after."})})]}),s.jsxs("details",{className:"faq__item",children:[s.jsxs("summary",{children:[s.jsx("span",{className:"faq__num",children:"05"}),s.jsx("span",{className:"faq__q",children:"Is it better than ChatGPT?"}),s.jsx("span",{className:"faq__chevron",children:s.jsx(mt,{id:"i-chevron-down"})})]}),s.jsx("div",{className:"faq__answer",children:s.jsx("p",{children:`It's different. ChatGPT is general intelligence trained on the open web. Great Experts is your specialised intelligence trained only on your work. For "what's the capital of France?" â use ChatGPT. For "how does Maya's polyvagal grounding sequence apply to my situation?" â only Maya's Expert can answer that, and answer it the way Maya would.`})})]}),s.jsxs("details",{className:"faq__item",children:[s.jsxs("summary",{children:[s.jsx("span",{className:"faq__num",children:"06"}),s.jsx("span",{className:"faq__q",children:"Is my data safe?"}),s.jsx("span",{className:"faq__chevron",children:s.jsx(mt,{id:"i-chevron-down"})})]}),s.jsx("div",{className:"faq__answer",children:s.jsx("p",{children:"Yes. Your materials are encrypted at rest, visible only to you and your Expert, never used to train any model that isn't yours, and exportable + deletable on demand. The full privacy posture is in our terms; a one-page summary is in your dashboard."})})]}),s.jsxs("details",{className:"faq__item",children:[s.jsxs("summary",{children:[s.jsx("span",{className:"faq__num",children:"07"}),s.jsx("span",{className:"faq__q",children:"What if I have a small audience â or none?"}),s.jsx("span",{className:"faq__chevron",children:s.jsx(mt,{id:"i-chevron-down"})})]}),s.jsx("div",{className:"faq__answer",children:s.jsx("p",{children:"If you have an audie
1392nce, your Expert earns from day one. If you don't, the build is longer â your Expert lives in our public discovery surface, and people find it through their own questions. Niche, well-scoped specialists get discovered faster than generalists. Honest read: this is more leverage if you already have something to leverage."})})]}),s.jsxs("details",{className:"faq__item",children:[s.jsxs("summary",{children:[s.jsx("span",{className:"faq__num",children:"08"}),s.jsx("span",{className:"faq__q",children:"What if my Expert says something off?"}),s.jsx("span",{className:"faq__chevron",children:s.jsx(mt,{id:"i-chevron-down"})})]}),s.jsx("div",{className:"faq__answer",children:s.jsx("p",{children:`You'll see it in the dashboard with the user's rating. Rewrite the answer, add a "say it like this" sample, tighten the relevant boundary, or remove the source it pulled from â all in one place. The Expert learns from your edits. The only bad answer is one you don't see.`})})]})]})]})}),s.jsx("section",{className:"final",children:s.jsx("div",{className:"container",children:s.jsxs("div",{className:"final__inner",children:[s.jsx("span",{className:"final__pill",children:"A new layer for your practice"}),s.jsxs("h2",{children:[s.jsx("span",{style:{color:"rgb(61, 61, 245)"},children:"Your clients need you"}),s.jsx("br",{}),s.jsx("span",{style:{color:"rgb(0, 0, 0)"},children:"more than once a week."})]}),s.jsx("p",{children:"Build your AI Expert trained on your expertise so people can receive support anytime â and your wisdom can grow beyond your calendar."}),s.jsxs("div",{className:"final__ctas",children:[s.jsx(Le,{className:"btn btn--indigo btn--lg",to:qg,children:"Build my Expert now"}),s.jsx(Le,{className:"btn btn--ghost btn--lg",to:rH,children:"See live examples"})]}),s.jsxs("div",{className:"final__meta",children:[s.jsxs("span",{children:[s.jsx(mt,{id:"i-check"})," No coding required"]}),s.jsxs("span",{children:[s.jsx(mt,{id:"i-check"})," Launch in under 30 min"]}),s.jsxs("span",{children:[s.jsx(mt,{id:"i-check"})," Keep 70% of earnings"]}),s.jsxs("span",{children:[s.jsx(mt,{id:"i-check"})," Available 24/7"]}),s.jsxs("span",{children:[s.jsx(mt,{id:"i-check"})," Replies in any language"]})]})]})})})]}),s.jsx("footer",{className:"footer",children:s.jsxs("div",{className:"container",children:[s.jsxs("div",{className:"footer__top",children:[s.jsxs("div",{className:"footer__brand",children:[s.jsx(Le,{className:"logo",to:"/","aria-label":"Great Experts home",children:s.jsx(bn,{variant:"flat",height:40})}),s.jsxs("p",{children:[s.jsx("strong",{children:"Great Experts helps"})," practitioners, coaches and therapists ",s.jsx("strong",{children:"scale trusted support using private AI Experts"})," built from their own knowledge."]})]}),s.jsxs("div",{className:"footer__col",children:[s.jsx("h5",{children:"For practitioners"}),s.jsxs("ul",{children:[s.jsx("li",{children:s.jsx("a",{href:"#why",children:"Why join"})}),s.jsx("li",{children:s.jsx("a",{href:"#what",children:"What it is"})}),s.jsx("li",{children:s.jsx("a",{href:"#earn",children:"How you earn"})}),s.jsx("li",{children:s.jsx("a",{href:"#faq",children:"FAQ"})})]})]}),s.jsxs("div",{className:"footer__col",children:[s.jsx("h5",{children:"Platform"}),s.jsxs("ul",{children:[s.jsx("li",{children:s.jsx(Le,{to:"/dashboard",children:"Great Experts"})}),s.jsx("li",{children:s.jsx(Le,{to:rH,children:"Live examples"})})]})]}),s.jsxs("div",{className:"footer__col",children:[s.jsx("h5",{children:"Company"}),s.jsxs("ul",{children:[s.jsx("li",{children:s.jsx(Le,{to:"/faq",children:"FAQ"})}),s.jsx("li",{children:s.jsx(Le,{to:"/terms",children:"Terms & Conditions"})}),s.jsx("li",{children:s.jsx(Le,{to:"/privacy",children:"Privacy Policy"})})]})]})]}),s.jsx("div",{className:"footer__copy",children:"© 2026 Great Experts · Great Spirits Limited (ADGM)"})]})}),s.jsx("div",{className:"sticky-cta",children:s.jsxs(Le,{className:"btn btn--primary btn--full",to:qg,children:["Build my AI assistant",s.jsx(mt,{id:"i-arrow-right",style:{width:"16px",height:"16px"}})]})})]})}const jlt="6:00 - 7:00 PM",_lt="BST",klt="9:00 - 10:00 PM",Nlt="GST",Elt=Date.UTC(2026,5,30,17,0,0),Slt=Elt,Clt="https://auth.greatexperts.ai/storage/v1/object/public/public-web-videos/Thank%20you%20page%20-%20video%20of%20Soniyaa.mp4",sC=e=>e<10?`0${e}`:`${e}`;function iH(){const e=Slt-Date.now();if(e<=0)return null;const t=Math.floor(e/1e3);return{days:Math.floor(t/86400),hours:sC(Math.floor(t%86400/3600)),mins:sC(Math.floor(t%3600/60)),secs:sC(t%60)}}function Tlt(){const[e,t]=f.useState(iH),[n,r]=f.useState(!1),[a,i]=f.useState(!0),o=f.useRef(null);f.useEffect(()=>{const u=setInterval(()=>{const d=iH();t(d),d||clearInterval(u)},1e3);return()=>clearInterval(u)},[]),f.useEffect(()=>{typeof window<"u"&&typeof window.fbq=="function"&&window.fbq("track","Lead")},[]),f.useEffect(()=>{const u=o.current;if(!u)return;u.volume=1,u.muted=!1;const d=u.play();
1392d&&typeof d.catch=="function"&&d.catch(()=>{u.muted=!0,u.play().catch(()=>{})})},[]);const l=()=>{const u=o.current;u&&(u.muted?(u.muted=!1,u.volume=1,u.play().catch(()=>{}),i(!1)):(u.muted=!0,i(!0)))},c=()=>{const u=o.current;u&&(r(!1),u.currentTime=0,u.muted=!1,u.volume=1,u.play().catch(()=>{}),i(!1))};return s.jsxs("div",{className:"thankyou-page",children:[s.jsx(vs,{title:"Thank you for signing up | Great Experts Masterclass",description:"Your spot is booked for the Great Experts Masterclass. Here's what to expect and how to prepare.",path:"/masterclass/thankyou",noIndex:!0}),s.jsx("div",{className:"glow glow-indigo"}),s.jsx("div",{className:"glow glow-peach"}),s.jsxs("main",{className:"page",children:[s.jsx("a",{href:"/","aria-label":"Great Experts home",children:s.jsx("img",{src:"/brand/logo-flat.svg",alt:"Great Experts",height:"40",className:"logo"})}),s.jsx("div",{className:"logo-clearspace"}),s.jsxs("h1",{className:"headline",children:["Thank you for",s.jsx("br",{}),s.jsx("em",{children:"signing up."})]}),s.jsx("p",{className:"lede",children:"Your spot is booked. We'll send you a reminder email before the session â if you don't see it, please check your spam folder."}),s.jsxs("div",{className:"video video--portrait",children:[s.jsx("video",{ref:o,className:"video-el",src:Clt,playsInline:!0,preload:"auto",muted:a,onLoadedMetadata:()=>{const u=o.current;u&&u.paused&&u.currentTime===0&&(u.currentTime=.1)},onVolumeChange:()=>{const u=o.current;u&&i(u.muted)},onEnded:()=>r(!0)}),!n&&s.jsx("button",{type:"button",className:"video-shield",onClick:l,"aria-label":a?"Unmute video":"Mute video",children:s.jsx("span",{className:"video-mute-icon","aria-hidden":"true",children:a?s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("path",{d:"M11 5 6 9H2v6h4l5 4V5z"}),s.jsx("path",{d:"M23 9l-6 6M17 9l6 6"})]}):s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("path",{d:"M11 5 6 9H2v6h4l5 4V5z"}),s.jsx("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"}),s.jsx("path",{d:"M19 5a9 9 0 0 1 0 14"})]})})}),n&&s.jsxs("button",{type:"button",className:"video-placeholder video-replay",onClick:c,"aria-label":"Replay the welcome video with sound",children:[s.jsx("span",{className:"video-play","aria-hidden":"true",children:s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsx("path",{d:"M8 5v14l11-7z"})})}),s.jsx("span",{className:"video-caption",children:"Replay with sound"})]})]}),s.jsxs("div",{className:"video-cta",children:[s.jsx("p",{className:"video-cta-note",children:"Start exploring Great Experts and create your account now."}),s.jsxs("a",{className:"cta",href:"/experts/new",children:["Check it out",s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M5 12h14"}),s.jsx("path",{d:"M13 6l6 6-6 6"})]})]})]}),s.jsx("hr",{className:"rule"}),s.jsxs("section",{className:"card card-event",children:[s.jsx("p",{className:"eyebrow",children:"Next session"}),s.jsx("h2",{className:"card-title",children:"Great Experts Masterclass"}),s.jsxs("div",{className:"details",children:[s.jsxs("div",{className:"detail-row",children:[s.jsx("span",{className:"detail-icon","aria-hidden":"true",children:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"4.5",width:"18",height:"17",rx:"2"}),s.jsx("path",{d:"M3 9.5h18"}),s.jsx("path",{d:"M8 2.5v4"}),s.jsx("path",{d:"M16 2.5v4"})]})}),s.jsx("span",{className:"detail-text",children:s.jsx("strong",{children:"Tuesday, 30th June 2026"})})]}),s.jsxs("div",{className:"detail-row",children:[s.jsx("span",{className:"detail-icon","aria-hidden":"true",children:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 7v5l3.5 2"})]})}),s.jsxs("span",{className:"detail-text",children:[s.jsx("strong",{children:jlt})," ",s.jsxs("span",{className:"detail-sub",children:["â London (",_lt,") · ",klt," Dubai (",Nlt,", UTC+4)"]})]})]}),s.jsxs("div",{className:"detail-row",children:[s.jsx("span",{className:"detail-icon","aria-hidden":"true",children:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M20 10.5c0 5.5-8 11-8 11s-8-5.5-8-11a8 8 0 0 1 16 0Z"}),s.jsx("circle",{cx:"12",cy:"10.5",r:"2.8"})]})}),s.jsxs("span",{className:"detail-text",children:[s.jsx("strong",{children:"Live on Zoom"})," ",s.jsx("span",{className:"detail-sub",children:"â link will be sent by email"})]})]})]}),s.jsx("div",{className:"countdown",children:e?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"countdown-eyebrow",children:"The Masterclass begins in"}),s.jsxs("div",{className:"countdown-grid",children:[s.jsxs("div",{className:"count-card",children:[s.jsx("div",{className:"count-num",children:e.days}),s.jsx("div",{className:"count-label",children:"Days"})]}),s.jsxs("div",{className:"count-card",children:[s.jsx("div",{className:"count-num",children:e.hours}),s.jsx("div",{className:"count-label",children:"Hours"})]}),s.jsxs("div",{className:"count-card",children:[s.jsx("div",{className:"count-num",children:e.mins}),s.jsx("div",{className:"count-label",children:"Mins"})]}),s.jsxs("div",{className:"count-card",children:[s.jsx("div",{className:"count-num",children:e.secs}),s.jsx("div",{className:"count-label",children:"Secs"})]})]})]}):s.jsx("p",{className:"countdown-live",children:"The session is starting now."})})]}),s.jsxs("section",{className:"card card-prep",children:[s.jsx("p",{className:"eyebrow",children:"Before the session"}),s.jsx("p",{className:"prep-subtitle",children:"Please come prepared â having these ready is what makes the session work for you:"}),s.jsxs("ul",{className:"prep-list",children:[s.jsxs("li",{children:["Your ",s.jsx("strong",{children:"laptop"})," â you'll be working live during the session"]}),s.jsxs("li",{children:["A ",s.jsx("strong",{children:"piece of your teaching"})," â framework, PDF, worksheet or notes"]}),s.jsxs("li",{children:["Your ",s.jsx("strong",{children:"photo"})," â it helps personalise the experience"]}),s.jsxs("li",{children:["A ",s.jsx("strong",{children:"short bio"})," â a few sentences about your background and what you do"]}),s.jsxs("li",{children:["A ",s.jsx("strong",{children:"quiet space"})," + full presence"]})]})]}),s.jsx("p",{className:"footer",children:"great experts · greatexperts.ai"})]})]})}const Alt="/experts/new",Rlt="/masterclass/wellness",Ilt=[{label:"Trained on",them:"Public web data",us:"Only on YOUR teachings, PDFs, frameworks, materials"},{label:"Tone",them:"Generic, universal, bland",us:"YOUR tone"},{label:"When unsure",them:"Hallucinates. Fabricates. Doesn't fact-check.",us:'Says "I donât know"'},{label:"Boundaries",them:"Doesn't know yours",us:"Stays inside YOUR scope and ethics"}
1392,{label:"Reputation",them:"Hidden risk",us:"Reputation-safe by design"},{label:"You earn from it",them:"Never",us:"Yes - Monthly subscriptions, paid access"}],Plt=[{no:"â 01 · It costs you nothing",title:"Setup & hosting",fig:"$0",unit:"to start, forever",keep:!1,items:["No setup fee","No monthly bill","No developer to hire","We only earn when you do"]},{no:"â 02 · Earn monthly",title:"1-on-1 subscription",fig:"from $4.99",unit:"per month",keep:!0,items:["Loyal clients pay monthly","Unlimited access to your Expert","You set the price","Easy billing and payouts"]},{no:"â 03 · Earn per answer",title:"Pay-as-you-go",fig:"$0.088",unit:"per answer",keep:!1,items:["Paid on every question asked","No subscription required","Small amounts that add up fast","Earn passively, around the clock"]}],Llt=["Free to start","No code","Quick setup","Trained only on your work"];function nC({size:e=14,width:t=2.4}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})}function Olt(){return s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--ink-light)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Mlt(){return s.jsxs("div",{className:"why-us-landing-page",style:{position:"fixed",inset:0,overflowY:"auto",overflowX:"hidden",scrollBehavior:"smooth"},children:[s.jsx(vs,{title:"Great Experts vs ChatGPT | Aligned AI for practitioners",description:"ChatGPT answers everything. Great Experts answers like you. The first AI platform trained only on your expertise â built for therapists, coaches and wellness practitioners.",path:"/whyus"}),s.jsx("section",{className:"section hero",children:s.jsxs("div",{className:"wrap",children:[s.jsx("h1",{className:"h1",style:{maxWidth:"20ch",margin:"0 auto 18px",textAlign:"center"},children:s.jsx("span",{className:"line",style:{color:"var(--ink)",fontStyle:"normal"},children:"AI is changing the future of your practice."})}),s.jsx("p",{style:{fontFamily:"var(--f-display)",fontStyle:"italic",fontWeight:400,fontSize:"clamp(24px, 3vw, 38px)",lineHeight:1.2,letterSpacing:"-0.02em",color:"var(--violet)",margin:"0 auto 28px",textAlign:"center"},children:"But generic AI could quietly damage your reputation."}),s.jsxs("p",{className:"lede",style:{margin:"0 auto 48px",maxWidth:760,textAlign:"center"},children:["Most practitioners are experimenting with AI by testing ChatGPT, trying Claude, uploading PDFs and experimenting with prompts, but very few are building AI in a way that truly protects their"," ",s.jsx("strong",{children:"expertise, reputation, and client trust."})]}),s.jsx("div",{className:"hero__venn",style:{maxWidth:560,margin:"0 auto"},children:s.jsxs("svg",{viewBox:"0 0 520 420",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Where Great Experts sits: the overlap of standard AI and a human expert.",children:[s.jsx("circle",{cx:"200",cy:"230",r:"150",fill:"#E6E4DC",fillOpacity:"0.4",stroke:"#86847B",strokeWidth:"1.5"}),s.jsx("circle",{cx:"320",cy:"230",r:"150",fill:"#E6E4DC",fillOpacity:"0.4",stroke:"#86847B",strokeWidth:"1.5"}),s.jsx("clipPath",{id:"heroLeftClip",children:s.jsx("circle",{cx:"200",cy:"230",r:"150"})}),s.jsx("g",{clipPath:"url(#heroLeftClip)",children:s.jsx("circle",{cx:"320",cy:"230",r:"150",fill:"#3D3DF5",fillOpacity:"0.16",stroke:"#3D3DF5",strokeWidth:"1.5"})}),s.jsx("text",{x:"70",y:"40",textAnchor:"start",fontFamily:"JetBrains Mono, ui-monospace, monospace",fontSize:"11",letterSpacing:"2",fill:"#86847B",fontWeight:"500",children:"STANDARD AI"}),s.jsx("text",{x:"70",y:"62",textAnchor:"start",fontFamily:"Inter, system-ui, sans-serif",fontSize:"15",fontWeight:"600",fill:"#141413",children:"ChatGPT, Claude"}),s.jsx("text",{x:"130",y:"215",textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",fontSize:"12",fill:"#4A4945",children:"Answers"}),s.jsx("text",{x:"130",y:"234",textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",fontSize:"12",fill:"#4A4945",children:"everything"}),s.jsx("text",{x:"130",y:"258",textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",fontSize:"12",fontWeight:"600",fill:"#141413",children:"Off-method"}),s.jsx("text",{x:"450",y:"40",textAnchor:"end",fontFamily:"JetBrains Mono, ui-monospace, monospace",fontSize:"11",letterSpacing:"2",fill:"#86847B",fontWeight:"500",children:"HUMAN EXPERT"}),s.jsx("text",{x:"450",y:"62",textAnchor:"end",fontFamily:"Inter, system-ui, sans-serif",fontSize:"15",fontWeight:"600",fill:"#141413",children:"You, today"}),s.jsx("text",{x:"390",y:"215",textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",fontSize:"12",fill:"#4A4945",children:"Personal"}),s.jsx("text",{x:"390",y:"234",textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",fontSize:"12",fill:"#4A4945",children:"but capped"}),s.jsx("text",{x:"390",y:"258",textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",fontSize:"12",fontWeight:"600",fill:"#141413",children:"By the hour"}),s.jsx("text",{x:"260",y:"200",textAnchor:"middle",fontFamily:"JetBrains Mono, ui-monospace, monospace",fontSize:"10",letterSpacing:"1.5",fill:"#3D3DF5",fontWeight:"600",children:"GREAT EXPERTS"}),s.jsx("text",{x:"260",y:"232",textAnchor:"middle",fontFamily:"Fraunces, Georgia, serif",fontSize:"19",fontStyle:"italic",fill:"#3D3DF5",fontWeight:"400",children:"Aligned AI"}),s.jsx("text",{x:"260",y:"258",textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",fontSize:"10.5",fill:"#4A4945",children:"Trained on you"}),s.jsx("text",{x:"260",y:"276",textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",fontSize:"10.5",fill:"#4A4945",children:"24/7"})]})})]})}),s.jsx("section",{className:"section",style:{background:"var(--violet)",borderBottom:0,padding:"36px 0"},children:s.jsx("div",{className:"wrap",children:s.jsxs("div",{className:"compare-head",style:{marginBottom:0},children:[s.jsx("span",{className:"eyebrow",style:{color:"var(--peach)"},children:"This is your chance to be a pioneer"}),s.jsxs("h2",{className:"h2",style:{color:"var(--cream)"},children:[s.jsx("span",{className:"line",children:"AI is not replacing practitioners."}),s.jsx("span",{className:"line",style:{fontFamily:"var(--f-display)",fontStyle:"italic",color:"var(--peach)"},children:"But practitioners who use AI strategically may replace those who donât."})]}),s.jsx("p",{className:"lede",style:{margin:"24px auto 0",textAlign:"center",maxWidth:780,color:"rgba(250, 249, 245, 0.85)"},children:"The best therapist, coach or practitioner will always beat any AI, but only for the few clients who can book them, afford them, and live near them."})]})})}),s.jsx("section",{className:"section",children:s.jsxs("div",{className:"wrap",children:[s.jsxs("div",{className:"compare-head",children:[s.jsx("span",{className:"eyebrow",children:"Intelligent vs aligned"}),s.jsxs("h2",{className:"h2",children:[s.jsx("span",{className:"line",children:"ChatGPT was built to answer everything."}),s.jsx("span",{className:"line accent",children:"Your AI Expert answers only what you taught it."})]}),s.jsxs("p",{className:"lede",style:{margin:"24px auto 0",textAlign:"center",maxWidth:760},children:["Trained only on your frameworks, your boundaries, your voice.",s.jsx("br",{}),"No hallucinations outside your work."]})]}),s.jsxs("div",{className:"cmp",children:[s.jsxs("div",{className:"cmp__row cmp__head",children:[s.jsx("div",{}),s.jsxs("div",{className:"cmp__col",children:["ChatGPT & Claude",s.jsx("span",{className:"cmp__col-sub",children:"Built to be intelligent"})]}),s.jsxs("div",{className:"cmp__col cmp__col--us",children:["Great Experts",s.jsx("span",{className:"cmp__col-sub",children:"Built to be aligned"})]})]}),Ilt.map(e=>s.jsxs("div",{className:"cmp__row",children:[s.jsx("div",{className:"cmp__label",children:e.label}),s.jsxs("div",{className:"cmp__cell",children:[s.jsx(Olt,{}),s.jsx("span",{children:e.them})]}),s.jsxs("div",{className:"cmp__cell cmp__cell--us",children:[s.jsx(nC,{}),s.jsx("span",{children:e.us})]})]},e.label))]})]})}),s.jsx("section",{className:"section",style:{background:"var(--cream-deep)"},children:s.jsxs("div",{className:"wrap",children:[s.jsxs("div",{className:"compare-head",children:[s.jsx("span",{className:"eyebrow",children:"Pricing"}),s.jsxs("h2",{className:"h2",children:[s.jsxs("span",{className:"line",style:{fontSize:74},children:["Free to start. ",s.jsx("span",{className:"accent",style:{fontSize:74},children:"Free to stay."})]}),s.jsxs("span",{className:"line",style:{fontStyle:"normal",color:"var(--ink)",display:"block",marginTop:8,fontSize:50,fontFamily:"var(--f-display)",fontWeight:400,letterSpacing:"-0.015em"},children:["We only earn when"," ",s.jsx("em",{style:{fontFamily:"var(--f-display)",fontStyle:"italic",color:"var(--violet)",fontWeight:400},children:"you"})," ","do."]})]}),s.jsxs("p",{className:"lede",style:{margin:"24px auto 0",textAlign:"center",maxWidth:720},children:["Upload what you know and choose how you want to earn.",s.jsx("br",{}),"One way, or all of them."]})]}),s.jsx("div",{className:"price-grid",children:Plt.map(e=>s.jsxs("article",{className:"pcard",children:[s.jsx("span",{className:"pcard__no",children:e.no}),s.jsx("h3",{className:"pcard__title",children:e.title}),s.jsxs("div",{className:"pcard__fig",children:[e.fig," ",s.jsx("small",{children:e.unit})]}),s.jsx("p",{className:`pcard__keep${e.keep?"":" pcard__keep--ghost"}`,"aria-hidden":e.keep?void 0:"true",children:"you keep 70%"}),s.jsx("ul",{className:"pcard__list",children:e.items.map(t=>s.jsxs("li",{children:[s.jsx(nC,{size:18}),s.jsx("span",{children:t})]},t))})]},e.title))})]})}),s.jsx("section",{className:"section section--no-border closer hero-bg",children:s.jsxs("div",{className:"wrap",children:[s.jsx("span",{className:"eyebrow",children:"The decision"}),s.jsxs("h2",{className:"h2",children:[s.jsx("span",{className:"line",children:"The future is not generic AI."}),s.jsx("span",{className:"line accent",children:"The future is AI trained on trusted expertise."})]}),s.jsx("p",{className:"closer__sub",children:"And the practitioners who build early will have a major advantage."}),s.jsxs("div",{className:"closer__cta-row",children:[s.jsx(Le,{className:"btn btn--primary",to:Alt,children:"Build your AI Expert"}),s.jsx(Le,{className:"btn btn--ghost",to:Rlt,children:"Join our Free Masterclass"})]}),s.jsx("div",{className:"closer__trust",children:Llt.map(e=>s.jsxs("span",{children:[s.jsx(nC,{size:16}),e]},e))})]})}),s.jsx("footer",{className:"site-footer",children:s.jsxs("div",{className:"wrap site-footer__in",children:[s.jsx("span",{className:"site-footer__brand",children:"2026 Great Experts"}),s.jsxs("nav",{className:"site-footer__nav","aria-label":"Footer",children:[s.jsx(Le,{to:"/",children:"Home"}),s.jsx("span",{className:"dot","aria-hidden":"true",children:"·"}),s.jsx(Le,{to:"/forcreators",children:"For creators"}),s.jsx("span",{className:"dot","aria-hidden":"true",children:"·"}),s.jsx(Le,{to:"/forpractitioners",children:"For wellness practitioners"}),s.jsx("span",{className:"dot","aria-hidden":"true",children:"·"}),s.jsx(Le,{to:"/faq",children:"FAQ"}),s.jsx("span",{className:"dot","aria-hidden":"true",children:"·"}),s.jsx(Le,{to:"/pricing",children:"Pricing"}),s.jsx("span",{className:"dot","aria-hidden":"true",children:"·"}),s.jsx(Le,{to:"/terms",children:"Terms & Conditions"}),s.jsx("span",{className:"dot","aria-hidden":"true",children:"·"}),s.jsx(Le,{to:"/privacy",children:"Privacy Policy"})]})]})})]})}function gh({className:e,children:t}){const n=Nc({journey:"business"});return s.jsx(Le,{className:e,to:n.to,onClick:n.onClick,children:t})}function Zk(){return s.jsx("svg",{width:"19",height:"19",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})})}
1392const Dlt=[{n:"01",q:"How is this different from a live chat widget?",a:"Live chat needs someone on the other end, and a standard chatbot answers from the internet. This answers from your materials only, recommends the right product or service, and shows where every answer came from. When it does not know, it hands the person to your team with the question and the contact attached."},{n:"02",q:"Will it interfere with our website?",a:"No. It is one line of code and it sits on top of the site you already have. Nothing to rebuild, nothing to migrate, and it matches your colours and fonts."},{n:"03",q:"Will it invent answers about our prices or our process?",a:"Never. It only answers from what you gave it, and nothing is pulled from the internet. When a question goes past what it knows, it says so and passes the person to your team."},{n:"04",q:"Does it work with our CRM?",a:"Often no integration is needed. If you already have a form or a tool collecting contacts, everything goes into it exactly as you have it set up. Have a special request? Talk to us, we will make it work."},{n:"05",q:"Will our knowledge train a model our competitors can use?",a:"Never. It stays inside your instance and works for you only. It is never sold, never licensed, and you can delete everything at any time."},{n:"06",q:"Where do we put it?",a:"On your website, on any page you want. Or as a standalone page with its own link, for campaigns, emails, LinkedIn and your bio. Most companies do both."}],rC=["Answers 24/7.","Recommends products.","Takes calls.","Captures leads."],r0="https://calendly.com/anna-greatspire/strategy-call",_ie=[["/welcome","For Creators"],["/pricing","Pricing"]],$lt=[..._ie,["#how-it-works","How it works"]];function Q0(e,{duration:t,loop:n=!0,still:r=t,threshold:a=.35}){const[i,o]=B.useState(0),[l,c]=B.useState(!1),[u,d]=B.useState(!1),h=B.useRef(0);return B.useEffect(()=>{const p=window.matchMedia("(prefers-reduced-motion: reduce)"),m=()=>d(p.matches);return m(),p.addEventListener("change",m),()=>p.removeEventListener("change",m)},[]),B.useEffect(()=>{const p=new IntersectionObserver(([m])=>c(m.isIntersecting&&m.intersectionRatio>=a),{threshold:[0,a]});return e.current&&p.observe(e.current),()=>p.disconnect()},[e,a]),B.useEffect(()=>{if(u){h.current=r,o(r);return}if(!l)return;let p,m=null,g=-1/0;const x=b=>{document.hidden?m=null:(m!==null&&(h.current+=b-m),m=b,h.current>=t&&(h.current=n?h.current%t:t),Math.abs(h.current-g)>=60&&(g=h.current,o(g))),(n||h.current<t)&&(p=requestAnimationFrame(x))};return p=requestAnimationFrame(x),()=>cancelAnimationFrame(p)},[l,u,t,n,r]),i}const oH=34;function kie(e,{widgetHeight:t,widgetWidth:n=340,share:r=.52}){const[a,i]=B.useState(!1);return B.useEffect(()=>{const o=e.current,l=new ResizeObserver(()=>{const{width:c,height:u}=o.getBoundingClientRect(),d=c<520;i(d),o.style.setProperty("--site-scale",String(c/(d?420:1100))),o.style.setProperty("--view-w",`${c}px`),o.style.setProperty("--view-h",`${u-oH}px`),o.style.setProperty("--widget-scale",String(Math.min(1,(u-oH-20)/t,c*(d?.9:r)/n)))});return l.observe(o),()=>l.disconnect()},[e,t,n,r]),a}const rn={name:"Fieldhouse",guide:"Fieldhouse Assistant",url:"fieldhousesports.com",logo:"/business/landing/shop-logo.svg",greeting:"Hi! Iâm the Fieldhouse Assistant. Ask me about gear, sizes or delivery.",teaser:"Hi! Need help choosing gear?"},$c=e=>`/business/landing/product-${e}.jpg`,Ta={roadShoes:{title:"Road Running Shoes",price:"$119",image:$c("road-shoes")},trailShoes:{title:"Trail Running Shoes",price:"$139",image:$c("trail-shoes")},racket:{title:"Pro Tennis Racket",price:"$149",image:$c("racket")},tennisBalls:{title:"Tennis Balls, 4-pack",price:"$9",image:$c("tennis-balls")},basketball:{title:"Indoor Basketball",price:"$35",image:$c("basketball")},dumbbells:{title:"Hex Dumbbell Pair",price:"$59",image:$c("dumbbells")},kettlebell:{title:"Cast Iron Kettlebell",price:"$49",image:$c("kettlebell")},duffel:{title:"Gym Duffel Bag",price:"$65",image:$c("duffel")}};function e2(e,t){const n=e.split(" ").slice(0,t).join(" ");return(n.match(/\*\*/g)||[]).length%2?`${n}**`:n}function t2(e){return e.split(" ").length}function s2(e,t,n,r){return t<n?"":e.slice(0,Math.ceil(e.length*Math.min(1,(t-n)/(r-n))))}function Vi({name:e,size:t=16}){const n={phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"}),close:s.jsx("path",{d:"m6 6 12 12M6 18 18 6"}),expand:s.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"}),menu:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),plus:s.jsx("path",{d:"M12 5v14M5 12h14"}),up:s.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),external:s.jsx("path",{d:"M7 7h10v10M7 17 17 7"}),check:s.jsx("path",{d:"m20 6-11 11-5-5"}),lock:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"4",y:"11",width:"16",height:"10",rx:"2"}),s.jsx("path",{d:"M8 11V7a4 4 0 0 1 8 0v4"})]})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]})}function Flt(e){return e.split(/(\*\*[^*]+\*\*)/).map((t,n)=>t.startsWith("**")?s.jsx("strong",{children:t.slice(2,-2)},n):t)}function ya({role:e,text:t,typing:n=!1}){return n?s.jsx("div",{className:"bw-thinking",children:s.jsx(Pk,{size:20})}):s.jsx("div",{className:`bw-msg bw-${e}`,children:Flt(t)})}function pL({product:e}){return s.jsxs("article",{className:"bw-product",children:[s.jsx("img",{src:e.image,alt:"",loading:"lazy"}),s.jsxs("div",{children:[s.jsx("strong",{children:e.title}),s.jsxs("span",{children:[e.price,s.jsxs("em",{children:["View product ",s.jsx(Vi,{name:"external",size:11})]})]})]})]})}function a0({children:e,composer:t="",contact:n=!0,className:r=""}){const a=B.useRef(null);return B.useEffect(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)}),s.jsxs("div",{className:`bw-panel ${r}`,children:[s.jsxs("div",{className:"bw-strip","aria-hidden":"true",children:[s.jsx(Vi,{name:"expand",size:13}),s.jsx(Vi,{name:"close",size:14})]}),s.jsxs("header",{className:"bw-header",children:[s.jsxs("span",{className:"bw-avatar",children:[s.jsx("img",{src:rn.logo,alt:""}),s.jsx("i",{})]}),s.jsxs("div",{className:"bw-name",children:[s.jsx("strong",{children:rn.guide}),s.jsxs("small",{children:["Powered by ",s.jsx("u",{children:"Great Experts"})]})]}),n&&s.jsxs("span",{className:"bw-contact",children:[s.jsx(Vi,{name:"plus",size:13}),"Contact"]}),s.jsx("span",{className:"bw-menu",children:s.jsx(Vi,{name:"menu",size:20})})]}),s.jsx("div",{className:"bw-thread",ref:a,children:e}),s.jsxs("div",{className:`bw-composer ${t?"is-typing":""}`,children:[s.jsx("span",{children:t||"Ask a question..."}),s.jsx("b",{children:s.jsx(Vi,{name:"up",size:14})})]}),s.jsx("p",{className:"bw-legal",children:"AI Chat. Messages and AI replies may be reviewed by this expertâs owner for audience insights."})]})}function Nie({open:e=!1,teaser:t="",tapping:n=!1,callBadge:r=!0}){return s.jsxs("div",{className:"bw-launcher",children:[t&&s.jsxs("div",{className:"bw-teaser",children:[s.jsx("img",{src:rn.logo,alt:""}),s.jsx("span",{children:t}),s.jsx(Vi,{name:"close",size:11})]}),s.jsxs("div",{className:`bw-bubble ${e?"is-open":""} ${n?"is-tapping":""}`,children:[e?s.jsx(Vi,{name:"close",size:22}):s.jsx("img",{src:rn.logo,alt:""}),r&&!e&&s.jsx("span",{className:"bw-call-badge",children:s.jsx(Vi,{name:"phone",size:11})})]})]})}function lH({compact:e}){return s.jsxs("nav",{className:"bs-nav",children:[s.jsxs("b",{className:"bs-logo",children:[s.jsx("img",{src:rn.logo,alt:""}),rn.name]}),e?s.jsx("span",{className:"bs-burger",children:s.jsx(Vi,{name:"menu",size:22})}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"bs-links",children:[s.jsx("span",{children:"Running"}),s.jsx("span",{children:"Training"}),s.jsx("span",{children:"Racket sports"}),s.jsx("span",{children:"Sale"})]}),s.jsx("span",{className:"bs-btn",children:"Shop new arrivals"})]})]})}
1392const Blt=[["roadShoes","Running"],["dumbbells","Training"],["racket","Racket sports"],["basketball","Team sports"]];function Eie({compact:e=!1,page:t="home"}){const n=`bs-site${e?" bs-compact":""}`;return t==="help"?s.jsxs("div",{className:`${n} bs-help`,children:[s.jsx(lH,{compact:e}),s.jsxs("header",{className:"bs-help-head",children:[s.jsx("p",{className:"bs-eyebrow",children:"Questions? Weâre here"}),s.jsxs("h3",{children:["Ask our gear experts ",s.jsx("em",{children:"anything."})]})]})]}):s.jsxs("div",{className:n,children:[s.jsx(lH,{compact:e}),s.jsxs("section",{className:"bs-banner",children:[s.jsx("img",{src:"/business/landing/shop-hero.jpg",alt:""}),s.jsxs("div",{className:"bs-banner-copy",children:[s.jsx("p",{className:"bs-eyebrow",children:"Spring 2026 · New arrivals"}),s.jsxs("h3",{children:["Gear up for",s.jsx("br",{}),s.jsx("em",{children:"every game."})]}),s.jsx("p",{className:"bs-lede",children:"Running, training and racket sports gear, tested by people who play. Free returns, and same-day dispatch before 2 pm."}),s.jsxs("div",{className:"bs-ctas",children:[s.jsx("span",{className:"bs-btn",children:"Shop running"}),s.jsx("span",{className:"bs-ghost",children:"Find your size"})]})]})]}),s.jsx("section",{className:"bs-cats",children:Blt.map(([r,a])=>s.jsxs("figure",{children:[s.jsx("img",{src:Ta[r].image,alt:""}),s.jsx("figcaption",{children:a})]},r))})]})}function Sie({url:e=rn.url,children:t,className:n=""}){return s.jsxs("div",{className:`bz-browser ${n}`,children:[s.jsxs("div",{className:"bz-browser-bar","aria-hidden":"true",children:[s.jsxs("span",{className:"bz-dots",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("span",{className:"bz-url",children:[s.jsx(Vi,{name:"lock",size:10}),e]})]}),s.jsx("div",{className:"bz-browser-view",children:t})]})}const Ult=17e3,cH="Iâm training for my first 10K. Which shoes should I get?",uH="Go for the **Road Running Shoes**, theyâre cushioned and light for longer runs. If you run off-road, the **Trail Running Shoes** grip better.",zlt=[Ta.roadShoes,Ta.trailShoes],Vr={teaser:900,tap:2700,open:3e3,typeFrom:3500,typeTo:5300,sent:5500,think:5800,answerFrom:6600,answerTo:9600,offers:1e4,leave:16200};function Hlt(){const e=B.useRef(null),t=Q0(e,{duration:Ult,still:12e3,threshold:.2}),n=kie(e,{widgetHeight:508}),r=t>=Vr.open&&t<Vr.leave,a=t<Vr.sent?s2(cH,t,Vr.typeFrom,Vr.typeTo):"",i=Math.ceil(t2(uH)*Math.min(1,(t-Vr.answerFrom)/(Vr.answerTo-Vr.answerFrom)));return s.jsx("div",{className:"bz-hero-visual",ref:e,role:"img","aria-label":"An AI Expert chat bubble on a sports store answers a question about running shoes and recommends two products",children:s.jsxs(Sie,{children:[s.jsx("div",{className:"bz-site-scale",children:s.jsx(Eie,{compact:n})}),s.jsxs("div",{className:`bw-root ${r?"is-open":""}`,children:[s.jsxs(a0,{composer:a,className:r?"is-shown":"",children:[s.jsx(ya,{role:"ai",text:rn.greeting}),t>=Vr.sent&&s.jsx(ya,{role:"user",text:cH}),t>=Vr.think&&t<Vr.answerFrom&&s.jsx(ya,{typing:!0}),t>=Vr.answerFrom&&s.jsx(ya,{role:"ai",text:e2(uH,i)}),t>=Vr.offers&&s.jsx("div",{className:"bw-products bw-enter",children:zlt.map(o=>s.jsx(pL,{product:o},o.title))})]}),s.jsx(Nie,{open:r,teaser:t>=Vr.teaser&&t<Vr.open?rn.teaser:"",tapping:t>=Vr.tap&&t<Vr.open})]})]})})}const Bv=9500,qlt=[{id:"bubble",label:"Bubble in the corner"},{id:"inline",label:"Chat inside your page"}],Wlt={bubble:{question:"Do you have the trail shoes in size 10?",answer:"Yes! The **Trail Running Shoes** are in stock in size 10, and orders before 2 pm ship today.",T:{teaser:400,tap:1500,open:1800,typeFrom:2200,typeTo:3500,sent:3700,think:3900,answerFrom:4600,answerTo:6400,offers:6700,leave:9100}},inline:{question:"Can I return shoes if they donât fit?",answer:"Of course. Returns and size exchanges are free within 30 days, and the new pair ships as soon as yours is on its way back.",T:{typeFrom:500,typeTo:2e3,sent:2200,think:2400,answerFrom:3100,answerTo:5400,leave:9100}}};function dH({script:e,t}){const{question:n,answer:r,T:a}=e,i=Math.ceil(t2(r)*Math.min(1,(t-a.answerFrom)/(a.answerTo-a.answerFrom)));return s.jsxs(s.Fragment,{children:[s.jsx(ya,{role:"ai",text:rn.greeting}),t>=a.sent&&s.jsx(ya,{role:"user",text:n}),t>=a.think&&t<a.answerFrom&&s.jsx(ya,{typing:!0}),t>=a.answerFrom&&s.jsx(ya,{role:"ai",text:e2(r,i)}),a.offers&&t>=a.offers&&s.jsx("div",{className:"bw-products bw-enter",children:s.jsx(pL,{product:Ta.trailShoes})})]})}function Vlt(){const e=B.useRef(null),t=B.useRef(null),[n,r]=B.use
1392State(null),a=Q0(e,{duration:Bv*2,still:Bv-1200,threshold:.3}),i=kie(t,{widgetHeight:508}),o=n||(a<Bv?"bubble":"inline"),l=a%Bv,c=Wlt[o],{T:u}=c,d=l<u.leave,h=l<u.sent?s2(c.question,l,u.typeFrom,u.typeTo):"",p=d&&l>=(u.open??0);return s.jsxs("article",{className:"ge-feature-row bz-embed-feature",children:[s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["Your website. ",s.jsx("em",{children:"Now it answers."})]}),s.jsx("p",{children:"Pick a bubble in the corner or a chat inside your page. It matches your colours and works on any website."}),s.jsxs(gh,{children:["Add it to my website ",s.jsx(Zk,{})]})]}),s.jsxs("div",{className:"bz-scene bz-embed-scene",ref:e,children:[s.jsx("div",{className:"bz-mode-switch",role:"tablist","aria-label":"How it sits on your website",children:qlt.map(m=>s.jsx("button",{type:"button",role:"tab","aria-selected":o===m.id,onClick:()=>r(m.id),children:m.label},m.id))}),s.jsx("div",{className:"bz-embed-browser",ref:t,role:"img","aria-label":o==="bubble"?"The chat as a bubble in the corner of the storeâs home page":"The chat inside the storeâs help page",children:s.jsxs(Sie,{url:o==="bubble"?rn.url:`${rn.url}/help`,children:[s.jsx("div",{className:"bz-site-scale",children:s.jsx(Eie,{compact:i,page:o==="bubble"?"home":"help"})}),o==="bubble"?s.jsxs("div",{className:"bw-root",children:[s.jsx(a0,{composer:h,className:p?"is-shown":"",children:s.jsx(dH,{script:c,t:d?l:0})}),s.jsx(Nie,{open:p,teaser:l>=u.teaser&&l<u.open?rn.teaser:"",tapping:l>=u.tap&&l<u.open})]}):s.jsx("div",{className:"bw-inline",children:s.jsx(a0,{composer:h,contact:!1,children:s.jsx(dH,{script:c,t:d?l:0})})})]})})]})]})}function Qc({name:e,size:t=20}){const n={phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"}),mic:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),s.jsx("path",{d:"M5 10v2a7 7 0 0 0 14 0v-2M12 19v3M8 22h8"})]}),micOff:s.jsx(s.Fragment,{children:s.jsx("path",{d:"m2 2 20 20M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V5a3 3 0 0 0-5.94-.6M5 10v2a7 7 0 0 0 12 4.9M19 10v2c0 .67-.09 1.32-.27 1.94M12 19v3M8 22h8"})}),arrow:s.jsx("path",{d:"M4 12h16m-6-6 6 6-6 6"}),external:s.jsx("path",{d:"M7 7h10v10M7 17 17 7"}),chevronRight:s.jsx("path",{d:"m9 6 6 6-6 6"}),chevronLeft:s.jsx("path",{d:"m15 6-6 6 6 6"}),chevronUp:s.jsx("path",{d:"m6 15 6-6 6 6"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.65",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]})}const Pd=1e4,Glt="I need a gift for someone who loves tennis.",Ylt=["The Pro Racket is our top gift.","Add a pack of match balls.","A duffel bag carries the lot.","Iâve shared all three here for you."],Klt=[{at:2400,title:Ta.racket.title,category:Ta.racket.price,image:Ta.racket.image},{at:4e3,title:Ta.tennisBalls.title,category:Ta.tennisBalls.price,image:Ta.tennisBalls.image},{at:5500,title:Ta.duffel.title,category:Ta.duffel.price,image:Ta.duffel.image}],hH=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function Xlt(e,t,n,r=1){const[a,i]=B.useState(0),[o,l]=B.useState(!1),c=B.useRef(0);return B.useEffect(()=>{const u=window.matchMedia("(prefers-reduced-motion: reduce)"),d=()=>l(u.matches);return d(),u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[]),B.useEffect(()=>{c.current=0,i(0)},[n]),B.useEffect(()=>{if(o){c.current=Pd,i(Pd);return}if(!e||t||c.current>=Pd)return;let u,d=null,h=c.current;const p=g=>{document.hidden?d=null:(d!==null&&(c.current=Math.min(Pd,c.current+(g-d)*r)),d=g,(c.current-h>=80||c.current===Pd)&&(h=c.current,i(h))),c.current<Pd&&(u=requestAnimationFrame(p))},m=()=>{d=null};return document.addEventListener("visibilitychange",m),u=requestAnimationFrame(p),()=>{cancelAnimationFrame(u),document.removeEventListener("visibilitychange",m)}},[e,t,n,o,r]),a}function pH({products:e,large:t=!1}){return s.jsx("section",{className:`cf-recommendations ${t?"cf-recommendations-large":""}`,"aria-label":"Profile recommendations",children:e.map(n=>s.jsxs("span",{className:"cf-product-row",children:[s.jsx("span",{className:"cf-product-image",children:s.jsx("img",{src:n.image,alt:""})}),s.jsxs("span",{className:"cf-product-info",children:[s.jsx("strong",{children:n.title}),s.jsx("span",{children:n.category})]}),s.jsx(Qc,{name:"external",size:t?18:16})]},n.title))})}function mH({device:e,active:t,onComplete:n,onEnd:r,playbackRate:a=1}){const[i,o]=B.useState(!1),[l,c]=B.useState(!1),[u,d]=B.useState(0),[h,p]=B.useState(null),[m,g]=B.use
1392State(!0),x=Xlt(t,l,u,a),b=B.useRef(!1);B.useEffect(()=>{b.current=!1},[u]),B.useEffect(()=>{x>=Pd&&n&&!b.current&&(b.current=!0,n())},[x,n]);const y=x>=1750&&x<8200,v=x>=1200&&x<1750,w=l?[]:Klt.filter(T=>x>=T.at),j=w.length>0,E=j&&(h===null?x>=5e3:h),S=x<3200?0:x<4800?1:x<6500?2:3,_=Glt.split(" ").slice(0,Math.max(1,Math.floor(x/100))).join(" "),k=258-Math.floor(x/1e3),C=B.useRef(null),N=e==="phone";B.useEffect(()=>{const T=C.current,I=()=>T.style.setProperty("--call-scale",T.clientWidth/(N?390:1040));I();const $=new ResizeObserver(I);return $.observe(T),()=>$.disconnect()},[N]);const A=()=>{c(!1),o(!1),p(null),g(!0),d(T=>T+1)};return s.jsx("div",{className:`cf-device-screen ${N?"cf-screen-phone":"cf-screen-laptop"}`,ref:C,children:s.jsxs("div",{className:`cf-call-ui ${l?"cf-ended":""} ${i?"cf-muted":""} ${j?"cf-has-offers":""} ${y?"cf-speaking":v?"cf-thinking":"cf-listening"}`,role:"group","aria-label":`AI voice call preview on ${e}`,children:[s.jsxs("div",{className:"cf-call-main",children:[s.jsxs("header",{className:"cf-call-header",children:[s.jsxs("div",{className:"cf-identity",children:[s.jsxs("span",{children:[s.jsx("img",{src:rn.logo,alt:""}),s.jsx("i",{"aria-hidden":"true"})]}),s.jsx("strong",{children:rn.name})]}),s.jsxs("div",{className:"cf-time",children:[s.jsx(Qc,{name:"phone",size:14}),!l&&s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16","aria-hidden":"true",children:[s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"#e8e6dc",strokeWidth:"2.5"}),s.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"#3d3df5",strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${k/300*40.8} 40.8`,transform:"rotate(-90 8 8)"})]}),s.jsx("span",{children:l?hH(42+Math.floor(x/1e3)):`${hH(k)} remaining`})]})]}),s.jsxs("div",{className:"cf-call-stage",children:[s.jsxs("div",{className:"cf-avatar-stage",children:[s.jsxs("div",{className:"cf-aura","aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("div",{className:"cf-avatar",children:[s.jsx("i",{className:"cf-avatar-halo","aria-hidden":"true"}),s.jsx("i",{className:"cf-avatar-ring","aria-hidden":"true"}),s.jsx("i",{className:"cf-avatar-ripple","aria-hidden":"true"}),s.jsx("img",{src:rn.logo,alt:rn.name})]})]}),s.jsx("p",{className:"cf-call-status",role:"status",children:l?"Call ended":i?"Microphone off":y?"Speaking":v?"Thinking":"Listening"}),s.jsx("div",{className:"cf-transcript",children:!l&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"cf-question",children:["You · ",_]}),x>=1750&&s.jsx("div",{className:"cf-captions","aria-label":"Call transcript",children:s.jsx("div",{className:"cf-caption-track",style:{transform:`translateY(${(1-S)*32.8}px)`},children:Ylt.map((T,I)=>s.jsx("span",{className:I===S?"is-current":"","aria-current":I===S?"true":void 0,children:T},T))})})]})})]}),N&&j&&s.jsxs("button",{className:"cf-offers-bar",onClick:()=>p(!0),"aria-expanded":E,children:[s.jsx("span",{className:"cf-offer-thumbs",children:w.map(T=>s.jsx("span",{children:s.jsx("img",{src:T.image,alt:""})},T.title))}),s.jsxs("strong",{children:[w.length," mentioned in this call"]}),s.jsx(Qc,{name:"chevronUp",size:16})]}),s.jsx("footer",{className:"cf-call-controls",children:l?s.jsxs("button",{className:"cf-call-again",onClick:A,children:[s.jsx(Qc,{name:"phone",size:16}),"Call again"]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`cf-mute ${i?"is-muted":""}`,onClick:()=>o(!i),"aria-pressed":i,"aria-label":i?"Unmute microphone":"Mute microphone",children:s.jsx(Qc,{name:i?"micOff":"mic"})}),s.jsxs("button",{className:"cf-end",onClick:()=>r?r():c(!0),children:[s.jsx(Qc,{name:"phone",size:16}),"End call"]})]})})]}),!N&&j&&(m?s.jsxs("aside",{className:"cf-offers-panel","aria-label":"Mentioned during this call",children:[s.jsxs("div",{className:"cf-offers-heading",children:[s.jsx("h3",{children:"Mentioned in this call"}),s.jsx("span",{children:w.length}),s.jsx("button",{onClick:()=>g(!1),"aria-label":"Collapse recommendations",children:s.jsx(Qc,{name:"chevronRight",size:16})})]}),s.jsx(pH,{products:w,large:!0})]}):s.jsxs("button",{className:"cf-offers-tab",onClick:()=>g(!0),"aria-label":`Show ${w.length} mentioned in this call`,"aria-expanded":!1,children:[s.jsx(Qc,{name:"chevronLeft",size:16}),w.slice(-2).map(T=>s.jsx("img",{src:T.image,alt:""}
1392,T.title)),s.jsx("span",{children:w.length})]})),N&&E&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"cf-offers-backdrop",onClick:()=>p(!1),"aria-label":"Back to the call"}),s.jsxs("div",{className:"cf-offers-sheet",role:"dialog","aria-modal":"false","aria-label":"Mentioned in this call",onKeyDown:T=>{T.key==="Escape"&&p(!1)},children:[s.jsx("button",{className:"cf-sheet-handle",onClick:()=>p(!1),"aria-label":"Close recommendations",children:s.jsx("span",{})}),s.jsxs("div",{className:"cf-offers-heading",children:[s.jsx("h3",{children:"Mentioned in this call"}),s.jsx("span",{children:w.length})]}),s.jsx(pH,{products:w})]})]})]})})}function Jlt(){const e=B.useRef(null),t=B.useRef(null),[n,r]=B.useState(!1);return B.useEffect(()=>{const a=new IntersectionObserver(([c])=>r(c.isIntersecting&&c.intersectionRatio>=.4),{threshold:[0,.4],rootMargin:"-90px 0px 0px"});e.current&&a.observe(e.current);const i=t.current,o=()=>i.style.setProperty("--phone-scale",i.clientWidth/356);o();const l=new ResizeObserver(o);return l.observe(i),()=>{a.disconnect(),l.disconnect()}},[]),s.jsx("div",{className:"cf-showcase",children:s.jsx("div",{className:`cf-scene ${n?"cf-visible":""}`,ref:e,"aria-label":"Voice calls on laptop and phone",children:s.jsxs("div",{className:"cf-devices",children:[s.jsxs("div",{className:"cf-laptop",children:[s.jsx("div",{className:"cf-laptop-display",children:s.jsx(mH,{device:"laptop",active:n})}),s.jsx("img",{className:"cf-laptop-frame",src:"/welcome/assets/device-frames/macbook-pro-14-space-black.png",alt:"","aria-hidden":"true",draggable:"false"})]}),s.jsx("div",{className:"cf-phone",ref:t,children:s.jsxs("div",{className:"cf-phone-device",children:[s.jsx("span",{className:"cf-phone-side cf-phone-silent","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-volume-up","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-volume-down","aria-hidden":"true"}),s.jsx("span",{className:"cf-phone-side cf-phone-power","aria-hidden":"true"}),s.jsxs("div",{className:"cf-phone-display",children:[s.jsx(mH,{device:"phone",active:n}),s.jsx("div",{className:"cf-phone-home","aria-hidden":"true",children:s.jsx("span",{})})]})]})})]})})})}const Qlt=16e3,fH="I want to start training at home. What do I need?",gH="Start with the **Hex Dumbbell Pair** for strength work. Add the **Cast Iron Kettlebell** for full-body sessions.",xH=["dumbbells","kettlebell"],bH=["roadShoes","dumbbells","racket","kettlebell","basketball"],Oi={typeFrom:700,typeTo:2400,sent:2600,think:2900,answerFrom:3600,answerTo:6e3,offers:6400,leave:15400};function Zlt(){const e=B.useRef(null),t=Q0(e,{duration:Qlt,still:9e3});B.useEffect(()=>{const o=e.current,l=()=>{const{width:u,height:d}=o.getBoundingClientRect(),h=u<560;o.dataset.narrow=h?"true":"false",o.style.setProperty("--rec-scale",String(Math.min(h?u/340:u/900,d/640)))},c=new ResizeObserver(l);return c.observe(o),l(),()=>c.disconnect()},[]);const n=t<Oi.leave,r=t<Oi.sent?s2(fH,t,Oi.typeFrom,Oi.typeTo):"",a=Math.ceil(t2(gH)*Math.min(1,(t-Oi.answerFrom)/(Oi.answerTo-Oi.answerFrom))),i=n&&t>=Oi.offers;return s.jsxs("article",{className:"ge-feature-row bz-rec-feature",children:[s.jsx("div",{className:"bz-scene bz-rec-scene",ref:e,role:"img","aria-label":"A shopper on a phone asks what they need to train at home, and the AI Expert recommends two of the storeâs products",children:s.jsxs("div",{className:"bz-rec-canvas",children:[s.jsxs("section",{className:"bz-offers","aria-hidden":"true",children:[s.jsxs("header",{children:[s.jsx("strong",{children:"Your products"}),s.jsxs("span",{children:[bH.length," live"]})]}),s.jsx("ul",{children:bH.map(o=>{const l=Ta[o],c=i&&xH.includes(o);return s.jsxs("li",{className:c?"is-picked":"",children:[s.jsx("img",{src:l.image,alt:""}),s.jsxs("span",{children:[s.jsx("b",{children:l.title}),s.jsx("small",{children:l.price})]}),c?s.jsxs("em",{children:[s.jsx(Vi,{name:"check",size:11}),"Recommended"]}):s.jsx("i",{})]},o)})})]}),s.jsx("div",{className:"bz-phone",children:s.jsx("div",{className:"bz-phone-screen",children:s.jsxs(a0,{composer:r,className:"bw-full",contact:!1,children:[s.jsx(ya,{role:"ai",text:rn.greeting}),n&&t>=Oi.sent&&s.jsx(ya,{role:"user",text:fH}),n&&t>=Oi.think&&t<Oi.answerFrom&&s.jsx(ya,{typing:!0}),n&&t>=Oi.answerFrom&&s.jsx(ya,{role:"ai",text:e2(gH,a)}),i&&s.jsx("div",{className:"bw-products bw-enter",children:xH.map(o=>s.jsx(pL,{product:Ta[o]},o))})]})})})]})}),s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["Finds ",s.jsx("em",{children:"the right product."})]}),s.jsx("p",{children:"Nobody reads your whole catalogue to work out what fits. It listens, picks the match and links straight to it."}),s.jsxs(gh,{children:["Add your products ",s.jsx(Zk,{})]})]})]})}const n_=[{id:1,name:"Emily Parker",time:"12 min ago",status:"New",ready:"Ready to buy",source:"Team orders page",topic:"School team order",email:"[email protected]",summary:"Coaches a school basketball team and needs 15 balls and training bibs before the season starts.",message:"Hi, I coach a school team. Could we get 15 indoor basketballs and bibs at a team price?",question:"Do you offer discounts for school teams?",answer:"Yes, team and school orders of 10 or more get a team price. Send a contact request and the team can quote you.",offering:"Team & school orders",price:"From 10 items"},{id:2,name:"James Wilson",time:"38 min ago",status:"New",ready:"Exploring options",source:"Running page",topic:"Running shoes",email:"[email protected]",summary:"Training for a half marathon and comparing road and trail shoes before choosing.",message:"Most of my long runs are on roads, with some par
1392k trails. Which should I pick?",question:"Which shoes are best for a half marathon?",answer:"The Road Running Shoes are cushioned and light for long distances. If part of the route is off-road, the Trail Running Shoes grip better.",offering:"Road Running Shoes",price:"$119"},{id:3,name:"Sophie Bennett",time:"2 hours ago",status:"Contacted",ready:"Ready to buy",source:"Homepage",topic:"Birthday gift",email:"[email protected]",summary:"Buying a tennis racket for her sonâs birthday and needs it delivered by Saturday.",message:"Itâs for my sonâs birthday on Saturday. Can it get here in time?",question:"Can a racket arrive by Saturday?",answer:"Order before 2 pm for same-day dispatch. Express delivery arrives in 1 to 2 days.",offering:"Pro Tennis Racket",price:"$149"},{id:4,name:"Alex Morgan",time:"8 days ago",status:"New",ready:"Ready to talk",source:"Homepage",topic:"Gym fit-out",email:"[email protected]",summary:"Opening a small gym and wants dumbbells, kettlebells and mats for 40 members.",message:"Weâre opening a gym for 40 members. Can you supply the free weights?",question:"Do you supply equipment for gyms?",answer:"Yes, the store fits out gyms and studios. Send a contact request with your space and numbers so the team can put a quote together.",offering:"Gym fit-out",price:"Work together"},{id:5,name:"Daniel Reed",time:"12 days ago",status:"Closed",ready:"Exploring options",source:"Returns page",topic:"Size exchange",email:"[email protected]",summary:"Asked how to swap his trail shoes for half a size up.",message:"Thanks, the exchange went through and the new pair fits.",question:"Can I swap my shoes for a bigger size?",answer:"Of course. Exchanges are free within 30 days, and the new pair ships as soon as yours is on its way back.",offering:"Trail Running Shoes",price:"$139 · Free exchanges"}];function ect({phase:e,onPause:t,onCapture:n,onPreviewNote:r}){const[a,i]=B.useState(!1),[o,l]=B.useState(null),[c,u]=B.useState("[email protected]"),[d,h]=B.useState(!0),[p,m]=B.useState(""),[g,x]=B.useState([]),[b,y]=B.useState(!0),[v,w]=B.useState(!1),j=B.useRef(null),E=B.useRef(null);B.useEffect(()=>{l(null),i(!1),e===0&&(u("[email protected]"),h(!0),m(""),x([]))},[e]);const S=o||(e===2?"form":e===3?"sent":"chat");B.useEffect(()=>{j.current&&j.current.scrollTo({top:j.current.scrollHeight,behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"})},[e,g]);const _=(T,I=20)=>{const $={menu:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),plus:s.jsx("path",{d:"M12 5v14M5 12h14"}),close:s.jsx("path",{d:"m6 6 12 12M6 18 18 6"}),check:s.jsx("path",{d:"m20 6-11 11-5-5"}),mail:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),s.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),up:s.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})};return s.jsx("svg",{width:I,height:I,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:T==="menu"?1.35:1.85,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:$[T]})},k=()=>{t(),i(!1),h(!1),l("form")},C=()=>{t(),l("chat")},N=()=>{p.trim()&&(t(),x(T=>[...T,{role:"user",text:p.trim()},{role:"ai",text:"To reach the store team, use Contact in the menu to send your details and conversation."}]),m(""))},A=d&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c);return s.jsxs("aside",{ref:E,className:`lc-shell ${v?"lc-expanded":""}`,"aria-label":"Chat with the Fieldhouse Assistant â demonstration",onPointerDownCapture:t,onFocusCapture:t,children:[s.jsxs("header",{className:"lc-header",inert:S!=="chat"?"":void 0,children:[s.jsx("img",{src:rn.logo,alt:rn.name}),s.jsxs("div",{className:"lc-name",children:[s.jsx("strong",{children:rn.guide}),s.jsxs("small",{children:["Powered by ",s.jsx("a",{href:"https://greatexperts.ai",target:"_blank",rel:"noopener noreferrer",children:"Great Experts"})]})]}),s.jsx("button",{className:"lc-icon",type:"button","aria-label":"Conversation menu","aria-expanded":a,onClick:()=>i(!a),children:_("menu",26)})]}),s.jsxs("div",{className:"lc-body",inert:S!=="chat"?"":void 0,children:[s.jsxs("div",{className:"lc-thread",ref:j,children:[s.jsx("div",{className:"lc-message lc-ai",children:rn.greeting}),b&&e>=0&&s.jsx("div",{className:"lc-message lc-user",children:"Do you offer discounts for school teams?"}),b&&e>=1&&s.jsx("div",{className:"lc-message lc-ai",children:"Yes, team and school orders of 10 or more get a team price. Send a contact request and the team can quote you."}),g.map((T,I)=>s.jsx("div",{className:`lc-message lc-${T.role}`,children:T.text},I))]}),s.jsx("div",{className:"lc-compose",children:s.jsxs("div",{className:"lc-composer",children:[s.jsx("button",{className:"lc-icon",type:"button","aria-label":"Attach files",onClick:()=>r("Attachments are available in the full product."),children:_("plus")}),s.jsx("textarea",{rows:"1","aria-label":"Demo message",placeholder:"Ask anything...",maxLength:"2000",value:p,onChange:T=>m(T.target.value),onKeyDown:T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),N())}}),p.trim()?s.jsx("button",{type:"button",className:"lc-send","aria-label":"Send demo message",onClick:N,children:_("up",18)}):s.jsxs("button",{type:"button",className:"lc-call","aria-label":"Start a voice call with this AI expert",onClick:()=>r("Voice calls are available in the full product."),children:[_("phone",17),"Call"]})]})}),a&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"lc-menu-scrim",type:"button","aria-label":"Close conversation menu",onClick:()=>i(!1)}),s.jsxs("aside",{className:"lc-menu","aria-label":"Conversations",children:[s.jsx("button",{className:"lc-menu-action",onClick:k,children:"Contact"}),s.jsx("button",{className:"lc-menu-action",onClick:()=>{w(!v),i(!1)},children:v?"Exit full screen":"Expand"}),s.jsx("h4",{children:"Conversations"}),s.jsxs("button",{className:"lc-menu-new",onClick:()=>{i(!1),y(!1),x([]),m("")},children:[_("plus",17),"New conversation"]}),s.jsx("button",{className:"lc-history-item",onClick:()=>{i(!1),y(!0)},children:"School team order"})]})]})]}),(S==="form"||S==="sent")&&s.jsxs("div",{className:"lc-modal-wrap",children:[s.jsx("button",{className:"lc-modal-shade",type:"button","aria-label":"Close contact request",onClick:C}),s.jsxs("section",{className:"lc-modal",role:"dialog","aria-label":S==="sent"?"Request sent":"Send a contact request",onKeyDown:T=>{T.key==="Escape"&&C()},children:[s.jsx("button",{className:"lc-modal-close","aria-label":"Close contact form",type:"button",onClick:C,children:_("close")}),S==="form"?s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"Send a contact request"}),s.jsxs("form",{onSubmit:T=>{T.preventDefault(),A&&(n(c),l("sent"))},children:[s.jsxs("label",{className:"lc-email",children:[_("mail",16),s.jsx("input",{"aria-label":"Contact request email",type:"email",autoComplete:"off",placeholder:"Email",value:c,onChange:T=>u(T.target.value),required:!0})]}),s.jsxs("label",{className:"lc-consent",children:[s.jsx("input",{type:"checkbox",checked:d,onChange:T=>h(T.target.checked)}),s.jsx("span",{className:"lc-check-box","aria-hidden":"true",children:_("check",14)}),s.jsxs("span",{children:["I am 18+ and agree to the ",s.jsx("a",{href:"https://greatexperts.ai/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"})," and ",s.jsx("a",{href:"https://greatexperts.ai/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),", and to share my contact details and conversation with Fieldhouse."]}
1392)]}),s.jsx("button",{className:"lc-contact-submit",type:"submit",disabled:!A,children:"Send a contact request"})]})]}):s.jsxs("div",{className:"lc-sent",children:[s.jsx("span",{className:"lc-sent-check",children:_("check")}),s.jsx("h3",{children:"Request sent"}),s.jsx("p",{children:"Thanks for reaching out. The Fieldhouse team will get back to you soon."}),s.jsxs("p",{className:"lc-reply-email",children:["The reply will go to ",s.jsx("strong",{children:c.trim()}),"."]}),s.jsx("div",{children:s.jsx("button",{type:"button",className:"lc-done",onClick:C,children:"Done"})})]})]})]})]})}const Cie=["New","Contacted","Replied","Not replied","Booked a call","Not relevant"],tct=[["1","Today"],["7","7 days"],["30","30 days"],["all","All time"]],aC=[["insights","Insights"],["conversations","Conversations"],["leads","Leads"]];function wi({name:e,size:t=16}){const n={search:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"10",cy:"10",r:"6"}),s.jsx("path",{d:"m15 15 5 5"})]}),download:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),chevron:s.jsx("path",{d:"m9 5 7 7-7 7"}),down:s.jsx("path",{d:"m6 9 6 6 6-6"}),spark:s.jsx("path",{d:"m12 3 2.5 6.5L21 12l-6.5 2.5L12 21l-2.5-6.5L3 12l6.5-2.5Z"}),mail:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),s.jsx("path",{d:"m3 7 9 6 9-6"})]}),clock:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 7v5l3 2"})]}),message:s.jsx("path",{d:"M21 11.5a8.4 8.4 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.4 8.4 0 0 1-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.4 8.4 0 0 1 3.8-.9h.5a8.5 8.5 0 0 1 8 8v.5Z"}),bot:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"4",y:"7",width:"16",height:"13",rx:"3"}),s.jsx("path",{d:"M12 3v4M9 12v2m6-2v2M2 12h2m16 0h2"})]}),source:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"m16 8-3 5-5 3 3-5Z"})]}),file:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),s.jsx("path",{d:"M14 2v6h6M8 13h8m-8 4h8"})]}),phone:s.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72l.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45l2.81.7A2 2 0 0 1 22 16.92z"})};return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n[e]||n.message})}function Tie({value:e,onChange:t,label:n}){return s.jsxs("label",{className:"lp-search",children:[s.jsx(wi,{name:"search"}),s.jsx("input",{type:"search","aria-label":n,placeholder:n,value:e,onChange:r=>t(r.target.value)})]})}function sct({value:e,onChange:t,options:n,label:r}){const[a,i]=B.useState(!1),o=B.useRef(null);return B.useEffect(()=>{if(!a)return;const l=c=>{o.current?.contains(c.target)||i(!1)};return document.addEventListener("pointerdown",l),()=>document.removeEventListener("pointerdown",l)},[a]),s.jsxs("div",{className:"lp-select",ref:o,onKeyDown:l=>{l.key==="Escape"&&i(!1)},children:[s.jsxs("button",{type:"button","aria-label":r,"aria-expanded":a,"aria-haspopup":"listbox",onClick:()=>i(!a),children:[n.find(l=>l[0]===e)?.[1],s.jsx(wi,{name:"down"})]}),a&&s.jsx("div",{className:"lp-options",role:"listbox","aria-label":r,children:n.map(([l,c])=>s.jsxs("button",{type:"button",role:"option","aria-selected":l===e,onClick:()=>{t(l),i(!1)},children:[c,l===e&&s.jsx("span",{children:"â"})]},l))})]})}function nct({captured:e,selected:t,setSelected:n,query:r,setQuery:a,expert:i,setExpert:o}){const[l,c]=B.useState(!1),[u,d]=B.useState([]),[h,p]=B.useState(!1),m=n_.filter(b=>`${b.question} ${b.summary} ${rn.guide}`.toLowerCase().includes(r.toLowerCase())),g=m.find(b=>b.id===t)||m[0],x=g&&s.jsxs("article",{className:"lp-conversation-detail",children:[s.jsxs("header",{className:"lp-card-header",children:[s.jsxs("div",{children:[s.jsx("h4",{children:g.question}),s.jsxs("p",{children:[rn.guide," · ",g.id===1?"Today":g.time]})]}),h&&s.jsx("button",{className:"lp-close","aria-label":"Close conversation",onClick:()=>p(!1),children:"Ã"})]}),s.jsxs("div",{className:"lp-card-body",children:[s.jsxs("dl",{className:"lp-chat-counts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Visitor messages"}),s.jsx("dd",{children:"2"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Total messages"}),s.jsx("dd",{children:"4"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Source"}),s.jsx("dd",{children:"Website chat"})]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Conversation summary"}),s.jsxs("div",{className:"lp-summary",children:[s.jsx(wi,{name:"spark"}),s.jsxs("div",{children:[s.jsx("p",{children:g.summary}),l&&s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:"Recommended offering"}),s.jsxs("p",{children:[g.offering,". ",g.id===1&&e?"The visitor shared their email and asked the team to follow up.":"The visitor explored this recommendation with the storeâs AI Expert."]})]})]}),s.jsx("button",{"aria-label":l?"Collapse summary":"Expand summary","aria-expanded":l,onClick:()=>c(!l),children:s.jsx(wi,{name:"down"})})]})]}),s.jsxs("section",{className:"lp-transcript",children:[s.jsx("span",{className:"lp-eyebrow",children:"Transcript"}),s.jsx("ol",{children:[{role:"Visitor",text:g.question},{role:"AI expert",text:g.answer},{role:"Visitor",text:g.message},{role:"AI expert",text:"You can send a contact request and the team can follow up with you."}].map((b,y)=>s.jsxs("li",{className:b.role==="AI expert"?"is-assistant":"",children:[s.jsx("span",{children:b.role}),s.jsx("p",{children:b.text})]},y))})]})]})]});return s.jsxs("section",{className:"lp-view",children:[s.jsxs("div",{className:"lp-intro lp-conversation-intro",children:[s.jsxs("div",{children:[s.jsxs("h4",{children:["What your customers are ",s.jsx("em",{children:"asking"})]}),s.jsx("p",{children:"See what visitors asked and how your AI Expert answered, across every conversation on your website."})]}),s.jsxs("div",{className:"lp-chat-filters",children:[s.jsx(Tie,{label:"Search conversations",value:r,onChange:a}),s.jsx(sct,{label:"Filter conversations by expert",value:i,onChange:o,options:[["all","All experts"],["assistant",rn.guide]]})]})]}),m.length?s.jsxs("div",{className:"lp-split",children:[s.jsxs("div",{className:"lp-card lp-list",children:[s.jsxs("div",{className:"lp-card-header",children:[s.jsx("strong",{children:"Chat inbox"}),s.jsxs("span",{children:[m.length," ",m.length===1?"conversation":"conversations"]})]}),m.map(b=>s.jsxs("button",{className:`lp-list-row ${g.id===b.id?"selected":""}`,"aria-current":g.id===b.id?"true":void 0,onClick:()=>{n(b.id),c(!1),d(y=>[...y,b.id]),window.matchMedia("(max-width: 960px)").matches&&p(!0)},children:[s.jsxs("span",{className:"lp-row-top",children:[s.jsx("strong",{children:b.question}),s.jsx("small",{children:b.id===1?"Just now":b.time})]}),s.jsxs("span",{className:"lp-row-meta",children:[s.jsxs("span",{children:[b.id!==g.id&&!u.includes(b.id)&&s.jsx("b",{className:"lp-new",children:"New"}),rn.guide]}),s.jsx("small",{children:"4 messages"}),s.jsx("i",{children:s.jsx(wi,{name:"chevron",size:14})})]})]},b.id))]}),s.jsx("div",{className:"lp-card lp-chat-desktop",children:x}),h&&s.jsx("div",{className:"lp-mobile-modal",role:"dialog","aria-label":"Conversation detail",children:x})]}):s.jsxs("div",{className:"lp-card lp-empty",children:[s.jsx("h4",{children:"No matching conversations"}),s.jsx("p",{children:"Try another search or expert."})]})]})}function yH({lead:e,onStatus:t,onNote:n}){const[r,a]=B.useState(!0),[i,o]=B.useState(e.note||""),[l,c]=B.useState(!1),[u,d]=B.useState(!1),h=(p,m,g)=>s.jsxs("div",{className:"lp-context-row",children:[s.jsx(wi,{name:p}),s.jsx("span",{children:m}),s.jsx("strong",{children:g})]});return s.jsxs("article",{className:"lp-card lp-lead-detail",children:[s.jsxs("header",{className:"lp-card-header",children:[s.jsxs("div",{children:[s.jsx("h4",{children:e.name}),s.jsx("small",{children:e.time})]}),s.jsx("span",{className:"lp-ready",children:e.id===1||e.id===3?"Ready now":"Exploring"}),s.jsx("select",{"aria-label":"Request status",value:e.status,onChange:p=>t(p.target.value),children:Cie.map(p=>s.jsx("option",{children:p},p))})]}),s.jsxs("div",{className:"lp-card-body",children:[s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Request context"}),s.jsxs("div",{className:"lp-inset",children:[h("source","Source",`Website · ${e.source}`),h("bot","Expert",rn.guide),s.jsxs("div",{className:"lp-context-row is-stack",children:[s.jsx(wi,{name:"file"}),s.jsxs("div",{children:[s.jsx("span",{children:"Summary"}),s.jsx("p",{children:e.summary})]})]}),h("clock","Received",e.time)]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Contact & details"}),s.jsxs("div",{className:"lp-inset",children:[s.jsxs("div",{className:"lp-context-row",children:[s.jsx(wi,{name:"mail"}),s.jsx("span",{children:"Email"}),s.jsx("strong",{children:e.email}),s.jsx("button",{className:"lp-text-button",onClick:async()=>{try{await navigator.clipboard.writeText(e.email),d(!0)}catch{d(!1)}},children:u?"Copied":"Copy"})]}),h("phone","Phone","Not shared"),s.jsxs("div",{className:"lp-context-row is-stack",children:[s.jsx(wi,{name:"message"}),s.jsxs("div",{children:[s.jsx("span",{children:"Message they left"}),s.jsx("p",{children:e.message})]})]}),s.jsxs("div",{className:"lp-context-row",children:[s.jsx(wi,{name:"message"}),s.jsx("span",{children:"Chat history"}),s.jsxs("button",{className:"lp-show-chat","aria-expanded":r,onClick:()=>a(!r),children:[r?"Hide":"Show",s.jsx(wi,{name:"down"})]})]}),r&&s.jsxs("div",{className:"lp-lead-transcript",children:[s.jsx("p",{children:e.question}),s.jsx("p",{children:e.answer})]})]})]}),s.jsxs("section",{children:[s.jsx("span",{className:"lp-eyebrow",children:"Internal note"}),s.jsxs("div",{className:"lp-inset lp-note",children:[s.jsx("textarea",{"aria-label":"Internal note",placeholder:"Only visible to you",value:i,onChange:p=>{o(p.target.value),c(!1)}}),s.jsxs("div",{children:[l&&s.jsx("span",{role:"status",children:"Note saved"}),s.jsx("button",{onClick:()=>{n(i),c(!0)},children:"Save"})]})]})]})]})]})}function bd({title:e,children:t,id:n}){return s.jsxs("section",{className:"lp-card lp-insight-card",id:n,children:[s.jsx("div",{className:"lp-card-header",children:s.jsx("strong",{children:e})}),s.jsx("div",{className:"lp-card-body",children:t})]})}function rct({period:e,captured:t,newCount:n,onConversations:r,onLeads:a,onNewLeads:i}
1392){const o=t?1:0,l=e==="1"?{c:11+o,p:9,v:47,l:o,r:6+o,k:3,voice:2}:e==="7"?{c:46+o,p:32,v:218,l:2+o,r:21+o,k:9,voice:8}:e==="all"?{c:342+o,p:228,v:1430,l:4+o,r:174+o,k:64,voice:57}:{c:184+o,p:126,v:842,l:4+o,r:86+o,k:31,voice:29},c=B.useRef(null),u=[["Road Running Shoes",39,16,21],["Hex Dumbbell Pair",29,10,17],["Pro Tennis Racket",19,5,12]],d=()=>c.current?.scrollIntoView({behavior:"smooth",block:"nearest"}),h=[["Conversations",l.c,s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lp-voice-bar",children:s.jsx("i",{style:{width:`${l.voice/l.c*100}%`}})}),"Voice ",l.voice," · Text ",l.c-l.voice]}),"conversations","View"],["People who chatted",l.p,`Different people · ${Math.round(l.p*.4)} not signed in`],["Profile visitors",l.v,"People who opened your profile page"],["Leads",l.l,"People who asked you to get in touch","leads","Open"],["Recommendations",l.r,"Times your AI suggested one of your offerings","breakdown","Breakdown"],["Offering clicks",l.k,`${Math.round(l.k/l.r*100)}% of recommendations led to a click`,"breakdown","Breakdown"]];return s.jsxs("section",{className:"lp-view",children:[s.jsx("div",{className:"lp-intro",children:s.jsxs("div",{children:[s.jsxs("h4",{children:["Find out what your customers ",s.jsx("em",{children:"actually want"})]}),s.jsxs("p",{children:["Insights are ",s.jsx("strong",{children:"fully anonymous"}),". They show what people need, not who they are."]})]})}),s.jsx("div",{className:"lp-metrics",children:h.map(([p,m,g,x,b],y)=>{const v=x?"button":"div";return s.jsxs(v,{type:x?"button":void 0,className:`lp-metric ${y===0?"accent":""} ${y===1?"indigo-value":""}`,onClick:x?()=>{x==="breakdown"?d():x==="conversations"?r():x==="leads"&&a()}:void 0,"aria-label":x?`${p}, ${b}`:void 0,children:[s.jsx("span",{className:"lp-eyebrow",children:p}),s.jsx("strong",{children:m},m),s.jsxs("div",{children:[s.jsx("small",{children:g}),b&&s.jsxs("b",{children:[b," â"]})]})]},p)})}),s.jsxs("div",{className:"lp-card lp-next",children:[s.jsx("h5",{children:"What to do next"}),s.jsxs("button",{onClick:i,children:[s.jsxs("span",{children:[s.jsxs("strong",{children:[n," new requests waiting"]}),s.jsx("small",{children:"Reply while the conversation is still fresh."})]}),s.jsx("b",{children:"View new requests â"})]})]}),s.jsxs(bd,{title:"How conversations progress",children:[[["Conversations",l.c],["Kept talking (5+ messages)",Math.round(l.c*.63)],["Asked to connect",l.l]].map(([p,m],g)=>s.jsxs("div",{className:"lp-bar-row",children:[s.jsx("span",{children:p}),s.jsx("i",{children:s.jsx("b",{style:{width:`${Math.max(3,m/l.c*100)}%`}})}),s.jsx("strong",{children:m}),s.jsx("small",{children:g>0?`${Math.round(m/l.c*100)}%`:""})]},p)),s.jsxs("p",{className:"lp-foot",children:[s.jsxs("strong",{children:[Math.round(l.p*.18)," people came back"]})," for a second conversation in this period. Returning visitors are your warmest leads."]})]}),s.jsx("div",{ref:c,children:s.jsxs(bd,{title:"Your AI sales agent at work",children:[s.jsx("p",{className:"lp-foot",children:"What your AI recommended, and what people did about it."}),s.jsx("div",{className:"lp-ranking-grid",children:[["Most clicked",2],["Most recommended",1],["Most asked for",3]].map(([p,m])=>s.jsxs("div",{children:[s.jsx("h5",{children:p}),u.map((g,x)=>s.jsxs("div",{className:"lp-ranking",children:[s.jsxs("span",{children:["0",x+1]}),s.jsx("strong",{children:g[0]}),s.jsx("b",{children:e==="7"?Math.max(1,Math.round(g[m]/4)):e==="1"?Math.max(1,Math.round(g[m]/15)):e==="all"?g[m]*2:g[m]})]},g[0]))]},p))})]})}),s.jsx(bd,{title:"What people ask about",children:[["Shoe sizing",68],["Delivery times",51],["Home gym gear",39],["Returns",26]].map(([p,m])=>s.jsxs("div",{className:"lp-bar-row",children:[s.jsx("span",{children:p}),s.jsx("i",{children:s.jsx("b",{style:{width:`${m/68*100}%`}})}),s.jsx("strong",{children:m})]},p))}),s.jsx("div",{className:"lp-two-up",children:[["Busiest days",["M","T","W","T","F","S","S"],[18,21,24,20,32,39,31]],["Busiest hours",["6am","9am","12pm","3pm","6pm","9pm"],[9,18,31,35,54,38]]].map(([p,m,g])=>s.jsx(bd,{title:p,children:s.jsx("div",{className:"lp-columns",children:m.map((x,b)=>s.jsxs("div",{children:[s.jsx("span",{children:Math.round(g[b]*l.c/185)}),s.jsx("i",{style:{height:`${g[b]*1.4}px`}}),s.jsx("small",{children:x})]},b))})},p))}),s.jsxs("div",{className:"lp-two-up",children:[s.jsx(bd,{title:"Your experts",children:s.jsxs("table",{className:"lp-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Expert"}),s.jsx("th",{children:"Chats"}),s.jsx("th",{children:"Requests"})]})}),s.jsx("tbody",{children:s.jsxs("tr",{children:[s.jsx("th",{children:rn.guide}),s.jsx("td",{children:l.c}),s.jsx("td",{children:l.l})]})})]})}),s.jsxs(bd,{title:"Knowledge gaps",children:[s.jsx("h5",{children:"Racket restringing"}),s.jsx("p",{className:"lp-foot",children:"People asked if you restring rackets. Add it to your knowledge and the next answer is ready."})]})]}),s.jsx(bd,{title:"Where people find you",children:s.jsxs("table",{className:"lp-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Source"}),s.jsx("th",{children:"Chats"}),s.jsx("th",{children:"Requests"})]})}),s.jsxs("tbody",{children:[s.jsxs("tr",{children:[s.jsx("th",{children:"Website chat"}),s.jsx("td",{children:Math.round(l.c*.8)}),s.jsx("td",{children:l.l})]}),s.jsxs("tr",{children:[s.jsx("th",{children:"Standalone page"}),s.jsx("td",{children:l.c-Math.round(l.c*.8)}),s.jsx("td",{children:"0"})]})]})]})})]})}const vH=e=>(e?n_:n_.slice(1)).map(t=>({...t,status:t.status==="Closed"?"Replied":t.status,time:t.id===1?"Just now":t.time}));
1392function act(){const[e,t]=B.useState("insights"),[n,r]=B.useState(()=>vH(!1)),[a,i]=B.useState(2),[o,l]=B.useState("All"),[c,u]=B.useState(""),[d,h]=B.useState("30"),[p,m]=B.useState(1),[g,x]=B.useState(""),[b,y]=B.useState("all"),[v,w]=B.useState(""),[j,E]=B.useState([]),[S,_]=B.useState(!1),[k,C]=B.useState("chat"),N=B.useRef(null),A=B.useRef(null),T=B.useRef({}),I=B.useRef(0),$=B.useRef(!1),O=B.useRef(!1),U=B.useRef(-1),[F,H]=B.useState(!1),[G,M]=B.useState(-1),z=G>=3,W=()=>{O.current=!0,H(!1)},D=B.useCallback(P=>{t(P),A.current&&(A.current.scrollTop=0)},[]),Z=B.useCallback((P,ee=!1)=>{const X=P<700?0:P<1500?1:P<2800?2:P<4800?3:4;X===U.current&&!ee||(U.current=X,M(X),(X===0||ee)&&(w(""),r(vH(X>=3)),i(X>=3?1:2),l("All"),u(""),x(""),y("all"),m(1),E([]),_(!1),C("chat"),D(X===3?"leads":"insights"),h("30")),X===3&&(r(ae=>ae.some(me=>me.id===1)?ae:[{...n_[0],time:"Just now"},...ae]),i(1),D("leads"),w("Emily Parker shared her details. New lead added to your inbox.")),X===4&&(m(1),D("conversations")))},[D]);B.useEffect(()=>{const P=window.matchMedia("(prefers-reduced-motion: reduce)"),ee=new IntersectionObserver(([me])=>{$.current=me.isIntersecting&&me.intersectionRatio>=.5,$.current&&!O.current&&!P.matches&&(O.current=!0,Z(0,!0),H(!0))},{threshold:.5,rootMargin:"-88px 0px 0px"}),X=N.current?.querySelector(".lc-shell");X&&ee.observe(X);const ae=()=>{P.matches&&(O.current=!0,H(!1),I.current=2800,Z(2800,!0))};return ae(),P.addEventListener("change",ae),()=>{ee.disconnect(),P.removeEventListener("change",ae)}},[Z]),B.useEffect(()=>{if(!F)return;let P=performance.now();const ee=setInterval(()=>{const X=performance.now(),ae=Math.min(X-P,200);P=X,!(!$.current||document.hidden)&&(I.current=Math.min(I.current+ae,9e3),Z(I.current),I.current===9e3&&H(!1))},100);return()=>clearInterval(ee)},[F,Z]);const V=n.filter(P=>(o==="All"||P.status===o)&&`${P.name} ${P.topic} ${P.email}`.toLowerCase().includes(c.toLowerCase())),L=V.find(P=>P.id===a)||V[0],K=n.filter(P=>P.status==="New").length,te=P=>{r(ee=>ee.map(X=>X.id===L.id?{...X,status:P}:X)),w(`${L.name} marked ${P.toLowerCase()}.`)},Q=P=>r(ee=>ee.map(X=>X.id===L.id?{...X,note:P}:X)),Y=P=>{if(!["ArrowLeft","ArrowRight"].includes(P.key))return;P.preventDefault();const ee=aC.findIndex(ae=>ae[0]===e),X=aC[(ee+(P.key==="ArrowRight"?1:2))%3][0];D(X),T.current[X]?.focus()},J=P=>{P.target.closest(".ld-export")||(W(),C("dashboard"))};return s.jsx("div",{className:"ld-showcase",ref:N,children:s.jsxs("div",{className:"ld-stage",children:[s.jsx("div",{className:"ld-demo lp-product",style:{zIndex:k==="dashboard"?4:1},onPointerDownCapture:J,onFocusCapture:J,children:s.jsxs("div",{className:"ld-app",ref:A,children:[s.jsxs("header",{className:"ld-header",children:[s.jsxs("h3",{children:["Insights & ",s.jsx("em",{children:"Leads"})]}),s.jsxs("button",{type:"button",className:"ld-reset ld-export",children:[s.jsx(wi,{name:"download"}),e==="conversations"?"Export chats":"Export CSV"]})]}),s.jsxs("div",{className:"ld-toolbar",children:[s.jsx("div",{className:"ld-tabs",role:"tablist","aria-label":"Leads views",onKeyDown:Y,children:aC.map(([P,ee])=>s.jsxs("button",{type:"button",ref:X=>T.current[P]=X,role:"tab",id:`demo-tab-${P}`,"aria-controls":`demo-panel-${P}`,"aria-selected":e===P,tabIndex:e===P?0:-1,onClick:()=>D(P),children:[s.jsx("span",{className:"lp-full-label",children:ee}),s.jsx("span",{className:"lp-short-label",children:P==="conversations"?"Chats":ee}),P==="leads"&&K>0&&s.jsx("span",{className:"lp-tab-count",children:K})]},P))}),e==="insights"&&s.jsx("div",{className:"ld-filters",role:"group","aria-label":"Period",children:tct.map(([P,ee])=>s.jsx("button",{"aria-pressed":d===P,onClick:()=>h(P),children:ee},P))}),e==="leads"&&s.jsx("div",{className:"ld-filters",role:"group","aria-label":"Filter by status",children:["All",...Cie].map(P=>s.jsxs("button",{"aria-pressed":o===P,onClick:()=>l(P),children:[P,s.jsx("span",{children:P==="All"?n.length:n.filter(ee=>ee.status===P).length})]},P))})]}),s.jsxs("div",{role:"tabpanel",id:`demo-panel-${e}`,"aria-labelledby":`demo-tab-${e}`,children:[e==="insights"&&s.jsx(rct,{period:d,captured:z,newCount:K,onConversations:()=>D("conversations"),onLeads:()=>{l("All"),u(""),D("leads")},onNewLeads:()=>{l("New"),u(""),D("leads")}}
1392),e==="conversations"&&s.jsx(nct,{captured:z,selected:p,setSelected:m,query:g,setQuery:x,expert:b,setExpert:y}),e==="leads"&&s.jsxs("section",{className:"lp-view",children:[s.jsxs("div",{className:"lp-intro",children:[s.jsxs("div",{children:[s.jsxs("h4",{children:["Someone is waiting for your ",s.jsx("em",{children:"reply"})]}),s.jsx("p",{children:"People who asked you to get in touch after talking with your AI Experts. You only see what they agreed to share."})]}),s.jsx(Tie,{label:"Search leads",value:c,onChange:u})]}),s.jsxs("div",{className:"lp-split lp-leads-split",children:[s.jsxs("div",{className:"lp-card lp-list",children:[s.jsxs("div",{className:"lp-card-header",children:[s.jsx("strong",{children:"Inbox"}),s.jsxs("span",{children:[V.length," ",V.length===1?"lead":"leads"]})]}),V.map(P=>s.jsxs("button",{className:`lp-list-row ${P.id===L?.id?"selected":""} ${P.id===1&&z?"ld-arrived":""}`,"aria-current":P.id===L?.id?"true":void 0,onClick:()=>{i(P.id),E(ee=>[...ee,P.id]),window.matchMedia("(max-width: 960px)").matches&&_(!0)},children:[s.jsxs("span",{className:"lp-row-top",children:[s.jsx("strong",{children:P.name}),s.jsx("small",{children:P.time})]}),s.jsxs("span",{className:"lp-row-meta",children:[(P.status!=="New"||!(j.includes(P.id)||P.id===L?.id))&&s.jsx("b",{className:`lp-status lp-${P.status.toLowerCase().replaceAll(" ","-")}`,children:P.status}),s.jsxs("span",{children:["Expert: ",rn.guide]}),s.jsx("i",{children:s.jsx(wi,{name:"chevron",size:14})})]})]},P.id)),!V.length&&s.jsx("div",{className:"lp-empty",children:"No requests with this status."})]}),s.jsx("div",{className:"lp-lead-desktop",children:L&&s.jsx(yH,{lead:L,onStatus:te,onNote:Q},L.id)})]}),S&&L&&s.jsxs("div",{className:"lp-mobile-modal",role:"dialog","aria-label":"Lead detail",children:[s.jsx("button",{className:"lp-close","aria-label":"Close request",onClick:()=>_(!1),children:"Ã"}),s.jsx(yH,{lead:L,onStatus:te,onNote:Q},L.id)]})]})]}),s.jsx("div",{className:"ld-sr",role:"status","aria-live":"polite",children:v})]})}),s.jsx(ect,{phase:G,onPause:()=>{W(),C("chat")},onPreviewNote:w,onCapture:P=>{W(),I.current=2800,Z(2800,!0),r(ee=>ee.map(X=>X.id===1?{...X,email:P}:X))}})]})})}function ict(){return s.jsxs("article",{className:"ge-feature-row lf-feature",children:[s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["Conversations become ",s.jsx("em",{children:"leads."})]}),s.jsx("p",{children:"When someone is ready to buy, you get their name, email and the full conversation. And you see what everyone else asks."}),s.jsxs(gh,{children:["Start capturing leads ",s.jsx(Zk,{})]})]}),s.jsx(act,{})]})}const oct=15e3,dc=[{kind:"web",name:"fieldhousesports.com",note:"Website · 320 pages",color:"#3D3DF5"},{kind:"pdf",name:"Shoe size guide.pdf",note:"PDF",color:"#E0603A"},{kind:"sheet",name:"Price list 2026.xlsx",note:"Spreadsheet",color:"#2F9E5B"},{kind:"doc",name:"Shipping & returns.docx",note:"Document",color:"#2B6BE0"},{kind:"video",name:"Fieldhouse YouTube",note:"40 gear reviews",color:"#E23B3B"},{kind:"note",name:"Price match policy",note:"Note",color:"#D99A12"}],wH="¿Qué zapatillas me recomiendas para montaña?",jH="Las **Zapatillas de Trail** tienen más agarre y protección en montaña. Si no te van bien, los cambios son gratis durante 30 dÃas.",Ka={sourceStep:450,typeFrom:3300,typeTo:4700,sent:4900,think:5200,answerFrom:5900,answerTo:7900,leave:14400},r_=56,mL=10,Aie=(640-(dc.length*r_+(dc.length-1)*mL))/2,lct=dc.map((e,t)=>{const n=Aie+r_/2+t*(r_+mL),r=290+t*12;return`M414 ${n} C 462 ${n}, 458 ${r}, 506 ${r}`}),cct=dc.map((e,t)=>{const n=30+t*60,r=150+t*12;return`M${n} 172 C ${n} 204, ${r} 200, ${r} 236`});function uct({kind:e}){const t={web:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"})]}),pdf:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),s.jsx("path",{d:"M14 3v6h6M8 14h8M8 17h5"})]}),sheet:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"4",y:"3",width:"16",height:"18",rx:"2"}),s.jsx("path",{d:"M4 9h16M4 15h16M10 3v18"})]}),doc:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),s.jsx("path",{d:"M14 3v6h6M8 13h8M8 17h8"})]}),video:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"4"}),s.jsx("path",{d:"m10 9 5 3-5 3z"})]}),note:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4 4h12l4 4v12H4z"}),s.jsx("path",{d:"M8 10h8M8 14h8M8 18h4"})]})};return s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t[e]})}function _H({wires:e,learned:t,layout:n}){return s.jsxs("div",{className:`bz-wires is-${n}`,"aria-hidden":"true",children:[s.jsx("svg",{viewBox:n==="wide"?"0 0 900 640":"0 0 360 680",children:e.map((r,a)=>s.jsx("path",{d:r,pathLength:"100",className:a<t?"is-on":"",style:{"--wire":dc[a].color}},r))}),e.map((r,a)=>a<t?s.jsx("i",{className:"bz-packet",style:{offsetPath:`path('${r}')`,background:dc[a].color}},r):null)]})}function dct(){const e=B.useRef(null),t=Q0(e,{duration:oct,still:9e3});B.useEffect(()=>{const l=e.current,c=()=>{const{width:d,height:h}=l.getBoundingClientRect(),p=d<560;l.dataset.narrow=p?"true":"false",l.style.setProperty("--kn-scale",
1392String(p?Math.min(d/360,h/680):Math.min(d/900,h/640)))},u=new ResizeObserver(c);return u.observe(l),c(),()=>u.disconnect()},[]);const n=t<Ka.leave,r=n?Math.min(dc.length,Math.floor(t/Ka.sourceStep)):0,a=r>0&&t<(dc.length+2)*Ka.sourceStep,i=t<Ka.sent?s2(wH,t,Ka.typeFrom,Ka.typeTo):"",o=Math.ceil(t2(jH)*Math.min(1,(t-Ka.answerFrom)/(Ka.answerTo-Ka.answerFrom)));return s.jsxs("article",{className:"ge-feature-row bz-kn-feature",children:[s.jsx("div",{className:"bz-scene bz-kn-scene",ref:e,role:"img","aria-label":"The storeâs website, files and videos feed its AI Expert, which answers a question about shoes asked in Spanish",children:s.jsxs("div",{className:"bz-kn-canvas",style:{"--list-top":`${Aie}px`,"--row":`${r_}px`,"--gap":`${mL}px`},children:[s.jsx(_H,{wires:lct,learned:r,layout:"wide"}),s.jsx(_H,{wires:cct,learned:r,layout:"narrow"}),s.jsx("ul",{className:"bz-sources","aria-hidden":"true",children:dc.map((l,c)=>{const u=c<r?"is-learned":n&&c===r?"is-reading":"";return s.jsxs("li",{className:u,style:{"--read-ms":`${Ka.sourceStep}ms`},children:[s.jsx("span",{className:`bz-source-icon bz-${l.kind}`,children:s.jsx(uct,{kind:l.kind})}),s.jsxs("span",{children:[s.jsx("b",{children:l.name}),s.jsx("small",{children:l.note})]}),s.jsx("i",{children:c<r?"Learned":u?"Readingâ¦":"Queued"})]},l.name)})}),s.jsxs(a0,{composer:i,className:`bz-kn-panel ${a?"is-receiving":""}`,children:[s.jsx(ya,{role:"ai",text:"Hi! Iâm the Fieldhouse Assistant. Ask me in any language."}),n&&t>=Ka.sent&&s.jsx(ya,{role:"user",text:wH}),n&&t>=Ka.think&&t<Ka.answerFrom&&s.jsx(ya,{typing:!0}),n&&t>=Ka.answerFrom&&s.jsx(ya,{role:"ai",text:e2(jH,o)})]})]})}),s.jsxs("div",{className:"ge-feature-copy",children:[s.jsxs("h2",{children:["Knows ",s.jsx("em",{children:"your business."})]}),s.jsx("p",{children:"Add your website, price lists and documents. Nothing new to write. It answers only from what you give it, in your customerâs language."}),s.jsxs(gh,{children:["Add your content ",s.jsx(Zk,{})]})]})]})}const hct=".ge-features > *, #testimonials > *, .bf-heading, .bf-scene, .ge-bottom-claim > div, .ge-world-banner, #faq > h2, #faq .ge-acc, #creators > div",pct=".ld-showcase",mct={fontStyle:"italic",color:"#3D3DF5"};function kH(){return s.jsx("span",{"aria-hidden":"true",className:"ge-sheen"})}function fct(){const e=f.useRef(null),t=Nc({journey:"business"});return BP(e,{reveal:hct,demos:pct}),s.jsxs("div",{ref:e,className:"welcome-page business-landing",children:[s.jsx(vs,{path:"/forbusiness",title:or.business.title,description:or.business.description,ogImage:or.business.image}),s.jsx(l0,{children:s.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..600;1,9..144,300..600&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&family=Manrope:wght@400;500;600;700&display=swap",rel:"stylesheet"})}),s.jsxs("div",{className:"ge-home",children:[s.jsx("div",{className:"ge-nav",children:s.jsx("div",{children:s.jsx(Dk,{links:_ie,mobileLinks:$lt,cta:"Get started for free",ctaLink:t})})}),s.jsxs("section",{className:"ge-hero bz-hero",children:[s.jsxs("div",{className:"ge-hero-copy",children:[s.jsxs("h1",{children:[s.jsx("span",{className:"bz-hero-line",children:"An AI Expert on your website."}),s.jsxs("span",{className:"ge-hero-benefits",children:[rC.join(" ")," ",s.jsx("span",{className:"ge-hero-endless",children:"And much more."})]}),s.jsx("span",{className:"ge-hero-rotator","aria-hidden":"true",children:s.jsxs("span",{className:"ge-hero-phrase-track",children:[rC.map(n=>s.jsx("span",{children:n},n)),s.jsx("span",{className:"ge-hero-endless",children:"And much more."}),s.jsx("span",{children:rC[0]})]})})]}),s.jsxs("p",{children:["Every company has that one person who knows everything. ",s.jsx("strong",{children:"Put them on your website, answering every visitor."})]}),s.jsxs("div",{className:"bz-hero-actions",children:[s.jsxs(gh,{className:"ge-claim-submit bz-cta",children:[s.jsx("span",{children:"Add it to my website for free"}),s.jsx(kH,{})]}),s.jsx("a",{className:"bz-ghost",href:r0,target:"_blank",rel:"noopener noreferrer",children:"Book a call"})]})]}),s.jsx(Hlt,{})]}),s.jsxs("section",{id:"voice-calls",className:"ge-features bz-calls","aria-label":"AI voice calls",children:[s.jsxs("header",{className:"bf-heading",children:[s.jsxs("h2",{children:["Questions, answered ",s.jsx("em",{children:"out loud."})]}),s.jsx("p",{children:"Visitors tap the call badge and talk it through, in your voice or a teammateâs. Every product it mentions appears on screen as it speaks."})]}),s.jsx(Jlt,{})]}),s.jsx(qne,{}),s.jsx("section",{id:"embed",className:"ge-features","aria-label":"The chat on your website",children:s.jsx(Vlt,{})}),s.jsx("section",{id:"recommendations",className:"ge-features","aria-label":"Product recommendations",children:s.jsx(Zlt,{})}),s.jsx("section",{id:"leads-demo",className:"ge-features","aria-label":"Leads and customer insights",children:s.jsx(ict,{})}),s.jsx("section",{id:"connected-knowledge",className:"ge-features","aria-label":"Your website, files and knowledge",children:s.jsx(dct,{})}),s.jsx("section",{id:"how-it-works",className:"ge-build-section","aria-label":"How to add it to your website",children:s.jsxs("div",{className:"bf-content",children:[s.jsxs("header",{className:"bf-heading",children:[s.jsxs("h2",{children:["Live on your website ",s.jsx("em",{children:"in seconds."})]}),s.jsx("p",{children:"Paste one snippet into the site you already have. Nothing to rebuild or migrate."})]}),s.jsx("div",{className:"bf-scene",id:"install-preview",children:s.jsx(Yne,{src:"/business/install-guide.mp4",poster:"/business/landing/install-poster.jpg",label:"How to add your AI Expert to your website",width:1920,height:1080})})]})}),s.jsx("section",{className:"ge-bottom-claim","aria-label":"Get started",children:s.jsx("div",{className:"bz-bottom-cta",children:s.jsxs(gh,{className:"ge-claim-submit bz-cta",children:[s.jsx("span",{children:"Add an AI Expert to my website"}),s.jsx(kH,{})]})})}),s.jsx("section",{className:"ge-world-section","aria-label":"Start with Great Experts",children:s.jsxs("div",{className:"ge-world-banner",children:[s.jsxs("div",{className:"ge-world-copy",children:[s.jsxs("h2",{children:[s.jsx("span",{children:"Your dream employee."}),s.jsx("em",{children:"Knows everything. Never sleeps."})]}),s.jsxs("div",{className:"ge-world-actions",children:[s.jsx(gh,{className:"ge-world-primary",children:"Get started"}),s.jsx("a",{href:r0,target:"_blank",rel:"noopener noreferrer",children:"Book a call"})]})]}),s.jsxs("div",{className:"ge-world-profiles","aria-hidden":"true",children:[s.jsxs("div",{className:"ge-world-track",children:[s.jsx("img",{src:"/welcome/assets/profiles/elena.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/priya.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/elena.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/priya.jpg",alt:"",loading:"lazy"})]}),s.jsxs("div",{className:"ge-world-track",children:[s.jsx("img",{src:"/welcome/assets/profiles/tercera.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/lukas.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/tercera.jpg",alt:"",loading:"lazy"}),s.jsx("img",{src:"/welcome/assets/profiles/lukas.jpg",alt:"",loading:"lazy"})]})]})]})}),s.jsx(UP,{items:Dlt,title:s.jsxs(s.Fragment,{children:["Questions companies ask ",s.jsx("em",{style:mct,children:"before they start."})]})}),s.jsx("section",{id:"creators",className:"bz-band","aria-label":"For creators",children:s.jsxs("div",{children:[s.jsx("span",{className:"bz-band-tag",children:"For creators"}),s.jsxs("div",{children:[s.jsxs("p",{children:["Building a personal brand? Great Experts works as your ",s.jsx("em",{children:"link in bio"})," too."]}),s.jsxs("a",{href:"/welcome",children:["See how ",s.jsx("span",{"aria-hidden":"true",children:"â"})]})]})]})}),s.jsx(zP,{})]})]})}function gct(){return s.jsxs(s.Fragment,{children:[s.jsx(fct,{}),s.jsx(FP,{})]})}const NH="https://assets.calendly.com/assets/external/widget.js",EH="https://assets.calendly.com/assets/external/widget.css";function xct(){if(window.Calendly)return Promise.resolve(window.Calendly);if(!document.querySelector(`link[href="${EH}"]`)){const e=document.createElement("link");e.rel="stylesheet",e.href=EH,document.head.appendChild(e)}return new Promise((e,t)=>
1392{const n=document.querySelector(`script[src="${NH}"]`),r=n||document.createElement("script");r.addEventListener("load",()=>e(window.Calendly),{once:!0}),r.addEventListener("error",t,{once:!0}),n||(r.src=NH,r.async=!0,document.body.appendChild(r))})}async function bct(e){try{(await xct()).initPopupWidget({url:`${e}?hide_gdpr_banner=1`})}catch{window.open(e,"_blank","noopener,noreferrer")}}const SH={wide:[{x:.44,y:-.02,scale:.78,spin:1,brain:1,impulse:.8},{x:0,y:.38,scale:.44,spin:0,brain:0,impulse:.7},{x:0,y:.3,scale:.5,spin:0,brain:0,impulse:.6},{x:0,y:.27,scale:.6,spin:1,brain:1,impulse:1}],narrow:[{x:0,y:.43,scale:.84,spin:1,brain:1,impulse:.8},{x:0,y:.38,scale:.6,spin:0,brain:0,impulse:.7},{x:0,y:.33,scale:.66,spin:0,brain:0,impulse:.6},{x:0,y:.32,scale:.78,spin:1,brain:1,impulse:1}]},iC=[[255,255,255],[255,255,255],[245,245,247],[255,255,255]],yct=-1,Fd=[[-1.15,.36],[-.55,.58],[.02,.4],[.6,.58],[1.15,.34],[-.86,-.08],[-.28,.06],[.3,-.04],[.9,-.14],[-1.12,-.56],[-.42,-.5],[.24,-.58],[.86,-.6]],vct=["Price lists","Emails","Product catalogue","CRM","SOPs","Team interviews","Spreadsheets","Policies","Training videos","Support tickets","Orders","Supplier data","Meeting notes"],wct=.07,Rie=.19,Iie=` 1393uniform float uFrom, uTo, uT, uTime, uYaw, uSpin, uScale; 1394uniform vec2 uOffset, uFit, uTilt; 1395vec3 rotY(vec3 p, float a) { float c = cos(a), s = sin(a); return vec3(c * p.x + s * p.z, p.y, -s * p.x + c * p.z); } 1396vec3 rotX(vec3 p, float a) { float c = cos(a), s = sin(a); return vec3(p.x, c * p.y - s * p.z, s * p.y + c * p.z); } 1397float stagger(float seed) { float t = clamp((uT - seed * 0.4) / 0.6, 0.0, 1.0); return t * t * (3.0 - 2.0 * t); } 1398vec3 drift(float seed) { return 0.005 * vec3(sin(uTime * 0.8 + seed * 40.0), cos(uTime * 0.7 + seed * 31.0), sin(uTime * 0.6 + seed * 17.0)); } 1399float isFlat(float k) { return step(0.5, k) * step(k, 2.5); } 1400vec4 place(vec3 p, out float persp) { 1401 p = mix(p, rotY(p, uYaw), uSpin); 1402 p = rotX(rotY(p, uTilt.x), uTilt.y); 1403 persp = 3.4 / (3.4 - p.z); 1404 return vec4(p.xy * persp * uScale * uFit + uOffset, 0.0, 1.0); 1405}`,jct=`#version 300 es 1406precision highp float; 1407in vec3 aA; in vec3 aB; in vec3 aC; in vec3 aD; in vec3 aN; in vec4 aMeta; in vec4 aTag; in vec4 aVis; 1408uniform float uPx, uBrain; 1409${Iie} 1410out vec3 vColor; out float vAlpha; out float vNeuron; 1411vec3 pickP(float k) { return k < 0.5 ? aA : (k < 1.5 ? aB : (k < 2.5 ? aC : aD)); } 1412float pick(vec4 v, float k) { return k < 0.5 ? v.x : (k < 1.5 ? v.y : (k < 2.5 ? v.z : v.w)); } 1413void main() { 1414 float seed = aMeta.x, neuron = aMeta.w; 1415 float t = stagger(seed); 1416 vec3 p = mix(pickP(uFrom), pickP(uTo), t) + drift(seed); 1417 float plain = mix(isFlat(uFrom), isFlat(uTo), t); 1418 float persp; 1419 gl_Position = place(p, persp); 1420 vec3 n = normalize(mix(aN, rotY(aN, uYaw), uSpin)); 1421 n = rotX(rotY(n, uTilt.x), uTilt.y); 1422 // Tissue is a faint dust that gives the brain its folds; neurons are glowing somas. 1423 float size = aMeta.y * (neuron > 0.5 ? 3.6 : 1.0); 1424 gl_PointSize = mix(size, 10.0, plain * neuron) * uPx * persp; 1425 float diffuse = max(dot(n, normalize(vec3(-0.5, 0.72, 0.5))), 0.0); 1426 float shade = clamp((0.25 + 0.75 * diffuse) * aMeta.z, 0.0, 1.0); 1427 vec3 tissue = mix(vec3(0.1, 0.1, 0.115), vec3(0.56, 0.57, 0.62), shade); 1428 vec3 col = neuron > 0.5 ? mix(vec3(0.12, 0.12, 0.14), vec3(0.3, 0.31, 0.35), shade) : tissue; 1429 // Signals in brand indigo: pulsing on the brain, steady on the finished task. 1430 float tag = mix(pick(aTag, uFrom), pick(aTag, uTo), t); 1431 float pulse = 0.55 + 0.45 * sin(uTime * 2.0 + seed * 60.0); 1432 vColor = mix(col, vec3(0.239, 0.239, 0.961), tag * mix(1.0, pulse, uBrain)); 1433 vNeuron = neuron; 1434 float vis = mix(pick(aVis, uFrom), pick(aVis, uTo), t); 1435 vAlpha = vis * clamp(0.55 + 0.4 * (persp - 0.8) / 0.4, 0.4, 1.0) * (neuron > 0.5 ? 1.0 : 0.6); 1436}`,_ct=`#version 300 es 1437precision mediump float; 1438in vec3 vColor; in float vAlpha; in float vNeuron; 1439out vec4 outColor; 1440void main() { 1441 if (vAlpha < 0.005) discard; 1442 vec2 q = gl_PointCoord * 2.0 - 1.0; 1443 float d2 = dot(q, q); 1444 if (d2 > 1.0) discard; 1445 // A soma is a solid core with a soft edge; tissue is a faint soft dot. 1446 float a = vNeuron > 0.5 ? min(1.0, exp(-d2 * 12.0) * 1.2 + 0.18 * exp(-d2 * 3.0)) : exp(-d2 * 3.0); 1447 a *= vAlpha; 1448 outColor = vec4(vColor * a, a); 1449}`,kct=`#version 300 es 1450precision highp float; 1451in vec3 lA; in vec3 lB; in vec3 lC; in vec3 lD; in vec4 lMeta; in vec4 lAlpha; 1452${Iie} 1453out float vAlong; out float vPhase; out float vAlpha; out float vFlat; out float vKind; 1454vec3 pickP(float k) { return k < 0.5 ? lA : (k < 1.5 ? lB : (k < 2.5 ? lC : lD)); } 1455float pickA(float k) { return k < 0.5 ? lAlpha.x : (k < 1.5 ? lAlpha.y : (k < 2.5 ? lAlpha.z : lAlpha.w)); } 1456void main() { 1457 float seed = lMeta.x, kind = lMeta.w; 1458 float t = stagger(seed); 1459 vec3 p = mix(pickP(uFrom), pickP(uTo), t) + drift(seed); 1460 float persp; 1461 gl_Position = place(p, persp); 1462 // Dendrites travel with their soma. Synapses belong to one shape each: they fade out while 1463 // the neurons travel and back in once the next shape has formed. 1464 float travel = smoothstep(0.04, 0.3, uT) * (1.0 - smoothstep(0.7, 0.96, uT)); 1465 float a = kind > 0.5 ? mix(pickA(uFrom), pickA(uTo), t) : mix(pickA(uFrom), pickA(uTo), step(0.5, uT)) * (1.0 - travel); 1466 vFlat = mix(isFlat(uFrom), isFlat(uTo), step(0.5, uT)); 1467 vAlpha = a * clamp(0.5 + 0.4 * (persp - 0.8) / 0.4, 0.35, 0.95); 1468 vAlong = lMeta.y; 1469 vPhase = lMeta.z; 1470 vKind = kind; 1471}`,Nct=`#version 300 es 1472precision mediump float; 1473in float vAlong; in float vPhase; in float vAlpha; in float vFlat; in float vKind; 1474// uTime is shared with the vertex stage, so its precision has to match. 1475uniform highp float uTime; 1476uniform float uImpulse; 1477out vec4 outColor; 1478void main() { 1479 if (vKind > 0.5) { 1480 // A dendrite: bright where it leaves the soma, fading out towards its tip. 1481 float a = vAlpha * pow(1.0 - vAlong, 1.4) * 0.6; 1482 outColor = vec4(vec3(0.3, 0.31, 0.35) * a, a); 1483 return; 1484 } 1485 // About a third of the synapses carry an impulse that runs from one neuron to the next. 1486 float firing = step(0.66, fract(vPhase * 13.7)); 1487 float head = fract(uTime * 0.32 + vPhase); 1488 float pulse = exp(-pow((vAlong - head) * 6.0, 2.0)) * firing * uImpulse; 1489 vec3 col = mix(vec3(0.36, 0.37, 0.41), vec3(0.239, 0.239, 0.961), pulse); 1490 float a = vAlpha * (mix(0.22, 0.5, vFlat) + 0.75 * pulse); 1491 outColor = vec4(col * a, a); 1492}`;function Ect(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function Sct(e){const t=Array.from({length:256},(o,l)=>l);for(let o=255;o>0;o--){const l=Math.floor(e()*(o+1));[t[o],t[l]]=[t[l],t[o]]}const n=new Uint8Array(512);for(let o=0;o<512;o++)n[o]=t[o&255];const r=o=>o*o*o*(o*(o*6-15)+10),a=(o,l,c)=>o+(l-o)*c,i=(o,l,c,u)=>{const d=o<8?l:c,h=o<4?c:o===12||o===14?l:u;return(o&1?-d:d)+(o&2?-h:h)};return(o,l,c)=>{const u=Math.floor(o)&255,d=Math.floor(l)&255,h=Math.floor(c)&255;o-=Math.floor(o),l-=Math.floor(l),c-=Math.floor(c);const p=r(o),m=r(l),g=r(c),x=n[u]+d,b=n[x]+h,y=n[x+1]+h,v=n[u+1]+d,w=n[v]+h,j=n[v+1]+h;return a(a(a(i(n[b]&15,o,l,c),i(n[w]&15,o-1,l,c),p),a(i(n[y]&15,o,l-1,c),i(n[j]&15,o-1,l-1,c),p),m),a(a(i(n[b+1]&15,o,l,c-1),i(n[w+1]&15,o-1,l,c-1),p),a(i(n[y+1]&15,o,l-1,c-1),i(n[j+1]&15,o-1,l-1,c-1),p),m),g)}}const CH=(e,t,n)=>{const r=Math.hypot(e,t,n)||1;return[e/r,t/r,n/r]};function Cct(e){const t=Sct(e),n=()=>{const d=e()*2-1,h=e()*Math.PI*2,p=Math.sqrt(1-d*d);return[p*Math.cos(h),d,p*Math.sin(h)]},r=.46,a=.5,i=.82,o=.06,l=()=>{for(;;){const d=e()<.5?-1:1,[h,p,m]=n();let g=h,x=p;const b=m;g*d<0&&(g*=.3),x<0&&(x*=.6);const y=Math.max(0,b),v=Math.max(0,-b),w=Math.max(0,h*d);x-=.12*y*y;const j=Math.exp(-(((b-.12)/.42)**2)-((p+.5)/.34)**2)*w;x-=.24*j,g+=.1*d*j,g*=1-.2*v*v,x*=1-.12*v*v;const E=d*.18;let S=E+g*r,_=o+x*a,k=b*i;const C=Math.abs(_-(-.2-.3*(k-.5)));if(w>.3&&k>-.4&&k<.6&&C<.028&&e()<.93)continue;
1492const N=Math.abs(t(S*4.1+d*9.3,_*4.1,k*4.1));if(N<.085&&e()<.9)continue;const A=Math.min(1,N/.3),T=1+.05*A,I=e()<.93?1:.82+e()*.12;S=E+(S-E)*T*I,_=o+(_-o)*T*I,k*=T*I;const[$,O,U]=CH((S-E)/(r*r),(_-o)/(a*a),k/(i*i));return[S,_,k,$,O,U,(.3+.7*A)*(I<1?.6:1),I===1]}},c=()=>{for(;;){const d=e()<.5?-1:1,[h,p,m]=n(),g=d*.16,x=-.32,b=-.5,y=g+h*.25,v=x+p*.15,w=b+m*.21,j=Math.abs(Math.sin((v-x)*62+m*3));if(j<.32&&e()<.85)continue;const[E,S,_]=CH(h/.25,p/.15,m/.21);return[y,v,w,E,S,_,.5+.45*j,!0]}},u=()=>{const d=e(),h=e()*Math.PI*2,p=.095-d*.03;return[Math.cos(h)*p,-.26-d*.5,-.16-d*.12+Math.sin(h)*p*.9,Math.cos(h),.15,Math.sin(h),.75,!0]};return()=>{const d=e();return d<.87?l():d<.96?c():u()}}function TH(e){const a=[],i=Math.round((4.720000000000001+2*Math.PI*.14)/e),o=[[.9-.14,.56-.14,0],[-.9+.14,.56-.14,Math.PI/2],[-.9+.14,-.56+.14,Math.PI],[.9-.14,-.56+.14,1.5*Math.PI]],l=2*(.9-.14),c=2*(.56-.14),u=Math.PI*.14/2,d=[["edge",l,[.9-.14,.56],[-.9+.14,.56]],["corner",u,1],["edge",c,[-.9,.56-.14],[-.9,-.56+.14]],["corner",u,2],["edge",l,[-.9+.14,-.56],[.9-.14,-.56]],["corner",u,3],["edge",c,[.9,-.56+.14],[.9,.56-.14]],["corner",u,0]],h=b=>{let y=b;for(const[v,w,j,E]of d){if(y<=w){const S=y/w;if(v==="edge")return[j[0]+(E[0]-j[0])*S,j[1]+(E[1]-j[1])*S];const[_,k,C]=o[j],N=C+S*(Math.PI/2);return[_+Math.cos(N)*.14,k+Math.sin(N)*.14]}y-=w}return[.9-.14,.56]},p=2*(2*.9-2*.14)+2*(2*.56-2*.14)+2*Math.PI*.14;for(let b=0;b<i;b++)a.push(h(b/i*p));const m=Array.from({length:9},(b,y)=>[-.62+Math.cos(y/9*Math.PI*2)*.1,.26+Math.sin(y/9*Math.PI*2)*.1]),g=[[-.672,.262],[-.636,.222],[-.6,.262],[-.565,.302],[-.535,.336]],x=(b,y,v)=>{const w=Math.max(2,Math.round((v-y)/e)+1);return Array.from({length:w},(j,E)=>[y+(v-y)*E/(w-1),b])};return[{points:a,closed:!0,ticked:!1},{points:m,closed:!0,ticked:!0},{points:g,closed:!1,ticked:!0},{points:x(.26,-.42,.62),closed:!1,ticked:!1},{points:x(.03,-.72,.62),closed:!1,ticked:!1},{points:x(-.14,-.72,.3),closed:!1,ticked:!1},{points:x(-.31,-.72,.5),closed:!1,ticked:!1}]}function AH(e,t){const n=Ect(20261002),r=()=>(n()+n()+n()-1.5)/1.5,a=Cct(n),i=Math.round(e*wct),o=new Float32Array(e*3),l=new Float32Array(e*3),c=new Float32Array(e*3),u=new Float32Array(e*3),d=new Float32Array(e*4),h=new Float32Array(e*4),p=new Float32Array(e*4),m=(L,K)=>[L[K*3],L[K*3+1],L[K*3+2]],g=(L,K)=>(L[0]-K[0])**2+(L[1]-K[1])**2+(L[2]-K[2])**2;for(let L=0;L<e;L++){let K=a();for(;L<i&&!K[7];)K=a();o.set(K.slice(0,3),L*3),l.set(K.slice(3,6),L*3),d.set([n(),1.4+n()*n()*2,K[6],L<i?1:0],L*4),p.set([1,0,0,1],L*4),h.set([n()<.05?1:0,0,0,n()<.12?1:0],L*4)}const x=Math.min(e,1500),b=[0],y=new Float32Array(x).fill(1/0);for(;b.length<Fd.length;){const L=m(o,b[b.length-1]);let K=0;for(let te=0;te<x;te++)y[te]=Math.min(y[te],g(m(o,te),L)),y[te]>y[K]&&(K=te);b.push(K)}const v=b.map(L=>m(o,L)),w=new Uint8Array(e);for(let L=0;L<e;L++){const K=m(o,L);let te=0;v.forEach((Q,Y)=>{g(K,Q)<g(K,v[te])&&(te=Y)}),w[L]=te}const j=Fd.map(()=>[]);for(let L=0;L<i;
1492L++)j[w[L]].length<t&&j[w[L]].push(L);j.forEach((L,K)=>{const te=[];L.forEach(Q=>{let Y=null;for(let J=0;J<30;J++){const P=n()*Math.PI*2,ee=Math.sqrt(n())*Rie,X=[Fd[K][0]+Math.cos(P)*ee,Fd[K][1]+Math.sin(P)*ee*.82,r()*.04],ae=Math.min(...te.map(me=>g(X,me)),1/0);if((!Y||ae>Y[1])&&(Y=[X,ae]),ae>.07*.07)break}te.push(Y[0]),c.set(Y[0],Q*3),p[Q*4+1]=1})});for(let L=0;L<e;L++){if(p[L*4+1])continue;const K=j[w[L]],te=K.length?m(c,K[Math.floor(n()*K.length)]):[...Fd[w[L]],0];c.set([te[0]+r()*.01,te[1]+r()*.01,te[2]],L*3)}const E=[];TH(.075).forEach((L,K)=>L.points.forEach(([te,Q],Y)=>E.push({x:te,y:Q,p:K,k:Y,ticked:L.ticked})));const S=j.flat().sort((L,K)=>c[L*3]+.3*c[L*3+1]-(c[K*3]+.3*c[K*3+1])),_=[...E.keys()].sort((L,K)=>E[L].x+.3*E[L].y-(E[K].x+.3*E[K].y)),k=new Map;_.forEach((L,K)=>{const te=S[Math.floor(K*S.length/_.length)];te===void 0||k.has(te)||(k.set(te,L),u.set([E[L].x,E[L].y,r()*.01],te*3),p[te*4+2]=1,h[te*4+2]=E[L].ticked?1:0)});const C=new Map([...k].map(([L,K])=>[K,L]));for(let L=0;L<e;L++){if(p[L*4+2])continue;const K=E[Math.floor(n()*E.length)];u.set([K.x+r()*.01,K.y+r()*.01,0],L*3)}const N=[],A=new Set,T=(L,K,te)=>{const Q=`${Math.min(L,K)}:${Math.max(L,K)}:${te}`;L!==K&&!A.has(Q)&&(A.add(Q),N.push([L,K,te]))},I=(L,K,te,Q,Y)=>L.forEach(J=>{L.map(P=>[g(K(J),K(P)),P]).filter(([P,ee])=>ee!==J&&P<Q*Q).sort((P,ee)=>P[0]-ee[0]).slice(0,te).forEach(([,P])=>T(J,P,Y))});I([...Array(i).keys()],L=>m(o,L),2,.24,"brain"),j.forEach(L=>I(L,K=>m(c,K),3,.17,"network"));const $=new Map;E.forEach((L,K)=>{$.has(L.p)||$.set(L.p,[]),$.get(L.p).push(K)});const O=TH(.075);$.forEach((L,K)=>L.forEach((te,Q)=>{const Y=Q+1<L.length?L[Q+1]:O[K].closed?L[0]:null;Y!==null&&C.has(te)&&C.has(Y)&&T(C.get(te),C.get(Y),"task")}));const U={brain:[1,0,0,1],network:[0,1,0,0],task:[0,0,1,0]},F=[],H=(L,K,te,Q,Y,J,P,ee)=>F.push([L,K,te,[Q,Y,J,P],ee]);N.forEach(([L,K,te])=>{const Q=n();
1492[L,K].forEach((Y,J)=>H(m(o,Y),m(c,Y),m(u,Y),d[Y*4],J,Q,0,U[te]))});const G=(L,K)=>[L[1]*K[2]-L[2]*K[1],L[2]*K[0]-L[0]*K[2],L[0]*K[1]-L[1]*K[0]],M=L=>{const K=Math.hypot(...L)||1;return L.map(te=>te/K)};for(let L=0;L<i;L++){const K=m(l,L);let te=G(K,[0,1,0]);Math.hypot(...te)<.1&&(te=G(K,[1,0,0])),te=M(te);const Q=G(K,te),Y=m(o,L),J=m(c,L),P=m(u,L),ee=([he,se])=>[[Y[0]+he*te[0]+se*Q[0],Y[1]+he*te[1]+se*Q[1],Y[2]+he*te[2]+se*Q[2]],[J[0]+he*.62,J[1]+se*.62,J[2]],[P[0]+he*.4,P[1]+se*.4,P[2]]],X=[p[L*4],p[L*4+1],p[L*4+2],p[L*4+3]],ae=d[L*4],me=(he,se,le,ke)=>{const[oe,Oe,Je]=ee(he),[Ie,ue,be]=ee(se);H(oe,Oe,Je,ae,le,0,1,X),H(Ie,ue,be,ae,ke,0,1,X)},q=4+Math.floor(n()*3);for(let he=0;he<q;he++){let se=he/q*Math.PI*2+n()*.9;const le=.05+n()*.07,ke=[[0,0]];for(let oe=1;oe<=3;oe++){se+=(n()-.5)*.7;const[Oe,Je]=ke[oe-1];ke.push([Oe+Math.cos(se)*le/3,Je+Math.sin(se)*le/3])}for(let oe=1;oe<=3;oe++)me(ke[oe-1],ke[oe],(oe-1)/3,oe/3);if(n()<.7){let oe=se+(n()<.5?-1:1)*(.5+n()*.5),Oe=ke[1];for(let Je=0;Je<2;Je++){oe+=(n()-.5)*.6;const Ie=[Oe[0]+Math.cos(oe)*le*.22,Oe[1]+Math.sin(oe)*le*.22];me(Oe,Ie,.33+Je*.3,.63+Je*.3),Oe=Ie}}}}const z=new Float32Array(F.length*3),W=new Float32Array(F.length*3),D=new Float32Array(F.length*3),Z=new Float32Array(F.length*4),V=new Float32Array(F.length*4);return F.forEach(([L,K,te,Q,Y],J)=>{z.set(L,J*3),W.set(K,J*3),D.set(te,J*3),Z.set(Q,J*4),V.set(Y,J*4)}),{count:e,A:o,N:l,B:c,C:u,meta:d,tag:h,vis:p,lines:F.length,LA:z,LB:W,LC:D,lineMeta:Z,lineAlpha:V}}function RH(e,t,n){const r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r)||"shader");return r}function IH(e,t,n){const r=e.createProgram();if(e.attachShader(r,RH(e,e.VERTEX_SHADER,t)),e.attachShader(r,RH(e,e.FRAGMENT_SHADER,n)),e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))throw new Error(e.getProgramInfoLog(r)||"link");return r}const Tct=["uFrom","uTo","uT","uTime","uYaw","uSpin","uScale","uOffset","uFit","uTilt","uPx","uBrain","uImpulse"],Act=e=>e*e*(3-2*e),Fo=(e,t,n)=>e+(t-e)*n;function Rct(e,t,n,r){const a=Math.cos(r.yaw),i=Math.sin(r.yaw);let o=e+(a*e+i*n-e)*r.spin,l=n+(-i*e+a*n-n)*r.spin;const c=Math.cos(r.tiltX),u=Math.sin(r.tiltX);[o,l]=[c*o+u*l,-u*o+c*l];const d=Math.cos(r.tiltY),h=Math.sin(r.tiltY),p=d*t-h*l;l=h*t+d*l;const m=3.4/(3.4-l);return[o*m*r.scale*r.fitX+r.x,p*m*r.scale*r.fitY+r.y]}function Ict({storyRef:e}){const t=f.useRef(null),n=f.useRef(null),[r,a]=f.useState(!1);return f.useEffect(()=>{const i=t.current,o=e.current,l=i?.getContext("webgl2",{antialias:!1,alpha:!0,premultipliedAlpha:!0,powerPreference:"low-power"});if(!l||!o){a(!0);return}let c,u;try{c=IH(l,jct,_ct),u=IH(l,kct,Nct)}catch(D){console.warn("BrainCanvas: WebGL setup failed, showing the fallback.",D),a(!0);return}const d=matchMedia("(max-width: 899px)"),h=matchMedia("(prefers-reduced-motion: reduce)"),p=d.matches?AH(7e3,14):AH(14e3,20),m=new Map,g=(D,Z)=>{const V=l.createVertexArray();return l.bindVertexArray(V),Z.forEach(([L,K,te])=>{if(!m.has(K)){const Y=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,Y),l.bufferData(l.ARRAY_BUFFER,K,l.STATIC_DRAW),m.set(K,Y)}l.bindBuffer(l.ARRAY_BUFFER,m.get(K));const Q=l.getAttribLocation(D,L);l.enableVertexAttribArray(Q),l.vertexAttribPointer(Q,te,l.FLOAT,!1,0,0)}),V},x=g(c,[["aA",p.A,3],["aB",p.B,3],["aC",p.C,3],["aD",p.A,3],["aN",p.N,3],["aMeta",p.meta,4],["aTag",p.tag,4],["aVis",p.vis,4]]),b=g(u,[["lA",p.LA,3],["lB",p.LB,3],["lC",p.LC,3],["lD",p.LA,3],["lMeta",p.lineMeta,4],["lAlpha",p.lineAlpha,4]]),y=D=>Object.fromEntries(Tct.map(Z=>[Z,l.getUniformLocation(D,Z)])),v=[[u,y(u)],[c,y(c)]];l.enable(l.BLEND),l.blendFunc(l.ONE,l.ONE_MINUS_SRC_ALPHA),l.clearColor(0,0,0,0);let w=0,j=0,E=1;const S=()=>{E=Math.min(window.devicePixelRatio||1,2),w=i.clientWidth,j=i.clientHeight,i.width=Math.max(1,Math.round(w*E)),i.height=Math.max(1,Math.round(j*E)),l.viewport(0,0,i.width,i.height)};S();const _=new ResizeObserver(S);_.observe(i);const k={x:0,y:0,sx:0,sy:0},C=D=>{D.pointerType==="mouse"&&(k.x=(D.clientX/window.innerWidth-.5)*2,k.y=(D.clientY/window.innerHeight-.5)*2)};window.addEventListener("pointermove",C,{passive:!0});const N=[...n.current?.children||[]],A=iC.length-1,T=()=>{const D=o.getBoundingClientRect();return Math.min(Math.max(-D.top/(window.innerHeight||1),0),A)};let I=T(),$=0,O=null,U=0,F=!0,H=!1;const G=D=>{U=0;const Z=h.matches,V=O===null?16:Math.min(D-O,64);O=D;const L=T();I=Z?Math.round(L):Fo(I,L,1-Math.pow(.86,V/16)),Math.abs(L-I)<5e-4&&(I=L),Z||($+=V/1e3),k.sx=Fo(k.sx,k.x,.05),k.sy=Fo(k.sy,k.y,.05);const K=Math.min(Math.floor(I),A),te=Math.min(K+1,A),Q=Act(Math.min(Math.max((I-K-.18)/.64,0),1)),Y=d.matches?SH.narrow:SH.wide,J=Y[K],P=Y[te],ee=Math.min(w,j),X=Fo(J.spin,P.spin,Q),ae={yaw:yct+(Z?0:.26*Math.sin($*.24)),spin:X,scale:Fo(J.scale,P.scale,Q),x:Fo(J.x,P.x,Q),y:Fo(J.y,P.y,Q),fit
1492X:ee/Math.max(w,1),fitY:ee/Math.max(j,1),tiltX:Z?0:k.sx*.16*X,tiltY:X*.32+(Z?0:k.sy*.08*X)};l.clear(l.COLOR_BUFFER_BIT),v.forEach(([le,ke])=>{l.useProgram(le),l.uniform1f(ke.uFrom,K),l.uniform1f(ke.uTo,te),l.uniform1f(ke.uT,Q),l.uniform1f(ke.uTime,$),l.uniform1f(ke.uYaw,ae.yaw),l.uniform1f(ke.uSpin,X),l.uniform1f(ke.uScale,ae.scale),l.uniform2f(ke.uOffset,ae.x,ae.y),l.uniform2f(ke.uFit,ae.fitX,ae.fitY),l.uniform2f(ke.uTilt,ae.tiltX,ae.tiltY),l.uniform1f(ke.uPx,E),l.uniform1f(ke.uBrain,Fo(J.brain,P.brain,Q)),l.uniform1f(ke.uImpulse,Fo(J.impulse,P.impulse,Q)),le===u?(l.bindVertexArray(b),l.drawArrays(l.LINES,0,p.lines)):(l.bindVertexArray(x),l.drawArrays(l.POINTS,0,p.count))});const me=Math.min(Math.max(1-Math.abs(I-1)*2.4,0),1);(me>0||H)&&(H=me>0,N.forEach((le,ke)=>{const[oe,Oe]=Rct(Fd[ke][0],Fd[ke][1]-Rie-.08,0,ae);le.style.opacity=String(me),le.style.transform=`translate(${((oe*.5+.5)*w).toFixed(1)}px, ${((.5-Oe*.5)*j).toFixed(1)}px) translate(-50%, 0)`}));const q=iC[K],he=iC[te];o.style.setProperty("--ent-story-bg",`rgb(${q.map((le,ke)=>Math.round(Fo(le,he[ke],Q))).join(",")})`);const se=I===L&&Z;F&&!document.hidden&&!se&&(U=requestAnimationFrame(G))},M=()=>{!U&&F&&!document.hidden&&(O=null,U=requestAnimationFrame(G))},z=new IntersectionObserver(([D])=>{F=D.isIntersecting,F&&M()});z.observe(i),window.addEventListener("scroll",M,{passive:!0}),document.addEventListener("visibilitychange",M),h.addEventListener("change",M);const W=D=>{D.preventDefault(),F=!1,cancelAnimationFrame(U),a(!0)};return i.addEventListener("webglcontextlost",W),M(),()=>{cancelAnimationFrame(U),z.disconnect(),_.disconnect(),window.removeEventListener("pointermove",C),window.removeEventListener("scroll",M),document.removeEventListener("visibilitychange",M),h.removeEventListener("change",M),i.removeEventListener("webglcontextlost",W),m.forEach(D=>l.deleteBuffer(D)),l.deleteVertexArray(x),l.deleteVertexArray(b),l.deleteProgram(c),l.deleteProgram(u)}},[e]),s.jsxs("div",{className:`ent-brain${r?" ent-brain-fallback":""}`,"aria-hidden":"true",children:[!r&&s.jsx("canvas",{ref:t}),!r&&s.jsx("div",{ref:n,className:"ent-brain-labels",children:vct.map(i=>s.jsx("span",{children:i},i))})]})}const oC={name:"Halden Supply",logo:"/enterprise/halden-logo.svg"},lC=e=>`/enterprise/${e}.jpg`,cC={warehouse:{src:lC("people-warehouse"),alt:"Two colleagues walking an aisle of a supplies warehouse"},leadership:{src:lC("people-leadership"),alt:"A leadership team in a meeting around a table"},clinic:{src:lC("people-clinic"),alt:"A modern dental treatment room"}},PH=[["#journey","How it works"],["#solutions","Solutions"],["#faq","FAQ"]],Uv={label:"AI Transformation for enterprise",lead:"AI that knows",soft:"your company.",sub:"We learn how your company really works, then build AI around it: assistants for every team, an AI Expert for your customers, voice agents and custom automations."},Pct=[{title:"Your company already knows how to do the work.",sub:"It is just scattered across people, inboxes and spreadsheets."},{title:"Connected, it turns into work done.",sub:"Orders, prices, policies and know-how come together into tasks that AI can run."},{title:"That is your Company Brain.",sub:"Built from your people. Then the busywork starts to disappear."}],uC={label:"How it works",title:"From the first call to AI that takes the busywork.",steps:[{id:"strategy",n:"01",title:"Strategy call",body:"We start with your goals and where the pressure is, not with a tool."},{id:"audit",n:"02",title:"Employee audit",body:"An AI Expert interviews your team by voice or chat and maps every task that repeats, with the hours it costs."},{id:"company-brain",n:"03",title:"Company Brain",body:"Interviews, documents and the tools you already use become one source of truth that every AI works from."},{id:"design",n:"04",title:"Solution design",body:"We pick the biggest wins and design AI around your workflows, from the building blocks below."},{id:"pilot",n:"05",title:"Pilot",body:"One team and one goal, agreed up front. We build it, launch it and measure it."},{id:"scale",n:"06",title:"Scale",body:"Roll out what works, team by team. The brain keeps learning as your company changes."}]}
1492,zv={label:"What we build",title:"Custom AI, built around how you work.",sub:"Every solution runs on your Company Brain and answers only from what your company knows.",items:[{icon:"team",title:"AI Experts for every team",body:"An assistant for sales, support, operations or HR that answers staff questions around the clock.",points:["Answers from your own documents","Onboards new hires","Drafts replies and quotes"]},{icon:"customers",title:"An AI Expert for your customers",body:"On your website or its own page. It answers in your customerâs language, recommends the right product and captures every lead.",points:["Answers 24/7, in any language","Recommends the right product","Hands warm leads to your team"]},{icon:"voice",title:"Voice AI agents",body:"Natural voice conversations, in your voice or a teammateâs, for your customers or for your own team.",points:["Takes calls on your website","Shows products as it speaks","Runs the employee audit"]},{icon:"automation",title:"Custom automations",body:"Bespoke builds for the work that repeats, connected to the tools you already use.",points:["Order entry from email","Status updates and follow-ups","Stock and price checks"]}]},Lct=[{photo:cC.warehouse,tag:"Operations",title:"Big enough to feel the friction.",body:"Enough people that the same questions and the same copy-paste happen every day. Small enough to change fast."},{photo:cC.leadership,tag:"Leadership",title:"For the people who own the outcome.",body:"You know AI matters. We turn it into hours back for your team, not another tool to manage."},{photo:cC.clinic,tag:"Distribution, healthcare, services",title:"Built for people-heavy work.",body:"Order desks, support lines, sales teams and onboarding. Work that runs on what your people know."}],LH={value:"100+",label:"companies work with Great Experts"},Oct=[{result:"28%",label:"of the workweek goes to managing email.",source:"McKinsey Global Institute, 2012",href:"https://www.mckinsey.com/~/media/mckinsey/industries/technology%20media%20and%20telecommunications/high%20tech/our%20insights/the%20social%20economy/mgi_the_social_economy_full_report.pdf"},{result:"~20%",label:"goes to looking for internal information, or the colleague who knows.",source:"McKinsey Global Institute, 2012",href:"https://www.mckinsey.com/~/media/mckinsey/industries/technology%20media%20and%20telecommunications/high%20tech/our%20insights/the%20social%20economy/mgi_the_social_economy_full_report.pdf"},{result:"60â70%",label:"of employeesâ time goes to work that todayâs AI can automate.",source:"McKinsey, 2023",href:"https://www.mckinsey.com/capabilities/tech-and-ai/our-insights/the-economic-potential-of-generative-ai-the-next-productivity-frontier"}],Hv={columns:["","Build it in-house","With Great Experts"],rows:[["Starting point","A blank slate and a vendor list","Interviews with the people doing the work"],["Context for the AI","Whatever someone remembers to upload","A Company Brain built from people, files and tools"],["Who does the work","Your already-busy team","Our team, alongside yours"],["Adoption","Another tool nobody opens","An AI Expert people talk to, by voice or chat"],["Risk","A long project before anything works","A pilot with one team, then scale what works"]]},Mct=[{n:"01",q:"What can you build for us?",a:"Four kinds of solution, combined to fit your company: AI Experts for each team, an AI Expert for your customers, voice AI agents and custom automations. Each one runs on your Company Brain."},{n:"02",q:"What happens in the employee audit?",a:"Each person has a short conversation with an AI Expert, by voice or chat, whenever suits them. It asks how their week really goes, follows up like a good consultant, and marks every task that repeats. You get one report: where the time goes, and what to automate first."},{n:"03",q:"Do our people need to be technical?",a:"No. They talk, the way they would to a new colleague. Nobody installs anything or learns a new tool."},{n:"04",q:"What is a Company Brain?",a:"One place that holds how your company actually works: people and roles, products, processes, customers and policies. It is built from the interviews and the files and tools you already have, and every AI agent works from it."},{n:"05",q:"Will it invent answers about our prices or our process?",a:"Never. It only answers from what you gave it, and nothing is pulled from the internet. When a question goes past what it knows, it says so and passes the person to your team."},{n:"06",q:"Will our knowledge train a model our competitors can use?",a:"Never. It stays inside your instance and works for you only. It is never sold, never licensed, and you can delete everything at any time."},{n:"07",q:"How do we start?",a:"Book a strategy call. We agree your goals, run the audit with one team, and decide together what the pilot should prove before anything is built."}],OH={title:"Give your company a brain.",sub:"Start with one team. See where the hours go, then take them back."},Dct=["Overview","Interviews","Tasks"],$ct=["All teams","Customer service","Sales","Operations"],T5=[["Re-keying emailed orders","Customer service",31],["Product and compatibility questions","Sales",22],["Order status follow-ups","Operations",14],["New-hire product training","All teams",9]],Pie=T5.reduce((e,[,,t])=>e+t,0),Fct=[["Interviews",12,"Across customer service, sales, operations and finance"],["Repeat tasks foun
1492d",23,"Work that happens the same way every week"],["Hours a week",Pie,"Spent on the four biggest tasks"]];function Bct(){const e=f.useRef(null),t=Q0(e,{duration:1800,loop:!1,threshold:.3}),n=1-Math.pow(1-Math.min(t/1400,1),3);return s.jsx("div",{ref:e,className:"ld-showcase ent-audit",role:"img","aria-label":`Sample audit report for ${oC.name}: 12 interviews, 23 repeat tasks, ${Pie} hours a week on the four biggest, led by re-keying emailed orders. Order re-entry is the first pilot.`,children:s.jsx("div",{className:"ld-demo lp-product","aria-hidden":"true",children:s.jsxs("div",{className:"ld-app",children:[s.jsxs("header",{className:"ld-header",children:[s.jsxs("h3",{children:["Team ",s.jsx("em",{children:"audit"})]}),s.jsxs("span",{className:"ent-audit-company",children:[s.jsx("img",{src:oC.logo,alt:""}),oC.name]})]}),s.jsxs("div",{className:"ld-toolbar",children:[s.jsx("div",{className:"ld-tabs",children:Dct.map((r,a)=>s.jsx("button",{type:"button",tabIndex:-1,"aria-selected":a===0,children:r},r))}),s.jsx("div",{className:"ld-filters",children:$ct.map((r,a)=>s.jsx("button",{type:"button",tabIndex:-1,"aria-pressed":a===0,children:r},r))})]}),s.jsxs("section",{className:"lp-view",children:[s.jsx("div",{className:"lp-intro",children:s.jsxs("div",{children:[s.jsxs("h4",{children:["Where your teamâs week ",s.jsx("em",{children:"actually goes"})]}),s.jsxs("p",{children:["From 12 interviews across 4 teams. ",s.jsx("strong",{children:"Anonymous"}),": it shows the work, not who said it."]})]})}),s.jsx("div",{className:"lp-metrics",children:Fct.map(([r,a,i],o)=>s.jsxs("div",{className:`lp-metric ${o===2?"accent":""}`,children:[s.jsx("span",{className:"lp-eyebrow",children:r}),s.jsx("strong",{children:Math.round(a*n)}),s.jsx("div",{children:s.jsx("small",{children:i})})]},r))}),s.jsxs("section",{className:"lp-card lp-insight-card",children:[s.jsxs("div",{className:"lp-card-header",children:[s.jsx("strong",{children:"Where the time goes"}),s.jsx("span",{children:"Hours a week, sample"})]}),s.jsx("div",{className:"lp-card-body",children:T5.map(([r,a,i])=>s.jsxs("div",{className:"lp-bar-row",children:[s.jsx("span",{children:r}),s.jsx("i",{children:s.jsx("b",{style:{width:`${i/T5[0][2]*100*n}%`}})}),s.jsxs("strong",{children:[i," h"]}),s.jsx("small",{children:a})]},r))})]})]})]})})})}const Uct=".ent-hero-copy > *, .ent-beat > div, .ent-head, .ent-journey > li, .ent-solution, .ent-results > *, .ent-photo-card, .ent-compare-copy, .ent-table, #faq > h2, #faq .ge-acc, .ent-closing-inner",zct={team:B4,customers:vc,voice:kY,automation:AY},Lie=e=>t=>{eR("ge_enterprise_book_call",{location:e}),t.preventDefault(),bct(r0)};function dC({location:e,className:t,children:n}){return s.jsx("a",{className:t,href:r0,target:"_blank",rel:"noopener noreferrer",onClick:Lie(e),children:n})}function Hct(){const e=f.useRef(null),t=f.useRef(null);return BP(e,{reveal:Uct,demos:".ld-showcase"}),s.jsxs("div",{ref:e,className:"welcome-page business-landing ent-page",children:[s.jsx(vs,{path:"/enterprise",title:or.enterprise.title,description:or.enterprise.description,ogImage:or.enterprise.image}),s.jsx(l0,{children:s.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap",rel:"stylesheet"})}),s.jsxs("div",{className:"ge-home",children:[s.jsx("div",{className:"ge-nav",children:s.jsx("div",{children:s.jsx(Dk,{links:PH,mobileLinks:PH,cta:"Book a call",ctaHref:r0,onCta:Lie("nav"),login:!1})})}),s.jsxs("main",{className:"ent-main",children:[s.jsxs("div",{ref:t,className:"ent-story",children:[s.jsx("div",{className:"ent-story-stage",children:s.jsx(Ict,{storyRef:t})}),s.jsxs("div",{className:"ent-story-content",children:[s.jsx("header",{className:"ent-hero",children:s.jsxs("div",{className:"ent-hero-copy",children:[s.jsx("p",{className:"ent-label",children:Uv.label}),s.jsxs("h1",{children:[s.jsx("span",{children:Uv.lead})," ",s.jsx("span",{className:"ent-soft",children:Uv.soft})]}),s.jsx("p",{className:"ent-hero-sub",children:Uv.sub}),s.jsxs("div",{className:"ent-actions",children:[s.jsx(dC,{location:"hero",className:"ent-btn",children:"Book a strategy call"}),s.jsxs("a",{className:"ent-link",href:"#journey",children:["See how it works ",s.jsx("span",{"aria-hidden":"true",children:"âº"})]})]})]})}),Pct.map(n=>s.jsx("section",{className:"ent-beat",children:s.jsxs("div",{children:[s.jsx("h2",{children:n.title}),s.jsx("p",{children:n.sub})]})},n.title))]})]}),s.jsxs("section",{id:"journey",className:"ent-section","aria-labelledby":"ent-journey-title",children:[s.jsxs("header",{className:"ent-head",children:[s.jsx("p",{className:"ent-label",children:uC.label}),s.jsx("h2",{id:"ent-journey-title",children:uC.title})]}),s.jsx("ol",{className:"ent-journey",children:uC.steps.map(n=>s.jsxs("li",{id:n.id,children:[s.jsx("span",{className:"ent-journey-n",children:n.n}),s.jsxs("div",{className:"ent-journey-body",children:[s.jsx("h3",{children:n.title}),s.jsx("p",{children:n.body}),n.id==="audit"&&s.jsx("div",{className:"ent-audit-panel",children:s.jsx(Bct,{})})]})]},n.id))})]}),s.jsxs("section",{id:"solutions",className:"ent-section","aria-labelledby":"ent-solutions-title",children:[s.jsxs("header",{className:"ent-head",children:[s.jsx("p",{className:"ent-label",children:zv.label}),s.jsx("h2",{id:"ent-solutions-title",children:zv.title}),s.jsx("p",{children:zv.sub})]}),s.jsx("div",{className:"ent-solutions",children:zv.items.map(n=>{const r=zct[n.icon];return s.jsxs("article",{className:"ent-solution",children:[s.jsx("span",{className:"ent-solution-icon",children:s.jsx(r,{size:22,strokeWidth:1.8,"aria-hidden":"true"})}),s.jsx("h3",{children:n.title}),s.jsx("p",{children:n.body}),s.jsx("ul",{children:n.points.map(a=>s.jsxs("li",{children:[s.jsx(ft,{size:16,strokeWidth:2.2,"aria-hidden":"true"}),a]},a))})]},n.title)})})]}),s.jsxs("section",{className:"ent-section","aria-labelledby":"ent-results-title",children:[s.jsxs("header",{className:"ent-head",children:[s.jsx("p",{className:"ent-label",children:"Results"}),s.jsx("h2",{id:"ent-results-title",children:"The hours are there to win back."})]}),s.jsxs("div",{className:"ent-results",children:[s.jsxs("article",{className:"ent-result ent-result-lead",children:[s.jsx("strong",{children:LH.value}),s.jsx("span",{children:LH.label})]}),Oct.map(n=>s.jsxs("article",{className:"ent-result",children:[s.jsx("strong",{children:n.result}),s.jsx("span",{children:n.label}),s.jsx("p",{children:s.jsx("a",{href:n.href,target:"_blank",rel:"noopener noreferrer",children:n.source})})]},n.result))]})]}),s.jsxs("section",{className:"ent-section","aria-labelledby":"ent-audience-title",children:[s.jsxs("header",{className:"ent-head",children:[s.jsx("p",{className:"ent-label",children:"Who it is for"}),s.jsx("h2",{id:"ent-audience-title",children:"For companies that run on what their people know."})]}),s.jsx("div",{className:"ent-grid",children:Lct.map(n=>s.jsxs("article",{className:"ent-photo-card",children:[s.jsx("img",{src:n.photo.src,alt:n.photo.alt,width:"1400",height:"932",loading:"lazy"}),s.jsxs("div",{children:[s.jsx("p",{className:"ent-card-tag",children:n.tag}),s.jsx("h3",{children:n.title}),s.jsx("p",{children:n.body})]})]},n.title))})]}),s.jsxs("section",{className:"ent-section ent-compare","aria-labelledby":"ent-compare-title",children:[s.jsxs("header",{className:"ent-compare-copy",children:[s.jsx("p",{className:"ent-label",children:"Why Great Experts"}),s.jsx("h2",{id:"ent-compare-title",children:"Build it in-house, or start with one team."}),s.jsx("p",{children:"An honest comparison."}),s.jsx(dC,{location:"compare",className:"ent-btn",children:"Book a strategy call"})]}),s.jsxs("table",{className:"ent-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:Hv.columns.map((n,r)=>s.jsx("th",{scope:"col",children:n||s.jsx("span",{className:"ent-sr",children:"Topic"})},r))})}),s.jsx("tbody",{children:Hv.rows.map(([n,r,a])=>s.jsxs("tr",{children:[s.jsx("th",{scope:"row",children:n}),s.jsx("td",{"data-label":Hv.columns[1],children:s.jsxs("span",{className:"ent-cell ent-no",children:[s.jsx(D4,{size:16,strokeWidth:2,"aria-hidden":"true"}),r]})}),s.jsx("td",{"data-label":Hv.columns[2],children:s.jsxs("span",{className:"ent-cell ent-yes",children:[s.jsx(ft,{size:16,strokeWidth:2.4,"aria-hidden":"true"}),a]})})]},n))})]})]}),s.jsx(UP,{items:Mct,title:"Questions leaders ask before they start."}),s.jsx("section",{className:"ent-section ent-closing","aria-labelledby":"ent-closing-title",children:s.jsxs("div",{className:"ent-closing-inner",children:[s.jsx("h2",{id:"ent-closing-title",children:OH.title}),s.jsx("p",{children:OH.sub}),s.jsxs("div",{className:"ent-actions",children:[s.jsx(dC,{location:"closing",className:"ent-btn",children:"Book a strategy call"}),s.jsxs("a",{className:"ent-link",href:"#journey",children:["See how it works ",s.jsx("span",{"aria-hidden":"true",children:"âº"})]})]})]})})]}),s.jsx(zP,{})]})]})}function qct(){return s.jsx(Hct,{})}const MH={muted:"text-ink-muted",ink:"text-ink",indigo:"text-indigo",peach:"text-peach-deep"};function Wct({children:e,tone:t="muted",as:n="span",className:r=""}){return s.jsx(n,{className:`font-mono text-xs font-medium uppercase tracking-eyebrow ${MH[t]||MH.muted} ${r}`,children:e})}async function Vct(e){const{data:t,error:n}=await Rt.rpc("submit_feedback",{p_context_type:e.context_type,p_message_id:e.message_id||null,p_liked:e.liked||null,p_disliked:e.disliked||null,p_nps_score:e.nps_score});if(n){const r=n.message||"",a=new Error(r);throw r.includes("MESSAGE_NOT_FOUND")?a.response={status:404,data:{detail:{code:"MESSAGE_NOT_FOUND",message:"Expert message not found or not accessible."}}}:r.includes("MISSING_MESSAGE_ID")?a.response={status:400,data:{detail:{code:"MISSING_MESSAGE_ID",message:"Message ID required."}}}:a.response={status:400,data:{detail:{code:"FEEDBACK_FAILED",message:r}}},a}return{status:"success",data:t}}const yd={low:{label:"Needs improvement",color:"#C64840"},mid:{label:"Good, but not sure",color:"#A17D3A"},high:{label:"Would recommend",color:"#6E8355"}};function Wg(e){return e<=3?"low":e<=6?"mid":"high"}function Gct(){const e=Ps(),t=an(),{addToast:n}=f.useContext(Zs),r=t.state||null,[a,i]=f.useState(""),[o,l]=f.useState(""),[c,u]=f.useState(7),[d,h]=f.useState(!1);if(f.useEffect(()=>{(!r||!r.contextType)&&(n("Open feedback from a chat message","info"),e("/",{replace:!0}))},[r,n,e]),!r||!r.contextType)return null;const{contextType:p,messageId:m}=r,g=async b=>{if(b.preventDefault(),!d){h(!0);try{await Vct({context_type:p,message_id:p==="chat"?m:null,liked:a.trim()||null,disliked:o.trim()||null,nps_score:c}),n("Thanks for the feedback","success"),e(-1)}catch(y){const v=y?.response?.data?.detail?.message||"Could not send feedback";n(v,"error")}finally{h(!1)}}};return s.jsx("div",{className:"feedback-page min-h-[calc(100dvh-120px)] flex items-start justify-center px-4 py-8",children:s.jsxs("div",{className:"w-full max-w-xl",children:[s.jsxs("button",{type:"button",onClick:()=>e(-1),className:"inline-flex items-center gap-1.5 text-xs font-mono uppercase tracking-eyebrow text-ink-muted hover:text-ink mb-4 transition-colors",children:[s.jsx(ja,{className:"w-3.5 h-3.5"}),"Back"]}),s.jsxs("div",{className:"bg-paper rounded-lg border border-rule shadow-card p-6 sm:p-8",children:[s.jsxs("div",{className:"flex items-center gap-2.5 mb-1",children:[s.jsx("span",{className:"inline-flex items-center justify-center w-8 h-8 rounded-md bg-indigo-wash text-indigo-deep",children:s.jsx(xY,{className:"w-4 h-4"})}),s.jsx(Wct,{children:"Send feedback"})]}),s.jsx("h1",{className:"font-heading text-2xl text-ink mb-1",children:"Tell us how is your experience"}),s.jsx("p",{className:"text-sm text-ink-mid mb-6",children:"Feel free to give your honest feedback"}),s.jsxs("form",{onSubmit:g,className:"space-y-5",children:[s.jsx(ul,{type:"textarea",label:"What you liked",value:a,onChange:b=>i(b.target.value),placeholder:"What worked well?",rows:4,maxLength:2e3}),s.jsx(ul,{type:"textarea",label:"What you didn't like",value:o,onChange:b=>l(b.target.value),placeholder:"What could be better?",rows:4,maxLength:2e3}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-mono font-medium uppercase tracking-eyebrow text-ink-muted mb-3",children:"Would you recommend us?"}),s.jsxs("div",{className:"flex items-baseline gap-2 mb-3",children:[s.jsx("span",{className:"font-heading text-5xl leading-none transition-colors duration-200",style:{color:yd[Wg(c)].color,fontVariantNumeric:"tabular-nums"},children:c}),s.jsx("span",{className:"text-sm text-ink-muted",children:"/ 10"}),s.jsxs("span",{className:"text-sm font-medium transition-colors duration-200",style:{color:yd[Wg(c)].color},children:["· ",yd[Wg(c)].label]})]}),s.jsx("input",{type:"range",min:1,max:10,step:1,value:c,onChange:b=>u(Number(b.target.value)),className:`feedback-page__slider feedback-page__slider--${Wg(c)}`,"aria-label":`Would you recommend us, 1 to 10 â currently ${yd[Wg(c)].label}`}),s.jsxs("div",{className:"feedback-page__zone-labels",children:[s.jsx("span",{style:{color:yd.low.color},children:"Needs work"}),s.jsx("span",{style:{color:yd.mid.color},children:"Okay"}),s.jsx("span",{style:{color:yd.high.color},children:"Great"})]})]}),s.jsx("div",{className:"pt-2",children:s.jsx(yt,{type:"submit",variant:"primary",size:"lg",isLoading:d,className:"w-full",children:"Send feedback"})})]})]})]})})}const DH={a:0,ay:0,hey:0,eh:0,b:1,be:1,bee:1,c:2,see:2,sea:2,si:2,d:3,de:3,dee:3,e:4,f:5,ef:5,eff:5,g:6,gee:6,h:7,aitch:7,age:7},$H={first:0,second:1,third:2,fourth:3,fifth:4,sixth:5,seventh:6,eighth:7,last:-2},FH={1:0,one:0,2:1,two:1,to:1,too:1,3:2,three:2,4:3,four:3,for:3,5:4,five:4,6:5,six:5,7:6,seven:6,8:7,eight:7},Yct=new Set(["option","options","answer","letter","number","choice","the","i","id","ill","im","think","its","it","is","choose","pick","my","me","select","go","with","please","um","uh","like","that","would","say","maybe","probably","this","take","s","t","ll","re","ve","m"]),BH=e=>(e||"").toLowerCase().normalize("NFD").replace(/[Ì-ͯ]/g,"").replace(/[^a-z0-9\s]/g," ").trim();function Kct(e,t){const n=BH(e);if(!n)return-1;const r=n.split(/\s+/).filter(c=>!Yct.has(c)),a=c=>DH[c]!==void 0||$H[c]!==void 0||FH[c]!==void 0;if(r.length&&r.every(a)){const c=u=>new Set(r.map(d=>u[d]).filter(d=>d!==void 0));for(const u of[DH,$H,FH]){const d=c(u);if(d.size>1)break;if(d.size===1){let h=[...d][0];if(h===-2&&(h=t.length-1),h>=0&&h<t.length)return h;break}}}const i=new Set(n.split(/\s+/));let o=-1,l=0;return t.forEach((c,u)=>
1492{const d=BH(c.label).split(/\s+/).filter(Boolean);if(!d.length)return;const h=d.filter(p=>i.has(p)).length/d.length;h>l&&(l=h,o=u)}),l>=.5?o:-1}function Xct(e,t){return[...e].sort((n,r)=>(n.min_points||0)-(r.min_points||0)).reduce((n,r)=>(r.min_points||0)<=t?r:n,e[0])}const qv=typeof window<"u"?window.SpeechRecognition||window.webkitSpeechRecognition:null,Vg=typeof window<"u"&&"speechSynthesis"in window,hC="ABCDEFGH",Jct=24e3;function Qct({quiz:e,expertName:t,accent:n,tts:r=null,audio:a=null}){const[i,o]=f.useState(e.intro?-1:0),[l,c]=f.useState([]),[u,d]=f.useState(null),[h,p]=f.useState(!1),[m,g]=f.useState(!1),[x,b]=f.useState(!1),[y,v]=f.useState(!1),[w,j]=f.useState(!1),[E,S]=f.useState(""),_=f.useRef(null),k=f.useRef(null),C=f.useRef({ctx:null,srcs:[],playAt:0,abort:null,endTimer:null}),N=f.useRef(!0),A=f.useRef(new Map),T=f.useRef(0),I=f.useRef(!1),$=e.questions||[],O=u!==null?u:l[i],U=l.reduce((se,le,ke)=>se+($[ke]?.options?.[le]?.points||0),0),F=i>=$.length,H=!F&&i>=0?$[i]:null,G=!!qv,M=n?{backgroundColor:n}:void 0,z=n?{color:n}:void 0,W=n||"#4f46e5",D={"--qa":W,"--qa-soft":`${W}14`},Z=()=>{if(!r&&!a)return;const se=C.current;se.ctx||(se.ctx=new(window.AudioContext||window.webkitAudioContext)),se.ctx.state==="suspended"&&se.ctx.resume()},V=()=>{T.current+=1,Vg&&window.speechSynthesis.cancel();const se=C.current;se.abort?.abort(),se.abort=null,se.srcs.forEach(le=>{le.onended=null;try{le.stop()}catch{}}),se.srcs=[],clearTimeout(se.endTimer),b(!1),v(!1)},L=(se,le)=>{if(!Vg||!se){le?.();return}window.speechSynthesis.cancel();const ke=new SpeechSynthesisUtterance(se);e.voice_lang&&(ke.lang=e.voice_lang);const oe=T.current;ke.onend=()=>{oe===T.current&&(b(!1),le?.())},ke.onerror=ke.onend,b(!0),v(!1),window.speechSynthesis.speak(ke)},K=async(se,le,ke)=>{const oe=C.current,Oe=new AbortController;oe.abort=Oe,b(!0),v(!0);let Je=!1;try{const Ie=await r(se,Oe.signal);if(!Ie.ok||!Ie.body)throw new Error(`tts ${Ie.status}`);oe.ctx||(oe.ctx=new(window.AudioContext||window.webkitAudioContext)),oe.ctx.state==="suspended"&&await oe.ctx.resume(),oe.playAt=oe.ctx.currentTime+.05;const ue=Ie.body.getReader();let be=new Uint8Array(0);for(;;){const{done:Re,value:Ge}=await ue.read();if(Re)break;const it=new Uint8Array(be.length+Ge.length);it.set(be),it.set(Ge,be.length);const ut=it.length-it.length%2;if(be=it.slice(ut),!ut)continue;const $t=new Int16Array(it.buffer,0,ut/2),tt=oe.ctx.createBuffer(1,$t.length,Jct),He=tt.getChannelData(0);for(let St=0;St<$t.length;St++)He[St]=$t[St]/32768;const wt=oe.ctx.createBufferSource();wt.buffer=tt,wt.connect(oe.ctx.destination),oe.playAt=Math.max(oe.playAt,oe.ctx.currentTime),wt.start(oe.playAt),oe.playAt+=tt.duration,oe.srcs.push(wt),Je||v(!1),Je=!0}if(Oe.signal.aborted)return;if(!Je)throw new Error("empty tts stream");oe.endTimer=setTimeout(()=>{oe.srcs=[],b(!1),ke?.()},Math.max(0,(oe.playAt-oe.ctx.currentTime)*1e3))}catch{if(Oe.signal.aborted)return;N.current=!1,V(),L(le,ke)}},te=se=>{if(!a||se<0||se>=$.length)return null;const le=A.current;if(!le.has(se)){const ke=C.current;ke.ctx||(ke.ctx=new(window.AudioContext||window.webkitAudioContext));const oe=a(se).then(Oe=>{if(!Oe.ok)throw new Error(`audio ${Oe.status}`);return Oe.arrayBuffer()}).then(Oe=>ke.ctx.decodeAudioData(Oe));oe.catch(()=>le.delete(se)),le.set(se,oe)}return le.get(se)},Q=async(se,le,ke)=>{const oe=C.current,Oe=T.current;b(!0),v(!0);try{const Je=await te(se);if(Oe!==T.current)return;oe.ctx.state==="suspended"&&await oe.ctx.resume(),v(!1),te(se+1);const Ie=oe.ctx.createBufferSource();Ie.buffer=Je,Ie.connect(oe.ctx.destination),Ie.onended=()=>{oe.srcs=oe.srcs.filter(ue=>ue!==Ie),b(!1),ke?.()},oe.srcs.push(Ie),Ie.start()}catch{if(Oe!==T.current)return;r&&N.current?K(se,le,ke):L(le,ke)}},Y=(se,le)=>{const ke=$[se];if(!ke)return;const oe=`${ke.text} ${ke.options.map((Oe,Je)=>`${hC[Je]}. ${Oe.label}.`).join(" ")}`;a?Q(se,oe,le):r&&N.current?K(se,oe,le):L(oe,le)},J=()=>{I.current=!1,_.current?.abort?.()},P=se=>{u===null&&(J(),d(se),k.current=setTimeout(()=>{c(le=>[...le.slice(0,i),se]),d(null),S(""),o(le=>le+1)},350))},ee=()=>{if(!qv||!H||u!==null)return;_.current?.abort?.();const se=new qv;_.current=se,I.current=!0,e.voice_lang&&(se.lang=e.voice_lang),se.interimResults=!1,se.maxAlternatives=3,j(!0),S(""),se.onresult=le=>{const ke=Array.from(le.results[0]).map(Oe=>Oe.transcript),oe=ke.map(Oe=>Kct(Oe,H.options)).find(Oe=>Oe>=0);oe!==void 0?P(oe):S(`Heard "${ke[0]}". Say "Option A", "Option B"... or tap your answer.`)},se.onerror=le=>{le.error==="no-speech"||le.error==="aborted"||(I.current=!1,S("Could not hear you. Tap your answer instead."))},se.onend=()=>
1492{if(_.current===se)if(I.current)try{se.start()}catch{j(!1)}else j(!1)},se.start()};f.useEffect(()=>{if(!H)return;const se=l[i]!==void 0;return m&&!se?Y(i,()=>ee()):h&&!se&&Y(i),()=>{V(),J()}},[i,h,m]),f.useEffect(()=>()=>{V(),J(),clearTimeout(k.current),C.current.ctx?.close?.()},[]);const X=()=>{Z(),S(""),m&&J(),g(se=>!se)},ae=()=>{S(""),o(se=>Math.max(0,se-1))},me=()=>{S(""),o(se=>se+1)},q=()=>{Z(),J(),V(),Y(i,m?()=>ee():void 0)},he=()=>{c([]),S(""),o(e.intro?-1:0)};if(i===-1)return s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center px-6 py-8 animate-fade-in",children:[s.jsx("p",{className:"text-[15px] text-slate-700 leading-relaxed max-w-sm mb-6",children:e.intro}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-2.5",style:D,children:[s.jsx("button",{type:"button",onClick:()=>{g(!1),o(0)},className:"px-7 py-3 rounded-2xl text-sm font-semibold text-white bg-primary-600 shadow-md hover:opacity-90 transition-opacity",style:M,children:"Start the quiz"}),G&&s.jsxs("button",{type:"button",onClick:()=>{Z(),g(!0),o(0)},className:"inline-flex items-center gap-2 px-7 py-3 rounded-2xl text-sm font-semibold border-2 border-[var(--qa)] text-[var(--qa)] hover:bg-[var(--qa-soft)] transition-colors",children:[s.jsx(Qr,{size:15})," Answer by voice"]})]}),s.jsxs("p",{className:"mt-3 text-[11px] text-slate-400",children:[$.length," quick questions · about a minute",G?" · switch between tap and voice anytime":""]})]});if(F){const se=Xct(e.levels,U),le=e.show_result!==!1;return s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center px-6 py-8 animate-fade-in",children:[le?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-24 h-24 rounded-full bg-primary-50 border-2 border-primary-200 flex items-center justify-center mb-4",style:n?{backgroundColor:`${n}14`,borderColor:`${n}55`}:void 0,children:s.jsx("span",{className:"text-lg font-bold text-primary-700 px-2 leading-tight",style:z,children:se?.id||se?.label})}),s.jsx("p",{className:"text-xs text-slate-500 mb-1",children:"Your level"}),s.jsx("p",{className:"text-xl font-semibold text-slate-900 mb-6",children:se?.label||se?.id})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-24 h-24 rounded-full bg-primary-50 border-2 border-primary-200 flex items-center justify-center mb-4",style:n?{backgroundColor:`${n}14`,borderColor:`${n}55`}:void 0,children:s.jsx(ft,{size:30,className:"text-primary-600",style:z})}),s.jsx("p",{className:"text-xl font-semibold text-slate-900 mb-2",children:"All done!"}),s.jsxs("p",{className:"text-sm text-slate-600 leading-relaxed max-w-sm mb-6",children:["Fill in this quick form to get your score. ",t?`${t} will`:"We will"," get back to you."]})]}),s.jsxs("a",{href:se?.form_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-7 py-3 rounded-2xl text-sm font-semibold text-white bg-primary-600 shadow-md hover:opacity-90 transition-opacity",style:M,children:[le?`Continue to ${se?.label||"your course"}`:"Get my score"," ",s.jsx(Ro,{size:14})]}),s.jsxs("button",{type:"button",onClick:he,className:"mt-4 inline-flex items-center gap-1.5 text-xs text-slate-400 hover:text-slate-600 transition-colors",children:[s.jsx(Du,{size:12})," Retake the quiz"]})]})}return s.jsxs("div",{className:"flex-1 flex flex-col px-4 py-4 overflow-y-auto",style:D,children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i>0?s.jsx("button",{type:"button",onClick:ae,"aria-label":"Previous question",className:"p-1 rounded-lg text-slate-400 hover:text-slate-600 hover:bg-slate-100 transition-colors",children:s.jsx(ja,{size:16})}):s.jsx("span",{className:"w-[24px]"}),l[i]!==void 0&&s.jsx("button",{type:"button",onClick:me,"aria-label":"Next question",className:"p-1 rounded-lg text-slate-400 hover:text-slate-600 hover:bg-slate-100 transition-colors",children:s.jsx(xn,{size:16})}),s.jsx("div",{className:"flex-1 h-1.5 bg-slate-100 rounded-full overflow-hidden",role:"progressbar","aria-valuenow":i+1,"aria-valuemin":1,"aria-valuemax":$.length,children:s.jsx("div",{className:"h-full bg-primary-600 rounded-full transition-all duration-300",style:{width:`${(i+1)/$.length*100}%`,...M}})}),s.jsxs("span",{className:"text-[11px] text-slate-400 tabular-nums shrink-0",children:[i+1," / ",$.length]}),!m&&(Vg||r)&&s.jsx("button",{type:"button",onClick:()=>{Z(),p(se=>!se)},"aria-pressed":h,"aria-label":h?"Turn off read-aloud":"Read questions aloud",title:h?"Turn off read-aloud":"Read questions aloud",className:`p-1.5 rounded-lg transition-colors ${h?"text-[var(--qa)] bg-[var(--qa-soft)]":"text-slate-400 hover:text-slate-600 hover:bg-slate-100"}`,children:h?s.jsx(uu,{size:15}):s.jsx(U4,{size:15})}),G&&s.jsxs("div",{className:"flex rounded-lg border border-slate-200 overflow-hidden shrink-0",role:"group","aria-label":"Answer mode",children:[s.jsxs("button",{type:"button",onClick:()=>m&&X(),"aria-pressed":!m,title:"Tap your answers",className:`flex items-center gap-1 px-2 py-1 text-[10px] font-semibold transition-colors ${m?"text-slate-400 hover:text-slate-600 hover:bg-slate-50":"bg-[var(--qa)] text-white"}`,children:[s.jsx(pve,{size:11})," Tap"]}),s.jsxs("button",{type:"button",onClick:()=>!m&&X(),"aria-pressed":m,title:"Hear questions and answer by speaking",className:`flex items-center gap-1 px-2 py-1 text-[10px] font-semibold transition-colors ${m?"bg-[var(--qa)] text-white":"text-slate-400 hover:text-slate-600 hover:bg-slate-50"}`,children:[s.jsx(Qr,{size:11})," Voice"]})]})]}),m?s.jsxs("div",{className:"animate-fade-in flex-1 flex flex-col min-h-0",children:[s.jsxs("div",{className:"flex items-start justify-center gap-1.5 mb-5",children:[s.jsx("p",{className:"text-[15px] font-medium text-slate-900 leading-relaxed text-center",children:H.text}),(Vg||r||a)&&s.jsx("button",{type:"button",onClick:q,"aria-label":"Read the question aloud",title:"Read the question aloud",className:"p-1 rounded-lg text-slate-400 hover:text-[var(--qa)] hover:bg-[var(--qa-soft)] transition-colors shrink-0",children:s.jsx(uu,{size:15})})]}),s.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:H.options.map((se,le)=>{const ke=O===le;return s.jsxs("button",{type:"button",onClick:()=>P(le),className:`inline-flex items-center gap-2 pl-1.5 pr-3.5 py-1.5 rounded-full border text-[13px] transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--qa)] ${ke?"border-[var(--qa)] bg-[var(--qa-soft)] text-slate-900":"border-slate-200 text-slate-700 hover:border-[var(--qa)] hover:bg-[var(--qa-soft)]"}`,children:[s.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 ${ke?"bg-[var(--qa)] text-white":"bg-slate-100 text-slate-500"}`,children:ke?s.jsx(ft,{size:12}):hC[le]}),s.jsx("span",{className:"leading-snug",children:se.label})]},le)})}),s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 py-6",children:[s.jsx("button",{type:"button",onClick:()=>{Z(),x?(V(),ee()):w?J():ee()},"aria-label":x?"Interrupt and answer":w?"Stop listening":"Answer by voice",className:`w-20 h-20 rounded-full border-2 flex items-center justify-center transition-colors ${w?"border-red-300 bg-red-50 text-red-500":x?"border-[var(--qa)] bg-[var(--qa-soft)] text-[var(--qa)]":"border-slate-200 text-slate-400 hover:text-[var(--qa)] hover:border-[var(--qa)]"}`,children:y?s.jsx(vt,{size:28,className:"animate-spin"}):x?s.jsx(uu,{size:28,className:"animate-pulse"}):s.jsx(Qr,{size:28,className:w?"animate-rec-pulse":void 0})}),s.jsx("p",{className:"text-xs text-slate-500 text-center px-6","aria-live":"polite",children:y?`Loading ${t?`${t}'s`:"the"} voiceâ¦`:x?`${t||"The expert"} is reading the question. Tap the mic to interrupt and answer.`:w?'Listening. Say "Option A", "Option B"⦠or the answer itself. Tap the mic to stop.':E||'Tap the mic and say "Option A", "Option B"⦠or the answer itself. Or just tap an option.'})]})]},i):s.jsxs("div",{className:"animate-fade-in",children:[s.jsxs("div",{className:"flex items-start gap-1.5 mb-4",children:[s.jsx("p",{className:"text-[15px] font-medium text-slate-900 leading-relaxed",children:H.text}),(Vg||r||a)&&s.jsx("button",{type:"button",onClick:q,"aria-label":"Read the question aloud",title:"Read the question aloud",className:"p-1 rounded-lg text-slate-400 hover:text-[var(--qa)] hover:bg-[var(--qa-soft)] transition-colors shrink-0",children:s.jsx(uu,{size:15})})]}),s.jsx("div",{className:"space-y-2",children:H.options.map((se,le)=>{const ke=O===le;return s.jsxs("button",{type:"button",onClick:()=>P(le),className:`w-full text-left pl-2.5 pr-4 py-2.5 rounded-xl border text-sm flex items-center gap-3 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--qa)] ${ke?"border-[var(--qa)] bg-[var(--qa-soft)] text-slate-900":"border-slate-200 text-slate-700 hover:border-[var(--qa)] hover:bg-[var(--qa-soft)]"}`,children:[s.jsx("span",{className:`w-7 h-7 rounded-lg flex items-center justify-center text-[11px] font-bold shrink-0 ${ke?"bg-[var(--qa)] text-white":"bg-slate-100 text-slate-500"}`,children:ke?s.jsx(ft,{size:13}):hC[le]}),s.jsx("span",{className:"leading-snug",children:se.label})]},le)})}),qv&&s.jsxs("div",{className:"mt-4 flex flex-col items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>w?J():ee(),"aria-label":w?"Stop listening":"Answer by voice",className:`w-11 h-11 rounded-full border flex items-center justify-center transition-colors ${w?"border-red-300 bg-red-50 text-red-500":"border-slate-200 text-slate-400 hover:text-[var(--qa)] hover:border-[var(--qa)]"}`,children:s.jsx(Qr,{size:17,className:w?"animate-rec-pulse":void 0})}),s.jsx("p",{className:"text-[11px] text-slate-400 text-center px-4","aria-live":"polite",children:w?'Listening. Say "Option A", "Option B"⦠or the answer. Tap the mic to stop.':E||'Or tap the mic and say "Option A", "Option B"⦠or the answer'})]})]},i)]})}let Oie="";try{document.referrer&&(Oie=new URL(document.referrer).hostname)}catch{}const n2="grid h-7 w-7 shrink-0 place-items-center rounded-lg text-ink transition-colors duration-base ease-out hover:bg-cream-deep focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo/40",pC="grid h-6 w-7 shrink-0 place-items-center text-ink-mid transition-colors duration-base ease-out hover:bg-cream-tint hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo/40";function A5(e,t){return`gx_widget_pending:${e}:${t}`}function Zct(e,t){try{const n=sessionStorage.getItem(A5(e,t));return n?JSON.parse(n):null}catch{return null}}function fL({isFullscreen:e,onToggle:t,className:n=n2}){return s.jsx("button",{type:"button",onClick:t,className:n,"aria-label":e?"Exit full screen":"Full screen",title:e?"Exit full screen":"Full screen","aria-pressed":e,children:e?s.jsx(vY,{size:13,strokeWidth:2,"aria-hidden":"true"}):s.jsx(O4,{size:13,strokeWidth:2,"aria-hidden":"true"})})}function eut({isTall:e,onToggle:t,className:n=n2}){return s.jsx("button",{type:"button",onClick:t,className:`${n} hidden [@media(hover:hover)_and_(pointer:fine)]:grid`,"aria-label":e?"Restore height":"Expand height",title:e?"Restore height":"Expand height","aria-pressed":e,children:e?s.jsx(nve,{size:13,strokeWidth:2,"aria-hidden":"true"}):s.jsx($we,{size:13,strokeWidth:2,"aria-hidden":"true"})})}function Mie({onClose:e,className:t=n2}){return s.jsx("button",{type:"button",onClick:e,className:t,"aria-label":"Close chat",title:"Close chat",children:s.jsx(as,{size:15,strokeWidth:2,"aria-hidden":"true"})})}function tut({widgetKey:e,expert:t,accent:n,canExpand:r,isFullscreen:a,onToggleFullscreen:i,isTall:o,onToggleTall:l,onClose:c}){const u={...t,id:t.expert_id},d=u.id,{user:h,isAuthenticated:p,isAnonymous:m,ensureAnonymousSession:g,resetAnonymousSession:x,getAnonymousStatus:b,updateBalance:y,updateUser:v}=Ut(),w=f.useRef(Zct(e,d)),j=f.useRef(!!w.current),E=f.useRef(!1),S=f.useRef(null),_=f.useRef(null),k=f.useRef(null),C=f.useRef(null),N=f.useRef(w.current),[A,T]=f.useState(!1),[I,$]=f.useState(null);f.useEffect(()=>{if($(null),!d)return;let ne=!1;return kh(d).then(ge=>{if(ne)return;const xe=ge?.data?.starters;Array.isArray(xe)&&xe.length>0&&$(xe)}).catch(()=>{}),()=>{ne=!0}},[d]);const[O,U]=f.useState([]),[F,H]=f.useState(null),[G,M]=f.useState([]),[z,W]=f.useState(!1),[D,Z]=f.useState("chat"),[V,L]=f.useState(""),[K,te]=f.useState(!1),[Q,Y]=f.useState(w.current?.mode||null),[J,P]=f.useState(w.current?.mode==="gate"),[ee,X]=f.useState(!1),[ae,me]=f.useState(null),[q,he]=f.useState(null),[se,le]=f.useState(""),ke=!!t?.require_login_to_chat&&!p,{isStreaming:oe,startStream
1492:Oe,stopStream:Je}=eL(d,F,U,`widget-${e}`),Ie=Wae(d,F,{surface:"embed",onCreatorMessage:(ne,ge)=>{if(window.parent===window)return;let xe;try{xe=window.location.ancestorOrigins?.[0]||new URL(document.referrer).origin}catch{return}try{window.parent.postMessage({type:"ge:live-message",name:ge,text:ne.content},xe)}catch{}},onReturnToAi:ne=>U(ge=>{const xe=new Set(ge.map(pe=>pe.id));return[...ge,...ne.filter(pe=>!xe.has(pe.id))]})}),[ue,be]=f.useState(!1),Re=MY(O,Ie),Ge=Kae(Ie.config?.enabled||Ie.active?d:null),it=Ie.config?.available!==!1,ut=!it&&!!Ge&&!Ie.active,$t=()=>{it?be(!0):Ge?.()},tt=Vae(O,Ie,F,d),He=async()=>{const ne=await F_(d,{force:!0});M(ne?.data?.conversations||[])},wt=async(ne=null)=>{const ge=await Nb(d,ne);U(ge?.data?.messages||[]),H(ge?.data?.conversation_id||ne||null),te(!!ge?.data?.creator_summary_consent)};f.useEffect(()=>{let ne=!1;return(async()=>{try{if(await g(),ne)return;await Promise.all([wt(),He()]),ne||T(!0)}catch(ge){if(ge.response?.data?.detail?.code==="ANONYMOUS_SESSION_EXPIRED")try{if(await x(),ne)return;await Promise.all([wt(),He()]),ne||T(!0);return}catch{}ne||le(ge.message||"Chat could not be opened.")}})(),()=>{ne=!0}},[d,e]),f.useEffect(()=>()=>window.clearTimeout(S.current),[]);const St=Qae(_,O,A);f.useEffect(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[Ie.messages,Ie.state,Ie.creatorTyping]);const Zt=ne=>{N.current=ne;try{sessionStorage.setItem(A5(e,d),JSON.stringify(ne))}catch{}},Jt=ne=>{ne&&H(ne),He().catch(()=>{})},$e=f.useRef(!1);f.useEffect(()=>{!$e.current||!ee||!p||($e.current=!1,QP(d,{target:"_blank"}).catch(()=>{}))},[ee,p,d]);const Qe=ne=>
1492{Oe(ne,[],O,Jt,y,null,{saasProfile:!0,creatorSummaryConsent:K,onAuthRequired:({content:ge,attachments:xe,error:pe})=>{const Ne=pe?.code==="LOGIN_REQUIRED"?"login-required":"gate";Zt({content:ge,attachments:xe,conversationId:F,mode:Ne}),Ne==="gate"&&P(!0),Y(Ne)},onExpertSubscriptionRequired:()=>{X(!0),P(!0),p||($e.current=!0,Y("register"))},onTermsRequired:({content:ge,attachments:xe})=>{Zt({content:ge,attachments:xe,conversationId:F,mode:"terms"}),Y("terms")}})},ct=()=>{const ne=V.trim();if(!(!ne||oe)&&!Ie.active){if(!A){he(ne),L("");return}if(!ee){if(J){Y("gate");return}if(ke){Zt({content:ne,attachments:[],conversationId:F,mode:"login-required"}),L(""),Y("login-required");return}if(p&&h?.terms_current===!1){Zt({content:ne,attachments:[],conversationId:F,mode:"terms"}),L(""),Y("terms");return}L(""),Qe(ne)}}};f.useEffect(()=>{!A||!q||(Qe(q),he(null))},[A,q]);const ve=async()=>{if(!A||oe)return;const ne=await X4(d);H(ne?.data?.conversation?.id||null),U(ne?.data?.messages||[]),te(!!ne?.data?.conversation?.creator_summary_consent),Z("chat"),await He(),k.current?.focus()},Ye=async()=>{Z("history"),W(!0);try{await He()}finally{W(!1)}};f.useEffect(()=>{if(D!=="history")return;const ne=ge=>{ge.key==="Escape"&&(Z("chat"),C.current?.focus())};return window.addEventListener("keydown",ne),()=>window.removeEventListener("keydown",ne)},[D]);const rt=async ne=>{if(oe||ne===F){Z("chat");return}await wt(ne),Z("chat")},De=async(ne={})=>{ne.authenticated!==!1&&v({terms_current:!0}),P(!1),Y(null);const ge=N.current;N.current=null;try{sessionStorage.removeItem(A5(e,d))}catch{}ge?.conversationId&&ge.conversationId!==F&&await wt(ge.conversationId),ge&&me(ge),He().catch(()=>{})};f.useEffect(()=>{if(!(!A||!p||!j.current)){if(j.current=!1,h?.terms_current===!1){Y("terms");return}De()}},[A,p,h?.terms_current]),f.useEffect(()=>{if(!A||p||!j.current)return;let ne=!1;return b(d).then(ge=>{ne||!ge?.data?.email_captured||(j.current=!1,De({authenticated:!1}))}).catch(()=>{}),()=>{ne=!0}},[A,p,d,b]),f.useEffect(()=>{ae&&(ae.conversationId&&ae.conversationId!==F||(Qe(ae.content),me(null)))},[ae,F]);const{canCall:qe,startCall:ye,callUi:Ze}=Vk(u,{conversationId:F,onCallStart:()=>{r&&!a&&(E.current=!0,i())},onCallEnd:()=>{E.current&&(E.current=!1,a&&i())},onConversation:ne=>{ne&&(H(ne),window.clearTimeout(S.current),S.current=window.setTimeout(()=>{wt(ne).catch(()=>{}),He().catch(()=>{})},2500))},onLimitReached:()=>{P(!0),Y("gate")},onLoginRequired:()=>Y("login-required")}),jt=n?{backgroundColor:n}:void 0,Nt=D==="history";return s.jsxs("div",{className:"relative flex h-dvh flex-col bg-cream text-ink",style:q4(n),children:[s.jsxs("header",{className:"relative z-40 shrink-0 bg-cream",children:[(r||c)&&s.jsxs("div",{className:"flex h-8 items-center justify-end gap-0.5 border-b border-rule bg-cream-deep px-1.5",children:[r&&s.jsx(fL,{isFullscreen:a,onToggle:i,className:pC}),l&&!a&&s.jsx(eut,{isTall:o,onToggle:l,className:pC}),c&&s.jsx(Mie,{onClose:c,className:pC})]}),s.jsxs("div",{className:"flex items-center gap-3 border-b border-rule px-4 py-3",children:[s.jsx(tne,{name:u.name,avatarUrl:u.avatar_url,accent:n,showBadge:u.show_badge!==!1}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s.jsx(Ik,{expert:u,messages:O,source:"embed",widgetKey:e,className:"inline-flex h-9 max-w-[11rem] shrink-0 items-center gap-1.5 rounded-pill border border-indigo/30 bg-paper px-3.5 text-[15px] font-semibold text-indigo shadow-subtle transition-colors duration-base ease-out hover:border-indigo/50 hover:bg-indigo-wash focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo/40",labelClassName:"hidden min-[400px]:block",iconClassName:"h-4 w-4 text-indigo",silent:!!Ie.config?.enabled&&!ut}),Ie.config?.enabled&&!Ie.active&&!ut&&s.jsx(j5,{name:Ie.name,available:it,onClick:()=>be(!0),onOffline:Ge,disabled:!F||!A,className:"inline-flex h-9 max-w-[11rem] shrink-0 items-center gap-1.5 rounded-pill border border-rule bg-paper px-3.5 text-[15px] font-semibold text-ink shadow-subtle transition-colors duration-base ease-out hover:bg-cream-deep focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/30",labelClassName:"hidden truncate min-[400px]:block",iconClassName:"h-4 w-4",iconSize:16}),s.jsx("button",{ref:C,type:"button",onClick:Nt?()=>Z("chat"):Ye,className:n2,"aria-label":"Conversations","aria-controls":"widget-conversations-drawer","aria-expanded":Nt,title:"Conversations",children:s.jsx(xl,{size:20,strokeWidth:1.8,"aria-hidden":"true"})})]})]}),Ie.state==="human"&&s.jsx(Yae,{placement:"top",onEnd:Ie.resume,disabled:Ie.busy,accent:n})]}),s.jsx("button",{type:"button",onClick:()=>Z("chat"),className:`absolute inset-0 z-20 bg-ink/40 backdrop-blur-sm transition-opacity duration-base ease-out motion-reduce:transition-none ${Nt?"pointer-events-auto opacity-100":"pointer-events-none opacity-0"}`,"aria-label":"Close conversations",tabIndex:Nt?0:-1}),s.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[s.jsxs("div",{ref:_,className:"min-h-0 flex-1 space-y-3 overflow-x-hidden overflow-y-auto bg-cream px-4 py-4",children:[!A&&!se&&s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx(vt,{size:18,className:"animate-spin text-ink-muted motion-reduce:animate-none"})}),se&&s.jsx("p",{className:"rounded-xl border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:se}),A&&Re.map(ne=>s.jsx(H3,{message:ne,accentStyle:jt,expertId:d,creatorName:Ie.name},ne.id)),A&&tt.show&&(it||Ge)&&s.jsx(qae,{name:Ie.name,offline:!it,onStart:$t,onDismiss:tt.dismiss}),Ie.state==="waiting"&&s.jsx(Dm,{variant:"waiting",name:Ie.name,onAction:Ie.cancel,disabled:Ie.busy,queuePosition:Ie.queuePosition,typicalWaitMinutes:Ie.typicalWaitMinutes}),Ie.state==="human"&&s.jsx(Dm,{variant:"joined",name:Ie.name}),Ie.messages.map(ne=>s.jsxs(f.Fragment,{children:[s.jsx(H3,{message:ne,accentStyle:jt,expertId:d,creatorName:Ie.name}),ne.id===Ie.seenMessageId&&s.jsx("p",{className:"-mt-2 text-right text-[11px] text-ink-muted",children:"Seen"})]},ne.id)),Ie.state==="human"&&s.jsx(zae,{name:Ie.name,typing:Ie.creatorTyping}),Ie.state==="resolved"&&s.jsx(Dm,{variant:"ended",name:Ie.name,terminalReason:Ie.attempt?.terminalReason,idleMinutes:Ie.config?.idleMinutes,onAction:Ie.resume,disabled:Ie.busy,onLeaveMessage:Ge,rating:Ie.attempt?.rating,onRate:
1492Ie.rate,ratingError:Ie.ratingError}),A&&!oe&&!ee&&!Ie.active&&Array.isArray(I)&&I.length>0&&!O.some(ne=>ne.role==="user")&&s.jsx(sne,{starters:I,onAsk:Qe,disabled:J||Nt,accent:n}),s.jsx("div",{ref:St,"aria-hidden":"true"})]}),Ie.active?s.jsx(Gae,{state:Ie.state,onSend:Ie.send,disabled:Nt,accentStyle:jt,error:Ie.error,reconnecting:Ie.reconnecting,onTyping:Ie.sendTyping}):ee?s.jsx(Xae,{expert:u,signedIn:p,onAuthenticate:()=>Y("register"),checkoutTarget:"_blank"}):s.jsx(Zse,{value:V,onChange:L,onSend:ct,onStop:Je,disabled:!A||oe||J||Nt,isStreaming:oe,accentStyle:jt,inputRef:k,onStartCall:A&&qe?ye:void 0,creatorSummaryConsent:K,onCreatorSummaryConsentChange:te,placeholder:ke?"Log in to start chattingâ¦":void 0}),s.jsx(Lk,{onLogin:p?void 0:()=>Y("login")}),s.jsxs("aside",{id:"widget-conversations-drawer",role:"dialog","aria-modal":Nt?"true":void 0,"aria-label":"Conversations","aria-hidden":!Nt,inert:!Nt,className:"absolute inset-y-0 right-0 z-30 flex flex-col border-l border-rule bg-cream px-4 py-5 transition-transform duration-base ease-out will-change-transform motion-reduce:transition-none",style:{width:"min(60%, 360px)",transform:Nt?"translateX(0)":"translateX(100%)"},children:[s.jsx("h2",{className:"font-sans text-base font-semibold text-ink sm:text-lg",children:"Conversations"}),s.jsxs("button",{type:"button",onClick:ve,disabled:!A||oe,className:"mt-4 inline-flex h-12 w-full shrink-0 items-center justify-center gap-1 rounded-lg bg-indigo px-2 text-xs font-semibold text-cream transition-colors duration-base ease-out hover:bg-indigo-deep focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo/40 disabled:cursor-not-allowed disabled:opacity-60 sm:gap-2 sm:px-4 sm:text-sm",style:jt,"aria-label":"New conversation",children:[s.jsx(Es,{size:17,strokeWidth:1.8,"aria-hidden":"true"}),s.jsx("span",{children:"New conversation"})]}),z?s.jsx("div",{className:"flex justify-center py-12",children:s.jsx(vt,{size:18,className:"animate-spin text-ink-muted motion-reduce:animate-none"})}):G.length===0?s.jsxs("div",{className:"px-2 py-12 text-center",children:[s.jsx("p",{className:"text-sm font-medium text-ink",children:"No conversations yet"}),s.jsx("p",{className:"mt-1 text-xs text-ink-muted",children:"Start a new chat whenever you're ready."})]}):s.jsxs("div",{className:"mt-5 min-h-0 flex-1 overflow-y-auto overscroll-contain",children:[s.jsx("p",{className:"px-1 text-xs font-medium text-ink-muted",children:"Recent"}),s.jsx("div",{className:"mt-2 space-y-1",children:G.map(ne=>s.jsx("button",{type:"button",onClick:()=>rt(ne.id),className:`block min-h-11 w-full truncate rounded-lg px-3 py-2.5 text-left text-sm font-medium transition-colors duration-base ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo/40 ${ne.id===F?"bg-indigo-wash text-ink":"text-ink-mid hover:bg-cream"}`,"aria-current":ne.id===F?"true":void 0,children:ne.title||"New conversation"},ne.id))})]})]})]}),s.jsx(Hae,{open:ue,name:Ie.name,defaultEmail:p&&!m?h?.email:"",accent:n,busy:Ie.busy,error:Ie.error,onClose:()=>{be(!1),Ie.clearError()},onConfirm:async ne=>{await Ie.request(ne)&&be(!1)}}),s.jsx(FR,{open:!!Q,mode:Q||"login",expertId:d,conversationId:N.current?.conversationId||F,hasPendingQuestion:!!N.current,pendingAttachmentIds:[],allowGoogle:!0,onClose:Q==="gate"||Q==="terms"?void 0:()=>Y(null),onSuccess:De}),Ze,s.jsx("span",{className:"sr-only",children:m?"Anonymous widget chat session":"Account widget chat session"})]})}function sut({reason:e,canExpand:t,isFullscreen:n,onToggleFullscreen:r,onClose:a}){return s.jsxs("div",{className:"flex h-dvh flex-col bg-cream text-ink",children:[s.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-rule bg-indigo-wash/40 px-4 py-3",children:[s.jsx("div",{className:"grid h-9 w-9 place-items-center rounded-full bg-indigo-wash",children:s.jsx(Ms,{size:17,className:"text-indigo"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-sm font-semibold",children:"Expert unavailable"}),s.jsx(ene,{})]}),t&&s.jsx(fL,{isFullscreen:n,onToggle:r}),a&&s.jsx(Mie,{onClose:a})]}),s.jsx("div",{className:"flex flex-1 items-center justify-center px-8 text-center",children:s.jsx("p",{className:"max-w-xs text-sm leading-6 text-ink-mid",children:e==="domain"?"This expert isn't enabled for this website.":"This expert is not available right now."})}),s.jsx(Lk,{})]})}function nut(){const{widgetKey:e}=Ef(),[t]=gl(),n=Ost(t.get("accent")||""),r=t.get("host")||Oie,a=!!t.get("mode"),i=t.get("mode")==="bubble",[o,l]=f.useState(!1),[c,u]=f.useState(!1),[d,h]=f.useState(null),[p,m]=f.useState(null),[g,x]=f.useState(!1),b=p!==null,y=n?{backgroundColor:n}:void 0,v=()=>{l(N=>{const A=!N;try{window.parent.postMessage({type:"ge:fullscreen",value:A},"*")}catch{}return A})},w=()=>{u(N=>{const A=!N;try{window.parent.postMessage({type:"ge:tall",value:A},"*")}catch{}return A})},j=()=>
1492{l(!1);try{window.parent.postMessage({type:"ge:close"},"*")}catch{}};if(f.useEffect(()=>(gD(e),()=>gD(null)),[e]),f.useEffect(()=>{let N=!1;const A=`?host=${encodeURIComponent(r||"")}`;return fetch(`${Hr}/widget/${encodeURIComponent(e)}/info${A}`).then(T=>{if(!T.ok){const I=new Error(`info ${T.status}`);throw I.status=T.status,I}return T.json()}).then(T=>{N||h(T)}).catch(T=>{N||m(T.status===403?"domain":"missing")}),()=>{N=!0}},[e,r]),!d&&!b)return s.jsxs(s.Fragment,{children:[s.jsx(vs,{title:"Chat",noIndex:!0}),s.jsx("div",{className:"flex h-dvh items-center justify-center bg-cream","aria-label":"Loading chat",children:s.jsx(vt,{size:20,className:"animate-spin text-ink-muted motion-reduce:animate-none"})})]});if(b)return s.jsxs(s.Fragment,{children:[s.jsx(vs,{title:"Chat",noIndex:!0}),s.jsx(sut,{reason:p,canExpand:a,isFullscreen:o,onToggleFullscreen:v,onClose:i?j:void 0})]});const E=d?.quiz||null,S=!!(E&&(E.mode!=="chat"||g)),_=E?.voice?(N,A)=>fetch(`${Hr}/widget/${encodeURIComponent(e)}/quiz-tts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({index:N,host:r||null}),signal:A}):null,k=E?.audio?N=>fetch(`${Hr}/widget/${encodeURIComponent(e)}/quiz-audio/${N}?host=${encodeURIComponent(r||"")}&v=${encodeURIComponent(E.audio)}`):null,C=E&&E.mode==="chat"&&!g&&s.jsxs("button",{type:"button",onClick:()=>x(!0),className:"absolute bottom-24 left-1/2 z-10 inline-flex -translate-x-1/2 items-center gap-2 rounded-full bg-indigo px-5 py-2.5 text-sm font-semibold text-cream shadow-lg transition-opacity hover:opacity-90",style:y,children:[s.jsx(Ms,{size:14,"aria-hidden":"true"})," ",E.button_label]});return S?s.jsxs("div",{className:"relative flex h-dvh flex-col bg-cream text-ink",children:[s.jsx(vs,{title:"Quiz",noIndex:!0}),s.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-rule bg-indigo-wash/40 px-4 py-3",children:[s.jsx("div",{className:"grid h-9 w-9 shrink-0 place-items-center overflow-hidden rounded-full bg-indigo-wash",style:n?{backgroundColor:`${n}22`}:void 0,children:d?.avatar_url?s.jsx("img",{src:d.avatar_url,alt:d.name||"Expert",className:"h-full w-full object-cover",onError:N=>{N.currentTarget.style.display="none"}}):s.jsx(Ms,{size:16,className:"text-indigo","aria-hidden":"true"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-semibold leading-tight text-ink",children:d?.name||"â¦"}),s.jsx("p",{className:"text-[11px] leading-none text-ink-muted",children:"Level quiz"})]}),E.mode==="chat"&&s.jsx("button",{type:"button",onClick:()=>x(!1),className:"rounded-lg px-2 py-1 text-xs text-ink-mid transition-colors hover:bg-cream-deep hover:text-ink",children:"Back to chat"}),a&&s.jsx(fL,{isFullscreen:o,onToggle:v})]}),s.jsx(Qct,{quiz:E,expertName:d?.name,accent:n,tts:_,audio:k}),s.jsx(Lk,{})]}):s.jsxs(s.Fragment,{children:[s.jsx(vs,{title:"Chat",noIndex:!0}),s.jsxs("div",{className:"relative h-dvh",children:[s.jsx(tut,{widgetKey:e,expert:d,accent:n,canExpand:a,isFullscreen:o,onToggleFullscreen:v,isTall:c,onToggleTall:i?w:void 0,onClose:i?j:void 0}),C]})]})}function Bh({title:e,description:t,actionLabel:n,onAction:r,eyebrow:a,icon:i}){const o=i||qh;return s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[s.jsx("div",{className:"w-12 h-12 rounded-lg bg-cream-deep flex items-center justify-center mb-4 border border-rule",children:s.jsx(o,{className:"w-6 h-6 text-ink-light"})}),a&&s.jsx("span",{className:"font-mono text-xs font-medium uppercase tracking-eyebrow text-ink-muted mb-2",children:a}),s.jsx("h3",{className:"font-heading text-base font-medium text-ink mb-1",children:e}),t&&s.jsx("p",{className:"text-sm text-ink-mid max-w-sm mb-4",children:t}),n&&r&&s.jsx(yt,{onClick:r,variant:"ink",size:"sm",children:n})]})}function UH({n:e,of:t,label:n}){return s.jsxs("div",{className:"meter",children:[s.jsx("div",{className:"dots","aria-hidden":"true",children:Array.from({length:t},(r,a)=>s.jsx("span",{className:a<e?"dot on":"dot"},a))}),s.jsxs("span",{className:"mlbl",children:[s.jsx("b",{children:Math.min(e,t)})," of ",t," ",n]})]})}function R5({ghost:e,hook:t,progress:n,children:r}){const{creator:a}=Yh(),[i,o]=f.useState(!1),[l,c]=f.useState(!1),u=f.useRef(null);f.useEffect(()=>()=>clearTimeout(u.current),[]);const d=f.useCallback(async()=>{try{await navigator.clipboard.writeText(ll(a)),c(!0),clearTimeout(u.current),u.current=setTimeout(()=>c(!1),2e3)}catch{}},[a]);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"lockedblock",children:[s.jsx("div",{className:"ghost-blur","aria-hidden":"true",children:e}),s.jsx("div",{className:"lock-overlay",children:s.jsxs("div",{className:"lock-card",children:[s.jsx("p",{className:"lock-hook",children:t}),s.jsx("p",{children:r}),n&&s.jsxs("div",{className:"meters",children:[s.jsx(UH,{n:n.convos,of:n.minConvos,label:"conversations"}),s.jsx(UH,{n:n.people,of:n.kmin,label:"different people"})]}),s.jsxs("div",{className:"lock-cta",children:[s.jsx(yt,{onClick:()=>o(!0),children:"Share your profile"}),s.jsx(yt,{variant:"secondary",onClick:d,children:l?"Link copied":"Copy profile link"})]})]})})]}),s.jsx(K0,{isOpen:i,onClose:()=>o(!1),subjectName:a?.full_name||"my page",url:ll(a),headline:"Share your profile",subline:"Anyone with this link can chat with your AI, book you and buy your work.",blurb:a?.full_name?`Chat with ${a.full_name}'s AI, see what they offer and book them.`:"Chat with my AI, see what I offer and book me."})]})}const gL=["New","Contacted","Replied","Not replied","Booked a call","Not relevant"];function rut(e,t="All",n=""){const r=String(n).trim().toLocaleLowerCase();return(e||[]).filter(a=>t!=="All"&&a.status!==t?!1:r?[a.name,a.email,a.company,a.message,a.expertName].some(i=>String(i||"").toLocaleLowerCase().includes(r)):!0)}function Die(e){return`st-${String(e).toLowerCase().replace(/[^a-z0-9]+/g,"-")}`}const zH={profile:"Public profile",embed:"Website embed",platform:"Platform chat",voice:"Voice call",unknown:"Unattributed"};function xL(e){return zH[e?.source]||zH.unknown}function bL(e){return e?.expertName||"Creator profile"}const I5={high:{cls:"i-high",lbl:"Ready now",def:"Asked to start, book, or get pricing now."},possible:{cls:"i-possible",lbl:"Exploring",def:"Gathering options, interested but not committed yet."},future:{cls:"i-future",lbl:"Later",def:"Interested, but not at this time."}},qp=864e5;function aut(e){return e==="full"?"the full conversation":e==="summary"?"an AI conversation summary":"no conversation content"}function iut(e){return!!(e.phone&&e.phone.trim())}function out(e){return X3e.find(t=>t.value===e)?.label||null}function Z0(e){if(!e)return"";const t=Ch(e);if(Number.isNaN(t.getTime()))return String(e);const n=Date.now()-t.getTime();if(n<6e4)return"Just now";if(n<36e5)return`${Math.floor(n/6e4)}m ago`;if(n<qp)return`${Math.floor(n/36e5)}h ago`;if(n<2*qp)return"Yesterday";if(n<7*qp)return`${Math.floor(n/qp)} days ago`;if(n<28*qp){const r=Math.floor(n/(7*qp));return r===1?"1 week ago":`${r} weeks ago`}return ey(e)}function ey(e){if(!e)return"";const t=Ch(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleDateString("en-GB",{day:"numeric",month:"short"})}function lut(e){const t=Array.isArray(e.activity)?e.activity:[];return t.length?t[t.length-1]:{t:"Request received",when:e.createdAt}}const HH="ge.leads.requestsSeen";function $ie(e){let t=String(e??"");return/^[\t\r\n]|^\s*[=+\-@]/.test(t)&&(t=`'${t}`),`"${t.replace(/"/g,'""')}"`}function cut(e){const t=["Name","Company","Role","Email","Phone","Preferred method","Best time","Expert","Source","Received","Status","Last activity","Readiness","Reasons","Message","Consent"],n=$ie,r=e.map(a=>{const i=lut(a);return[a.name,a.company||"",a.role||"",a.email,a.phone||"",out(a.method)||a.method||"",a.bestTime||"",bL(a),xL(a),Z0(a.createdAt),a.status,`${i.t} · ${ey(i.when)}`,I5[a.readiness]?.lbl||"",(a.reasons||[]).join("; "),a.message||"",aut(a.consent)].map(n).join(",")});return`${t.join(",")} 1493${r.join(` 1494`)}`}function P5(e,t,n="text/csv"){const r=new Blob([e],{type:n}),a=document.createElement("a"),i=URL.createObjectURL(r);a.href=i,a.download=t,document.body.appendChild(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(i),0)}function uut({request:e,selected:t,onSelect:n,seen:r}){const a=e.status!=="New"||!(r?.has(e.id)||t);return s.jsxs("button",{type:"button",className:`lead-row ${t?"sel":""}`,"aria-current":t||void 0,onClick:()=>n(e.id),children:[s.jsxs("span",{className:"rl-1",children:[s.jsx("span",{className:"rl-name",children:e.name}),s.jsx("span",{className:"rl-ago",children:Z0(e.createdAt)})]}),s.jsxs("span",{className:"rl-2",children:[a&&s.jsx("span",{className:`badge ${Die(e.status)}`,children:e.status}),s.jsxs("span",{className:"rl-src",children:["Expert: ",bL(e)]}),s.jsx("span",{className:"rl-go","aria-hidden":"true",children:s.jsx(hn,{})}),s.jsx("span",{className:"sr-only",children:"Open this lead"})]})]})}function dut({requests:e,selectedId:t,onSelect:n,statusFilter:r,seen:a}){const i=e.length;return s.jsxs("div",{className:"list ge-card",children:[s.jsxs("div",{className:"lh ge-card-header",children:[s.jsx("span",{className:"lh-title",children:"Inbox"}),s.jsx("span",{className:"lh-count",children:i?s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:i})," ",i===1?"lead":"leads"]}):"Nothing here yet"})]}),s.jsx("div",{className:"rows",children:i?e.map(o=>s.jsx(uut,{request:o,selected:o.id===t,onSelect:n,seen:a},o.id)):s.jsx("div",{className:"empty",children:r&&r!=="All"?"No requests with this status.":"No requests to show."})})]})}function i0(e){try{const t=JSON.parse(window.localStorage.getItem(e));return new Set(Array.isArray(t)?t:[])}catch{return new Set}}function yL(e,t){if(!t)return i0(e);const n=i0(e);if(n.has(t))return n;n.add(t);const r=[...n].slice(-500);try{window.localStorage.setItem(e,JSON.stringify(r))}catch{}return new Set(r)}function hut(e){return typeof e=="boolean"?e?"Yes":"No":Array.isArray(e)?e.join(", "):String(e??"")}function qH({value:e,label:t}){const[n,r]=f.useState(!1),a=async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1200)}catch{}};return s.jsx("button",{type:"button",className:`copy ${n?"ok":""}`,onClick:a,"aria-label":`Copy ${t}`,children:n?"Copied":"Copy"})}function WH({request:e,onPatch:t,onActivity:n,onBack:r}){const[a,i]=f.useState(e.note||""),[o,l]=f.useState(!1),[c,u]=f.useState(!0),d=I5[e.readiness]||I5.possible,h=iut(e),p=Object.hasOwn(e,"convo"),m=()=>{a!==(e.note||"")&&t(e.id,{note:a},{silent:!0}).then(()=>{l(!0),setTimeout(()=>l(!1),1800)})};return s.jsxs("div",{className:"detail ge-card",children:[s.jsxs("div",{className:"dtop ge-card-header",children:[s.jsxs("div",{className:"who",children:[s.jsx("h2",{className:"font-heading text-ink",children:e.name}),s.jsx("div",{className:"via",children:Z0(e.createdAt)})]}),s.jsx("span",{className:"readypill",title:d.def,children:d.lbl}),s.jsxs("span",{className:"stwrap",children:[s.jsx("select",{className:"stsel",value:e.status,"aria-label":"Request status",onChange:g=>t(e.id,{status:g.target.value},{message:`Status: ${g.target.value}`}),children:gL.map(g=>s.jsx("option",{children:g},g))}),s.jsx(Is,{className:"stchev","aria-hidden":"true"})]}),r&&s.jsx("button",{type:"button",className:"det-close",onClick:r,"aria-label":"Close request",children:s.jsx(as,{"aria-hidden":"true"})})]}),s.jsxs("div",{className:"dbody",children:[s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"ge-surface-eyebrow glabel",children:"Request context"}),s.jsxs("div",{className:"ge-card-inset ginset",children:[s.jsxs("div",{className:"crow",children:[s.jsx(aY,{className:"crow-ic",strokeWidth:1.5,"aria-hidden":"true"}),s.jsx("span",{className:"crow-k",children:"Source"}),s.jsx("span",{className:"crow-v",children:xL(e)})]}),s.jsxs("div",{className:"crow",children:[s.jsx(qh,{className:"crow-ic",strokeWidth:1.5,"aria-hidden":"true"}),s.jsx("span",{className:"crow-k",children:"Expert"}),s.jsx("span",{className:"crow-v",children:bL(e)})]}),s.jsxs("div",{className:"crow crow-top",children:[s.jsx(si,{className:"crow-ic",strokeWidth:1.5,"aria-hidden":"true"}),s.jsxs("span",{className:"crow-stack",children:[s.jsx("span",{className:"crow-k",children:"Summary"}),s.jsx("span",{className:`crow-body ${e.summary?"":"muted"}`,children:e.summary||"No conversation summary was shared."})]})]}),s.jsxs("div",{className:"crow",children:[s.jsx(ah,{className:"crow-ic",strokeWidth:1.5,"aria-hidden":"true"}),s.jsx("span",{className:"crow-k",children:"Received"}),s.jsx("span",{className:"crow-body",children:ey(e.createdAt)})]})]})]}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"ge-surface-eyebrow glabel",children:"Contact & details"}),s.jsxs("div",{className:"ge-card-inset ginset",children:[s.jsxs("div",{className:"crow reply-note",role:"note",children:[s.jsx(al,{className:"crow-ic",strokeWidth:1.5,"aria-hidden":"true"}),s.jsx("span",{className:"crow-body",children:"To reply, email this person from your own inbox. Their address is below."})]}),s.jsxs("div",{className:"crow",children:[s.jsx(qr,{className:"crow-ic",strokeWidth:1.5,"aria-hidden":"true"}),s.jsx("span",{className:"crow-k",children:"Email"}),s.jsx("a",{className:"crow-v crow-link",href:`mailto:${e.email}?subject=${encodeURIComponent("Following up on your contact request")}`,onClick:()=>{e.status==="New"&&n(e.id,"Email sent")},children:e.email}),s.jsx(qH,{value:e.email,label:"email"})]}),s.jsxs("div",{className:"crow",children:[s.jsx(Ts,{className:"crow-ic",strokeWidth:1.5,"aria-hidden":"true"}),s.jsx("span",{className:"crow-k",children:"Phone"}),h?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"crow-v",children:e.phone}),s.jsx(qH,{value:e.phone,label:"phone number"})]}):s.jsx("span",{className:"crow-v muted",children:"Not shared"})]}),s.jsxs("div",{className:"crow crow-top",children:[s.jsx(ea,{className:"crow-ic",strokeWidth:1.5,"aria-hidden":"true"}),s.jsxs("span",{className:"crow-stack",children:[s.jsx("span",{className:"crow-k",children:"Message they left"}),s.jsx("span",{className:`crow-body ${e.message?"":"muted"}`,children:e.message||"They left no message, only their contact details."})]})]}),(e.answers||[]).map(g=>s.jsxs("div",{className:"crow crow-top",children:[s.jsx(If,{className:"crow-ic",strokeWidth:1.5,"aria-hidden":"true"}),s.jsxs("span",{className:"crow-stack",children:[s.jsx("span",{className:"crow-k",children:g.label}),s.jsx("span",{className:"crow-body",children:hut(g.value)})]})]},g.id)),s.jsxs("div",{className:"crow",children:[s.jsx(M4,{className:"crow-ic",strokeWidth:1.5,"aria-hidden":"true"}),s.jsx("span",{className:"crow-k",children:"Chat history"}),s.jsxs("button",{type:"button",className:"showbtn","aria-expanded":c,onClick:()=>u(g=>!g),children:[c?"Hide":"Show",s.jsx(Is,{className:`showchev ${c?"up":""}`,"aria-hidden":"true"})]})]}),c&&s.jsx("div",{className:"crow crow-top histpanel",children:e.consent==="summary"?s.jsx("p",{className:"crow-body muted",children:"They chose to share a summary of their chat rather than the full messages. The summary is above."}):e.consent!=="full"?s.jsx("p",{className:"crow-body muted",children:"They chose not to share their chat, so only their contact details came through."}):p?e.convo?.length?s.jsx("div",{className:"convo-box",children:e.convo.map((g,x)=>s.jsx("div",{className:g.role==="user"?"cu":"cx",children:g.text},x))}):s.jsx("p",{className:"crow-body muted",children:"They got in touch directly, without chatting to your AI first."}):s.jsx("p",{className:"crow-body muted",children:"Loading the conversation."})})]})]}),s.jsxs("div",{className:"group",children:[s.jsx("span",{className:"ge-surface-eyebrow glabel",children:"Internal note"}),s.jsxs("div",{className:"ge-card-inset ginset noteinset",children:[s.jsx("textarea",{value:a,placeholder:"Only visible to you","aria-label":"Internal note",onCh
1494ange:g=>i(g.target.value),onBlur:m}),s.jsxs("div",{className:"noterow",children:[o&&s.jsx("span",{className:"note-saved",role:"status",children:"Note saved"}),s.jsx("button",{type:"button",className:"savebtn",onClick:m,children:"Save"})]})]})]})]})]})}const VH={"Email sent":"Email logged, moved to Contacted"},put=[["Maya Alvarez","Sleep Coach","New"],["Tom Becker","Nutrition Expert","New"],["Priya Raman","Sleep Coach","Contacted"],["Jonas Wolff","Profile","Booked a call"]];function mut(){return s.jsxs("div",{className:"list ge-card",children:[s.jsxs("div",{className:"lh ge-card-header",children:[s.jsx("span",{className:"lh-title",children:"Inbox"}),s.jsx("span",{className:"lh-count",children:"1â4 of 4"})]}),s.jsx("div",{className:"rows",children:put.map(([e,t,n])=>s.jsxs("div",{className:"lead-row",children:[s.jsxs("span",{className:"rl-1",children:[s.jsx("span",{className:"rl-name",children:e}),s.jsx("span",{className:"rl-ago",children:"2d ago"})]}),s.jsxs("span",{className:"rl-2",children:[s.jsx("span",{className:`badge ${Die(n)}`,children:n}),s.jsx("span",{className:"rl-src",children:t})]})]},e))})]})}function fut({active:e=!1,settings:t,statusFilter:n="All",onRequestsChange:r,onGoToSettings:a}){const{addToast:i}=f.useContext(Zs),[o,l]=f.useState([]),[c,u]=f.useState(!0),[d,h]=f.useState(!1),[p,m]=f.useState(null),[g,x]=f.useState(()=>i0(HH)),[b,y]=f.useState(!1),[v,w]=f.useState(""),j=f.useRef(null),E=f.useCallback(async()=>{u(!0),h(!1);try{const F=await tke();l(Array.isArray(F?.requests)?F.requests:[])}catch{h(!0)}finally{u(!1)}},[]);f.useEffect(()=>{E()},[E]);const S=f.useMemo(()=>rut(o,n,v),[o,v,n]),_=f.useMemo(()=>{const F={All:o.length};return gL.forEach(H=>{F[H]=0}),o.forEach(H=>{H.status in F&&(F[H.status]+=1)}),F},[o]);f.useEffect(()=>{r?.({counts:_,rows:S,allRows:o,loading:c,error:d,reload:E})},[_,d,S,E,c,r,o]);const k=F=>{l(H=>H.map(G=>G.id===F.id?F:G))},C=f.useCallback(async(F,H,{message:G,silent:M}={})=>{const z=o.find(W=>W.id===F);l(W=>W.map(D=>D.id===F?{...D,...H}:D));try{k(await ake(F,H)),G&&!M&&i(G,"success")}catch(W){throw z&&k(z),i(W?.response?.data?.detail?.message||"Could not save the change.","error"),W}},[i,o]),N=f.useCallback(async(F,H)=>{try{k(await ike(F,H)),VH[H]&&i(VH[H],"success")}catch(G){i(G?.response?.data?.detail?.message||"Could not log the activity.","error")}},[i]),A=S.find(F=>F.id===p)||S[0]||null;f.useEffect(()=>{if(!e||!A||Object.hasOwn(A,"convo"))return;let F=!1;return ske(A.id).then(H=>{F||l(G=>G.map(M=>M.id===H.id?H:M))}).catch(()=>{F||i("Could not load the full request details.","error")}),()=>{F=!0}},[e,i,A]);const[T,I]=f.useState(0),$=()=>I(F=>F+1);f.useEffect(()=>{if(!T)return;const F=requestAnimationFrame(()=>{const H=window.matchMedia("(prefers-reduced-motion: reduce)").matches;j.current?.scrollIntoView({behavior:H?"auto":"smooth",block:"start"})});return()=>cancelAnimationFrame(F)},[T]);const O=F=>{m(F),x(yL(HH,F)),window.matchMedia("(max-width: 960px)").matches?y(!0):$()},U=!d&&!c&&o.length===0;return s.jsxs("div",{className:"reqs",children:[t?.enabled===!1&&s.jsxs("div",{className:"offbanner",role:"alert",children:[s.jsx(xr,{className:"ob-ic","aria-hidden":"true"}),s.jsxs("div",{className:"ob-text",children:["Lead capture is currently ",s.jsx("b",{children:"off"}),", so visitors won't see the Contact button and no new leads can arrive."]}),s.jsx(yt,{size:"sm",onClick:a,children:"Turn on in Settings"})]}),s.jsxs("div",{className:"reqs-intro",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"reqs-head",children:["Someone is waiting for your ",s.jsx("em",{className:"text-indigo",children:"reply"})]}),!U&&s.jsx("p",{className:"lead-lede",children:"People who asked you to get in touch after talking with your AI Experts. You only see what they agreed to share."})]}),!U&&s.jsxs("label",{className:"req-search",children:[s.jsx(Fa,{"aria-hidden":"true"}),s.jsx("span",{className:"sr-only",children:"Search leads"}),s.jsx("input",{type:"search",value:v,onChange:F=>w(F.target.value),placeholder:"Search leads"})]})]}),d?s.jsx(Bh,{icon:xr,title:"Couldn't load leads",description:"Something went wrong while fetching your leads. Please try again.",actionLabel:"Try again",onAction:E}):c?s.jsxs("div",{className:"reqs-loading","aria-label":"Loading leads",children:[s.jsx(gt,{className:"h-3.5 w-2/5 rounded-lg"}),s.jsx(gt,{className:"h-3.5 w-[55%] rounded-lg"}),s.jsx(gt,{className:"h-3.5 w-[30%] rounded-lg"})]}):o.length===0?s.jsx(R5,{ghost:s.jsx(mut,{}),hook:s.jsxs(s.Fragment,{children:["Itâs quiet in here. ",s.jsx("em",{children:"Too quiet."})]}),children:"Leads land here when a visitor asks you to get in touch while chatting with your AI experts."}):s.jsx("div",{id:"reqs-top",ref:j,children:s.jsxs("div",{className:"grid",children:[s.jsx(dut,{requests:S,selectedId:A?.id,onSelect:O,seen:g,statusFilter:n}),A?s.jsx(WH,{request:A,onPatch:C,onActivity:N},A.id):s.jsx("div",{className:"detail ge-card",children:s.jsx("div",{className:"empty",children:"Nothing to show with this filter."})})]})}),s.jsx(en,{isOpen:b,onClose:()=>y(!1),title:A?.name||"Request",hideTitle:!0,maxWidth:"max-w-2xl",className:"reqs-mobile-modal",children:s.jsx("div",{className:"reqs reqs-mobile-detail-shell",children:A&&s.jsx(WH,{request:A,onPatch:C,onActivity:N,onBack:()=>y(!1)},A.id)})})]})}const tb="all";
1494function Uh(e){return e?.topic||"Audience question"}function vL(e){return e?.summary||null}function r2(e){return String(vL(e)||"").split(/\r?\n/).map(t=>t.trim()).filter(t=>t&&!/^#{1,6}\s/.test(t)).map(t=>t.replace(/^[-*+]\s+/,"").replace(/^\d+[.)]\s+/,"").replace(/\[([^\]]+)]\([^)]*\)/g,"$1").replace(/[*_`~]/g,"").trim()).filter(Boolean)}function gut(e){const t=r2(e).slice(0,3);return t.length<=1?t[0]||null:t.map(n=>/[.!?]$/.test(n)?n:`${n}.`).join(" ")}function xut(e){return r2(e).length>3}function but(e,t=tb,n=""){const r=n.trim().toLowerCase();return[...e].filter(a=>t===tb||a.expertId===t).filter(a=>r?[a.expertName,a.source,Uh(a),vL(a)].some(i=>String(i||"").toLowerCase().includes(r)):!0).sort((a,i)=>Ch(i.updatedAt||0)-Ch(a.updatedAt||0)||String(i.id||"").localeCompare(String(a.id||"")))}const Fie="ge.leads.conversationsSeen";function yut(){return i0(Fie)}function vut(e){return yL(Fie,e)}function wut(e){const t=Number(e?.messageCount)||0;return`${t} ${t===1?"message":"messages"}`}function jut({row:e}){const t=vL(e),n=gut(e),r=f.useRef(null),[a,i]=f.useState(!1),[o,l]=f.useState(!1),c=xut(e)||o;return f.useEffect(()=>{const u=r.current;if(!u)return;const d=()=>l(u.scrollHeight>u.clientHeight+1);if(d(),typeof ResizeObserver>"u")return;const h=new ResizeObserver(d);return h.observe(u),()=>h.disconnect()},[n]),!t||!n?null:s.jsxs("section",{className:"sc-summary-section",children:[s.jsx("span",{className:"ge-surface-eyebrow",children:"Conversation summary"}),s.jsxs("div",{className:`sc-summary-card${a?" is-expanded":""}`,children:[s.jsx(Ms,{className:"sc-summary-icon","aria-hidden":"true"}),s.jsx("div",{className:"sc-summary-copy",children:a?s.jsx(Qf,{content:t}):s.jsx("p",{ref:r,className:"sc-summary-preview",children:n})}),c&&s.jsx("button",{type:"button",className:"sc-summary-toggle","aria-expanded":a,"aria-label":a?"Collapse summary":"Expand summary",onClick:()=>i(u=>!u),children:s.jsx(Is,{"aria-hidden":"true"})})]})]})}function GH({row:e,loading:t=!1,error:n=!1,onRetry:r,onClose:a}){if(!e)return null;const i=Array.isArray(e.messages)?e.messages:[];return s.jsxs("article",{className:"sc-detail",children:[s.jsxs("header",{className:"sc-detail-head ge-card-header",children:[s.jsxs("div",{children:[s.jsx("h3",{children:Uh(e)}),s.jsxs("p",{children:[e.expertName||"Expert"," · ",ey(e.updatedAt)]})]}),a&&s.jsx("button",{type:"button",className:"sc-close",onClick:a,"aria-label":"Close conversation",children:s.jsx(as,{"aria-hidden":"true"})})]}),s.jsxs("div",{className:"sc-detail-body",children:[s.jsxs("dl",{className:"sc-counts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Visitor messages"}),s.jsx("dd",{children:e.userMessageCount})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Total messages"}),s.jsx("dd",{children:e.messageCount})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Source"}),s.jsx("dd",{children:e.source||"Unattributed"})]})]}),s.jsx(jut,{row:e},e.id),s.jsxs("section",{className:"sc-transcript","aria-label":"Conversation transcript",children:[s.jsx("span",{className:"ge-surface-eyebrow",children:"Transcript"}),t?s.jsxs("div",{className:"sc-transcript-loading","aria-label":"Loading transcript",children:[s.jsx(gt,{className:"h-16 w-4/5"}),s.jsx(gt,{className:"ml-auto h-20 w-4/5"})]}):n?s.jsxs("div",{className:"sc-transcript-error",children:[s.jsx("p",{children:"Couldnât load this transcript."}),s.jsx("button",{type:"button",onClick:r,children:"Try again"})]}):i.length>0?s.jsx("ol",{className:"sc-messages",children:i.map(o=>s.jsxs("li",{className:`sc-message is-${o.role}`,children:[s.jsx("span",{children:o.role==="user"?"Visitor":"AI expert"}),s.jsx("p",{children:o.content||"Non-text message"})]},o.id))}):s.jsx("p",{className:"sc-no-messages",children:"No readable messages in this conversation."})]})]})]})}function _ut({onExportableChange:e}){const[t,n]=f.useState([]),[r,a]=f.useState(0),[i,o]=f.useState(!0),[l,c]=f.useState(!1),[u,d]=f.useState(0),[h,p]=f.useState(""),[m,g]=f.useState(tb),[x,b]=f.useState(null),[y,v]=f.useState(!1),[w,j]=f.useState({}),[E,S]=f.useState(null),[_,k]=f.useState(0),[C,N]=f.useState(yut);f.useEffect(()=>{let U=!1;return rke().then(F=>
1494{U||(n(F.conversations),a(F.total))}).catch(()=>{U||c(!0)}).finally(()=>{U||o(!1)}),()=>{U=!0}},[u]);const A=f.useMemo(()=>{const U=new Map(t.map(F=>[F.expertId,F.expertName||"Expert"]));return[{value:tb,label:"All experts"},...[...U].sort((F,H)=>F[1].localeCompare(H[1])).map(([F,H])=>({value:F,label:H}))]},[t]),T=f.useMemo(()=>but(t,m,h),[t,m,h]),I=T.find(U=>U.id===x)||T[0]||null,$=I?w[I.id]||I:null,O=U=>!C.has(U.id)&&U.id!==I?.id;return f.useEffect(()=>{const U=[];m!==tb&&U.push(`expert: ${A.find(F=>F.value===m)?.label||"one expert"}`),h.trim()&&U.push(`search: â${h.trim()}â`),e?.({rows:T,scopeNote:U.length?`Filtered by ${U.join(" · ")}.`:T.length===r?"Every conversation you have.":""})},[m,A,T,e,h,r]),f.useEffect(()=>{if(!I?.id||w[I.id])return;let U=!1;return lK(I.id).then(F=>{U||j(H=>({...H,[I.id]:F}))}).catch(()=>{U||S(I.id)}),()=>{U=!0}},[I?.id,w,_]),l?s.jsx("div",{className:"shared-convos reqs",children:s.jsx(Bh,{icon:xr,title:"Couldn't load conversations",description:"Please try again.",actionLabel:"Try again",onAction:()=>{o(!0),c(!1),d(U=>U+1)}})}):s.jsxs("section",{className:"shared-convos reqs","aria-labelledby":"shared-convos-title",children:[s.jsxs("div",{className:"sc-intro",children:[s.jsxs("div",{children:[s.jsxs("h2",{id:"shared-convos-title",className:"reqs-head",children:["What your audience is ",s.jsx("em",{className:"text-indigo",children:"asking"})]}),s.jsx("p",{className:"lead-lede",children:"See what visitors asked and how your AI responded across every audience conversation."})]}),!i&&t.length>0&&s.jsxs("div",{className:"sc-filters",children:[s.jsxs("label",{className:"sc-search",children:[s.jsx(Fa,{"aria-hidden":"true"}),s.jsx("span",{className:"sr-only",children:"Search conversations"}),s.jsx("input",{type:"search",value:h,onChange:U=>p(U.target.value),placeholder:"Search conversations"})]}),s.jsx(xu,{value:m,options:A,onChange:g,label:"Filter conversations by expert",className:"sc-expert"})]})]}),i?s.jsxs("div",{className:"sc-loading ge-card","aria-label":"Loading conversations",children:[s.jsx(gt,{className:"h-4 w-2/5"}),s.jsx(gt,{className:"h-4 w-3/5"}),s.jsx(gt,{className:"h-4 w-1/3"})]}):t.length===0?s.jsxs("div",{className:"sc-empty ge-card",children:[s.jsx(M4,{"aria-hidden":"true"}),s.jsx("h3",{children:"No audience conversations yet"}),s.jsx("p",{children:"Conversations appear after a visitor sends their first message."})]}):T.length===0?s.jsxs("div",{className:"sc-empty ge-card",children:[s.jsx(Fa,{"aria-hidden":"true"}),s.jsx("h3",{children:"No matching conversations"}),s.jsx("p",{children:"Try another search or expert."})]}):s.jsxs("div",{className:"sc-grid",children:[s.jsxs("div",{className:"sc-list ge-card","aria-label":"Audience conversations",children:[s.jsxs("div",{className:"sc-list-head ge-card-header",children:[s.jsx("span",{className:"sc-list-title",children:"Chat inbox"}),s.jsxs("span",{children:[s.jsx("strong",{children:T.length===r?r:T.length}),T.length===r?` conversation${r===1?"":"s"}`:` of ${r} conversations`]})]}),s.jsx("div",{className:"sc-rows",children:T.map(U=>s.jsx("button",{type:"button",className:`sc-row${I?.id===U.id?" is-selected":""}`,"aria-current":I?.id===U.id?"true":void 0,onClick:()=>{b(U.id),N(vut(U.id)),S(F=>F===U.id?null:F),window.matchMedia("(max-width: 960px)").matches&&v(!0)},children:s.jsxs("span",{className:"sc-row-copy",children:[s.jsxs("span",{className:"sc-row-top",children:[s.jsx("strong",{children:Uh(U)}),s.jsx("span",{children:Z0(U.updatedAt)})]}),s.jsxs("span",{className:"sc-row-meta",children:[s.jsxs("span",{className:"sc-row-who",children:[O(U)&&s.jsx("span",{className:"sc-row-new",children:"New"}),s.jsx("span",{className:"sc-row-expert",children:U.expertName||"Expert"})]}),s.jsx("span",{children:wut(U)}),s.jsx("span",{className:"sc-row-go","aria-hidden":"true",children:s.jsx(hn,{})}),s.jsx("span",{className:"sr-only",children:"Open this chat"})]})]})},U.id))})]}),s.jsx("div",{className:"sc-desktop-detail ge-card",children:s.jsx(GH,{row:$,loading:!w[I?.id]&&E!==I?.id,error:E===I?.id,onRetry:()=>{S(null),k(U=>U+1)}})})]}),s.jsx(en,{isOpen:y,onClose:()=>v(!1),title:I?Uh(I):"Conversation",hideTitle:!0,maxWidth:"max-w-2xl",className:"sc-mobile-modal",children:s.jsx("div",{className:"shared-convos sc-mobile-detail-shell",children:s.jsx(GH,{row:$,loading:!w[I?.id]&&E!==I?.id,error:E===I?.id,onRetry:()=>{S(null),k(U=>U+1)},onClose:()=>v(!1)})})})]})}const kut={day:"numeric",month:"long",year:"numeric"},Nut={day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"};function Eut(e){if(!e)return"";const t=Ch(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleDateString("en-GB",kut)}function Sut(e=new Date){return e.toISOString().slice(0,10)}function YH(e,t,n=new Date){const r=e==="csv"?"csv":"html";return`conversations-${t}-${Sut(n)}.${r}`}const Cut=["Topic","Expert","Source","Visitor messages","Total messages","Started","Last activity","Summary"];function Tut(e){const n=(Array.isArray(e)?e:[]).map(r=>[Uh(r),r.expertName||"Expert",r.source||"Unattributed",Number(r.userMessageCount)||0,Number(r.messageCount)||0,r.createdAt||"",r.updatedAt||"",r2(r).join(" · ")].map($ie).join(","));return`${Cut.join(",")} 1495${n.join(` 1496`)}`}function yo(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Aut(e){const t=String(e??"").split(/\n{2,}/).map(n=>
1496n.trim()).filter(Boolean);return t.length?t.map(n=>`<p>${yo(n).replace(/\n/g,"<br />")}</p>`).join(""):'<p class="empty">No text in this message.</p>'}function Rut(e){const t=r2(e);return t.length?`<aside class="summary"><h3>Summary</h3>${t.length===1?`<p>${yo(t[0])}</p>`:`<ul>${t.map(r=>`<li>${yo(r)}</li>`).join("")}</ul>`}</aside>`:""}function Iut(e){const t=String(e.source||"").trim();return t?t.charAt(0).toUpperCase()+t.slice(1):"Unattributed"}function Put(e,t){const n=Array.isArray(e.messages)?e.messages:[],r=[e.expertName||"Expert",Eut(e.updatedAt),Iut(e)].filter(Boolean).map(yo).join(" · "),a=n.length?n.map(i=>{const o=i.role==="user";return`<div class="msg ${o?"visitor":"ai"}"><span class="who">${o?"Visitor":"AI expert"}</span><div class="bubble">${Aut(i.content)}</div></div>`}).join(""):'<p class="empty">This transcript could not be loaded.</p>';return`<section class="convo" id="c${t+1}"> 1497 <p class="eyebrow">Conversation ${t+1}</p> 1498 <h2>${yo(Uh(e))}</h2> 1499 <p class="meta">${r}</p> 1500 <p class="counts">${Number(e.userMessageCount)||0} from the visitor · ${Number(e.messageCount)||0} messages in total</p> 1501 ${Rut(e)} 1502 <div class="transcript">${a}</div> 1503 </section>`}const Lut=` 1504 :root { --indigo:#3D3DF5; --ink:#141413; --ink-mid:#54524C; --ink-muted:#86847B; 1505 --paper:#FDFCF8; --cream:#FAF9F5; --rule:#E8E6DC; --wash:#EEEEFC; --tint:#F5F3EC; } 1506 * { box-sizing:border-box; } 1507 body { margin:0; background:var(--cream); color:var(--ink); 1508 font:15px/1.65 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; 1509 -webkit-print-color-adjust:exact; print-color-adjust:exact; } 1510 .sheet { max-width:760px; margin:0 auto; padding:32px 28px 56px; } 1511 .hint { margin:0 0 22px; padding:11px 15px; border:1px solid var(--rule); border-radius:12px; 1512 background:var(--paper); color:var(--ink-muted); font-size:12.5px; } 1513 h1 { margin:0; font-family:Georgia,'Times New Roman',serif; font-size:40px; font-weight:400; 1514 line-height:1.08; letter-spacing:-0.02em; } 1515 h1 em { color:var(--indigo); } 1516 h2 { margin:0 0 6px; font-family:Georgia,'Times New Roman',serif; font-size:24px; font-weight:400; line-height:1.25; } 1517 h3 { margin:0 0 7px; font-size:10px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:var(--indigo); } 1518 .eyebrow { margin:0 0 10px; font-size:10px; font-weight:600; letter-spacing:.14em; 1519 text-transform:uppercase; color:var(--ink-muted); } 1520 .cover { padding-bottom:26px; border-bottom:1px solid var(--rule); } 1521 .cover .meta { margin:12px 0 0; color:var(--ink-mid); font-size:14px; } 1522 .cover .scope { margin:6px 0 0; color:var(--ink-muted); font-size:13px; } 1523 .stats { display:flex; flex-wrap:wrap; gap:10px; margin:22px 0 0; padding:0; } 1524 .stats div { flex:1 1 120px; padding:13px 15px; border:1px solid var(--rule); border-radius:14px; background:var(--paper); } 1525 .stats dt { margin:0; font-size:10px; font-weight:600; letter-spacing:.1em; text-transform:uppercase; color:var(--ink-muted); } 1526 .stats dd { margin:6px 0 0; font-family:Georgia,'Times New Roman',serif; font-size:26px; line-height:1; } 1527 .contents { margin:30px 0 0; padding:20px 22px; border:1px solid var(--rule); border-radius:16px; background:var(--paper); } 1528 .contents ol { margin:0; padding-left:20px; } 1529 .contents li { margin:6px 0; font-size:13.5px; } 1530 .contents a { color:var(--ink); text-decoration:none; } 1531 .contents a span { color:var(--ink-muted); } 1532 .convo { margin-top:38px; padding-top:30px; border-top:1px solid var(--rule); } 1533 .convo .meta { margin:0; color:var(--ink-mid); font-size:13px; } 1534 .convo .counts { margin:3px 0 0; color:var(--ink-muted); font-size:12.5px; } 1535 .summary { margin:18px 0 0; padding:16px 18px; border:1px solid #DCDCFB; border-radius:16px; background:var(--wash); } 1536 .summary p, .summary li { margin:0 0 5px; color:var(--ink-mid); font-size:13.5px; line-height:1.6; } 1537 .summary ul { margin:0; padding-left:18px; } 1538 .transcript { margin-top:22px; } 1539 .msg { margin:0 0 14px; break-inside:avoid; } 1540 .msg .who { display:block; margin-bottom:5px; font-size:10px; font-weight:600; 1541 letter-spacing:.1em; text-transform:uppercase; color:var(--ink-muted); } 1542 .bubble { padding:13px 16px; border:1px solid var(--rule); border-radius:16px; background:var(--paper); } 1543 .bubble p { margin:0 0 9px; font-size:14px; line-height:1.68; } 1544 .bubble p:last-child { margin-bottom:0; } 1545 .msg.visitor .bubble { border-color:#DCDCFB; background:var(--wash); } 1546 .msg.ai .who { color:var(--indigo); } 1547 .empty { margin:0; color:var(--ink-muted); font-size:13px; font-style:italic; } 1548 footer { margin-top:44px; padding-top:18px; border-top:1px solid var(--rule); 1549 color:var(--ink-muted); font-size:12px; } 1550 @media print { 1551 body { background:#fff; } 1552 .sheet { max-width:none; padding:0; } 1553 .hint { display:none; } 1554 .contents { break-after:page; } 1555 .convo { break-before:page; margin-top:0; padding-top:0; border-top:0; } 1556 .contents + .convo, .cover + .convo { break-before:auto; } 1557 h1 { font-size:32px; } 1558 } 1559 @page { margin:16mm; } 1560`;function Out({rows:e,scopeNote:t="",exportedAt:n=new Date}={}){const r=Array.isArray(e)?e:[],a=r.reduce((u,d)=>u+(Number(d.messageCount)||0),0),i=r.reduce((u,d)=>u+(Number(d.userMessageCount)||0),0),o=new Set(r.map(u=>
1560u.expertName||"Expert")).size,l=n.toLocaleString("en-GB",Nut),c=r.length>1?`<nav class="contents" aria-label="Conversations in this export"> 1561 <h3>In this export</h3> 1562 <ol>${r.map((u,d)=>`<li><a href="#c${d+1}">${yo(Uh(u))} <span>· ${yo(u.expertName||"Expert")} · ${yo(ey(u.updatedAt))}</span></a></li>`).join("")}</ol> 1563 </nav>`:"";return`<!doctype html> 1564<html lang="en"> 1565<head> 1566<meta charset="utf-8" /> 1567<meta name="viewport" content="width=device-width, initial-scale=1" /> 1568<title>Audience conversations · ${yo(l)}</title> 1569<style>${Lut}</style> 1570</head> 1571<body> 1572<div class="sheet"> 1573 <p class="hint">Press Cmd + P (Mac) or Ctrl + P (Windows) to save this as a PDF.</p> 1574 <header class="cover"> 1575 <p class="eyebrow">Great Experts</p> 1576 <h1>Audience <em>conversations</em></h1> 1577 <p class="meta">${r.length} conversation${r.length===1?"":"s"} · exported ${yo(l)}</p> 1578 ${t?`<p class="scope">${yo(t)}</p>`:""} 1579 <dl class="stats"> 1580 <div><dt>Conversations</dt><dd>${r.length}</dd></div> 1581 <div><dt>Messages</dt><dd>${a}</dd></div> 1582 <div><dt>From visitors</dt><dd>${i}</dd></div> 1583 <div><dt>Experts</dt><dd>${o}</dd></div> 1584 </dl> 1585 </header> 1586 ${c} 1587 ${r.map(Put).join(` 1588`)} 1589 <footer>Exported from Great Experts · greatexperts.ai</footer> 1590</div> 1591</body> 1592</html>`}const KH=[{id:"document",icon:si,name:"Transcripts",file:".html",detail:"Every message, laid out to read. Open it and print to PDF.",action:"Download transcripts"},{id:"csv",icon:lY,name:"Spreadsheet",file:".csv",detail:"One row per conversation, with its summary. No messages.",action:"Download spreadsheet"}],Mut=4;async function Dut(e,t,n){const r=new Array(e.length);let a=0,i=0;const o=async()=>{for(;a<e.length&&!n.current;){const l=a;a+=1,r[l]=await lK(e[l].id).then(c=>({...e[l],...c})).catch(()=>e[l]),i+=1,t(i)}};return await Promise.all(Array.from({length:Math.min(Mut,e.length)},o)),r.map((l,c)=>l||e[c])}function $ut({onClose:e,rows:t=[],scopeNote:n=""}){const[r,a]=f.useState("document"),[i,o]=f.useState(null),[l,c]=f.useState(!1),u=f.useRef(!1);f.useEffect(()=>()=>{u.current=!0},[]);const d=t.length,h=i!==null;async function p(){if(!(!d||h)){if(c(!1),r==="csv"){P5(Tut(t),YH("csv",d)),e();return}o(0);try{const b=await Dut(t,o,u);if(u.current)return;P5(Out({rows:b,scopeNote:n}),YH("document",d),"text/html"),o(null),e()}catch{u.current||(o(null),c(!0))}}}const m=h&&d?Math.round(i/d*100):0,g=KH.find(b=>b.id===r),x=d?`${d} conversation${d===1?"":"s"}${n?` · ${n.replace(/\.$/,"")}`:""}`:"There is nothing to export in this view yet.";return s.jsx(en,{isOpen:!0,onClose:e,title:"Export conversations",maxWidth:"max-w-lg",hideTitle:!0,className:"sc-export-modal",children:s.jsxs("div",{className:"sc-export",children:[s.jsxs("header",{className:"sc-export-head",children:[s.jsxs("div",{children:[s.jsx("h2",{children:"Export conversations"}),s.jsx("p",{children:x})]}),s.jsx("button",{type:"button",className:"sc-export-close",onClick:e,disabled:h,"aria-label":"Close",children:s.jsx(as,{"aria-hidden":"true"})})]}),s.jsx("div",{className:"sc-export-formats",role:"radiogroup","aria-label":"Export format",children:KH.map(({id:b,icon:y,name:v,file:w,detail:j})=>s.jsxs("button",{type:"button",role:"radio","aria-checked":r===b,disabled:h,className:`sc-export-format${r===b?" is-on":""}`,onClick:()=>a(b),children:[s.jsx("span",{className:"sc-export-icon",children:s.jsx(y,{"aria-hidden":"true"})}),s.jsxs("span",{className:"sc-export-copy",children:[s.jsxs("span",{className:"sc-export-name",children:[v,s.jsx("span",{className:"sc-export-file",children:w})]}),s.jsx("span",{className:"sc-export-detail",children:j})]}),s.jsx("span",{className:"sc-export-mark","aria-hidden":"true",children:r===b&&s.jsx(ft,{})})]},b))}),h&&s.jsxs("div",{className:"sc-export-progress",role:"status",children:[s.jsx("span",{className:"sc-export-bar","aria-hidden":"true",children:s.jsx("span",{style:{width:`${Math.max(4,m)}%`}})}),s.jsxs("span",{children:["Collecting transcripts · ",i," of ",d]})]}),l&&s.jsxs("p",{className:"sc-export-error",role:"alert",children:[s.jsx(xr,{"aria-hidden":"true"}),"Something went wrong building the file. Please try again."]}),s.jsxs("div",{className:"sc-export-actions",children:[s.jsx(yt,{variant:"secondary",onClick:e,disabled:h,children:"Cancel"}),s.jsx(yt,{onClick:p,disabled:!d,isLoading:h,children:g.action})]})]})})}function wL({icon:e,title:t,subtitle:n,children:r}){return s.jsxs("div",{className:"ge-card flex flex-col overflow-hidden",children:[s.jsx("div",{className:"ge-card-header flex flex-wrap items-baseline justify-between gap-x-4 gap-y-2 px-4 pb-3.5 pt-3 sm:px-[30px]",children:s.jsxs("span",{className:`flex gap-[11px] ${n?"items-start":"items-center"}`,children:[e,s.jsxs("span",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"font-heading text-base font-normal text-ink",children:t}),n&&s.jsx("span",{className:"ins-card-subtitle",children:n})]})]})}),s.jsx("div",{className:"flex flex-col gap-3 px-4 pb-[22px] pt-5 sm:px-[30px]",children:r})]})}function jL({className:e="",children:t}){return s.jsx("div",{className:`ge-card flex flex-col gap-3.5 px-4 py-[22px] sm:px-[26px] ${e}`,children:t})}function Bie({n:e,pct:t,solid:n=!1}){const r=Number(e)?Math.max(3,t):0;return s.jsx("span",{className:"ins-track","aria-hidden":"true",children:s.jsx("span",{className:"ins-fill",style:{width:`${r}%`,background:n?"var(--indigo)":"rgba(61, 61, 245, 0.34)"}})})}const Fut=[{v:"1d",btn:"Today",low:"the last 24 hours",cap:"Last 24 hours"},{v:"7d",btn:"7 days",low:"the last 7 days",cap:"Last 7 days"},{v:"30d",btn:"30 days",low:"the last 30 days",cap:"Last 30 days"},{v:"all",btn:"All time",low:"all time",cap:"All time"}],Uie="30d";function mC(e,t){return e===void 0?t:e}function zie(e=[]){return e.length>1}function But(e,t){return zie(e)?t:null}function Uut(e,t,n=5){const r=Math.max(1,Math.ceil(e.length/n)),a=Math.min(Math.max(1,t),r),i=(a-1)*n,o=e.slice(i,i+n);return{rows:o,page:a,pageCount:r,from:o.length?i+1:0,to:i+o.length}}const zut={convMonth:0,people:0,anonPeople:0,voiceMonth:0,requestsMonth:0,connectRatePct:0,profileVisitors:0,recommendations:0,clicks:0};function Hut(e,t){return(Array.isArray(e)?e:[]).flatMap(n=>{const r=Number(n?.conversations)||0,a=Number(n?.requests)||0;if(n?.source==="platform"||n?.source==="voice")return[];if(n?.source==="unknown"&&r===0&&a===0)return[];const i={...n,conversations:r,requests:a};return n?.source==="embed"&&!t&&(i.embedStatus=r||a?"Currently off":"Not enabled",!r&&!a&&(i.muted=!0)),[i]})}function a_(e){if(typeof e!="string"||!e.trim())return null;const t=Ch(e);return Number.isNaN(t.getTime())?null:t.toISOString()}function qut(e){return(Array.isArray(e)?e:[]).flatMap(t=>!t||typeof t!="object"||!String(t.ref||"").trim()?[]:[{ref:String(t.ref),title:String(t.title||"Untitled offering"),imageUrl:typeof t.imageUrl=="string"&&t.imageUrl?t.imageUrl:null,recommendations:Math.max(0,Number(t.recommendations)||0),clicks:Math.max(0,Number(t.clicks)||0),lastRecommendedAt:a_(t.lastRecommendedAt),lastActivityAt:a_(t.lastActivityAt)}])}const Wut={shown:"recommendations",requested:"requested",clicked:"clicks"};function Vut(e,t="clicked",n=1,r=5){const a=Array.isArray(e)?[...e]:[];a.sort((d,h)=>{if(t==="latest"){const p=(Date.parse(h?.lastActivityAt||"")||0)-(Date.parse(d?.lastActivityAt||"")||0);if(p)return p}else{const p=Wut[t]||"clicks",m=(Number(h?.[p])||0)-(Number(d?.[p])||0);if(m)return m}return String(d?.title||"").localeCompare(String(h?.title||""))});const i=Math.max(1,Math.floor(Number(r)||5)),o=a.length,l=Math.max(1,Math.ceil(o/i)),c=Math.max(1,Math.min(l,Math.floor(Number(n)||1))),u=(c-1)*i;return{rows:a.slice(u,u+i),page:c,pageCount:l,start:o?u+1:0,end:Math.min(u+i,o),total:o}}function Gut(e,t){const n=(Array.isArray(e)?e:[]).map(a=>({...a,requested:0})),r=new Map(n.map(a=>[a.ref,a]));for(const a of Array.isArray(t)?t:[]){const i=String(a?.ref||""),o=Math.max(0,Number(a?.n)||0);if(!i||!o)continue;const l=r.get(i);l?l.requested=o:n.push({ref:i,title:String(a?.t||"Untitled offering"),imageUrl:null,recommendations:0,clicks:0,requested:o,lastRecommendedAt:null,lastActivityAt:null})}return n}function Yut(e){const t=Array.isArray(e)?e:[],n=t.reduce((a,i)=>a+(Number(i?.recommendations)||0),0),r=t.reduce((a,i)=>a+(Number(i?.clicks)||0),0);return{recommendations:n,clicks:r,ctr:Gu(r,n)}}function Kut(e){const t=Array.isArray(e)?e:[],n=[],r=t.filter(i=>(Number(i?.requested)||0)>(Number(i?.recommendations)||0)).sort((i,o)=>(Number(o?.requested)||0)-(Number(i?.requested)||0))[0];if(r){const i=Number(r.requested)||0,o=Number(r.recommendations)||0;n.push({id:"under-recommended",tone:"demand",title:"Asked for, rarely recommended",text:`${i} ${i===1?"person":"people"} asked about â${r.title}â, but your AI ${o===0?"has not recommended it yet":`recommended it only ${o} time${o===1?"":"s"}`}. Add more about it to your profile so your AI can recommend it.`})}const a=t.filter(i=>(Number(i?.clicks)||0)>0&&(Number(i?.recommendations)||0)>0).sort((i,o)=>(Number(o?.clicks)||0)-(Number(i?.clicks)||0))[0];if(a){const i=Number(a.clicks)||0,o=Number(a.recommendations)||0,l=i<=o?` (${Gu(i,o)}% follow-through)`:"";n.push({id:"closer",tone:"win",title:"Your best closer",text:`â${a.title}â converts: recommended ${o} time${o===1?"":"s"}, clicked ${i} time${i===1?"":"s"}${l}.`})}return n}function Xut(e){const t=a_(e);return t?`These are new first-party metrics. Activity before ${new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"})} is not available.`:null}function Jut(e={},t=Uie){const n=e&&typeof e=="object"?e:{},r=n.embedEnabled===!0;return{...n,stats:{...zut,...n.stats||{}},previous:t==="all"||!n.previous?null:n.previous,availableExperts:Array.isArray(n.availableExperts)?n.availableExperts:[],embedEnabled:r,sources:Hut(n.sources,r),trackingSince:a_(n.trackingSince),topRecommended:Array.isArray(n.topRecommended)?n.topRecommended:[],topClicked:Array.isArray(n.topClicked)?n.topClicked:[],offeringPerformance:qut(n.offeringPerformance)}}function Wp(e,t,n){const r=Number(t)||0;if(n==="all"||r<=0)return null;const a=Math.round(((Number(e)||0)-r)/r*100);return a<0?`${Math.abs(a)}% lower than previous period`:`${a}% vs previous period`}function Qut({newRequests:e=0,gaps:t=[],topClicked:n=[]}={}){const r=[];return Number(e)>0&&r.push({id:"requests",title:`${e} new request${Number(e)===1?"":"s"} waiting`,body:"Reply while the conversation is still fresh.",label:"View new requests"}),t?.length&&r.push({id:"gaps",title:`Cover â${t[0].t}â`,body:"People asked for more than your expert could answer.",label:"Review knowledge gaps"}),n?.length&&r.push({id:"clicks",title:`Review â${n[0].title||"your top offering"}â`,body:`${Number(n[0].n)||0} validated click${Number(n[0].n)===1?"":"s"} in this period.`,label:"Review clicked offerings"}),r.slice(0,3)}const zh={fontFeatureSettings:'"tnum" 1, "lnum" 1'};function Gu(e,t){const n=Number(t)||0;return n<=0?0:Math.round((Number(e)||0)/n*100)}const Zut={Conversations:"Started a conversation","Kept talking (5+ messages)":"5+ messages","Asked to connect":"Left their contact"},edt=["Booked a next step"];function tdt(e,t){return(e||[]).filter(n=>n&&!edt.includes(n.label)).map((n,r)=>({label:Zut[n.label]||n.label,n:Number(n.n)||0,pct:Gu(n.n,t),showPct:r>0}))}function sdt(e){const t=Number(e)||0;return t===0?"Nobody came back":t===1?"1 person came back":`${t} people came back`}
1592function ndt(e){const t=Number(e)||0;return t===1?"1 person asked to connect":`${t} people asked to connect`}function rdt(e,t){const n=Number(e)||0,r=Number(t)||0;return r?`${n} of ${r} recommendations clicked · ${Math.min(100,Gu(n,r))}%`:"No offerings recommended yet"}function adt(e,t){const n=Number(e)||0;if(n<=0)return null;const r=Math.min(n,Math.max(0,Number(t)||0)),a=Gu(r,n);return{voice:r,text:n-r,voicePct:a,textPct:100-a}}const idt={Mon:"Monday",Tue:"Tuesday",Wed:"Wednesday",Thu:"Thursday",Fri:"Friday",Sat:"Saturday",Sun:"Sunday"},odt={"22-02":"Night","02-06":"Early","06-10":"Morning","10-14":"Midday","14-18":"Afternoon","18-22":"Evening"},ldt=["02-06","06-10","10-14","14-18","18-22","22-02"];function cdt(e){const t=new Map((e||[]).map(n=>[n.h,n]));return ldt.map(n=>{const r=t.get(n);return{h:n,name:odt[n],n:Number(r?.n)||0,night:!!r?.night}})}function udt(e,t){const n=Number(e)||0;if(n===0)return 0;const r=Number(t)||0;return r<=0?8:Math.max(8,Math.round(n/r*140))}function ddt(e,t,n){const r=e||[];if(r.length===0)return null;const a=r.reduce((o,l)=>l.n>o.n?l:o,r[0]),i=Gu(a.n,t);return{name:n(a),n:a.n,pct:i,text:`${n(a)} (${i}%)`}}function hdt(e,t,n){const r=e||[];if(r.length===0)return null;const a=r.reduce((c,u)=>u.n<c?u.n:c,r[0].n),i=r.filter(c=>c.n===a).map(n),o=i.length>2?`${i.slice(0,2).join(", ")} and ${i.length-2} more`:i.join(" and "),l=Gu(a,t);return{names:i,n:a,pct:l,text:`${o} (${l}%)`}}function pdt(e,t){return Gu(e,t)}const mdt={1:"One",2:"Two",3:"Three"};function fdt(e){const t=(e||[]).filter(l=>l&&l.t);if(t.length===0)return"Nothing yet. Gaps appear once several people push past what your AI Expert covers.";if(t.length===1)return`One topic came up repeatedly past what your expert covers: ${t[0].t}.`;const n=t.slice(0,3).map(l=>l.t),r=mdt[t.length]||String(t.length),a=t.length-n.length,i=n.length>1?`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`:n[0],o=a>0?`, and ${a} more`:"";return`${r} topics came up repeatedly past what your expert covers: ${i}${o}.`}function XH({title:e,items:t,total:n,dimAxis:r=!1}){const a=t.reduce((c,u)=>u.n>c?u.n:c,0),i=c=>c.name,o=ddt(t,n,i),l=hdt(t,n,i);return s.jsxs(jL,{children:[s.jsx("span",{className:"flex items-center gap-[11px]",children:s.jsx("span",{className:"font-heading text-base font-normal text-ink",children:e})}),s.jsx("div",{className:"ins-bars",style:{gridTemplateColumns:`repeat(${t.length}, minmax(0, 1fr))`},children:t.map(c=>{const u=a>0&&c.n===a;return s.jsxs("div",{className:"ins-bars-col",children:[s.jsx("span",{className:`text-[11.5px] ${u?"font-semibold text-indigo":r?"text-ink-muted":"text-ink-light"}`,style:zh,children:c.n}),s.jsx("span",{className:"ins-bar","aria-hidden":"true",style:{height:`${udt(c.n,a)}px`,background:u?"var(--indigo)":"rgba(61, 61, 245, 0.22)"}}),s.jsx("span",{className:`text-[11px] tracking-[0.06em] ${r?"text-ink-muted":u?"text-indigo":"text-ink-light"}`,children:c.axis})]},c.key)})}),s.jsxs("p",{className:"ins-foot",children:["Busiest: ",s.jsx("strong",{className:"font-semibold text-ink",children:o?.text||"nothing yet"}),". Quietest: ",s.jsx("strong",{className:"font-semibold text-ink",children:l?.text||"nothing yet"}),"."]})]})}const gdt={viewBox:"0 0 24 24",fill:"none",strokeWidth:1.6,strokeLinecap:"round","aria-hidden":"true",focusable:"false"};function ty({className:e="h-[18px] w-[18px] flex-none stroke-indigo",children:t,join:n=!1}){return s.jsx("svg",{...gdt,strokeLinejoin:n?"round":void 0,className:e,children:t})}function Hie(e){return s.jsxs(ty,{...e,children:[s.jsx("path",{d:"M4 19V5"}),s.jsx("path",{d:"M4 19h16"}),s.jsx("path",{d:"M8 19v-5"}),s.jsx("path",{d:"M12.5 19v-8"}),s.jsx("path",{d:"M17 19v-3"})]})}function xdt(e){return s.jsx(ty,{...e,children:s.jsx("path",{d:"M4.5 6.2A1.7 1.7 0 0 1 6.2 4.5h11.6a1.7 1.7 0 0 1 1.7 1.7v8.1a1.7 1.7 0 0 1-1.7 1.7H9.8L6 19.5V16H6.2a1.7 1.7 0 0 1-1.7-1.7V6.2Z"})})}function qie(e){return s.jsxs(ty,{join:!0,...e,children:[s.jsx("path",{d:"M7 3.5h10"}),s.jsx("path",{d:"M7 20.5h10"}),s.jsx("path",{d:"M8 3.5v3.2c0 1.6 1 2.6 2.4 3.6l1.6 1.2 1.6-1.2c1.4-1 2.4-2 2.4-3.6V3.5"}),s.jsx("path",{d:"M8 20.5v-3.2c0-1.6 1-2.6 2.4-3.6L12 12.5l1.6 1.2c1.4 1 2.4 2 2.4 3.6v3.2"})]})}function bdt(e){return s.jsxs(ty,{...e,children:[s.jsx("circle",{cx:"9",cy:"9",r:"3.4"}),s.jsx("path",{d:"M3.6 19c.9-2.9 3.1-4.5 5.9-4.5s5 1.6 5.9 4.5"}),s.jsx("path",{d:"M16 7.2a3 3 0 0 1 0 5.6"}),s.jsx("path",{d:"M18.4 19c-.3-1.2-.8-2.2-1.5-3"})]})}function ydt(e){return s.jsxs(ty,{...e,children:[s.jsx("path",{d:"M12 4.5v3"}),s.jsx("path",{d:"M12 16.5v3"}),s.jsx("circle",{cx:"12",cy:"12",r:"4.2"}),s.jsx("path",{d:"M5.5 12h-1.5"}),s.jsx("path",{d:"M20 12h-1.5"})]})}function vdt({name:e,src:t}){const[n,r]=f.useState(!1),a=(e||"?").trim().charAt(0).toUpperCase()||"?";return s.jsx("span",{className:"inline-flex h-[38px] w-[38px] flex-none items-center justify-center overflow-hidden rounded-full bg-[rgba(61,61,245,0.10)] font-heading text-base text-indigo","aria-hidden":"true",children:t&&!n?s.jsx("img",{src:t,alt:"",className:"block h-full w-full object-cover",onError:()=>r(!0)}):a})}function wdt({experts:e}){const t=[...e||[]].sort((c,u)=>u.convos-c.convos),n=t.map(c=>`${c.id}:${c.convos}:${c.connect}`).join("|"),[r,a]=f.useState({key:n,page:1});r.key!==n&&a({key:n,page:1});const i=r.key===n?r.page:1,o=Uut(t,i);if(t.length===0)return null;const l=c=>
1592a({key:n,page:c});return s.jsxs(jL,{children:[s.jsxs("div",{className:"ins-experts-heading",children:[s.jsxs("span",{className:"flex items-center gap-[11px]",children:[s.jsx(bdt,{}),s.jsx("span",{className:"font-heading text-base font-normal text-ink",children:"Your experts"})]}),s.jsxs("span",{className:"ins-experts-count","aria-live":"polite","aria-atomic":"true",children:[o.from,"â",o.to," of ",t.length]})]}),s.jsx("p",{className:"-mt-1 pl-[29px] text-[13.5px] leading-[1.6] text-ink-mid",children:"Conversations and connect requests per expert."}),s.jsx("div",{className:"ins-experts-scroll",children:s.jsxs("table",{className:"ins-experts-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",children:"Expert"}),s.jsx("th",{scope:"col",children:"Chats"}),s.jsx("th",{scope:"col",children:"Requests"})]})}),s.jsxs("tbody",{children:[o.rows.map(c=>s.jsxs("tr",{children:[s.jsxs("th",{scope:"row",children:[s.jsx(vdt,{name:c.name,src:c.avatarUrl||void 0}),s.jsx("span",{children:c.name})]}),s.jsx("td",{children:c.convos}),s.jsx("td",{children:c.connect})]},c.id)),o.pageCount>1&&Array.from({length:5-o.rows.length},(c,u)=>s.jsxs("tr",{className:"ins-row-filler","aria-hidden":"true",children:[s.jsx("th",{scope:"row",children:s.jsx("span",{className:"inline-flex h-[38px] w-[38px] flex-none"})}),s.jsx("td",{colSpan:2})]},`filler-${u}`))]})]})}),o.pageCount>
15921&&s.jsxs("nav",{className:"ins-experts-pager","aria-label":"Expert pages",children:[s.jsx("button",{type:"button",className:"ins-experts-page-button","aria-label":"Previous expert page",disabled:o.page<=1,onClick:()=>l(o.page-1),children:s.jsx(Wh,{size:15,"aria-hidden":"true"})}),s.jsx("button",{type:"button",className:"ins-experts-page-button","aria-label":"Next expert page",disabled:o.page>=o.pageCount,onClick:()=>l(o.page+1),children:s.jsx(hn,{size:15,"aria-hidden":"true"})})]})]})}function Wie({funnel:e,convMonth:t,returning:n}){const r=tdt(e,t);return s.jsxs(wL,{icon:s.jsx(Hie,{}),title:"How conversations progress",children:[s.jsx("div",{className:"flex flex-col gap-[11px]",children:r.map(a=>s.jsxs("div",{className:"ins-funnel-row",children:[s.jsx("span",{className:"min-w-0 text-[13.5px] font-medium text-ink-mid",children:a.label}),s.jsx(Bie,{n:a.n,pct:a.pct}),s.jsx("span",{className:"text-right text-sm font-medium text-ink",style:zh,children:a.n}),s.jsx("span",{className:"ins-pct text-right text-[11.5px] text-ink-light",style:zh,children:a.showPct?`${a.pct}%`:""})]},a.label))}),s.jsxs("p",{className:"ins-foot",children:[s.jsx("strong",{className:"font-semibold text-ink",children:sdt(n)})," ","for a second conversation in this period. Returning visitors are your warmest audience."]})]})}function jdt({gaps:e,unavailable:t,loading:n}){return s.jsxs("div",{className:"flex flex-col justify-center gap-3 rounded-[var(--radius-card)] border border-[rgba(20,20,19,0.13)] bg-[rgba(245,243,236,0.5)] px-[26px] py-[22px]",children:[s.jsxs("span",{className:"flex items-center gap-[11px]",children:[s.jsx(ydt,{}),s.jsx("span",{className:"font-heading text-[15px] font-normal text-ink-mid",children:"Where people wanted more"})]}),s.jsx("p",{className:"pl-[29px] text-[13.5px] leading-[1.6] text-ink-mid",children:"Questions your AI Expert could not fully answer, worth turning into new content."}),s.jsxs("div",{className:"flex items-start gap-[11px] rounded-[14px] border border-[var(--surface-border)] bg-[rgba(253,252,248,0.8)] px-[18px] py-4",children:[s.jsx(qie,{className:"mt-px h-[18px] w-[18px] flex-none stroke-[var(--ink-light)]"}),n?s.jsx(gt,{className:"h-4 w-4/5"}):s.jsx("p",{className:"text-[13.5px] leading-[1.6] text-ink-mid",children:t?"Topic analysis is unavailable right now. Counts and charts are unaffected.":fdt(e)})]})]})}const _dt=[{id:"clicked",title:"Most clicked",note:"What people actually opened",icon:wY,key:"clicks",strong:!0,unit:e=>`${e} ${e===1?"click":"clicks"}`},{id:"shown",title:"Most recommended",note:"What your AI puts forward most",icon:I_,key:"recommendations",unit:e=>`${e} ${e===1?"time":"times"}`},{id:"requested",title:"Most asked for",note:"Visitor explicitly asked about",icon:Ci,key:"requested",demandOnly:!0,unit:e=>`${e} ${e===1?"ask":"asks"}`}],JH=3,Wv=25,kdt=[{id:"recommendations",icon:I_,label:"Recommendations",caption:"Times your AI suggested an offering"},{id:"clicks",icon:wY,label:"Clicks",caption:"Visitors who opened one"},{id:"rate",icon:A1e,label:"Click rate",caption:"Clicks out of recommendations"}];function Ndt({title:e,value:t,max:n,unit:r,strong:a}){const i=t>0?Math.max(2,Math.round(t/n*100)):0;return s.jsxs("div",{className:"ins-rank-row",children:[s.jsx("span",{className:"ins-rank-name",title:e,children:e}),s.jsx("span",{className:"ins-rank-track","aria-hidden":"true",children:s.jsx("span",{className:`ins-rank-fill${a?"":" is-soft"}`,style:{width:`${i}%`}})}),s.jsx("span",{className:"ins-rank-value",style:zh,children:r(t)})]})}function Edt({block:e,offerings:t,pending:n,open:r,onToggle:a}){const i=Vut(t,e.id,1,Wv).rows,o=t.length,l=Math.max(1,...t.map(d=>Number(d[e.key])||0)),c=r?i:i.slice(0,JH),u=e.icon;return s.jsxs("section",{className:"ins-rank-block",children:[s.jsxs("header",{children:[s.jsxs("h3",{children:[s.jsx("span",{className:"ins-rank-icon",children:s.jsx(u,{"aria-hidden":"true"})}),e.title]}),s.jsx("p",{children:e.note})]}),n?s.jsx("p",{className:"ins-rank-note",children:"Countingâ¦"}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:`ins-rank-rows${r?" is-open":""}`,children:c.map(d=>s.jsx(Ndt,{title:d.title,value:Number(d[e.key])||0,max:l,unit:e.unit,strong:e.strong},d.ref))}),o>JH&&s.jsxs("button",{type:"button",className:"ins-rank-more","aria-expanded":r,onClick:()=>a(e.id),children:[r?"Show less":`See more (${Math.min(o,Wv)})`,s.jsx(Is,{"aria-hidden":"true",className:r?"is-open":void 0})]}),r&&o>Wv&&s.jsxs("p",{className:"ins-rank-note",children:["Showing the top ",Wv," of ",o,"."]})]})]})}function Sdt({items:e,requested:t=null,requestedLoading:n=!1}){const r=t!==null,a=r?Gut(e,n?[]:t):Array.isArray(e)?e:[],i=Yut(a),o=r&&!n?Kut(a):[],l=_dt.filter(h=>r||!h.demandOnly),[c,u]=f.useState({}),d=h=>u(p=>({...p,[h]:!p[h]}));
1592return s.jsx("div",{id:"insight-recommendations",tabIndex:-1,className:"ins-focus-target scroll-mt-6",children:s.jsx("div",{id:"insight-clicks",tabIndex:-1,className:"ins-focus-target ins-offerings-anchor scroll-mt-6",children:s.jsx(wL,{icon:s.jsx(Hie,{}),title:"Your AI sales agent at work",subtitle:"What your AI recommended, and what people did about it.",children:a.length?s.jsxs(s.Fragment,{children:[s.jsx("dl",{className:"ins-sales-kpis",children:kdt.map(({id:h,icon:p,label:m,caption:g})=>s.jsxs("div",{className:"ins-sales-kpi",children:[s.jsx("span",{className:"ins-sales-kpi-icon",children:s.jsx(p,{"aria-hidden":"true"})}),s.jsxs("div",{className:"ins-sales-kpi-copy",children:[s.jsx("dt",{children:m}),s.jsxs("dd",{style:zh,children:[h==="recommendations"&&i.recommendations,h==="clicks"&&i.clicks,h==="rate"&&(i.recommendations?`${Math.min(100,i.ctr)}%`:"â")]}),s.jsx("p",{children:g})]})]},h))}),o.length>0&&s.jsx("div",{className:"ins-sales-callouts",children:o.map(h=>s.jsxs("p",{className:`ins-sales-callout ins-sales-callout-${h.tone}`,children:[s.jsx("span",{className:"ins-callout-emoji","aria-hidden":"true",children:h.tone==="demand"?"ð£":"ð"}),s.jsxs("span",{children:[s.jsxs("strong",{children:[h.title,"."]})," ",h.text]})]},h.id))}),s.jsx("div",{className:"ins-rankings",children:l.map(h=>s.jsx(Edt,{block:h,offerings:a,pending:h.demandOnly&&n,open:!!c[h.id],onToggle:d},h.id))})]}):s.jsx("p",{className:"ins-offerings-empty",children:"Once people explore your offerings, you will see what they asked for, what your AI recommended, and what they clicked, right here."})})})})}function Cdt({n:e,kmin:t}){return s.jsxs("span",{className:"inline-flex h-8 items-center gap-2 rounded-pill border border-[var(--surface-border)] bg-[rgba(253,252,248,0.8)] px-3.5",title:`${e} of ${t} people so far`,children:[s.jsx("span",{className:"inline-flex items-center gap-1","aria-hidden":"true",children:Array.from({length:t},(n,r)=>s.jsx("span",{className:"h-[5px] w-[5px] rounded-pill",style:{background:r<e?"rgba(61, 61, 245, 0.5)":"rgba(20, 20, 19, 0.12)"}},r))}),s.jsxs("span",{className:"text-[11.5px] font-medium tracking-[0.04em] text-ink-muted",style:zh,children:[e,"/",t]})]})}function Tdt(){const e="Grouping topics from recent conversations";return s.jsxs("div",{className:"flex flex-col gap-3 py-1","aria-busy":"true","aria-label":e,children:[s.jsx(gt,{className:"h-4 w-3/5"}),s.jsx(gt,{className:"h-2.5 w-full"}),s.jsx(gt,{className:"h-4 w-2/5"}),s.jsx(gt,{className:"h-2.5 w-full"}),s.jsxs("p",{className:"text-[13px] leading-[1.6] text-ink-muted",children:[e,"."]})]})}function Vie({topics:e,hidden:t,kmin:n,unavailable:r,loading:a}){const i=e||[],o=t||[],l=i[0]?.n||0;return s.jsx(wL,{icon:s.jsx(xdt,{}),title:"What people ask about",children:a?s.jsx(Tdt,{}):r?s.jsx("p",{className:"ins-note",children:"Topic analysis is unavailable right now. Counts and charts are unaffected."}):i.length===0?s.jsx("p",{className:"ins-note",children:"No conversations in this period yet. Share your expert link and the first patterns will appear here."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-col gap-[11px]",children:i.map((c,u)=>{const d=u===0;return s.jsxs("div",{className:"ins-topic-row",children:[s.jsx("span",{className:`text-[13.5px] leading-[1.4] ${d?"font-semibold text-ink":"font-medium text-ink-mid"}`,style:{textWrap:"pretty"},children:c.t}),s.jsx(Bie,{n:c.n,pct:pdt(c.n,l),solid:d}),s.jsx("span",{className:`text-right text-sm text-ink ${d?"font-bold":"font-medium"}`,style:zh,children:c.n}),s.jsx("span",{className:"ins-pct text-right text-[11.5px] text-ink-light",children:"people"})]},c.t)})}),o.length>0&&s.jsxs("div",{className:"mt-[clamp(10px,2vh,20px)] flex flex-col gap-3 rounded-[var(--radius-card)] border border-[var(--surface-border)] bg-[rgba(245,243,236,0.5)] px-5 py-[18px]",children:[s.jsxs("span",{className:"flex items-center gap-[11px]",children:[s.jsx(qie,{}),s.jsxs("span",{className:"text-[13px] leading-[1.6] text-ink-muted",children:[s.jsx("strong",{className:"font-heading text-[15px] font-normal text-ink-mid",children:o.length===1?"1 topic is building up.":`${o.length} topics are building up.`})," ","Each stays hidden until ",n," different people have asked."]})]}),s.jsx("span",{className:"flex flex-wrap items-center gap-2.5 pl-[27px]",children:o.map((c,u)=>s.jsx(Cdt,{n:c,kmin:n},u))})]})]})})}function Vp({detail:e,delta:t}){return s.jsxs(s.Fragment,{children:[e,t&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),t]})]})}function Adt({convMonth:e,voiceMonth:t}){const n=adt(e,t);return n?s.jsxs("span",{className:"ins-voice-note",children:[s.jsxs("span",{className:"ins-voice-bar","aria-hidden":"true",children:[n.voicePct>0&&s.jsx("span",{className:"ins-voice-seg-voice",style:{width:`${n.voicePct}%`}}),n.textPct>0&&s.jsx("span",{className:"ins-voice-seg-text",style:{width:`${n.textPct}%`}})]}),s.jsxs("span",{className:"ins-voice-legend",children:[s.jsxs("span",{children:[s.jsx("i",{className:"ins-voice-dot ins-voice-seg-voice","aria-hidden":"true"}
1592),"Voice ",n.voicePct,"% · ",n.voice]}),s.jsxs("span",{children:[s.jsx("i",{className:"ins-voice-dot ins-voice-seg-text","aria-hidden":"true"}),"Text ",n.textPct,"% · ",n.text]})]})]}):"Voice and text mix appears here"}function QH({stats:e,previous:t,period:n,expertMode:r=!1,onShowConversations:a,onShowRequests:i,onJump:o}){return s.jsxs("div",{className:"ins-stat-grid grid grid-cols-2 gap-3.5 lg:grid-cols-3",children:[s.jsx(fi,{label:"Conversations",value:e.convMonth,note:s.jsx(Vp,{detail:s.jsx(Adt,{convMonth:e.convMonth,voiceMonth:e.voiceMonth}),delta:Wp(e.convMonth,t?.conversations,n)}),accent:!0,className:"ins-stat-card",onClick:a,ariaLabel:"Conversations, open the conversation list",actionLabel:a?"View":void 0}),s.jsx(fi,{label:"People who chatted",value:e.people,note:s.jsx(Vp,{detail:`Different people · ${e.anonPeople} not signed in`,delta:Wp(e.people,t?.people,n)}),valueIndigo:!0,className:"ins-stat-card"}),!r&&s.jsx(fi,{label:"Profile visitors",value:e.profileVisitors,note:s.jsx(Vp,{detail:"People who opened your profile page",delta:Wp(e.profileVisitors,t?.profileVisitors,n)}),className:"ins-stat-card"}),s.jsx(fi,{label:"Leads",value:e.requestsMonth,note:s.jsx(Vp,{detail:ndt(e.requestsMonth),delta:Wp(e.requestsMonth,t?.requests,n)}),className:"ins-stat-card",onClick:i,ariaLabel:"Leads, open the lead inbox",actionLabel:"Open"}),s.jsx(fi,{label:"Recommendations",value:e.recommendations,note:s.jsx(Vp,{detail:"Times your AI suggested one of your offerings",delta:Wp(e.recommendations,t?.recommendations,n)}),className:"ins-stat-card",onClick:o?()=>o("recommendations"):void 0,ariaLabel:"Recommendations, see the breakdown offering by offering",actionLabel:o?"Breakdown":void 0}),s.jsx(fi,{label:"Offering clicks",value:e.clicks,note:s.jsx(Vp,{detail:rdt(e.clicks,e.recommendations),delta:Wp(e.clicks,t?.clicks,n)}),className:"ins-stat-card",onClick:o?()=>o("clicks"):void 0,ariaLabel:"Offering clicks, see the breakdown offering by offering",actionLabel:o?"Breakdown":void 0})]})}const Rdt={convMonth:24,people:9,anonPeople:4,voiceMonth:7,requestsMonth:6,profileVisitors:18,recommendations:8,clicks:4},Idt=[{label:"Conversations",n:24},{label:"Kept talking (5+ messages)",n:17},{label:"Asked to connect",n:6}],Pdt=[{t:"Sleep and waking early",n:11},{t:"Supplements",n:8},{t:"Travel and jet lag",n:5}];function ZH({expertMode:e=!1}){return s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(Wie,{funnel:Idt,convMonth:24,returning:3}),!e&&s.jsx(Vie,{topics:Pdt,hidden:[2,1],kmin:3})]})}function Ldt(){return s.jsxs("div",{className:"leads-insights","aria-busy":"true","aria-label":"Loading insights",children:[s.jsx(gt,{className:"mb-3 h-7 w-3/5"}),s.jsx(gt,{className:"mb-6 h-4 w-2/5"}),s.jsx("div",{className:"grid grid-cols-2 gap-3.5 lg:grid-cols-3",children:[0,1,2,3,4,5].map(e=>s.jsxs("div",{className:"ge-surface flex flex-col gap-2.5 px-[22px] py-5",children:[s.jsx(gt,{className:"h-3 w-24"}),s.jsx(gt,{className:"h-8 w-14"}),s.jsx(gt,{className:"h-3 w-28"})]},e))}),s.jsxs("div",{className:"ge-card mt-5 flex flex-col gap-3 px-[30px] py-[22px]",children:[s.jsx(gt,{className:"h-4 w-48"}),s.jsx(gt,{className:"h-2.5 w-full"}),s.jsx(gt,{className:"h-2.5 w-full"}),s.jsx(gt,{className:"h-2.5 w-full"})]})]})}function Odt({actions:e,onAction:t}){return e.length?s.jsxs("section",{className:"ins-next-panel ge-card mt-5 px-[26px] py-[22px]","aria-labelledby":"what-next-title",children:[s.jsx("h3",{id:"what-next-title",className:"font-heading text-base font-normal text-ink",children:"What to do next"}),s.jsx("div",{className:`ins-next-actions mt-4 ${e.length===1?"ins-next-actions-single":""}`,children:e.map(n=>s.jsxs("button",{type:"button",onClick:()=>t(n.id),className:`ins-next-action rounded-[14px] border border-rule bg-paper px-4 py-4 text-left transition-colors hover:border-indigo/30 hover:bg-indigo-wash focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo/40 ${e.length===1?"ins-next-action-single":""}`,children:[s.jsxs("span",{className:"ins-next-copy",children:[s.jsx("span",{className:"block text-sm font-semibold text-ink",children:n.title}),s.jsx("span",{className:"mt-1 block text-[12.5px] leading-[1.5] text-ink-muted",children:n.body})]}),s.jsx("span",{className:"ins-next-label mt-3 block text-xs font-semibold text-indigo",children:n.label})]},n.id))})]}):null}function Mdt({sources:e}){return e.length?s.jsx(jL,{children:s.jsxs("div",{id:"insight-sources",tabIndex:-1,
1592className:"ins-focus-target scroll-mt-6",children:[s.jsx("h3",{id:"sources-title",className:"font-heading text-base font-normal text-ink",children:"Where activity started"}),s.jsxs("table",{className:"ins-sources","aria-labelledby":"sources-title",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",children:"Source"}),s.jsx("th",{scope:"col",children:"Chats"}),s.jsx("th",{scope:"col",children:"Requests"})]})}),s.jsx("tbody",{children:e.map(t=>s.jsxs("tr",{className:t.muted?"ins-source-disabled":"",children:[s.jsxs("th",{scope:"row",children:[xL(t),t.source==="unknown"&&s.jsx("span",{className:"ins-source-note",children:"Recorded before source tracking, or the origin could not be verified."}),t.embedStatus&&s.jsx("span",{className:"ins-source-status",children:t.embedStatus})]}),s.jsx("td",{className:t.conversations===0?"ins-source-zero":"",children:t.conversations}),s.jsx("td",{className:t.requests===0?"ins-source-zero":"",children:t.requests})]},t.source))})]})]})}):null}function Ddt({experts:e,selectedExpertId:t,onSelect:n}){const[r,a]=f.useState(!1),i=f.useRef(null),o=f.useRef(null),l=f.useRef(null),c=e.find(h=>h.id===t);if(f.useEffect(()=>{if(!r)return;const h=m=>{i.current?.contains(m.target)||a(!1)},p=m=>{if(m.key==="Tab"){a(!1);return}m.key==="Escape"&&(a(!1),o.current?.focus())};return document.addEventListener("mousedown",h),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",p)}},[r]),f.useEffect(()=>{if(!r)return;const h=l.current?.querySelector('[aria-selected="true"]')||l.current?.querySelector('[role="option"]');h?.focus(),h?.scrollIntoView({block:"nearest"})},[r]),!e.length)return null;const u=h=>{n(h),a(!1),o.current?.focus()},d=h=>{if(h.key!=="ArrowDown"&&h.key!=="ArrowUp")return;h.preventDefault();const p=[...l.current?.querySelectorAll('[role="option"]')||[]],m=p.indexOf(document.activeElement),g=h.key==="ArrowDown"?p[Math.min(m+1,p.length-1)]:p[Math.max(m-1,0)];g?.focus(),g?.scrollIntoView({block:"nearest"})};return s.jsxs("div",{ref:i,className:"ins-expert-lens",children:[s.jsx("span",{className:"ins-expert-lens-label",children:"Expert view"}),s.jsxs("button",{ref:o,type:"button",className:"ins-expert-lens-trigger","aria-haspopup":"listbox","aria-expanded":r,onClick:()=>a(h=>!h),onKeyDown:h=>{(h.key==="ArrowDown"||h.key==="ArrowUp")&&(h.preventDefault(),a(!0))},children:[c?s.jsx("span",{"aria-hidden":"true",children:s.jsx(ws,{name:c.name||"Expert",size:"sm",variant:"expert",src:c.avatarUrl||c.avatar_url})}):s.jsx("span",{className:"ins-expert-overall-mark","aria-hidden":"true",children:s.jsx(Ci,{})}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:c?.name||"Overall"}),s.jsx(Is,{className:`h-4 w-4 flex-none transition-transform ${r?"rotate-180":""}`,"aria-hidden":"true"})]}),r&&s.jsxs("ul",{ref:l,role:"listbox","aria-label":"Expert view",onKeyDown:d,className:"ins-expert-lens-menu",children:[s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":!t,tabIndex:-1,className:`ins-expert-lens-option ${t?"":"is-selected"}`,onClick:()=>u(null),children:[s.jsx("span",{className:"ins-expert-overall-mark","aria-hidden":"true",children:s.jsx(Ci,{})}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:"Overall"}),!t&&s.jsx(ft,{className:"h-4 w-4 flex-none","aria-hidden":"true"})]})}),e.map(h=>{const p=t===h.id;return s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":p,tabIndex:-1,className:`ins-expert-lens-option ${p?"is-selected":""}`,onClick:()=>u(h.id),children:[s.jsx("span",{"aria-hidden":"true",children:s.jsx(ws,{name:h.name||"Expert",size:"sm",variant:"expert",src:h.avatarUrl||h.avatar_url})}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:h.name||"Expert"}),p&&s.jsx(ft,{className:"h-4 w-4 flex-none","aria-hidden":"true"})]})},h.id)})]})]})}function $dt({period:e,newRequests:t=0,onShowNewRequests:n,onShowRequests:r,onShowConversations:a}){const i=Ps(),[o,l]=f.useState(null),[c,u]=f.useState(null),[d,h]=f.useState(!0),[p,m]=f.useState(!1),[g,x]=f.useState(null),[b,y]=f.useState(!1),v=f.useRef(0),w=f.useRef(!1),j=f.useRef(null),E=f.useRef(void 0),S=f.useRef(new Map),_=f.useCallback(async()=>{y(!0);try{x(await cke())}catch{x({topics:[],hidden:[],gaps:[],topicsUnavailable:!0})}finally{y(!1)}},[]),k=f.useCallback(async(P,ee=j.current)=>{const X=++v.current;E.current=ee,h(!0),m(!1);const ae=`${P}|${ee??""}`,me=S.current.get(ae);me&&(l(me),j.current=ee,u(ee));try{const q=await lke(P,ee);if(X!==v.current)return;const he=Jut(q,P);S.current.set(ae,he),l(he),j.current=ee,E.current=void 0,u(ee),q.state!=="no_experts"&&!w.current&&(w.current=!0,_())}catch{X===v.current&&m(!0)}finally{X===v.current&&h(!1)}},[_]);if(f.useEffect(()=>{k(e,mC(E.current,j.current))},[k,e]),f.useEffect(()=>{const P=o?.availableExperts;if(!Array.isArray(P)||!c)return;const ee=But(P,c);ee!==c&&E.current===void 0&&k(e,ee)},[o?.availableExperts,k,e,c]),!o)return d?s.jsx(Ldt,{}):s.jsxs("div",{className:"ge-card px-[30px] py-10 text-center",children:[s.jsx("p",{className:"mb-4 text-sm text-ink-mid",children:"Could not load your insights."}),s.jsx(yt,{variant:"secondary",onClick:()=>k(e),children:"Try again"})]});if(o.state==="no_experts")return s.jsx("div",{className:"ge-card px-[30px] py-6",children:s.jsx(Bh,{icon:Ci,eyebrow:"Insights",title:"No experts yet",description:"Insights show what people ask your experts, fully anonymously. Create and share an expert to start seeing patterns here.",actionLabel:"Create your expert",onAction:()=>i(tl)})});const{stats:C,funnel:N,returning:A,week:T,hours:I,experts:$,kmin:O,previous:U,sources:F,topClicked:H,offeringPerformance:G,availableExperts:M,trackingSince:z}=o,W=!!c,D=b||g===null,Z=o.state==="too_early"&&C.convMonth===0&&C.requestsMonth===0,V=o.state==="too_early"&&!Z,L=Xut(z),K=(T||[]).map(P=>({key:P.d,n:P.n,axis:P.d,name:idt[P.d]||P.d})),te=cdt(I).map(P=>({key:P.h,n:P.n,axis:P.name,name:P.name})),Q=Qut({newRequests:t,gaps:g?.gaps||[],topClicked:H}),Y=P=>{if(P==="requests"){n?.();return}const ee=document.getElementById(`insight-${P}`);ee?.scrollIntoView({behavior:"auto",block:"center"}),ee?.focus({preventScroll:!0})},J=P=>{P!==mC(E.current,j.current)&&k(e,P)};return s.jsxs("div",{className:"leads-insights",children:[s.jsxs("header",{className:"mb-5 flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("h2",{className:"font-heading text-[clamp(22px,3vh,28px)] font-normal leading-[1.15] tracking-[-0.022em] text-ink",children:["Find out what your audience ",s.jsx("em",{className:"text-indigo",children:"actually wants"})]}),s.jsxs("p",{className:"mt-2.5 max-w-[720px] text-[13.5px] leading-[1.6] text-ink-mid",children:["Insights are ",s.jsx("span",{className:"text-ink",children:"fully anonymous"}),". They show what people need, not who they are."]})]}),zie(M)&&s.jsx(Ddt,{experts:M,selectedExpertId:c,onSelect:J})]}),W&&s.jsx("p",{className:"ins-expert-scope",role:"status",children:"This view includes activity attributable to this expert. Profile visitors, topics, gaps, and account-wide actions remain in Overall."}),p&&s.jsxs("p",{className:"mb-3 text-[13px] text-ink-mid",role:"status",children:["Could not refresh this window."," ",s.jsx("button",{type:"button",className:"ins-retry",onClick:()=>k(e,mC(E.current,j.current)),children:"Try again"})]}),s.jsx("div",{className:d?"ins-body ins-busy":"ins-body","aria-busy":d||void 0,children:Z?s.jsxs(R5,{ghost:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(QH,{stats:Rdt,previous:null,period:"all",expertMode:W}),s.jsx(ZH,{expertMode:W})]}),hook:s.jsxs(s.Fragment,{children:["Itâs quiet in here. ",s.jsx("em",{children:"Too quiet."})]}),children:["This is where your insights will live. Share your profile, and once at least ",O," different people have chatted with your experts the first patterns will show up here."]}):s.jsxs(s.Fragment,{children:[s.jsx(QH,{stats:C,previous:U,peri
1592od:e,expertMode:W,onShowConversations:a,onShowRequests:r,onJump:Y}),L&&s.jsx("p",{className:"ins-tracking-note",children:L}),!W&&s.jsx(Odt,{actions:Q,onAction:Y}),V?s.jsxs(R5,{ghost:s.jsx(ZH,{expertMode:W}),hook:"The patterns are still forming.",children:["We need a bit more data before we can show the deeper stats. They unlock once at least ",O," different people have had ",o.minConvos," or more conversations with your experts in the selected period."]}):s.jsxs(s.Fragment,{children:[s.jsx(Wie,{funnel:N,convMonth:C.convMonth,returning:A}),s.jsx(Sdt,{items:G,requested:W||g?.topicsUnavailable?null:g?.requested||[],requestedLoading:!W&&D}),!W&&s.jsx(Vie,{topics:g?.topics||[],hidden:g?.hidden||[],kmin:O,unavailable:g?.topicsUnavailable,loading:D}),s.jsxs("div",{className:"ins-two-up",children:[s.jsx(XH,{title:"Busiest days",items:K,total:C.convMonth}),s.jsx(XH,{title:"Busiest hours",items:te,total:C.convMonth,dimAxis:!0})]}),!W&&s.jsxs("div",{className:"ins-two-up",children:[s.jsx(wdt,{experts:$}),s.jsx("div",{id:"insight-gaps",tabIndex:-1,className:"ins-focus-target grid scroll-mt-6",children:s.jsx(jdt,{gaps:g?.gaps||[],unavailable:g?.topicsUnavailable,loading:D})})]}),s.jsx(Mdt,{sources:F})]})]})})]})}function L5({id:e,title:t,summary:n=null,badge:r=null,info:a=null,infoMode:i="panel",collapsible:o=!0,open:l=!0,onToggle:c,children:u}){const[d,h]=f.useState(!1),p=`leads-sect-${e}-body`,m=`leads-sect-${e}-info`,g=`leads-sect-${e}-title`,x=o?l:!0,b=s.jsxs(s.Fragment,{children:[o&&s.jsx(Is,{className:`chev ${x?"open":""}`,size:18,"aria-hidden":"true"}),s.jsx("span",{className:"sectt",id:g,children:t}),r&&s.jsx("span",{className:`sectbadge ${r.tone||""}`,children:r.label})]});return s.jsxs("section",{className:"panelcard sect","aria-labelledby":g,children:[s.jsxs("div",{className:"secthead",children:[o?s.jsx("button",{type:"button",className:"secttoggle","aria-expanded":x,"aria-controls":p,onClick:()=>c(e,!x),children:b}):s.jsx("h2",{className:"secttoggle secttoggle--static",children:b}),s.jsxs("div",{className:"sectacts",children:[a&&i==="tooltip"&&s.jsx(Ru,{label:`What is ${t}?`,tone:"light",width:340,children:a}),a&&i!=="tooltip"&&s.jsx("button",{type:"button",className:"sectic","aria-expanded":d,"aria-controls":m,"aria-label":`What is ${t}?`,title:`What is ${t}?`,onClick:()=>h(y=>!y),children:s.jsx(al,{size:16,"aria-hidden":"true"})})]})]}),n&&s.jsx("p",{className:"sectsum",children:n}),a&&i!=="tooltip"&&d&&s.jsx("div",{className:"sectinfo",id:m,children:a}),s.jsx("div",{id:p,className:"sectbody",hidden:!x,children:u})]})}function Fdt(e,t){const[n,r]=f.useState(()=>{try{return{...t,...JSON.parse(localStorage.getItem(e)||"{}")}}catch{return t}});return[n,(i,o)=>r(l=>{const c={...l,[i]:o};try{localStorage.setItem(e,JSON.stringify(c))}catch{}return c})]}const Bdt=[{value:"choice-full",label:"Let the visitor choose: full conversation, AI summary, or nothing"},{value:"choice",label:"Let the visitor choose: an AI summary or nothing"},{value:"none",label:"Neither, contact details only"}],Udt={advanced:!1},zdt="gx_leads_sections",fC=(e,t)=>JSON.stringify({...e,notifyExtra:t});function Hdt({settings:e,onSaved:t}){const{addToast:n}=f.useContext(Zs),r=e?.notifyEmail||"",[a,i]=f.useState(()=>({...ar(e?.config),enabled:e?.enabled??!0})),[o,l]=f.useState(()=>ar(e?.config).notifyExtra.join(", ")),[c,u]=f.useState(()=>fC(a,o)),[d,h]=f.useState(!1),[p,m]=f.useState(!1),[g,x]=f.useState(!1),[b,y]=Fdt(zdt,Udt),v=f.useRef(null);f.useEffect(()=>()=>clearTimeout(v.current),[]);const w=C=>i(N=>({...N,...C})),j=fC(a,o)!==c;async function E(C,N=o){const A=C.enabled,T=dI(C,N,A);h(!0);try{const I=await Xl({enabled:A,config:T}),$={...T,enabled:I.enabled,steps:{...T.steps},collect:{...T.collect}},O=T.notifyExtra.join(", ");return i($),l(O),u(fC($,O)),t?.(I),m(!0),clearTimeout(v.current),v.current=setTimeout(()=>m(!1),2500),!0}catch(I){return n(I.response?.data?.detail?.message||"Could not save. Please try again.","error"),!1}finally{h(!1)}}function S(){return E(a)}async function _(C){const N=a,A={...a,enabled:C};i(A),await E(A)?n(C?"Contact requests are on.":"Contact requests are off.","success"):i(N)}function k(){const{handover:C,desc:N,confirm:A,rtime:T,share:I,collect:$}=Gs;i(O=>({...O,handover:C,desc:N,confirm:A,rtime:T,share:I,collect:{...$},notifyExtra:[]})),l(""),x(!1)}return s.jsxs("div",{className:"lead-settings",children:[s.jsx(L5,{id:"status",title:"Status",collapsible:!1,summary:"On by default. Nothing to set up.",badge:a.enabled?{label:"Live",tone:"ok"}:{label:"Off"},info:s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["Every AI expert you have gets a ",s.jsx("b",{children:"Contact"})," button in its chat. Someone talking to your expert taps it, fills in a short form, and their details arrive in your inbox as a lead. That is
1592what this switch turns on, and it is the whole point of Contact Requests."]}),s.jsx("p",{children:"Your AI can only mention the services on your public page and the response time you set here. It never invents availability, pricing or outcomes."})]}),children:s.jsxs("div",{className:"setrow",children:[s.jsxs("div",{className:"sl",children:[s.jsx("div",{className:"t",children:"Accept contact requests"}),s.jsx("div",{className:"d",children:"Your public page shows a Contact form, and every AI expert you publish shows a Contact button in its chat."})]}),s.jsxs("label",{className:"toggle",children:[s.jsx("input",{type:"checkbox",checked:a.enabled,disabled:d,onChange:C=>_(C.target.checked),"aria-label":"Accept contact requests"}),s.jsx("span",{className:"tk"})]})]})}),s.jsxs(L5,{id:"advanced",title:"Advanced",summary:"Wording, form fields, privacy and where requests are sent. The defaults already work.",open:b.advanced,onToggle:y,children:[s.jsx("div",{className:"subt",children:"Contact button & messages"}),s.jsxs("div",{className:"field",children:[s.jsxs("label",{htmlFor:"leads-handover",children:["Button label, shown at the top of the chat",s.jsxs("span",{className:"charcnt",children:[a.handover.length," chars"]})]}),s.jsx("input",{id:"leads-handover",value:a.handover,onChange:C=>w({handover:C.target.value}),maxLength:60,placeholder:"Contact"})]}),s.jsxs("div",{className:"field",children:[s.jsxs("label",{htmlFor:"leads-desc",children:["Text inside the pop-up",s.jsxs("span",{className:"charcnt",children:[a.desc.length," chars"]})]}),s.jsx("textarea",{id:"leads-desc",rows:2,value:a.desc,onChange:C=>w({desc:C.target.value}),maxLength:500})]}),s.jsxs("div",{className:"field",children:[s.jsxs("label",{htmlFor:"leads-confirm",children:["What they see after sending",s.jsxs("span",{className:"charcnt",children:[a.confirm.length," chars"]})]}),s.jsx("textarea",{id:"leads-confirm",rows:2,value:a.confirm,onChange:C=>w({confirm:C.target.value}),maxLength:300})]}),s.jsxs("div",{className:"field",children:[s.jsxs("label",{htmlFor:"leads-rtime",children:["Expected response time",s.jsx("span",{className:"opt",children:"optional, only shown if you set it"})]}),s.jsx("input",{id:"leads-rtime",value:a.rtime,onChange:C=>w({rtime:C.target.value}),maxLength:200,placeholder:"e.g. Sarah usually responds within two business days."})]}),s.jsx("div",{className:"subt",children:"What the form asks for"}),s.jsxs("div",{className:"pillrow",children:[s.jsxs("label",{className:"ptog",children:[s.jsx("input",{type:"checkbox",checked:a.collect.phone,onChange:C=>w({collect:{...a.collect,phone:C.target.checked}})}),"Phone"]}),s.jsxs("label",{className:"ptog",children:[s.jsx("input",{type:"checkbox",checked:a.collect.message,onChange:C=>w({collect:{...a.collect,message:C.target.checked}})}),"Message"]})]}),s.jsx("div",{className:"fhint",children:"Email is always asked for."}),s.jsx("div",{className:"subt",id:"leads-share-label",children:"What visitors may share with you"}),s.jsxs("div",{className:"field",children:[s.jsx("select",{id:"leads-share","aria-labelledby":"leads-share-label",value:a.share,onChange:C=>w({share:C.target.value}),children:Bdt.map(C=>s.jsx("option",{value:C.value,children:C.label},C.value))}),s.jsx("div",{className:"fhint",children:"Always the visitor's choice, they can decline. Conversation content is never shared without their explicit opt-in; this setting only caps what they can offer."})]}),s.jsx("div",{className:"subt",children:"Where requests are sent"}),s.jsxs("div",{className:"field",children:[s.jsxs("label",{htmlFor:"leads-notify",children:["Your inbox",s.jsxs("span",{className:"lockpill",children:[s.jsx(Zi,{"aria-hidden":"true"}),"Locked"]})]}),s.jsxs("div",{className:"lockfield",children:[s.jsx("input",{id:"leads-notify",value:r,readOnly:!0,"aria-readonly":"true",title:"Set from your account email"}),s.jsx(Zi,{className:"lk","aria-hidden":"true"})]}),s.jsx("div",{className:"fhint",children:"Tied to your account email. Change it in Account settings."})]}),s.jsxs("div",{className:"field",children:[s.jsxs("label",{htmlFor:"leads-notify2",children:["Also send to",s.jsx("span",{className:"opt",children:"optional"})]}),s.jsx("input",{id:"leads-notify2",value:o,maxLength:2e3,onChange:C=>l(C.target.value),placeholder:"[email protected], assistant@â¦"}),s.jsx("div",{className:"fhint",children:"Every new request also goes to these addresses, for a studio inbox or an assistant."})]})]}),s.jsxs("div",{className:"savebar",children:[s.jsx(yt,{variant:"primary",isLoading:d,onClick:S,children:"Save changes"}),s.jsx("span",{className:"savestate",role:"status",children:j?s.jsx("span",{className:"unsaved",children:"Unsaved changes"}):p?s.jsx("span",{className:"justsaved",children:"â Saved"}):s.jsx("span",{className:"allsaved",children:"All changes saved"})}),g?s.jsxs("span",{className:"resetconf",children:["Put the wording, form fields and privacy options back to our defaults? Your public page is untouched, and nothing changes until you press Save.",s.jsx("button",{type:"button",className:"rc-yes",onClick:k,children:"Yes, reset"}),s.jsx("button",{type:"button",className:"rc-no",onClick:()=>x(!1),children:"Cancel"})]}):s.jsx(yt,{variant:"ghost",onClick:()=>x(!0),children:"Reset to defaults"})]})]})}const gC=[{id:"insights",label:"Insights"},{id:"requests",label:"Leads",short:"Leads"}];function Gie(e){return e?[gC[0],{id:"conversations",label:"Conversations",short:"Chats"},gC[1]]:gC}function qdt(e,t){return e==="settings"||Gie(t).some(n=>n.id===e)?e:"insights"}const im=Gie(Nx);[...im.map(e=>e.id)];const Wdt={"#profile-services":"services","#profile-content":"media"},Vdt={All:0};function Gdt(){const[e,t]=f.useState(()=>
1592{const O=new URLSearchParams(window.location.search).get("tab");return qdt(O,Nx)}),[n,r]=f.useState(null),[a,i]=f.useState(!1),o=f.useRef({}),[l,c]=f.useState(()=>new Set([e,"requests"])),u=Ps(),[d,h]=f.useState(Uie),[p,m]=f.useState("All"),[g,x]=f.useState({counts:Vdt,rows:[],allRows:[],loading:!0,error:!1,reload:null}),b=f.useCallback(O=>x(O),[]),[y,v]=f.useState({rows:[],scopeNote:""}),w=f.useCallback(O=>v(O),[]),[j,E]=f.useState(!1),S=g.counts.New||0;f.useEffect(()=>{const O=Wdt[window.location.hash];O&&u(t5e(O),{replace:!0})},[u]);const _=O=>{c(F=>new Set(F).add(O)),t(O);const U=new URL(window.location.href);O==="insights"?U.searchParams.delete("tab"):U.searchParams.set("tab",O),window.history.replaceState(null,"",`${U.pathname}${U.search}${U.hash}`)},k=f.useCallback(()=>$r().then(O=>{r(O),i(!1)}).catch(()=>i(!0)),[]);f.useEffect(()=>{let O=!1;return $r().then(U=>{O||(r(U),i(!1))}).catch(()=>{O||i(!0)}),()=>{O=!0}},[]);function C(O){if(O.key!=="ArrowLeft"&&O.key!=="ArrowRight")return;O.preventDefault();const U=im.findIndex(G=>G.id===e),H=im[((U===-1?0:U)+(O.key==="ArrowRight"?1:im.length-1))%im.length];_(H.id),o.current[H.id]?.focus()}const N=f.useMemo(()=>["All",...gL].map(O=>({label:O,count:g.counts[O]||0})),[g.counts]);function A(){if(!g.rows.length)return;const O=p==="All"?"all":p.toLowerCase().replace(/\s+/g,"-");P5(cut(g.rows),`contact-requests-${O}.csv`)}const T=e==="conversations",I=T?y.rows.length:g.rows.length,$=T?"conversation":"lead";return s.jsxs("div",{className:"leads-page",children:[s.jsxs("header",{className:"ge-surface mb-6 flex flex-wrap items-center gap-x-3 gap-y-3 px-4 py-3 sm:gap-x-5 sm:px-7",children:[s.jsxs("h1",{className:"min-w-0 whitespace-nowrap font-heading text-[clamp(20px,5.8vw,28px)] font-normal leading-[1.1] tracking-[-0.018em] text-ink",children:["Insights & ",s.jsx("em",{className:"italic text-indigo",children:"Leads"})]}),s.jsx("div",{className:"ml-auto flex items-center gap-2 sm:gap-2.5",children:s.jsxs("button",{type:"button",onClick:()=>T?E(!0):A(),disabled:!I,title:I?`Export ${I} ${$}${I===1?"":"s"}`:`No ${$}s to export yet`,className:"ge-surface-btn h-10 gap-2 px-3.5 text-[13px] disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-rule disabled:hover:bg-transparent disabled:hover:text-ink-soft",children:[s.jsx(Eh,{className:"w-4 h-4","aria-hidden":"true"}),s.jsx("span",{className:"hidden sm:inline",children:T?"Export chats":"Export CSV"}),s.jsx("span",{className:"sm:hidden",children:T?"Export":"CSV"})]})})]}),s.jsxs("div",{className:"leads-controls",children:[s.jsx("div",{className:"leads-pillbar",role:"tablist","aria-label":"Leads views",onKeyDown:C,children:im.map(O=>s.jsxs("button",{ref:U=>{o.current[O.id]=U},type:"button",role:"tab",id:`leads-tab-${O.id}`,"aria-selected":e===O.id,"aria-controls":`leads-panel-${O.id}`,tabIndex:e===O.id?0:-1,className:`leads-tab${e===O.id?" is-on":""}`,onClick:()=>_(O.id),children:[s.jsx("span",{className:"lbl-full",children:O.label}),s.jsx("span",{className:"lbl-short",children:O.short||O.label}),O.id==="requests"&&S>0&&s.jsx("span",{className:"leads-tabcount",children:S})]},O.id))}),e==="insights"&&s.jsx("div",{className:"leads-pillbar is-filter",role:"group","aria-label":"Period",children:Fut.map(O=>s.jsx("button",{type:"button",className:`leads-pill${d===O.v?" is-on":""}`,"aria-pressed":d===O.v,onClick:()=>h(O.v),children:O.btn},O.v))}),e==="requests"&&n&&s.jsx("div",{className:"leads-pillbar is-filter",role:"group","aria-label":"Filter by status",children:N.map(O=>s.jsxs("button",{type:"button",className:`leads-pill${p===O.label?" is-on":""}`,"aria-pressed":p===O.label,onClick:()=>m(O.label),children:[O.label," ",s.jsx("span",{className:"leads-pillcount",children:O.count})]},O.label))})]}),s.jsx("div",{role:"tabpanel",id:"leads-panel-insights","aria-labelledby":"leads-tab-insights",hidden:e!=="insights",children:l.has("insights")&&s.jsx($dt,{period:d,newRequests:S,onShowNewRequests:()=>{m("New"),_("requests"),requestAnimationFrame(()=>o.current.requests?.focus())},onShowRequests:()=>{m("All"),_("requests"),requestAnimationFrame(()=>
1592o.current.requests?.focus())},onShowConversations:Nx?()=>{_("conversations"),requestAnimationFrame(()=>o.current.conversations?.focus())}:void 0})}),Nx&&s.jsx("div",{role:"tabpanel",id:"leads-panel-conversations","aria-labelledby":"leads-tab-conversations",hidden:e!=="conversations",children:l.has("conversations")&&s.jsx(_ut,{onExportableChange:w})}),s.jsx("div",{role:"tabpanel",id:"leads-panel-requests","aria-labelledby":"leads-tab-requests",hidden:e!=="requests",children:n&&l.has("requests")?s.jsx(fut,{active:e==="requests",settings:n,statusFilter:p,onGoToSettings:()=>_("settings"),onRequestsChange:b}):a?s.jsx(tq,{onRetry:k}):s.jsx(eq,{})}),j&&s.jsx($ut,{onClose:()=>E(!1),rows:y.rows,scopeNote:y.scopeNote}),s.jsx("div",{role:"tabpanel",id:"leads-panel-settings","aria-label":"Lead settings",hidden:e!=="settings",children:n&&l.has("settings")?s.jsx(Hdt,{settings:n,onSaved:r}):a?s.jsx(tq,{onRetry:k}):s.jsx(eq,{})})]})}function eq(){return s.jsxs("div",{className:"space-y-4","aria-busy":"true","aria-label":"Loading",children:[s.jsx(gt,{className:"h-5 w-2/3"}),s.jsx(gt,{className:"h-40 w-full"}),s.jsx(gt,{className:"h-64 w-full"})]})}function tq({onRetry:e}){return s.jsxs("div",{className:"panelcard text-center py-10",children:[s.jsx("p",{className:"text-sm text-ink-mid mb-4",children:"Could not load your leads setup."}),s.jsx(yt,{variant:"secondary",onClick:e,children:"Try again"})]})}const Ydt=[{mode:"shorten",label:"Shorten"},{mode:"expand",label:"Expand"},{mode:"friendlier",label:"Friendlier"},{mode:"grammar",label:"Fix grammar"}];function Kdt({attempt:e,visitor:t,creatorName:n,quickReplies:r,draft:a,onDraft:i,onSend:o,onTyping:l,composerError:c,onComposerError:u}){const{addToast:d}=f.useContext(Zs),[h,p]=f.useState(null),[m,g]=f.useState(null),[x,b]=f.useState(!1),[y,v]=f.useState(!1),[w,j]=f.useState(null),[E,S]=f.useState(0),_=f.useRef(null),k=f.useRef(null),C=f.useRef(null),N=f.useRef(!0);f.useEffect(()=>()=>{N.current=!1},[]);const A=`lc-composer-${e.id}`,T=`${A}-replies`,I=!!a.trim(),$=Xje(a),O=y||$!==null&&r.length>0&&w!==a,U=O?Jje(r,$??""):[],F=Math.min(E,Math.max(U.length-1,0));f.useEffect(()=>{x&&C.current?.querySelector("button")?.focus()},[x]),f.useEffect(()=>{if(!x&&!O)return;const L=K=>{k.current?.contains(K.target)||(b(!1),v(!1))};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[x,O]);function H(L){i(L),u(null),l(!!L.trim())}function G(){v(!1),j(a)}function M(L){const K=Kje(L.text,{visitorLabel:t,creatorName:n,expertName:e.expertName}),te=$!==null?K:a.trim()?`${a.replace(/\s+$/,"")} ${K}`:K;v(!1),j(null),g(null),H(te),requestAnimationFrame(()=>_.current?.focus())}async function z(L){if(h)return;const K=a;b(!1),p(L),u(null);try{const te=await Pje(e.id,L,L==="draft"?"":K);if(!N.current)return;const Q=(te?.text||"").trim();if(!Q){d("Your AI had nothing to suggest this time.","info");return}g(K),i(Q),requestAnimationFrame(()=>_.current?.focus())}catch(te){if(!N.current)return;te?.response?.status===429?u("Too many AI drafts, try again in a minute."):d(ih(te,"Your AI could not help with that just now. Please try again."),"error")}finally{N.current&&p(null)}}function W(){h||(l(!1),g(null),o())}function D(L){if(O&&L.key==="Escape"){L.preventDefault(),L.stopPropagation(),G();return}if(O&&U.length){if(L.key==="ArrowDown"||L.key==="ArrowUp"){L.preventDefault();const K=L.key==="ArrowDown"?1:U.length-1;S((F+K)%U.length);return}if(L.key==="Enter"&&!L.shiftKey){if(L.nativeEvent.isComposing)return;L.preventDefault(),M(U[F]);return}}L.key==="Enter"&&!L.shiftKey&&!L.nativeEvent.isComposing&&(L.preventDefault(),W())}const Z=[...a].length,V=I&&!h;return s.jsxs("div",{className:"lc-composer",children:[s.jsxs("div",{className:`lc-box${h?" is-assisting":""}`,children:[s.jsx("textarea",{ref:_,rows:1,className:"lc-input",id:A,value:a,readOnly:!!h,"aria-busy":!!h,placeholder:`Write to ${t.split(" ")[0]}, or type / for saved replies`,"aria-label":`Reply to ${t}`,"aria-describedby":`${A}-help${c?` ${A}-error`:""}`,"aria-invalid":!!c,"aria-controls":O?T:void 0,"aria-activedescendant":O&&U.length?`${T}-${F}`:void 0,onChange:L=>{H(L.target.value),g(null),S(0)},onBlur:()=>l(!1),onKeyDown:D}),h&&s.jsxs("div",{className:"lc-ai-chip","aria-hidden":"true",children:[s.jsx(Ms,{}
1592),s.jsx("span",{children:h==="draft"?"Drafting in your voice":"Rewriting in your voice"}),s.jsx("span",{className:"lc-ai-bar",children:s.jsx("span",{})})]}),s.jsxs("div",{className:"lc-box-bar",children:[s.jsxs("div",{className:"lc-tools",ref:k,children:[s.jsxs("button",{type:"button",className:"lc-tool is-primary",onClick:()=>z("draft"),disabled:!!h,"aria-describedby":`${A}-ai-note`,children:[h==="draft"?s.jsx(vt,{className:"lc-spin","aria-hidden":"true"}):s.jsx(Ms,{"aria-hidden":"true"}),s.jsx("span",{className:"lc-tool-label",children:h==="draft"?"Drafting":"Draft with my AI"})]}),s.jsxs("div",{className:"lc-tool-wrap",children:[s.jsxs("button",{type:"button",className:"lc-tool","aria-haspopup":"menu","aria-expanded":x,"aria-controls":`${A}-rewrite`,disabled:!I||!!h,onClick:()=>{b(L=>!L),v(!1)},children:[h&&h!=="draft"?s.jsx(vt,{className:"lc-spin","aria-hidden":"true"}):s.jsx(eje,{"aria-hidden":"true"}),s.jsx("span",{className:"lc-tool-label",children:h&&h!=="draft"?"Rewriting":"Rewrite"}),s.jsx(Is,{className:"lc-tool-chev","aria-hidden":"true"})]}),x&&s.jsx("div",{id:`${A}-rewrite`,className:"lc-pop lc-rewrite",role:"menu","aria-label":"Rewrite your reply",ref:C,onKeyDown:L=>{if(L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),b(!1),_.current?.focus()),L.key==="ArrowDown"||L.key==="ArrowUp"){L.preventDefault();const K=[...L.currentTarget.querySelectorAll("button")],te=K.indexOf(document.activeElement),Q=L.key==="ArrowDown"?1:K.length-1;K[(te+Q)%K.length]?.focus()}},children:Ydt.map(L=>s.jsx("button",{type:"button",role:"menuitem",className:"lc-pop-item",onClick:()=>z(L.mode),children:L.label},L.mode))})]}),s.jsxs("button",{type:"button",className:"lc-tool","aria-expanded":O,"aria-controls":T,onClick:()=>{b(!1),O?G():(v(!0),S(0)),_.current?.focus()},children:[s.jsx(P0e,{"aria-hidden":"true"}),s.jsx("span",{className:"lc-tool-label",children:"Saved replies"})]}),m!==null&&!h&&s.jsxs("button",{type:"button",className:"lc-tool is-quiet",onClick:()=>{i(m),g(null),_.current?.focus()},children:[s.jsx(Mwe,{"aria-hidden":"true"}),"Undo"]}),O&&s.jsx("div",{className:"lc-pop lc-picker",children:U.length?s.jsx("ul",{id:T,role:"listbox","aria-label":"Saved replies",children:U.map((L,K)=>s.jsxs("li",{id:`${T}-${K}`,role:"option","aria-selected":K===F,className:`lc-pop-item${K===F?" is-active":""}`,onMouseDown:te=>{te.preventDefault(),M(L)},onMouseEnter:()=>S(K),children:[s.jsx("strong",{children:L.title}),s.jsx("span",{children:L.text})]},L.id||L.title))}):s.jsx("p",{id:T,className:"lc-pop-empty",children:r.length?"No saved reply has that title.":"No saved replies yet. Add them in Live chat, under Settings."})})]}),s.jsxs("button",{type:"button",className:"lc-send",onClick:W,disabled:!V,"aria-label":"Send message",children:[s.jsx("span",{children:"Send"}),s.jsx(rl,{"aria-hidden":"true"})]})]})]}),s.jsxs("p",{id:`${A}-help`,className:"lc-composer-help",children:[Z>7500?`${Z.toLocaleString()} / 8,000 characters`:"Enter sends, Shift plus Enter makes a new line.",s.jsxs("span",{id:`${A}-ai-note`,className:"lc-composer-ai",children:[" ","AI drafts land here for you to edit. Nothing is sent until you send it."]})]}),c&&s.jsx("p",{id:`${A}-error`,className:"lc-composer-error",role:"alert",children:c})]})}const Xdt={profile:"Your profile page",embed:"Chat embedded on a website"},Jdt={up:"Rated the chat helpful",down:"Rated the chat not helpful"},Qdt=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleString([],{dateStyle:"medium",timeStyle:"short"})};function Zdt({attempt:e,isOpen:t,onClose:n}){const[r,a]=f.useState({id:null,data:null,error:!1}),i=e?.id;f.useEffect(()=>{if(!t||!i)return;let g=!1;return Aje(i).then(x=>{g||a({id:i,data:x||{},error:!1})}).catch(()=>{g||a({id:i,data:null,error:!0})}),()=>{g=!0}},[t,i]);const o=r.id===i?r:{data:null,error:!1},l=o.data,c=l?.visitorLabel||e?.visitorLabel||"Visitor",u=l?.pageUrl||e?.pageUrl||null,d=l?.source||e?.source,h=Qdt(l?.conversationStartedAt),p=l?!!l.shareTranscript:!!e?.shareTranscript,m=l?.expertName||e?.expertName;return s.jsx(en,{isOpen:t,onClose:n,title:`About ${c}`,maxWidth:"max-w-md",backdropZ:"z-[100]",contentZ:"z-[110]",children:s.jsxs("div",{className:"lc-ctx",children:[s.jsxs("div",{className:"lc-ctx-person",children:[s.jsx(ws,{name:c,size:"lg"}),s.jsxs("div",{children:[s.jsx("strong",{children:c}),l&&s.jsx("span",{children:l.signedIn?"Signed-in visitor":"Anonymous visitor"})]})]}),o.error?s.jsx("p",{className:"lc-ctx-note",children:"Couldnât load the details for this conversation."}):l?s.jsxs("dl",{className:"lc-ctx-facts",children:[m&&s.jsxs("div",{children:[s.jsx("dt",{children:"AI expert"}),s.jsx("dd",{children:m})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Email"}),s.jsx("dd",{children:l.email?s.jsx("a",{href:`mailto:${encodeURIComponent(l.email)}`,children:l.email}):s.jsx("span",{className:"lc-ctx-empty",children:"Not shared"})})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Phone"}),s.jsx("dd",{children:l.phone?s.jsx("a",{href:`tel:${l.phone.replace(/[^\d+]/g,"")}`,children:l.phone}):s.jsx("span",{className:"lc-ctx-empty",children:"Not shared"})})]}),d&&s.jsxs("div",{children:[s.jsx("dt",{children:"Came from"}),s.jsx("dd",{children:Xdt[d]||d})]}),u&&s.jsxs("div",{children:[s.jsx("dt",{children:"Page"}),s.jsx("dd",{className:"lc-ctx-url",children:Zje(u)?s.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer nofollow",children:[u,s.jsx(Ro,{"aria-hidden":"true"}),s.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}):u})]}),l.browser&&s.jsxs("div",{children:[s.jsx("dt",{children:"Browser"}),s.jsx("dd",{children:l.browser})]}),h&&s.jsxs("div",{children:[s.jsx("dt",{children:"Conversation started"}),s.jsx("dd",{children:h})]}),typeof l.aiMessageCount=="number"&&s.jsxs("div",{children:[s.jsx("dt",{children:"Messages with your AI"}
1592),s.jsx("dd",{children:l.aiMessageCount.toLocaleString()})]}),typeof l.previousLiveChats=="number"&&s.jsxs("div",{children:[s.jsx("dt",{children:"Earlier live chats with you"}),s.jsx("dd",{children:l.previousLiveChats===0?"None, this is the first":l.previousLiveChats.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Earlier AI chat"}),s.jsx("dd",{children:p?"Shared with you":"Not shared"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Satisfaction"}),s.jsx("dd",{children:Jdt[l.rating]||"Not rated yet"})]})]}):s.jsxs("div",{className:"lc-ctx-loading","aria-label":"Loading details",children:[s.jsx(gt,{className:"h-4 w-3/5"}),s.jsx(gt,{className:"h-4 w-2/5"}),s.jsx(gt,{className:"h-4 w-1/2"})]}),e?.approvedSummary&&s.jsxs("div",{className:"lc-ctx-summary",children:[s.jsx("span",{children:"Summary of the AI chat"}),s.jsx("p",{children:e.approvedSummary})]})]})})}const sq="ge.leads.liveChatSeen",eht=[{value:"waiting",label:"Waiting"},{value:"human",label:"Active"},{value:"resolved",label:"Resolved"}],nq=6,xC="(min-width: 961px)",bC={attempts:[],counts:{waiting:0,human:0},capacity:3,activeCount:0,available:!1};function U1(e){return e?e.state==="human"?"Active conversation":e.state==="waiting"?"Waiting for you":e.terminalReason==="declined"?"Request declined":e.terminalReason==="expired"?"Request expired":e.terminalReason==="cancelled"?"Ended by visitor":e.terminalReason==="idle"?"Ended, no messages for a while":"Conversation resolved":""}function tht(e,t,n){return e.role==="creator"?"You":e.role==="assistant"?n||"AI expert":`${t} · Visitor`}const sht=e=>e.reduce((t,n)=>n.role==="user"&&typeof n.revision=="number"&&n.revision>t?n.revision:t,0),nht=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};function rht({id:e}){return s.jsxs("div",{className:"lc-heading",children:[s.jsx("h1",{id:e,className:"lc-title",children:"Live chat"}),s.jsx("p",{className:"lc-lede",children:"Visitors can ask to speak with you instead of your AI. You write as yourself, never billed as AI usage."})]})}const rq="ge.liveChat.alertsNudgeDismissed";function aht(){const{addToast:e}=f.useContext(Zs),[t,n]=f.useState(()=>{if(typeof Notification>"u"||Notification.permission==="granted"&&V4())return!0;try{return localStorage.getItem(rq)==="1"}catch{return!1}});if(t)return null;const r=Notification.permission==="denied",a=()=>{try{localStorage.setItem(rq,"1")}catch{}n(!0)},i=async()=>{try{const o=await Notification.requestPermission()==="granted";eA(o),o?(n(!0),e("Desktop alerts are on for this browser.","success")):e("Your browser blocked notifications. Allow them in its site settings to turn this on.","error")}catch{e("This browser could not turn on desktop alerts.","error")}};return s.jsxs("div",{className:"lc-nudge",role:"note",children:[s.jsx(T0e,{size:15,strokeWidth:1.8,"aria-hidden":"true"}),s.jsx("p",{children:r?"Notifications are blocked for this site, so chats that arrive while this tab is in the background only make a sound. Allow them in your browserâs site settings.":"Get a desktop alert for new chats and messages, even when this tab is in the background."}),!r&&s.jsx("button",{type:"button",className:"lc-nudge-on",onClick:i,children:"Turn on"}),s.jsx("button",{type:"button",className:"lc-nudge-x",onClick:a,"aria-label":"Dismiss",children:s.jsx(as,{size:14,"aria-hidden":"true"})})]})}function Yie({label:e,rows:t}){return s.jsx("div",{className:"lc-thread-loading",role:"status","aria-label":e,children:t.map((n,r)=>n==="out"?s.jsx("div",{className:"lc-skel-row is-own",children:s.jsx(gt,{className:"h-9 w-40 rounded-2xl rounded-br-md"})},r):s.jsxs("div",{className:"lc-skel-row",children:[s.jsx(gt,{className:"h-7 w-7 shrink-0 rounded-full"}),s.jsxs("div",{className:"lc-skel-copy",children:[s.jsx(gt,{className:"h-2.5 w-16 rounded-full"}),s.jsx(gt,{className:`h-9 rounded-2xl rounded-bl-md ${r%2?"w-44":"w-60"}`})]})]},r))})}function Kie({message:e,visitor:t,expertName:n,pending:r=!1,seen:a=!1}){const i=e.role==="creator";return s.jsxs("div",{className:`lc-message${i?" is-own":""}${r?" is-pending":""}`,children:[!i&&s.jsx(ws,{name:e.role==="assistant"?n||"AI expert":t,variant:e.role==="assistant"?"expert":"square",size:"sm"}),s.jsxs("div",{className:"lc-message-body",children:[s.jsxs("span",{className:"lc-message-meta",children:[s.jsx("strong",{children:tht(e,t,n)}),s.jsx("span",{children:r?"Sending":nht(e.createdAt)})]}),s.jsx("p",{className:"lc-message-text",children:e.content}),a&&s.jsx("span",{className:"lc-seen",children:"Seen"})]})]})}const iht={waiting:{title:"No one is waiting",description:"A request appears here the moment a visitor asks to talk to you."},human:{title:"No active conversations",description:"Accept a waiting request and it moves here."},resolved:{title:"Nothing resolved yet",description:"Conversations you finish, decline or that expire are kept here."}};function Xie({rating:e,withLabel:t=!1}){if(e!=="up"&&e!=="down")return null;const n=e==="up"?eo:wc,r=e==="up"?"Visitor rated this chat good":"Visitor rated this chat not good";return s.jsxs("span",{className:`lc-rating is-${e}`,title:r,children:[s.jsx(n,{"aria-hidden":"true"}),t?s.jsx("span",{children:e==="up"?"Rated good":"Rated not good"}):s.jsx("span",{className:"sr-only",children:r})]})}function oht({active:e=!0,onLiveChatChange:t,toolbar:n=null}){const{user:r}=Ut(),a=r?.id||null,{addToast:i}=f.useContext(Zs),[o,l]=f.useState("waiting"),[c,u]=f.useState(()=>Bl(a,"inbox:waiting")||bC),[d,h]=f.useState(()=>!Bl(a,"inbox:waiting")),[p,m]=f.useState(!1),[g,x]=f.useState(null),[b,y]=f.useState(!1),[v,w]=f.useState(()=>Bl(a,"threads")||{}),[j,E]=f.useState(null),[S,_]=f.useState({}),[k,C]=f.useState(null),[N,A]=f.useState(()=>i0(sq)),[T,I]=f.useState(!1),[$,O]=f.useState(!1),[U,F]=f.useState(null),[H,G]=f.useState(()=>Bl(a,"transcripts")||{}),[M,z]=f.useState(()=>Bl(a,"settings")?.quickReplies||[]),[W,D]=f.useState(!1),[Z,V]=f.useState(()=>typeof document>"u"||!document.hidden),[L,K]=f.useState(()=>window.matchMedia(xC).matches),te=f.useRef({}),Q=f.useRef(o);Q.current=o;const Y=f.useRef(v);Y.current=v;const J=f.useRef(null),P=f.useRef(!0),ee=f.useMemo(()=>{const ve=[...c.attempts||[]];return o==="waiting"&&ve.sort((Ye,rt)=>new Date(Ye.requestedAt||0)-new Date(rt.requestedAt||0)),ve}
1592,[c.attempts,o]),X=ee.find(ve=>ve.id===g)||ee[0]||null,ae=f.useRef(X);ae.current=X;const me=X?v[X.id]:null,q=me?.messages||[],he=X?.visitorLabel||"Visitor",se=(c.activeCount||0)>=(c.capacity||1),le=X?.shareTranscript?H[X.id]:null,ke=Math.max(X?.visitorReadRevision||0,me?.attempt?.visitorReadRevision||0),oe=sht(q),Oe=!!X&&e&&Z&&(L||b),Je=Oe?X.id:null;f.useEffect(()=>(tA.id=Je,()=>{tA.id=null}),[Je]);const Ie=f.useCallback(async({quiet:ve=!1,join:Ye=!1}={})=>{const rt=Q.current;ve||h(!0);try{const De=await oh(a,`inbox:${rt}`,()=>YT({state:rt}),{join:Ye});if(Q.current!==rt)return;u({...bC,...De,attempts:De?.attempts||[]}),m(!1)}catch{!ve&&Q.current===rt&&m(!0)}finally{!ve&&Q.current===rt&&h(!1)}},[a]),ue=f.useRef({}),be=f.useCallback(async(ve,{reset:Ye=!1}={})=>{if(ve)try{await oh(a,`thread:${ve}${Ye?":reset":""}`,async()=>{const rt=Ye?0:ue.current[ve]??Y.current[ve]?.throughRevision??0,De=[];let qe=null,ye=rt;for(let jt=0;jt<20;jt+=1){qe=await Nje(ve,ye);const Nt=qe?.messages||[];if(De.push(...Nt),Nt.length<OY)break;ye=qe?.throughRevision??Mw(Nt,ye)}const Ze=qe?.throughRevision??Mw(De,rt);ue.current[ve]=Math.max(Ye?0:ue.current[ve]||0,Ze),w(jt=>{const Nt=Ye?[]:jt[ve]?.messages||[];return{...jt,[ve]:{messages:QT(Nt,De),throughRevision:Ze,attempt:qe?.attempt??jt[ve]?.attempt??null}}})}),E(rt=>rt===ve?null:rt)}catch{E(ve)}},[a]),Re=f.useCallback(async ve=>{G(Ye=>({...Ye,[ve]:{status:"loading",messages:[]}}));try{const Ye=await Rje(ve);G(rt=>({...rt,[ve]:{status:"ready",messages:Ye?.messages||[]}}))}catch(Ye){const rt=IY(Ye)==="LIVE_CHAT_TRANSCRIPT_NOT_SHARED"?"hidden":"error";G(De=>({...De,[ve]:{status:rt,messages:[]}}))}},[]);f.useEffect(()=>{const ve=Bl(a,`inbox:${o}`);ve&&(u({...bC,...ve,attempts:ve.attempts||[]}),h(!1),m(!1)),Ie({quiet:!!ve,join:!0})},[o,Ie,a]),f.useEffect(()=>{sA(a,"threads",v)},[a,v]),f.useEffect(()=>{sA(a,"transcripts",Object.fromEntries(Object.entries(H).filter(([,ve])=>ve.status==="ready"||ve.status==="hidden")))},[a,H]),f.useEffect(()=>{X?.id&&X.shareTranscript&&!H[X.id]&&Re(X.id)},[X?.id,X?.shareTranscript,H,Re]),f.useEffect(()=>{if(!e)return;let ve=!1;return oh(a,"settings",P_,{join:!0}).then(Ye=>{ve||z(Array.isArray(Ye?.quickReplies)?Ye.quickReplies:[])}).catch(()=>{}),()=>{ve=!0}},[e,a]),f.useEffect(()=>{const ve=()=>V(!document.hidden),Ye=window.matchMedia(xC),rt=De=>K(De.matches);return document.addEventListener("visibilitychange",ve),Ye.addEventListener("change",rt),()=>{document.removeEventListener("visibilitychange",ve),Ye.removeEventListener("change",rt)}},[]);const Ge=X?.id,it=X?.creatorReadRevision||0;f.useEffect(()=>{if(!Oe||!Ge||!oe||oe<=Math.max(te.current[Ge]||0,it))return;const ve=Ge,Ye=oe,rt=setTimeout(()=>{te.current[ve]=Ye,Ije(ve,Ye).then(()=>u(De=>({...De,attempts:De.attempts.map(qe=>qe.id===ve?{...qe,unreadCount:0,creatorReadRevision:Math.max(qe.creatorReadRevision||0,Ye)}:qe)}))).catch(()=>{delete te.current[ve]})},1e3);return()=>clearTimeout(rt)},[Oe,Ge,oe,it]);const ut=f.useRef(new Set);f.useEffect(()=>{const ve=X?.id;!ve||j===ve||(v[ve]?ut.current.has(ve)||(ut.current.add(ve),be(ve)):(ut.current.add(ve),be(ve,{reset:!0})))},[X?.id,v,j,be]),f.useEffect(()=>{t?.({waiting:c.counts?.waiting||0})},[c.counts?.waiting,t]);const $t=f.useRef(new Set);Ow(r?.id?`live-chat:creator:${r.id}`:null,{onSignal:ve=>{if(ve?.event==="read"){ve.actor==="visitor"&&typeof ve.readRevision=="number"&&u(De=>({...De,attempts:De.attempts.map(qe=>qe.id===ve.attemptId?{...qe,visitorReadRevision:Math.max(qe.visitorReadRevision||0,ve.readRevision)}:qe)}));return}Ie({quiet:!0});const Ye=ae.current,rt=ve?.event==="message"&&$t.current.has(ve.revision);Ye&&ve?.conversationId===Ye.conversationId&&!rt&&be(Ye.id)},onReconcile:()=>{Ie({quiet:!0});const ve=ae.current;ve&&be(ve.id)}});const tt=X&&(X.state==="waiting"||X.state==="human")?`live-chat:conv:${X.conversationId}`:null,{peerTyping:He,sendTyping:wt}=Ow(tt,{typingSide:"creator",enabled:!!tt,onSendTyping:ve=>ae.current?.state==="human"?Mje(ae.current.id,ve):void 0});f.useEffect(()=>{P.current=!0,J.current&&(J.current.scrollTop=J.current.scrollHeight)},[X?.id,b]),f.useEffect(()=>{J.current&&P.current&&(J.current.scrollTop=J.current.scrollHeight)},[q.length,He,le?.status]);
1592function St(ve){x(ve.id),A(yL(sq,ve.id)),C(null),F(null),D(!1),window.matchMedia(xC).matches||y(!0)}function Zt(ve){l(ve),x(null),F(null),C(null)}async function Jt(ve){const Ye=ae.current;if(!Ye||T)return;const rt=c,De=ve==="accept"?{state:"human",terminalReason:null}:{state:"resolved",terminalReason:ve==="decline"?"declined":"resolved"};I(!0),F(null),u(qe=>({...qe,attempts:qe.attempts.map(ye=>ye.id===Ye.id?{...ye,...De}:ye)}));try{const qe={accept:Eje,decline:Sje,resolve:Cje}[ve];await qe(Ye.id),x(Ye.id),l(ve==="accept"?"human":"resolved"),ve==="accept"&&be(Ye.id,{reset:!0})}catch(qe){u(rt),i(ih(qe,"Could not update that conversation. Please try again."),"error")}finally{I(!1)}}async function $e(){const ve=ae.current;if(!ve)return;const Ye=S[ve.id]||"",rt=W4(Ye);if(rt){C(rt);return}const De=crypto.randomUUID(),qe={id:De,role:"creator",content:Ye,createdAt:new Date().toISOString(),_pending:!0};w(ye=>({...ye,[ve.id]:{...ye[ve.id],messages:[...ye[ve.id]?.messages||[],qe],throughRevision:ye[ve.id]?.throughRevision??0}})),_(ye=>({...ye,[ve.id]:""})),C(null);try{const ye=await Tje(ve.id,De,Ye);typeof ye?.message?.revision=="number"&&$t.current.add(ye.message.revision),w(Ze=>{const jt=Ze[ve.id];return jt?{...Ze,[ve.id]:{...jt,messages:QT(jt.messages,[{clientMessageId:De,...ye.message}])}}:Ze})}catch(ye){w(Ze=>{const jt=Ze[ve.id];return jt?{...Ze,[ve.id]:{...jt,messages:jt.messages.filter(Nt=>Nt.id!==De)}}:Ze}),_(Ze=>({...Ze,[ve.id]:Ze[ve.id]||Ye})),i(ih(ye,"Could not send that message. Please try again."),"error")}}async function Qe(ve,Ye){const rt={available:c.available,capacity:c.capacity};u(De=>({...De,...ve})),O(!0);try{const De=await H4(ve);u(qe=>({...qe,available:De?.available??qe.available,outsideHours:De?.outsideHours??qe.outsideHours,capacity:De?.capacity??qe.capacity,activeCount:De?.activeCount??qe.activeCount})),Ye&&i(Ye,"success")}catch(De){u(qe=>({...qe,...rt})),i(ih(De,"Could not save that. Please try again."),"error")}finally{O(!1)}}const ct=s.jsx(lht,{attempt:X,inboxEmpty:ee.length===0,messages:q,visitor:he,transcript:le,onRetryTranscript:()=>X&&Re(X.id),visitorReadRevision:ke,peerTyping:He,onOpenContext:()=>D(!0),composer:X?.state==="human"?s.jsx(Kdt,{attempt:X,visitor:he,creatorName:ZT(r?.full_name),quickReplies:M,draft:S[X.id]||"",onDraft:ve=>_(Ye=>({...Ye,[X.id]:ve})),onSend:$e,onTyping:wt,composerError:k,onComposerError:C},X.id):null,loading:!!X&&!me&&j!==X?.id,error:j===X?.id,onRetry:()=>X&&be(X.id,{reset:!0}),busy:T,atCapacity:se,confirming:U,onConfirm:F,onAction:Jt,bodyRef:J,onBodyScroll:ve=>{const Ye=ve.currentTarget;P.current=Ye.scrollHeight-Ye.scrollTop-Ye.clientHeight<80},onClose:()=>y(!1)});return p?s.jsxs("div",{className:"live-inbox",children:[s.jsx("header",{className:"lc-intro",children:n}),s.jsx(Bh,{icon:xr,title:"Couldn't load your live chats",description:"Please try again.",actionLabel:"Try again",onAction:()=>Ie()})]}):s.jsxs("section",{className:"live-inbox","aria-label":"Live chats",children:[s.jsxs("header",{className:"lc-intro",children:[n,s.jsxs("div",{className:"lc-controls",children:[s.jsxs("div",{className:"lc-control",children:[s.jsx("span",{className:"lc-control-label",id:"lc-available-label",children:"Available"}),s.jsxs("label",{className:"toggle",children:[s.jsx("input",{type:"checkbox",checked:!!c.available,disabled:$,"aria-labelledby":"lc-available-label",onChange:ve=>Qe({available:ve.target.checked},ve.target.checked?"You are available for live chat.":"New live chat requests are off.")}),s.jsx("span",{className:"tk"})]})]}),s.jsxs("span",{className:"lc-active",role:"status",children:[c.activeCount||0," of ",c.capacity||1," active"]}),c.available&&c.outsideHours&&s.jsx("span",{className:"lc-active",children:"Outside your office hours, so visitors can leave a message."})]})]}),c.available&&s.jsx(aht,{}),s.jsx("div",{className:"lc-filters",role:"group","aria-label":"Filter live chats",children:eht.map(ve=>s.jsxs("button",{type:"button",className:`lc-seg${o===ve.value?" is-on":""}`,"aria-pressed":o===ve.value,onClick:()=>Zt(ve.value),children:[ve.label,ve.value!=="resolved"&&s.jsx("span",{className:"lc-seg-count",children:c.counts?.[ve.value]||
15920})]},ve.value))}),d?s.jsxs("div",{className:"lc-loading lc-card","aria-label":"Loading live chats",children:[s.jsx(gt,{className:"h-4 w-2/5"}),s.jsx(gt,{className:"h-4 w-3/5"}),s.jsx(gt,{className:"h-4 w-1/3"})]}):s.jsxs("div",{className:`lc-grid${ee.length===0?" is-empty":""}`,children:[s.jsxs("div",{className:"lc-list lc-card","aria-label":"Live chat requests",children:[s.jsxs("div",{className:"lc-list-head",children:[s.jsx("span",{className:"lc-list-title",children:"Inbox"}),s.jsxs("span",{children:[ee.length," ",ee.length===1?"conversation":"conversations"]})]}),s.jsxs("div",{className:"lc-rows",children:[ee.length===0&&s.jsx("div",{className:"lc-list-empty",children:s.jsx(Bh,{icon:A_,...iht[o]})}),ee.map(ve=>s.jsxs("button",{type:"button",className:`lc-row${X?.id===ve.id?" is-selected":""}${ve.unreadCount>0?" is-unread":""}`,"aria-current":X?.id===ve.id?"true":void 0,onClick:()=>St(ve),children:[s.jsx(ws,{name:ve.visitorLabel||"Visitor",size:"sm"}),s.jsxs("span",{className:"lc-row-copy",children:[s.jsxs("span",{className:"lc-row-top",children:[s.jsx("strong",{children:ve.visitorLabel||"Visitor"}),s.jsx("span",{children:Z0(ve.lastMessageAt||ve.requestedAt)}),ve.unreadCount>0&&s.jsxs("span",{className:"lc-row-unread",children:[ve.unreadCount>99?"99+":ve.unreadCount,s.jsx("span",{className:"sr-only",children:" unread"})]})]}),s.jsx("span",{className:"lc-row-preview",children:ve.lastMessagePreview||ve.approvedSummary||U1(ve)}),s.jsxs("span",{className:"lc-row-meta",children:[ve.state==="waiting"&&!N.has(ve.id)&&ve.id!==X?.id&&s.jsx("span",{className:"lc-row-new",children:"New"}),s.jsx("span",{className:"lc-row-expert",children:ve.expertName||"Your AI expert"}),s.jsx(Xie,{rating:ve.rating}),s.jsx("span",{className:"sr-only",children:"Open this conversation"})]})]})]},ve.id))]})]}),s.jsx("div",{className:"lc-desktop-detail lc-card",children:ct})]}),s.jsx(en,{isOpen:b,onClose:()=>y(!1),title:X?`Live chat with ${he}`:"Live chat",hideTitle:!0,maxWidth:"max-w-2xl",className:"lc-mobile-modal",children:s.jsx("div",{className:"live-inbox lc-mobile-shell",children:ct})}),s.jsx(Zdt,{attempt:X,isOpen:W&&!!X,onClose:()=>D(!1)})]})}function lht({attempt:e,messages:t,visitor:n,transcript:r,onRetryTranscript:a,visitorReadRevision:i,peerTyping:o,onOpenContext:l,composer:c,loading:u,error:d,onRetry:h,busy:p,atCapacity:m,confirming:g,onConfirm:x,onAction:b,bodyRef:y,onBodyScroll:v,onClose:w,inboxEmpty:j=!1}){const E=f.useRef(null);if(f.useEffect(()=>{E.current?.focus()},[e?.id]),!e)return s.jsx("div",{className:"lc-thread lc-thread-idle",children:s.jsx(Bh,{icon:ni,title:j?"Your chats open here":"Nothing open",description:j?"Accept a request and you talk with the visitor right here, with their summary and earlier AI chat above.":"Choose a conversation from your inbox to read it."})});let S=-1;t.forEach((k,C)=>{k.role==="creator"&&!k._pending&&typeof k.revision=="number"&&(S=C)});const _=n==="Visitor"?"The visitor":n.split(" ")[0];return s.jsxs("article",{className:"lc-thread",children:[s.jsxs("header",{className:"lc-thread-head",children:[s.jsx("button",{type:"button",className:"lc-back",onClick:w,"aria-label":"Back to conversations",children:s.jsx(ja,{"aria-hidden":"true"})}),s.jsxs("button",{ref:E,type:"button",className:"lc-person-btn",onClick:l,"aria-haspopup":"dialog","aria-label":`${n}, ${U1(e)}. Show conversation details`,children:[s.jsx(ws,{name:n,size:"sm"}),s.jsxs("span",{className:"lc-thread-person",children:[s.jsxs("span",{className:"lc-thread-name",children:[n,s.jsx(hn,{className:"lc-person-chev","aria-hidden":"true"})]}),s.jsxs("span",{className:"lc-thread-state",children:[s.jsx("span",{className:`lc-dot${e.state==="human"?" is-on":""}`,"aria-hidden":"true"}),U1(e),s.jsx(Xie,{rating:e.rating,withLabel:!0})]})]})]}),e.state==="human"&&s.jsxs(yt,{variant:"secondary",size:"sm",className:"lc-btn",disabled:p,onClick:()=>x("resolve"),children:[s.jsx(UT,{size:15,"aria-hidden":"true"}),"Resolve"]}),e.state==="waiting"&&!g&&s.jsxs("div",{className:"lc-head-actions",children:[s.jsx(yt,{variant:"ghost",size:"sm",className:"lc-btn",disabled:p,onClick:()=>x("decline"),children:"Decline"}),s.jsx(yt,{variant:"ink",size:"sm",className:"lc-btn",isLoading:p,disabled:m,onClick:()=>b("accept"),children:"Accept"})]})]}),s.jsxs("div",{className:"lc-thread-body",ref:y,onScroll:v,children:[e.approvedSummary&&s.jsx(cht,{text:e.approvedSummary},e.id),e.shareTranscript?s.jsx(uht,{transcript:r,visitor:n,expertName:e.expertName,onRetry:a},e.id):s.jsx("p",{className:"lc-not-shared",children:"The visitor did not share their earlier AI chat."}),s.jsxs("div",{className:"lc-marker",children:[s.jsx("span",{}),s.jsx("span",{children:"Live conversation"}),s.jsx("span",{})]}),u?s.jsx(Yie,{label:"Loading messages",rows:["in","out","in"]}):d?s.jsxs("div",{className:"lc-thread-error",children:[s.jsx("p",{children:"Couldnât load these messages."}),s.jsx("button",{type:"button",onClick:h,children:"Try again"})]}):t.length===0?s.jsx("p",{className:"lc-no-messages",children:e.state==="waiting"?"Accept this request to join the conversation.":"No live messages in this conversation yet."}):s.jsx("div",{className:"lc-messages",role:"log","aria-label":`Live messages with ${n}`,"aria-live":"polite","aria-relevant":"additions text",children:t.map((k,C)=>s.jsx(Kie,{message:k,visitor:n,expertName:e.expertName,pending:!!k._pending,seen:C===S&&i>=k.revision},k.id))}),s.jsx("div",{className:"lc-typing-slot","aria-live":"polite",children:o&&s.jsxs("span",{className:"lc-typing",children:[s.jsxs("span",{className:"lc-typing-dots","aria-hidden":"true",children:[s.jsx("span",{}),s.jsx("span",{}),s.jsx("span",{})]}),_," is typing"]})})]}),s.jsx("footer",{className:"lc-thread-foot",children:g?s.jsxs("div",{className:"lc-confirm",children:[s.jsx("strong",{children:g==="decline"?"Decline this request?":"Resolve this conversation?"}),s.jsx("p",{children:g==="decline"?"The visitor goes back to their AI conversation.":"This ends the live chat for both of you."}),s.jsxs("div",{className:"lc-confirm-actions",children:[s.jsx(yt,{variant:"secondary",size:"sm",className:"lc-btn",onClick:()=>x(null),children:"Keep open"}),s.jsx(yt,{variant:"ink",size:"sm",className:"lc-btn",isLoading:p,onClick:()=>b(g),children:g==="decline"?"Decline request":"Resolve conversation"})]})]}):e.state==="waiting"?s.jsxs("div",{className:"lc-request",children:[s.jsxs("div",{className:"lc-request-copy",children:[s.jsx("strong",{children:"Someone could use your perspective."}),s.jsx("p",{children:"Accept to start writing as yourself."})]}),s.jsxs("div",{className:"lc-request-actions",children:[s.jsx(yt,{variant:"secondary",size:"sm",className:"lc-btn",disabled:p,onClick:()=>x("decline"),children:"Decline"}),s.jsx(yt,{variant:"ink",size:"sm",className:"lc-btn",isLoading:p,disabled:m,onClick:()=>b("accept"),children:"Accept conversation"})]}),m&&s.jsx("p",{className:"lc-capacity-note",children:"You are at capacity. Resolve an active chat or raise your limit above."})]}):c||s.jsxs("div",{className:"lc-resolved",children:[s.jsx(UT,{"aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("strong",{children:U1(e)}),s.jsx("p",{children:"This live conversation is closed."})]})]})})]})}function cht({text:e}){const[t,n]=f.useState(!0);return s.jsxs("section",{className:`lc-summary${t?"":" is-closed"}`,children:[s.jsxs("button",{type:"button",className:"lc-summary-head","aria-expanded":t,onClick:()=>n(r=>!r),children:[s.jsx("span",{children:"Summary"}),s.jsx(Is,{className:"lc-summary-chev","aria-hidden":"true"})]}),t?s.jsx("p",{children:e}):s.jsx("p",{className:"lc-summary-peek",children:e})]})}function uht({transcript:e,visitor:t,expertName:n,onRetry:r}){const[a,i]=f.useState(!1),o=e?.status||"loading";if(o==="hidden")return s.jsx("p",{className:"lc-not-shared",children:"The visitor did not share their earlier AI chat."});const l=e?.messages||[],c=a?l:l.slice(-nq),u=l.length-c.length;return s.jsxs("section",{className:"lc-earlier","aria-label":"Earlier chat with your AI",children:[s.jsxs("div",{className:"lc-marker",children:[s.jsx("span",{}),s.jsx("span",{children:"Earlier chat with your AI"}),s.jsx("span",{})]}),o==="loading"?s.jsx(Yie,{label:"Loading the earlier chat",rows:["in","in"]}):o==="error"?s.jsxs("div",{className:"lc-thread-error",children:[s.jsx("p",{children:"Couldnât load the earlier chat."}),s.jsx("button",{type:"button",onClick:r,children:"Try again"})]}):l.length===0?s.jsx("p",{className:"lc-no-messages",children:"There were no earlier messages to share."}):s.jsxs(s.Fragment,{children:[(u>0||a)&&l.length>nq&&s.jsx("button",{type:"button",className:"lc-earlier-toggle","aria-expanded":a,onClick:()=>i(d=>!d),children:a?"Show fewer":`Show all ${l.length} messages`}),s.jsx("div",{className:"lc-messages",children:c.map(d=>s.jsx(Kie,{message:d,visitor:t,expertName:n},d.id))})]})]})}
1592const dht=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"].map((e,t)=>({value:t,name:e,short:e.slice(0,3)})),Jie=Array.from({length:48},(e,t)=>{const n=Math.floor(t/2),r=t%2?30:0;return{value:`${String(n).padStart(2,"0")}:${r?"30":"00"}`,label:new Date(2e3,0,1,n,r).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}}),hht=Jie.map(e=>e.value==="00:00"?{...e,label:"Midnight"}:e),Qie={"Africa/Asmera":"Africa/Asmara","America/Buenos_Aires":"America/Argentina/Buenos_Aires","America/Godthab":"America/Nuuk","America/Indianapolis":"America/Indiana/Indianapolis","America/Louisville":"America/Kentucky/Louisville","Asia/Calcutta":"Asia/Kolkata","Asia/Katmandu":"Asia/Kathmandu","Asia/Rangoon":"Asia/Yangon","Asia/Saigon":"Asia/Ho_Chi_Minh","Atlantic/Faeroe":"Atlantic/Faroe","Europe/Kiev":"Europe/Kyiv","Pacific/Enderbury":"Pacific/Kanton","Pacific/Ponape":"Pacific/Pohnpei","Pacific/Truk":"Pacific/Chuuk"},pht=Object.fromEntries(Object.entries(Qie).map(([e,t])=>[t,e])),sb=e=>Qie[e]||e,mht=()=>{try{return sb(Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC")}catch{return"UTC"}};function fht(e){const t=n=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:n}).formatToParts(new Date).find(r=>r.type==="timeZoneName")?.value||""}catch{return""}};return{offset:t("shortOffset"),long:t("long")}}function aq(e){const{offset:t,long:n}=fht(e);return{value:e,label:`${e.replaceAll("_"," ")}${t?` (${t})`:""}`,keywords:`${n} ${t.replace("GMT","UTC")} ${pht[e]||""}`}}let Gg=null;function ght(e){if(!Gg){const t=typeof Intl.supportedValuesOf=="function"?Intl.supportedValuesOf("timeZone"):[];Gg=[{value:"UTC",label:"UTC (GMT)",keywords:"coordinated universal time"},...t.map(sb).filter(n=>n!=="UTC").sort().map(aq)]}return Gg.some(t=>t.value===e)?Gg:[aq(e),...Gg]}function xht({hours:e,disabled:t,onSave:n}){const r=!!e?.on,a=e||{on:!1,tz:mht(),days:[0,1,2,3,4],start:"09:00",end:"17:00"},i=(o,l="Office hours saved.")=>n({...a,...o},l);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"setrow",children:[s.jsxs("div",{className:"sl",children:[s.jsx("div",{className:"t",id:"lc-hours-label",children:"When you take chats"}),s.jsx("div",{className:"d",children:r?"Only inside your office hours. Outside them, visitors can leave a message instead.":"Any time you are Available on the Chats tab."})]}),s.jsx("div",{className:"lc-places",role:"group","aria-labelledby":"lc-hours-label",children:[!1,!0].map(o=>s.jsx("button",{type:"button",className:`lc-place${r===o?" is-on":""}`,"aria-pressed":r===o,disabled:t,onClick:()=>r!==o&&i({on:o},o?"Live chat now follows your office hours.":"Live chat is open whenever you are available."),children:o?"Set hours":"Always available"},String(o)))})]}),r&&s.jsxs("div",{className:"lc-hours",children:[s.jsxs("div",{className:"lc-hours-line",children:[s.jsx("span",{className:"lc-hours-label",id:"lc-days-label",children:"Days"}),s.jsx("div",{className:"lc-days",role:"group","aria-labelledby":"lc-days-label",children:dht.map(({value:o,name:l,short:c})=>{const u=a.days.includes(o),d=u&&a.days.length===1;return s.jsx("button",{type:"button",className:`lc-place lc-day${u?" is-on":""}`,"aria-pressed":u,"aria-label":l,title:d?"Keep at least one day":l,disabled:t||d,onClick:()=>i({days:u?a.days.filter(h=>h!==o):[...a.days,o].sort((h,p)=>h-p)}),children:c},o)})})]}),s.jsxs("div",{className:"lc-hours-line",children:[s.jsx("span",{className:"lc-hours-label",children:"Hours"}),s.jsxs("div",{className:"lc-hours-range",children:[s.jsx(xu,{className:"lc-capacity-select lc-time-select",fixed:!0,label:"Opens at",value:a.start,options:Jie.filter(o=>o.value!==a.end),disabled:t,onChange:o=>o!==a.start&&i({start:o})}),s.jsx("span",{className:"lc-hours-to",children:"to"}),s.jsx(xu,{className:"lc-capacity-select lc-time-select",fixed:!0,label:"Closes at",value:a.end,options:hht.filter(o=>o.value!==a.start),disabled:t,onChange:o=>o!==a.end&&i({end:o})}),a.end<a.start&&a.end!=="00:00"&&s.jsx("span",{className:"lc-hours-note",children:"Runs past midnight"})]})]}),s.jsxs("div",{className:"lc-hours-line",children:[s.jsx("span",{className:"lc-hours-label",children:"Time zone"}),s.jsx(xu,{className:"lc-capacity-select lc-zone-select",fixed:!0,label:"Time zone",search:!0,value:sb(a.tz),options:ght(sb(a.tz)),disabled:t,onChange:o=>o!==sb(a.tz)&&i({tz:o})})]})]})]})}const iq=()=>typeof window<"u"&&"Notification"in window,bht=[{key:"on_embed",field:"onEmbed",label:"Website",icon:vc,name:"your website chat"},{key:"on_profile",field:"onProfile",label:"Profile page",icon:Ci,name:"your profile page"}],yht=40,vht=Array.from({length:10},(e,t)=>({value:t+1,label:`${t+1} ${t===0?"visitor":"visitors"}`}));function wht(){const{addToast:e}=f.useContext(Zs),{user:t}=Ut(),n=t?.id||null,[r,a]=f.useState(()=>Bl(n,"settings")||null),[i,o]=f.useState(!1),[l,c]=f.useState(()=>V4()&&iq()&&Notification.permission==="granted");f.useEffect(()=>{let v=!1;return oh(n,"settings",P_,{join:!0}).then(w=>
1592{v||a(w)}).catch(()=>{v||a(w=>w||{enabled:!1,featureEnabled:!1,unreachable:!0})}),()=>{v=!0}},[n]),f.useEffect(()=>{r&&!r.unreachable&&sA(n,"settings",r)},[n,r]);async function u(v,w,j=v){const E=r;a(S=>({...S,...j})),o(!0);try{const S=await H4(v);a(_=>({..._,...S})),e(w,"success")}catch(S){a(E),e(ih(S,"Could not save that. Please try again."),"error")}finally{o(!1)}}async function d(v){if(!v){eA(!1),c(!1);return}try{const j=await Notification.requestPermission()==="granted";eA(j),c(j),e(j?"Desktop alerts are on for this browser.":"Your browser blocked notifications. Allow them in its site settings to turn this on.",j?"success":"error")}catch{e("This browser could not turn on desktop alerts.","error")}}const h=!!r?.featureEnabled,p=!!r?.enabled,[m,g]=f.useState(null),x=r?.displayName||"",b=m??x;function y(){const v=b.split(/\s+/).filter(Boolean).join(" ");g(null),v!==x&&u({display_name:v},v?`Visitors now see "${v}".`:"Visitors now see your name.",{displayName:v})}return s.jsxs(L5,{id:"liveChat",title:"Live chat",summary:"Let visitors ask to talk to you instead of your AI. Off until you turn it on.",badge:r?{label:p?"On":"Off",tone:p?"ok":""}:null,collapsible:!1,infoMode:"tooltip",info:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"block",children:"A visitor talking to one of your AI experts can ask to speak with you. Before the request is sent they are told you will read their earlier AI chat, and they can leave an email for replies they might miss."}),s.jsx("span",{className:"mt-2 block",children:"Anything you write is sent as yourself, and your replies are never billed as AI usage. Switch Available off on the Chats tab when you step away, or set office hours: outside them visitors get the option to leave a message instead of waiting."})]}),children:[s.jsxs("div",{className:"setrow",children:[s.jsxs("div",{className:"sl",children:[s.jsx("div",{className:"t",children:"Accept live chat requests"}),s.jsx("div",{className:"d",children:"Your AI experts show a way to reach you, and requests arrive on the Live chat tab."})]}),s.jsxs("label",{className:"toggle",children:[s.jsx("input",{type:"checkbox",checked:p,disabled:!r||i||!h,onChange:v=>u({enabled:v.target.checked},v.target.checked?"Live chat is on.":"Live chat is off."),"aria-label":"Accept live chat requests"}),s.jsx("span",{className:"tk"})]})]}),r&&!h&&s.jsx("div",{className:"fhint",children:"Live chat is not enabled for your account yet."}),h&&p&&s.jsxs("div",{className:"setrow",children:[s.jsxs("div",{className:"sl",children:[s.jsx("div",{className:"t",id:"lc-surfaces-label",children:"Show live chat on"}),s.jsx("div",{className:"d",children:!r?.onEmbed&&!r?.onProfile?s.jsx("span",{className:"lc-warn",children:"Visitors cannot see live chat anywhere. Pick at least one."}):"Where visitors see the Live chat button."})]}),s.jsx("div",{className:"lc-places",role:"group","aria-labelledby":"lc-surfaces-label",children:bht.map(({key:v,field:w,label:j,icon:E,name:S})=>{const _=!!r?.[w];return s.jsxs("button",{type:"button",className:`lc-place${_?" is-on":""}`,"aria-pressed":_,disabled:!r||i,onClick:()=>u({[v]:!_},`Live chat is ${_?"off":"on"} for ${S}.`,{[w]:!_}),children:[s.jsx(E,{"aria-hidden":"true"}),j,_&&s.jsx(ft,{className:"lc-place-check","aria-hidden":"true"})]},v)})})]}),h&&p&&s.jsx(xht,{hours:r?.hours,disabled:!r||i,onSave:(v,w)=>u({hours:v},w)}),h&&s.jsxs("div",{className:"setrow",children:[s.jsxs("div",{className:"sl",children:[s.jsx("div",{className:"t",children:"Name shown to visitors"}),s.jsx("div",{className:"d",children:"Your name or your team's, like âSarahâ or âAcme Supportâ. Leave it empty to use your name."})]}),s.jsx("input",{className:"lc-name-input",value:b,maxLength:yht,placeholder:r?.defaultDisplayName||"Your name",disabled:!r||i,onChange:v=>g(v.target.value),onBlur:y,onKeyDown:v=>{v.key==="Enter"&&v.currentTarget.blur()},"aria-label":"Name shown to visitors"})]}),h&&s.jsxs("div",{className:"setrow",children:[s.jsxs("div",{className:"sl",children:[s.jsx("div",{className:"t",id:"lc-capacity-label",children:"Visitors at the same time"}),s.jsx("div",{className:"d",children:"How many visitors you chat with at once. When you are full, the next visitor waits in line until you finish a chat."})]}),s.jsx(xu,{className:"lc-capacity-select",fixed:!0,label:"Visitors at the same time",value:r?.capacity||3,options:vht,disabled:!r||i,onChange:v=>{v!==r?.capacity&&u({capacity:v},`You will chat with up to ${v} ${v===1?"visitor":"visitors"} at the same time.`)}})]}),h&&iq()&&s.jsxs("div",{className:"setrow",children:[s.jsxs("div",{className:"sl",children:[s.jsx("div",{className:"t",id:"lc-alerts-label",children:"Desktop alerts"}),s.jsx("div",{className:"d",id:"lc-alerts-help",children:"A browser notification for new requests while you are on another tab. Set per browser."})]}),s.jsxs("label",{className:"toggle",children:[s.jsx("input",{type:"checkbox",checked:l,"aria-labelledby":"lc-alerts-label","aria-describedby":"lc-alerts-help",onChange:v=>d(v.target.checked)}),s.jsx("span",{className:"tk"})]})]}),h&&s.jsx(jht,{replies:Array.isArray(r?.quickReplies)?r.quickReplies:[],onSaved:v=>a(w=>({...w,...v}))})]})}function jht({replies:e,onSaved:t}){const{addToast:n}=f.useContext(Zs),[r,a]=f.useState(null),[i,o]=f.useState(!1);async function l(d,h){o(!0);try{const p=await H4({quick_replies:d});t(p),a(null),n(h,"success")}catch(p){n(ih(p,"Could not save your saved replies. Please try again."),"error")}finally{o(!1)}}function c(d){d.preventDefault();const h=r.title.trim(),p=r.text.trim();if(!h||!p)return;
1592const m=r.id?{id:r.id,title:h,text:p}:{title:h,text:p},g=r.id?e.map(x=>x.id===r.id?m:x):[...e,m];l(g,r.id?"Saved reply updated.":"Saved reply added.")}const u=e.length>=Cp.count;return s.jsxs("div",{className:"lc-qr",children:[s.jsx("div",{className:"setrow",children:s.jsxs("div",{className:"sl",children:[s.jsx("div",{className:"t",children:"Saved replies"}),s.jsxs("div",{className:"d",children:["Type / at the start of a live chat reply to insert one. ","{visitor_name}",", ","{creator_name}"," and"," ","{expert_name}"," are filled in for you."]})]})}),e.length>0&&s.jsx("ul",{className:"lc-qr-list",children:e.map(d=>s.jsxs("li",{className:"lc-qr-item",children:[s.jsxs("div",{className:"lc-qr-copy",children:[s.jsx("strong",{children:d.title}),s.jsx("span",{children:d.text})]}),s.jsxs("div",{className:"lc-qr-actions",children:[s.jsx("button",{type:"button",className:"lc-qr-icon","aria-label":`Edit ${d.title}`,disabled:i,onClick:()=>a({id:d.id,title:d.title,text:d.text}),children:s.jsx(Mu,{size:15,"aria-hidden":"true"})}),s.jsx("button",{type:"button",className:"lc-qr-icon","aria-label":`Delete ${d.title}`,disabled:i,onClick:()=>l(e.filter(h=>h!==d),"Saved reply deleted."),children:s.jsx(Qs,{size:15,"aria-hidden":"true"})})]})]},d.id||d.title))}),r?s.jsxs("form",{className:"lc-qr-form",onSubmit:c,children:[s.jsxs("div",{className:"field",children:[s.jsxs("label",{htmlFor:"lc-qr-title",children:["Title",s.jsxs("span",{className:"charcnt",children:[r.title.length," / ",Cp.title]})]}),s.jsx("input",{id:"lc-qr-title",value:r.title,maxLength:Cp.title,onChange:d=>a(h=>({...h,title:d.target.value})),placeholder:"Welcome",required:!0,autoFocus:!0})]}),s.jsxs("div",{className:"field",children:[s.jsxs("label",{htmlFor:"lc-qr-text",children:["Reply",s.jsxs("span",{className:"charcnt",children:[r.text.length," / ",Cp.text]})]}),s.jsx("textarea",{id:"lc-qr-text",rows:3,value:r.text,maxLength:Cp.text,onChange:d=>a(h=>({...h,text:d.target.value})),placeholder:"Hi {visitor_name}, {creator_name} here. Thanks for waiting.",required:!0})]}),s.jsxs("div",{className:"lc-qr-form-actions",children:[s.jsx(yt,{type:"button",variant:"ghost",size:"sm",onClick:()=>a(null),disabled:i,children:"Cancel"}),s.jsx(yt,{type:"submit",size:"sm",isLoading:i,disabled:!r.title.trim()||!r.text.trim(),children:r.id?"Save reply":"Add reply"})]})]}):s.jsxs("div",{className:"lc-qr-add",children:[s.jsxs(yt,{type:"button",variant:"secondary",size:"sm",disabled:u||i,onClick:()=>a({id:null,title:"",text:""}),children:[s.jsx(Es,{size:15,"aria-hidden":"true"}),"Add saved reply"]}),u&&s.jsxs("span",{className:"fhint",children:["You have ",Cp.count," saved replies, the most you can keep."]})]})]})}const _ht=[{days:1,label:"Last 24 hours"},{days:7,label:"Last 7 days"},{days:30,label:"Last 30 days"},{days:90,label:"Last 90 days"}],vd=e=>typeof e=="number"?e.toLocaleString():null;function kht({icon:e,label:t,value:n,caption:r}){return s.jsxs("div",{className:"lc-kpi",children:[s.jsx("span",{className:"lc-kpi-icon",children:s.jsx(e,{"aria-hidden":"true"})}),s.jsxs("div",{className:"lc-kpi-copy",children:[s.jsx("dt",{children:t}),s.jsx("dd",{children:n??s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":"true",children:"â"}),s.jsx("span",{className:"sr-only",children:"Not enough data yet"})]})}),s.jsx("p",{children:r})]})]})}function oq({title:e,stats:t,loading:n}){return s.jsxs("section",{className:"lc-usage-group","aria-label":e,children:[s.jsx("h2",{className:"lc-usage-title",children:e}),s.jsx("dl",{className:"lc-kpis",children:t.map(r=>n?s.jsxs("div",{className:"lc-kpi","aria-hidden":"true",children:[s.jsx(gt,{className:"h-7 w-7 rounded-lg"}),s.jsxs("div",{className:"lc-kpi-copy",children:[s.jsx(gt,{className:"h-3 w-20"}),s.jsx(gt,{className:"mt-2 h-6 w-12"}),s.jsx(gt,{className:"mt-2 h-3 w-32"})]})]},r.label):s.jsx(kht,{...r},r.label))})]})}function Nht(){const{user:e}=Ut(),t=e?.id||null,[n,r]=f.useState(30),[a,i]=f.useState(0),[o,l]=f.useState({key:null,data:null,failed:!1}),c=`${n}:${a}`;f.useEffect(()=>{let w=!1;return oh(t,`usage:${n}`,()=>Lje(n),{join:!0}).then(j=>{w||l({key:c,data:j||{},failed:!1})}).catch(()=>{w||l({key:c,data:null,failed:!0})}),()=>{w=!0}},[n,c,t]);const u=Bl(t,`usage:${n}`),d=o.key===c,h=!d&&!u,p=(d?o.data:u)||{},m=p.limits||{},g=w=>w===0?"0 min":jN(w),x=[{icon:A_,label:"Requests",value:vd(p.requests),caption:"Visitors who asked to talk to you"},{icon:UT,label:"Accept rate",value:iD(p.acceptRate),caption:"Requests you joined, of those you could answer"},{icon:bY,label:"Live chats",value:vd(p.accepted),caption:"Chats you joined"},{icon:ah,label:"Median wait",value:jN(p.medianWaitSeconds),caption:"Before you joined a chat"},{icon:B1e,label:"Median first reply",value:jN(p.medianFirstReplySeconds),caption:"From joining to your first message"},{icon:eo,label:"Thumbs up",value:iD(Qje(p.ratingUp,p.ratingDown)),caption:"Of the chats visitors rated"}],b=[{icon:Nwe,label:"Time chatting",value:g(p.liveSeconds),caption:"Active time, quiet gaps left out"},{icon:yve,label:"Average chat",value:p.accepted?g(Math.round((p.liveSeconds||0)/p.accepted)):null,caption:"Active time per chat you joined"},{icon:$u,label:"Your messages",value:vd(p.creatorMessages),caption:"Sent by you in live chat"},{icon:ni,label:"Visitor messages",value:vd(p.visitorMessages),caption:"Received in live chat"},{icon:Ms,label:"AI drafts",value:vd(p.aiAssists),caption:"Drafts and rewrites you asked for"}
1592,{icon:eY,label:"Contacts shared",value:vd(p.contactsShared),caption:"Visitors who left an email or phone"}],y=[{label:"Resolved by you",value:p.resolved},{label:"Ended after no messages",value:p.idle},{label:"Visitor went back to the AI",value:p.cancelled},{label:"Declined",value:p.declined},{label:"Expired, nobody answered",value:p.expired}],v=y.reduce((w,j)=>w+(j.value||0),0);return s.jsxs("div",{className:"lc-usage",children:[s.jsx("div",{className:"lc-filters",role:"group","aria-label":"Period",children:_ht.map(w=>s.jsx("button",{type:"button",className:`lc-seg${n===w.days?" is-on":""}`,"aria-pressed":n===w.days,onClick:()=>r(w.days),children:w.label},w.days))}),o.failed&&!h?s.jsx(Bh,{icon:xr,title:"Couldn't load your usage",description:"Please try again.",actionLabel:"Try again",onAction:()=>i(w=>w+1)}):s.jsxs("div",{"aria-busy":h,children:[s.jsx(oq,{title:"Performance",stats:x,loading:h}),s.jsx(oq,{title:"Usage",stats:b,loading:h}),s.jsxs("div",{className:"lc-usage-split",children:[s.jsxs("section",{className:"lc-card lc-usage-card","aria-label":"How requests ended",children:[s.jsx("h2",{className:"lc-usage-title",children:"How requests ended"}),h?s.jsx(gt,{className:"h-24 w-full"}):v===0?s.jsx("p",{className:"lc-usage-empty",children:"No finished requests in this period."}):s.jsx("ul",{className:"lc-outcomes",children:y.map(w=>s.jsxs("li",{children:[s.jsx("span",{className:"lc-outcome-label",children:w.label}),s.jsx("span",{className:"lc-outcome-bar","aria-hidden":"true",children:s.jsx("span",{style:{width:`${(w.value||0)/v*100}%`}})}),s.jsx("span",{className:"lc-outcome-value",children:vd(w.value)??"0"})]},w.label))})]}),s.jsxs("section",{className:"lc-card lc-usage-card","aria-label":"Limits",children:[s.jsx("h2",{className:"lc-usage-title",children:"Limits"}),h?s.jsx(gt,{className:"h-24 w-full"}):s.jsxs("dl",{className:"lc-limits",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Visitors at the same time"}),s.jsxs("dd",{children:[m.capacity??"â",m.maxCapacity&&s.jsxs("span",{children:[" of up to ",m.maxCapacity,", change it in Settings"]})]})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"AI drafts and rewrites"}),s.jsx("dd",{children:m.aiAssistsPer10Min?`Up to ${m.aiAssistsPer10Min} every 10 minutes`:"â"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Waiting requests"}),s.jsx("dd",{children:m.queueMinutes?`Expire after ${m.queueMinutes} minutes`:"â"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Quiet chats"}),s.jsx("dd",{children:m.idleMinutes?`End after ${m.idleMinutes} minutes without messages`:"â"})]})]}),s.jsx("p",{className:"lc-usage-note",children:"Live chat is included in your plan. Nothing here is billed today."})]})]})]})]})}const Zie=[{id:"chats",label:"Chats"},{id:"usage",label:"Usage"},{id:"settings",label:"Settings"}];function Eht({tab:e,onChange:t}){return s.jsx("nav",{className:"lc-tabs","aria-label":"Live chat sections",children:Zie.map(n=>s.jsx("button",{type:"button",className:`lc-tab${e===n.id?" is-on":""}`,"aria-current":e===n.id?"page":void 0,onClick:()=>t(n.id),children:n.label},n.id))})}function Sht(){const e=XY(),[t,n]=gl(),r=Zie.some(o=>o.id===t.get("tab"))?t.get("tab"):"chats",a=o=>n(o==="chats"?{}:{tab:o},{replace:!0}),i=s.jsx(Eht,{tab:r,onChange:a});return e===!1?s.jsx(Pn,{to:Me.DASHBOARD,replace:!0}):s.jsxs("div",{className:"leads-page live-page",children:[s.jsx("header",{className:"live-inbox lc-page-head",children:s.jsx(rht,{})}),e===null?s.jsx(gt,{className:"h-96 w-full rounded-xl"}):r==="chats"?s.jsx(oht,{active:!0,toolbar:i}):s.jsxs("div",{className:"live-inbox",children:[s.jsx("header",{className:"lc-intro",children:i}),r==="usage"?s.jsx(Nht,{}):s.jsx(wht,{})]})]})}function Cht(){const{user:e,isAuthenticated:t,isLoading:n,completeAccount:r}=Ut(),a=Ps(),[i,o]=f.useState(""),[l,c]=f.useState(""),[u,d]=f.useState(""),[h,p]=f.useState(""),[m,g]=f.useState(!1);if(f.useEffect(()=>{e?.full_name&&o(e.full_name)},[e?.full_name]),n)return null;if(!t)return s.jsx(Pn,{to:"/login",replace:!0});if(e?.account_completed!==!1)return s.jsx(Pn,{to:"/dashboard",replace:!0});const x=async b=>{if(b.preventDefault(),p(""),!i.trim()){p("Enter your name.");return}if(l.length<8){p("Use at least 8 characters for your password.");return}if(l!==u){p("Passwords do not match.");return}g(!0);try{await r(i.trim(),l),a("/dashboard",{replace:!0})}catch(y){p(y.message||"Could not finish your account.")}finally{g(!1)}};return s.jsx("main",{className:"min-h-dvh bg-cream px-4 py-12 text-ink",children:s.jsxs("div",{className:"mx-auto w-full max-w-lg",children:[s.jsx("div",{className:"mb-8 flex justify-center",children:s.jsx(bn,{height:48})}),s.jsxs("form",{onSubmit:x,className:"rounded-[28px] border border-rule bg-paper p-6 shadow-card sm:p-10",children:[s.jsx("h1",{className:"font-display text-4xl",children:"Finish your account"}),s.jsx("p",{className:"mt-2 text-sm text-ink-mid",children:"Confirm your name and create a password for the full Great Experts platform."}),s.jsxs("div",{className:"mt-7 space-y-4",children:[s.jsxs("label",{className:"block text-sm font-medium",children:["Name",s.jsx("input",{value:i,onChange:b=>o(b.target.value),autoComplete:"name",className:"mt-2 w-full rounded-xl border border-rule bg-white px-4 py-3 outline-none focus:border-indigo"})]}),s.jsxs("label",{className:"block text-sm font-medium",children:["Create password",s.jsx("input",{type:"password",value:l,onCh
1592ange:b=>c(b.target.value),autoComplete:"new-password",className:"mt-2 w-full rounded-xl border border-rule bg-white px-4 py-3 outline-none focus:border-indigo"})]}),s.jsxs("label",{className:"block text-sm font-medium",children:["Confirm password",s.jsx("input",{type:"password",value:u,onChange:b=>d(b.target.value),autoComplete:"new-password",className:"mt-2 w-full rounded-xl border border-rule bg-white px-4 py-3 outline-none focus:border-indigo"})]})]}),h&&s.jsx("p",{className:"mt-4 rounded-xl bg-red-50 px-3 py-2 text-sm text-red-700",children:h}),s.jsx("button",{type:"submit",disabled:m,className:"mt-6 w-full rounded-full bg-indigo px-5 py-3 font-semibold text-cream disabled:opacity-50",children:"Save and continue"})]})]})})}async function Tht(e){return(await Se.post("/dev/journey/step",{step:e})).data?.data}function Aht(e){const t=e?.response?.data?.detail;return t?.message||(typeof t=="string"?t:"")||e?.message||"The development state could not be applied."}function eoe({embedded:e=!1}){const t=typeof window<"u"&&window.self===window.top,n=typeof window<"u"&&window.location.pathname==="/dev/journey",{user:r,isAuthenticated:a}=Ut(),[i,o]=f.useState(e),[l,c]=f.useState(()=>{try{return XP(window.location.search)||sessionStorage.getItem("dev_journey_current_step")||"welcome"}catch{return"welcome"}}),[u,d]=f.useState(!1),[h,p]=f.useState(""),g=!(a&&!!WM&&r?.email?.toLowerCase()===WM.toLowerCase());f.useEffect(()=>{if(!wu||!t)return;const b=v=>{v.metaKey&&v.shiftKey&&v.key.toLowerCase()==="d"&&(v.preventDefault(),o(w=>!w))},y=v=>c(v.detail?.screen||"welcome");return window.addEventListener("keydown",b),window.addEventListener(c5,y),()=>{window.removeEventListener("keydown",b),window.removeEventListener(c5,y)}},[t]);const x=async b=>{d(!0),p("");try{if(g){rU(b,null,{preview:!0});return}const y=await Tht(b);rU(b,y.expert_id)}catch(y){p(Aht(y)),d(!1)}};return!wu||!t||!e&&n?null:!i&&!e?s.jsx("button",{className:"dev-journey-trigger",type:"button",onClick:()=>o(!0),children:"DEV"}):s.jsxs("aside",{className:`dev-journey-panel${e?" is-embedded":""}`,"aria-label":"Developer sections",children:[s.jsxs("header",{className:"dev-journey-header",children:[s.jsx("strong",{children:"Sections"}),!e&&s.jsx("button",{type:"button",className:"dev-journey-icon",onClick:()=>o(!1),"aria-label":"Close sections",children:s.jsx(as,{size:17})})]}),s.jsxs("div",{className:"dev-journey-select",children:[s.jsx("select",{"aria-label":"Sections",value:l,onChange:b=>c(b.target.value),children:Fre.map(({id:b,label:y})=>s.jsx("option",{value:b,children:y},b))}),s.jsx(Is,{size:15})]}),s.jsx("button",{className:"dev-journey-secondary",type:"button",disabled:u,onClick:()=>x(l),children:u?"Openingâ¦":"Open section"}),h&&s.jsx("p",{className:"dev-journey-error",role:"alert",children:h})]})}function Rht(){return wu?s.jsx("main",{className:"dev-journey-page",children:s.jsx(eoe,{embedded:!0})}):s.jsx(Pn,{to:"/",replace:!0})}const toe=["free","lite","starter","pro"],O5={free:"Free",lite:"Lite",starter:"Starter",pro:"Pro"},soe={answer:"Answer a question",start_call:"Start a voice call",add_contact:"Receive a contact (lead)",create_expert:"Publish an expert",embed_expert:"Embed on a website",enable_language:"Add a call language",clone_voice:"Clone a voice"},Iht=[{key:"answers_used",label:"Answers used",limitKey:"answers_quota",step:1},{key:"voice_seconds_used",label:"Voice used (min)",limitKey:"voice_seconds_quota",step:60,display:e=>Math.floor(e/60)},{key:"contacts_count",label:"Contacts stored",limitKey:"contacts_max",step:1},{key:"experts_count",label:"Experts published",limitKey:"max_experts",step:1},{key:"embedded_count",label:"Experts embedded",limitKey:"max_embedded_experts",step:1},{key:"languages_in_use",label:"Call languages on",limitKey:"call_languages_max",step:1}],Gp={answers_used:0,voice_seconds_used:0,contacts_count:0,experts_count:0,embedded_count:0,languages_in_use:0,active_clones:0};function Pht(e,t){const n=e?.[t.limitKey];return n==null?t.key==="voice_seconds_used"?3600*12:50:Math.ceil(n*1.25)+t.step}function Lht({decision:e}){const t=e.allowed;return s.jsx("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-semibold ${t?"bg-emerald-100 text-emerald-800":"bg-red-100 text-red-700"}`,children:t?"ALLOWED":"BLOCKED"})}function Oht({name:e,decision:t}){return s.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-neutral-100 py-2 last:border-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-neutral-900",children:soe[e]||e}),s.jsx("div",{className:"truncate text-xs text-neutral-500",children:t.reason})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[t.limit!=null&&s.jsxs("span",{className:"font-mono text-xs text-neutral-500",children:[t.used,"/",t.limit]}),s.jsx(Lht,{decision:t})]})]})}function Mht({matrix:e,running:t,onRun:n}){const r=f.useMemo(()=>
1592{if(!e)return{};const a={};for(const i of e.cases)(a[i.plan]=a[i.plan]||[]).push(i);return a},[e]);return s.jsxs("div",{className:"rounded-2xl border border-neutral-200 bg-white p-5 shadow-sm",children:[s.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-base font-semibold text-neutral-900",children:"Automated feedback board"}),s.jsx("p",{className:"text-xs text-neutral-500",children:"Replays every plan à limit at its boundaries through the production gates and grades the result against the /pricing promise."})]}),s.jsx("button",{type:"button",onClick:n,disabled:t,className:"rounded-full bg-neutral-900 px-4 py-2 text-sm font-semibold text-white hover:bg-neutral-700 disabled:opacity-50",children:t?"Runningâ¦":e?"Run again":"Run full matrix"})]}),e&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`mb-4 rounded-xl px-4 py-3 text-sm font-semibold ${e.ok?"bg-emerald-50 text-emerald-800":"bg-red-50 text-red-700"}`,children:[e.ok?"â":"â"," ",e.passed,"/",e.total," boundary cases match the pricing page",!e.ok&&` â ${e.failed} broken promise${e.failed===1?"":"s"}`]}),s.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:toe.map(a=>s.jsxs("div",{className:"rounded-xl border border-neutral-100 p-3",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-semibold",children:O5[a]}),s.jsxs("span",{className:"text-xs text-neutral-500",children:[(r[a]||[]).filter(i=>i.ok).length,"/",(r[a]||[]).length," pass"]})]}),s.jsx("div",{className:"max-h-64 space-y-1 overflow-y-auto pr-1",children:(r[a]||[]).map((i,o)=>s.jsxs("div",{className:`flex items-center justify-between rounded px-2 py-1 text-xs ${i.ok?"text-neutral-600":"bg-red-50 font-semibold text-red-700"}`,children:[s.jsxs("span",{className:"truncate",children:[i.ok?"â":"â"," ",soe[i.action]||i.action," â ",i.case]}),s.jsxs("span",{className:"ml-2 shrink-0 font-mono",children:[i.actual_allowed?"allow":"block",!i.ok&&` (wanted ${i.expected_allowed?"allow":"block"})`]})]},o))})]},a))})]})]})}function Dht(){const[e,t]=f.useState(null),[n,r]=f.useState("free"),[a,i]=f.useState({...Gp}),[o,l]=f.useState(null),[c,u]=f.useState(null),[d,h]=f.useState(!1),[p,m]=f.useState("");f.useEffect(()=>{Se.get("/dev/pricing/catalog").then(y=>t(y.data.data)).catch(()=>m("Pricing harness API is not available. Set ENABLE_PRICING_HARNESS=true in backend .env (development/staging only) and restart the API."))},[]),f.useEffect(()=>{if(!e)return;const y=setTimeout(()=>{Se.post("/dev/pricing/evaluate",{plan:n,usage:a}).then(v=>l(v.data.data)).catch(()=>l(null))},120);return()=>clearTimeout(y)},[e,n,a]);const g=e?.plans?.[n],x=f.useCallback(()=>{h(!0),Se.get("/dev/pricing/matrix").then(y=>u(y.data.data)).finally(()=>h(!1))},[]),b=f.useMemo(()=>g?[{label:"Fresh account",usage:{...Gp}},{label:"One answer left",usage:{...Gp,answers_used:(g.answers_quota??1)-1}},{label:"Answers exhausted",usage:{...Gp,answers_used:g.answers_quota??0}},{label:"Voice spent",usage:{...Gp,voice_seconds_used:g.voice_seconds_quota??0}},{label:"Contacts full",usage:{...Gp,contacts_count:g.contacts_max??0}},{label:"Everything maxed",usage:{active_clones:0,answers_used:g.answers_quota??0,voice_seconds_used:g.voice_seconds_quota??0,contacts_count:g.contacts_max??0,experts_count:g.max_experts??0,embedded_count:g.max_embedded_experts??0,languages_in_use:g.call_languages_max??0}}]:[],[g]);return p?s.jsx("div",{className:"mx-auto max-w-3xl px-6 py-16",children:s.jsx("div",{className:"rounded-2xl border border-amber-200 bg-amber-50 p-6 text-sm text-amber-900",children:p})}):s.jsxs("div",{className:"mx-auto max-w-6xl px-6 py-10",children:[s.jsxs("header",{className:"mb-8",children:[s.jsx("h1",{className:"text-2xl font-bold text-neutral-900",children:"Pricing enforcement harness"}),s.jsx("p",{className:"mt-1 max-w-2xl text-sm text-neutral-500",children:"Live test bench for the plan limits. Every verdict below comes from the same gate functions the product runs in chat, voice, leads, publishing, and embeds â nothing on this page is hardcoded copy."})]}),s.jsxs("div",{className:"mb-8 grid gap-6 lg:grid-cols-[320px,1fr]",children:[s.jsxs("div",{className:"rounded-2xl border border-neutral-200 bg-white p-5 shadow-sm",children:[s.jsx("div",{className:"mb-4 flex flex-wrap gap-2",children:toe.map(y=>s.jsx("button",{type:"button",onClick:()=>r(y),className:`rounded-full px-3.5 py-1.5 text-sm font-semibold transition ${n===y?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-600 hover:bg-neutral-200"}`,children:O5[y]},y))}),g&&s.jsxs("div",{className:"space-y-4",children:[Iht.map(y=>{const v=g[y.limitKey],w=a[y.key],j=y.display?y.display(w):w,E=v==null?"â":y.display?y.display(v):v,S=v!=null&&w>=v;return s.jsxs("label",{className:"block",children:[s.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs",children:[s.jsx("span",{className:"font-medium text-neutral-700",children:y.label}),s.jsxs("span",{className:`font-mono ${S?"font-bold text-red-600":"text-neutral-500"}`,children:[j," / ",E]})]}),s.jsx("input",{type:"range",min:0,max:Pht(g,y),step:y.step,value:w,onChange:_=>i(k=>({...k,[y.key]:Number(_.target.value)})),className:"w-full accent-neutral-900"})]},y.key)}),s.jsxs("div",{className:"pt-1",children:[s.jsx("div",{className:"mb-2 text-xs font-medium text-neutral-700",children:"Scenarios"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:b.map(y=>s.jsx("button",{type:"button",onClick:()=>i(y.usage),className:"rounded-full border border-neutral-200 px-2.5 py-1 text-xs text-neutral-600 hover:bg-neutral-50",children:y.label},y.label))})]})]})]}),s.jsxs("div",{className:"rounded-2xl border border-neutral-200 bg-white p-5 shadow-sm",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsxs("h2",{className:"text-base font-semibold text-neutral-900",children:["What ",O5[n]," can do right now"]}),o&&s.jsxs("span",{className:"text-xs text-neutral-500",children:["per-call ceiling:"," ",s.jsx("span",{className:"font-mono",children:o.call_seconds_allowance==null?"uncapped":`${Math.floor(o.call_seconds_allowance/60)}m ${o.call_seconds_allowance%60}s`})]})]}),o?Object.entries(o.decisions).map(([y,v])=>s.jsx(Oht,{name:y,decision:v}
1592,y)):s.jsx("div",{className:"py-8 text-center text-sm text-neutral-400",children:"Evaluatingâ¦"}),g&&s.jsxs("div",{className:"mt-4 flex flex-wrap gap-x-5 gap-y-1 border-t border-neutral-100 pt-3 text-xs text-neutral-500",children:[s.jsxs("span",{children:["Answers reset: ",s.jsx("b",{children:g.answers_window})]}),s.jsxs("span",{children:["Badge: ",s.jsx("b",{children:g.powered_by_badge?"shown":"off"})]}),s.jsxs("span",{children:["Cloned voice: ",s.jsx("b",{children:g.cloned_voice?"yes":"no"})]}),s.jsxs("span",{children:["Embed: ",s.jsx("b",{children:g.embed_enabled?"yes":"no"})]}),s.jsxs("span",{children:["Top-up:"," ",s.jsx("b",{children:g.topup_cents_per_min==null?"â":`$${(g.topup_cents_per_min/100).toFixed(2)}/min`})]})]})]})]}),s.jsx(Mht,{matrix:c,running:d,onRun:x})]})}const $ht=`data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="640" height="360"><rect width="640" height="360" fill="#e7e3f6"/></svg>')}`,Fht=`data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="360" height="640"><rect width="360" height="640" fill="#d9d2f2"/><rect x="40" y="120" width="280" height="400" rx="24" fill="#c4b9ea"/></svg>')}`,Bht=e=>({...e,img:e.img||(ff(e)?Fht:$ht),thumbnailMode:"auto",thumbnailLink:e.url});[{id:"item_yt_featured",type:"video",provider:"youtube",title:"London Fog (full special) â YouTube, starred",url:"https://youtu.be/SaFuOr_iYlE?t=30",img:"https://i.ytimg.com/vi/SaFuOr_iYlE/hqdefault.jpg",duration:"1:02:14"},{id:"item_yt",type:"video",provider:"youtube",title:"Honorary Jones â YouTube",url:"https://youtu.be/G1EbecGkomk",img:"https://i.ytimg.com/vi/G1EbecGkomk/hqdefault.jpg",duration:"58:02"},{id:"item_yt_link",type:"video",provider:"youtube",title:"Modern Male â YouTube, set to open link",url:"https://youtu.be/VUuzkA0Qg6U",img:"https://i.ytimg.com/vi/VUuzkA0Qg6U/hqdefault.jpg",duration:"55:10",embed:!1},{id:"item_spotify_track",type:"podcast",provider:"spotify",title:"Never Gonna Give You Up â Spotify track",url:"https://open.spotify.com/track/4PTG3Z6ehGkBFwjybzWkR8",img:"https://i.scdn.co/image/ab67616d0000b27315ebbedaacef61af244262a8",duration:"3:33"},{id:"item_spotify_show",type:"podcast",provider:"spotify",title:"This Week in Zoltan â Spotify show",url:"https://open.spotify.com/show/2LC1TctbmJsFGjfkv7qE7O?si=4cecec19b2b645a4",img:""},{id:"item_short",type:"video",provider:"youtube",title:"YouTube Short â portrait tile, plays in place",url:"https://www.youtube.com/shorts/VFB4ZQT-Te8",img:"https://i.ytimg.com/vi/VFB4ZQT-Te8/hqdefault.jpg",duration:"0:42"},{id:"item_tiktok",type:"video",provider:"tiktok",title:"TikTok video (popup)",url:"https://www.tiktok.com/@scout2015/video/6718335390845095173",img:"",duration:"0:15"},{id:"item_vimeo",type:"video",provider:"vimeo",title:"Vimeo â stays a link",url:"https://vimeo.com/76979871",img:"https://i.vimeocdn.com/video/452001751-8216e0571c251a09d7a8387550942d77f7f693e40c5f7ce2d9aeb6ef9e8c2cb9-d_640",duration:"3:53"},{id:"item_instagram",type:"post",provider:"instagram",title:"Instagram post (popup)",url:"https://www.instagram.com/p/CUbHfhpswxt/",img:""},{id:"item_blog",type:"post",title:"A blog post â stays a link",url:"https://example.com/blog/post",img:"",meta:"example.com"}].map(Bht);function Uht(){const{pathname:e}=an();return f.useEffect(()=>{eR("ge_page_view")},[e]),null}function zht(){const{id:e}=Ef();return s.jsx(Pn,{to:`/creators/${e}`,replace:!0})}function Hht(){const{isAuthenticated:e,isLoading:t}=Ut(),{entry:n,isLoading:r}=N0();return t||e&&r?s.jsx(C_,{}):e?s.jsx(Pn,{to:n?.to||oc,replace:!0}):s.jsx(BYe,{})}const qht="429242245897-38kl6l5p3cnsib5ftvvpgs8qmo3nkd7r.apps.googleusercontent.com";function Wht({children:e}){return s.jsx(Kce,{children:s.jsx(Ube,{children:s.jsx(Gbe,{children:s.jsx(qbe,{children:s.jsxs(r0e,{children:[s.jsx(Uht,{}),s.jsx(yAe,{}),s.jsx(xAe,{}),e,s.jsx(eoe,{})]})})})})})}function Vht(){const e=s.jsx(Wht,{children:s.jsx(vh,{})});return s.jsx(Gce,{clientId:qht,children:e})}const Ght=[{Component:Vht,ErrorBoundary:jAe,children:[{path:"/welcome",Component:fKe,entry:!0},{path:"/creator",Component:FKe,entry:!0},{path:"/edu",Component:cXe,entry:!0},{path:"/beauty",Component:PXe,entry:!0},{path:"/forbusiness",Component:gct,entry:!0},{path:"/enterprise",Component:qct,entry:!0},{path:"/youtubers",Component:_Je,entry:!0},{path:"/login",Component:IAe,entry:!0},{path:"/signup",Component:qAe,entry:!0},{path:"/auth/callback",Component:ZAe},{path:"/forgot-password",Component:e3e},{path:"/reset-password",Component:s3e},{path:"/complete-account",Component:Cht},{path:"/u/:id",Component:zht}
1592,{path:"/embed/:widgetKey",Component:nut},{path:"/forcreators",Component:ylt,entry:!0},{path:"/forpractitioners",Component:wlt,entry:!0},{path:"/masterclass/wellness",element:s.jsx(Pn,{to:"/",replace:!0})},{path:"/masterclass",element:s.jsx(Pn,{to:"/",replace:!0})},{path:"/masterclass/tutor",element:s.jsx(Pn,{to:"/",replace:!0})},{path:"/masterclass/thankyou",Component:Tlt,entry:!0},{path:"/whyus",Component:Mlt,entry:!0},{path:"/unsubscribe",Component:xlt},{path:"/creators/:id",Component:Sz},{path:"/saas",element:s.jsx(Pn,{to:"/forbusiness",replace:!0})},{Component:S_e,children:[{Component:u_e,children:[{path:"/internal",Component:kot},{path:"/internal/users",Component:Got},{path:"/internal/users/:userId",Component:rlt},{path:"/internal/chats",Component:kit},{path:"/internal/profile-presets",Component:dlt}]}]},{Component:cAe,children:[{index:!0,Component:Hht,entry:!0},{path:"/privacy",Component:Zat,entry:!0},{path:"/terms",Component:nit,entry:!0},{path:"/data-deletion",Component:tit,entry:!0},{path:"/faq",Component:ait,entry:!0},{path:"/pricing",Component:fit,entry:!0},{path:"/explore",Component:BU},{path:"/explore/experts",Component:BU},{path:"/creators",Component:Hnt},{path:"/experts/:id/chat",Component:YU},{path:"/experts/:id/chat/:conversationId",Component:YU},{path:"/dashboard/creator",Component:Xat},{path:"/experts/new",Component:Vet},...wu?[{path:"/dev/journey",Component:Rht}]:[],...Ixe?[{path:"/dev/pricing-harness",Component:Dht}]:[],{Component:a_e,children:[{path:"/dashboard",Component:j5e},{path:"/dashboard/leads",Component:Gdt},{path:"/dashboard/live-chat",Component:Sht},{path:"/dashboard/embed",Component:SVe},{path:"/dashboard/inventory",Component:WGe},{path:"/lab",Component:kJe,children:[{index:!0,element:s.jsx(Pn,{to:"/lab/experts",replace:!0})},{path:"experts",Component:OB},{path:"drafts",element:s.jsx(Pn,{to:"/lab/experts",replace:!0})}]},{path:"/experts",Component:OB},{path:"/experts/:id/edit",Component:_tt},{path:"/myaccount",Component:Cst},{path:"/myaccount/page",Component:$nt},{path:"/myaccount/subscriptions",Component:wit},{path:"/profile",element:s.jsx(Pn,{to:"/myaccount",replace:!0})},{path:"/profile/page",element:s.jsx(Pn,{to:"/myaccount/page",replace:!0})},{path:"/profile/subscriptions",element:s.jsx(Pn,{to:"/myaccount/subscriptions",replace:!0})},{path:"/feedback",Component:Gct},{path:"/checkout/success",Component:plt},{path:"/checkout/cancel",Component:mlt}]}]},{path:"/:slug",Component:Sz},{path:"*",Component:flt}]}];qce({routes:Ght});const Yht=Object.freeze(Object.defineProperty({__proto__:null,Mermaid:Fte},Symbol.toStringTag,{value:"Module"}));export{Y9e as A,Ppt as L,Ti as R,cq as a,Koe as b,xc as g,s as j,f as r};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.