@xcelsior/ui-chat 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/preview.tsx +2 -1
- package/dist/index.d.mts +58 -5
- package/dist/index.d.ts +58 -5
- package/dist/index.js +1073 -473
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1060 -463
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
- package/src/components/BookingCancelledCard.tsx +103 -0
- package/src/components/BookingCards.stories.tsx +102 -0
- package/src/components/BookingConfirmationCard.tsx +170 -0
- package/src/components/BookingSlotPicker.stories.tsx +87 -0
- package/src/components/BookingSlotPicker.tsx +253 -0
- package/src/components/BrandIcons.stories.tsx +32 -1
- package/src/components/BrandIcons.tsx +21 -17
- package/src/components/Chat.tsx +78 -83
- package/src/components/ChatWidget.tsx +30 -3
- package/src/components/MessageItem.tsx +83 -72
- package/src/components/MessageList.tsx +4 -0
- package/src/hooks/useDraggablePosition.ts +147 -42
- package/src/hooks/useMessages.ts +119 -45
- package/src/hooks/useWebSocket.ts +17 -4
- package/src/index.tsx +11 -0
- package/src/types.ts +39 -2
- package/src/utils/api.ts +1 -0
- package/storybook-static/assets/BookingCancelledCard-XHuB-Ebp.js +31 -0
- package/storybook-static/assets/BookingCards.stories-DfJ482RS.js +66 -0
- package/storybook-static/assets/BookingSlotPicker-BkfssueW.js +1 -0
- package/storybook-static/assets/BookingSlotPicker.stories-fYlg1zLg.js +50 -0
- package/storybook-static/assets/BrandIcons-BsRAdWzL.js +4 -0
- package/storybook-static/assets/BrandIcons.stories-C6gBovfU.js +106 -0
- package/storybook-static/assets/Chat.stories-BrR7LHsz.js +830 -0
- package/storybook-static/assets/{Color-YHDXOIA2-BMnd3YrF.js → Color-YHDXOIA2-azE51u2m.js} +1 -1
- package/storybook-static/assets/{DocsRenderer-CFRXHY34-i_W8iCu9.js → DocsRenderer-CFRXHY34-jTmzKIDk.js} +3 -3
- package/storybook-static/assets/MessageItem-pEOwuLyh.js +34 -0
- package/storybook-static/assets/MessageItem.stories-Cs5Vtkle.js +422 -0
- package/storybook-static/assets/{entry-preview-oDnntGcx.js → entry-preview-vcpiajAT.js} +1 -1
- package/storybook-static/assets/globe-BtMvkLMD.js +31 -0
- package/storybook-static/assets/{iframe-CGBtu2Se.js → iframe-Cx1n-SeE.js} +2 -2
- package/storybook-static/assets/preview-B8y-wc-n.css +1 -0
- package/storybook-static/assets/preview-CC4t7T7W.js +1 -0
- package/storybook-static/assets/{preview-BRpahs9B.js → preview-Do3b3dZv.js} +2 -2
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.json +1 -1
- package/storybook-static/project.json +1 -1
- package/tsconfig.json +4 -0
- package/storybook-static/assets/BrandIcons-Cjy5INAp.js +0 -4
- package/storybook-static/assets/BrandIcons.stories-BeVC6svr.js +0 -64
- package/storybook-static/assets/Chat.stories-J_Yp51wU.js +0 -803
- package/storybook-static/assets/MessageItem-DAaKZ9s9.js +0 -14
- package/storybook-static/assets/MessageItem.stories-Ckr1_scc.js +0 -255
- package/storybook-static/assets/ToastContext-Bty1K7ya.js +0 -1
- package/storybook-static/assets/preview-DUOvJmsz.js +0 -1
- package/storybook-static/assets/preview-DcGwT3kv.css +0 -1
|
@@ -1,803 +0,0 @@
|
|
|
1
|
-
import{j as h}from"./jsx-runtime-Cf8x2fCZ.js";import{r as _,R as hs}from"./index--qcDGAq6.js";import{X as br,a as ms,C as gs}from"./BrandIcons-Cjy5INAp.js";import{S as Dt}from"./ToastContext-Bty1K7ya.js";import{r as bs}from"./index-B_4m48Mv.js";import{M as vs}from"./MessageItem-DAaKZ9s9.js";import"./index-yBjzXJbu.js";import"./en-US-BukEqXxE.js";import"./index-BLHw34Di.js";function ys(e,t){const[n,r]=_.useState(!1),[s,o]=_.useState(null),[i,l]=_.useState(null),c=_.useRef(null),u=_.useRef(null),a=_.useRef(0),f=_.useRef(null),m=5,v=3e3,d=!!t,g=_.useCallback(C=>{f.current&&C.removeEventListener("message",f.current);const R=M=>{var k,N,T;try{const j=JSON.parse(M.data);if(o(j),j.type==="message"&&j.data)(k=e.onMessageReceived)==null||k.call(e,j.data);else if(j.type==="error"){const z=new Error(((N=j.data)==null?void 0:N.message)||"WebSocket error");l(z),(T=e.onError)==null||T.call(e,z)}}catch(j){console.error("Failed to parse WebSocket message:",j)}};return C.addEventListener("message",R),f.current=R,()=>{C.removeEventListener("message",R),f.current===R&&(f.current=null)}},[]),b=_.useCallback(()=>{var C;console.log("connecting to WebSocket...",e.currentUser,e.conversationId);try{c.current&&(f.current&&(c.current.removeEventListener("message",f.current),f.current=null),c.current.close());const R=new URL(e.websocketUrl);R.searchParams.set("user",JSON.stringify(e.currentUser)),e.conversationId&&R.searchParams.set("conversationId",e.conversationId),e.apiKey&&R.searchParams.set("apiKey",e.apiKey);const M=new WebSocket(R.toString());M.onopen=()=>{var k;console.log("WebSocket connected"),r(!0),l(null),a.current=0,(k=e.onConnectionChange)==null||k.call(e,!0)},M.onerror=k=>{var T;console.error("WebSocket error:",k);const N=new Error("WebSocket connection error");l(N),(T=e.onError)==null||T.call(e,N)},M.onclose=k=>{var N;console.log("WebSocket closed:",k.code,k.reason),r(!1),(N=e.onConnectionChange)==null||N.call(e,!1),c.current=null,k.code!==1e3&&a.current<m&&(a.current+=1,console.log(`Reconnecting... (${a.current}/${m})`),u.current=setTimeout(()=>{b()},v))},g(M),c.current=M??null}catch(R){console.error("Failed to create WebSocket connection:",R);const M=R instanceof Error?R:new Error("Failed to connect");l(M),(C=e.onError)==null||C.call(e,M)}},[JSON.stringify([e.currentUser,e.conversationId])]),x=_.useCallback((C,R)=>{var M,k;if(!c.current||c.current.readyState!==WebSocket.OPEN){console.error("WebSocket is not connected"),(M=e.toast)==null||M.error("Not connected to chat server");return}try{c.current.send(JSON.stringify({action:C,data:R}))}catch(N){console.error("Failed to send message:",N);const T=N instanceof Error?N:new Error("Failed to send message");l(T),(k=e.onError)==null||k.call(e,T)}},[e]),S=_.useCallback(()=>{a.current=0,b()},[b]);return _.useEffect(()=>d?(r((t==null?void 0:t.readyState)===WebSocket.OPEN||!1),c.current=t,g(t)):(b(),()=>{u.current&&clearTimeout(u.current),c.current&&(f.current&&(c.current.removeEventListener("message",f.current),f.current=null),c.current.close(1e3,"Component unmounted"))}),[b,d,t,g]),{isConnected:d?(t==null?void 0:t.readyState)===WebSocket.OPEN||!1:n,sendMessage:x,lastMessage:s,error:i,reconnect:S}}function vr(e,t){return function(){return e.apply(t,arguments)}}const{toString:_s}=Object.prototype,{getPrototypeOf:Lt}=Object,{iterator:rt,toStringTag:yr}=Symbol,st=(e=>t=>{const n=_s.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ne=e=>(e=e.toLowerCase(),t=>st(t)===e),ot=e=>t=>typeof t===e,{isArray:xe}=Array,ve=ot("undefined");function Ae(e){return e!==null&&!ve(e)&&e.constructor!==null&&!ve(e.constructor)&&G(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const _r=ne("ArrayBuffer");function xs(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&_r(e.buffer),t}const ws=ot("string"),G=ot("function"),xr=ot("number"),Ne=e=>e!==null&&typeof e=="object",ks=e=>e===!0||e===!1,Ve=e=>{if(st(e)!=="object")return!1;const t=Lt(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(yr in e)&&!(rt in e)},Cs=e=>{if(!Ne(e)||Ae(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Ss=ne("Date"),$s=ne("File"),js=ne("Blob"),Es=ne("FileList"),Rs=e=>Ne(e)&&G(e.pipe),Ts=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||G(e.append)&&((t=st(e))==="formdata"||t==="object"&&G(e.toString)&&e.toString()==="[object FormData]"))},Ms=ne("URLSearchParams"),[Ps,Ls,As,Ns]=["ReadableStream","Request","Response","Headers"].map(ne),zs=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ze(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),xe(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Ae(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let l;for(r=0;r<i;r++)l=o[r],t.call(null,e[l],l,e)}}function wr(e,t){if(Ae(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const he=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,kr=e=>!ve(e)&&e!==he;function bt(){const{caseless:e,skipUndefined:t}=kr(this)&&this||{},n={},r=(s,o)=>{const i=e&&wr(n,o)||o;Ve(n[i])&&Ve(s)?n[i]=bt(n[i],s):Ve(s)?n[i]=bt({},s):xe(s)?n[i]=s.slice():(!t||!ve(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&ze(arguments[s],r);return n}const Os=(e,t,n,{allOwnKeys:r}={})=>(ze(t,(s,o)=>{n&&G(s)?e[o]=vr(s,n):e[o]=s},{allOwnKeys:r}),e),Is=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ds=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Us=(e,t,n,r)=>{let s,o,i;const l={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!l[i]&&(t[i]=e[i],l[i]=!0);e=n!==!1&&Lt(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Fs=(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},Bs=e=>{if(!e)return null;if(xe(e))return e;let t=e.length;if(!xr(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Hs=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Lt(Uint8Array)),qs=(e,t)=>{const r=(e&&e[rt]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Vs=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ws=ne("HTMLFormElement"),Js=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Ut=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ks=ne("RegExp"),Cr=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ze(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},Xs=e=>{Cr(e,(t,n)=>{if(G(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(G(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+"'")})}})},Gs=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return xe(e)?r(e):r(String(e).split(t)),n},Ys=()=>{},Zs=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Qs(e){return!!(e&&G(e.append)&&e[yr]==="FormData"&&e[rt])}const eo=e=>{const t=new Array(10),n=(r,s)=>{if(Ne(r)){if(t.indexOf(r)>=0)return;if(Ae(r))return r;if(!("toJSON"in r)){t[s]=r;const o=xe(r)?[]:{};return ze(r,(i,l)=>{const c=n(i,s+1);!ve(c)&&(o[l]=c)}),t[s]=void 0,o}}return r};return n(e,0)},to=ne("AsyncFunction"),no=e=>e&&(Ne(e)||G(e))&&G(e.then)&&G(e.catch),Sr=((e,t)=>e?setImmediate:t?((n,r)=>(he.addEventListener("message",({source:s,data:o})=>{s===he&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),he.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",G(he.postMessage)),ro=typeof queueMicrotask<"u"?queueMicrotask.bind(he):typeof process<"u"&&process.nextTick||Sr,so=e=>e!=null&&G(e[rt]),p={isArray:xe,isArrayBuffer:_r,isBuffer:Ae,isFormData:Ts,isArrayBufferView:xs,isString:ws,isNumber:xr,isBoolean:ks,isObject:Ne,isPlainObject:Ve,isEmptyObject:Cs,isReadableStream:Ps,isRequest:Ls,isResponse:As,isHeaders:Ns,isUndefined:ve,isDate:Ss,isFile:$s,isBlob:js,isRegExp:Ks,isFunction:G,isStream:Rs,isURLSearchParams:Ms,isTypedArray:Hs,isFileList:Es,forEach:ze,merge:bt,extend:Os,trim:zs,stripBOM:Is,inherits:Ds,toFlatObject:Us,kindOf:st,kindOfTest:ne,endsWith:Fs,toArray:Bs,forEachEntry:qs,matchAll:Vs,isHTMLForm:Ws,hasOwnProperty:Ut,hasOwnProp:Ut,reduceDescriptors:Cr,freezeMethods:Xs,toObjectSet:Gs,toCamelCase:Js,noop:Ys,toFiniteNumber:Zs,findKey:wr,global:he,isContextDefined:kr,isSpecCompliantForm:Qs,toJSONObject:eo,isAsyncFn:to,isThenable:no,setImmediate:Sr,asap:ro,isIterable:so};function P(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}p.inherits(P,Error,{toJSON:function(){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:p.toJSONObject(this.config),code:this.code,status:this.status}}});const $r=P.prototype,jr={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{jr[e]={value:e}});Object.defineProperties(P,jr);Object.defineProperty($r,"isAxiosError",{value:!0});P.from=(e,t,n,r,s,o)=>{const i=Object.create($r);p.toFlatObject(e,i,function(a){return a!==Error.prototype},u=>u!=="isAxiosError");const l=e&&e.message?e.message:"Error",c=t==null&&e?e.code:t;return P.call(i,l,c,n,r,s),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};const oo=null;function vt(e){return p.isPlainObject(e)||p.isArray(e)}function Er(e){return p.endsWith(e,"[]")?e.slice(0,-2):e}function Ft(e,t,n){return e?e.concat(t).map(function(s,o){return s=Er(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function io(e){return p.isArray(e)&&!e.some(vt)}const ao=p.toFlatObject(p,{},null,function(t){return/^is[A-Z]/.test(t)});function it(e,t,n){if(!p.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=p.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,b){return!p.isUndefined(b[g])});const r=n.metaTokens,s=n.visitor||a,o=n.dots,i=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(t);if(!p.isFunction(s))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(p.isDate(d))return d.toISOString();if(p.isBoolean(d))return d.toString();if(!c&&p.isBlob(d))throw new P("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(d)||p.isTypedArray(d)?c&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function a(d,g,b){let x=d;if(d&&!b&&typeof d=="object"){if(p.endsWith(g,"{}"))g=r?g:g.slice(0,-2),d=JSON.stringify(d);else if(p.isArray(d)&&io(d)||(p.isFileList(d)||p.endsWith(g,"[]"))&&(x=p.toArray(d)))return g=Er(g),x.forEach(function(w,C){!(p.isUndefined(w)||w===null)&&t.append(i===!0?Ft([g],C,o):i===null?g:g+"[]",u(w))}),!1}return vt(d)?!0:(t.append(Ft(b,g,o),u(d)),!1)}const f=[],m=Object.assign(ao,{defaultVisitor:a,convertValue:u,isVisitable:vt});function v(d,g){if(!p.isUndefined(d)){if(f.indexOf(d)!==-1)throw Error("Circular reference detected in "+g.join("."));f.push(d),p.forEach(d,function(x,S){(!(p.isUndefined(x)||x===null)&&s.call(t,x,p.isString(S)?S.trim():S,g,m))===!0&&v(x,g?g.concat(S):[S])}),f.pop()}}if(!p.isObject(e))throw new TypeError("data must be an object");return v(e),t}function Bt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function At(e,t){this._pairs=[],e&&it(e,this,t)}const Rr=At.prototype;Rr.append=function(t,n){this._pairs.push([t,n])};Rr.toString=function(t){const n=t?function(r){return t.call(this,r,Bt)}:Bt;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function lo(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Tr(e,t,n){if(!t)return e;const r=n&&n.encode||lo;p.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(s?o=s(t,n):o=p.isURLSearchParams(t)?t.toString():new At(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Ht{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){p.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Mr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},co=typeof URLSearchParams<"u"?URLSearchParams:At,uo=typeof FormData<"u"?FormData:null,fo=typeof Blob<"u"?Blob:null,po={isBrowser:!0,classes:{URLSearchParams:co,FormData:uo,Blob:fo},protocols:["http","https","file","blob","url","data"]},Nt=typeof window<"u"&&typeof document<"u",yt=typeof navigator=="object"&&navigator||void 0,ho=Nt&&(!yt||["ReactNative","NativeScript","NS"].indexOf(yt.product)<0),mo=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",go=Nt&&window.location.href||"http://localhost",bo=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Nt,hasStandardBrowserEnv:ho,hasStandardBrowserWebWorkerEnv:mo,navigator:yt,origin:go},Symbol.toStringTag,{value:"Module"})),J={...bo,...po};function vo(e,t){return it(e,new J.classes.URLSearchParams,{visitor:function(n,r,s,o){return J.isNode&&p.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function yo(e){return p.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function _o(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function Pr(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const l=Number.isFinite(+i),c=o>=n.length;return i=!i&&p.isArray(s)?s.length:i,c?(p.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!l):((!s[i]||!p.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&p.isArray(s[i])&&(s[i]=_o(s[i])),!l)}if(p.isFormData(e)&&p.isFunction(e.entries)){const n={};return p.forEachEntry(e,(r,s)=>{t(yo(r),s,n,0)}),n}return null}function xo(e,t,n){if(p.isString(e))try{return(t||JSON.parse)(e),p.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Oe={transitional:Mr,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=p.isObject(t);if(o&&p.isHTMLForm(t)&&(t=new FormData(t)),p.isFormData(t))return s?JSON.stringify(Pr(t)):t;if(p.isArrayBuffer(t)||p.isBuffer(t)||p.isStream(t)||p.isFile(t)||p.isBlob(t)||p.isReadableStream(t))return t;if(p.isArrayBufferView(t))return t.buffer;if(p.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return vo(t,this.formSerializer).toString();if((l=p.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return it(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),xo(t)):t}],transformResponse:[function(t){const n=this.transitional||Oe.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(p.isResponse(t)||p.isReadableStream(t))return t;if(t&&p.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(l){if(i)throw l.name==="SyntaxError"?P.from(l,P.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:J.classes.FormData,Blob:J.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],e=>{Oe.headers[e]={}});const wo=p.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"]),ko=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
-
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&wo[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},qt=Symbol("internals");function ke(e){return e&&String(e).trim().toLowerCase()}function We(e){return e===!1||e==null?e:p.isArray(e)?e.map(We):String(e)}function Co(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 So=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ut(e,t,n,r,s){if(p.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!p.isString(t)){if(p.isString(r))return t.indexOf(r)!==-1;if(p.isRegExp(r))return r.test(t)}}function $o(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function jo(e,t){const n=p.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let Y=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(l,c,u){const a=ke(c);if(!a)throw new Error("header name must be a non-empty string");const f=p.findKey(s,a);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||c]=We(l))}const i=(l,c)=>p.forEach(l,(u,a)=>o(u,a,c));if(p.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(p.isString(t)&&(t=t.trim())&&!So(t))i(ko(t),n);else if(p.isObject(t)&&p.isIterable(t)){let l={},c,u;for(const a of t){if(!p.isArray(a))throw TypeError("Object iterator must return a key-value pair");l[u=a[0]]=(c=l[u])?p.isArray(c)?[...c,a[1]]:[c,a[1]]:a[1]}i(l,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=ke(t),t){const r=p.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Co(s);if(p.isFunction(n))return n.call(this,s,r);if(p.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=ke(t),t){const r=p.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||ut(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=ke(i),i){const l=p.findKey(r,i);l&&(!n||ut(r,r[l],l,n))&&(delete r[l],s=!0)}}return p.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||ut(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return p.forEach(this,(s,o)=>{const i=p.findKey(r,o);if(i){n[i]=We(s),delete n[o];return}const l=t?$o(o):String(o).trim();l!==o&&delete n[o],n[l]=We(s),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return p.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&p.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(`
|
|
3
|
-
`)}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);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[qt]=this[qt]={accessors:{}}).accessors,s=this.prototype;function o(i){const l=ke(i);r[l]||(jo(s,i),r[l]=!0)}return p.isArray(t)?t.forEach(o):o(t),this}};Y.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);p.reduceDescriptors(Y.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});p.freezeMethods(Y);function dt(e,t){const n=this||Oe,r=t||n,s=Y.from(r.headers);let o=r.data;return p.forEach(e,function(l){o=l.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Lr(e){return!!(e&&e.__CANCEL__)}function we(e,t,n){P.call(this,e??"canceled",P.ERR_CANCELED,t,n),this.name="CanceledError"}p.inherits(we,P,{__CANCEL__:!0});function Ar(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new P("Request failed with status code "+n.status,[P.ERR_BAD_REQUEST,P.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Eo(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Ro(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),a=r[o];i||(i=u),n[s]=c,r[s]=u;let f=o,m=0;for(;f!==s;)m+=n[f++],f=f%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const v=a&&u-a;return v?Math.round(m*1e3/v):void 0}}function To(e,t){let n=0,r=1e3/t,s,o;const i=(u,a=Date.now())=>{n=a,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const a=Date.now(),f=a-n;f>=r?i(u,a):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-f)))},()=>s&&i(s)]}const Ge=(e,t,n=3)=>{let r=0;const s=Ro(50,250);return To(o=>{const i=o.loaded,l=o.lengthComputable?o.total:void 0,c=i-r,u=s(c),a=i<=l;r=i;const f={loaded:i,total:l,progress:l?i/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&a?(l-i)/u:void 0,event:o,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},Vt=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Wt=e=>(...t)=>p.asap(()=>e(...t)),Mo=J.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,J.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(J.origin),J.navigator&&/(msie|trident)/i.test(J.navigator.userAgent)):()=>!0,Po=J.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];p.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),p.isString(r)&&l.push(`path=${r}`),p.isString(s)&&l.push(`domain=${s}`),o===!0&&l.push("secure"),p.isString(i)&&l.push(`SameSite=${i}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Lo(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Ao(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Nr(e,t,n){let r=!Lo(t);return e&&(r||n==!1)?Ao(e,t):t}const Jt=e=>e instanceof Y?{...e}:e;function ge(e,t){t=t||{};const n={};function r(u,a,f,m){return p.isPlainObject(u)&&p.isPlainObject(a)?p.merge.call({caseless:m},u,a):p.isPlainObject(a)?p.merge({},a):p.isArray(a)?a.slice():a}function s(u,a,f,m){if(p.isUndefined(a)){if(!p.isUndefined(u))return r(void 0,u,f,m)}else return r(u,a,f,m)}function o(u,a){if(!p.isUndefined(a))return r(void 0,a)}function i(u,a){if(p.isUndefined(a)){if(!p.isUndefined(u))return r(void 0,u)}else return r(void 0,a)}function l(u,a,f){if(f in t)return r(u,a);if(f in e)return r(void 0,u)}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:l,headers:(u,a,f)=>s(Jt(u),Jt(a),f,!0)};return p.forEach(Object.keys({...e,...t}),function(a){const f=c[a]||s,m=f(e[a],t[a],a);p.isUndefined(m)&&f!==l||(n[a]=m)}),n}const zr=e=>{const t=ge({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:l}=t;if(t.headers=i=Y.from(i),t.url=Tr(Nr(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),p.isFormData(n)){if(J.hasStandardBrowserEnv||J.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(p.isFunction(n.getHeaders)){const c=n.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([a,f])=>{u.includes(a.toLowerCase())&&i.set(a,f)})}}if(J.hasStandardBrowserEnv&&(r&&p.isFunction(r)&&(r=r(t)),r||r!==!1&&Mo(t.url))){const c=s&&o&&Po.read(o);c&&i.set(s,c)}return t},No=typeof XMLHttpRequest<"u",zo=No&&function(e){return new Promise(function(n,r){const s=zr(e);let o=s.data;const i=Y.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=s,a,f,m,v,d;function g(){v&&v(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(a),s.signal&&s.signal.removeEventListener("abort",a)}let b=new XMLHttpRequest;b.open(s.method.toUpperCase(),s.url,!0),b.timeout=s.timeout;function x(){if(!b)return;const w=Y.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),R={data:!l||l==="text"||l==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:w,config:e,request:b};Ar(function(k){n(k),g()},function(k){r(k),g()},R),b=null}"onloadend"in b?b.onloadend=x:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(x)},b.onabort=function(){b&&(r(new P("Request aborted",P.ECONNABORTED,e,b)),b=null)},b.onerror=function(C){const R=C&&C.message?C.message:"Network Error",M=new P(R,P.ERR_NETWORK,e,b);M.event=C||null,r(M),b=null},b.ontimeout=function(){let C=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const R=s.transitional||Mr;s.timeoutErrorMessage&&(C=s.timeoutErrorMessage),r(new P(C,R.clarifyTimeoutError?P.ETIMEDOUT:P.ECONNABORTED,e,b)),b=null},o===void 0&&i.setContentType(null),"setRequestHeader"in b&&p.forEach(i.toJSON(),function(C,R){b.setRequestHeader(R,C)}),p.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),l&&l!=="json"&&(b.responseType=s.responseType),u&&([m,d]=Ge(u,!0),b.addEventListener("progress",m)),c&&b.upload&&([f,v]=Ge(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",v)),(s.cancelToken||s.signal)&&(a=w=>{b&&(r(!w||w.type?new we(null,e,b):w),b.abort(),b=null)},s.cancelToken&&s.cancelToken.subscribe(a),s.signal&&(s.signal.aborted?a():s.signal.addEventListener("abort",a)));const S=Eo(s.url);if(S&&J.protocols.indexOf(S)===-1){r(new P("Unsupported protocol "+S+":",P.ERR_BAD_REQUEST,e));return}b.send(o||null)})},Oo=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(u){if(!s){s=!0,l();const a=u instanceof Error?u:this.reason;r.abort(a instanceof P?a:new we(a instanceof Error?a.message:a))}};let i=t&&setTimeout(()=>{i=null,o(new P(`timeout ${t} of ms exceeded`,P.ETIMEDOUT))},t);const l=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:c}=r;return c.unsubscribe=()=>p.asap(l),c}},Io=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},Do=async function*(e,t){for await(const n of Uo(e))yield*Io(n,t)},Uo=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()}},Kt=(e,t,n,r)=>{const s=Do(e,t);let o=0,i,l=c=>{i||(i=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:a}=await s.next();if(u){l(),c.close();return}let f=a.byteLength;if(n){let m=o+=f;n(m)}c.enqueue(new Uint8Array(a))}catch(u){throw l(u),u}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},Xt=64*1024,{isFunction:Fe}=p,Fo=(({Request:e,Response:t})=>({Request:e,Response:t}))(p.global),{ReadableStream:Gt,TextEncoder:Yt}=p.global,Zt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Bo=e=>{e=p.merge.call({skipUndefined:!0},Fo,e);const{fetch:t,Request:n,Response:r}=e,s=t?Fe(t):typeof fetch=="function",o=Fe(n),i=Fe(r);if(!s)return!1;const l=s&&Fe(Gt),c=s&&(typeof Yt=="function"?(d=>g=>d.encode(g))(new Yt):async d=>new Uint8Array(await new n(d).arrayBuffer())),u=o&&l&&Zt(()=>{let d=!1;const g=new n(J.origin,{body:new Gt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!g}),a=i&&l&&Zt(()=>p.isReadableStream(new r("").body)),f={stream:a&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!f[d]&&(f[d]=(g,b)=>{let x=g&&g[d];if(x)return x.call(g);throw new P(`Response type '${d}' is not supported`,P.ERR_NOT_SUPPORT,b)})});const m=async d=>{if(d==null)return 0;if(p.isBlob(d))return d.size;if(p.isSpecCompliantForm(d))return(await new n(J.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(p.isArrayBufferView(d)||p.isArrayBuffer(d))return d.byteLength;if(p.isURLSearchParams(d)&&(d=d+""),p.isString(d))return(await c(d)).byteLength},v=async(d,g)=>{const b=p.toFiniteNumber(d.getContentLength());return b??m(g)};return async d=>{let{url:g,method:b,data:x,signal:S,cancelToken:w,timeout:C,onDownloadProgress:R,onUploadProgress:M,responseType:k,headers:N,withCredentials:T="same-origin",fetchOptions:j}=zr(d),z=t||fetch;k=k?(k+"").toLowerCase():"text";let U=Oo([S,w&&w.toAbortSignal()],C),te=null;const K=U&&U.unsubscribe&&(()=>{U.unsubscribe()});let re;try{if(M&&u&&b!=="get"&&b!=="head"&&(re=await v(N,x))!==0){let F=new n(g,{method:"POST",body:x,duplex:"half"}),A;if(p.isFormData(x)&&(A=F.headers.get("content-type"))&&N.setContentType(A),F.body){const[X,D]=Vt(re,Ge(Wt(M)));x=Kt(F.body,Xt,X,D)}}p.isString(T)||(T=T?"include":"omit");const B=o&&"credentials"in n.prototype,se={...j,signal:U,method:b.toUpperCase(),headers:N.normalize().toJSON(),body:x,duplex:"half",credentials:B?T:void 0};te=o&&new n(g,se);let I=await(o?z(te,j):z(g,se));const H=a&&(k==="stream"||k==="response");if(a&&(R||H&&K)){const F={};["status","statusText","headers"].forEach(Q=>{F[Q]=I[Q]});const A=p.toFiniteNumber(I.headers.get("content-length")),[X,D]=R&&Vt(A,Ge(Wt(R),!0))||[];I=new r(Kt(I.body,Xt,X,()=>{D&&D(),K&&K()}),F)}k=k||"text";let Z=await f[p.findKey(f,k)||"text"](I,d);return!H&&K&&K(),await new Promise((F,A)=>{Ar(F,A,{data:Z,headers:Y.from(I.headers),status:I.status,statusText:I.statusText,config:d,request:te})})}catch(B){throw K&&K(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new P("Network Error",P.ERR_NETWORK,d,te),{cause:B.cause||B}):P.from(B,B&&B.code,d,te)}}},Ho=new Map,Or=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,l=i,c,u,a=Ho;for(;l--;)c=o[l],u=a.get(c),u===void 0&&a.set(c,u=l?new Map:Bo(t)),a=u;return u};Or();const zt={http:oo,xhr:zo,fetch:{get:Or}};p.forEach(zt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Qt=e=>`- ${e}`,qo=e=>p.isFunction(e)||e===null||e===!1;function Vo(e,t){e=p.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){r=e[i];let l;if(s=r,!qo(r)&&(s=zt[(l=String(r)).toLowerCase()],s===void 0))throw new P(`Unknown adapter '${l}'`);if(s&&(p.isFunction(s)||(s=s.get(t))))break;o[l||"#"+i]=s}if(!s){const i=Object.entries(o).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?i.length>1?`since :
|
|
4
|
-
`+i.map(Qt).join(`
|
|
5
|
-
`):" "+Qt(i[0]):"as no adapter specified";throw new P("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const Ir={getAdapter:Vo,adapters:zt};function ft(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new we(null,e)}function en(e){return ft(e),e.headers=Y.from(e.headers),e.data=dt.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ir.getAdapter(e.adapter||Oe.adapter,e)(e).then(function(r){return ft(e),r.data=dt.call(e,e.transformResponse,r),r.headers=Y.from(r.headers),r},function(r){return Lr(r)||(ft(e),r&&r.response&&(r.response.data=dt.call(e,e.transformResponse,r.response),r.response.headers=Y.from(r.response.headers))),Promise.reject(r)})}const Dr="1.13.2",at={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{at[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const tn={};at.transitional=function(t,n,r){function s(o,i){return"[Axios v"+Dr+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,l)=>{if(t===!1)throw new P(s(i," has been removed"+(n?" in "+n:"")),P.ERR_DEPRECATED);return n&&!tn[i]&&(tn[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,l):!0}};at.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Wo(e,t,n){if(typeof e!="object")throw new P("options must be an object",P.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const l=e[o],c=l===void 0||i(l,o,e);if(c!==!0)throw new P("option "+o+" must be "+c,P.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new P("Unknown option "+o,P.ERR_BAD_OPTION)}}const Je={assertOptions:Wo,validators:at},oe=Je.validators;let me=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ht,response:new Ht}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
-
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ge(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Je.assertOptions(r,{silentJSONParsing:oe.transitional(oe.boolean),forcedJSONParsing:oe.transitional(oe.boolean),clarifyTimeoutError:oe.transitional(oe.boolean)},!1),s!=null&&(p.isFunction(s)?n.paramsSerializer={serialize:s}:Je.assertOptions(s,{encode:oe.function,serialize:oe.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Je.assertOptions(n,{baseUrl:oe.spelling("baseURL"),withXsrfToken:oe.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&p.merge(o.common,o[n.method]);o&&p.forEach(["delete","get","head","post","put","patch","common"],d=>{delete o[d]}),n.headers=Y.concat(i,o);const l=[];let c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(c=c&&g.synchronous,l.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let a,f=0,m;if(!c){const d=[en.bind(this),void 0];for(d.unshift(...l),d.push(...u),m=d.length,a=Promise.resolve(n);f<m;)a=a.then(d[f++],d[f++]);return a}m=l.length;let v=n;for(;f<m;){const d=l[f++],g=l[f++];try{v=d(v)}catch(b){g.call(this,b);break}}try{a=en.call(this,v)}catch(d){return Promise.reject(d)}for(f=0,m=u.length;f<m;)a=a.then(u[f++],u[f++]);return a}getUri(t){t=ge(this.defaults,t);const n=Nr(t.baseURL,t.url,t.allowAbsoluteUrls);return Tr(n,t.params,t.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(t){me.prototype[t]=function(n,r){return this.request(ge(r||{},{method:t,url:n,data:(r||{}).data}))}});p.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,l){return this.request(ge(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}me.prototype[t]=n(),me.prototype[t+"Form"]=n(!0)});let Jo=class Ur{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(l=>{r.subscribe(l),o=l}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,l){r.reason||(r.reason=new we(o,i,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 Ur(function(s){t=s}),cancel:t}}};function Ko(e){return function(n){return e.apply(null,n)}}function Xo(e){return p.isObject(e)&&e.isAxiosError===!0}const _t={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent: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(_t).forEach(([e,t])=>{_t[t]=e});function Fr(e){const t=new me(e),n=vr(me.prototype.request,t);return p.extend(n,me.prototype,t,{allOwnKeys:!0}),p.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Fr(ge(e,s))},n}const O=Fr(Oe);O.Axios=me;O.CanceledError=we;O.CancelToken=Jo;O.isCancel=Lr;O.VERSION=Dr;O.toFormData=it;O.AxiosError=P;O.Cancel=O.CanceledError;O.all=function(t){return Promise.all(t)};O.spread=Ko;O.isAxiosError=Xo;O.mergeConfig=ge;O.AxiosHeaders=Y;O.formToJSON=e=>Pr(p.isHTMLForm(e)?new FormData(e):e);O.getAdapter=Ir.getAdapter;O.HttpStatusCode=_t;O.default=O;const{Axios:sa,AxiosError:oa,CanceledError:ia,isCancel:aa,CancelToken:la,VERSION:ca,all:ua,Cancel:da,isAxiosError:fa,spread:pa,toFormData:ha,AxiosHeaders:ma,HttpStatusCode:ga,formToJSON:ba,getAdapter:va,mergeConfig:ya}=O;async function nn(e,t,n){var r,s,o,i;try{const l=await O.get(`${e}/messages`,{params:{conversationId:t.conversationId,limit:t.limit||50,pageToken:t.pageToken},headers:{"Content-Type":"application/json",...n}});return{data:l.data.data??[],nextPageToken:(r=l.data.pagination)==null?void 0:r.nextPageToken}}catch(l){throw O.isAxiosError(l)?new Error(((i=(o=(s=l.response)==null?void 0:s.data)==null?void 0:o.error)==null?void 0:i.message)||l.message||"Failed to fetch messages"):l}}function Go(e,t){const[n,r]=_.useState([]),[s,o]=_.useState(!1),[i,l]=_.useState(null),[c,u]=_.useState(void 0),[a,f]=_.useState(!0),[m,v]=_.useState(!1),{httpApiUrl:d,conversationId:g,headers:b,onError:x,toast:S}=t,w=_.useMemo(()=>({...b,"x-api-key":t.apiKey}),[b,t.apiKey]);_.useEffect(()=>{(async()=>{if(!(!d||!g)){o(!0),l(null);try{const j=await nn(d,{conversationId:g,limit:20},w);r(j.data),u(j.nextPageToken),f(!!j.nextPageToken)}catch(j){const z=j instanceof Error?j:new Error("Failed to load messages");l(z),x==null||x(z),S==null||S.error("Failed to load existing messages")}finally{o(!1)}}})()},[g,d,w,x,S]);const{onMessageReceived:C}=t;_.useEffect(()=>{var T;if(((T=e.lastMessage)==null?void 0:T.type)==="message"&&e.lastMessage.data){const j=e.lastMessage.data;if(g&&j.conversationId!==g)return;r(z=>z.some(U=>U.id===j.id)?z:[...z,j]),C==null||C(j)}},[e.lastMessage,C,g]);const R=_.useCallback(T=>{r(j=>j.some(z=>z.id===T.id)?j:[...j,T])},[]),M=_.useCallback((T,j)=>{r(z=>z.map(U=>U.id===T?{...U,status:j}:U))},[]),k=_.useCallback(()=>{r([])},[]),N=_.useCallback(async()=>{if(!(!a||m||!d||!g||!c)){v(!0),l(null);try{const T=await nn(d,{conversationId:g,limit:20,pageToken:c},w);r(j=>[...T.data,...j]),u(T.nextPageToken),f(!!T.nextPageToken)}catch(T){const j=T instanceof Error?T:new Error("Failed to load more messages");l(j),x==null||x(j)}finally{v(!1)}}},[a,m,d,g,c,w,x]);return{messages:n,addMessage:R,updateMessageStatus:M,clearMessages:k,isLoading:s,error:i,loadMore:N,hasMore:a,isLoadingMore:m}}function Yo(e,t){const[n,r]=_.useState(!1),[s,o]=_.useState(0),[i,l]=_.useState(null),u={...{maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/jpg","image/png","image/gif","image/webp","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","text/csv"]},...t},a=!!(t!=null&&t.uploadUrl),f=v=>u.allowedTypes.includes(v.type)?v.size>u.maxFileSize?`File size ${(v.size/1024/1024).toFixed(2)}MB exceeds the maximum allowed size of ${(u.maxFileSize/1024/1024).toFixed(2)}MB`:null:`File type ${v.type} is not supported. Allowed types: ${u.allowedTypes.join(", ")}`;return{uploadFile:async v=>{if(!(t!=null&&t.uploadUrl)){const g=new Error("File upload URL is not configured");throw l(g),g}const d=f(v);if(d){const g=new Error(d);throw l(g),g}r(!0),o(0),l(null);try{const g=await O.post(t.uploadUrl,{fileName:v.name,contentType:v.type,fileSize:v.size},{headers:{"Content-Type":"application/json","x-api-key":e||"",...t.headers}}),{uploadUrl:b,attachmentUrl:x}=g.data.data||g.data;if(!b||!x)throw new Error("Failed to get upload URL from server");return await O.put(b,v,{headers:{"Content-Type":v.type},onUploadProgress:S=>{if(S.total){const w=Math.round(S.loaded*100/S.total);o(w)}}}),{url:x,name:v.name,size:v.size,type:v.type,markdown:v.type.startsWith("image/")?``:`[${v.name}](${x})`}}catch(g){console.error("File upload failed:",g);const b=g instanceof Error?g:new Error("Upload failed");throw l(b),b}finally{r(!1),o(0)}},isUploading:n,uploadProgress:s,error:i,canUpload:a}}function Zo(e){const[t,n]=_.useState([]);return _.useEffect(()=>{var r;if(((r=e.lastMessage)==null?void 0:r.type)==="typing"&&e.lastMessage.data){const{userId:s,isTyping:o}=e.lastMessage.data;n(o?i=>i.includes(s)?i:[...i,s]:i=>i.filter(l=>l!==s))}},[e.lastMessage]),{isTyping:t.length>0,typingUsers:t}}function xt({agent:e,onClose:t,onMinimize:n,theme:r}){return h.jsxs("div",{className:"relative text-white overflow-hidden",style:{background:["radial-gradient(ellipse at 30% 50%, rgba(0,50,255,0.4) 0%, transparent 60%)","radial-gradient(ellipse at 70% 30%, rgba(0,80,255,0.3) 0%, transparent 50%)","radial-gradient(ellipse at 50% 80%, rgba(0,30,200,0.3) 0%, transparent 60%)","linear-gradient(135deg, #0030cc 0%, #001a66 50%, #000d33 100%)"].join(", ")},children:[h.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 50%)"}}),h.jsxs("div",{className:"relative flex items-center justify-between px-4 py-6",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsxs("div",{className:"relative",children:[e!=null&&e.avatar?h.jsx("img",{src:e.avatar,alt:e.name,className:"h-10 w-10 rounded-full object-cover",style:{boxShadow:"0 2px 8px rgba(0,0,0,0.25)"}}):h.jsx("div",{style:{filter:"drop-shadow(0 2px 8px rgba(0,0,0,0.3))"},children:h.jsx(br,{size:28,color:"white"})}),(e==null?void 0:e.status)==="online"&&h.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full",style:{backgroundColor:(r==null?void 0:r.statusPositive)||"#1ed473",border:"2.5px solid rgba(0,50,180,0.9)",boxShadow:`0 0 8px ${(r==null?void 0:r.statusPositive)||"#1ed473"}80`}})]}),h.jsxs("div",{children:[h.jsx("h3",{className:"font-semibold leading-tight",style:{fontSize:"15px",letterSpacing:"-0.01em"},children:(e==null?void 0:e.name)||"Xcelsior Software"}),h.jsx("p",{className:"mt-0.5 leading-tight",style:{fontSize:"12px",letterSpacing:"0.015em",color:"rgba(255,255,255,0.6)"},children:(e==null?void 0:e.status)==="online"?h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{backgroundColor:(r==null?void 0:r.statusPositive)||"#1ed473",boxShadow:`0 0 4px ${(r==null?void 0:r.statusPositive)||"#1ed473"}60`}}),"Online now"]}):(e==null?void 0:e.status)==="away"?"Away":"We typically reply within minutes"})]})]}),h.jsx("div",{className:"flex items-center gap-0.5",children:(n||t)&&h.jsx("button",{type:"button",onClick:n||t,className:"p-2 rounded-lg transition-all duration-150",style:{backgroundColor:"transparent"},onMouseEnter:s=>{s.currentTarget.style.backgroundColor="rgba(255,255,255,0.1)"},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent"},"aria-label":"Minimize chat",children:h.jsxs("svg",{width:"18",height:"18",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[h.jsx("title",{children:"Minimize"}),h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})]})})})]}),h.jsx("div",{className:"h-px",style:{background:"linear-gradient(90deg, transparent 5%, rgba(255,255,255,0.12) 30%, rgba(255,255,255,0.12) 70%, transparent 95%)"}})]})}try{xt.displayName="ChatHeader",xt.__docgenInfo={description:"",displayName:"ChatHeader",props:{agent:{defaultValue:null,description:"",name:"agent",required:!1,type:{name:"IUser | undefined"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!1,type:{name:"(() => void) | undefined"}},onMinimize:{defaultValue:null,description:"",name:"onMinimize",required:!1,type:{name:"(() => void) | undefined"}},theme:{defaultValue:null,description:"",name:"theme",required:!1,type:{name:"IChatTheme | undefined"}}}}}catch{}function wt({messages:e,currentUser:t,isLoading:n=!1,isTyping:r=!1,typingUser:s,autoScroll:o=!0,onLoadMore:i,hasMore:l=!1,isLoadingMore:c=!1,theme:u}){const a=_.useRef(null),f=_.useRef(null),m=_.useRef(e.length),v=_.useRef(null),d=_.useRef(0),g=_.useRef(!1),b=_.useRef(!1),x=(u==null?void 0:u.background)||"#00001a",S=(()=>{if(!x.startsWith("#"))return!1;const k=x.replace("#",""),N=parseInt(k.substring(0,2),16),T=parseInt(k.substring(2,4),16),j=parseInt(k.substring(4,6),16);return(.299*N+.587*T+.114*j)/255>.5})(),w=(u==null?void 0:u.primary)||"#337eff",C=(u==null?void 0:u.text)||(S?"#1a1a2e":"#f7f7f8"),R=(u==null?void 0:u.textMuted)||(S?"rgba(0,0,0,0.4)":"rgba(247,247,248,0.45)");_.useEffect(()=>{o&&a.current&&(e.length>m.current&&!c&&a.current.scrollIntoView({behavior:"smooth"}),m.current=e.length)},[e.length,o,c]),_.useEffect(()=>{e.length>0&&a.current&&!n&&!g.current?(setTimeout(()=>{var k;(k=a.current)==null||k.scrollIntoView({behavior:"auto"}),setTimeout(()=>{b.current=!0},200)},100),g.current=!0):!n&&e.length===0&&!g.current&&(b.current=!0,g.current=!0)},[n,e.length]),_.useEffect(()=>{var k;if(c)d.current=((k=f.current)==null?void 0:k.scrollHeight)||0;else if(d.current>0&&f.current){const T=f.current.scrollHeight-d.current;f.current.scrollTop=T,d.current=0}},[c]);const M=_.useCallback(()=>{if(!f.current||!i||!l||c||!b.current)return;const{scrollTop:k}=f.current;k<100&&i()},[i,l,c]);return _.useEffect(()=>{const k=f.current;if(k)return k.addEventListener("scroll",M),()=>k.removeEventListener("scroll",M)},[M]),n?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx(Dt,{size:"lg"})}):e.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center px-8 py-10",children:[h.jsxs("div",{className:"relative mb-6",style:{width:72,height:72},children:[h.jsx("div",{className:"absolute inset-0 rounded-full",style:{background:`radial-gradient(circle, ${w}18 0%, transparent 70%)`,transform:"scale(2)"}}),h.jsx("div",{className:"relative flex items-center justify-center rounded-full",style:{width:72,height:72,background:S?`linear-gradient(135deg, ${w}15, rgba(0,0,0,0.02))`:`linear-gradient(135deg, ${w}20, rgba(255,255,255,0.03))`,boxShadow:S?"inset 0 0 0 1px rgba(0,0,0,0.06)":"inset 0 0 0 0.5px rgba(255,255,255,0.06), inset 0 1px 0 0 rgba(255,255,255,0.1)"},children:h.jsx(br,{size:32,color:w})})]}),h.jsx("h3",{className:"font-semibold mb-2",style:{color:C,fontSize:"17px",letterSpacing:"-0.01em"},children:"How can we help?"}),h.jsx("p",{className:"max-w-[240px]",style:{color:R,fontSize:"13px",lineHeight:"1.5",letterSpacing:"0.015em"},children:"Ask us anything. We are here to help you get the most out of Xcelsior."}),h.jsx("div",{className:"flex flex-wrap justify-center gap-2 mt-5",children:["Get started","Pricing","Support"].map(k=>h.jsx("span",{className:"px-3 py-1.5 rounded-full",style:{backgroundColor:S?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.03)",boxShadow:S?"inset 0 0 0 1px rgba(0,0,0,0.08)":"inset 0 0 0 0.5px rgba(255,255,255,0.08)",color:S?"rgba(0,0,0,0.5)":"rgba(247,247,248,0.5)",fontSize:"12px",letterSpacing:"0.015em"},children:k},k))})]}):h.jsxs("div",{ref:f,className:"flex-1 overflow-y-auto px-4 py-3",style:{scrollBehavior:"smooth"},children:[c&&h.jsx("div",{className:"flex justify-center py-3",children:h.jsx(Dt,{size:"sm"})}),h.jsx("div",{ref:v}),e.map(k=>h.jsx(vs,{message:k,currentUser:t,showAvatar:!0,showTimestamp:!0,theme:u},k.id)),r&&h.jsxs("div",{className:"flex gap-2.5 mb-3",children:[h.jsx("div",{className:"flex-shrink-0 mt-auto mb-5",children:h.jsx(ms,{size:28})}),h.jsxs("div",{className:"flex flex-col items-start",children:[h.jsx("div",{className:"px-4 py-3",style:{backgroundColor:S?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.04)",borderRadius:"18px 18px 18px 4px",boxShadow:S?"inset 0 0 0 1px rgba(0,0,0,0.06)":"inset 0 0 0 0.5px rgba(255,255,255,0.06), inset 0 1px 0 0 rgba(255,255,255,0.08)"},children:h.jsx("div",{className:"flex gap-1.5 items-center",style:{height:16},children:[0,1,2].map(k=>h.jsx("span",{className:"rounded-full animate-bounce",style:{width:5,height:5,backgroundColor:`${w}80`,animationDelay:`${k*.15}s`,animationDuration:"0.8s"}},k))})}),s&&h.jsxs("span",{className:"mt-1 px-1",style:{color:R,fontSize:"11px",letterSpacing:"0.019em"},children:[s," is typing..."]})]})]}),h.jsx("div",{ref:a})]})}try{wt.displayName="MessageList",wt.__docgenInfo={description:"",displayName:"MessageList",props:{messages:{defaultValue:null,description:"",name:"messages",required:!0,type:{name:"IMessage[]"}},currentUser:{defaultValue:null,description:"",name:"currentUser",required:!0,type:{name:"IUser"}},isLoading:{defaultValue:{value:"false"},description:"",name:"isLoading",required:!1,type:{name:"boolean | undefined"}},isTyping:{defaultValue:{value:"false"},description:"",name:"isTyping",required:!1,type:{name:"boolean | undefined"}},typingUser:{defaultValue:null,description:"",name:"typingUser",required:!1,type:{name:"string | undefined"}},autoScroll:{defaultValue:{value:"true"},description:"",name:"autoScroll",required:!1,type:{name:"boolean | undefined"}},onLoadMore:{defaultValue:null,description:"",name:"onLoadMore",required:!1,type:{name:"(() => void) | undefined"}},hasMore:{defaultValue:{value:"false"},description:"",name:"hasMore",required:!1,type:{name:"boolean | undefined"}},isLoadingMore:{defaultValue:{value:"false"},description:"",name:"isLoadingMore",required:!1,type:{name:"boolean | undefined"}},theme:{defaultValue:null,description:"",name:"theme",required:!1,type:{name:"IChatTheme | undefined"}}}}}catch{}function Br(e){return e&&e.__esModule?e.default:e}function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var lt,E,Hr,Le,qr,rn,Ye={},Vr=[],Qo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function ue(e,t){for(var n in t)e[n]=t[n];return e}function Wr(e){var t=e.parentNode;t&&t.removeChild(e)}function kt(e,t,n){var r,s,o,i={};for(o in t)o=="key"?r=t[o]:o=="ref"?s=t[o]:i[o]=t[o];if(arguments.length>2&&(i.children=arguments.length>3?lt.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)i[o]===void 0&&(i[o]=e.defaultProps[o]);return Ke(e,i,r,s,null)}function Ke(e,t,n,r,s){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:s??++Hr};return s==null&&E.vnode!=null&&E.vnode(o),o}function ae(){return{current:null}}function ye(e){return e.children}function ie(e,t){this.props=e,this.context=t}function _e(e,t){if(t==null)return e.__?_e(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?_e(e):null}function Jr(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return Jr(e)}}function sn(e){(!e.__d&&(e.__d=!0)&&Le.push(e)&&!Ze.__r++||rn!==E.debounceRendering)&&((rn=E.debounceRendering)||qr)(Ze)}function Ze(){for(var e;Ze.__r=Le.length;)e=Le.sort(function(t,n){return t.__v.__b-n.__v.__b}),Le=[],e.some(function(t){var n,r,s,o,i,l;t.__d&&(i=(o=(n=t).__v).__e,(l=n.__P)&&(r=[],(s=ue({},o)).__v=o.__v+1,Ot(l,o,s,n.__n,l.ownerSVGElement!==void 0,o.__h!=null?[i]:null,r,i??_e(o),o.__h),Yr(r,o),o.__e!=i&&Jr(o)))})}function Kr(e,t,n,r,s,o,i,l,c,u){var a,f,m,v,d,g,b,x=r&&r.__k||Vr,S=x.length;for(n.__k=[],a=0;a<t.length;a++)if((v=n.__k[a]=(v=t[a])==null||typeof v=="boolean"?null:typeof v=="string"||typeof v=="number"||typeof v=="bigint"?Ke(null,v,null,null,v):Array.isArray(v)?Ke(ye,{children:v},null,null,null):v.__b>0?Ke(v.type,v.props,v.key,null,v.__v):v)!=null){if(v.__=n,v.__b=n.__b+1,(m=x[a])===null||m&&v.key==m.key&&v.type===m.type)x[a]=void 0;else for(f=0;f<S;f++){if((m=x[f])&&v.key==m.key&&v.type===m.type){x[f]=void 0;break}m=null}Ot(e,v,m=m||Ye,s,o,i,l,c,u),d=v.__e,(f=v.ref)&&m.ref!=f&&(b||(b=[]),m.ref&&b.push(m.ref,null,v),b.push(f,v.__c||d,v)),d!=null?(g==null&&(g=d),typeof v.type=="function"&&v.__k===m.__k?v.__d=c=Xr(v,c,e):c=Gr(e,v,m,x,d,c),typeof n.type=="function"&&(n.__d=c)):c&&m.__e==c&&c.parentNode!=e&&(c=_e(m))}for(n.__e=g,a=S;a--;)x[a]!=null&&(typeof n.type=="function"&&x[a].__e!=null&&x[a].__e==n.__d&&(n.__d=_e(r,a+1)),Qr(x[a],x[a]));if(b)for(a=0;a<b.length;a++)Zr(b[a],b[++a],b[++a])}function Xr(e,t,n){for(var r,s=e.__k,o=0;s&&o<s.length;o++)(r=s[o])&&(r.__=e,t=typeof r.type=="function"?Xr(r,t,n):Gr(n,r,r,s,r.__e,t));return t}function Qe(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){Qe(n,t)}):t.push(e)),t}function Gr(e,t,n,r,s,o){var i,l,c;if(t.__d!==void 0)i=t.__d,t.__d=void 0;else if(n==null||s!=o||s.parentNode==null)e:if(o==null||o.parentNode!==e)e.appendChild(s),i=null;else{for(l=o,c=0;(l=l.nextSibling)&&c<r.length;c+=2)if(l==s)break e;e.insertBefore(s,o),i=o}return i!==void 0?i:s.nextSibling}function ei(e,t,n,r,s){var o;for(o in n)o==="children"||o==="key"||o in t||et(e,o,null,n[o],r);for(o in t)s&&typeof t[o]!="function"||o==="children"||o==="key"||o==="value"||o==="checked"||n[o]===t[o]||et(e,o,t[o],n[o],r)}function on(e,t,n){t[0]==="-"?e.setProperty(t,n):e[t]=n==null?"":typeof n!="number"||Qo.test(t)?n:n+"px"}function et(e,t,n,r,s){var o;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||on(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||on(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r||e.addEventListener(t,o?ln:an,o):e.removeEventListener(t,o?ln:an,o);else if(t!=="dangerouslySetInnerHTML"){if(s)t=t.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if(t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n!=null&&(n!==!1||t[0]==="a"&&t[1]==="r")?e.setAttribute(t,n):e.removeAttribute(t))}}function an(e){this.l[e.type+!1](E.event?E.event(e):e)}function ln(e){this.l[e.type+!0](E.event?E.event(e):e)}function Ot(e,t,n,r,s,o,i,l,c){var u,a,f,m,v,d,g,b,x,S,w,C=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(c=n.__h,l=t.__e=n.__e,t.__h=null,o=[l]),(u=E.__b)&&u(t);try{e:if(typeof C=="function"){if(b=t.props,x=(u=C.contextType)&&r[u.__c],S=u?x?x.props.value:u.__:r,n.__c?g=(a=t.__c=n.__c).__=a.__E:("prototype"in C&&C.prototype.render?t.__c=a=new C(b,S):(t.__c=a=new ie(b,S),a.constructor=C,a.render=ni),x&&x.sub(a),a.props=b,a.state||(a.state={}),a.context=S,a.__n=r,f=a.__d=!0,a.__h=[]),a.__s==null&&(a.__s=a.state),C.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=ue({},a.__s)),ue(a.__s,C.getDerivedStateFromProps(b,a.__s))),m=a.props,v=a.state,f)C.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(C.getDerivedStateFromProps==null&&b!==m&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(b,S),!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(b,a.__s,S)===!1||t.__v===n.__v){a.props=b,a.state=a.__s,t.__v!==n.__v&&(a.__d=!1),a.__v=t,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(R){R&&(R.__=t)}),a.__h.length&&i.push(a);break e}a.componentWillUpdate!=null&&a.componentWillUpdate(b,a.__s,S),a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(m,v,d)})}a.context=S,a.props=b,a.state=a.__s,(u=E.__r)&&u(t),a.__d=!1,a.__v=t,a.__P=e,u=a.render(a.props,a.state,a.context),a.state=a.__s,a.getChildContext!=null&&(r=ue(ue({},r),a.getChildContext())),f||a.getSnapshotBeforeUpdate==null||(d=a.getSnapshotBeforeUpdate(m,v)),w=u!=null&&u.type===ye&&u.key==null?u.props.children:u,Kr(e,Array.isArray(w)?w:[w],t,n,r,s,o,i,l,c),a.base=t.__e,t.__h=null,a.__h.length&&i.push(a),g&&(a.__E=a.__=null),a.__e=!1}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=ti(n.__e,t,n,r,s,o,i,c);(u=E.diffed)&&u(t)}catch(R){t.__v=null,(c||o!=null)&&(t.__e=l,t.__h=!!c,o[o.indexOf(l)]=null),E.__e(R,t,n)}}function Yr(e,t){E.__c&&E.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){E.__e(r,n.__v)}})}function ti(e,t,n,r,s,o,i,l){var c,u,a,f=n.props,m=t.props,v=t.type,d=0;if(v==="svg"&&(s=!0),o!=null){for(;d<o.length;d++)if((c=o[d])&&"setAttribute"in c==!!v&&(v?c.localName===v:c.nodeType===3)){e=c,o[d]=null;break}}if(e==null){if(v===null)return document.createTextNode(m);e=s?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,m.is&&m),o=null,l=!1}if(v===null)f===m||l&&e.data===m||(e.data=m);else{if(o=o&<.call(e.childNodes),u=(f=n.props||Ye).dangerouslySetInnerHTML,a=m.dangerouslySetInnerHTML,!l){if(o!=null)for(f={},d=0;d<e.attributes.length;d++)f[e.attributes[d].name]=e.attributes[d].value;(a||u)&&(a&&(u&&a.__html==u.__html||a.__html===e.innerHTML)||(e.innerHTML=a&&a.__html||""))}if(ei(e,m,f,s,l),a)t.__k=[];else if(d=t.props.children,Kr(e,Array.isArray(d)?d:[d],t,n,r,s&&v!=="foreignObject",o,i,o?o[0]:n.__k&&_e(n,0),l),o!=null)for(d=o.length;d--;)o[d]!=null&&Wr(o[d]);l||("value"in m&&(d=m.value)!==void 0&&(d!==f.value||d!==e.value||v==="progress"&&!d)&&et(e,"value",d,f.value,!1),"checked"in m&&(d=m.checked)!==void 0&&d!==e.checked&&et(e,"checked",d,f.checked,!1))}return e}function Zr(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){E.__e(r,n)}}function Qr(e,t,n){var r,s;if(E.unmount&&E.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Zr(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){E.__e(o,t)}r.base=r.__P=null}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&Qr(r[s],t,typeof e.type!="function");n||e.__e==null||Wr(e.__e),e.__e=e.__d=void 0}function ni(e,t,n){return this.constructor(e,n)}function es(e,t,n){var r,s,o;E.__&&E.__(e,t),s=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],Ot(t,e=(!r&&n||t).__k=kt(ye,null,[e]),s||Ye,Ye,t.ownerSVGElement!==void 0,!r&&n?[n]:s?null:t.firstChild?lt.call(t.childNodes):null,o,!r&&n?n:s?s.__e:t.firstChild,r),Yr(o,e)}lt=Vr.slice,E={__e:function(e,t){for(var n,r,s;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(e)),s=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e),s=n.__d),s)return n.__E=n}catch(o){e=o}throw e}},Hr=0,ie.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ue({},this.state),typeof e=="function"&&(e=e(ue({},n),this.props)),e&&ue(n,e),e!=null&&this.__v&&(t&&this.__h.push(t),sn(this))},ie.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),sn(this))},ie.prototype.render=ye,Le=[],qr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ze.__r=0;var ri=0;function y(e,t,n,r,s){var o,i,l={};for(i in t)i=="ref"?o=t[i]:l[i]=t[i];var c={type:e,props:l,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--ri,__source:r,__self:s};if(typeof e=="function"&&(o=e.defaultProps))for(i in o)l[i]===void 0&&(l[i]=o[i]);return E.vnode&&E.vnode(c),c}function si(e,t){try{window.localStorage[`emoji-mart.${e}`]=JSON.stringify(t)}catch{}}function oi(e){try{const t=window.localStorage[`emoji-mart.${e}`];if(t)return JSON.parse(t)}catch{}}var de={set:si,get:oi};const pt=new Map,ii=[{v:15,emoji:"🫨"},{v:14,emoji:"🫠"},{v:13.1,emoji:"😶🌫️"},{v:13,emoji:"🥸"},{v:12.1,emoji:"🧑🦰"},{v:12,emoji:"🥱"},{v:11,emoji:"🥰"},{v:5,emoji:"🤩"},{v:4,emoji:"👱♀️"},{v:3,emoji:"🤣"},{v:2,emoji:"👋🏻"},{v:1,emoji:"🙃"}];function ai(){for(const{v:e,emoji:t}of ii)if(ts(t))return e}function li(){return!ts("🇨🇦")}function ts(e){if(pt.has(e))return pt.get(e);const t=ci(e);return pt.set(e,t),t}const ci=(()=>{let e=null;try{navigator.userAgent.includes("jsdom")||(e=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}))}catch{}if(!e)return()=>!1;const t=25,n=20,r=Math.floor(t/2);return e.font=r+"px Arial, Sans-Serif",e.textBaseline="top",e.canvas.width=n*2,e.canvas.height=t,s=>{e.clearRect(0,0,n*2,t),e.fillStyle="#FF0000",e.fillText(s,0,22),e.fillStyle="#0000FF",e.fillText(s,n,22);const o=e.getImageData(0,0,n,t).data,i=o.length;let l=0;for(;l<i&&!o[l+3];l+=4);if(l>=i)return!1;const c=n+l/4%n,u=Math.floor(l/4/n),a=e.getImageData(c,u,1,1).data;return!(o[l]!==a[0]||o[l+2]!==a[2]||e.measureText(s).width>=n)}})();var cn={latestVersion:ai,noCountryFlags:li};const Ct=["+1","grinning","kissing_heart","heart_eyes","laughing","stuck_out_tongue_winking_eye","sweat_smile","joy","scream","disappointed","unamused","weary","sob","sunglasses","heart"];let V=null;function ui(e){V||(V=de.get("frequently")||{});const t=e.id||e;t&&(V[t]||(V[t]=0),V[t]+=1,de.set("last",t),de.set("frequently",V))}function di({maxFrequentRows:e,perLine:t}){if(!e)return[];V||(V=de.get("frequently"));let n=[];if(!V){V={};for(let o in Ct.slice(0,t)){const i=Ct[o];V[i]=t-o,n.push(i)}return n}const r=e*t,s=de.get("last");for(let o in V)n.push(o);if(n.sort((o,i)=>{const l=V[i],c=V[o];return l==c?o.localeCompare(i):l-c}),n.length>r){const o=n.slice(r);n=n.slice(0,r);for(let i of o)i!=s&&delete V[i];s&&n.indexOf(s)==-1&&(delete V[n[n.length-1]],n.splice(-1,1,s)),de.set("frequently",V)}return n}var ns={add:ui,get:di,DEFAULTS:Ct},rs={};rs=JSON.parse('{"search":"Search","search_no_results_1":"Oh no!","search_no_results_2":"That emoji couldn’t be found","pick":"Pick an emoji…","add_custom":"Add custom emoji","categories":{"activity":"Activity","custom":"Custom","flags":"Flags","foods":"Food & Drink","frequent":"Frequently used","nature":"Animals & Nature","objects":"Objects","people":"Smileys & People","places":"Travel & Places","search":"Search Results","symbols":"Symbols"},"skins":{"1":"Default","2":"Light","3":"Medium-Light","4":"Medium","5":"Medium-Dark","6":"Dark","choose":"Choose default skin tone"}}');var le={autoFocus:{value:!1},dynamicWidth:{value:!1},emojiButtonColors:{value:null},emojiButtonRadius:{value:"100%"},emojiButtonSize:{value:36},emojiSize:{value:24},emojiVersion:{value:15,choices:[1,2,3,4,5,11,12,12.1,13,13.1,14,15]},exceptEmojis:{value:[]},icons:{value:"auto",choices:["auto","outline","solid"]},locale:{value:"en",choices:["en","ar","be","cs","de","es","fa","fi","fr","hi","it","ja","ko","nl","pl","pt","ru","sa","tr","uk","vi","zh"]},maxFrequentRows:{value:4},navPosition:{value:"top",choices:["top","bottom","none"]},noCountryFlags:{value:!1},noResultsEmoji:{value:null},perLine:{value:9},previewEmoji:{value:null},previewPosition:{value:"bottom",choices:["top","bottom","none"]},searchPosition:{value:"sticky",choices:["sticky","static","none"]},set:{value:"native",choices:["native","apple","facebook","google","twitter"]},skin:{value:1,choices:[1,2,3,4,5,6]},skinTonePosition:{value:"preview",choices:["preview","search","none"]},theme:{value:"auto",choices:["auto","light","dark"]},categories:null,categoryIcons:null,custom:null,data:null,i18n:null,getImageURL:null,getSpritesheetURL:null,onAddCustomEmoji:null,onClickOutside:null,onEmojiSelect:null,stickySearch:{deprecated:!0,value:!0}};let W=null,L=null;const ht={};async function un(e){if(ht[e])return ht[e];const n=await(await fetch(e)).json();return ht[e]=n,n}let mt=null,ss=null,os=!1;function ct(e,{caller:t}={}){return mt||(mt=new Promise(n=>{ss=n})),e?fi(e):t&&!os&&console.warn(`\`${t}\` requires data to be initialized first. Promise will be pending until \`init\` is called.`),mt}async function fi(e){os=!0;let{emojiVersion:t,set:n,locale:r}=e;if(t||(t=le.emojiVersion.value),n||(n=le.set.value),r||(r=le.locale.value),L)L.categories=L.categories.filter(c=>!c.name);else{L=(typeof e.data=="function"?await e.data():e.data)||await un(`https://cdn.jsdelivr.net/npm/@emoji-mart/data@latest/sets/${t}/${n}.json`),L.emoticons={},L.natives={},L.categories.unshift({id:"frequent",emojis:[]});for(const c in L.aliases){const u=L.aliases[c],a=L.emojis[u];a&&(a.aliases||(a.aliases=[]),a.aliases.push(c))}L.originalCategories=L.categories}if(W=(typeof e.i18n=="function"?await e.i18n():e.i18n)||(r=="en"?Br(rs):await un(`https://cdn.jsdelivr.net/npm/@emoji-mart/data@latest/i18n/${r}.json`)),e.custom)for(let c in e.custom){c=parseInt(c);const u=e.custom[c],a=e.custom[c-1];if(!(!u.emojis||!u.emojis.length)){u.id||(u.id=`custom_${c+1}`),u.name||(u.name=W.categories.custom),a&&!u.icon&&(u.target=a.target||a),L.categories.push(u);for(const f of u.emojis)L.emojis[f.id]=f}}e.categories&&(L.categories=L.originalCategories.filter(c=>e.categories.indexOf(c.id)!=-1).sort((c,u)=>{const a=e.categories.indexOf(c.id),f=e.categories.indexOf(u.id);return a-f}));let s=null,o=null;n=="native"&&(s=cn.latestVersion(),o=e.noCountryFlags||cn.noCountryFlags());let i=L.categories.length,l=!1;for(;i--;){const c=L.categories[i];if(c.id=="frequent"){let{maxFrequentRows:f,perLine:m}=e;f=f>=0?f:le.maxFrequentRows.value,m||(m=le.perLine.value),c.emojis=ns.get({maxFrequentRows:f,perLine:m})}if(!c.emojis||!c.emojis.length){L.categories.splice(i,1);continue}const{categoryIcons:u}=e;if(u){const f=u[c.id];f&&!c.icon&&(c.icon=f)}let a=c.emojis.length;for(;a--;){const f=c.emojis[a],m=f.id?f:L.emojis[f],v=()=>{c.emojis.splice(a,1)};if(!m||e.exceptEmojis&&e.exceptEmojis.includes(m.id)){v();continue}if(s&&m.version>s){v();continue}if(o&&c.id=="flags"&&!bi.includes(m.id)){v();continue}if(!m.search){if(l=!0,m.search=","+[[m.id,!1],[m.name,!0],[m.keywords,!1],[m.emoticons,!1]].map(([g,b])=>{if(g)return(Array.isArray(g)?g:[g]).map(x=>(b?x.split(/[-|_|\s]+/):[x]).map(S=>S.toLowerCase())).flat()}).flat().filter(g=>g&&g.trim()).join(","),m.emoticons)for(const g of m.emoticons)L.emoticons[g]||(L.emoticons[g]=m.id);let d=0;for(const g of m.skins){if(!g)continue;d++;const{native:b}=g;b&&(L.natives[b]=m.id,m.search+=`,${b}`);const x=d==1?"":`:skin-tone-${d}:`;g.shortcodes=`:${m.id}:${x}`}}}}l&&be.reset(),ss()}function is(e,t,n){e||(e={});const r={};for(let s in t)r[s]=as(s,e,t,n);return r}function as(e,t,n,r){const s=n[e];let o=r&&r.getAttribute(e)||(t[e]!=null&&t[e]!=null?t[e]:null);return s&&(o!=null&&s.value&&typeof s.value!=typeof o&&(typeof s.value=="boolean"?o=o!="false":o=s.value.constructor(o)),s.transform&&o&&(o=s.transform(o)),(o==null||s.choices&&s.choices.indexOf(o)==-1)&&(o=s.value)),o}const pi=/^(?:\:([^\:]+)\:)(?:\:skin-tone-(\d)\:)?$/;let St=null;function hi(e){return e.id?e:L.emojis[e]||L.emojis[L.aliases[e]]||L.emojis[L.natives[e]]}function mi(){St=null}async function gi(e,{maxResults:t,caller:n}={}){if(!e||!e.trim().length)return null;t||(t=90),await ct(null,{caller:n||"SearchIndex.search"});const r=e.toLowerCase().replace(/(\w)-/,"$1 ").split(/[\s|,]+/).filter((l,c,u)=>l.trim()&&u.indexOf(l)==c);if(!r.length)return;let s=St||(St=Object.values(L.emojis)),o,i;for(const l of r){if(!s.length)break;o=[],i={};for(const c of s){if(!c.search)continue;const u=c.search.indexOf(`,${l}`);u!=-1&&(o.push(c),i[c.id]||(i[c.id]=0),i[c.id]+=c.id==l?0:u+1)}s=o}return o.length<2||(o.sort((l,c)=>{const u=i[l.id],a=i[c.id];return u==a?l.id.localeCompare(c.id):u-a}),o.length>t&&(o=o.slice(0,t))),o}var be={search:gi,get:hi,reset:mi,SHORTCODES_REGEX:pi};const bi=["checkered_flag","crossed_flags","pirate_flag","rainbow-flag","transgender_flag","triangular_flag_on_post","waving_black_flag","waving_white_flag"];function vi(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((n,r)=>n==t[r])}async function yi(e=1){for(let t in[...Array(e).keys()])await new Promise(requestAnimationFrame)}function _i(e,{skinIndex:t=0}={}){const n=e.skins[t]||(t=0,e.skins[t]),r={id:e.id,name:e.name,native:n.native,unified:n.unified,keywords:e.keywords,shortcodes:n.shortcodes||e.shortcodes};return e.skins.length>1&&(r.skin=t+1),n.src&&(r.src=n.src),e.aliases&&e.aliases.length&&(r.aliases=e.aliases),e.emoticons&&e.emoticons.length&&(r.emoticons=e.emoticons),r}const xi={activity:{outline:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:y("path",{d:"M12 0C5.373 0 0 5.372 0 12c0 6.627 5.373 12 12 12 6.628 0 12-5.373 12-12 0-6.628-5.372-12-12-12m9.949 11H17.05c.224-2.527 1.232-4.773 1.968-6.113A9.966 9.966 0 0 1 21.949 11M13 11V2.051a9.945 9.945 0 0 1 4.432 1.564c-.858 1.491-2.156 4.22-2.392 7.385H13zm-2 0H8.961c-.238-3.165-1.536-5.894-2.393-7.385A9.95 9.95 0 0 1 11 2.051V11zm0 2v8.949a9.937 9.937 0 0 1-4.432-1.564c.857-1.492 2.155-4.221 2.393-7.385H11zm4.04 0c.236 3.164 1.534 5.893 2.392 7.385A9.92 9.92 0 0 1 13 21.949V13h2.04zM4.982 4.887C5.718 6.227 6.726 8.473 6.951 11h-4.9a9.977 9.977 0 0 1 2.931-6.113M2.051 13h4.9c-.226 2.527-1.233 4.771-1.969 6.113A9.972 9.972 0 0 1 2.051 13m16.967 6.113c-.735-1.342-1.744-3.586-1.968-6.113h4.899a9.961 9.961 0 0 1-2.931 6.113"})}),solid:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:y("path",{d:"M16.17 337.5c0 44.98 7.565 83.54 13.98 107.9C35.22 464.3 50.46 496 174.9 496c9.566 0 19.59-.4707 29.84-1.271L17.33 307.3C16.53 317.6 16.17 327.7 16.17 337.5zM495.8 174.5c0-44.98-7.565-83.53-13.98-107.9c-4.688-17.54-18.34-31.23-36.04-35.95C435.5 27.91 392.9 16 337 16c-9.564 0-19.59 .4707-29.84 1.271l187.5 187.5C495.5 194.4 495.8 184.3 495.8 174.5zM26.77 248.8l236.3 236.3c142-36.1 203.9-150.4 222.2-221.1L248.9 26.87C106.9 62.96 45.07 177.2 26.77 248.8zM256 335.1c0 9.141-7.474 16-16 16c-4.094 0-8.188-1.564-11.31-4.689L164.7 283.3C161.6 280.2 160 276.1 160 271.1c0-8.529 6.865-16 16-16c4.095 0 8.189 1.562 11.31 4.688l64.01 64C254.4 327.8 256 331.9 256 335.1zM304 287.1c0 9.141-7.474 16-16 16c-4.094 0-8.188-1.564-11.31-4.689L212.7 235.3C209.6 232.2 208 228.1 208 223.1c0-9.141 7.473-16 16-16c4.094 0 8.188 1.562 11.31 4.688l64.01 64.01C302.5 279.8 304 283.9 304 287.1zM256 175.1c0-9.141 7.473-16 16-16c4.094 0 8.188 1.562 11.31 4.688l64.01 64.01c3.125 3.125 4.688 7.219 4.688 11.31c0 9.133-7.468 16-16 16c-4.094 0-8.189-1.562-11.31-4.688l-64.01-64.01C257.6 184.2 256 180.1 256 175.1z"})})},custom:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:y("path",{d:"M417.1 368c-5.937 10.27-16.69 16-27.75 16c-5.422 0-10.92-1.375-15.97-4.281L256 311.4V448c0 17.67-14.33 32-31.1 32S192 465.7 192 448V311.4l-118.3 68.29C68.67 382.6 63.17 384 57.75 384c-11.06 0-21.81-5.734-27.75-16c-8.828-15.31-3.594-34.88 11.72-43.72L159.1 256L41.72 187.7C26.41 178.9 21.17 159.3 29.1 144C36.63 132.5 49.26 126.7 61.65 128.2C65.78 128.7 69.88 130.1 73.72 132.3L192 200.6V64c0-17.67 14.33-32 32-32S256 46.33 256 64v136.6l118.3-68.29c3.838-2.213 7.939-3.539 12.07-4.051C398.7 126.7 411.4 132.5 417.1 144c8.828 15.31 3.594 34.88-11.72 43.72L288 256l118.3 68.28C421.6 333.1 426.8 352.7 417.1 368z"})}),flags:{outline:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:y("path",{d:"M0 0l6.084 24H8L1.916 0zM21 5h-4l-1-4H4l3 12h3l1 4h13L21 5zM6.563 3h7.875l2 8H8.563l-2-8zm8.832 10l-2.856 1.904L12.063 13h3.332zM19 13l-1.5-6h1.938l2 8H16l3-2z"})}),solid:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:y("path",{d:"M64 496C64 504.8 56.75 512 48 512h-32C7.25 512 0 504.8 0 496V32c0-17.75 14.25-32 32-32s32 14.25 32 32V496zM476.3 0c-6.365 0-13.01 1.35-19.34 4.233c-45.69 20.86-79.56 27.94-107.8 27.94c-59.96 0-94.81-31.86-163.9-31.87C160.9 .3055 131.6 4.867 96 15.75v350.5c32-9.984 59.87-14.1 84.85-14.1c73.63 0 124.9 31.78 198.6 31.78c31.91 0 68.02-5.971 111.1-23.09C504.1 355.9 512 344.4 512 332.1V30.73C512 11.1 495.3 0 476.3 0z"})})},foods:{outline:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:y("path",{d:"M17 4.978c-1.838 0-2.876.396-3.68.934.513-1.172 1.768-2.934 4.68-2.934a1 1 0 0 0 0-2c-2.921 0-4.629 1.365-5.547 2.512-.064.078-.119.162-.18.244C11.73 1.838 10.798.023 9.207.023 8.579.022 7.85.306 7 .978 5.027 2.54 5.329 3.902 6.492 4.999 3.609 5.222 0 7.352 0 12.969c0 4.582 4.961 11.009 9 11.009 1.975 0 2.371-.486 3-1 .629.514 1.025 1 3 1 4.039 0 9-6.418 9-11 0-5.953-4.055-8-7-8M8.242 2.546c.641-.508.943-.523.965-.523.426.169.975 1.405 1.357 3.055-1.527-.629-2.741-1.352-2.98-1.846.059-.112.241-.356.658-.686M15 21.978c-1.08 0-1.21-.109-1.559-.402l-.176-.146c-.367-.302-.816-.452-1.266-.452s-.898.15-1.266.452l-.176.146c-.347.292-.477.402-1.557.402-2.813 0-7-5.389-7-9.009 0-5.823 4.488-5.991 5-5.991 1.939 0 2.484.471 3.387 1.251l.323.276a1.995 1.995 0 0 0 2.58 0l.323-.276c.902-.78 1.447-1.251 3.387-1.251.512 0 5 .168 5 6 0 3.617-4.187 9-7 9"})}),solid:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:y("path",{d:"M481.9 270.1C490.9 279.1 496 291.3 496 304C496 316.7 490.9 328.9 481.9 337.9C472.9 346.9 460.7 352 448 352H64C51.27 352 39.06 346.9 30.06 337.9C21.06 328.9 16 316.7 16 304C16 291.3 21.06 279.1 30.06 270.1C39.06 261.1 51.27 256 64 256H448C460.7 256 472.9 261.1 481.9 270.1zM475.3 388.7C478.3 391.7 480 395.8 480 400V416C480 432.1 473.3 449.3 461.3 461.3C449.3 473.3 432.1 480 416 480H96C79.03 480 62.75 473.3 50.75 461.3C38.74 449.3 32 432.1 32 416V400C32 395.8 33.69 391.7 36.69 388.7C39.69 385.7 43.76 384 48 384H464C468.2 384 472.3 385.7 475.3 388.7zM50.39 220.8C45.93 218.6 42.03 215.5 38.97 211.6C35.91 207.7 33.79 203.2 32.75 198.4C31.71 193.5 31.8 188.5 32.99 183.7C54.98 97.02 146.5 32 256 32C365.5 32 457 97.02 479 183.7C480.2 188.5 480.3 193.5 479.2 198.4C478.2 203.2 476.1 207.7 473 211.6C469.1 215.5 466.1 218.6 461.6 220.8C457.2 222.9 452.3 224 447.3 224H64.67C59.73 224 54.84 222.9 50.39 220.8zM372.7 116.7C369.7 119.7 368 123.8 368 128C368 131.2 368.9 134.3 370.7 136.9C372.5 139.5 374.1 141.6 377.9 142.8C380.8 143.1 384 144.3 387.1 143.7C390.2 143.1 393.1 141.6 395.3 139.3C397.6 137.1 399.1 134.2 399.7 131.1C400.3 128 399.1 124.8 398.8 121.9C397.6 118.1 395.5 116.5 392.9 114.7C390.3 112.9 387.2 111.1 384 111.1C379.8 111.1 375.7 113.7 372.7 116.7V116.7zM244.7 84.69C241.7 87.69 240 91.76 240 96C240 99.16 240.9 102.3 242.7 104.9C244.5 107.5 246.1 109.6 249.9 110.8C252.8 111.1 256 112.3 259.1 111.7C262.2 111.1 265.1 109.6 267.3 107.3C269.6 105.1 271.1 102.2 271.7 99.12C272.3 96.02 271.1 92.8 270.8 89.88C269.6 86.95 267.5 84.45 264.9 82.7C262.3 80.94 259.2 79.1 256 79.1C251.8 79.1 247.7 81.69 244.7 84.69V84.69zM116.7 116.7C113.7 119.7 112 123.8 112 128C112 131.2 112.9 134.3 114.7 136.9C116.5 139.5 118.1 141.6 121.9 142.8C124.8 143.1 128 144.3 131.1 143.7C134.2 143.1 137.1 141.6 139.3 139.3C141.6 137.1 143.1 134.2 143.7 131.1C144.3 128 143.1 124.8 142.8 121.9C141.6 118.1 139.5 116.5 136.9 114.7C134.3 112.9 131.2 111.1 128 111.1C123.8 111.1 119.7 113.7 116.7 116.7L116.7 116.7z"})})},frequent:{outline:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[y("path",{d:"M13 4h-2l-.001 7H9v2h2v2h2v-2h4v-2h-4z"}),y("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0m0 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10"})]}),solid:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:y("path",{d:"M256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256C512 397.4 397.4 512 256 512zM232 256C232 264 236 271.5 242.7 275.1L338.7 339.1C349.7 347.3 364.6 344.3 371.1 333.3C379.3 322.3 376.3 307.4 365.3 300L280 243.2V120C280 106.7 269.3 96 255.1 96C242.7 96 231.1 106.7 231.1 120L232 256z"})})},nature:{outline:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[y("path",{d:"M15.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 15.5 8M8.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 8.5 8"}),y("path",{d:"M18.933 0h-.027c-.97 0-2.138.787-3.018 1.497-1.274-.374-2.612-.51-3.887-.51-1.285 0-2.616.133-3.874.517C7.245.79 6.069 0 5.093 0h-.027C3.352 0 .07 2.67.002 7.026c-.039 2.479.276 4.238 1.04 5.013.254.258.882.677 1.295.882.191 3.177.922 5.238 2.536 6.38.897.637 2.187.949 3.2 1.102C8.04 20.6 8 20.795 8 21c0 1.773 2.35 3 4 3 1.648 0 4-1.227 4-3 0-.201-.038-.393-.072-.586 2.573-.385 5.435-1.877 5.925-7.587.396-.22.887-.568 1.104-.788.763-.774 1.079-2.534 1.04-5.013C23.929 2.67 20.646 0 18.933 0M3.223 9.135c-.237.281-.837 1.155-.884 1.238-.15-.41-.368-1.349-.337-3.291.051-3.281 2.478-4.972 3.091-5.031.256.015.731.27 1.265.646-1.11 1.171-2.275 2.915-2.352 5.125-.133.546-.398.858-.783 1.313M12 22c-.901 0-1.954-.693-2-1 0-.654.475-1.236 1-1.602V20a1 1 0 1 0 2 0v-.602c.524.365 1 .947 1 1.602-.046.307-1.099 1-2 1m3-3.48v.02a4.752 4.752 0 0 0-1.262-1.02c1.092-.516 2.239-1.334 2.239-2.217 0-1.842-1.781-2.195-3.977-2.195-2.196 0-3.978.354-3.978 2.195 0 .883 1.148 1.701 2.238 2.217A4.8 4.8 0 0 0 9 18.539v-.025c-1-.076-2.182-.281-2.973-.842-1.301-.92-1.838-3.045-1.853-6.478l.023-.041c.496-.826 1.49-1.45 1.804-3.102 0-2.047 1.357-3.631 2.362-4.522C9.37 3.178 10.555 3 11.948 3c1.447 0 2.685.192 3.733.57 1 .9 2.316 2.465 2.316 4.48.313 1.651 1.307 2.275 1.803 3.102.035.058.068.117.102.178-.059 5.967-1.949 7.01-4.902 7.19m6.628-8.202c-.037-.065-.074-.13-.113-.195a7.587 7.587 0 0 0-.739-.987c-.385-.455-.648-.768-.782-1.313-.076-2.209-1.241-3.954-2.353-5.124.531-.376 1.004-.63 1.261-.647.636.071 3.044 1.764 3.096 5.031.027 1.81-.347 3.218-.37 3.235"})]}),solid:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:y("path",{d:"M332.7 19.85C334.6 8.395 344.5 0 356.1 0C363.6 0 370.6 3.52 375.1 9.502L392 32H444.1C456.8 32 469.1 37.06 478.1 46.06L496 64H552C565.3 64 576 74.75 576 88V112C576 156.2 540.2 192 496 192H426.7L421.6 222.5L309.6 158.5L332.7 19.85zM448 64C439.2 64 432 71.16 432 80C432 88.84 439.2 96 448 96C456.8 96 464 88.84 464 80C464 71.16 456.8 64 448 64zM416 256.1V480C416 497.7 401.7 512 384 512H352C334.3 512 320 497.7 320 480V364.8C295.1 377.1 268.8 384 240 384C211.2 384 184 377.1 160 364.8V480C160 497.7 145.7 512 128 512H96C78.33 512 64 497.7 64 480V249.8C35.23 238.9 12.64 214.5 4.836 183.3L.9558 167.8C-3.331 150.6 7.094 133.2 24.24 128.1C41.38 124.7 58.76 135.1 63.05 152.2L66.93 167.8C70.49 182 83.29 191.1 97.97 191.1H303.8L416 256.1z"})})},objects:{outline:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[y("path",{d:"M12 0a9 9 0 0 0-5 16.482V21s2.035 3 5 3 5-3 5-3v-4.518A9 9 0 0 0 12 0zm0 2c3.86 0 7 3.141 7 7s-3.14 7-7 7-7-3.141-7-7 3.14-7 7-7zM9 17.477c.94.332 1.946.523 3 .523s2.06-.19 3-.523v.834c-.91.436-1.925.689-3 .689a6.924 6.924 0 0 1-3-.69v-.833zm.236 3.07A8.854 8.854 0 0 0 12 21c.965 0 1.888-.167 2.758-.451C14.155 21.173 13.153 22 12 22c-1.102 0-2.117-.789-2.764-1.453z"}),y("path",{d:"M14.745 12.449h-.004c-.852-.024-1.188-.858-1.577-1.824-.421-1.061-.703-1.561-1.182-1.566h-.009c-.481 0-.783.497-1.235 1.537-.436.982-.801 1.811-1.636 1.791l-.276-.043c-.565-.171-.853-.691-1.284-1.794-.125-.313-.202-.632-.27-.913-.051-.213-.127-.53-.195-.634C7.067 9.004 7.039 9 6.99 9A1 1 0 0 1 7 7h.01c1.662.017 2.015 1.373 2.198 2.134.486-.981 1.304-2.058 2.797-2.075 1.531.018 2.28 1.153 2.731 2.141l.002-.008C14.944 8.424 15.327 7 16.979 7h.032A1 1 0 1 1 17 9h-.011c-.149.076-.256.474-.319.709a6.484 6.484 0 0 1-.311.951c-.429.973-.79 1.789-1.614 1.789"})]}),solid:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:y("path",{d:"M112.1 454.3c0 6.297 1.816 12.44 5.284 17.69l17.14 25.69c5.25 7.875 17.17 14.28 26.64 14.28h61.67c9.438 0 21.36-6.401 26.61-14.28l17.08-25.68c2.938-4.438 5.348-12.37 5.348-17.7L272 415.1h-160L112.1 454.3zM191.4 .0132C89.44 .3257 16 82.97 16 175.1c0 44.38 16.44 84.84 43.56 115.8c16.53 18.84 42.34 58.23 52.22 91.45c.0313 .25 .0938 .5166 .125 .7823h160.2c.0313-.2656 .0938-.5166 .125-.7823c9.875-33.22 35.69-72.61 52.22-91.45C351.6 260.8 368 220.4 368 175.1C368 78.61 288.9-.2837 191.4 .0132zM192 96.01c-44.13 0-80 35.89-80 79.1C112 184.8 104.8 192 96 192S80 184.8 80 176c0-61.76 50.25-111.1 112-111.1c8.844 0 16 7.159 16 16S200.8 96.01 192 96.01z"})})},people:{outline:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[y("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0m0 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10"}),y("path",{d:"M8 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 8 7M16 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 16 7M15.232 15c-.693 1.195-1.87 2-3.349 2-1.477 0-2.655-.805-3.347-2H15m3-2H6a6 6 0 1 0 12 0"})]}),solid:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:y("path",{d:"M0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256zM256 432C332.1 432 396.2 382 415.2 314.1C419.1 300.4 407.8 288 393.6 288H118.4C104.2 288 92.92 300.4 96.76 314.1C115.8 382 179.9 432 256 432V432zM176.4 160C158.7 160 144.4 174.3 144.4 192C144.4 209.7 158.7 224 176.4 224C194 224 208.4 209.7 208.4 192C208.4 174.3 194 160 176.4 160zM336.4 224C354 224 368.4 209.7 368.4 192C368.4 174.3 354 160 336.4 160C318.7 160 304.4 174.3 304.4 192C304.4 209.7 318.7 224 336.4 224z"})})},places:{outline:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[y("path",{d:"M6.5 12C5.122 12 4 13.121 4 14.5S5.122 17 6.5 17 9 15.879 9 14.5 7.878 12 6.5 12m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5M17.5 12c-1.378 0-2.5 1.121-2.5 2.5s1.122 2.5 2.5 2.5 2.5-1.121 2.5-2.5-1.122-2.5-2.5-2.5m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5"}),y("path",{d:"M22.482 9.494l-1.039-.346L21.4 9h.6c.552 0 1-.439 1-.992 0-.006-.003-.008-.003-.008H23c0-1-.889-2-1.984-2h-.642l-.731-1.717C19.262 3.012 18.091 2 16.764 2H7.236C5.909 2 4.738 3.012 4.357 4.283L3.626 6h-.642C1.889 6 1 7 1 8h.003S1 8.002 1 8.008C1 8.561 1.448 9 2 9h.6l-.043.148-1.039.346a2.001 2.001 0 0 0-1.359 2.097l.751 7.508a1 1 0 0 0 .994.901H3v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h6v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h1.096a.999.999 0 0 0 .994-.901l.751-7.508a2.001 2.001 0 0 0-1.359-2.097M6.273 4.857C6.402 4.43 6.788 4 7.236 4h9.527c.448 0 .834.43.963.857L19.313 9H4.688l1.585-4.143zM7 21H5v-1h2v1zm12 0h-2v-1h2v1zm2.189-3H2.811l-.662-6.607L3 11h18l.852.393L21.189 18z"})]}),solid:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:y("path",{d:"M39.61 196.8L74.8 96.29C88.27 57.78 124.6 32 165.4 32H346.6C387.4 32 423.7 57.78 437.2 96.29L472.4 196.8C495.6 206.4 512 229.3 512 256V448C512 465.7 497.7 480 480 480H448C430.3 480 416 465.7 416 448V400H96V448C96 465.7 81.67 480 64 480H32C14.33 480 0 465.7 0 448V256C0 229.3 16.36 206.4 39.61 196.8V196.8zM109.1 192H402.9L376.8 117.4C372.3 104.6 360.2 96 346.6 96H165.4C151.8 96 139.7 104.6 135.2 117.4L109.1 192zM96 256C78.33 256 64 270.3 64 288C64 305.7 78.33 320 96 320C113.7 320 128 305.7 128 288C128 270.3 113.7 256 96 256zM416 320C433.7 320 448 305.7 448 288C448 270.3 433.7 256 416 256C398.3 256 384 270.3 384 288C384 305.7 398.3 320 416 320z"})})},symbols:{outline:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:y("path",{d:"M0 0h11v2H0zM4 11h3V6h4V4H0v2h4zM15.5 17c1.381 0 2.5-1.116 2.5-2.493s-1.119-2.493-2.5-2.493S13 13.13 13 14.507 14.119 17 15.5 17m0-2.986c.276 0 .5.222.5.493 0 .272-.224.493-.5.493s-.5-.221-.5-.493.224-.493.5-.493M21.5 19.014c-1.381 0-2.5 1.116-2.5 2.493S20.119 24 21.5 24s2.5-1.116 2.5-2.493-1.119-2.493-2.5-2.493m0 2.986a.497.497 0 0 1-.5-.493c0-.271.224-.493.5-.493s.5.222.5.493a.497.497 0 0 1-.5.493M22 13l-9 9 1.513 1.5 8.99-9.009zM17 11c2.209 0 4-1.119 4-2.5V2s.985-.161 1.498.949C23.01 4.055 23 6 23 6s1-1.119 1-3.135C24-.02 21 0 21 0h-2v6.347A5.853 5.853 0 0 0 17 6c-2.209 0-4 1.119-4 2.5s1.791 2.5 4 2.5M10.297 20.482l-1.475-1.585a47.54 47.54 0 0 1-1.442 1.129c-.307-.288-.989-1.016-2.045-2.183.902-.836 1.479-1.466 1.729-1.892s.376-.871.376-1.336c0-.592-.273-1.178-.818-1.759-.546-.581-1.329-.871-2.349-.871-1.008 0-1.79.293-2.344.879-.556.587-.832 1.181-.832 1.784 0 .813.419 1.748 1.256 2.805-.847.614-1.444 1.208-1.794 1.784a3.465 3.465 0 0 0-.523 1.833c0 .857.308 1.56.924 2.107.616.549 1.423.823 2.42.823 1.173 0 2.444-.379 3.813-1.137L8.235 24h2.819l-2.09-2.383 1.333-1.135zm-6.736-6.389a1.02 1.02 0 0 1 .73-.286c.31 0 .559.085.747.254a.849.849 0 0 1 .283.659c0 .518-.419 1.112-1.257 1.784-.536-.651-.805-1.231-.805-1.742a.901.901 0 0 1 .302-.669M3.74 22c-.427 0-.778-.116-1.057-.349-.279-.232-.418-.487-.418-.766 0-.594.509-1.288 1.527-2.083.968 1.134 1.717 1.946 2.248 2.438-.921.507-1.686.76-2.3.76"})}),solid:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:y("path",{d:"M500.3 7.251C507.7 13.33 512 22.41 512 31.1V175.1C512 202.5 483.3 223.1 447.1 223.1C412.7 223.1 383.1 202.5 383.1 175.1C383.1 149.5 412.7 127.1 447.1 127.1V71.03L351.1 90.23V207.1C351.1 234.5 323.3 255.1 287.1 255.1C252.7 255.1 223.1 234.5 223.1 207.1C223.1 181.5 252.7 159.1 287.1 159.1V63.1C287.1 48.74 298.8 35.61 313.7 32.62L473.7 .6198C483.1-1.261 492.9 1.173 500.3 7.251H500.3zM74.66 303.1L86.5 286.2C92.43 277.3 102.4 271.1 113.1 271.1H174.9C185.6 271.1 195.6 277.3 201.5 286.2L213.3 303.1H239.1C266.5 303.1 287.1 325.5 287.1 351.1V463.1C287.1 490.5 266.5 511.1 239.1 511.1H47.1C21.49 511.1-.0019 490.5-.0019 463.1V351.1C-.0019 325.5 21.49 303.1 47.1 303.1H74.66zM143.1 359.1C117.5 359.1 95.1 381.5 95.1 407.1C95.1 434.5 117.5 455.1 143.1 455.1C170.5 455.1 191.1 434.5 191.1 407.1C191.1 381.5 170.5 359.1 143.1 359.1zM440.3 367.1H496C502.7 367.1 508.6 372.1 510.1 378.4C513.3 384.6 511.6 391.7 506.5 396L378.5 508C372.9 512.1 364.6 513.3 358.6 508.9C352.6 504.6 350.3 496.6 353.3 489.7L391.7 399.1H336C329.3 399.1 323.4 395.9 321 389.6C318.7 383.4 320.4 376.3 325.5 371.1L453.5 259.1C459.1 255 467.4 254.7 473.4 259.1C479.4 263.4 481.6 271.4 478.7 278.3L440.3 367.1zM116.7 219.1L19.85 119.2C-8.112 90.26-6.614 42.31 24.85 15.34C51.82-8.137 93.26-3.642 118.2 21.83L128.2 32.32L137.7 21.83C162.7-3.642 203.6-8.137 231.6 15.34C262.6 42.31 264.1 90.26 236.1 119.2L139.7 219.1C133.2 225.6 122.7 225.6 116.7 219.1H116.7z"})})}},wi={loupe:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:y("path",{d:"M12.9 14.32a8 8 0 1 1 1.41-1.41l5.35 5.33-1.42 1.42-5.33-5.34zM8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12z"})}),delete:y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:y("path",{d:"M10 8.586L2.929 1.515 1.515 2.929 8.586 10l-7.071 7.071 1.414 1.414L10 11.414l7.071 7.071 1.414-1.414L11.414 10l7.071-7.071-1.414-1.414L10 8.586z"})})};var tt={categories:xi,search:wi};function $t(e){let{id:t,skin:n,emoji:r}=e;if(e.shortcodes){const l=e.shortcodes.match(be.SHORTCODES_REGEX);l&&(t=l[1],l[2]&&(n=l[2]))}if(r||(r=be.get(t||e.native)),!r)return e.fallback;const s=r.skins[n-1]||r.skins[0],o=s.src||(e.set!="native"&&!e.spritesheet?typeof e.getImageURL=="function"?e.getImageURL(e.set,s.unified):`https://cdn.jsdelivr.net/npm/emoji-datasource-${e.set}@15.0.1/img/${e.set}/64/${s.unified}.png`:void 0),i=typeof e.getSpritesheetURL=="function"?e.getSpritesheetURL(e.set):`https://cdn.jsdelivr.net/npm/emoji-datasource-${e.set}@15.0.1/img/${e.set}/sheets-256/64.png`;return y("span",{class:"emoji-mart-emoji","data-emoji-set":e.set,children:o?y("img",{style:{maxWidth:e.size||"1em",maxHeight:e.size||"1em",display:"inline-block"},alt:s.native||s.shortcodes,src:o}):e.set=="native"?y("span",{style:{fontSize:e.size,fontFamily:'"EmojiMart", "Segoe UI Emoji", "Segoe UI Symbol", "Segoe UI", "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "Android Emoji"'},children:s.native}):y("span",{style:{display:"block",width:e.size,height:e.size,backgroundImage:`url(${i})`,backgroundSize:`${100*L.sheet.cols}% ${100*L.sheet.rows}%`,backgroundPosition:`${100/(L.sheet.cols-1)*s.x}% ${100/(L.sheet.rows-1)*s.y}%`}})})}const ki=typeof window<"u"&&window.HTMLElement?window.HTMLElement:Object;class ls extends ki{static get observedAttributes(){return Object.keys(this.Props)}update(t={}){for(let n in t)this.attributeChangedCallback(n,null,t[n])}attributeChangedCallback(t,n,r){if(!this.component)return;const s=as(t,{[t]:r},this.constructor.Props,this);this.component.componentWillReceiveProps?this.component.componentWillReceiveProps({[t]:s}):(this.component.props[t]=s,this.component.forceUpdate())}disconnectedCallback(){this.disconnected=!0,this.component&&this.component.unregister&&this.component.unregister()}constructor(t={}){if(super(),this.props=t,t.parent||t.ref){let n=null;const r=t.parent||(n=t.ref&&t.ref.current);n&&(n.innerHTML=""),r&&r.appendChild(this)}}}class Ci extends ls{setShadow(){this.attachShadow({mode:"open"})}injectStyles(t){if(!t)return;const n=document.createElement("style");n.textContent=t,this.shadowRoot.insertBefore(n,this.shadowRoot.firstChild)}constructor(t,{styles:n}={}){super(t),this.setShadow(),this.injectStyles(n)}}var cs={fallback:"",id:"",native:"",shortcodes:"",size:{value:"",transform:e=>/\D/.test(e)?e:`${e}px`},set:le.set,skin:le.skin};class us extends ls{async connectedCallback(){const t=is(this.props,cs,this);t.element=this,t.ref=n=>{this.component=n},await ct(),!this.disconnected&&es(y($t,{...t}),this)}constructor(t){super(t)}}ee(us,"Props",cs);typeof customElements<"u"&&!customElements.get("em-emoji")&&customElements.define("em-emoji",us);var dn,jt=[],fn=E.__b,pn=E.__r,hn=E.diffed,mn=E.__c,gn=E.unmount;function Si(){var e;for(jt.sort(function(t,n){return t.__v.__b-n.__v.__b});e=jt.pop();)if(e.__P)try{e.__H.__h.forEach(Xe),e.__H.__h.forEach(Et),e.__H.__h=[]}catch(t){e.__H.__h=[],E.__e(t,e.__v)}}E.__b=function(e){fn&&fn(e)},E.__r=function(e){pn&&pn(e);var t=e.__c.__H;t&&(t.__h.forEach(Xe),t.__h.forEach(Et),t.__h=[])},E.diffed=function(e){hn&&hn(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(jt.push(t)!==1&&dn===E.requestAnimationFrame||((dn=E.requestAnimationFrame)||function(n){var r,s=function(){clearTimeout(o),bn&&cancelAnimationFrame(r),setTimeout(n)},o=setTimeout(s,100);bn&&(r=requestAnimationFrame(s))})(Si))},E.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Xe),n.__h=n.__h.filter(function(r){return!r.__||Et(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],E.__e(r,n.__v)}}),mn&&mn(e,t)},E.unmount=function(e){gn&&gn(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Xe(r)}catch(s){t=s}}),t&&E.__e(t,n.__v))};var bn=typeof requestAnimationFrame=="function";function Xe(e){var t=e.__c;typeof t=="function"&&(e.__c=void 0,t())}function Et(e){e.__c=e.__()}function $i(e,t){for(var n in t)e[n]=t[n];return e}function vn(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function nt(e){this.props=e}(nt.prototype=new ie).isPureReactComponent=!0,nt.prototype.shouldComponentUpdate=function(e,t){return vn(this.props,e)||vn(this.state,t)};var yn=E.__b;E.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),yn&&yn(e)};var ji=E.__e;E.__e=function(e,t,n){if(e.then){for(var r,s=t;s=s.__;)if((r=s.__c)&&r.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t)}ji(e,t,n)};var _n=E.unmount;function gt(){this.__u=0,this.t=null,this.__b=null}function ds(e){var t=e.__.__c;return t&&t.__e&&t.__e(e)}function Be(){this.u=null,this.o=null}E.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),_n&&_n(e)},(gt.prototype=new ie).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var s=ds(r.__v),o=!1,i=function(){o||(o=!0,n.__R=null,s?s(l):l())};n.__R=i;var l=function(){if(!--r.__u){if(r.state.__e){var u=r.state.__e;r.__v.__k[0]=(function f(m,v,d){return m&&(m.__v=null,m.__k=m.__k&&m.__k.map(function(g){return f(g,v,d)}),m.__c&&m.__c.__P===v&&(m.__e&&d.insertBefore(m.__e,m.__d),m.__c.__e=!0,m.__c.__P=d)),m})(u,u.__c.__P,u.__c.__O)}var a;for(r.setState({__e:r.__b=null});a=r.t.pop();)a.forceUpdate()}},c=t.__h===!0;r.__u++||c||r.setState({__e:r.__b=r.__v.__k[0]}),e.then(i,i)},gt.prototype.componentWillUnmount=function(){this.t=[]},gt.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=(function o(i,l,c){return i&&(i.__c&&i.__c.__H&&(i.__c.__H.__.forEach(function(u){typeof u.__c=="function"&&u.__c()}),i.__c.__H=null),(i=$i({},i)).__c!=null&&(i.__c.__P===c&&(i.__c.__P=l),i.__c=null),i.__k=i.__k&&i.__k.map(function(u){return o(u,l,c)})),i})(this.__b,n,r.__O=r.__P)}this.__b=null}var s=t.__e&&kt(ye,null,e.fallback);return s&&(s.__h=null),[kt(ye,null,t.__e?null:e.children),s]};var xn=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};(Be.prototype=new ie).__e=function(e){var t=this,n=ds(t.__v),r=t.o.get(e);return r[0]++,function(s){var o=function(){t.props.revealOrder?(r.push(s),xn(t,e,r)):s()};n?n(o):o()}},Be.prototype.render=function(e){this.u=null,this.o=new Map;var t=Qe(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},Be.prototype.componentDidUpdate=Be.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){xn(e,n,t)})};var Ei=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Ri=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ti=typeof document<"u",Mi=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};ie.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(ie.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var wn=E.event;function Pi(){}function Li(){return this.cancelBubble}function Ai(){return this.defaultPrevented}E.event=function(e){return wn&&(e=wn(e)),e.persist=Pi,e.isPropagationStopped=Li,e.isDefaultPrevented=Ai,e.nativeEvent=e};var kn={configurable:!0,get:function(){return this.class}},Cn=E.vnode;E.vnode=function(e){var t=e.type,n=e.props,r=n;if(typeof t=="string"){var s=t.indexOf("-")===-1;for(var o in r={},n){var i=n[o];Ti&&o==="children"&&t==="noscript"||o==="value"&&"defaultValue"in n&&i==null||(o==="defaultValue"&&"value"in n&&n.value==null?o="value":o==="download"&&i===!0?i="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+t)&&!Mi(n.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp)/.test(o)?o=o.toLowerCase():s&&Ri.test(o)?o=o.replace(/[A-Z0-9]/,"-$&").toLowerCase():i===null&&(i=void 0),r[o]=i)}t=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=Qe(n.children).forEach(function(l){l.props.selected=r.value.indexOf(l.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=Qe(n.children).forEach(function(l){l.props.selected=r.multiple?r.defaultValue.indexOf(l.props.value)!=-1:r.defaultValue==l.props.value})),e.props=r,n.class!=n.className&&(kn.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",kn))}e.$$typeof=Ei,Cn&&Cn(e)};var Sn=E.__r;E.__r=function(e){Sn&&Sn(e),e.__c};const Ni={light:"outline",dark:"solid"};class zi extends nt{renderIcon(t){const{icon:n}=t;if(n){if(n.svg)return y("span",{class:"flex",dangerouslySetInnerHTML:{__html:n.svg}});if(n.src)return y("img",{src:n.src})}const r=tt.categories[t.id]||tt.categories.custom,s=this.props.icons=="auto"?Ni[this.props.theme]:this.props.icons;return r[s]||r}render(){let t=null;return y("nav",{id:"nav",class:"padding","data-position":this.props.position,dir:this.props.dir,children:y("div",{class:"flex relative",children:[this.categories.map((n,r)=>{const s=n.name||W.categories[n.id],o=!this.props.unfocused&&n.id==this.state.categoryId;return o&&(t=r),y("button",{"aria-label":s,"aria-selected":o||void 0,title:s,type:"button",class:"flex flex-grow flex-center",onMouseDown:i=>i.preventDefault(),onClick:()=>{this.props.onClick({category:n,i:r})},children:this.renderIcon(n)})}),y("div",{class:"bar",style:{width:`${100/this.categories.length}%`,opacity:t==null?0:1,transform:this.props.dir==="rtl"?`scaleX(-1) translateX(${t*100}%)`:`translateX(${t*100}%)`}})]})})}constructor(){super(),this.categories=L.categories.filter(t=>!t.target),this.state={categoryId:this.categories[0].id}}}class Oi extends nt{shouldComponentUpdate(t){for(let n in t)if(n!="children"&&t[n]!=this.props[n])return!0;return!1}render(){return this.props.children}}const He={rowsPerRender:10};class Ii extends ie{getInitialState(t=this.props){return{skin:de.get("skin")||t.skin,theme:this.initTheme(t.theme)}}componentWillMount(){this.dir=W.rtl?"rtl":"ltr",this.refs={menu:ae(),navigation:ae(),scroll:ae(),search:ae(),searchInput:ae(),skinToneButton:ae(),skinToneRadio:ae()},this.initGrid(),this.props.stickySearch==!1&&this.props.searchPosition=="sticky"&&(console.warn("[EmojiMart] Deprecation warning: `stickySearch` has been renamed `searchPosition`."),this.props.searchPosition="static")}componentDidMount(){if(this.register(),this.shadowRoot=this.base.parentNode,this.props.autoFocus){const{searchInput:t}=this.refs;t.current&&t.current.focus()}}componentWillReceiveProps(t){this.nextState||(this.nextState={});for(const n in t)this.nextState[n]=t[n];clearTimeout(this.nextStateTimer),this.nextStateTimer=setTimeout(()=>{let n=!1;for(const s in this.nextState)this.props[s]=this.nextState[s],(s==="custom"||s==="categories")&&(n=!0);delete this.nextState;const r=this.getInitialState();if(n)return this.reset(r);this.setState(r)})}componentWillUnmount(){this.unregister()}async reset(t={}){await ct(this.props),this.initGrid(),this.unobserve(),this.setState(t,()=>{this.observeCategories(),this.observeRows()})}register(){document.addEventListener("click",this.handleClickOutside),this.observe()}unregister(){var t;document.removeEventListener("click",this.handleClickOutside),(t=this.darkMedia)==null||t.removeEventListener("change",this.darkMediaCallback),this.unobserve()}observe(){this.observeCategories(),this.observeRows()}unobserve({except:t=[]}={}){Array.isArray(t)||(t=[t]);for(const n of this.observers)t.includes(n)||n.disconnect();this.observers=[].concat(t)}initGrid(){const{categories:t}=L;this.refs.categories=new Map;const n=L.categories.map(s=>s.id).join(",");this.navKey&&this.navKey!=n&&this.refs.scroll.current&&(this.refs.scroll.current.scrollTop=0),this.navKey=n,this.grid=[],this.grid.setsize=0;const r=(s,o)=>{const i=[];i.__categoryId=o.id,i.__index=s.length,this.grid.push(i);const l=this.grid.length-1,c=l%He.rowsPerRender?{}:ae();return c.index=l,c.posinset=this.grid.setsize+1,s.push(c),i};for(let s of t){const o=[];let i=r(o,s);for(let l of s.emojis)i.length==this.getPerLine()&&(i=r(o,s)),this.grid.setsize+=1,i.push(l);this.refs.categories.set(s.id,{root:ae(),rows:o})}}initTheme(t){if(t!="auto")return t;if(!this.darkMedia){if(this.darkMedia=matchMedia("(prefers-color-scheme: dark)"),this.darkMedia.media.match(/^not/))return"light";this.darkMedia.addEventListener("change",this.darkMediaCallback)}return this.darkMedia.matches?"dark":"light"}initDynamicPerLine(t=this.props){if(!t.dynamicWidth)return;const{element:n,emojiButtonSize:r}=t,s=()=>{const{width:i}=n.getBoundingClientRect();return Math.floor(i/r)},o=new ResizeObserver(()=>{this.unobserve({except:o}),this.setState({perLine:s()},()=>{this.initGrid(),this.forceUpdate(()=>{this.observeCategories(),this.observeRows()})})});return o.observe(n),this.observers.push(o),s()}getPerLine(){return this.state.perLine||this.props.perLine}getEmojiByPos([t,n]){const r=this.state.searchResults||this.grid,s=r[t]&&r[t][n];if(s)return be.get(s)}observeCategories(){const t=this.refs.navigation.current;if(!t)return;const n=new Map,r=i=>{i!=t.state.categoryId&&t.setState({categoryId:i})},s={root:this.refs.scroll.current,threshold:[0,1]},o=new IntersectionObserver(i=>{for(const c of i){const u=c.target.dataset.id;n.set(u,c.intersectionRatio)}const l=[...n];for(const[c,u]of l)if(u){r(c);break}},s);for(const{root:i}of this.refs.categories.values())o.observe(i.current);this.observers.push(o)}observeRows(){const t={...this.state.visibleRows},n=new IntersectionObserver(r=>{for(const s of r){const o=parseInt(s.target.dataset.index);s.isIntersecting?t[o]=!0:delete t[o]}this.setState({visibleRows:t})},{root:this.refs.scroll.current,rootMargin:`${this.props.emojiButtonSize*(He.rowsPerRender+5)}px 0px ${this.props.emojiButtonSize*He.rowsPerRender}px`});for(const{rows:r}of this.refs.categories.values())for(const s of r)s.current&&n.observe(s.current);this.observers.push(n)}preventDefault(t){t.preventDefault()}unfocusSearch(){const t=this.refs.searchInput.current;t&&t.blur()}navigate({e:t,input:n,left:r,right:s,up:o,down:i}){const l=this.state.searchResults||this.grid;if(!l.length)return;let[c,u]=this.state.pos;const a=(()=>{if(c==0&&u==0&&!t.repeat&&(r||o))return null;if(c==-1)return!t.repeat&&(s||i)&&n.selectionStart==n.value.length?[0,0]:null;if(r||s){let f=l[c];const m=r?-1:1;if(u+=m,!f[u]){if(c+=m,f=l[c],!f)return c=r?0:l.length-1,u=r?0:l[c].length-1,[c,u];u=r?f.length-1:0}return[c,u]}if(o||i){c+=o?-1:1;const f=l[c];return f?(f[u]||(u=f.length-1),[c,u]):(c=o?0:l.length-1,u=o?0:l[c].length-1,[c,u])}})();if(a)t.preventDefault();else{this.state.pos[0]>-1&&this.setState({pos:[-1,-1]});return}this.setState({pos:a,keyboard:!0},()=>{this.scrollTo({row:a[0]})})}scrollTo({categoryId:t,row:n}){const r=this.state.searchResults||this.grid;if(!r.length)return;const s=this.refs.scroll.current,o=s.getBoundingClientRect();let i=0;if(n>=0&&(t=r[n].__categoryId),t&&(i=(this.refs[t]||this.refs.categories.get(t).root).current.getBoundingClientRect().top-(o.top-s.scrollTop)+1),n>=0)if(!n)i=0;else{const l=r[n].__index,c=i+l*this.props.emojiButtonSize,u=c+this.props.emojiButtonSize+this.props.emojiButtonSize*.88;if(c<s.scrollTop)i=c;else if(u>s.scrollTop+o.height)i=u-o.height;else return}this.ignoreMouse(),s.scrollTop=i}ignoreMouse(){this.mouseIsIgnored=!0,clearTimeout(this.ignoreMouseTimer),this.ignoreMouseTimer=setTimeout(()=>{delete this.mouseIsIgnored},100)}handleEmojiOver(t){this.mouseIsIgnored||this.state.showSkins||this.setState({pos:t||[-1,-1],keyboard:!1})}handleEmojiClick({e:t,emoji:n,pos:r}){if(this.props.onEmojiSelect&&(!n&&r&&(n=this.getEmojiByPos(r)),n)){const s=_i(n,{skinIndex:this.state.skin-1});this.props.maxFrequentRows&&ns.add(s,this.props),this.props.onEmojiSelect(s,t)}}closeSkins(){this.state.showSkins&&(this.setState({showSkins:null,tempSkin:null}),this.base.removeEventListener("click",this.handleBaseClick),this.base.removeEventListener("keydown",this.handleBaseKeydown))}handleSkinMouseOver(t){this.setState({tempSkin:t})}handleSkinClick(t){this.ignoreMouse(),this.closeSkins(),this.setState({skin:t,tempSkin:null}),de.set("skin",t)}renderNav(){return y(zi,{ref:this.refs.navigation,icons:this.props.icons,theme:this.state.theme,dir:this.dir,unfocused:!!this.state.searchResults,position:this.props.navPosition,onClick:this.handleCategoryClick},this.navKey)}renderPreview(){const t=this.getEmojiByPos(this.state.pos),n=this.state.searchResults&&!this.state.searchResults.length;return y("div",{id:"preview",class:"flex flex-middle",dir:this.dir,"data-position":this.props.previewPosition,children:[y("div",{class:"flex flex-middle flex-grow",children:[y("div",{class:"flex flex-auto flex-middle flex-center",style:{height:this.props.emojiButtonSize,fontSize:this.props.emojiButtonSize},children:y($t,{emoji:t,id:n?this.props.noResultsEmoji||"cry":this.props.previewEmoji||(this.props.previewPosition=="top"?"point_down":"point_up"),set:this.props.set,size:this.props.emojiButtonSize,skin:this.state.tempSkin||this.state.skin,spritesheet:!0,getSpritesheetURL:this.props.getSpritesheetURL})}),y("div",{class:`margin-${this.dir[0]}`,children:t||n?y("div",{class:`padding-${this.dir[2]} align-${this.dir[0]}`,children:[y("div",{class:"preview-title ellipsis",children:t?t.name:W.search_no_results_1}),y("div",{class:"preview-subtitle ellipsis color-c",children:t?t.skins[0].shortcodes:W.search_no_results_2})]}):y("div",{class:"preview-placeholder color-c",children:W.pick})})]}),!t&&this.props.skinTonePosition=="preview"&&this.renderSkinToneButton()]})}renderEmojiButton(t,{pos:n,posinset:r,grid:s}){const o=this.props.emojiButtonSize,i=this.state.tempSkin||this.state.skin,c=(t.skins[i-1]||t.skins[0]).native,u=vi(this.state.pos,n),a=n.concat(t.id).join("");return y(Oi,{selected:u,skin:i,size:o,children:y("button",{"aria-label":c,"aria-selected":u||void 0,"aria-posinset":r,"aria-setsize":s.setsize,"data-keyboard":this.state.keyboard,title:this.props.previewPosition=="none"?t.name:void 0,type:"button",class:"flex flex-center flex-middle",tabindex:"-1",onClick:f=>this.handleEmojiClick({e:f,emoji:t}),onMouseEnter:()=>this.handleEmojiOver(n),onMouseLeave:()=>this.handleEmojiOver(),style:{width:this.props.emojiButtonSize,height:this.props.emojiButtonSize,fontSize:this.props.emojiSize,lineHeight:0},children:[y("div",{"aria-hidden":"true",class:"background",style:{borderRadius:this.props.emojiButtonRadius,backgroundColor:this.props.emojiButtonColors?this.props.emojiButtonColors[(r-1)%this.props.emojiButtonColors.length]:void 0}}),y($t,{emoji:t,set:this.props.set,size:this.props.emojiSize,skin:i,spritesheet:!0,getSpritesheetURL:this.props.getSpritesheetURL})]})},a)}renderSearch(){const t=this.props.previewPosition=="none"||this.props.skinTonePosition=="search";return y("div",{children:[y("div",{class:"spacer"}),y("div",{class:"flex flex-middle",children:[y("div",{class:"search relative flex-grow",children:[y("input",{type:"search",ref:this.refs.searchInput,placeholder:W.search,onClick:this.handleSearchClick,onInput:this.handleSearchInput,onKeyDown:this.handleSearchKeyDown,autoComplete:"off"}),y("span",{class:"icon loupe flex",children:tt.search.loupe}),this.state.searchResults&&y("button",{title:"Clear","aria-label":"Clear",type:"button",class:"icon delete flex",onClick:this.clearSearch,onMouseDown:this.preventDefault,children:tt.search.delete})]}),t&&this.renderSkinToneButton()]})]})}renderSearchResults(){const{searchResults:t}=this.state;return t?y("div",{class:"category",ref:this.refs.search,children:[y("div",{class:`sticky padding-small align-${this.dir[0]}`,children:W.categories.search}),y("div",{children:t.length?t.map((n,r)=>y("div",{class:"flex",children:n.map((s,o)=>this.renderEmojiButton(s,{pos:[r,o],posinset:r*this.props.perLine+o+1,grid:t}))})):y("div",{class:`padding-small align-${this.dir[0]}`,children:this.props.onAddCustomEmoji&&y("a",{onClick:this.props.onAddCustomEmoji,children:W.add_custom})})})]}):null}renderCategories(){const{categories:t}=L,n=!!this.state.searchResults,r=this.getPerLine();return y("div",{style:{visibility:n?"hidden":void 0,display:n?"none":void 0,height:"100%"},children:t.map(s=>{const{root:o,rows:i}=this.refs.categories.get(s.id);return y("div",{"data-id":s.target?s.target.id:s.id,class:"category",ref:o,children:[y("div",{class:`sticky padding-small align-${this.dir[0]}`,children:s.name||W.categories[s.id]}),y("div",{class:"relative",style:{height:i.length*this.props.emojiButtonSize},children:i.map((l,c)=>{const u=l.index-l.index%He.rowsPerRender,a=this.state.visibleRows[u],f="current"in l?l:void 0;if(!a&&!f)return null;const m=c*r,v=m+r,d=s.emojis.slice(m,v);return d.length<r&&d.push(...new Array(r-d.length)),y("div",{"data-index":l.index,ref:f,class:"flex row",style:{top:c*this.props.emojiButtonSize},children:a&&d.map((g,b)=>{if(!g)return y("div",{style:{width:this.props.emojiButtonSize,height:this.props.emojiButtonSize}});const x=be.get(g);return this.renderEmojiButton(x,{pos:[l.index,b],posinset:l.posinset+b,grid:this.grid})})},l.index)})})]})})})}renderSkinToneButton(){return this.props.skinTonePosition=="none"?null:y("div",{class:"flex flex-auto flex-center flex-middle",style:{position:"relative",width:this.props.emojiButtonSize,height:this.props.emojiButtonSize},children:y("button",{type:"button",ref:this.refs.skinToneButton,class:"skin-tone-button flex flex-auto flex-center flex-middle","aria-selected":this.state.showSkins?"":void 0,"aria-label":W.skins.choose,title:W.skins.choose,onClick:this.openSkins,style:{width:this.props.emojiSize,height:this.props.emojiSize},children:y("span",{class:`skin-tone skin-tone-${this.state.skin}`})})})}renderLiveRegion(){const t=this.getEmojiByPos(this.state.pos),n=t?t.name:"";return y("div",{"aria-live":"polite",class:"sr-only",children:n})}renderSkins(){const n=this.refs.skinToneButton.current.getBoundingClientRect(),r=this.base.getBoundingClientRect(),s={};return this.dir=="ltr"?s.right=r.right-n.right-3:s.left=n.left-r.left-3,this.props.previewPosition=="bottom"&&this.props.skinTonePosition=="preview"?s.bottom=r.bottom-n.top+6:(s.top=n.bottom-r.top+3,s.bottom="auto"),y("div",{ref:this.refs.menu,role:"radiogroup",dir:this.dir,"aria-label":W.skins.choose,class:"menu hidden","data-position":s.top?"top":"bottom",style:s,children:[...Array(6).keys()].map(o=>{const i=o+1,l=this.state.skin==i;return y("div",{children:[y("input",{type:"radio",name:"skin-tone",value:i,"aria-label":W.skins[i],ref:l?this.refs.skinToneRadio:null,defaultChecked:l,onChange:()=>this.handleSkinMouseOver(i),onKeyDown:c=>{(c.code=="Enter"||c.code=="Space"||c.code=="Tab")&&(c.preventDefault(),this.handleSkinClick(i))}}),y("button",{"aria-hidden":"true",tabindex:"-1",onClick:()=>this.handleSkinClick(i),onMouseEnter:()=>this.handleSkinMouseOver(i),onMouseLeave:()=>this.handleSkinMouseOver(),class:"option flex flex-grow flex-middle",children:[y("span",{class:`skin-tone skin-tone-${i}`}),y("span",{class:"margin-small-lr",children:W.skins[i]})]})]})})})}render(){const t=this.props.perLine*this.props.emojiButtonSize;return y("section",{id:"root",class:"flex flex-column",dir:this.dir,style:{width:this.props.dynamicWidth?"100%":`calc(${t}px + (var(--padding) + var(--sidebar-width)))`},"data-emoji-set":this.props.set,"data-theme":this.state.theme,"data-menu":this.state.showSkins?"":void 0,children:[this.props.previewPosition=="top"&&this.renderPreview(),this.props.navPosition=="top"&&this.renderNav(),this.props.searchPosition=="sticky"&&y("div",{class:"padding-lr",children:this.renderSearch()}),y("div",{ref:this.refs.scroll,class:"scroll flex-grow padding-lr",children:y("div",{style:{width:this.props.dynamicWidth?"100%":t,height:"100%"},children:[this.props.searchPosition=="static"&&this.renderSearch(),this.renderSearchResults(),this.renderCategories()]})}),this.props.navPosition=="bottom"&&this.renderNav(),this.props.previewPosition=="bottom"&&this.renderPreview(),this.state.showSkins&&this.renderSkins(),this.renderLiveRegion()]})}constructor(t){super(),ee(this,"darkMediaCallback",()=>{this.props.theme=="auto"&&this.setState({theme:this.darkMedia.matches?"dark":"light"})}),ee(this,"handleClickOutside",n=>{const{element:r}=this.props;n.target!=r&&(this.state.showSkins&&this.closeSkins(),this.props.onClickOutside&&this.props.onClickOutside(n))}),ee(this,"handleBaseClick",n=>{this.state.showSkins&&(n.target.closest(".menu")||(n.preventDefault(),n.stopImmediatePropagation(),this.closeSkins()))}),ee(this,"handleBaseKeydown",n=>{this.state.showSkins&&n.key=="Escape"&&(n.preventDefault(),n.stopImmediatePropagation(),this.closeSkins())}),ee(this,"handleSearchClick",()=>{this.getEmojiByPos(this.state.pos)&&this.setState({pos:[-1,-1]})}),ee(this,"handleSearchInput",async()=>{const n=this.refs.searchInput.current;if(!n)return;const{value:r}=n,s=await be.search(r),o=()=>{this.refs.scroll.current&&(this.refs.scroll.current.scrollTop=0)};if(!s)return this.setState({searchResults:s,pos:[-1,-1]},o);const i=n.selectionStart==n.value.length?[0,0]:[-1,-1],l=[];l.setsize=s.length;let c=null;for(let u of s)(!l.length||c.length==this.getPerLine())&&(c=[],c.__categoryId="search",c.__index=l.length,l.push(c)),c.push(u);this.ignoreMouse(),this.setState({searchResults:l,pos:i},o)}),ee(this,"handleSearchKeyDown",n=>{const r=n.currentTarget;switch(n.stopImmediatePropagation(),n.key){case"ArrowLeft":this.navigate({e:n,input:r,left:!0});break;case"ArrowRight":this.navigate({e:n,input:r,right:!0});break;case"ArrowUp":this.navigate({e:n,input:r,up:!0});break;case"ArrowDown":this.navigate({e:n,input:r,down:!0});break;case"Enter":n.preventDefault(),this.handleEmojiClick({e:n,pos:this.state.pos});break;case"Escape":n.preventDefault(),this.state.searchResults?this.clearSearch():this.unfocusSearch();break}}),ee(this,"clearSearch",()=>{const n=this.refs.searchInput.current;n&&(n.value="",n.focus(),this.handleSearchInput())}),ee(this,"handleCategoryClick",({category:n,i:r})=>{this.scrollTo(r==0?{row:-1}:{categoryId:n.id})}),ee(this,"openSkins",n=>{const{currentTarget:r}=n,s=r.getBoundingClientRect();this.setState({showSkins:s},async()=>{await yi(2);const o=this.refs.menu.current;o&&(o.classList.remove("hidden"),this.refs.skinToneRadio.current.focus(),this.base.addEventListener("click",this.handleBaseClick,!0),this.base.addEventListener("keydown",this.handleBaseKeydown,!0))})}),this.observers=[],this.state={pos:[-1,-1],perLine:this.initDynamicPerLine(t),visibleRows:{0:!0},...this.getInitialState(t)}}}class It extends Ci{async connectedCallback(){const t=is(this.props,le,this);t.element=this,t.ref=n=>{this.component=n},await ct(t),!this.disconnected&&es(y(Ii,{...t}),this.shadowRoot)}constructor(t){super(t,{styles:Br(fs)})}}ee(It,"Props",le);typeof customElements<"u"&&!customElements.get("em-emoji-picker")&&customElements.define("em-emoji-picker",It);var fs={};fs=`:host {
|
|
7
|
-
width: min-content;
|
|
8
|
-
height: 435px;
|
|
9
|
-
min-height: 230px;
|
|
10
|
-
border-radius: var(--border-radius);
|
|
11
|
-
box-shadow: var(--shadow);
|
|
12
|
-
--border-radius: 10px;
|
|
13
|
-
--category-icon-size: 18px;
|
|
14
|
-
--font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
|
|
15
|
-
--font-size: 15px;
|
|
16
|
-
--preview-placeholder-size: 21px;
|
|
17
|
-
--preview-title-size: 1.1em;
|
|
18
|
-
--preview-subtitle-size: .9em;
|
|
19
|
-
--shadow-color: 0deg 0% 0%;
|
|
20
|
-
--shadow: .3px .5px 2.7px hsl(var(--shadow-color) / .14), .4px .8px 1px -3.2px hsl(var(--shadow-color) / .14), 1px 2px 2.5px -4.5px hsl(var(--shadow-color) / .14);
|
|
21
|
-
display: flex;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
[data-theme="light"] {
|
|
25
|
-
--em-rgb-color: var(--rgb-color, 34, 36, 39);
|
|
26
|
-
--em-rgb-accent: var(--rgb-accent, 34, 102, 237);
|
|
27
|
-
--em-rgb-background: var(--rgb-background, 255, 255, 255);
|
|
28
|
-
--em-rgb-input: var(--rgb-input, 255, 255, 255);
|
|
29
|
-
--em-color-border: var(--color-border, rgba(0, 0, 0, .05));
|
|
30
|
-
--em-color-border-over: var(--color-border-over, rgba(0, 0, 0, .1));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
[data-theme="dark"] {
|
|
34
|
-
--em-rgb-color: var(--rgb-color, 222, 222, 221);
|
|
35
|
-
--em-rgb-accent: var(--rgb-accent, 58, 130, 247);
|
|
36
|
-
--em-rgb-background: var(--rgb-background, 21, 22, 23);
|
|
37
|
-
--em-rgb-input: var(--rgb-input, 0, 0, 0);
|
|
38
|
-
--em-color-border: var(--color-border, rgba(255, 255, 255, .1));
|
|
39
|
-
--em-color-border-over: var(--color-border-over, rgba(255, 255, 255, .2));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
#root {
|
|
43
|
-
--color-a: rgb(var(--em-rgb-color));
|
|
44
|
-
--color-b: rgba(var(--em-rgb-color), .65);
|
|
45
|
-
--color-c: rgba(var(--em-rgb-color), .45);
|
|
46
|
-
--padding: 12px;
|
|
47
|
-
--padding-small: calc(var(--padding) / 2);
|
|
48
|
-
--sidebar-width: 16px;
|
|
49
|
-
--duration: 225ms;
|
|
50
|
-
--duration-fast: 125ms;
|
|
51
|
-
--duration-instant: 50ms;
|
|
52
|
-
--easing: cubic-bezier(.4, 0, .2, 1);
|
|
53
|
-
width: 100%;
|
|
54
|
-
text-align: left;
|
|
55
|
-
border-radius: var(--border-radius);
|
|
56
|
-
background-color: rgb(var(--em-rgb-background));
|
|
57
|
-
position: relative;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@media (prefers-reduced-motion) {
|
|
61
|
-
#root {
|
|
62
|
-
--duration: 0;
|
|
63
|
-
--duration-fast: 0;
|
|
64
|
-
--duration-instant: 0;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
#root[data-menu] button {
|
|
69
|
-
cursor: auto;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
#root[data-menu] .menu button {
|
|
73
|
-
cursor: pointer;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
:host, #root, input, button {
|
|
77
|
-
color: rgb(var(--em-rgb-color));
|
|
78
|
-
font-family: var(--font-family);
|
|
79
|
-
font-size: var(--font-size);
|
|
80
|
-
-webkit-font-smoothing: antialiased;
|
|
81
|
-
-moz-osx-font-smoothing: grayscale;
|
|
82
|
-
line-height: normal;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
*, :before, :after {
|
|
86
|
-
box-sizing: border-box;
|
|
87
|
-
min-width: 0;
|
|
88
|
-
margin: 0;
|
|
89
|
-
padding: 0;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.relative {
|
|
93
|
-
position: relative;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.flex {
|
|
97
|
-
display: flex;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.flex-auto {
|
|
101
|
-
flex: none;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.flex-center {
|
|
105
|
-
justify-content: center;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.flex-column {
|
|
109
|
-
flex-direction: column;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.flex-grow {
|
|
113
|
-
flex: auto;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.flex-middle {
|
|
117
|
-
align-items: center;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.flex-wrap {
|
|
121
|
-
flex-wrap: wrap;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.padding {
|
|
125
|
-
padding: var(--padding);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.padding-t {
|
|
129
|
-
padding-top: var(--padding);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.padding-lr {
|
|
133
|
-
padding-left: var(--padding);
|
|
134
|
-
padding-right: var(--padding);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.padding-r {
|
|
138
|
-
padding-right: var(--padding);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.padding-small {
|
|
142
|
-
padding: var(--padding-small);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.padding-small-b {
|
|
146
|
-
padding-bottom: var(--padding-small);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.padding-small-lr {
|
|
150
|
-
padding-left: var(--padding-small);
|
|
151
|
-
padding-right: var(--padding-small);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.margin {
|
|
155
|
-
margin: var(--padding);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.margin-r {
|
|
159
|
-
margin-right: var(--padding);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.margin-l {
|
|
163
|
-
margin-left: var(--padding);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.margin-small-l {
|
|
167
|
-
margin-left: var(--padding-small);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.margin-small-lr {
|
|
171
|
-
margin-left: var(--padding-small);
|
|
172
|
-
margin-right: var(--padding-small);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.align-l {
|
|
176
|
-
text-align: left;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.align-r {
|
|
180
|
-
text-align: right;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.color-a {
|
|
184
|
-
color: var(--color-a);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.color-b {
|
|
188
|
-
color: var(--color-b);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.color-c {
|
|
192
|
-
color: var(--color-c);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.ellipsis {
|
|
196
|
-
white-space: nowrap;
|
|
197
|
-
max-width: 100%;
|
|
198
|
-
width: auto;
|
|
199
|
-
text-overflow: ellipsis;
|
|
200
|
-
overflow: hidden;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.sr-only {
|
|
204
|
-
width: 1px;
|
|
205
|
-
height: 1px;
|
|
206
|
-
position: absolute;
|
|
207
|
-
top: auto;
|
|
208
|
-
left: -10000px;
|
|
209
|
-
overflow: hidden;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
a {
|
|
213
|
-
cursor: pointer;
|
|
214
|
-
color: rgb(var(--em-rgb-accent));
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
a:hover {
|
|
218
|
-
text-decoration: underline;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.spacer {
|
|
222
|
-
height: 10px;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
[dir="rtl"] .scroll {
|
|
226
|
-
padding-left: 0;
|
|
227
|
-
padding-right: var(--padding);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.scroll {
|
|
231
|
-
padding-right: 0;
|
|
232
|
-
overflow-x: hidden;
|
|
233
|
-
overflow-y: auto;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.scroll::-webkit-scrollbar {
|
|
237
|
-
width: var(--sidebar-width);
|
|
238
|
-
height: var(--sidebar-width);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.scroll::-webkit-scrollbar-track {
|
|
242
|
-
border: 0;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.scroll::-webkit-scrollbar-button {
|
|
246
|
-
width: 0;
|
|
247
|
-
height: 0;
|
|
248
|
-
display: none;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.scroll::-webkit-scrollbar-corner {
|
|
252
|
-
background-color: rgba(0, 0, 0, 0);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
.scroll::-webkit-scrollbar-thumb {
|
|
256
|
-
min-height: 20%;
|
|
257
|
-
min-height: 65px;
|
|
258
|
-
border: 4px solid rgb(var(--em-rgb-background));
|
|
259
|
-
border-radius: 8px;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
.scroll::-webkit-scrollbar-thumb:hover {
|
|
263
|
-
background-color: var(--em-color-border-over) !important;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.scroll:hover::-webkit-scrollbar-thumb {
|
|
267
|
-
background-color: var(--em-color-border);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
.sticky {
|
|
271
|
-
z-index: 1;
|
|
272
|
-
background-color: rgba(var(--em-rgb-background), .9);
|
|
273
|
-
-webkit-backdrop-filter: blur(4px);
|
|
274
|
-
backdrop-filter: blur(4px);
|
|
275
|
-
font-weight: 500;
|
|
276
|
-
position: sticky;
|
|
277
|
-
top: -1px;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
[dir="rtl"] .search input[type="search"] {
|
|
281
|
-
padding: 10px 2.2em 10px 2em;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
[dir="rtl"] .search .loupe {
|
|
285
|
-
left: auto;
|
|
286
|
-
right: .7em;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
[dir="rtl"] .search .delete {
|
|
290
|
-
left: .7em;
|
|
291
|
-
right: auto;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.search {
|
|
295
|
-
z-index: 2;
|
|
296
|
-
position: relative;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.search input, .search button {
|
|
300
|
-
font-size: calc(var(--font-size) - 1px);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.search input[type="search"] {
|
|
304
|
-
width: 100%;
|
|
305
|
-
background-color: var(--em-color-border);
|
|
306
|
-
transition-duration: var(--duration);
|
|
307
|
-
transition-property: background-color, box-shadow;
|
|
308
|
-
transition-timing-function: var(--easing);
|
|
309
|
-
border: 0;
|
|
310
|
-
border-radius: 10px;
|
|
311
|
-
outline: 0;
|
|
312
|
-
padding: 10px 2em 10px 2.2em;
|
|
313
|
-
display: block;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.search input[type="search"]::-ms-input-placeholder {
|
|
317
|
-
color: inherit;
|
|
318
|
-
opacity: .6;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.search input[type="search"]::placeholder {
|
|
322
|
-
color: inherit;
|
|
323
|
-
opacity: .6;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
.search input[type="search"], .search input[type="search"]::-webkit-search-decoration, .search input[type="search"]::-webkit-search-cancel-button, .search input[type="search"]::-webkit-search-results-button, .search input[type="search"]::-webkit-search-results-decoration {
|
|
327
|
-
-webkit-appearance: none;
|
|
328
|
-
-ms-appearance: none;
|
|
329
|
-
appearance: none;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.search input[type="search"]:focus {
|
|
333
|
-
background-color: rgb(var(--em-rgb-input));
|
|
334
|
-
box-shadow: inset 0 0 0 1px rgb(var(--em-rgb-accent)), 0 1px 3px rgba(65, 69, 73, .2);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.search .icon {
|
|
338
|
-
z-index: 1;
|
|
339
|
-
color: rgba(var(--em-rgb-color), .7);
|
|
340
|
-
position: absolute;
|
|
341
|
-
top: 50%;
|
|
342
|
-
transform: translateY(-50%);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
.search .loupe {
|
|
346
|
-
pointer-events: none;
|
|
347
|
-
left: .7em;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
.search .delete {
|
|
351
|
-
right: .7em;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
svg {
|
|
355
|
-
fill: currentColor;
|
|
356
|
-
width: 1em;
|
|
357
|
-
height: 1em;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
button {
|
|
361
|
-
-webkit-appearance: none;
|
|
362
|
-
-ms-appearance: none;
|
|
363
|
-
appearance: none;
|
|
364
|
-
cursor: pointer;
|
|
365
|
-
color: currentColor;
|
|
366
|
-
background-color: rgba(0, 0, 0, 0);
|
|
367
|
-
border: 0;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
#nav {
|
|
371
|
-
z-index: 2;
|
|
372
|
-
padding-top: 12px;
|
|
373
|
-
padding-bottom: 12px;
|
|
374
|
-
padding-right: var(--sidebar-width);
|
|
375
|
-
position: relative;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
#nav button {
|
|
379
|
-
color: var(--color-b);
|
|
380
|
-
transition: color var(--duration) var(--easing);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
#nav button:hover {
|
|
384
|
-
color: var(--color-a);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
#nav svg, #nav img {
|
|
388
|
-
width: var(--category-icon-size);
|
|
389
|
-
height: var(--category-icon-size);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
#nav[dir="rtl"] .bar {
|
|
393
|
-
left: auto;
|
|
394
|
-
right: 0;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
#nav .bar {
|
|
398
|
-
width: 100%;
|
|
399
|
-
height: 3px;
|
|
400
|
-
background-color: rgb(var(--em-rgb-accent));
|
|
401
|
-
transition: transform var(--duration) var(--easing);
|
|
402
|
-
border-radius: 3px 3px 0 0;
|
|
403
|
-
position: absolute;
|
|
404
|
-
bottom: -12px;
|
|
405
|
-
left: 0;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
#nav button[aria-selected] {
|
|
409
|
-
color: rgb(var(--em-rgb-accent));
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
#preview {
|
|
413
|
-
z-index: 2;
|
|
414
|
-
padding: calc(var(--padding) + 4px) var(--padding);
|
|
415
|
-
padding-right: var(--sidebar-width);
|
|
416
|
-
position: relative;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
#preview .preview-placeholder {
|
|
420
|
-
font-size: var(--preview-placeholder-size);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
#preview .preview-title {
|
|
424
|
-
font-size: var(--preview-title-size);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
#preview .preview-subtitle {
|
|
428
|
-
font-size: var(--preview-subtitle-size);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
#nav:before, #preview:before {
|
|
432
|
-
content: "";
|
|
433
|
-
height: 2px;
|
|
434
|
-
position: absolute;
|
|
435
|
-
left: 0;
|
|
436
|
-
right: 0;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
#nav[data-position="top"]:before, #preview[data-position="top"]:before {
|
|
440
|
-
background: linear-gradient(to bottom, var(--em-color-border), transparent);
|
|
441
|
-
top: 100%;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
#nav[data-position="bottom"]:before, #preview[data-position="bottom"]:before {
|
|
445
|
-
background: linear-gradient(to top, var(--em-color-border), transparent);
|
|
446
|
-
bottom: 100%;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
.category:last-child {
|
|
450
|
-
min-height: calc(100% + 1px);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
.category button {
|
|
454
|
-
font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, sans-serif;
|
|
455
|
-
position: relative;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
.category button > * {
|
|
459
|
-
position: relative;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
.category button .background {
|
|
463
|
-
opacity: 0;
|
|
464
|
-
background-color: var(--em-color-border);
|
|
465
|
-
transition: opacity var(--duration-fast) var(--easing) var(--duration-instant);
|
|
466
|
-
position: absolute;
|
|
467
|
-
top: 0;
|
|
468
|
-
bottom: 0;
|
|
469
|
-
left: 0;
|
|
470
|
-
right: 0;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
.category button:hover .background {
|
|
474
|
-
transition-duration: var(--duration-instant);
|
|
475
|
-
transition-delay: 0s;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
.category button[aria-selected] .background {
|
|
479
|
-
opacity: 1;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
.category button[data-keyboard] .background {
|
|
483
|
-
transition: none;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
.row {
|
|
487
|
-
width: 100%;
|
|
488
|
-
position: absolute;
|
|
489
|
-
top: 0;
|
|
490
|
-
left: 0;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
.skin-tone-button {
|
|
494
|
-
border: 1px solid rgba(0, 0, 0, 0);
|
|
495
|
-
border-radius: 100%;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
.skin-tone-button:hover {
|
|
499
|
-
border-color: var(--em-color-border);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
.skin-tone-button:active .skin-tone {
|
|
503
|
-
transform: scale(.85) !important;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
.skin-tone-button .skin-tone {
|
|
507
|
-
transition: transform var(--duration) var(--easing);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
.skin-tone-button[aria-selected] {
|
|
511
|
-
background-color: var(--em-color-border);
|
|
512
|
-
border-top-color: rgba(0, 0, 0, .05);
|
|
513
|
-
border-bottom-color: rgba(0, 0, 0, 0);
|
|
514
|
-
border-left-width: 0;
|
|
515
|
-
border-right-width: 0;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
.skin-tone-button[aria-selected] .skin-tone {
|
|
519
|
-
transform: scale(.9);
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
.menu {
|
|
523
|
-
z-index: 2;
|
|
524
|
-
white-space: nowrap;
|
|
525
|
-
border: 1px solid var(--em-color-border);
|
|
526
|
-
background-color: rgba(var(--em-rgb-background), .9);
|
|
527
|
-
-webkit-backdrop-filter: blur(4px);
|
|
528
|
-
backdrop-filter: blur(4px);
|
|
529
|
-
transition-property: opacity, transform;
|
|
530
|
-
transition-duration: var(--duration);
|
|
531
|
-
transition-timing-function: var(--easing);
|
|
532
|
-
border-radius: 10px;
|
|
533
|
-
padding: 4px;
|
|
534
|
-
position: absolute;
|
|
535
|
-
box-shadow: 1px 1px 5px rgba(0, 0, 0, .05);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
.menu.hidden {
|
|
539
|
-
opacity: 0;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
.menu[data-position="bottom"] {
|
|
543
|
-
transform-origin: 100% 100%;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
.menu[data-position="bottom"].hidden {
|
|
547
|
-
transform: scale(.9)rotate(-3deg)translateY(5%);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
.menu[data-position="top"] {
|
|
551
|
-
transform-origin: 100% 0;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
.menu[data-position="top"].hidden {
|
|
555
|
-
transform: scale(.9)rotate(3deg)translateY(-5%);
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
.menu input[type="radio"] {
|
|
559
|
-
clip: rect(0 0 0 0);
|
|
560
|
-
width: 1px;
|
|
561
|
-
height: 1px;
|
|
562
|
-
border: 0;
|
|
563
|
-
margin: 0;
|
|
564
|
-
padding: 0;
|
|
565
|
-
position: absolute;
|
|
566
|
-
overflow: hidden;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
.menu input[type="radio"]:checked + .option {
|
|
570
|
-
box-shadow: 0 0 0 2px rgb(var(--em-rgb-accent));
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
.option {
|
|
574
|
-
width: 100%;
|
|
575
|
-
border-radius: 6px;
|
|
576
|
-
padding: 4px 6px;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
.option:hover {
|
|
580
|
-
color: #fff;
|
|
581
|
-
background-color: rgb(var(--em-rgb-accent));
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
.skin-tone {
|
|
585
|
-
width: 16px;
|
|
586
|
-
height: 16px;
|
|
587
|
-
border-radius: 100%;
|
|
588
|
-
display: inline-block;
|
|
589
|
-
position: relative;
|
|
590
|
-
overflow: hidden;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
.skin-tone:after {
|
|
594
|
-
content: "";
|
|
595
|
-
mix-blend-mode: overlay;
|
|
596
|
-
background: linear-gradient(rgba(255, 255, 255, .2), rgba(0, 0, 0, 0));
|
|
597
|
-
border: 1px solid rgba(0, 0, 0, .8);
|
|
598
|
-
border-radius: 100%;
|
|
599
|
-
position: absolute;
|
|
600
|
-
top: 0;
|
|
601
|
-
bottom: 0;
|
|
602
|
-
left: 0;
|
|
603
|
-
right: 0;
|
|
604
|
-
box-shadow: inset 0 -2px 3px #000, inset 0 1px 2px #fff;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
.skin-tone-1 {
|
|
608
|
-
background-color: #ffc93a;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
.skin-tone-2 {
|
|
612
|
-
background-color: #ffdab7;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
.skin-tone-3 {
|
|
616
|
-
background-color: #e7b98f;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
.skin-tone-4 {
|
|
620
|
-
background-color: #c88c61;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
.skin-tone-5 {
|
|
624
|
-
background-color: #a46134;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
.skin-tone-6 {
|
|
628
|
-
background-color: #5d4437;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
[data-index] {
|
|
632
|
-
justify-content: space-between;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
[data-emoji-set="twitter"] .skin-tone:after {
|
|
636
|
-
box-shadow: none;
|
|
637
|
-
border-color: rgba(0, 0, 0, .5);
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
[data-emoji-set="twitter"] .skin-tone-1 {
|
|
641
|
-
background-color: #fade72;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
[data-emoji-set="twitter"] .skin-tone-2 {
|
|
645
|
-
background-color: #f3dfd0;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
[data-emoji-set="twitter"] .skin-tone-3 {
|
|
649
|
-
background-color: #eed3a8;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
[data-emoji-set="twitter"] .skin-tone-4 {
|
|
653
|
-
background-color: #cfad8d;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
[data-emoji-set="twitter"] .skin-tone-5 {
|
|
657
|
-
background-color: #a8805d;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
[data-emoji-set="twitter"] .skin-tone-6 {
|
|
661
|
-
background-color: #765542;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
[data-emoji-set="google"] .skin-tone:after {
|
|
665
|
-
box-shadow: inset 0 0 2px 2px rgba(0, 0, 0, .4);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
[data-emoji-set="google"] .skin-tone-1 {
|
|
669
|
-
background-color: #f5c748;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
[data-emoji-set="google"] .skin-tone-2 {
|
|
673
|
-
background-color: #f1d5aa;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
[data-emoji-set="google"] .skin-tone-3 {
|
|
677
|
-
background-color: #d4b48d;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
[data-emoji-set="google"] .skin-tone-4 {
|
|
681
|
-
background-color: #aa876b;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
[data-emoji-set="google"] .skin-tone-5 {
|
|
685
|
-
background-color: #916544;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
[data-emoji-set="google"] .skin-tone-6 {
|
|
689
|
-
background-color: #61493f;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
[data-emoji-set="facebook"] .skin-tone:after {
|
|
693
|
-
border-color: rgba(0, 0, 0, .4);
|
|
694
|
-
box-shadow: inset 0 -2px 3px #000, inset 0 1px 4px #fff;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
[data-emoji-set="facebook"] .skin-tone-1 {
|
|
698
|
-
background-color: #f5c748;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
[data-emoji-set="facebook"] .skin-tone-2 {
|
|
702
|
-
background-color: #f1d5aa;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
[data-emoji-set="facebook"] .skin-tone-3 {
|
|
706
|
-
background-color: #d4b48d;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
[data-emoji-set="facebook"] .skin-tone-4 {
|
|
710
|
-
background-color: #aa876b;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
[data-emoji-set="facebook"] .skin-tone-5 {
|
|
714
|
-
background-color: #916544;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
[data-emoji-set="facebook"] .skin-tone-6 {
|
|
718
|
-
background-color: #61493f;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
`;function Di(e){const t=_.useRef(null),n=_.useRef(null);return n.current&&n.current.update(e),_.useEffect(()=>(n.current=new It({...e,ref:t}),()=>{n.current=null}),[]),hs.createElement("div",{ref:t})}function Ui(e){let t=0,n=0,r=0;if(e.startsWith("#")){const s=e.replace("#","");t=parseInt(s.substring(0,2),16),n=parseInt(s.substring(2,4),16),r=parseInt(s.substring(4,6),16)}return(.299*t+.587*n+.114*r)/255>.5}function Rt({onSend:e,onTyping:t,config:n,fileUpload:r,disabled:s=!1}){var Z,F,A,X,D,Q;const[o,i]=_.useState(""),[l,c]=_.useState(!1),[u,a]=_.useState(),[f,m]=_.useState(null),[v,d]=_.useState(!1),g=_.useRef(null),b=_.useRef(null),x=_.useRef(null),S=_.useRef(null),w=_.useRef(null),C=_.useRef(null),R=_.useRef(!1),M=n.enableEmoji??!0,k=n.enableFileUpload??!0,N=((Z=n.theme)==null?void 0:Z.background)||"#00001a",T=Ui(N),j=((F=n.theme)==null?void 0:F.text)||(T?"#1a1a2e":"#f7f7f8"),z=((A=n.theme)==null?void 0:A.textMuted)||(T?"rgba(0,0,0,0.4)":"rgba(247,247,248,0.45)"),U=((X=n.theme)==null?void 0:X.primary)||"#337eff";_.useEffect(()=>{M&&(async()=>{try{const $=await fetch("https://cdn.jsdelivr.net/npm/@emoji-mart/data");a(await $.json())}catch($){console.error("Failed to load emoji data:",$)}})()},[M]),_.useEffect(()=>{const $=q=>{b.current&&!b.current.contains(q.target)&&c(!1)};return l&&document.addEventListener("mousedown",$),()=>{document.removeEventListener("mousedown",$)}},[l]),_.useEffect(()=>()=>{w.current&&clearTimeout(w.current),C.current&&clearTimeout(C.current)},[]),_.useEffect(()=>{if(!l)return;const $=()=>{if(x.current){const q=x.current.getBoundingClientRect();m({top:q.top-370,left:q.left-300})}};return window.addEventListener("resize",$),window.addEventListener("scroll",$,!0),()=>{window.removeEventListener("resize",$),window.removeEventListener("scroll",$,!0)}},[l]);const te=$=>{i($),t&&n.enableTypingIndicator!==!1&&(C.current&&clearTimeout(C.current),w.current&&clearTimeout(w.current),R.current||(C.current=setTimeout(()=>{t(!0),R.current=!0},300)),w.current=setTimeout(()=>{R.current&&(t(!1),R.current=!1)},1500))},K=()=>{var q;const $=o.trim();!$||s||(e($),i(""),c(!1),t&&(w.current&&clearTimeout(w.current),C.current&&clearTimeout(C.current),R.current&&(t(!1),R.current=!1)),(q=g.current)==null||q.focus())},re=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),K())},B=$=>{const q=g.current;if(!q){i(fe=>fe+$);return}const Ie=q.selectionStart,De=q.selectionEnd,Ue=o.slice(0,Ie)+$+o.slice(De);i(Ue),setTimeout(()=>{const fe=Ie+$.length;q.setSelectionRange(fe,fe),q.focus()},0)},se=async $=>{var De,Ue,fe;const q=$.target.files;if(!q||q.length===0)return;const Ie=q[0];try{(De=n.toast)==null||De.info("Uploading file...");const pe=await r.uploadFile(Ie);pe!=null&&pe.markdown&&(B(`
|
|
722
|
-
${pe.markdown}
|
|
723
|
-
`),(Ue=n.toast)==null||Ue.success("File uploaded successfully"))}catch(pe){console.error("File upload failed:",pe),(fe=n.toast)==null||fe.error(pe.message)}finally{S.current&&(S.current.value="")}},I=o.trim().length>0&&!s,H=T?"rgba(0,0,0,0.35)":"rgba(247,247,248,0.3)";return h.jsxs("div",{className:"px-4 py-3",style:{borderTop:T?"1px solid rgba(0,0,0,0.06)":"1px solid rgba(255,255,255,0.06)"},children:[h.jsxs("div",{className:"relative flex items-center rounded-full transition-all duration-200",style:{backgroundColor:T?"rgba(112,115,124,0.08)":"rgba(112,115,124,0.12)",outline:v?`2px solid ${U}`:"none",outlineOffset:"-1px",border:T?"1px solid rgba(0,0,0,0.1)":"1px solid rgba(255,255,255,0.08)",backdropFilter:"blur(32px)"},children:[h.jsx("style",{children:`.xchat-input::placeholder { color: ${H}; }`}),h.jsx("textarea",{ref:g,value:o,onChange:$=>te($.target.value),onKeyDown:re,onFocus:()=>d(!0),onBlur:()=>d(!1),placeholder:"Type a message...",rows:1,className:"xchat-input flex-1 resize-none bg-transparent outline-none border-none",style:{color:j,border:"none",WebkitAppearance:"none",padding:"10px 0 10px 20px",minHeight:"42px",maxHeight:"120px",caretColor:U,fontSize:"14px",lineHeight:"20px",letterSpacing:"0.006em"},disabled:s}),h.jsxs("div",{className:"flex items-center gap-1 px-2 shrink-0",children:[M&&h.jsx("button",{ref:x,type:"button",onClick:()=>{if(!l&&x.current){const $=x.current.getBoundingClientRect();m({top:$.top-450,left:$.left-290})}c($=>!$)},className:"p-1.5 rounded-lg transition-all duration-150",style:{color:z,backgroundColor:"transparent"},onMouseEnter:$=>{$.currentTarget.style.backgroundColor=T?"rgba(0,0,0,0.06)":"rgba(255,255,255,0.06)",$.currentTarget.style.color=j},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent",$.currentTarget.style.color=z},disabled:s,"aria-label":"Add emoji",children:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[h.jsx("title",{children:"Emoji"}),h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),h.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),h.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})}),k&&r.canUpload&&h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",onClick:()=>{var $;return($=S.current)==null?void 0:$.click()},className:"p-1.5 rounded-lg transition-all duration-150",style:{color:z,backgroundColor:"transparent"},onMouseEnter:$=>{$.currentTarget.style.backgroundColor="rgba(255,255,255,0.06)",$.currentTarget.style.color=j},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent",$.currentTarget.style.color=z},disabled:s||r.isUploading,"aria-label":"Attach file",children:r.isUploading?h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",className:"animate-spin","aria-hidden":"true",children:[h.jsx("title",{children:"Uploading"}),h.jsx("path",{d:"M21 12a9 9 0 11-6.219-8.56"})]}):h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[h.jsx("title",{children:"Attach file"}),h.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})]})}),h.jsx("input",{ref:S,type:"file",accept:"image/*,application/pdf,.doc,.docx",className:"hidden",onChange:se})]}),h.jsx("button",{type:"button",onClick:K,disabled:!I,className:"p-1.5 rounded-lg transition-all duration-200",style:{background:I?`linear-gradient(135deg, ${U}, ${((D=n.theme)==null?void 0:D.primaryStrong)||"#005eff"})`:"transparent",color:I?"#ffffff":z,opacity:I?1:.35,cursor:I?"pointer":"default",boxShadow:I?`0 2px 8px -2px ${U}60`:"none"},"aria-label":"Send message",children:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[h.jsx("title",{children:"Send"}),h.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),h.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),r.isUploading&&h.jsxs("div",{className:"mt-2 px-1",children:[h.jsx("div",{className:"w-full rounded-full overflow-hidden",style:{height:3,backgroundColor:T?"rgba(0,0,0,0.06)":"rgba(255,255,255,0.06)"},children:h.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${r.uploadProgress}%`,background:`linear-gradient(90deg, ${U}, ${((Q=n.theme)==null?void 0:Q.primaryStrong)||"#005eff"})`}})}),h.jsxs("p",{className:"mt-1",style:{fontSize:"11px",letterSpacing:"0.019em",color:z},children:["Uploading... ",r.uploadProgress,"%"]})]}),l&&u&&f&&typeof document<"u"&&bs.createPortal(h.jsx("div",{ref:b,className:"fixed rounded-xl overflow-hidden",style:{top:`${f.top}px`,left:`${f.left}px`,zIndex:9999,boxShadow:["inset 0 0 0 0.5px rgba(255,255,255,0.06)","inset 0 1px 0 0 rgba(255,255,255,0.1)","0 16px 48px -8px rgba(0,0,0,0.5)"].join(", ")},children:h.jsx(Di,{data:u,onEmojiSelect:$=>{B($.native||$.shortcodes||""),c(!1)},previewPosition:"none",skinTonePosition:"none",navPosition:"bottom",perLine:8,searchPosition:"sticky",theme:"dark"})}),document.body)]})}try{Rt.displayName="ChatInput",Rt.__docgenInfo={description:"",displayName:"ChatInput",props:{onSend:{defaultValue:null,description:"",name:"onSend",required:!0,type:{name:"(message: string) => void"}},onTyping:{defaultValue:null,description:"",name:"onTyping",required:!1,type:{name:"((isTyping: boolean) => void) | undefined"}},config:{defaultValue:null,description:"",name:"config",required:!0,type:{name:"IChatConfig"}},fileUpload:{defaultValue:null,description:"",name:"fileUpload",required:!0,type:{name:"UseFileUploadReturn"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean | undefined"}}}}}catch{}function Fi(){var t;let e;try{const n=localStorage.getItem("xcelsior-chat-anon-id");n?e=n:(e=`anon-${((t=crypto.randomUUID)==null?void 0:t.call(crypto))||Math.random().toString(36).slice(2)}`,localStorage.setItem("xcelsior-chat-anon-id",e))}catch{e=`anon-${Math.random().toString(36).slice(2)}`}return{name:"Visitor",email:`${e}@anonymous.xcelsior.co`,type:"customer",status:"online"}}function Tt({config:e,className:t="",variant:n="popover",externalWebSocket:r,onMinimize:s,onClose:o,resolvedPosition:i="right"}){var K,re,B,se,I,H,Z,F;const l=n==="fullPage",c=e.currentUser||Fi(),u={...e,currentUser:c},a=ys(u,r),{messages:f,addMessage:m,isLoading:v,loadMore:d,hasMore:g,isLoadingMore:b}=Go(a,u),x=Yo(e.apiKey,e.fileUpload),{isTyping:S,typingUsers:w}=Zo(a),C=_.useCallback(A=>{var D,Q;if(!a.isConnected){(D=e.toast)==null||D.error("Not connected to chat server");return}const X={id:`temp-${Date.now()}`,conversationId:e.conversationId||"",senderId:c.email,senderType:c.type,content:A,messageType:"text",createdAt:new Date().toISOString(),status:"sent"};m(X),a.sendMessage("sendMessage",{conversationId:e.conversationId,content:A,messageType:"text"}),(Q=e.onMessageSent)==null||Q.call(e,X)},[a,e,m,c]),R=_.useCallback(A=>{!a.isConnected||e.enableTypingIndicator===!1||a.sendMessage("typing",{conversationId:e.conversationId,isTyping:A})},[a,e]);_.useEffect(()=>{var A;a.error&&((A=e.toast)==null||A.error(a.error.message||"An error occurred"))},[a.error,e]);const M=((K=e.theme)==null?void 0:K.background)||"#00001a";(re=e.theme)!=null&&re.backgroundAlt;const k=((B=e.theme)==null?void 0:B.text)||"#f7f7f8",N=((se=e.theme)==null?void 0:se.primary)||"#337eff",T=((I=e.theme)==null?void 0:I.textMuted)||"rgba(247,247,248,0.45)",j=(()=>{if(!M.startsWith("#"))return!1;const A=M.replace("#",""),X=parseInt(A.substring(0,2),16),D=parseInt(A.substring(2,4),16),Q=parseInt(A.substring(4,6),16);return(.299*X+.587*D+.114*Q)/255>.5})(),z=i==="left"?"left-4":"right-4",U=l?{backgroundColor:M,color:k}:{width:380,height:580,maxHeight:"calc(100vh - 100px)",backgroundColor:M,color:k,borderRadius:16,boxShadow:j?["0 25px 60px -12px rgba(0,0,0,0.15)","0 0 0 1px rgba(0,0,0,0.08)"].join(", "):["inset 0 0 0 0.5px rgba(255,255,255,0.06)","inset 0 1px 0 0 rgba(255,255,255,0.12)","0 25px 60px -12px rgba(0,0,0,0.6)","0 0 40px -8px rgba(51,126,255,0.15)"].join(", ")},te=l?{}:{backgroundImage:j?"radial-gradient(circle, rgba(0,0,0,0.04) 1px, transparent 1px)":"radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px)",backgroundSize:"24px 24px"};return h.jsxs("div",{className:l?`flex flex-col h-full ${t}`:`fixed bottom-20 ${z} z-50 flex flex-col overflow-hidden ${t}`,style:{...U,...te},children:[!l&&h.jsx(xt,{agent:c.type==="customer"?{email:"contact@xcelsior.co",name:"Xcelsior Software",type:"agent",status:a.isConnected?"online":"offline"}:void 0,onMinimize:s,onClose:o,theme:e.theme}),!a.isConnected&&h.jsx("div",{className:"px-4 py-2",style:{backgroundColor:j?"rgba(255,169,56,0.08)":"rgba(255,169,56,0.06)",borderBottom:`1px solid rgba(255,169,56,${j?"0.15":"0.12"})`},children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-pulse",style:{backgroundColor:((H=e.theme)==null?void 0:H.statusCaution)||"#ffa938"}}),h.jsx("span",{style:{fontSize:"12px",letterSpacing:"0.015em",color:((Z=e.theme)==null?void 0:Z.statusCaution)||"#ffa938"},children:"Reconnecting..."}),h.jsx("button",{type:"button",onClick:a.reconnect,className:"ml-auto transition-opacity",style:{fontSize:"12px",letterSpacing:"0.015em",color:((F=e.theme)==null?void 0:F.statusCaution)||"#ffa938",opacity:.7},onMouseEnter:A=>{A.currentTarget.style.opacity="1"},onMouseLeave:A=>{A.currentTarget.style.opacity="0.7"},children:"Retry"})]})}),v?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"w-7 h-7 border-2 border-t-transparent rounded-full animate-spin mx-auto mb-3",style:{borderColor:N,borderTopColor:"transparent"}}),h.jsx("p",{style:{fontSize:"12px",letterSpacing:"0.015em",color:T},children:"Loading messages..."})]})}):h.jsx(wt,{messages:f,currentUser:c,isTyping:S,typingUser:w[0],autoScroll:!0,onLoadMore:d,hasMore:g,isLoadingMore:b,theme:e.theme}),h.jsx(Rt,{onSend:C,onTyping:R,config:u,fileUpload:x,disabled:!a.isConnected}),!l&&h.jsx("div",{className:"px-4 py-1.5 text-center",style:{borderTop:j?"1px solid rgba(0,0,0,0.06)":"1px solid rgba(255,255,255,0.06)",backgroundColor:j?"rgba(0,0,0,0.03)":"rgba(0,0,0,0.2)"},children:h.jsxs("p",{style:{fontSize:"10px",letterSpacing:"0.025em",color:j?"rgba(0,0,0,0.35)":"rgba(247,247,248,0.28)"},children:["Powered by"," ",h.jsx("span",{style:{fontWeight:600,color:j?"rgba(0,0,0,0.5)":"rgba(247,247,248,0.45)"},children:"Xcelsior"})]})})]})}try{Tt.displayName="ChatWidget",Tt.__docgenInfo={description:"",displayName:"ChatWidget",props:{config:{defaultValue:null,description:"",name:"config",required:!0,type:{name:"IChatConfig"}},className:{defaultValue:{value:""},description:"",name:"className",required:!1,type:{name:"string | undefined"}},variant:{defaultValue:{value:"popover"},description:"",name:"variant",required:!1,type:{name:"enum",value:[{value:"undefined"},{value:'"popover"'},{value:'"fullPage"'}]}},externalWebSocket:{defaultValue:null,description:"",name:"externalWebSocket",required:!1,type:{name:"WebSocket | null | undefined"}},onMinimize:{defaultValue:null,description:"",name:"onMinimize",required:!1,type:{name:"(() => void) | undefined"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!1,type:{name:"(() => void) | undefined"}},resolvedPosition:{defaultValue:{value:"right"},description:"Resolved position (left or right) from the parent Chat component",name:"resolvedPosition",required:!1,type:{name:"enum",value:[{value:"undefined"},{value:'"left"'},{value:'"right"'}]}}}}}catch{}function Mt({onSubmit:e,className:t="",initialName:n="",initialEmail:r="",onMinimize:s,onClose:o}){const[i,l]=_.useState(n),[c,u]=_.useState(r),[a,f]=_.useState({}),[m,v]=_.useState(!1),[d,g]=_.useState(null),b=()=>{const w={};return i.trim()?i.trim().length<2&&(w.name="Name must be at least 2 characters"):w.name="Name is required",c.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c)||(w.email="Please enter a valid email address"):w.email="Email is required",f(w),Object.keys(w).length===0},x=async w=>{if(w.preventDefault(),!!b()){v(!0);try{e(i.trim(),c.trim())}catch(C){console.error("Error submitting form:",C)}finally{v(!1)}}},S=(w,C)=>({width:"100%",padding:"10px 16px",fontSize:"14px",lineHeight:"20px",letterSpacing:"0.006em",color:"#f7f7f8",backgroundColor:"rgba(255,255,255,0.04)",border:"none",borderRadius:"12px",outline:"none",boxShadow:C?"inset 0 0 0 1px rgba(255,99,99,0.5)":d===w?"inset 0 0 0 1px rgba(51,126,255,0.4), 0 0 0 3px rgba(51,126,255,0.15)":"inset 0 0 0 0.5px rgba(255,255,255,0.08)",transition:"box-shadow 0.2s ease",caretColor:"#337eff"});return h.jsxs("div",{className:`fixed bottom-4 right-4 z-50 flex flex-col overflow-hidden ${t}`,style:{width:380,maxHeight:"calc(100vh - 2rem)",backgroundColor:"#00001a",borderRadius:16,boxShadow:["inset 0 0 0 0.5px rgba(255,255,255,0.06)","inset 0 1px 0 0 rgba(255,255,255,0.12)","0 25px 60px -12px rgba(0,0,0,0.6)","0 0 40px -8px rgba(51,126,255,0.15)"].join(", "),backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px)",backgroundSize:"24px 24px"},children:[h.jsxs("div",{className:"relative text-white overflow-hidden",style:{background:"linear-gradient(135deg, #337eff 0%, #005eff 50%, #001a66 100%)"},children:[h.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 40%)"}}),h.jsx("div",{className:"relative px-5 py-4",children:h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex-1",children:[h.jsx("h2",{className:"font-semibold",style:{fontSize:"17px",letterSpacing:"-0.01em"},children:"Start a Conversation"}),h.jsx("p",{className:"mt-1",style:{fontSize:"13px",letterSpacing:"0.015em",color:"rgba(255,255,255,0.6)"},children:"Please provide your details to continue"})]}),h.jsxs("div",{className:"flex gap-1 ml-2",children:[h.jsx("button",{type:"button",onClick:s,className:"p-2 rounded-lg transition-all duration-150",style:{backgroundColor:"transparent"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor="rgba(255,255,255,0.1)"},onMouseLeave:w=>{w.currentTarget.style.backgroundColor="transparent"},"aria-label":"Minimize chat",children:h.jsxs("svg",{width:"18",height:"18",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[h.jsx("title",{children:"Minimize"}),h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})]})}),h.jsx("button",{type:"button",onClick:o,className:"p-2 rounded-lg transition-all duration-150",style:{backgroundColor:"transparent"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor="rgba(255,255,255,0.1)"},onMouseLeave:w=>{w.currentTarget.style.backgroundColor="transparent"},"aria-label":"Close chat",children:h.jsxs("svg",{width:"18",height:"18",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[h.jsx("title",{children:"Close"}),h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})]})})]})]})}),h.jsx("div",{className:"h-px",style:{background:"linear-gradient(90deg, transparent 5%, rgba(255,255,255,0.12) 30%, rgba(255,255,255,0.12) 70%, transparent 95%)"}})]}),h.jsxs("form",{onSubmit:x,className:"p-5 flex flex-col gap-4",children:[h.jsxs("div",{children:[h.jsxs("label",{htmlFor:"chat-name",className:"block mb-2 font-medium",style:{fontSize:"13px",letterSpacing:"0.015em",color:"rgba(247,247,248,0.72)"},children:["Name ",h.jsx("span",{style:{color:"#ff6363"},children:"*"})]}),h.jsx("input",{type:"text",id:"chat-name",value:i,onChange:w=>{l(w.target.value),a.name&&f(C=>({...C,name:void 0}))},onFocus:()=>g("name"),onBlur:()=>g(null),style:S("name",!!a.name),placeholder:"John Doe",disabled:m,autoComplete:"name"}),a.name&&h.jsx("p",{className:"mt-1.5",style:{fontSize:"12px",letterSpacing:"0.015em",color:"#ff6363"},role:"alert",children:a.name})]}),h.jsxs("div",{children:[h.jsxs("label",{htmlFor:"chat-email",className:"block mb-2 font-medium",style:{fontSize:"13px",letterSpacing:"0.015em",color:"rgba(247,247,248,0.72)"},children:["Email ",h.jsx("span",{style:{color:"#ff6363"},children:"*"})]}),h.jsx("input",{type:"email",id:"chat-email",value:c,onChange:w=>{u(w.target.value),a.email&&f(C=>({...C,email:void 0}))},onFocus:()=>g("email"),onBlur:()=>g(null),style:S("email",!!a.email),placeholder:"john@example.com",disabled:m,autoComplete:"email"}),a.email&&h.jsx("p",{className:"mt-1.5",style:{fontSize:"12px",letterSpacing:"0.015em",color:"#ff6363"},role:"alert",children:a.email})]}),h.jsx("button",{type:"submit",disabled:m,className:"w-full py-2.5 rounded-xl font-semibold text-white transition-all duration-200",style:{fontSize:"14px",letterSpacing:"0.006em",background:"linear-gradient(135deg, #337eff, #005eff)",boxShadow:"0 4px 16px -4px rgba(51,126,255,0.4)",opacity:m?.6:1,cursor:m?"not-allowed":"pointer"},onMouseEnter:w=>{m||(w.currentTarget.style.boxShadow="0 6px 20px -4px rgba(51,126,255,0.5)")},onMouseLeave:w=>{w.currentTarget.style.boxShadow="0 4px 16px -4px rgba(51,126,255,0.4)"},children:m?h.jsxs("span",{className:"flex items-center justify-center gap-2",children:[h.jsxs("svg",{className:"animate-spin",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-label":"Loading",children:[h.jsx("title",{children:"Loading"}),h.jsx("path",{d:"M21 12a9 9 0 11-6.219-8.56"})]}),"Starting Chat..."]}):"Start Chat"}),h.jsx("p",{className:"text-center",style:{fontSize:"11px",letterSpacing:"0.019em",color:"rgba(247,247,248,0.28)"},children:"We respect your privacy. Your information will only be used to assist you."})]}),h.jsx("div",{className:"px-4 py-1.5 text-center",style:{borderTop:"1px solid rgba(255,255,255,0.06)",backgroundColor:"rgba(0,0,0,0.2)"},children:h.jsxs("p",{style:{fontSize:"10px",letterSpacing:"0.025em",color:"rgba(247,247,248,0.28)"},children:["Powered by"," ",h.jsx("span",{style:{fontWeight:600,color:"rgba(247,247,248,0.45)"},children:"Xcelsior"})]})})]})}try{Mt.displayName="PreChatForm",Mt.__docgenInfo={description:`PreChatForm component for collecting user information before starting chat.
|
|
724
|
-
Styled to match the Xcelsior website design system.`,displayName:"PreChatForm",props:{onSubmit:{defaultValue:null,description:"",name:"onSubmit",required:!0,type:{name:"(name: string, email: string) => void"}},className:{defaultValue:{value:""},description:"",name:"className",required:!1,type:{name:"string | undefined"}},initialName:{defaultValue:{value:""},description:"",name:"initialName",required:!1,type:{name:"string | undefined"}},initialEmail:{defaultValue:{value:""},description:"",name:"initialEmail",required:!1,type:{name:"string | undefined"}},onMinimize:{defaultValue:null,description:"Callback when user wants to minimize the form",name:"onMinimize",required:!0,type:{name:"() => void"}},onClose:{defaultValue:null,description:"Callback when user wants to close the form",name:"onClose",required:!0,type:{name:"() => void"}}}}}catch{}const ps="xcelsior-chat-position";function Bi(){try{const e=localStorage.getItem(ps);if(e==="left"||e==="right")return e}catch{}return"right"}function Hi(e){try{localStorage.setItem(ps,e)}catch{}}function qi(e="auto"){const t=e==="auto"?Bi():e,[n,r]=_.useState(t),[s,o]=_.useState(!1),i=_.useRef(0),l=_.useRef(null),c=_.useRef(!1),[u,a]=_.useState(!1);_.useEffect(()=>{try{if(!localStorage.getItem("xcelsior-chat-hint-shown")&&!c.current){c.current=!0,a(!0);const g=setTimeout(()=>{a(!1),localStorage.setItem("xcelsior-chat-hint-shown","true")},2e3);return()=>clearTimeout(g)}}catch{}},[]);const f=_.useCallback(d=>{i.current=d.clientX,o(!0),d.target.setPointerCapture(d.pointerId)},[]),m=_.useCallback(d=>{},[]),v=_.useCallback(d=>{o(!1),d.target.releasePointerCapture(d.pointerId);const g=d.clientX-i.current;if(Math.abs(g)>50){const b=window.innerWidth/2,x=d.clientX<b?"left":"right";x!==n&&(r(x),Hi(x))}},[n]);return{position:n,isDragging:s,showHint:u,fabRef:l,handlers:{onPointerDown:f,onPointerMove:m,onPointerUp:v}}}function Vi({state:e,defaultState:t="minimized",onStateChange:n}){const[r,s]=_.useState(t),o=e!==void 0&&e!=="undefined",i=o?e:r,l=_.useCallback(c=>{o||s(c),n==null||n(c)},[o,n]);return{currentState:i,setState:l,isControlled:o}}function qe(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).substring(2,15)}`}function Pt({config:e,className:t="",storageKeyPrefix:n="xcelsior_chat",onPreChatSubmit:r,state:s,defaultState:o="minimized",onStateChange:i}){var re,B,se,I;const[l,c]=_.useState(null),[u,a]=_.useState(""),[f,m]=_.useState(!0),[v,d]=_.useState(!1),[g,b]=_.useState(!1),x=e.identityCollection||"progressive",{position:S,isDragging:w,showHint:C,handlers:R}=qi(e.position),{currentState:M,setState:k}=Vi({state:s,defaultState:o,onStateChange:i}),N=_.useCallback(H=>{H==="open"&&M==="minimized"?(b(!0),d(!0),k(H),requestAnimationFrame(()=>{requestAnimationFrame(()=>{d(!1)})})):(H==="minimized"||H==="closed")&&M==="open"?(d(!0),setTimeout(()=>{b(!1),d(!1),k(H)},200)):k(H)},[M,k]);_.useEffect(()=>{M==="open"&&b(!0)},[M]),_.useEffect(()=>{(()=>{var Z,F;try{if((Z=e.currentUser)!=null&&Z.email&&((F=e.currentUser)!=null&&F.name)){const D=e.conversationId||qe(),Q={name:e.currentUser.name,email:e.currentUser.email,avatar:e.currentUser.avatar,type:"customer",status:e.currentUser.status};c(Q),a(D),m(!1);return}const A=localStorage.getItem(`${n}_user`);if(A){const D=JSON.parse(A);if(!(Date.now()-D.timestamp>1440*60*1e3)&&D.email&&D.name){const $={name:D.name,email:D.email,type:"customer",status:"online"};c($),a(D.conversationId),m(!1);return}}const X=e.conversationId||qe();a(X),(x==="progressive"||x==="none")&&c(null)}catch(A){console.error("Error initializing chat session:",A),a(e.conversationId||qe())}finally{m(!1)}})()},[e,n,x]);const T=_.useCallback((H,Z)=>{const F=u||qe(),A={name:H,email:Z,type:"customer",status:"online"},X={name:H,email:Z,conversationId:F,timestamp:Date.now()};try{localStorage.setItem(`${n}_user`,JSON.stringify(X))}catch{}c(A),a(F),r==null||r(A)},[u,n,r]);if(f||M==="closed")return null;const j=S==="left"?"left-4":"right-4",z=((re=e.theme)==null?void 0:re.primary)||"#337eff",U=((B=e.theme)==null?void 0:B.primaryStrong)||"#005eff";if(M==="minimized")return h.jsx("div",{className:`fixed bottom-5 ${j} z-50 ${t}`,children:h.jsxs("button",{type:"button",onClick:()=>N("open"),className:`group relative h-16 w-16 rounded-full text-white transition-all duration-300 flex items-center justify-center touch-none select-none ${C?"animate-bounce":""} ${w?"cursor-grabbing scale-110":"cursor-grab hover:scale-105"}`,style:{background:`linear-gradient(135deg, ${z}, ${U})`,boxShadow:[`0 4px 24px 0 ${z}80`,"0 8px 32px -4px rgba(0,0,0,0.3)","inset 0 1px 0 0 rgba(255,255,255,0.2)"].join(", ")},"aria-label":"Open chat",...R,children:[h.jsx(gs,{size:28,color:"white",className:"pointer-events-none"}),h.jsx("span",{className:"absolute inset-0 rounded-full animate-ping pointer-events-none",style:{backgroundColor:z,opacity:.15,animationDuration:"2.5s"}})]})});if(x==="form"&&(!l||!l.email||!l.name))return h.jsx(Mt,{onSubmit:T,className:t,initialName:(se=e.currentUser)==null?void 0:se.name,initialEmail:(I=e.currentUser)==null?void 0:I.email,onClose:()=>N("closed"),onMinimize:()=>N("minimized")});const te={...e,conversationId:u,currentUser:l||void 0},K=g&&!v?{opacity:1,transform:"translateY(0) scale(1)",transition:"opacity 0.25s ease-out, transform 0.25s ease-out"}:{opacity:0,transform:"translateY(12px) scale(0.97)",transition:"opacity 0.2s ease-in, transform 0.2s ease-in"};return h.jsx("div",{style:K,children:h.jsx(Tt,{config:te,className:t,onClose:()=>N("closed"),onMinimize:()=>N("minimized"),resolvedPosition:S})})}try{Pt.displayName="Chat",Pt.__docgenInfo={description:"",displayName:"Chat",props:{config:{defaultValue:null,description:"",name:"config",required:!0,type:{name:'Omit<IChatConfig, "conversationId"> & { conversationId?: string | undefined; }'}},className:{defaultValue:{value:""},description:"",name:"className",required:!1,type:{name:"string | undefined"}},storageKeyPrefix:{defaultValue:{value:"xcelsior_chat"},description:"",name:"storageKeyPrefix",required:!1,type:{name:"string | undefined"}},onPreChatSubmit:{defaultValue:null,description:"",name:"onPreChatSubmit",required:!1,type:{name:"((user: IUser) => void) | undefined"}},state:{defaultValue:null,description:"",name:"state",required:!1,type:{name:"enum",value:[{value:"undefined"},{value:'"undefined"'},{value:'"open"'},{value:'"minimized"'},{value:'"closed"'}]}},defaultState:{defaultValue:{value:"minimized"},description:"",name:"defaultState",required:!1,type:{name:"enum",value:[{value:"undefined"},{value:'"undefined"'},{value:'"open"'},{value:'"minimized"'},{value:'"closed"'}]}},onStateChange:{defaultValue:null,description:"",name:"onStateChange",required:!1,type:{name:"((state: ChatWidgetState) => void) | undefined"}}}}}catch{}const _a={title:"Components/Chat",component:Pt,parameters:{layout:"fullscreen"},tags:["autodocs"]},Wi={primary:"#337eff",primaryStrong:"#005eff",background:"#02164a",backgroundAlt:"#00001a",text:"#f7f7f8",textMuted:"rgba(247, 247, 248, 0.6)",statusPositive:"#1ed473",statusCaution:"#ffa938",statusNegative:"#ff6363",borderColor:"rgba(255, 255, 255, 0.1)"},ce={websocketUrl:"wss://dev-ws-chat.xcelsior.co",httpApiUrl:"https://dev-chat.xcelsior.co/api",enableEmoji:!0,enableFileUpload:!0,enableTypingIndicator:!0,fileUpload:{uploadUrl:"https://dev-chat.xcelsior.co/api/attachments/upload-url",maxFileSize:2*1024*1024,allowedTypes:["image/jpeg","image/png","image/gif","application/pdf","text/plain"]},enableReadReceipts:!0,apiKey:"test",theme:Wi,toast:{success:e=>console.log("Success:",e),error:e=>console.error("Error:",e),info:e=>console.log("Info:",e)}},Ce={args:{config:{...ce,identityCollection:"progressive"}}},Se={args:{config:{...ce,identityCollection:"form"}}},$e={args:{config:{...ce,identityCollection:"progressive",currentUser:{name:"John Doe",email:"john@example.com",type:"customer",status:"online"}}}},je={args:{config:{...ce,identityCollection:"progressive",position:"left"}}},Ee={args:{config:{...ce,identityCollection:"progressive",position:"right"}}},Re={args:{config:{...ce,identityCollection:"progressive",position:"auto"}}},Te={args:{config:{...ce,identityCollection:"progressive",theme:{primary:"#005eff",primaryStrong:"#003ecc",background:"#ffffff",backgroundAlt:"#f7f7f8",text:"#171719",textMuted:"rgba(23, 23, 25, 0.5)",statusPositive:"#1ed473",statusCaution:"#ffa938",statusNegative:"#ff6363",borderColor:"rgba(0, 0, 0, 0.1)"}}}},Me={args:{config:ce}},Pe={args:{config:ce,defaultState:"open"}};var $n,jn,En,Rn,Tn;Ce.parameters={...Ce.parameters,docs:{...($n=Ce.parameters)==null?void 0:$n.docs,source:{originalSource:`{
|
|
725
|
-
args: {
|
|
726
|
-
config: {
|
|
727
|
-
...baseConfig,
|
|
728
|
-
identityCollection: 'progressive'
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
}`,...(En=(jn=Ce.parameters)==null?void 0:jn.docs)==null?void 0:En.source},description:{story:"Progressive identity mode (default) — no pre-chat form, bot collects info during conversation",...(Tn=(Rn=Ce.parameters)==null?void 0:Rn.docs)==null?void 0:Tn.description}}};var Mn,Pn,Ln,An,Nn;Se.parameters={...Se.parameters,docs:{...(Mn=Se.parameters)==null?void 0:Mn.docs,source:{originalSource:`{
|
|
732
|
-
args: {
|
|
733
|
-
config: {
|
|
734
|
-
...baseConfig,
|
|
735
|
-
identityCollection: 'form'
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
}`,...(Ln=(Pn=Se.parameters)==null?void 0:Pn.docs)==null?void 0:Ln.source},description:{story:"Form identity mode — shows pre-chat form before chat",...(Nn=(An=Se.parameters)==null?void 0:An.docs)==null?void 0:Nn.description}}};var zn,On,In,Dn,Un;$e.parameters={...$e.parameters,docs:{...(zn=$e.parameters)==null?void 0:zn.docs,source:{originalSource:`{
|
|
739
|
-
args: {
|
|
740
|
-
config: {
|
|
741
|
-
...baseConfig,
|
|
742
|
-
identityCollection: 'progressive',
|
|
743
|
-
currentUser: {
|
|
744
|
-
name: 'John Doe',
|
|
745
|
-
email: 'john@example.com',
|
|
746
|
-
type: 'customer',
|
|
747
|
-
status: 'online'
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}`,...(In=(On=$e.parameters)==null?void 0:On.docs)==null?void 0:In.source},description:{story:"With known user — skips form/anonymous, goes straight to chat",...(Un=(Dn=$e.parameters)==null?void 0:Dn.docs)==null?void 0:Un.description}}};var Fn,Bn,Hn,qn,Vn;je.parameters={...je.parameters,docs:{...(Fn=je.parameters)==null?void 0:Fn.docs,source:{originalSource:`{
|
|
752
|
-
args: {
|
|
753
|
-
config: {
|
|
754
|
-
...baseConfig,
|
|
755
|
-
identityCollection: 'progressive',
|
|
756
|
-
position: 'left'
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}`,...(Hn=(Bn=je.parameters)==null?void 0:Bn.docs)==null?void 0:Hn.source},description:{story:"Widget positioned on the left",...(Vn=(qn=je.parameters)==null?void 0:qn.docs)==null?void 0:Vn.description}}};var Wn,Jn,Kn,Xn,Gn;Ee.parameters={...Ee.parameters,docs:{...(Wn=Ee.parameters)==null?void 0:Wn.docs,source:{originalSource:`{
|
|
760
|
-
args: {
|
|
761
|
-
config: {
|
|
762
|
-
...baseConfig,
|
|
763
|
-
identityCollection: 'progressive',
|
|
764
|
-
position: 'right'
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
}`,...(Kn=(Jn=Ee.parameters)==null?void 0:Jn.docs)==null?void 0:Kn.source},description:{story:"Widget positioned on the right (explicit)",...(Gn=(Xn=Ee.parameters)==null?void 0:Xn.docs)==null?void 0:Gn.description}}};var Yn,Zn,Qn,er,tr;Re.parameters={...Re.parameters,docs:{...(Yn=Re.parameters)==null?void 0:Yn.docs,source:{originalSource:`{
|
|
768
|
-
args: {
|
|
769
|
-
config: {
|
|
770
|
-
...baseConfig,
|
|
771
|
-
identityCollection: 'progressive',
|
|
772
|
-
position: 'auto'
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
}`,...(Qn=(Zn=Re.parameters)==null?void 0:Zn.docs)==null?void 0:Qn.source},description:{story:"Auto position — reads from localStorage, falls back to right",...(tr=(er=Re.parameters)==null?void 0:er.docs)==null?void 0:tr.description}}};var nr,rr,sr,or,ir;Te.parameters={...Te.parameters,docs:{...(nr=Te.parameters)==null?void 0:nr.docs,source:{originalSource:`{
|
|
776
|
-
args: {
|
|
777
|
-
config: {
|
|
778
|
-
...baseConfig,
|
|
779
|
-
identityCollection: 'progressive',
|
|
780
|
-
theme: {
|
|
781
|
-
primary: '#005eff',
|
|
782
|
-
primaryStrong: '#003ecc',
|
|
783
|
-
background: '#ffffff',
|
|
784
|
-
backgroundAlt: '#f7f7f8',
|
|
785
|
-
text: '#171719',
|
|
786
|
-
textMuted: 'rgba(23, 23, 25, 0.5)',
|
|
787
|
-
statusPositive: '#1ed473',
|
|
788
|
-
statusCaution: '#ffa938',
|
|
789
|
-
statusNegative: '#ff6363',
|
|
790
|
-
borderColor: 'rgba(0, 0, 0, 0.1)'
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
}`,...(sr=(rr=Te.parameters)==null?void 0:rr.docs)==null?void 0:sr.source},description:{story:"Light theme variant",...(ir=(or=Te.parameters)==null?void 0:or.docs)==null?void 0:ir.description}}};var ar,lr,cr,ur,dr;Me.parameters={...Me.parameters,docs:{...(ar=Me.parameters)==null?void 0:ar.docs,source:{originalSource:`{
|
|
795
|
-
args: {
|
|
796
|
-
config: baseConfig
|
|
797
|
-
}
|
|
798
|
-
}`,...(cr=(lr=Me.parameters)==null?void 0:lr.docs)==null?void 0:cr.source},description:{story:"Default (dark theme Xcelsior branded)",...(dr=(ur=Me.parameters)==null?void 0:ur.docs)==null?void 0:dr.description}}};var fr,pr,hr,mr,gr;Pe.parameters={...Pe.parameters,docs:{...(fr=Pe.parameters)==null?void 0:fr.docs,source:{originalSource:`{
|
|
799
|
-
args: {
|
|
800
|
-
config: baseConfig,
|
|
801
|
-
defaultState: 'open'
|
|
802
|
-
}
|
|
803
|
-
}`,...(hr=(pr=Pe.parameters)==null?void 0:pr.docs)==null?void 0:hr.source},description:{story:"Starts in open state",...(gr=(mr=Pe.parameters)==null?void 0:mr.docs)==null?void 0:gr.description}}};const xa=["ProgressiveIdentity","FormIdentity","WithKnownUser","PositionLeft","PositionRight","PositionAuto","LightTheme","Default","OpenByDefault"];export{Me as Default,Se as FormIdentity,Te as LightTheme,Pe as OpenByDefault,Re as PositionAuto,je as PositionLeft,Ee as PositionRight,Ce as ProgressiveIdentity,$e as WithKnownUser,xa as __namedExportsOrder,_a as default};
|