deskcord 1.3.1 → 1.5.0

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/README.md CHANGED
@@ -10,6 +10,7 @@ The chat widget customers embed on their site. Preact + plain CSS in a shadow ro
10
10
  settings: {
11
11
  app_id: "YOUR_DISCORD_SERVER_ID",
12
12
  // theme: "auto", // "light" (default), "dark", or "auto" (follows the visitor's system)
13
+ // locale: "fr", // widget language; defaults to the page's <html lang>
13
14
  },
14
15
  };
15
16
  </script>
@@ -18,7 +19,7 @@ The chat widget customers embed on their site. Preact + plain CSS in a shadow ro
18
19
 
19
20
  Colors, position, titles and the offline message come from the server's `/customize-widget` settings.
20
21
 
21
- `window.deskcord` also exposes `openChatbox()`, `closeChatbox()`, `identify(user)`, `logout()` and `setTheme(theme)` once the script has loaded.
22
+ `window.deskcord` also exposes `openChatbox()`, `closeChatbox()`, `identify(user)`, `logout()`, `setTheme(theme)` and `setLocale(locale)` once the script has loaded.
22
23
 
23
24
  ### Theme
24
25
 
@@ -27,6 +28,14 @@ The widget never reads your page's colors (it lives in a shadow root). It has it
27
28
  - `"light"` (default), `"dark"`, or `"auto"`, which follows the visitor's system setting and updates live when it changes.
28
29
  - If your site has its own dark-mode switch, call `window.deskcord.setTheme("light" | "dark" | "auto")` whenever it changes. It applies immediately, no reload.
29
30
 
31
+ ### Language
32
+
33
+ The widget speaks English, French, German, Spanish, Brazilian Portuguese, Italian, Dutch, Polish, Japanese and Turkish (`src/i18n/locales/`). It picks, in order: `settings.locale`, the page's `<html lang>`, the visitor's browser languages, then English. Regions fall back to their language (`fr-CA` → French, `pt-PT` → Brazilian Portuguese).
34
+
35
+ - Only the widget's own texts are translated: messages, and the titles and offline message set with `/customize-widget`, show as written.
36
+ - Sites that switch language without a reload call `window.deskcord.setLocale("de")`. It applies immediately.
37
+ - Adding a language: copy `en.ts`, translate it, register it in `src/i18n/index.ts`. The type checker and `i18n.test.ts` catch missing keys, placeholders and plural forms.
38
+
30
39
  ## Identify logged-in users
31
40
 
32
41
  ```js
@@ -1,2 +1,2 @@
1
- (function(){"use strict";var Pe,$,tn,de,nn,rn,dt,on,ut,pt,ft,sn,Ae={},an=[],ai=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ht=Array.isArray;function ae(t,e){for(var n in e)t[n]=e[n];return t}function gt(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function ci(t,e,n){var r,i,o,a={};for(o in e)o=="key"?r=e[o]:o=="ref"?i=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?Pe.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)a[o]===void 0&&(a[o]=t.defaultProps[o]);return ze(t,a,r,i,null)}function ze(t,e,n,r,i){var o={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++tn,__i:-1,__u:0};return i==null&&$.vnode!=null&&$.vnode(o),o}function H(t){return t.children}function Be(t,e){this.props=t,this.context=e}function me(t,e){if(e==null)return t.__?me(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?me(t):null}function cn(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return cn(t)}}function mt(t){(!t.__d&&(t.__d=!0)&&de.push(t)&&!Fe.__r++||nn!==$.debounceRendering)&&((nn=$.debounceRendering)||rn)(Fe)}function Fe(){var t,e,n,r,i,o,a,c;for(de.sort(dt);t=de.shift();)t.__d&&(e=de.length,r=void 0,o=(i=(n=t).__v).__e,a=[],c=[],n.__P&&((r=ae({},i)).__v=i.__v+1,$.vnode&&$.vnode(r),vt(n.__P,r,i,n.__n,n.__P.namespaceURI,32&i.__u?[o]:null,a,o??me(i),!!(32&i.__u),c),r.__v=i.__v,r.__.__k[r.__i]=r,fn(a,r,c),r.__e!=o&&cn(r)),de.length>e&&de.sort(dt));Fe.__r=0}function ln(t,e,n,r,i,o,a,c,d,u,g){var p,h,x,w,k,_,A=r&&r.__k||an,y=e.length;for(d=li(n,e,A,d,y),p=0;p<y;p++)(x=n.__k[p])!=null&&(h=x.__i===-1?Ae:A[x.__i]||Ae,x.__i=p,_=vt(t,x,h,i,o,a,c,d,u,g),w=x.__e,x.ref&&h.ref!=x.ref&&(h.ref&&yt(h.ref,null,x),g.push(x.ref,x.__c||w,x)),k==null&&w!=null&&(k=w),4&x.__u||h.__k===x.__k?d=dn(x,d,t):typeof x.type=="function"&&_!==void 0?d=_:w&&(d=w.nextSibling),x.__u&=-7);return n.__e=k,d}function li(t,e,n,r,i){var o,a,c,d,u,g=n.length,p=g,h=0;for(t.__k=new Array(i),o=0;o<i;o++)(a=e[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(d=o+h,(a=t.__k[o]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?ze(null,a,null,null,null):ht(a)?ze(H,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?ze(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=t,a.__b=t.__b+1,c=null,(u=a.__i=di(a,n,d,p))!==-1&&(p--,(c=n[u])&&(c.__u|=2)),c==null||c.__v===null?(u==-1&&h--,typeof a.type!="function"&&(a.__u|=4)):u!=d&&(u==d-1?h--:u==d+1?h++:(u>d?h--:h++,a.__u|=4))):t.__k[o]=null;if(p)for(o=0;o<g;o++)(c=n[o])!=null&&!(2&c.__u)&&(c.__e==r&&(r=me(c)),hn(c,c));return r}function dn(t,e,n){var r,i;if(typeof t.type=="function"){for(r=t.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=t,e=dn(r[i],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=me(t)),n.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function di(t,e,n,r){var i,o,a=t.key,c=t.type,d=e[n];if(d===null||d&&a==d.key&&c===d.type&&!(2&d.__u))return n;if(r>(d!=null&&!(2&d.__u)?1:0))for(i=n-1,o=n+1;i>=0||o<e.length;){if(i>=0){if((d=e[i])&&!(2&d.__u)&&a==d.key&&c===d.type)return i;i--}if(o<e.length){if((d=e[o])&&!(2&d.__u)&&a==d.key&&c===d.type)return o;o++}}return-1}function un(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||ai.test(e)?n:n+"px"}function He(t,e,n,r,i){var o;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||un(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||un(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(on,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n.u=r.u:(n.u=ut,t.addEventListener(e,o?ft:pt,o)):t.removeEventListener(e,o?ft:pt,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function pn(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=ut++;else if(e.t<n.u)return;return n($.event?$.event(e):e)}}}function vt(t,e,n,r,i,o,a,c,d,u){var g,p,h,x,w,k,_,A,y,L,E,O,z,V,te,F,J,Y=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(d=!!(32&n.__u),o=[c=e.__e=n.__e]),(g=$.__b)&&g(e);e:if(typeof Y=="function")try{if(A=e.props,y="prototype"in Y&&Y.prototype.render,L=(g=Y.contextType)&&r[g.__c],E=g?L?L.props.value:g.__:r,n.__c?_=(p=e.__c=n.__c).__=p.__E:(y?e.__c=p=new Y(A,E):(e.__c=p=new Be(A,E),p.constructor=Y,p.render=pi),L&&L.sub(p),p.props=A,p.state||(p.state={}),p.context=E,p.__n=r,h=p.__d=!0,p.__h=[],p._sb=[]),y&&p.__s==null&&(p.__s=p.state),y&&Y.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=ae({},p.__s)),ae(p.__s,Y.getDerivedStateFromProps(A,p.__s))),x=p.props,w=p.state,p.__v=e,h)y&&Y.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),y&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(y&&Y.getDerivedStateFromProps==null&&A!==x&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(A,E),!p.__e&&(p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(A,p.__s,E)===!1||e.__v==n.__v)){for(e.__v!=n.__v&&(p.props=A,p.state=p.__s,p.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(Z){Z&&(Z.__=e)}),O=0;O<p._sb.length;O++)p.__h.push(p._sb[O]);p._sb=[],p.__h.length&&a.push(p);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(A,p.__s,E),y&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(x,w,k)})}if(p.context=E,p.props=A,p.__P=t,p.__e=!1,z=$.__r,V=0,y){for(p.state=p.__s,p.__d=!1,z&&z(e),g=p.render(p.props,p.state,p.context),te=0;te<p._sb.length;te++)p.__h.push(p._sb[te]);p._sb=[]}else do p.__d=!1,z&&z(e),g=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++V<25);p.state=p.__s,p.getChildContext!=null&&(r=ae(ae({},r),p.getChildContext())),y&&!h&&p.getSnapshotBeforeUpdate!=null&&(k=p.getSnapshotBeforeUpdate(x,w)),c=ln(t,ht(F=g!=null&&g.type===H&&g.key==null?g.props.children:g)?F:[F],e,n,r,i,o,a,c,d,u),p.base=e.__e,e.__u&=-161,p.__h.length&&a.push(p),_&&(p.__E=p.__=null)}catch(Z){if(e.__v=null,d||o!=null)if(Z.then){for(e.__u|=d?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,e.__e=c}else for(J=o.length;J--;)gt(o[J]);else e.__e=n.__e,e.__k=n.__k;$.__e(Z,e,n)}else o==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):c=e.__e=ui(n.__e,e,n,r,i,o,a,d,u);return(g=$.diffed)&&g(e),128&e.__u?void 0:c}function fn(t,e,n){for(var r=0;r<n.length;r++)yt(n[r],n[++r],n[++r]);$.__c&&$.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){$.__e(o,i.__v)}})}function ui(t,e,n,r,i,o,a,c,d){var u,g,p,h,x,w,k,_=n.props,A=e.props,y=e.type;if(y=="svg"?i="http://www.w3.org/2000/svg":y=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((x=o[u])&&"setAttribute"in x==!!y&&(y?x.localName==y:x.nodeType==3)){t=x,o[u]=null;break}}if(t==null){if(y==null)return document.createTextNode(A);t=document.createElementNS(i,y,A.is&&A),c&&($.__m&&$.__m(e,o),c=!1),o=null}if(y===null)_===A||c&&t.data===A||(t.data=A);else{if(o=o&&Pe.call(t.childNodes),_=n.props||Ae,!c&&o!=null)for(_={},u=0;u<t.attributes.length;u++)_[(x=t.attributes[u]).name]=x.value;for(u in _)if(x=_[u],u!="children"){if(u=="dangerouslySetInnerHTML")p=x;else if(!(u in A)){if(u=="value"&&"defaultValue"in A||u=="checked"&&"defaultChecked"in A)continue;He(t,u,null,x,i)}}for(u in A)x=A[u],u=="children"?h=x:u=="dangerouslySetInnerHTML"?g=x:u=="value"?w=x:u=="checked"?k=x:c&&typeof x!="function"||_[u]===x||He(t,u,x,_[u],i);if(g)c||p&&(g.__html===p.__html||g.__html===t.innerHTML)||(t.innerHTML=g.__html),e.__k=[];else if(p&&(t.innerHTML=""),ln(t,ht(h)?h:[h],e,n,r,y=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:n.__k&&me(n,0),c,d),o!=null)for(u=o.length;u--;)gt(o[u]);c||(u="value",y=="progress"&&w==null?t.removeAttribute("value"):w!==void 0&&(w!==t[u]||y=="progress"&&!w||y=="option"&&w!==_[u])&&He(t,u,w,_[u],i),u="checked",k!==void 0&&k!==t[u]&&He(t,u,k,_[u],i))}return t}function yt(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(i){$.__e(i,n)}}function hn(t,e,n){var r,i;if($.unmount&&$.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||yt(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){$.__e(o,e)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&hn(r[i],e,n||typeof t.type!="function");n||gt(t.__e),t.__c=t.__=t.__e=void 0}function pi(t,e,n){return this.constructor(t,n)}function fi(t,e,n){var r,i,o,a;e==document&&(e=document.documentElement),$.__&&$.__(t,e),i=(r=typeof n=="function")?null:e.__k,o=[],a=[],vt(e,t=(!r&&n||e).__k=ci(H,null,[t]),i||Ae,Ae,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?Pe.call(e.childNodes):null,o,!r&&n?n:i?i.__e:e.firstChild,r,a),fn(o,t,a)}function gn(t,e){var n={__c:e="__cC"+sn++,__:t,Consumer:function(r,i){return r.children(i)},Provider:function(r){var i,o;return this.getChildContext||(i=new Set,(o={})[e]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&i.forEach(function(c){c.__e=!0,mt(c)})},this.sub=function(a){i.add(a);var c=a.componentWillUnmount;a.componentWillUnmount=function(){i&&i.delete(a),c&&c.call(a)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}Pe=an.slice,$={__e:function(t,e,n,r){for(var i,o,a;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,r||{}),a=i.__d),a)return i.__E=i}catch(c){t=c}throw t}},tn=0,Be.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ae({},this.state),typeof t=="function"&&(t=t(ae({},n),this.props)),t&&ae(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),mt(this))},Be.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),mt(this))},Be.prototype.render=H,de=[],rn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,dt=function(t,e){return t.__v.__b-e.__v.__b},Fe.__r=0,on=/(PointerCapture)$|Capture$/i,ut=0,pt=pn(!1),ft=pn(!0),sn=0;var hi=0;function s(t,e,n,r,i,o){e||(e={});var a,c,d=e;if("ref"in d)for(c in d={},e)c=="ref"?a=e[c]:d[c]=e[c];var u={type:t,props:d,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--hi,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(a=t.defaultProps))for(c in a)d[c]===void 0&&(d[c]=a[c]);return $.vnode&&$.vnode(u),u}const gi=':host{all:initial}.dc{--dc-accent: #5865f2;--dc-accent-2: #4a55cc;--dc-on-accent: #fff;--dc-on-grad: #fff;--dc-accent-soft: rgba(88,101,242,.14);--dc-accent-text: #4a55cc;--w-bg: #ffffff;--w-raised: #ffffff;--w-sunken: #f2f3f7;--w-bubble: #f0f1f5;--w-line: rgba(18,22,33,.08);--w-line-strong: rgba(18,22,33,.15);--w-fg: #14171f;--w-fg-2: #3b404c;--w-muted: #6a7080;--w-faint: #9499a5;--w-online: #23a55a;--w-idle: #f0b232;--w-dnd: #f23f43;--w-offline: #80848e;--w-danger: #e5484d;--w-success: #1f9d55;--w-warn: #c98a0c;--w-badge: #f23f43;--w-shadow: 0 1px 2px rgba(16,20,30,.06), 0 10px 28px -8px rgba(16,20,30,.18), 0 30px 70px -18px rgba(16,20,30,.28);--w-card-shadow: 0 1px 2px rgba(16,20,30,.05), 0 6px 18px -10px rgba(16,20,30,.2);--ease-out: cubic-bezier(.22,1,.36,1);--ease-spring: cubic-bezier(.34,1.45,.64,1);--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--edge: 20px;position:fixed;inset:0;z-index:2147483000;pointer-events:none;font-family:var(--font);color:var(--w-fg);font-size:14px;line-height:1.4;text-align:left;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color-scheme:light}.dc[data-theme=dark]{--w-bg: #232428;--w-raised: #2b2d31;--w-sunken: #1c1d21;--w-bubble: #34363c;--w-line: rgba(255,255,255,.07);--w-line-strong: rgba(255,255,255,.13);--w-fg: #f2f3f5;--w-fg-2: #d5d7dc;--w-muted: #a4a8b2;--w-faint: #7d828d;--w-shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 34px -8px rgba(0,0,0,.55), 0 30px 80px -18px rgba(0,0,0,.6);--w-card-shadow: 0 1px 2px rgba(0,0,0,.25);color-scheme:dark}.dc *,.dc *:before,.dc *:after{box-sizing:border-box}:where(.dc) button{font:inherit;color:inherit;margin:0}:where(.dc) :is(p,h1,h2,h3,h4,ul,ol,form){margin:0;padding:0}.dc :focus-visible{outline:2px solid var(--dc-accent);outline-offset:2px}.dc [hidden]{display:none!important}.dc svg{display:block;flex:none}.dc img{max-width:100%}.dc-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.dc-launcher{pointer-events:auto;position:absolute;bottom:calc(var(--edge) + env(safe-area-inset-bottom,0px));right:var(--edge);width:56px;height:56px;border-radius:50%;border:0;padding:0;cursor:pointer;background:linear-gradient(145deg,var(--dc-accent) 0%,var(--dc-accent-2) 100%);color:var(--dc-on-grad);box-shadow:0 2px 4px #10141e1f,0 10px 26px -6px color-mix(in srgb,var(--dc-accent) 60%,transparent);transition:transform .35s var(--ease-spring),opacity .2s}.dc[data-pos=left] .dc-launcher{right:auto;left:var(--edge)}.dc-launcher:hover{transform:translateY(-2px) scale(1.04)}.dc-launcher:active{transform:scale(.93);transition-duration:.1s}.dc-launcher .ic{position:absolute;inset:0;display:grid;place-items:center;transition:transform .4s var(--ease-spring),opacity .2s}.dc-launcher .ic-close{opacity:0;transform:rotate(-90deg) scale(.6)}.dc-launcher.is-open .ic-chat{opacity:0;transform:rotate(90deg) scale(.6)}.dc-launcher.is-open .ic-close{opacity:1;transform:none}.dc-launcher.has-unread:after{content:"";position:absolute;inset:0;border-radius:50%;border:2px solid var(--dc-accent);animation:dc-halo 2.4s var(--ease-out) infinite;pointer-events:none}@keyframes dc-halo{0%{transform:scale(1);opacity:.7}70%,to{transform:scale(1.55);opacity:0}}.dc-badge{position:absolute;top:-3px;right:-3px;min-width:22px;height:22px;padding:0 6px;border-radius:11px;background:var(--w-badge);color:#fff;font:700 12px/22px var(--font);text-align:center;font-variant-numeric:tabular-nums;box-shadow:0 0 0 2.5px #fff}.dc-preview{pointer-events:auto;position:absolute;right:var(--edge);bottom:calc(var(--edge) + 70px + env(safe-area-inset-bottom,0px));width:300px;max-width:calc(100% - 2 * var(--edge));background:var(--w-raised);color:var(--w-fg);border:1px solid var(--w-line);border-radius:18px 18px 6px;padding:12px 14px;box-shadow:var(--w-shadow);cursor:pointer;display:grid;grid-template-columns:34px 1fr;gap:10px;transform-origin:bottom right}.dc[data-pos=left] .dc-preview{right:auto;left:var(--edge);border-radius:18px 18px 18px 6px;transform-origin:bottom left}.dc-preview .who{font-size:12.5px;color:var(--w-muted);margin-bottom:2px}.dc-preview .who b{color:var(--w-fg);font-weight:600}.dc-preview .txt{font-size:14px;color:var(--w-fg-2);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.dc-preview .x{position:absolute;top:-8px;right:-8px;width:24px;height:24px;border-radius:50%;border:0;background:var(--w-fg);color:var(--w-bg);display:grid;place-items:center;cursor:pointer;opacity:0;transition:opacity .15s;padding:0}.dc-preview:hover .x,.dc-preview:focus-within .x{opacity:1}@media (hover: none){.dc-preview .x{opacity:1}}.dc-panel{pointer-events:auto;position:absolute;right:var(--edge);bottom:calc(var(--edge) + 70px + env(safe-area-inset-bottom,0px));width:384px;height:min(680px,calc(100% - 110px));max-width:calc(100% - 2 * var(--edge));background:var(--w-bg);border-radius:22px;box-shadow:var(--w-shadow);border:1px solid var(--w-line);overflow:hidden;display:flex;flex-direction:column;transform-origin:bottom right}.dc[data-pos=left] .dc-panel{right:auto;left:var(--edge);transform-origin:bottom left}.dc[data-theme=dark] .dc-panel{border:0}.dc-views{position:relative;flex:1;min-height:0}.dc-view{position:absolute;inset:0;display:flex;flex-direction:column;background:var(--w-bg)}.dc-head{background:linear-gradient(160deg,var(--dc-accent) 0%,var(--dc-accent-2) 100%);color:var(--dc-on-grad);position:relative;flex:none;isolation:isolate}.dc-head:before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(120% 90% at 100% 0%,rgba(255,255,255,.22),transparent 55%),radial-gradient(80% 60% at 0% 100%,rgba(0,0,0,.12),transparent 60%)}.dc[data-flat] .dc-head:before{display:none}.dc-hbtn{width:34px;height:34px;border-radius:10px;border:0;background:transparent;display:grid;place-items:center;cursor:pointer;color:inherit;flex:none;padding:0;transition:background .15s,transform .2s var(--ease-spring)}.dc-hbtn:hover{background:color-mix(in srgb,currentColor 16%,transparent)}.dc-hbtn:active{transform:scale(.9)}.dc-hbtn .ic-down{display:none}.dc-head--compact{display:flex;align-items:center;gap:6px;padding:12px 10px;min-height:66px}.dc-head-id{flex:1;min-width:0;display:flex;align-items:center;gap:10px;padding-left:4px}.dc-head-id .tx{min-width:0}.dc-head-id .t{font-weight:650;font-size:15.5px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dc-head-id .s{font-size:12.5px;opacity:.85;display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;margin-top:1px}.dc-head-id .s span:last-child{overflow:hidden;text-overflow:ellipsis}.dc-head-id .mini{display:flex;flex:none}.dc-head-id .mini .dc-av{margin-left:-5px;box-shadow:0 0 0 1.5px var(--dc-accent)}.dc-head-id .mini .dc-av:first-child{margin-left:0}.dc-av{--s: 28px;width:var(--s);height:var(--s);border-radius:50%;flex:none;position:relative;display:grid;place-items:center;font:650 calc(var(--s) * .4) / 1 var(--font);color:#fff;letter-spacing:-.02em;background:linear-gradient(140deg,hsl(var(--h, 230) 72% 64%),hsl(calc(var(--h, 230) + 28) 62% 46%))}.dc-av img{width:100%;height:100%;border-radius:50%;object-fit:cover;display:block}.dc-av .dot{position:absolute;right:-2px;bottom:-2px;width:calc(var(--s) * .34);height:calc(var(--s) * .34);min-width:9px;min-height:9px;border-radius:50%;box-shadow:0 0 0 2.5px var(--ring, var(--w-bg))}.dot.online{background:var(--w-online)}.dot.idle{background:var(--w-idle)}.dot.dnd{background:var(--w-dnd)}.dot.offline,.dot.invisible{background:var(--w-offline)}.dc-head .dc-av .dot{--ring: var(--dc-accent-2)}.dc-guild{--s: 36px;width:var(--s);height:var(--s);border-radius:calc(var(--s) * .3);background:var(--dc-accent-2);color:var(--dc-on-grad);display:grid;place-items:center;flex:none;position:relative;font:700 calc(var(--s) * .42) / 1 var(--font);box-shadow:0 0 0 1px #ffffff24 inset}.dc-guild img{width:100%;height:100%;object-fit:cover;border-radius:inherit;display:block}.dc-guild .dot{position:absolute;right:-3px;bottom:-3px;width:11px;height:11px;border-radius:50%;box-shadow:0 0 0 2.5px var(--ring, var(--dc-accent-2))}.dc-hero{padding:16px 16px 58px}.dc-hero .top{display:flex;align-items:center;justify-content:space-between}.dc-hero h2{font:700 26px/1.12 var(--font);letter-spacing:-.02em;margin:22px 4px 6px;text-wrap:balance;color:inherit}.dc-hero p{margin:0 4px;font-size:14.5px;opacity:.88;line-height:1.45}.dc-team{display:flex;align-items:center;gap:10px;margin:16px 4px 0;font-size:13px}.dc-team .stack{display:flex}.dc-team .stack .dc-av{--s: 30px;margin-left:-8px;box-shadow:0 0 0 2px var(--dc-accent-2)}.dc-team .stack .dc-av:first-child{margin-left:0}.dc-team .stack .dc-av .dot{--ring: var(--dc-accent-2)}.dc-home-body{flex:1;min-height:0;overflow-y:auto;margin-top:-40px;padding:0 12px 12px;display:flex;flex-direction:column;gap:10px;position:relative;scrollbar-width:thin}.dc-card{background:var(--w-raised);border:1px solid var(--w-line);border-radius:16px;box-shadow:var(--w-card-shadow)}.dc-cta{display:flex;align-items:center;gap:12px;width:100%;padding:14px 14px 14px 16px;text-align:left;cursor:pointer;color:var(--w-fg);transition:transform .25s var(--ease-spring),box-shadow .2s}.dc-cta:hover{transform:translateY(-1px);box-shadow:var(--w-shadow)}.dc-cta .tx{flex:1;min-width:0}.dc-cta b{display:block;font-size:15px;font-weight:650}.dc-cta small{display:block;font-size:13px;color:var(--w-muted);margin-top:2px}.dc-cta .go{width:36px;height:36px;border-radius:50%;background:var(--dc-accent);color:var(--dc-on-accent);display:grid;place-items:center;flex:none;transition:transform .3s var(--ease-spring)}.dc-cta:hover .go{transform:translate(3px)}.dc-cta.is-paused{cursor:default}.dc-cta.is-paused:hover{transform:none;box-shadow:var(--w-card-shadow)}.dc-eyebrow{font-size:11px;font-weight:600;letter-spacing:.07em;text-transform:uppercase;color:var(--w-faint);padding:12px 16px 2px}.dc-list{padding:4px}.dc-conv{display:flex;gap:12px;align-items:center;width:100%;padding:12px 14px 12px 12px;border:0;background:transparent;text-align:left;cursor:pointer;border-radius:12px;color:var(--w-fg);position:relative;transition:background .15s}.dc-conv:hover{background:var(--w-sunken)}.dc-conv .tx{flex:1;min-width:0}.dc-conv .l1{display:flex;gap:8px;align-items:baseline}.dc-conv .l1 b{font-size:14px;font-weight:600;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dc-conv .l1 time{font-size:12px;color:var(--w-faint);flex:none}.dc-conv .l2{display:block;font-size:13px;color:var(--w-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}.dc-conv.is-unread .l2{color:var(--w-fg);font-weight:550}.dc-conv .count{background:var(--w-badge);color:#fff;font:700 11px/20px var(--font);min-width:20px;height:20px;border-radius:10px;text-align:center;padding:0 6px;flex:none}.dc-conv .chev{color:var(--w-faint);flex:none}.dc-list .dc-conv+.dc-conv:before{content:"";position:absolute;left:64px;right:14px;top:0;height:1px;background:var(--w-line)}.dc-pill{display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:600;padding:1px 7px;border-radius:999px;background:var(--w-sunken);color:var(--w-muted);margin-right:4px;vertical-align:1px}.dc-pill.ok{color:var(--w-success);background:color-mix(in srgb,var(--w-success) 12%,transparent)}.dc-empty{padding:14px 16px 16px;font-size:13px;color:var(--w-muted)}.dc-empty button{border:0;background:none;padding:0;color:var(--dc-accent-text);font-weight:600;cursor:pointer;text-decoration:underline;text-underline-offset:2px}.dc-skel-row{display:flex;gap:12px;align-items:center;padding:12px}.dc-skel-row i,.dc-skel i{display:block;border-radius:999px;background:linear-gradient(90deg,var(--w-sunken) 0%,var(--w-bubble) 40%,var(--w-sunken) 80%);background-size:300% 100%;animation:dc-shimmer 1.2s linear infinite}.dc-skel-row i:first-child{width:40px;height:40px;flex:none}.dc-skel-row span{flex:1;display:flex;flex-direction:column;gap:7px}.dc-skel-row span i{height:10px;width:60%}.dc-skel-row span i+i{width:85%}@keyframes dc-shimmer{0%{background-position:100% 0}to{background-position:-50% 0}}.dc-conn{overflow:hidden;flex:none;font-size:12.5px;font-weight:550;display:flex;align-items:center;justify-content:center;gap:8px;padding:7px 12px}.dc-conn.is-down{background:color-mix(in srgb,var(--w-warn) 14%,var(--w-bg));color:var(--w-warn)}.dc-conn.is-up{background:color-mix(in srgb,var(--w-success) 13%,var(--w-bg));color:var(--w-success)}.dc-spin{width:13px;height:13px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:dc-rot .8s linear infinite}@keyframes dc-rot{to{transform:rotate(360deg)}}.dc-scroll-wrap{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.dc-scroll{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;position:relative;scrollbar-width:thin;scrollbar-color:var(--w-line-strong) transparent;overscroll-behavior:contain}.dc-welcome{padding:34px 28px 10px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:6px}.dc-welcome .stack{display:flex;margin-bottom:8px}.dc-welcome .stack .dc-av{--s: 44px;margin-left:-12px;box-shadow:0 0 0 3px var(--w-bg)}.dc-welcome .stack .dc-av:first-child{margin-left:0}.dc-welcome .stack .dc-av .dot{--ring: var(--w-bg)}.dc-welcome h3{margin:0;font-size:19px;font-weight:700;letter-spacing:-.015em;text-wrap:balance;color:var(--w-fg)}.dc-welcome p{margin:0;font-size:13.5px;color:var(--w-muted);max-width:30ch;line-height:1.5;text-wrap:balance}.dc-msgs{display:flex;flex-direction:column;padding:6px 14px}.dc-day{display:flex;align-items:center;gap:10px;font-size:11px;font-weight:600;letter-spacing:.07em;text-transform:uppercase;color:var(--w-faint);margin:16px 6px 2px}.dc-day:before,.dc-day:after{content:"";flex:1;height:1px;background:var(--w-line)}.dc-row{display:flex;gap:8px;align-items:flex-end;margin-top:2px}.dc-row.is-first{margin-top:12px}.dc-row--me{justify-content:flex-end}.dc-row.is-deleted{animation:dc-collapse .38s var(--ease-out) forwards;overflow:hidden}@keyframes dc-collapse{0%{max-height:600px;opacity:1}to{max-height:0;opacity:0;margin-top:0;transform:scale(.96)}}.dc-row-av{width:28px;flex:none;visibility:hidden}.dc-row.is-last .dc-row-av{visibility:visible}.dc-stack{display:flex;flex-direction:column;gap:3px;max-width:80%;min-width:0;align-items:flex-start}.dc-row--me .dc-stack{align-items:flex-end}.dc-name{display:none;font-size:12px;color:var(--w-muted);margin:0 0 1px 4px}.dc-name b{color:var(--w-fg-2);font-weight:600;margin-right:4px}.dc-row.is-first .dc-name{display:block}.dc-bubble{padding:8px 13px 9px;font-size:14.5px;line-height:1.42;overflow-wrap:anywhere;background:var(--w-bubble);color:var(--w-fg);border-radius:6px 18px 18px 6px;max-width:100%;white-space:normal;transition:background .6s}.dc-row--agent.is-first .dc-bubble{border-top-left-radius:18px}.dc-row--agent.is-last .dc-bubble{border-bottom-left-radius:18px}.dc-row--me .dc-bubble{background:var(--dc-accent);color:var(--dc-on-accent);border-radius:18px 6px 6px 18px}.dc-row--me.is-first .dc-bubble{border-top-right-radius:18px}.dc-row--me.is-last .dc-bubble{border-bottom-right-radius:18px}.dc-row.is-pending .dc-bubble,.dc-row.is-pending .dc-img,.dc-row.is-pending .dc-file{opacity:.62}.dc-bubble a{color:var(--dc-accent-text);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.dc-row--me .dc-bubble a{color:inherit}.dc-bubble code{font:12.5px/1.4 var(--mono);background:color-mix(in srgb,currentColor 11%,transparent);padding:1px 5px;border-radius:5px}.dc-bubble pre{margin:6px 0 2px;padding:9px 11px;border-radius:9px;background:color-mix(in srgb,currentColor 8%,transparent);overflow-x:auto;white-space:pre}.dc-bubble pre code{background:none;padding:0;font-size:12px}.dc-bubble strong{font-weight:650}.dc-bubble .dc-quote{display:inline-block;border-left:3px solid color-mix(in srgb,currentColor 30%,transparent);padding-left:8px}.dc-cemoji{width:20px;height:20px;vertical-align:-5px;display:inline-block;object-fit:contain}.dc-bubble.is-jumbo{background:none!important;padding:0 2px;font-size:40px;line-height:1.15}.dc-bubble.is-jumbo .dc-cemoji{width:46px;height:46px}.dc-spoiler{background:var(--w-fg);color:transparent;border-radius:4px;cursor:pointer;transition:background .25s,color .25s;padding:0 2px}.dc-row--me .dc-spoiler{background:var(--dc-on-accent)}.dc-spoiler.is-shown{background:color-mix(in srgb,currentColor 12%,transparent)!important;color:inherit;cursor:auto}.dc-edited{font-size:11px;color:var(--w-faint);margin-left:4px}.dc-row--me .dc-edited{color:inherit;opacity:.7}.dc-bubble.is-flash{background:color-mix(in srgb,var(--dc-accent) 22%,var(--w-bubble));transition:none}.dc-status{display:none;align-items:center;gap:4px;font-size:11.5px;color:var(--w-faint);margin:1px 4px 0}.dc-row.show-status .dc-status,.dc-status.is-failed,.dc-status.is-pending{display:flex}.dc-status.is-failed{color:var(--w-danger)}.dc-status button{border:0;background:none;padding:0;color:inherit;font-weight:650;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.dc-event{align-self:center;display:flex;align-items:center;gap:7px;font-size:12.5px;color:var(--w-muted);margin:14px 0 4px;padding:5px 12px 5px 6px;border-radius:999px;background:var(--w-sunken);max-width:92%}.dc-event .dc-av{--s: 20px}.dc-event .ic{width:20px;height:20px;border-radius:50%;display:grid;place-items:center;background:var(--w-bg);color:var(--w-muted);flex:none}.dc-event.ok .ic{background:var(--w-success);color:#fff}.dc-event b{color:var(--w-fg-2);font-weight:600}.dc-event time{color:var(--w-faint)}.dc-event.note{border-radius:14px;padding:9px 12px;text-align:center;line-height:1.45}.dc-gallery{display:grid;grid-template-columns:1fr 1fr;gap:4px;width:236px;max-width:100%}.dc-img{position:relative;display:block;width:min(var(--w, 232px),232px);max-width:100%;border:0;padding:0;border-radius:14px;overflow:hidden;background:var(--w-sunken);cursor:zoom-in}.dc-gallery .dc-img{width:100%;aspect-ratio:1!important}.dc-img img{display:block;width:100%;height:100%;object-fit:cover;transition:transform .4s var(--ease-out)}.dc-img:hover img{transform:scale(1.035)}.dc-img.is-uploading,.dc-img.is-failed{cursor:default}.dc-img.is-uploading:after{content:"";position:absolute;inset:0;background:#080a106b}.dc-ring{position:absolute;left:50%;top:50%;width:44px;height:44px;margin:-22px 0 0 -22px;z-index:1;transform:rotate(-90deg)}.dc-ring circle{fill:none;stroke-width:3.2}.dc-ring .bg{stroke:#ffffff4d}.dc-ring .fg{stroke:#fff;stroke-linecap:round;stroke-dasharray:100;transition:stroke-dashoffset .25s var(--ease-out)}.dc-img .pct{position:absolute;left:0;right:0;top:50%;z-index:1;margin-top:26px;text-align:center;color:#fff;font:600 11px/1 var(--font);font-variant-numeric:tabular-nums}.dc-img .fail{position:absolute;inset:0;z-index:1;display:grid;place-items:center;align-content:center;gap:6px;background:color-mix(in srgb,var(--w-danger) 62%,rgba(0,0,0,.4));color:#fff;font-size:12.5px;font-weight:650}.dc-file{position:relative;display:flex;align-items:center;gap:11px;width:248px;max-width:100%;padding:10px;border-radius:14px;background:var(--w-raised);border:1px solid var(--w-line-strong);color:var(--w-fg);text-decoration:none;cursor:pointer;overflow:hidden;text-align:left;transition:transform .25s var(--ease-spring),box-shadow .2s}.dc-file:hover{transform:translateY(-1px);box-shadow:var(--w-card-shadow)}.dc-ftype{width:34px;height:40px;flex:none;position:relative;border-radius:6px;background:#e5484d;color:#fff;font:800 8.5px/1 var(--font);letter-spacing:.04em;display:grid;place-items:end center;padding-bottom:7px;clip-path:polygon(0 0,66% 0,100% 28%,100% 100%,0 100%)}.dc-ftype:after{content:"";position:absolute;top:0;right:0;width:34%;height:28%;background:#fff6;border-bottom-left-radius:4px}.dc-ftype.is-image{background:#3f8cff}.dc-file .tx{flex:1;min-width:0}.dc-file b{display:block;font-size:13.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dc-file small{display:block;font-size:12px;color:var(--w-muted);margin-top:2px;font-variant-numeric:tabular-nums}.dc-file .dl{width:32px;height:32px;border-radius:50%;background:var(--w-sunken);color:var(--w-muted);display:grid;place-items:center;flex:none;transition:background .15s,color .15s}.dc-file:hover .dl{background:var(--dc-accent);color:var(--dc-on-accent)}.dc-file .bar{position:absolute;left:0;bottom:0;height:3px;width:100%;background:var(--w-sunken)}.dc-file .bar i{display:block;height:100%;background:var(--dc-accent);transition:width .25s var(--ease-out);border-radius:0 2px 2px 0}.dc-file.is-failed{border-color:color-mix(in srgb,var(--w-danger) 50%,transparent)}.dc-file.is-failed small{color:var(--w-danger)}.dc-inline-img{display:block;max-width:232px;max-height:232px;border-radius:14px}.dc-skel{display:flex;flex-direction:column;gap:10px;padding:18px 14px}.dc-skel i{height:34px;border-radius:16px}.dc-skel i:nth-child(odd){width:62%}.dc-skel i:nth-child(2n){width:48%;align-self:flex-end}.dc-skel i:nth-child(3){width:70%;height:52px}.dc-intro{align-self:stretch;display:flex;gap:8px;align-items:flex-end;margin-top:12px}.dc-intro .card{flex:1;min-width:0;background:var(--w-raised);border:1px solid var(--w-line-strong);border-radius:18px 18px 18px 6px;padding:14px;box-shadow:var(--w-card-shadow)}.dc-intro h4{margin:0 0 3px;font-size:14.5px;font-weight:650;color:var(--w-fg)}.dc-intro p{margin:0 0 12px;font-size:13px;color:var(--w-muted);line-height:1.45}.dc-intro form{display:flex;flex-direction:column;gap:8px}.dc-in{display:flex;flex-direction:column;gap:4px}.dc-in span{font-size:12px;font-weight:600;color:var(--w-fg-2)}.dc-in input{font:16px/1.3 var(--font);color:var(--w-fg);background:var(--w-bg);border:1px solid var(--w-line-strong);border-radius:11px;padding:9px 11px;outline:0;width:100%;transition:border-color .15s,box-shadow .15s}@media (pointer: fine){.dc-in input{font-size:14.5px}}.dc-in input:focus{border-color:var(--dc-accent);box-shadow:0 0 0 4px var(--dc-accent-soft)}.dc-in input:focus-visible{outline:none}.dc-in.is-err input{border-color:var(--w-danger)}.dc-in em{font-style:normal;font-size:12px;color:var(--w-danger)}.dc-btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;border:0;border-radius:12px;padding:10px 14px;font-weight:650;font-size:14px;background:var(--dc-accent);color:var(--dc-on-accent);cursor:pointer;transition:transform .25s var(--ease-spring),filter .15s}.dc-btn:hover{filter:brightness(1.06)}.dc-btn:active{transform:scale(.96)}.dc-intro .done{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--w-muted)}.dc-intro .done .ok{width:20px;height:20px;border-radius:50%;background:var(--w-success);color:#fff;display:grid;place-items:center;flex:none}.dc-intro .done b{color:var(--w-fg);font-weight:600}.dc-shake{animation:dc-shake .4s}@keyframes dc-shake{20%{transform:translate(-5px)}40%{transform:translate(5px)}60%{transform:translate(-3px)}80%{transform:translate(2px)}}.dc-typing{display:flex;gap:8px;align-items:flex-end;padding:2px 14px 8px}.dc-typing .dots{display:flex;gap:4px;padding:13px 14px;background:var(--w-bubble);border-radius:18px 18px 18px 6px}.dc-typing .dots i{width:7px;height:7px;border-radius:50%;background:var(--w-muted);animation:dc-bounce 1.1s infinite var(--ease-out)}.dc-typing .dots i:nth-child(2){animation-delay:.14s}.dc-typing .dots i:nth-child(3){animation-delay:.28s}@keyframes dc-bounce{0%,60%,to{transform:translateY(0);opacity:.5}30%{transform:translateY(-4px);opacity:1}}.dc-jump{position:absolute;left:50%;bottom:10px;transform:translate(-50%);z-index:2;display:flex;align-items:center;gap:6px;border:0;border-radius:999px;padding:7px 12px 7px 10px;font-size:12.5px;font-weight:600;background:var(--w-fg);color:var(--w-bg);box-shadow:var(--w-card-shadow);cursor:pointer}.dc-composer{flex:none;padding:6px 12px calc(8px + env(safe-area-inset-bottom,0px));position:relative;background:var(--w-bg)}.dc-field{border:1px solid var(--w-line-strong);background:var(--w-raised);border-radius:22px;transition:border-color .2s,box-shadow .2s}.dc-field:focus-within{border-color:color-mix(in srgb,var(--dc-accent) 70%,transparent);box-shadow:0 0 0 4px var(--dc-accent-soft)}.dc-tray{display:flex;gap:10px;padding:12px 12px 2px;overflow-x:auto;scrollbar-width:none}.dc-chip{position:relative;flex:none;height:58px;border-radius:13px;background:var(--w-sunken);border:1px solid var(--w-line)}.dc-chip.img{width:58px}.dc-chip.img img{width:100%;height:100%;object-fit:cover;border-radius:12px;display:block}.dc-chip.file{display:flex;align-items:center;gap:9px;padding:0 30px 0 10px;max-width:200px}.dc-chip.file .dc-ftype{width:28px;height:33px;padding-bottom:5px;font-size:7.5px}.dc-chip.file .tx{min-width:0}.dc-chip.file b{display:block;font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--w-fg)}.dc-chip.file small{font-size:11.5px;color:var(--w-muted)}.dc-chip .rm{position:absolute;top:-7px;right:-7px;width:22px;height:22px;border-radius:50%;border:2px solid var(--w-raised);background:var(--w-fg);color:var(--w-bg);display:grid;place-items:center;cursor:pointer;padding:0;transition:transform .2s var(--ease-spring)}.dc-chip .rm:hover{transform:scale(1.12)}.dc-input-row{display:flex;align-items:flex-end;gap:2px;padding:5px 5px 5px 15px}.dc-input-row textarea{flex:1;min-width:0;border:0;outline:0;resize:none;background:transparent;color:var(--w-fg);font:16px/1.4 var(--font);padding:7px 0;height:37px;max-height:128px;margin:0}@media (pointer: fine){.dc-input-row textarea{font-size:15px;height:35px}}.dc-input-row textarea::placeholder{color:var(--w-faint)}.dc-input-row textarea:focus-visible{outline:none}.dc-tool{width:34px;height:34px;border-radius:50%;border:0;background:transparent;color:var(--w-muted);display:grid;place-items:center;cursor:pointer;flex:none;padding:0;transition:background .15s,color .15s,transform .2s var(--ease-spring)}.dc-tool:hover{background:var(--w-sunken);color:var(--w-fg)}.dc-tool:active{transform:scale(.9)}.dc-tool[aria-expanded=true]{color:var(--dc-accent-text);background:var(--dc-accent-soft)}.dc-send{width:34px;height:34px;border-radius:50%;border:0;display:grid;place-items:center;flex:none;cursor:pointer;margin-left:2px;padding:0;background:var(--dc-accent);color:var(--dc-on-accent);transition:transform .35s var(--ease-spring),background .2s,color .2s,box-shadow .2s;box-shadow:0 4px 12px -4px color-mix(in srgb,var(--dc-accent) 70%,transparent)}.dc-send:disabled{background:var(--w-sunken);color:var(--w-faint);transform:scale(.86);cursor:default;box-shadow:none}.dc-send:not(:disabled):hover{transform:scale(1.07)}.dc-send:not(:disabled):active{transform:scale(.92)}.dc-powered{display:flex;justify-content:center;align-items:center;gap:5px;margin-top:7px;font-size:11px;color:var(--w-faint);text-decoration:none;transition:color .15s}.dc-powered svg{height:9px;width:auto}.dc-powered:hover{color:var(--w-fg-2)}.dc-toast{position:absolute;left:12px;right:12px;bottom:calc(100% + 4px);display:flex;justify-content:center;pointer-events:none;z-index:3}.dc-toast span{display:flex;align-items:center;gap:7px;background:var(--w-fg);color:var(--w-bg);font-size:12.5px;font-weight:550;padding:8px 12px;border-radius:12px;box-shadow:var(--w-shadow);max-width:100%}.dc-toast span svg{color:#ff8b8e}.dc-resolved{display:flex;flex-direction:column;align-items:center;gap:10px;padding:10px 8px 2px;text-align:center}.dc-resolved p{margin:0;font-size:13px;color:var(--w-muted)}.dc-emoji{position:absolute;right:12px;bottom:calc(100% - 2px);width:300px;max-width:calc(100% - 24px);height:268px;background:var(--w-raised);border:1px solid var(--w-line-strong);border-radius:18px;box-shadow:var(--w-shadow);display:flex;flex-direction:column;overflow:hidden;z-index:4;transform-origin:bottom right}.dc-emoji .grid{flex:1;overflow-y:auto;display:grid;grid-template-columns:repeat(8,1fr);padding:8px;gap:2px;align-content:start;scrollbar-width:thin}.dc-emoji .grid button{border:0;background:transparent;font-size:22px;line-height:1;height:34px;border-radius:9px;cursor:pointer;padding:0;transition:background .12s,transform .2s var(--ease-spring)}.dc-emoji .grid button:hover{background:var(--w-sunken);transform:scale(1.18)}.dc-emoji .tabs{display:flex;border-top:1px solid var(--w-line);padding:4px;gap:2px}.dc-emoji .tabs button{flex:1;border:0;background:transparent;font-size:17px;height:32px;border-radius:9px;cursor:pointer;padding:0;filter:grayscale(1);opacity:.6;transition:filter .15s,opacity .15s,background .15s}.dc-emoji .tabs button[aria-pressed=true]{filter:none;opacity:1;background:var(--w-sunken)}.dc-emoji .cat{grid-column:1 / -1;font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--w-faint);padding:6px 4px 4px}.dc-drop{position:absolute;inset:8px;z-index:6;border-radius:18px;display:grid;place-items:center;align-content:center;gap:6px;text-align:center;color:var(--dc-accent-text);background-color:color-mix(in srgb,var(--w-bg) 86%,transparent);backdrop-filter:blur(6px);background-image:linear-gradient(90deg,var(--dc-accent) 50%,transparent 0),linear-gradient(90deg,var(--dc-accent) 50%,transparent 0),linear-gradient(0deg,var(--dc-accent) 50%,transparent 0),linear-gradient(0deg,var(--dc-accent) 50%,transparent 0);background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;background-size:14px 2px,14px 2px,2px 14px,2px 14px;background-position:0 0,0 100%,0 0,100% 0;animation:dc-march .6s linear infinite;pointer-events:none}@keyframes dc-march{to{background-position:14px 0,-14px 100%,0 -14px,100% 14px}}.dc-drop .ic{width:56px;height:56px;border-radius:18px;background:var(--dc-accent);color:var(--dc-on-accent);display:grid;place-items:center;margin:0 auto 6px;animation:dc-float 1.4s ease-in-out infinite}@keyframes dc-float{50%{transform:translateY(-5px)}}.dc-drop b{font-size:16px;color:var(--w-fg)}.dc-drop small{font-size:12.5px;color:var(--w-muted)}.dc-lightbox{pointer-events:auto;position:fixed;inset:0;z-index:20;display:flex;flex-direction:column}.dc-lightbox .bd{position:absolute;inset:0;background:#08090cdb;backdrop-filter:blur(4px)}.dc-lightbox .bar{position:relative;display:flex;align-items:center;gap:10px;padding:calc(12px + env(safe-area-inset-top,0px)) 14px 12px;color:#fff;font-size:13px}.dc-lightbox .bar span{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.85}.dc-lightbox .bar a,.dc-lightbox .bar button{color:#fff;border:0;background:#ffffff1f;border-radius:10px;height:34px;padding:0 12px;display:inline-flex;align-items:center;gap:6px;cursor:pointer;text-decoration:none;font-size:13px}.dc-lightbox .bar button.x{width:34px;padding:0;justify-content:center}.dc-lightbox .pic{position:relative;flex:1;min-height:0;display:grid;place-items:center;padding:8px 20px 28px}.dc-lightbox img{max-width:100%;max-height:100%;border-radius:10px;box-shadow:0 30px 80px #00000080;transform-origin:top left}@media (max-width: 520px),(max-height: 540px){.dc-panel{inset:0;width:auto;height:auto;max-width:none;border-radius:0;border:0;box-shadow:none;padding-top:env(safe-area-inset-top,0px);padding-bottom:max(0px,var(--dc-keyboard, 0px) - env(safe-area-inset-bottom,0px))}@supports (-webkit-touch-callout: none){.dc-panel{transition:padding-bottom .3s cubic-bezier(.2,.85,.4,1)}}.dc-launcher.is-open{opacity:0;pointer-events:none;transform:scale(.6)}.dc-hbtn .ic-x{display:none}.dc-hbtn .ic-down{display:block}}@media (prefers-reduced-motion: reduce){.dc *,.dc *:before,.dc *:after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}}',mi="https://api.deskcord.chat";function vi(){const t=window.deskcord?.settings;if(!t?.app_id)return console.error("[Deskcord] window.deskcord.settings.app_id is missing: check the embed snippet."),null;const e=t.theme==="dark"||t.theme==="auto"?t.theme:"light";return{appId:String(t.app_id),domain:(t.domain??mi).replace(/\/+$/,""),user:t.user,theme:e}}const yi="DESKCORD_UNAVAILABLE",bi="DESKCORD_QUOTA_REACHED";class ve extends Error{constructor(e,n){super(`Request failed (${e})`),this.status=e,this.body=n}}class mn extends Error{constructor(){super("Deskcord is temporarily unavailable")}}class vn extends Error{constructor(){super("This team isn't taking new conversations right now")}}class bt extends Error{}function yn(t){if(!t)return null;try{return JSON.parse(t)}catch{return t}}function xi(t,e){function n(o,a){if(o===503&&a?.code===yi)throw e(),new mn;if(o===403&&a?.code===bi)throw new vn;if(o<200||o>=300)throw new ve(o,a)}async function r(o,a,c,d){const u={};c!==void 0&&(u["Content-Type"]="application/json"),d&&(u.Authorization=`Bearer ${d}`);let g;try{g=await fetch(t+a,{method:o,headers:u,body:c===void 0?void 0:JSON.stringify(c)})}catch(h){throw new bt(String(h))}const p=yn(await g.text());return n(g.status,p),p}function i(o,a,c,d,u){return new Promise((g,p)=>{const h=new XMLHttpRequest;h.open("POST",t+o),h.setRequestHeader("Authorization",`Bearer ${c}`),h.upload.onprogress=w=>{w.lengthComputable&&d(w.loaded/w.total)},h.onload=()=>{const w=yn(h.responseText);try{n(h.status,w),g(w)}catch(k){p(k)}},h.onerror=()=>p(new bt("Upload failed"));const x=new FormData;x.append("file",a),u&&x.append("pageUrl",u),h.send(x)})}return{get:(o,a)=>r("GET",o,void 0,a),post:(o,a,c)=>r("POST",o,a,c),upload:i}}const wi=2048;function xt(t=typeof window>"u"?void 0:window.location){if(!t||t.protocol!=="https:"&&t.protocol!=="http:")return;const e=`${t.origin}${t.pathname}`;return e.length<=wi?e:void 0}const bn=t=>t instanceof ve&&t.status===404;function _i(t,e){const n=xi(t.domain,e),r=t.appId,i=({name:o,email:a,avatarUrl:c,metadata:d})=>({name:o,email:a,...c?{avatarUrl:c}:{},...d?{metadata:d}:{}});return{async status(){return!!(await n.get(`/guildSettings/status/${encodeURIComponent(r)}`))?.active},settings(){return n.get(`/guildSettings/${encodeURIComponent(r)}`)},async token(o,a){const c=await n.post("/auth/token",{guildId:r,...i(o)},a);if(!c?.token||c.token==="undefined")throw new Error("No token in /auth/token response");return c.token},async identify(o,a){try{return(await n.post("/auth/identify",{guildId:r,userId:o.userId,userHash:o.userHash,...i(o)},a))?.token??null}catch(c){if(c instanceof ve&&c.status<500)return null;throw c}},async current(o){try{return(await n.get("/conversations/current",o))?.currentConversation??null}catch(a){if(bn(a))return null;throw a}},async past(o){try{return(await n.get("/conversations/past",o))?.pastConversations??[]}catch(a){if(bn(a))return[];throw a}},async unreadCount(o){const a=await n.get("/conversations/unread-count",o);return Number(a?.unreadCount)||0},async markRead(o,a){await n.post("/conversations/mark-read",{timestamp:a},o)},send(o,a,c){const d=xt();return n.post("/conversations/sendMessage",{name:a,content:c,...d?{pageUrl:d}:{}},o)},upload(o,a,c){return n.upload("/conversations/uploadAttachment",a,o,c,xt())}}}const xn=20,wn=40,_n=200,ki=1024,Ei=t=>new TextEncoder().encode(t).length;function kn(t,e=Ai){if(t==null)return null;if(typeof t!="object"||Array.isArray(t))return e("metadata ignored: it must be a flat object."),null;const n=[],r={};let i=0,o=2;for(const[a,c]of Object.entries(t)){const d=a.trim(),u=c===null||typeof c=="boolean"||typeof c=="number"&&Number.isFinite(c)||typeof c=="string"&&c.length<=_n;if(!d||d.length>wn||d==="__proto__"||d in r){n.push(`"${a.slice(0,wn)}" (invalid key)`);continue}if(!u){n.push(`"${d}" (values must be strings of at most ${_n} characters, numbers, booleans or null)`);continue}const g=Ei(`${JSON.stringify(d)}:${JSON.stringify(c)},`);if(i>=xn||o+g>ki){n.push(`"${d}" (too much metadata: ${xn} keys and about 1 KB at most)`);continue}o+=g,i++,r[d]=c}return n.length&&e(`metadata dropped: ${n.join(", ")}.`),i?r:null}function Ai(t){console.warn(`[Deskcord] ${t}`)}const ie=Object.create(null);ie.open="0",ie.close="1",ie.ping="2",ie.pong="3",ie.message="4",ie.upgrade="5",ie.noop="6";const je=Object.create(null);Object.keys(ie).forEach(t=>{je[ie[t]]=t});const wt={type:"error",data:"parser error"},En=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",An=typeof ArrayBuffer=="function",Tn=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,_t=({type:t,data:e},n,r)=>En&&e instanceof Blob?n?r(e):Sn(e,r):An&&(e instanceof ArrayBuffer||Tn(e))?n?r(e):Sn(new Blob([e]),r):r(ie[t]+(e||"")),Sn=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function Cn(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let kt;function Ti(t,e){if(En&&t.data instanceof Blob)return t.data.arrayBuffer().then(Cn).then(e);if(An&&(t.data instanceof ArrayBuffer||Tn(t.data)))return e(Cn(t.data));_t(t,!1,n=>{kt||(kt=new TextEncoder),e(kt.encode(n))})}const Rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Te=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Rn.length;t++)Te[Rn.charCodeAt(t)]=t;const Si=t=>{let e=t.length*.75,n=t.length,r,i=0,o,a,c,d;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const u=new ArrayBuffer(e),g=new Uint8Array(u);for(r=0;r<n;r+=4)o=Te[t.charCodeAt(r)],a=Te[t.charCodeAt(r+1)],c=Te[t.charCodeAt(r+2)],d=Te[t.charCodeAt(r+3)],g[i++]=o<<2|a>>4,g[i++]=(a&15)<<4|c>>2,g[i++]=(c&3)<<6|d&63;return u},Ci=typeof ArrayBuffer=="function",Et=(t,e)=>{if(typeof t!="string")return{type:"message",data:In(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:Ri(t.substring(1),e)}:je[n]?t.length>1?{type:je[n],data:t.substring(1)}:{type:je[n]}:wt},Ri=(t,e)=>{if(Ci){const n=Si(t);return In(n,e)}else return{base64:!0,data:t}},In=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},Ln="",Ii=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,a)=>{_t(o,!1,c=>{r[a]=c,++i===n&&e(r.join(Ln))})})},Li=(t,e)=>{const n=t.split(Ln),r=[];for(let i=0;i<n.length;i++){const o=Et(n[i],e);if(r.push(o),o.type==="error")break}return r};function Ni(){return new TransformStream({transform(t,e){Ti(t,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let At;function qe(t){return t.reduce((e,n)=>e+n.length,0)}function Ve(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;i<e;i++)n[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function Oi(t,e){At||(At=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,c){for(n.push(a);;){if(r===0){if(qe(n)<1)break;const d=Ve(n,1);o=(d[0]&128)===128,i=d[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(qe(n)<2)break;const d=Ve(n,2);i=new DataView(d.buffer,d.byteOffset,d.length).getUint16(0),r=3}else if(r===2){if(qe(n)<8)break;const d=Ve(n,8),u=new DataView(d.buffer,d.byteOffset,d.length),g=u.getUint32(0);if(g>Math.pow(2,21)-1){c.enqueue(wt);break}i=g*Math.pow(2,32)+u.getUint32(4),r=3}else{if(qe(n)<i)break;const d=Ve(n,i);c.enqueue(Et(o?d:At.decode(d),e)),r=0}if(i===0||i>t){c.enqueue(wt);break}}}})}const Nn=4;function B(t){if(t)return $i(t)}function $i(t){for(var e in B.prototype)t[e]=B.prototype[e];return t}B.prototype.on=B.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},B.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},B.prototype.off=B.prototype.removeListener=B.prototype.removeAllListeners=B.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+t],this},B.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,e)}return this},B.prototype.emitReserved=B.prototype.emit,B.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},B.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Q=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function On(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const Mi=Q.setTimeout,Ui=Q.clearTimeout;function We(t,e){e.useNativeTimers?(t.setTimeoutFn=Mi.bind(Q),t.clearTimeoutFn=Ui.bind(Q)):(t.setTimeoutFn=Q.setTimeout.bind(Q),t.clearTimeoutFn=Q.clearTimeout.bind(Q))}const Di=1.33;function Pi(t){return typeof t=="string"?zi(t):Math.ceil((t.byteLength||t.size)*Di)}function zi(t){let e=0,n=0;for(let r=0,i=t.length;r<i;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function Bi(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function Fi(t){let e={},n=t.split("&");for(let r=0,i=n.length;r<i;r++){let o=n[r].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class Hi extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Tt extends B{constructor(e){super(),this.writable=!1,We(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,r){return super.emitReserved("error",new Hi(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=Et(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=Bi(e);return n.length?"?"+n:""}}const $n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),St=64,ji={};let Mn=0,Ye=0,Un;function Dn(t){let e="";do e=$n[t%St]+e,t=Math.floor(t/St);while(t>0);return e}function Pn(){const t=Dn(+new Date);return t!==Un?(Mn=0,Un=t):t+"."+Dn(Mn++)}for(;Ye<St;Ye++)ji[$n[Ye]]=Ye;let zn=!1;try{zn=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const qi=zn;function Bn(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||qi))return new XMLHttpRequest}catch{}if(!e)try{return new Q[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function ma(){}function Vi(){}const Wi=function(){return new Bn({xdomain:!1}).responseType!=null}();class Yi extends Tt{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let i=location.port;i||(i=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}const n=e&&e.forceBase64;this.supportsBinary=Wi&&!n,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Li(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Ii(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Pn()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new oe(this.uri(),e)}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class oe extends B{constructor(e,n){super(),We(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.data=n.data!==void 0?n.data:null,this.create()}create(){var e;const n=On(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new Bn(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=oe.requestsCount++,oe.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=Vi,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete oe.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(oe.requestsCount=0,oe.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Fn);else if(typeof addEventListener=="function"){const t="onpagehide"in Q?"pagehide":"unload";addEventListener(t,Fn,!1)}}function Fn(){for(let t in oe.requests)oe.requests.hasOwnProperty(t)&&oe.requests[t].abort()}const Ct=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Ke=Q.WebSocket||Q.MozWebSocket,Hn=!0,Ki="arraybuffer",jn=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Xi extends Tt{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,r=jn?{}:On(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=Hn&&!jn?n?new Ke(e,n):new Ke(e):new Ke(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;_t(r,this.supportsBinary,o=>{const a={};try{Hn&&this.ws.send(o)}catch{}i&&Ct(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Pn()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}check(){return!!Ke}}class Ji extends Tt{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const n=Oi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=Ni();i.readable.pipeTo(e.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:c,value:d})=>{c||(this.onPacket(d),o())}).catch(c=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this.writer.write(a).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;this.writer.write(r).then(()=>{i&&Ct(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const Zi={websocket:Xi,webtransport:Ji,polling:Yi},Gi=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Qi=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Rt(t){if(t.length>2e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=Gi.exec(t||""),o={},a=14;for(;a--;)o[Qi[a]]=i[a]||"";return n!=-1&&r!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=eo(o,o.path),o.queryKey=to(o,o.query),o}function eo(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function to(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let qn=class Ee extends B{constructor(e,n={}){super(),this.binaryType=Ki,this.writeBuffer=[],e&&typeof e=="object"&&(n=e,e=null),e?(e=Rt(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=Rt(n.host).host),We(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Fi(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=Nn,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new Zi[e](r)}open(){let e;if(this.opts.rememberUpgrade&&Ee.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(e){let n=this.createTransport(e),r=!1;Ee.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!r)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Ee.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(g(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function o(){r||(r=!0,g(),n.close(),n=null)}const a=p=>{const h=new Error("probe error: "+p);h.transport=n.name,o(),this.emitReserved("upgradeError",h)};function c(){a("transport closed")}function d(){a("socket closed")}function u(p){n&&p.name!==n.name&&o()}const g=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",c),this.off("close",d),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",c),this.once("close",d),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Ee.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const n=this.upgrades.length;for(;e<n;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const n=new Error("server error");n.code=e.data,this.onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=Pi(i)),r>0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(e,n,r){return this.sendPacket("message",e,n,r),this}send(e,n,r){return this.sendPacket("message",e,n,r),this}sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:e,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){Ee.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let r=0;const i=e.length;for(;r<i;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}};qn.protocol=Nn;function no(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=Rt(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+e,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const ro=typeof ArrayBuffer=="function",io=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Vn=Object.prototype.toString,oo=typeof Blob=="function"||typeof Blob<"u"&&Vn.call(Blob)==="[object BlobConstructor]",so=typeof File=="function"||typeof File<"u"&&Vn.call(File)==="[object FileConstructor]";function It(t){return ro&&(t instanceof ArrayBuffer||io(t))||oo&&t instanceof Blob||so&&t instanceof File}function Xe(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(Xe(t[n]))return!0;return!1}if(It(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Xe(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Xe(t[n]))return!0;return!1}function ao(t){const e=[],n=t.data,r=t;return r.data=Lt(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Lt(t,e){if(!t)return t;if(It(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Lt(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Lt(t[r],e));return n}return t}function co(t,e){return t.data=Nt(t.data,e),delete t.attachments,t}function Nt(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Nt(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Nt(t[n],e));return t}const lo=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],uo=5;var R;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(R||(R={}));class po{constructor(e){this.replacer=e}encode(e){return(e.type===R.EVENT||e.type===R.ACK)&&Xe(e)?this.encodeAsBinary({type:e.type===R.EVENT?R.BINARY_EVENT:R.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===R.BINARY_EVENT||e.type===R.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=ao(e),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function Wn(t){return Object.prototype.toString.call(t)==="[object Object]"}class Ot extends B{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===R.BINARY_EVENT;r||n.type===R.BINARY_ACK?(n.type=r?R.EVENT:R.ACK,this.reconstructor=new fo(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(It(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(R[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===R.BINARY_EVENT||r.type===R.BINARY_ACK){const o=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const a=e.substring(o,n);if(a!=Number(a)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(a)}if(e.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(o,n)}else r.nsp="/";const i=e.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const a=e.charAt(n);if(a==null||Number(a)!=a){--n;break}if(n===e.length)break}r.id=Number(e.substring(o,n+1))}if(e.charAt(++n)){const o=this.tryParse(e.substr(n));if(Ot.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case R.CONNECT:return Wn(n);case R.DISCONNECT:return n===void 0;case R.CONNECT_ERROR:return typeof n=="string"||Wn(n);case R.EVENT:case R.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&lo.indexOf(n[0])===-1);case R.ACK:case R.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class fo{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=co(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const ho=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ot,Encoder:po,get PacketType(){return R},protocol:uo},Symbol.toStringTag,{value:"Module"}));function re(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const go=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Yn extends B{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[re(e,"open",this.onopen.bind(this)),re(e,"packet",this.onpacket.bind(this)),re(e,"error",this.onerror.bind(this)),re(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(go.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const r={type:R.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const a=this.ids++,c=n.pop();this._registerAckCallback(a,c),r.id=a}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);n.call(this,new Error("operation has timed out"))},i),a=(...c)=>{this.io.clearTimeoutFn(o),n.apply(this,c)};a.withError=!0,this.acks[e]=a}emitWithAck(e,...n){return new Promise((r,i)=>{const o=(a,c)=>a?i(a):r(c);o.withError=!0,n.push(o),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:R.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case R.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case R.EVENT:case R.BINARY_EVENT:this.onevent(e);break;case R.ACK:case R.BINARY_ACK:this.onack(e);break;case R.DISCONNECT:this.ondisconnect();break;case R.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:R.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:R.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function ye(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}ye.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0},ye.prototype.reset=function(){this.attempts=0},ye.prototype.setMin=function(t){this.ms=t},ye.prototype.setMax=function(t){this.max=t},ye.prototype.setJitter=function(t){this.jitter=t};class $t extends B{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,We(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new ye({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||ho;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new qn(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=re(n,"open",function(){r.onopen(),e&&e()}),o=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},a=re(n,"error",o);if(this._timeout!==!1){const c=this._timeout,d=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},c);this.opts.autoUnref&&d.unref(),this.subs.push(()=>{this.clearTimeoutFn(d)})}return this.subs.push(i),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(re(e,"ping",this.onping.bind(this)),re(e,"data",this.ondata.bind(this)),re(e,"error",this.onerror.bind(this)),re(e,"close",this.onclose.bind(this)),re(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Ct(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new Yn(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Se={};function Je(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=no(t,e.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=Se[i]&&o in Se[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||a;let d;return c?d=new $t(r,e):(Se[i]||(Se[i]=new $t(r,e)),d=Se[i]),n.query&&!e.query&&(e.query=n.queryKey),d.socket(n.path,e)}Object.assign(Je,{Manager:$t,Socket:Yn,io:Je,connect:Je});const mo=["new-support-message","updated-support-message","deleted-support-message","new-customer-message","thread-closed","thread-reopened","thread-assigned","thread-reassigned","support-typing","presence-updated","conversations-paused"];function vo(t,e,n){const r=Je(t,{path:"/socket"});let i=!1,o=0,a;for(const c of mo)r.on(c,d=>n.event(c,d));return r.on("connect",()=>{o=0;const c=xt();r.emit("identify",{jwt:e,...c?{pageUrl:c}:{}}),n.status(!0)}),r.on("disconnect",c=>{n.status(!1),c==="io server disconnect"&&!i&&(a=setTimeout(()=>r.connect(),Math.min(3e4,1e3*2**o++)))}),r.on("connect_error",()=>n.status(!1)),r.on("error",c=>{c?.message==="Invalid token"&&n.invalidToken()}),{close(){i=!0,clearTimeout(a),r.removeAllListeners(),r.disconnect()}}}const yo="Customer support";function Kn(t){const e=t;return!e?.displayName||e.displayName===yo?null:{displayName:e.displayName,displayAvatarURL:e.displayAvatarURL??"",status:e.status??"offline"}}function bo(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n)|0;return(e>>>0).toString(36)}function Xn(t){return t.id?`id:${t.id}`:`d:${t.date}:${t.support?"s":"c"}:${bo(t.content??"")}:${t.attachments?.length??0}`}function Ze(t,e){const n=Xn(t);return{key:e.get(n)??n,sid:n,from:t.support?"agent":"me",authorName:t.authorName??"",...t.authorAvatarURL?{authorAvatarURL:t.authorAvatarURL}:{},text:t.content??"",date:Number(t.date),attachments:Array.isArray(t.attachments)?t.attachments:[],emojis:t.emojis??{}}}const Jn=(t,e)=>t.date-e.date;function Zn(t,e){return{threadId:t,status:"open",csMember:null,messages:[],lastMessageDate:e}}function Gn(t,e){const n=new Set,r=[];for(const i of t.messages??[]){if(!Number.isFinite(Number(i?.date)))continue;const o=Ze(i,e);n.has(o.sid)||(n.add(o.sid),r.push(o))}return r.sort(Jn),{threadId:t.threadId,status:t.status==="closed"?"closed":"open",csMember:Kn(t.csMember),messages:r,lastMessageDate:r[r.length-1]?.date??(Number(t.lastMessageDate)||Date.now())}}function Qn(t,e){const n=t.messages.findIndex(i=>i.sid===e.sid),r=n===-1?[...t.messages,e].sort(Jn):t.messages.map((i,o)=>o===n?{...e,key:i.key}:i);return{...t,messages:r,lastMessageDate:Math.max(t.lastMessageDate,e.date)}}function er(t,e,n){if(e){const r=t.messages.find(i=>i.sid===`id:${e}`);if(r)return r}return t.messages.find(r=>r.from==="agent"&&r.date===n)}function tr(t,e,n){return{...t,messages:t.messages.map(r=>r.sid===e?{...r,...n}:r)}}function xo(t,e){return{...t,messages:t.messages.filter(n=>n.sid!==e)}}function Ge(t,e){let n=!1;const r={...t};for(const i of Object.values(t))i.status==="open"&&i.threadId!==e&&(r[i.threadId]={...i,status:"closed"},n=!0);return n?r:t}function nr(t){return Object.values(t).sort((e,n)=>n.lastMessageDate-e.lastMessageDate)}function Qe(t){return nr(t).find(e=>e.status==="open")??null}function et(t){return t.guild.acceptingConversations!==!1}function rr(t){return et(t)||t.open||Qe(t.conversations)!==null}function wo(t){if(!t)return 0;for(let e=t.messages.length-1;e>=0;e--)if(t.messages[e].from==="agent")return t.messages[e].date;return 0}function ir(t,e){const n=Qe(t);return n?n.messages.filter(r=>r.from==="agent"&&!r.deleted&&r.date>e).length:0}function _o(t,e){const n=t.messages.filter(r=>r.from==="agent").map(r=>r.date).sort((r,i)=>i-r);return e<=0?n[0]??0:e>=n.length?0:n[e]}function ko(t){for(let e=t.messages.length-1;e>=0;e--)if(t.messages[e].from==="agent"&&t.messages[e].authorName)return t.messages[e].authorName;return null}function or(t){try{const e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}}function Eo(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function Mt(t){try{localStorage.removeItem(t)}catch{}}function Ao(t){try{const e=document.cookie.split("; ").find(n=>n.startsWith(`${t}=`));return e?decodeURIComponent(e.slice(t.length+1)):null}catch{return null}}function To(t){try{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`}catch{}}const sr={name:"",email:"",avatarUrl:"",verifiedUserId:null,metadata:null};function So(){return{boot:"loading",activeAt:null,guild:{},dark:!1,open:!1,view:"chat",nav:0,navPrev:null,activeThreadId:null,identity:sr,token:null,conversations:{},synced:!1,past:"idle",outbox:[],tray:[],typing:{},connection:"off",lastReadAt:0,events:{},preview:null,lightbox:null,notice:null}}const Co=30,ar=200,Ut=t=>`deskcord:${t}`,K=t=>typeof t=="string",Ce=t=>typeof t=="number"&&Number.isFinite(t);function Ro(t){return!t||!K(t.sid)||!K(t.key)||!Ce(t.date)?null:{key:t.key,sid:t.sid,from:t.from==="me"?"me":"agent",authorName:K(t.authorName)?t.authorName:"",...K(t.authorAvatarURL)?{authorAvatarURL:t.authorAvatarURL}:{},text:K(t.text)?t.text:"",date:t.date,attachments:Array.isArray(t.attachments)?t.attachments:[],emojis:t.emojis&&typeof t.emojis=="object"?t.emojis:{},...t.edited?{edited:!0}:{}}}function Io(t){if(!t||!K(t.threadId)||!t.threadId)return null;const e=(Array.isArray(t.messages)?t.messages:[]).map(Ro).filter(n=>!!n).slice(-ar);return{threadId:t.threadId,status:t.status==="open"?"open":"closed",csMember:t.csMember??null,messages:e,lastMessageDate:Ce(t.lastMessageDate)?t.lastMessageDate:e[e.length-1]?.date??0}}function cr(t){return{name:K(t?.name)?t.name:"",email:K(t?.email)?t.email:"",avatarUrl:K(t?.avatarUrl)?t.avatarUrl:"",verifiedUserId:K(t?.verifiedUserId)?t.verifiedUserId:null,metadata:kn(t?.metadata,()=>{})}}function Lo(){const t=or("discord-widget-storage"),e=Ao("discord-widget");if(!t&&!e)return null;const n=t?.state??{},r=e||(K(n.token)&&n.token?n.token:null);return Mt("discord-widget-storage"),Mt("deskcord_last_read"),Mt("deskcord_unread_count"),To("discord-widget"),{token:r,identity:cr({name:n.username,email:n.email,avatarUrl:n.avatarUrl,verifiedUserId:n.verifiedUserId}),conversations:{},lastReadAt:0,guild:{},activeAt:null,outbox:[]}}function lr(t){const e=or(Ut(t));if(!e||e.v!==1)return Lo();const n={};for(const i of Array.isArray(e.conversations)?e.conversations:[]){const o=Io(i);o&&(n[o.threadId]=o)}const r=(Array.isArray(e.outbox)?e.outbox:[]).filter(i=>K(i?.localId)&&K(i?.text)&&i.text).map(i=>({localId:i.localId,text:i.text,state:i.state==="held"||i.state==="queued"?i.state:"failed",progress:0,attempts:0,createdAt:Ce(i.createdAt)?i.createdAt:Date.now()}));return{token:K(e.token)&&e.token?e.token:null,identity:cr(e.identity),conversations:n,lastReadAt:Ce(e.lastReadAt)?e.lastReadAt:0,guild:e.guild&&typeof e.guild=="object"?e.guild:{},activeAt:Ce(e.activeAt)?e.activeAt:null,outbox:r}}function No(t,e){const n=Object.values(e.conversations).sort((i,o)=>o.lastMessageDate-i.lastMessageDate).slice(0,Co).map(i=>({...i,messages:i.messages.filter(o=>!o.deleted).slice(-ar)})),r={v:1,token:e.token,identity:e.identity,conversations:n,lastReadAt:e.lastReadAt,guild:e.guild,activeAt:e.activeAt,outbox:e.outbox.filter(i=>!i.file&&i.text).map(({localId:i,text:o,state:a,createdAt:c})=>({localId:i,text:o,state:a,createdAt:c}))};Eo(Ut(t),r)}var ue,U,Dt,dr,tt=0,ur=[],P=$,pr=P.__b,fr=P.__r,hr=P.diffed,gr=P.__c,mr=P.unmount,vr=P.__;function Re(t,e){P.__h&&P.__h(U,t,tt||e),tt=0;var n=U.__H||(U.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function j(t){return tt=1,yr(wr,t)}function yr(t,e,n){var r=Re(ue++,2);if(r.t=t,!r.__c&&(r.__=[wr(void 0,e),function(c){var d=r.__N?r.__N[0]:r.__[0],u=r.t(d,c);d!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=U,!U.u)){var i=function(c,d,u){if(!r.__c.__H)return!0;var g=r.__c.__H.__.filter(function(h){return!!h.__c});if(g.every(function(h){return!h.__N}))return!o||o.call(this,c,d,u);var p=r.__c.props!==c;return g.forEach(function(h){if(h.__N){var x=h.__[0];h.__=h.__N,h.__N=void 0,x!==h.__[0]&&(p=!0)}}),o&&o.call(this,c,d,u)||p};U.u=!0;var o=U.shouldComponentUpdate,a=U.componentWillUpdate;U.componentWillUpdate=function(c,d,u){if(this.__e){var g=o;o=void 0,i(c,d,u),o=g}a&&a.call(this,c,d,u)},U.shouldComponentUpdate=i}return r.__N||r.__}function ce(t,e){var n=Re(ue++,3);!P.__s&&zt(n.__H,e)&&(n.__=t,n.i=e,U.__H.__h.push(n))}function N(t,e){var n=Re(ue++,4);!P.__s&&zt(n.__H,e)&&(n.__=t,n.i=e,U.__h.push(n))}function S(t){return tt=5,nt(function(){return{current:t}},[])}function nt(t,e){var n=Re(ue++,7);return zt(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function br(t){var e=U.context[t.__c],n=Re(ue++,9);return n.c=t,e?(n.__==null&&(n.__=!0,e.sub(U)),e.props.value):t.__}function Oo(){for(var t;t=ur.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(rt),t.__H.__h.forEach(Pt),t.__H.__h=[]}catch(e){t.__H.__h=[],P.__e(e,t.__v)}}P.__b=function(t){U=null,pr&&pr(t)},P.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),vr&&vr(t,e)},P.__r=function(t){fr&&fr(t),ue=0;var e=(U=t.__c).__H;e&&(Dt===U?(e.__h=[],U.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(e.__h.forEach(rt),e.__h.forEach(Pt),e.__h=[],ue=0)),Dt=U},P.diffed=function(t){hr&&hr(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(ur.push(e)!==1&&dr===P.requestAnimationFrame||((dr=P.requestAnimationFrame)||$o)(Oo)),e.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),Dt=U=null},P.__c=function(t,e){e.some(function(n){try{n.__h.forEach(rt),n.__h=n.__h.filter(function(r){return!r.__||Pt(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],P.__e(r,n.__v)}}),gr&&gr(t,e)},P.unmount=function(t){mr&&mr(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{rt(r)}catch(i){e=i}}),n.__H=void 0,e&&P.__e(e,n.__v))};var xr=typeof requestAnimationFrame=="function";function $o(t){var e,n=function(){clearTimeout(r),xr&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);xr&&(e=requestAnimationFrame(n))}function rt(t){var e=U,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),U=e}function Pt(t){var e=U;t.__c=t.__(),U=e}function zt(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function wr(t,e){return typeof e=="function"?e(t):e}function Mo(t){let e=t;const n=new Set;return{get:()=>e,set(r){const i=typeof r=="function"?r(e):r;e={...e,...i},n.forEach(o=>o())},subscribe(r){return n.add(r),()=>n.delete(r)}}}function Uo(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null||Array.isArray(t)!==Array.isArray(e))return!1;const n=Object.keys(t);return n.length!==Object.keys(e).length?!1:n.every(r=>Object.is(t[r],e[r]))}function Do(t,e,n=Uo){const[,r]=yr(c=>c+1,0),i=S(e);i.current=e;const o=e(t.get()),a=S(o);return a.current=o,N(()=>{const c=()=>{n(i.current(t.get()),a.current)||r(0)},d=t.subscribe(c);return c(),d},[t,n]),o}const _r=["image/png","image/jpeg","image/gif","image/webp","application/pdf"],Po=10*1024*1024,kr=10,be=2e3,zo=8e3,Bo=12*60*60*1e3,Fo=5*60*1e3,Ho=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Er=256,jo=2048,Ar=t=>Ho.test(t.trim()),Bt=t=>`${t}${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`,qo=()=>document.visibilityState==="visible"&&document.hasFocus();function Tr(t){try{const e=JSON.parse(atob(t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/")));return Number.isFinite(e.exp)?e.exp*1e3:null}catch{return null}}function Vo(t){return typeof t!="string"||!t?"":!/^https:\/\/\S+$/i.test(t)||t.length>jo?(console.warn("[Deskcord] avatarUrl ignored: it must be an https:// URL of at most 2048 characters."),""):t}function Wo(t){const e=[];let n=t;for(;n.length>be;){let r=n.lastIndexOf(`
2
- `,be);r<be/2&&(r=n.lastIndexOf(" ",be)),r<be/2&&(r=be),e.push(n.slice(0,r).trim()),n=n.slice(r).trim()}return n&&e.push(n),e}function Yo(t){const e=Mo(So()),{get:n,set:r}=e,i=_i(t,()=>te()),o=new Map,a=new Map,c=new Map;let d=null,u=0,g=!1,p,h=null,x=0;const w=[];let k,_,A=0,y=0,L=!1,E=!1;function O(l){x>0?w.push(l):l()}function z(){for(;x===0&&w.length;)w.shift()()}function V(){et(n())&&r(l=>({guild:{...l.guild,acceptingConversations:!1}}))}function te(){r({boot:"hidden",open:!1,activeAt:null}),T()}function F(l,f,v=!1){let m=!0;return r(b=>{const C=b.conversations[l];if(!C&&!v)return m=!1,{};m=!!C;const I=C??Zn(l,Date.now());let q={...b.conversations,[l]:f(I)};return C||(q=Ge(q,l)),{conversations:q}}),m}function J(l){const f=Qe(l.conversations);return f?{view:"chat",activeThreadId:f.threadId}:Object.keys(l.conversations).length||l.token?{view:"home",activeThreadId:null}:{view:"chat",activeThreadId:null}}function Y(){L||n().open||r(l=>J(l))}function Z(){const l=n().token;if(!l)return;d?.close();const f=u;r({connection:"connecting"}),setTimeout(()=>{f===u&&!n().synced&&_e()},3e3),d=vo(t.domain,l,{event:(v,m)=>{f===u&&Qs(v,m)},status:v=>{f===u&&ne(v)},invalidToken:()=>{f===u&&Gt()}})}function T(){d?.close(),d=null,n().connection!=="off"&&r({connection:"off"})}function ne(l){const f=n().connection;l?(r({connection:"up"}),_e(),ge()):f==="up"&&r({connection:"down"})}async function _e(){const{token:l,synced:f}=n();if(!l)return;const v=u;A=Date.now();try{const[m,b]=await Promise.all([i.current(l),f?Promise.resolve(null):i.unreadCount(l).catch(()=>null)]);if(v!==u)return;O(()=>Gs(m,b))}catch(m){if(v!==u)return;m instanceof ve&&(m.status===401||m.status===403)&&Gt()}}function Oe(){clearTimeout(k),k=setTimeout(()=>void _e(),400)}function Gs(l,f){let v=!1;r(m=>{let b=Ge(m.conversations,l?.threadId??null),C=m.lastReadAt;if(l){const I=Gn(l,o);if(b={...b,[I.threadId]:I},f!==null){const q=_o(I,f);v=m.lastReadAt>q,C=Math.max(m.lastReadAt,q)}}return{conversations:b,lastReadAt:C,synced:!0}}),v&&oi(),Y()}async function Gt(){const l=n();if(l.identity.verifiedUserId){Ue();return}if(T(),r({token:null}),l.identity.name&&l.identity.email)try{await Jr()}catch{}}function Jr(){const l=n().token;if(l)return Promise.resolve(l);if(!h){const f=u;h=(async()=>{const{name:v,email:m,avatarUrl:b,metadata:C}=n().identity;if(!v||!m)throw new Error("Missing name or email");const I=await i.token({name:v,email:m,avatarUrl:b,metadata:C});if(f!==u)throw new Error("Visitor changed");return r({token:I}),Z(),I})().finally(()=>{h=null})}return h}function Qs(l,f){const v=f??{},m=v.threadId;switch(l){case"conversations-paused":V();return;case"presence-updated":r(b=>({guild:{...b.guild,onlineCsMembers:Array.isArray(v.onlineCsMembers)?v.onlineCsMembers:[]}}));return;case"new-support-message":m&&v.message&&ea(m,v.message);return;case"new-customer-message":if(m&&v.message){const b=v.message;O(()=>Gr(m,b))}return;case"updated-support-message":m&&v.message&&ta(m,v.message);return;case"deleted-support-message":m&&na(m,v.messageId,v.messageDate);return;case"thread-closed":m&&(F(m,b=>({...b,status:"closed"})),Qt(m));return;case"thread-reopened":m&&(r(b=>({conversations:Ge(b.conversations,m),events:Zr(b,m,"reopened")})),F(m,b=>({...b,status:"open"}))||Oe());return;case"thread-assigned":case"thread-reassigned":{if(!m)return;const b=Kn(v.csMember);F(m,I=>({...I,csMember:b}),!0)||Oe(),l==="thread-reassigned"&&b&&r(I=>({events:Zr(I,m,"handoff",b.displayName)}));return}case"support-typing":m&&ra(m);return}}function Zr(l,f,v,m){return{...l.events,[f]:[...l.events[f]??[],{key:Bt("e"),kind:v,date:Date.now(),name:m}]}}function Gr(l,f){const v=Ze(f,o);return Number.isFinite(v.date)?(F(l,b=>Qn({...b,status:"open"},v),!0)||Oe(),v):null}function ea(l,f){const v=Gr(l,f);if(Qt(l),!v)return;n().open||r({preview:{threadId:l,key:v.key}})}function ta(l,f){const v=n().conversations[l],m=v&&er(v,f.id,f.date);if(!m)return;const b=Ze(f,o);F(l,C=>tr(C,m.sid,{text:b.text,attachments:b.attachments,emojis:b.emojis,edited:!0}))}function na(l,f,v){const m=n().conversations[l],b=m&&er(m,f,v);b&&(F(l,C=>tr(C,b.sid,{deleted:!0})),setTimeout(()=>F(l,C=>xo(C,b.sid)),400))}function ra(l){clearTimeout(c.get(l)),c.set(l,setTimeout(()=>Qt(l),zo)),n().typing[l]||r(f=>({typing:{...f.typing,[l]:!0}}))}function Qt(l){clearTimeout(c.get(l)),c.delete(l),n().typing[l]&&r(f=>({typing:{...f.typing,[l]:!1}}))}function Qr(l){const f={localId:Bt("l"),progress:0,attempts:0,createdAt:Date.now(),...l};return r(v=>({outbox:[...v.outbox,f]})),f}function $e(l,f){r(v=>({outbox:v.outbox.map(m=>m.localId===l?{...m,...f}:m)}))}function ei(l){r(f=>({outbox:f.outbox.filter(v=>v.localId!==l)}))}async function ge(){if(!g){g=!0;try{for(;;){const l=n();if(l.boot==="hidden")break;const f=l.outbox.find(v=>v.state==="queued");if(!f||!await ia(f))break}}finally{g=!1}}}async function ia(l){const f=u,v=l.attempts+1;$e(l.localId,{state:"sending",progress:0,attempts:v}),x++;try{const m=await Jr();if(l.file){const b=await i.upload(m,l.file,C=>$e(l.localId,{progress:C}));f===u&&ti(l,{threadId:b.threadId,id:b.id,date:Number.isFinite(b.date)?b.date:Date.now(),content:"",attachments:b.attachments??[]})}else{const b=await i.send(m,n().identity.name,l.text??"");f===u&&ti(l,{threadId:b.threadId,id:b.id,date:b.date,content:l.text??"",attachments:[]})}return!0}catch(m){return f!==u?!0:m instanceof mn?(ei(l.localId),!1):m instanceof vn?(r(C=>({outbox:C.outbox.map(I=>I.localId===l.localId||I.state==="queued"?{...I,state:"failed"}:I)})),V(),!1):(m instanceof bt||m instanceof ve&&(m.status===401||m.status>=500))&&v<3?($e(l.localId,{state:"queued"}),m instanceof ve&&m.status===401&&await Gt(),clearTimeout(p),p=setTimeout(()=>void ge(),2e3*v),!1):($e(l.localId,{state:"failed"}),!0)}finally{x--,z()}}function ti(l,f){const v={id:f.id,content:f.content,authorName:n().identity.name,support:!1,date:f.date,attachments:f.attachments};o.set(Xn(v),l.localId),l.fileInfo?.previewUrl&&a.set(l.localId,l.fileInfo.previewUrl);const m=Ze(v,o);r(b=>{const C=Ge(b.conversations,f.threadId),I=C[f.threadId]??Zn(f.threadId,f.date),q=b.activeThreadId,G=q===null||q===f.threadId||b.conversations[q]?.status==="open";return{conversations:{...C,[f.threadId]:Qn({...I,status:"open"},m)},outbox:b.outbox.filter(le=>le.localId!==l.localId),activeThreadId:G?f.threadId:q}})}function ni(){n().outbox.some(l=>l.state==="held")&&(r(l=>({outbox:l.outbox.map(f=>f.state==="held"?{...f,state:"queued"}:f)})),ge())}let Me=Promise.resolve();function ri(l){return Me=Me.then(l).catch(f=>console.error("[Deskcord]",f)),Me}async function oa(){let l;do l=Me,await l;while(l!==Me)}function Ue(){u++,T(),o.clear(),a.forEach(l=>URL.revokeObjectURL(l)),a.clear(),c.forEach(clearTimeout),c.clear(),w.length=0,L=!1,r(l=>({token:null,identity:sr,conversations:{},outbox:[],tray:[],typing:{},lastReadAt:0,events:{},preview:null,synced:!1,past:"idle",view:"chat",activeThreadId:null,nav:l.nav+1})),lt()}function sa(l){const{identity:f,token:v}=n();if(f.verifiedUserId){const m=v?Tr(v):null,b=!!v&&(m===null||m>Date.now()),C=l?.userId===f.verifiedUserId&&!!l?.userHash;(l===null||!b&&!C)&&Ue()}l&&ii(l)}function ii(l){return ri(()=>ca(l))}function aa(){return ri(Ue)}async function ca(l){if(typeof l?.name!="string"||!l.name.trim()||typeof l.email!="string"||!Ar(l.email)){console.error("[Deskcord] identify() needs at least a name and a valid email.");return}const f=!!(l.userId&&l.userHash),v=n().identity;v.verifiedUserId&&(!f||String(l.userId)!==v.verifiedUserId)&&Ue();const m={name:l.name.trim().slice(0,Er),email:l.email.trim(),avatarUrl:Vo(l.avatarUrl),metadata:kn(l.metadata)},b=n().identity,C=b.name!==m.name||b.email!==m.email||b.avatarUrl!==m.avatarUrl||JSON.stringify(b.metadata)!==JSON.stringify(m.metadata);r(G=>({identity:{...m,verifiedUserId:G.identity.verifiedUserId}})),ni();const I=n().token;if(f){const G=String(l.userId),le=I?Tr(I):null;if(b.verifiedUserId===G&&!C&&le!==null&&le-Date.now()>Bo)return;const fa=u,si=await i.identify({...m,userId:G,userHash:String(l.userHash)},I);if(fa!==u)return;if(si){const ha=b.verifiedUserId!==G;r(ga=>({token:si,identity:{...ga.identity,verifiedUserId:G}})),ha&&(r({past:"idle",synced:!1}),y=0,n().boot==="ready"&&Z());return}console.warn("[Deskcord] Identity verification failed: check that it's enabled (/identity-verification enable) and that userHash is HMAC-SHA256(secret, userId) computed on your server. Continuing without it."),b.verifiedUserId&&(Ue(),r({identity:{...m,verifiedUserId:null}}))}const q=n().token;if(q&&C)try{const G=await i.token(m,q);r({token:G})}catch{}}function De(){const l=n();if(!l.open||l.view!=="chat"||!l.activeThreadId||!qo())return;const f=wo(l.conversations[l.activeThreadId]);f>l.lastReadAt&&(r({lastReadAt:f}),oi())}function oi(){clearTimeout(_),_=setTimeout(()=>{const{token:l,lastReadAt:f}=n();l&&f&&i.markRead(l,f).catch(()=>{})},600)}let en,ct=null;function la(l){return{token:l.token,identity:l.identity,conversations:l.conversations,lastReadAt:l.lastReadAt,guild:l.guild,activeAt:l.activeAt,outbox:l.outbox}}function lt(){clearTimeout(en);const l=la(n());ct=l,No(t.appId,l)}function da(){const l=n(),f=ct;f&&f.token===l.token&&f.identity===l.identity&&f.conversations===l.conversations&&f.lastReadAt===l.lastReadAt&&f.guild===l.guild&&f.activeAt===l.activeAt&&f.outbox===l.outbox||(clearTimeout(en),en=setTimeout(lt,300))}function ua(l){if(l.key!==Ut(t.appId))return;const f=lr(t.appId),v=n();!f||f.token===v.token||(u++,T(),o.clear(),ct=f,r({token:f.token,identity:f.identity,conversations:f.conversations,lastReadAt:f.lastReadAt,outbox:[],synced:!1,past:"idle",activeThreadId:null,view:"chat",nav:v.nav+1}),r(m=>J(m)),f.token&&v.boot==="ready"&&Z())}async function pa(){const l=lr(t.appId);l&&(r({...l}),ct=null),r(b=>J(b)),sa(t.user),e.subscribe(da),e.subscribe(De),lt();const f=n().activeAt;f&&Date.now()-f<7*24*60*60*1e3&&r({boot:"ready"});let v=!1,m=null;try{[v,m]=await Promise.all([i.status(),i.settings().catch(()=>null)])}catch{v=!1}if(!v){te();return}r(b=>({boot:"ready",activeAt:Date.now(),guild:m?{...b.guild,...m}:b.guild})),E&&ke.open(),await oa(),n().token&&Z(),ge()}if(typeof window<"u"){window.addEventListener("storage",ua),window.addEventListener("pagehide",lt),window.addEventListener("online",()=>void ge());const l=()=>{De(),document.visibilityState==="visible"&&n().connection==="up"&&Date.now()-A>3e4&&_e()};document.addEventListener("visibilitychange",l),window.addEventListener("focus",l)}const ke={open(){if(n().boot!=="ready"){E=n().boot==="loading";return}rr(n())&&(E=!1,r({open:!0,preview:null}),De(),n().view==="home"&&ke.loadPast())},close(){r({open:!1,lightbox:null})},toggle(){n().open?ke.close():ke.open()},goHome(){L=!0,r(l=>({view:"home",nav:l.nav+1,navPrev:l.activeThreadId})),ke.loadPast()},openConversation(l){L=!0;const f=n();if(f.view==="chat"&&f.activeThreadId===l){r({preview:null}),De();return}r(v=>({view:"chat",activeThreadId:l,nav:v.nav+1,navPrev:v.activeThreadId,preview:null})),De()},newConversation(){L=!0;const l=Qe(n().conversations);r(f=>({view:"chat",activeThreadId:l?.threadId??null,nav:f.nav+1,navPrev:f.activeThreadId}))},dismissPreview(){r({preview:null})},async loadPast(l=!1){const f=n();if(!f.token||f.past==="loading"||!l&&f.past==="done"&&Date.now()-y<Fo)return;const v=u;r({past:"loading"});try{const m=await i.past(f.token);if(v!==u)return;y=Date.now(),r(b=>{const C={...b.conversations};for(const I of m)!I?.threadId||C[I.threadId]?.status==="open"||(C[I.threadId]={...Gn(I,o),status:"closed"});return{conversations:C,past:"done"}})}catch{v===u&&r({past:"error"})}},send(l){const f=n(),v=!f.identity.name||!f.identity.email,m=v?"held":"queued";f.activeThreadId&&f.conversations[f.activeThreadId]?.status==="closed"&&r({activeThreadId:null});for(const b of Wo(l.trim()))Qr({text:b,state:m});for(const b of f.tray)Qr({state:m,file:b.file,fileInfo:{name:b.file.name||"image.png",size:b.file.size,type:b.file.type,previewUrl:b.previewUrl,width:b.width,height:b.height}});r({tray:[]}),v||ge()},completeIntro(l,f){r(v=>({identity:{...v.identity,name:l.trim().slice(0,Er),email:f.trim()}})),ni()},retry(l){$e(l,{state:"queued",attempts:0}),ge()},discard(l){const f=n().outbox.find(v=>v.localId===l);f?.fileInfo?.previewUrl&&URL.revokeObjectURL(f.fileInfo.previewUrl),ei(l)},addFiles(l){let f=null;const v=[];for(const m of l){if(!_r.includes(m.type)){f=`“${m.name}” can't be sent. Send an image or a PDF.`;continue}if(m.size>Po){f=`“${m.name}” is over 10 MB.`;continue}if(n().tray.length+v.length>=kr){f=`You can attach up to ${kr} files at once.`;break}const b=m.type.startsWith("image/"),C={id:Bt("f"),file:m,previewUrl:b?URL.createObjectURL(m):null,width:4,height:3};if(v.push(C),C.previewUrl){const I=new Image;I.onload=()=>{const q=I.naturalWidth||4,G=I.naturalHeight||3;r(le=>({tray:le.tray.map(se=>se.id===C.id?{...se,width:q,height:G}:se)})),r(le=>({outbox:le.outbox.map(se=>se.fileInfo&&se.fileInfo.previewUrl===C.previewUrl?{...se,fileInfo:{...se.fileInfo,width:q,height:G}}:se)}))},I.src=C.previewUrl}}return v.length&&r(m=>({tray:[...m.tray,...v]})),f&&r({notice:{text:f,at:Date.now()}}),f},removeFromTray(l){const f=n().tray.find(v=>v.id===l);f?.previewUrl&&URL.revokeObjectURL(f.previewUrl),r(v=>({tray:v.tray.filter(m=>m.id!==l)}))},openLightbox(l,f,v){r({lightbox:{url:l,name:f,from:v}})},closeLightbox(){r({lightbox:null})},clearNotice(){r({notice:null})},setDark(l){n().dark!==l&&r({dark:l})}};return{store:e,actions:ke,boot:pa,identify:ii,logout:aa,localPreview:l=>a.get(l)??null}}const Ko="#5865F2",Xo=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;function it(t){const e=t?.trim().match(Xo);if(!e)return null;let n=e[1];n.length===3&&(n=[...n].map(i=>i+i).join(""));const r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function Sr([t,e,n]){const r=i=>(i/=255,i<=.03928?i/12.92:((i+.055)/1.055)**2.4);return .2126*r(t)+.7152*r(e)+.0722*r(n)}function xe(t,e){const[n,r]=[Sr(t),Sr(e)].sort((i,o)=>o-i);return(n+.05)/(r+.05)}const Cr=(t,e,n)=>t.map((r,i)=>Math.round(r+(e[i]-r)*n)),Ie=t=>`rgb(${t.join(",")})`,pe=[255,255,255],ot=[17,19,24],Rr=[0,0,0];function Jo(t){const e=it(t.primary)??it(Ko),n=it(t.gradient)??Cr(e,Rr,.17),r=xe(e,pe)>=2.6?pe:ot,i=Math.min(xe(e,pe),xe(n,pe)),o=Math.min(xe(e,ot),xe(n,ot)),a=it(t.headerText)??(i>=2.6||i>=o?pe:ot),c=t.dark?[43,45,49]:pe;let d=e;for(let u=0;u<24&&xe(d,c)<4.5;u++)d=Cr(d,t.dark?pe:Rr,.08);return{vars:{"--dc-accent":Ie(e),"--dc-accent-2":Ie(n),"--dc-on-accent":Ie(r),"--dc-on-grad":Ie(a),"--dc-accent-text":Ie(d),"--dc-accent-soft":`rgba(${e.join(",")},${t.dark?.24:.14})`},flat:e.join()===n.join()}}const ee={out:"cubic-bezier(.22,1,.36,1)",spring:"cubic-bezier(.34,1.45,.64,1)",in:"cubic-bezier(.4,0,1,1)"},Zo=typeof matchMedia=="function"?matchMedia("(prefers-reduced-motion: reduce)"):null;function Ft(){return!Zo?.matches}function D(t,e,n={}){return!t||typeof t.animate!="function"?null:t.animate(e,{duration:300,easing:ee.out,fill:"backwards",...n,...Ft()?{}:{duration:1,delay:0}})}function Go(t){return t?t.finished.then(()=>{},()=>{}):Promise.resolve()}function Ir(t){return t.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}const Qo=/\.(gif|jpe?g|png|webp|apng)$/i,Lr=/https?:\/\/[^\s<]+[^\s<.,:;!?"')\]]/g;function es(t){try{const{protocol:e,pathname:n}=new URL(t);return(e==="https:"||e==="http:")&&Qo.test(n)}catch{return!1}}function ts(t){const e=[],n=t.replace(Lr,r=>es(r)?(e.push(r),""):r);return{text:e.length?n.replace(/[ \t]{2,}/g," ").trim():t,images:e}}function ns(t,e,n,r){return r[t]?.imageURL??`https://cdn.discordapp.com/emojis/${n}.${e?"gif":"webp"}?size=48`}function Nr(t,e={}){let n=Ir(t);const r=[],i=o=>`${r.push(o)-1}`;return n=n.replace(/```(?:[a-z0-9+-]*\n)?([\s\S]*?)```/gi,(o,a)=>i(`<pre><code>${a.replace(/^\n+|\n+$/g,"")}</code></pre>`)),n=n.replace(/`([^`\n]+)`/g,(o,a)=>i(`<code>${a}</code>`)),n=n.replace(/&lt;(a?):(\w+):(\d+)&gt;/g,(o,a,c,d)=>i(`<img class="dc-cemoji" alt=":${c}:" title=":${c}:" src="${Ir(ns(`<${a}:${c}:${d}>`,a==="a",d,e))}">`)),n=n.replace(/\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/g,(o,a,c)=>i(`<a href="${c}" target="_blank" rel="noopener noreferrer nofollow">${a}</a>`)),n=n.replace(Lr,o=>i(`<a href="${o}" target="_blank" rel="noopener noreferrer nofollow">${o.replace(/^https?:\/\//,"")}</a>`)),n=n.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<u>$1</u>").replace(/\*(?!\s)(.+?)\*/g,"<em>$1</em>").replace(/(^|[\s(])_(?!\s)(.+?)_(?=$|[\s).,!?])/gm,"$1<em>$2</em>").replace(/~~(.+?)~~/g,"<s>$1</s>").replace(/\|\|(.+?)\|\|/g,'<span class="dc-spoiler" tabindex="0" role="button" aria-label="Spoiler, click to reveal">$1</span>').replace(/^&gt; (.*)$/gm,'<span class="dc-quote">$1</span>').replace(/^[-*] (?=\S)/gm,"• ").replace(/\n/g,"<br>"),n.replace(/\u0001(\d+)\u0001/g,(o,a)=>r[Number(a)])}const Or=Intl.Segmenter,$r=Or?new Or:null;function rs(t){const e=t.replace(/<a?:\w+:\d+>/g,"⭐").replace(/\s+/g,"");return!e||!/^(?:\p{Extended_Pictographic}|\p{Emoji_Modifier}|[\u{1F1E6}-\u{1F1FF}]|‍|️|⃣)+$/u.test(e)?!1:($r?[...$r.segment(e)].length:[...e].length)<=3}function Mr(t){return t.replace(/<a?:(\w+):\d+>/g,":$1:").replace(/```[\s\S]*?```/g,"[code]").replace(/[*_`|~]/g,"").replace(/\s+/g," ").trim()}const is={x:"M6 6l12 12M18 6 6 18",down:"m6 9 6 6 6-6",left:"m15 18-6-6 6-6",right:"m9 18 6-6-6-6",send:"M12 19V5M5.5 11.5 12 5l6.5 6.5",arrow:"M5 12h14M13 6l6 6-6 6",clip:"m20.5 11.5-8.3 8.3a5.2 5.2 0 0 1-7.4-7.4l8.6-8.6a3.5 3.5 0 0 1 4.9 4.9l-8.5 8.6a1.75 1.75 0 0 1-2.5-2.5l7.9-7.9",check:"m5 12.5 4.5 4.5L19 7.5",dl:"M12 4v11m-5-5 5 5 5-5M5 20h14",retry:"M4 12a8 8 0 0 1 14-5.3M20 4v4h-4M20 12a8 8 0 0 1-14 5.3M4 20v-4h4",plus:"M12 5v14M5 12h14",upload:"M12 16V4m-5 5 5-5 5 5M5 20h14",ext:"M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"};function M({name:t,size:e=18,class:n}){const r={width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:n};return t==="smile"?s("svg",{...r,children:[s("circle",{cx:"12",cy:"12",r:"9"}),s("path",{d:"M8.5 14.5a4.5 4.5 0 0 0 7 0"}),s("circle",{cx:"9",cy:"9.8",r:"1.1",fill:"currentColor",stroke:"none"}),s("circle",{cx:"15",cy:"9.8",r:"1.1",fill:"currentColor",stroke:"none"})]}):t==="clock"?s("svg",{...r,children:[s("circle",{cx:"12",cy:"12",r:"8.5"}),s("path",{d:"M12 7.5V12l3 2"})]}):t==="alert"?s("svg",{...r,children:[s("circle",{cx:"12",cy:"12",r:"9"}),s("path",{d:"M12 7.5v5.5"}),s("circle",{cx:"12",cy:"16.3",r:"1.2",fill:"currentColor",stroke:"none"})]}):s("svg",{...r,children:s("path",{d:is[t]})})}function os(){return s("svg",{width:"26",height:"26",viewBox:"0 0 24 24","aria-hidden":"true",children:[s("path",{fill:"currentColor",d:"M12 3.5c4.97 0 9 3.36 9 7.5s-4.03 7.5-9 7.5c-.98 0-1.92-.13-2.8-.37L5.1 20.1c-.5.25-1.06-.22-.9-.75l1.02-3.34C3.84 14.7 3 12.93 3 11c0-4.14 4.03-7.5 9-7.5Z"}),s("circle",{cx:"8.6",cy:"11",r:"1.25",fill:"var(--dc-accent)"}),s("circle",{cx:"12",cy:"11",r:"1.25",fill:"var(--dc-accent)"}),s("circle",{cx:"15.4",cy:"11",r:"1.25",fill:"var(--dc-accent)"})]})}function Ur(){return s("svg",{viewBox:"0 0 642 74","aria-label":"Deskcord",children:s("path",{fill:"currentColor",d:"M23.9 73.2C19.43 73.2 15.37 72.07 11.7 69.8 8.1 67.53 5.23 64.43 3.1 60.5 1.03 56.5 0 51.97 0 46.9c0-5.13 1.07-9.67 3.2-13.6 2.13-4 5.03-7.13 8.7-9.4 3.73-2.33 7.87-3.5 12.4-3.5 3.47 0 6.5.63 9.1 1.9 2.6 1.2 4.73 2.97 6.4 5.3V0h15v72H41.5l-1.7-6.5c-1 1.4-2.23 2.7-3.7 3.9-1.4 1.13-3.1 2.03-5.1 2.7-2 .73-4.37 1.1-7.1 1.1Zm3.9-13.1c2.47 0 4.63-.57 6.5-1.7 1.93-1.13 3.4-2.7 4.4-4.7 1.07-2 1.6-4.3 1.6-6.9s-.53-4.9-1.6-6.9c-1-2-2.47-3.57-4.4-4.7-1.87-1.13-4.03-1.7-6.5-1.7-2.4 0-4.57.57-6.5 1.7-1.87 1.13-3.33 2.7-4.4 4.7-1.07 2-1.6 4.27-1.6 6.8 0 2.6.53 4.93 1.6 7 1.07 2 2.53 3.57 4.4 4.7 1.93 1.13 4.1 1.7 6.5 1.7Zm58.81 13.1c-5.2 0-9.77-1.07-13.7-3.2-3.93-2.2-7.03-5.23-9.3-9.1-2.2-3.93-3.3-8.43-3.3-13.5 0-5.2 1.1-9.83 3.3-13.9 2.2-4.07 5.27-7.27 9.2-9.6 3.93-2.33 8.5-3.5 13.7-3.5 5.07 0 9.5 1.1 13.3 3.3 3.8 2.2 6.77 5.2 8.9 9 2.2 3.73 3.3 8.07 3.3 13 0 .67-.03 1.43-.1 2.3 0 .8-.07 1.63-.2 2.5H71.01v-8.7h25.7c-.13-2.8-1.17-5.03-3.1-6.7-1.87-1.73-4.2-2.6-7-2.6-2.13 0-4.07.5-5.8 1.5-1.73 1-3.13 2.5-4.2 4.5-1 2-1.5 4.53-1.5 7.6v3c0 2.33.43 4.4 1.3 6.2.93 1.8 2.23 3.2 3.9 4.2 1.73 1 3.77 1.5 6.1 1.5 2.2 0 4-.43 5.4-1.3 1.47-.93 2.6-2.1 3.4-3.5h15.3c-.93 3.2-2.53 6.1-4.8 8.7-2.27 2.53-5.030 4.57-8.3 6.1-3.27 1.47-6.87 2.2-10.8 2.2Zm51.43 0c-4.73 0-8.83-.73-12.3-2.2-3.4-1.53-6.1-3.6-8.1-6.2-1.93-2.6-3.03-5.53-3.3-8.8h14.9c.27 1.13.73 2.17 1.4 3.1.73.87 1.7 1.57 2.9 2.1 1.27.47 2.67.7 4.2.7 1.67 0 3-.2 4-.6 1.07-.47 1.87-1.07 2.4-1.8.53-.73.8-1.5.8-2.3 0-1.27-.4-2.23-1.2-2.9-.73-.67-1.83-1.2-3.3-1.6-1.47-.47-3.23-.9-5.3-1.3-2.4-.53-4.8-1.13-7.2-1.8-2.33-.73-4.43-1.630-6.3-2.7-1.8-1.07-3.27-2.43-4.4-4.1-1.07-1.73-1.6-3.83-1.6-6.3 0-3 .83-5.7 2.5-8.1 1.67-2.47 4.07-4.4 7.2-5.8 3.13-1.47 6.93-2.2 11.4-2.2 6.33 0 11.3 1.4 14.9 4.2 3.6 2.8 5.73 6.57 6.4 11.3h-14c-.4-1.33-1.23-2.33-2.5-3-1.27-.73-2.87-1.1-4.8-1.1-2.2 0-3.87.37-5 1.1-1.13.73-1.7 1.7-1.7 2.9 0 .8.37 1.53 1.1 2.2.8.6 1.93 1.13 3.4 1.6 1.47.47 3.27.93 5.4 1.4 4.07.87 7.57 1.8 10.5 2.8 3 1 5.33 2.47 7 4.4 1.67 1.87 2.47 4.6 2.4 8.2.07 3.27-.8 6.17-2.6 8.7-1.73 2.53-4.23 4.53-7.5 6-3.27 1.4-7.17 2.1-11.7 2.1Zm60.6-1.2-20.8-27.6 18.5-22.8h17.7l-24.9 29.2v-12L217.24 72h-18.6Zm-33.6 0V0h15v72h-15Zm74.47 1.2c-5.2 0-9.8-1.13-13.8-3.4-3.93-2.27-7.03-5.37-9.3-9.3-2.2-3.93-3.3-8.43-3.3-13.5 0-5.2 1.1-9.77 3.3-13.7 2.27-4 5.37-7.13 9.3-9.4 4-2.33 8.6-3.5 13.8-3.5 6.6 0 12.13 1.73 16.6 5.2 4.53 3.47 7.4 8.3 8.6 14.5h-15.9c-.6-2.13-1.73-3.8-3.4-5-1.67-1.2-3.67-1.8-6-1.8-2.2 0-4.13.57-5.8 1.7-1.6 1.07-2.87 2.63-3.8 4.7-.93 2-1.4 4.37-1.4 7.1 0 2.07.27 3.93.8 5.6.53 1.67 1.27 3.1 2.2 4.3 1 1.2 2.17 2.13 3.5 2.8 1.33.6 2.83.9 4.5.9 1.6 0 3-.27 4.2-.8 1.27-.53 2.33-1.3 3.2-2.3.93-1 1.6-2.23 2-3.7h15.9c-1.2 6-4.07 10.77-8.6 14.3-4.53 3.53-10.07 5.3-16.6 5.3Zm55.02 0c-4.87 0-9.23-1.13-13.1-3.4-3.87-2.27-6.93-5.37-9.2-9.3-2.27-4-3.4-8.53-3.4-13.6 0-5.2 1.13-9.77 3.4-13.7 2.27-4 5.33-7.13 9.2-9.4 3.93-2.27 8.3-3.4 13.1-3.4 4.93 0 9.33 1.13 13.2 3.4 3.87 2.27 6.93 5.4 9.2 9.4 2.27 3.93 3.4 8.47 3.4 13.6 0 5.13-1.13 9.7-3.4 13.7-2.27 3.93-5.33 7.03-9.2 9.3-3.87 2.27-8.27 3.4-13.2 3.4Zm0-13c2 0 3.77-.5 5.3-1.5 1.6-1 2.87-2.5 3.8-4.5.93-2 1.4-4.47 1.4-7.4s-.47-5.4-1.4-7.4c-.93-2-2.17-3.5-3.7-4.5-1.53-1-3.3-1.5-5.3-1.5s-3.8.5-5.4 1.5c-1.53 1-2.77 2.5-3.7 4.5-.93 2-1.4 4.47-1.4 7.4s.47 5.4 1.4 7.4c.93 2 2.17 3.5 3.7 4.5 1.6 1 3.37 1.5 5.3 1.5Zm31.32 11.8V21.6h13.3l1.4 9.2c1.33-2.13 2.9-3.97 4.7-5.5 1.8-1.53 3.87-2.73 6.2-3.6 2.4-.87 4.97-1.3 7.7-1.3v15.9h-5c-2 0-3.83.23-5.5.7-1.6.4-3 1.1-4.2 2.1-1.13 1-2.03 2.37-2.7 4.1-.6 1.67-.9 3.77-.9 6.3V72h-15Zm58 1.2c-4.47 0-8.53-1.13-12.2-3.4-3.6-2.27-6.47-5.37-8.6-9.3-2.07-4-3.1-8.53-3.1-13.6 0-5.13 1.07-9.67 3.2-13.6 2.13-4 5.03-7.13 8.7-9.4 3.73-2.33 7.87-3.5 12.4-3.5 3.47 0 6.5.63 9.1 1.9 2.6 1.2 4.73 2.97 6.4 5.3V0h15v72h-13.3l-1.7-6.5c-1 1.4-2.23 2.7-3.7 3.9-1.4 1.13-3.1 2.03-5.1 2.7-2 .73-4.37 1.1-7.1 1.1Zm3.9-13.1c2.47 0 4.63-.57 6.5-1.7 1.93-1.13 3.4-2.7 4.4-4.7 1.07-2 1.6-4.3 1.6-6.9s-.53-4.9-1.6-6.9c-1-2-2.47-3.57-4.4-4.7-1.87-1.13-4.03-1.7-6.5-1.7-2.4 0-4.57.57-6.5 1.7-1.87 1.13-3.33 2.7-4.4 4.7-1.07 2-1.6 4.27-1.6 6.8 0 2.6.53 4.93 1.6 7 1.07 2 2.53 3.57 4.4 4.7 1.93 1.13 4.1 1.7 6.5 1.7Zm41.01 12.4c-2.73 0-4.97-.8-6.7-2.4-1.67-1.67-2.5-3.67-2.5-6 0-2.4.83-4.4 2.5-6 1.73-1.67 3.97-2.5 6.7-2.5 2.67 0 4.83.83 6.5 2.5 1.67 1.6 2.5 3.6 2.5 6 0 2.33-.83 4.33-2.5 6-1.67 1.6-3.83 2.4-6.5 2.4Zm38.66.7c-5.2 0-9.8-1.13-13.8-3.4-3.93-2.27-7.03-5.37-9.3-9.3-2.2-3.93-3.3-8.43-3.3-13.5 0-5.2 1.1-9.77 3.3-13.7 2.27-4 5.37-7.13 9.3-9.4 4-2.33 8.6-3.5 13.8-3.5 6.6 0 12.13 1.73 16.6 5.2 4.53 3.47 7.4 8.3 8.6 14.5h-15.9c-.6-2.13-1.73-3.8-3.4-5-1.67-1.2-3.67-1.8-6-1.8-2.2 0-4.13.57-5.8 1.7-1.6 1.07-2.87 2.63-3.8 4.7-.93 2-1.4 4.37-1.4 7.1 0 2.070.27 3.93.8 5.6.53 1.67 1.27 3.1 2.2 4.3 1 1.2 2.17 2.13 3.5 2.8 1.33.6 2.83.9 4.5.9 1.6 0 3-.27 4.2-.8 1.27-.53 2.33-1.3 3.2-2.3.93-1 1.6-2.23 2-3.7h15.9c-1.2 6-4.07 10.77-8.6 14.3-4.53 3.53-10.07 5.3-16.6 5.3ZM498.24 72V0h15v28.8c1.6-2.53 3.77-4.57 6.5-6.1 2.73-1.53 5.93-2.3 9.6-2.3 4.27 0 7.83.9 10.7 2.7 2.87 1.8 5.03 4.43 6.5 7.9 1.47 3.4 2.2 7.53 2.2 12.4V72h-14.9V44.8c0-3.73-.8-6.63-2.4-8.7-1.53-2.07-4-3.1-7.4-3.1-2 0-3.83.5-5.5 1.5-1.67 1-2.97 2.43-3.9 4.3-.93 1.8-1.4 3.97-1.4 6.5V72h-15Zm74.19 1.2c-4.2 0-7.7-.67-10.5-2-2.73-1.33-4.77-3.13-6.1-5.4-1.27-2.33-1.9-4.9-1.9-7.7 0-3 .73-5.63 2.2-7.9 1.53-2.33 3.9-4.17 7.1-5.5 3.2-1.4 7.23-2.1 12.1-2.1h12.2c0-2.27-.3-4.13-.9-5.6-.53-1.47-1.43-2.57-2.7-3.3-1.27-.73-3-1.1-5.2-1.1-2.33 0-4.3.47-5.9 1.4-1.6.93-2.6 2.4-3 4.4h-14.4c.33-3.6 1.5-6.73 3.5-9.4 2.07-2.67 4.8-4.77 8.2-6.3 3.4-1.53 7.3-2.3 11.7-2.3 4.8 0 8.97.8 12.5 2.4 3.53 1.53 6.27 3.8 8.2 6.8 2 3 3 6.73 3 11.2V72h-12.5l-1.8-7.3c-.73 1.27-1.6 2.43-2.6 3.5-1 1-2.17 1.9-3.5 2.7-1.33.73-2.8 1.3-4.4 1.7-1.6.4-3.37.6-5.3.6Zm3.7-11.4c1.6 0 3-.27 4.2-.8 1.2-.53 2.23-1.27 3.1-2.2.87-.93 1.57-2 2.1-3.2.6-1.27 1.03-2.63 1.3-4.1v-.1h-9.7c-1.67 0-3.07.23-4.2.7-1.07.4-1.87 1-2.4 1.8-.53.8-.8 1.73-.8 2.8 0 1.13.27 2.1.8 2.9.6.73 1.37 1.3 2.3 1.7 1 .33 2.1.5 3.3.5ZM632.3 72c-3.67 0-6.9-.57-9.7-1.7-2.8-1.2-4.97-3.13-6.5-5.8-1.53-2.67-2.3-6.3-2.3-10.9V34.1h-8.6V21.6h8.6l1.6-14.2h13.4v14.2h12.9v12.5h-12.9v19.7c0 2 .43 3.43 1.3 4.3.93.8 2.5 1.2 4.7 1.2h6.9V72h-9.4Z"})})}const Dr=gn(null),X=()=>br(Dr);function W(t){return Do(X().store,t)}function ss(t){const[,e]=j(0);ce(()=>{const n=setInterval(()=>e(r=>r+1),t);return()=>clearInterval(n)},[t])}function as(t,e,n,r,i={}){const[o,a]=j(t),c=S(t);c.current=t;const d=S(null);return N(()=>{if(t){d.current?.cancel(),d.current=null,o||a(!0);return}if(!o)return;const u=D(e.current,r,{duration:160,fill:"forwards",...i.exit});d.current=u,Go(u).then(()=>{!c.current&&d.current===u&&a(!1)})},[t]),N(()=>{t&&o&&D(e.current,n,{duration:380,...i.enter})},[t,o]),o}function cs(){const t=()=>document.visibilityState==="visible"&&document.hasFocus(),[e,n]=j(t);return ce(()=>{const r=()=>n(t());return document.addEventListener("visibilitychange",r),window.addEventListener("focus",r),window.addEventListener("blur",r),()=>{document.removeEventListener("visibilitychange",r),window.removeEventListener("focus",r),window.removeEventListener("blur",r)}},[]),e}const Pr=()=>typeof matchMedia=="function"&&matchMedia("(pointer: fine)").matches,ls="(max-width: 520px), (max-height: 540px)",zr="input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea";function ds(t,e,n){const r=getComputedStyle(t);return Math.abs(n)>=Math.abs(e)?!/auto|scroll/.test(r.overflowY)||t.scrollHeight<=t.clientHeight?!1:n>0?t.scrollTop>0:t.scrollTop+t.clientHeight<t.scrollHeight-1:!/auto|scroll/.test(r.overflowX)||t.scrollWidth<=t.clientWidth?!1:e>0?t.scrollLeft>0:t.scrollLeft+t.clientWidth<t.scrollWidth-1}function us(t,e){N(()=>{const n=window.visualViewport,r=t.current,i=r?.parentElement;if(!e||!n||!r||!i||typeof matchMedia!="function")return;const o=matchMedia(ls),a=r.getRootNode(),c=()=>{const E=a.activeElement;return E?.matches(zr)&&r.contains(E)?E:null},d=()=>{const E=c(),O=E?.closest(".dc-scroll");if(!E||!O)return;const z=E.getBoundingClientRect(),V=O.getBoundingClientRect();z.bottom>V.bottom?O.scrollTop+=z.bottom-V.bottom+12:z.top<V.top&&(O.scrollTop-=V.top-z.top+12)};let u=0;const g=()=>{let E=0;if(o.matches&&c()&&(E=Math.round(window.innerHeight-n.height-n.offsetTop),E<80&&(E=0)),E===u)return;const O=E>u;u=E,r.style.setProperty("--dc-keyboard",`${E}px`),O&&d()};let p=0;const h=()=>{cancelAnimationFrame(p),p=requestAnimationFrame(g)},x=E=>{E.target===r&&E.propertyName==="padding-bottom"&&u&&d()};let w=0,k=0,_=!1;const A=E=>{w=E.touches[0].clientX,k=E.touches[0].clientY,_=!1},y=E=>{if(!o.matches||E.touches.length>1||!E.cancelable)return;const{clientX:O,clientY:z}=E.touches[0],V=O-w,te=z-k;Math.abs(V)+Math.abs(te)>6&&(_=!0),w=O,k=z;for(let F=E.target;F&&F!==i;F=F.parentElement)if(ds(F,V,te))return;E.preventDefault()},L=E=>{const O=E.target;!o.matches||_||!E.cancelable||!O.matches(zr)||c()===O&&u||(E.preventDefault(),c()===O&&O.blur(),O.focus({preventScroll:!0}))};return g(),n.addEventListener("resize",g),n.addEventListener("scroll",g),o.addEventListener("change",g),i.addEventListener("focusin",h),i.addEventListener("focusout",h),r.addEventListener("transitionend",x),i.addEventListener("touchstart",A,{passive:!0}),i.addEventListener("touchmove",y,{passive:!1}),i.addEventListener("touchend",L),()=>{cancelAnimationFrame(p),n.removeEventListener("resize",g),n.removeEventListener("scroll",g),o.removeEventListener("change",g),i.removeEventListener("focusin",h),i.removeEventListener("focusout",h),r.removeEventListener("transitionend",x),i.removeEventListener("touchstart",A),i.removeEventListener("touchmove",y),i.removeEventListener("touchend",L),r.style.removeProperty("--dc-keyboard")}},[e])}function ps(t){let e=0;for(let n=0;n<t.length;n++)e=(e*31+t.charCodeAt(n))%360;return e}const Br=t=>(t.trim()[0]??"?").toUpperCase();function fe({name:t,url:e,size:n=28,status:r}){const[i,o]=j(!1);return s("span",{class:"dc-av",style:`--s:${n}px;--h:${ps(t)}`,title:t,children:[e&&!i?s("img",{src:e,alt:"",loading:"lazy",onError:()=>o(!0)}):Br(t),r&&s("i",{class:`dot ${r}`})]})}function he({member:t,size:e,withStatus:n}){return s(fe,{name:t.displayName,url:t.displayAvatarURL,size:e,status:n?t.status:null})}function Le({size:t=36,dot:e}){const{iconURL:n,name:r}=W(a=>({iconURL:a.guild.iconURL,name:a.guild.name})),[i,o]=j(!1);return s("span",{class:"dc-guild",style:`--s:${t}px`,children:[n&&!i?s("img",{src:n,alt:"",onError:()=>o(!0)}):Br(r||"S"),e&&s("i",{class:`dot ${e}`})]})}const st={online:3,idle:2,dnd:1};function Ht(t,e=3){return[...t].sort((n,r)=>(st[r.status]??0)-(st[n.status]??0)).slice(0,e).reverse()}function jt(t){const e=[...t].sort((r,i)=>(st[i.status]??0)-(st[r.status]??0)).map(r=>r.displayName);if(e.length===1)return`${e[0]} is online`;if(e.length===2)return`${e[0]} and ${e[1]} are online`;const n=e.length-2;return`${e[0]}, ${e[1]} and ${n===1?e[2]:`${n} others`} are online`}const fs={online:"Online",idle:"Away",dnd:"Busy",invisible:"Offline",offline:"Offline"},hs="Hi there 👋",gs="We typically reply within a few minutes.",qt="No one is online right now. Leave a message and we'll get back to you here.",at=6e4,Vt=60*at,Ne=24*Vt;function we(t){return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function ms(t,e=Date.now()){if(!Number.isFinite(t))return"";const n=e-t;return n<at?"now":n<Vt?`${Math.floor(n/at)} min`:n<Ne&&new Date(t).getDate()===new Date(e).getDate()?we(t):n<7*Ne?`${Math.max(1,Math.floor(n/Ne))}d`:new Date(t).toLocaleDateString([],{day:"numeric",month:"short"})}function vs(t,e=Date.now()){const n=new Date(e);return n.setHours(0,0,0,0),t>=n.getTime()?"Today":t>=n.getTime()-Ne?"Yesterday":new Date(t).toLocaleDateString([],{weekday:"short",day:"numeric",month:"short"})}function ys(t){const e=new Date(t);return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}function Wt(t){return Number.isFinite(t)?t<1024*1024?`${Math.max(1,Math.round(t/1024))} KB`:`${(t/1024/1024).toFixed(1)} MB`:""}function Yt(t){const e=t.lastIndexOf(".");return e>0&&e<t.length-1?t.slice(e+1).toUpperCase().slice(0,4):"FILE"}const bs={MIN:at,HOUR:Vt,DAY:Ne};function Fr(){const{actions:t}=X();return s("button",{class:"dc-hbtn","aria-label":"Close chat",onClick:t.close,children:[s(M,{name:"x",size:20,class:"ic-x"}),s(M,{name:"down",size:22,class:"ic-down"})]})}function xs(){const{actions:t}=X(),{guild:e,identity:n,conversations:r,past:i,lastReadAt:o,accepting:a}=W(_=>({guild:_.guild,accepting:et(_),identity:_.identity,conversations:_.conversations,past:_.past,lastReadAt:_.lastReadAt}));ss(3e4);const c=nt(()=>nr(r),[r]),d=c.find(_=>_.status==="open"),u=c.filter(_=>_.status==="closed"&&_.messages.length),g=e.onlineCsMembers,p=Array.isArray(g)&&g.length===0,h=n.name.trim().split(/\s+/)[0],x=e.header_title||(h?`Hi ${h} 👋`:hs),w=p?e.offline_message||qt:e.header_subtitle||gs,k=d?d.messages.filter(_=>_.from==="agent"&&_.date>o).length:0;return s(H,{children:[s("header",{class:"dc-head dc-hero",children:[s("div",{class:"top",children:[s(Le,{size:36}),s(Fr,{})]}),s("h2",{children:x}),s("p",{children:w}),g&&g.length>0&&s("div",{class:"dc-team",children:[s("span",{class:"stack",children:Ht(g).map(_=>s(he,{member:_,size:30,withStatus:!0},_.displayName))}),s("span",{children:jt(g)})]}),p&&s("div",{class:"dc-team",children:"The team is away right now"})]}),s("div",{class:"dc-home-body",children:[d?s("div",{class:"dc-card",children:[s("div",{class:"dc-eyebrow",children:"Ongoing conversation"}),s("div",{class:"dc-list",children:s(jr,{conv:d,unread:k,onOpen:()=>t.openConversation(d.threadId)})})]}):a?s("button",{class:"dc-card dc-cta",onClick:t.newConversation,children:[s("span",{class:"tx",children:[s("b",{children:"Send us a message"}),s("small",{children:p?"We'll reply as soon as we're back":"We typically reply within a few minutes"})]}),s("span",{class:"go",children:s(M,{name:"arrow",size:18})})]}):s("div",{class:"dc-card dc-cta is-paused","aria-live":"polite",children:s("span",{class:"tx",children:[s("b",{children:"We're not taking new conversations right now"}),s("small",{children:"Please come back a little later"})]})}),(u.length>0||i==="loading"||i==="error")&&s("div",{class:"dc-card",children:[s("div",{class:"dc-eyebrow",children:"Previous conversations"}),s("div",{class:"dc-list",children:[u.map(_=>s(jr,{conv:_,unread:0,onOpen:()=>t.openConversation(_.threadId)},_.threadId)),i==="loading"&&u.length===0&&s(H,{children:[s(Hr,{}),s(Hr,{})]})]}),i==="error"&&s("p",{class:"dc-empty",children:["Couldn't load your previous conversations."," ",s("button",{onClick:()=>void t.loadPast(!0),children:"Try again"})]})]}),s("a",{class:"dc-powered",href:"https://deskcord.chat",target:"_blank",rel:"noopener",children:["Powered by ",s(Ur,{})]})]})]})}function Hr(){return s("div",{class:"dc-skel-row","aria-hidden":"true",children:[s("i",{}),s("span",{children:[s("i",{}),s("i",{})]})]})}function ws(t){for(let e=t.messages.length-1;e>=0;e--){const n=t.messages[e];if(n.deleted)continue;const r=n.from==="me"?"You: ":"";if(n.text)return r+Mr(n.text);if(n.attachments.length)return r+(n.attachments[0].contentType?.startsWith("image/")?"📷 Image":`📄 ${n.attachments[0].name}`)}return""}function jr({conv:t,unread:e,onOpen:n}){const r=W(a=>a.guild.name),i=t.status==="closed",o=t.csMember?.displayName??ko(t);return s("button",{class:`dc-conv${e?" is-unread":""}`,onClick:n,children:[t.csMember?s(he,{member:t.csMember,size:40,withStatus:!i}):o?s(fe,{name:o,size:40}):s(Le,{size:40}),s("span",{class:"tx",children:[s("span",{class:"l1",children:[s("b",{children:o??r??"Support"}),s("time",{children:ms(t.lastMessageDate)})]}),s("span",{class:"l2",children:[i&&s("span",{class:"dc-pill ok",children:"Resolved"}),ws(t)]})]}),e>0?s("span",{class:"count",children:e}):s("span",{class:"chev",children:s(M,{name:"right",size:16})})]})}const _s=5*bs.MIN;function ks(t,e,n,r){const i=[];let o="",a=null,c=!1,d=!1,u=!1;const g=w=>{const k=ys(w);k!==o&&(i.push({type:"day",key:`day-${k}`,date:w}),o=k,a=null)},p=(w,k)=>{const _=a,A=!!_&&_.side===w&&k-_.date<_s;if(A){const y=i[i.length-1];(y.type==="msg"||y.type==="out")&&(y.last=!1)}return a={side:w,date:k},!A},h=[...(t?.messages??[]).map(w=>({date:w.date,m:w})),...n.map(w=>({date:w.date,e:w}))].sort((w,k)=>w.date-k.date);for(const w of h){if(g(w.date),w.e){i.push({type:"event",key:w.e.key,e:w.e}),a=null;continue}const k=w.m;k.from==="agent"?(d=!0,c||(c=!0,i.push({type:"joined",key:`joined-${k.key}`,name:k.authorName,avatar:k.authorAvatarURL,date:k.date}),a=null)):u=!0;const _=p(k.from==="me"?"me":`a:${k.authorName}`,k.date);i.push({type:"msg",key:k.key,m:k,first:_,last:!0,status:!1})}let x=!1;for(const w of e){g(w.createdAt),u=!0;const k=p("me",w.createdAt);i.push({type:"out",key:w.localId,o:w,first:k,last:!0}),w.state==="held"&&(x=!0)}if(!e.length)for(let w=i.length-1;w>=0;w--){const k=i[w];if(k.type==="msg"&&k.m.from==="me"){k.status=!0;break}}return x&&i.push({type:"intro",key:"intro"}),r&&u&&!d&&t?.status!=="closed"&&i.push({type:"note",key:"offline-note",text:r}),t?.status==="closed"&&i.push({type:"resolved",key:"resolved",date:t.lastMessageDate}),i}const qr=gn({mounted:{current:!1}});function Es({items:t,member:e}){const n=S(!1);return N(()=>{n.current=!0},[]),s(qr.Provider,{value:{mounted:n},children:s("div",{class:"dc-msgs",onClick:r=>{const i=r.target.closest?.(".dc-spoiler");i&&i.classList.add("is-shown")},onKeyDown:r=>{const i=r.target;(r.key==="Enter"||r.key===" ")&&i.classList?.contains("dc-spoiler")&&(r.preventDefault(),i.classList.add("is-shown"))},children:t.map(r=>s(As,{item:r,member:e},r.key))})})}function As({item:t,member:e}){const{mounted:n}=br(qr),r=S(null);switch(N(()=>{if(!n.current)return;const i=t.type==="out"||t.type==="msg"&&t.m.from==="me",o=t.type==="msg"||t.type==="out";r.current&&(r.current.style.transformOrigin=i?"bottom right":o?"bottom left":"center"),D(r.current,[{opacity:0,transform:`translateY(10px) scale(${o?.94:.98})`},{opacity:1,transform:"none"}],{duration:420,easing:ee.spring})},[]),t.type){case"day":return s("div",{ref:r,class:"dc-day",children:vs(t.date)});case"joined":return s("div",{ref:r,class:"dc-event",children:[s(fe,{name:t.name,url:t.avatar??(e?.displayName===t.name?e.displayAvatarURL:null),size:20}),s("span",{children:[s("b",{children:t.name})," joined the conversation"]}),s("time",{children:we(t.date)})]});case"event":return s("div",{ref:r,class:"dc-event",children:[t.e.kind==="handoff"?s(H,{children:[s(fe,{name:t.e.name??"?",size:20}),s("span",{children:[s("b",{children:t.e.name})," took over the conversation"]})]}):s(H,{children:[s("span",{class:"ic",children:s(M,{name:"retry",size:12})}),s("span",{children:"Conversation reopened"})]}),s("time",{children:we(t.e.date)})]});case"resolved":return s("div",{ref:r,class:"dc-event ok",children:[s("span",{class:"ic",children:s(M,{name:"check",size:12})}),s("span",{children:"Conversation resolved"})]});case"note":return s("div",{ref:r,class:"dc-event note",children:s("span",{children:t.text})});case"intro":return s("div",{ref:r,children:s(Ns,{})});case"msg":return t.m.from==="me"?s(Ss,{ref_:r,m:t.m,first:t.first,last:t.last,status:t.status}):s(Ts,{ref_:r,m:t.m,first:t.first,last:t.last,member:e});case"out":return s(Cs,{ref_:r,o:t.o,first:t.first,last:t.last})}}function Kt({text:t,emojis:e,edited:n}){const r=S(null),i=S(!0),{text:o,images:a}=ts(t);return N(()=>{if(i.current){i.current=!1;return}D(r.current,[{filter:"brightness(1.25) saturate(1.3)"},{filter:"none"}],{duration:900})},[t]),s(H,{children:[o&&s("div",{ref:r,class:`dc-bubble${rs(o)?" is-jumbo":""}`,dangerouslySetInnerHTML:{__html:Nr(o,e)+(n?'<span class="dc-edited">(edited)</span>':"")}}),a.map(c=>s("img",{class:"dc-inline-img",src:c,alt:"",loading:"lazy"},c))]})}function Xt(t,e,n,r=""){return`dc-row dc-row--${t}${e?" is-first":""}${n?" is-last":""}${r}`}function Ts({ref_:t,m:e,first:n,last:r,member:i}){const o=i&&i.displayName===e.authorName?i:null;return s("div",{ref:t,class:Xt("agent",n,r,e.deleted?" is-deleted":""),title:we(e.date),children:[s("div",{class:"dc-row-av",children:e.authorAvatarURL||!o?s(fe,{name:e.authorName||"?",url:e.authorAvatarURL,size:28}):s(he,{member:o,size:28})}),s("div",{class:"dc-stack",children:[s("div",{class:"dc-name",children:[s("b",{children:e.authorName}),we(e.date)]}),s(Kt,{text:e.text,emojis:e.emojis,edited:e.edited}),s(Wr,{list:e.attachments,localUrl:null})]})]})}function Ss({ref_:t,m:e,first:n,last:r,status:i}){const{localPreview:o}=X();return s("div",{ref:t,class:Xt("me",n,r,i?" show-status":""),title:we(e.date),children:s("div",{class:"dc-stack",children:[s(Kt,{text:e.text,emojis:e.emojis,edited:e.edited}),s(Wr,{list:e.attachments,localUrl:o(e.key)}),s("div",{class:"dc-status",children:[s(M,{name:"check",size:12})," Sent"]})]})})}function Cs({ref_:t,o:e,first:n,last:r}){const{actions:i}=X(),o=e.state==="failed",a=e.fileInfo,c=Math.round(e.progress*100);return s("div",{ref:t,class:Xt("me",n,r,o?"":" is-pending"),children:s("div",{class:"dc-stack",children:[e.text&&s(Kt,{text:e.text,emojis:{}}),a&&(a.previewUrl?s("div",{class:`dc-img is-${o?"failed":"uploading"}`,style:`--w:${Vr(a.width,a.height)}px;aspect-ratio:${a.width}/${a.height}`,children:[s("img",{src:a.previewUrl,alt:a.name}),!o&&s(Rs,{value:e.state==="sending"?c:0}),o&&s("span",{class:"fail",children:[s(M,{name:"retry",size:20}),"Not sent"]})]}):s("div",{class:`dc-file is-${o?"failed":"uploading"}`,children:[s("span",{class:"dc-ftype",children:Yt(a.name)}),s("span",{class:"tx",children:[s("b",{children:a.name}),s("small",{children:o?"Not sent":e.state==="sending"?`Uploading · ${c}%`:Wt(a.size)})]}),!o&&s("span",{class:"bar",children:s("i",{style:`width:${e.state==="sending"?c:0}%`})})]})),o?s("div",{class:"dc-status is-failed",children:[s(M,{name:"alert",size:13})," Not sent ·"," ",s("button",{onClick:()=>i.retry(e.localId),children:"Retry"})," ·"," ",s("button",{onClick:()=>i.discard(e.localId),children:"Remove"})]}):s("div",{class:"dc-status is-pending",children:[s(M,{name:"clock",size:12})," ",e.state==="held"?"Waiting for your details":"Sending…"]})]})})}function Rs({value:t}){return s(H,{children:[s("svg",{class:"dc-ring",viewBox:"0 0 36 36","aria-hidden":"true",children:[s("circle",{class:"bg",cx:"18",cy:"18",r:"15"}),s("circle",{class:"fg",cx:"18",cy:"18",r:"15",pathLength:100,style:`stroke-dashoffset:${100-t}`})]}),s("span",{class:"pct",children:[t,"%"]})]})}const Jt=t=>t.contentType?t.contentType.startsWith("image/"):/\.(png|jpe?g|gif|webp)$/i.test(t.name);function Vr(t,e){return!t||!e?232:e>t?Math.max(120,Math.round(232*t/e)):232}function Wr({list:t,localUrl:e}){if(!t.length)return null;const n=t.filter(Jt),r=t.filter(i=>!Jt(i));return s(H,{children:[n.length>1?s("div",{class:"dc-gallery",children:n.map(i=>s(Yr,{a:i,src:i.proxyURL||i.url},i.url))}):n[0]&&s(Yr,{a:n[0],src:e??(n[0].proxyURL||n[0].url)}),r.map(i=>s(Ls,{a:i},i.url))]})}function Yr({a:t,src:e}){const{actions:n}=X(),r=t.width&&t.height?`${t.width}/${t.height}`:"4/3";return s("button",{class:"dc-img",style:`--w:${Vr(t.width,t.height)}px;aspect-ratio:${r}`,"aria-label":`Open image ${t.name}`,onClick:i=>n.openLightbox(t.url||e,t.name,i.currentTarget.getBoundingClientRect()),children:s("img",{src:e,alt:t.name,loading:"lazy"})})}async function Is(t){try{const e=await fetch(t.url);if(!e.ok)throw new Error(String(e.status));const n=URL.createObjectURL(await e.blob()),r=document.createElement("a");r.href=n,r.download=t.name,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch{window.open(t.url,"_blank","noopener,noreferrer")}}function Ls({a:t}){return s("button",{class:"dc-file",onClick:()=>void Is(t),"aria-label":`Download ${t.name}`,children:[s("span",{class:`dc-ftype${Jt(t)?" is-image":""}`,children:Yt(t.name)}),s("span",{class:"tx",children:[s("b",{children:t.name}),s("small",{children:[Wt(t.size)," · ",Yt(t.name)]})]}),s("span",{class:"dl",children:s(M,{name:"dl",size:16})})]})}function Ns(){const{actions:t}=X(),e=W(p=>p.identity),[n,r]=j(e.name),[i,o]=j(e.email),[a,c]=j({}),d=S(null),u=S(null);return N(()=>{Pr()&&setTimeout(()=>u.current?.focus({preventScroll:!0}),350)},[]),s("div",{class:"dc-intro",children:[s(Le,{size:28}),s("div",{class:"card",ref:d,children:[s("h4",{children:"Who should we reply to?"}),s("p",{children:"Your message is ready. Add your name and email so the team knows who they're talking to."}),s("form",{onSubmit:p=>{p.preventDefault();const h={name:n.trim()?void 0:"Tell us what to call you.",email:Ar(i)?void 0:"That email doesn't look right."};if(c(h),h.name||h.email){D(d.current,[{transform:"translateX(-5px)"},{transform:"translateX(5px)"},{transform:"translateX(-3px)"},{transform:"none"}],{duration:360});return}t.completeIntro(n,i)},noValidate:!0,children:[s("label",{class:`dc-in${a.name?" is-err":""}`,children:[s("span",{children:"Name"}),s("input",{ref:u,id:"dc-name",name:"name",autocomplete:"name",placeholder:"Ada Lovelace",maxLength:256,value:n,onInput:p=>r(p.currentTarget.value)}),a.name&&s("em",{children:a.name})]}),s("label",{class:`dc-in${a.email?" is-err":""}`,children:[s("span",{children:"Email"}),s("input",{id:"dc-email",name:"email",type:"email",autocomplete:"email",placeholder:"ada@example.com",value:i,onInput:p=>o(p.currentTarget.value)}),a.email&&s("em",{children:a.email})]}),s("button",{class:"dc-btn",type:"submit",children:[s(M,{name:"send",size:15})," Send message"]})]})]})]})}const Kr=[["😀","Smileys","😀 😃 😄 😁 😆 😅 😂 🤣 😊 😇 🙂 😉 😍 🥰 😘 😋 😜 🤪 🤓 😎 🥳 😏 😒 😔 😕 🙁 😣 😩 🥺 😢 😭 😤 😠 🤯 😳 😱 🤗 🤔 🤫 😐 🙄 😬 😴 😷"],["👋","People","👋 🤚 ✋ 👌 🤌 ✌️ 🤞 🤟 🤘 👈 👉 👆 👇 👍 👎 ✊ 👊 👏 🙌 🫶 🙏 💪 ✍️ 👀"],["🎮","Objects","💻 🖥️ ⌨️ 🖱️ 📱 🎮 🕹️ 🎧 📦 📎 📌 📝 📅 🔒 🔑 🛠️ ⚙️ 🧪 💡 🔋 📈 📉 🧾 💳 🗂️"],["❤️","Symbols","❤️ 🧡 💛 💚 💙 💜 🖤 🤍 💯 ✅ ❌ ⚠️ ❓ ❗ 🔥 ✨ ⭐ 🎉 🎊 🚀 💬 🆗 🆒 ⏳ 🌊"]];function Os({closed:t,paused:e,placeholder:n}){const{actions:r}=X(),{tray:i,notice:o}=W(y=>({tray:y.tray,notice:y.notice})),[a,c]=j(""),[d,u]=j(!1),g=S(null),p=S(null),h=S(null),x=S(null),w=S(t);N(()=>{const y=g.current;y&&(y.style.height="",y.style.height=`${Math.min(y.scrollHeight,128)}px`)},[a,t]),N(()=>{w.current!==t&&(D(x.current,[{opacity:0,transform:"translateY(10px)"},{opacity:1,transform:"none"}],{duration:380}),w.current=t)},[t]),ce(()=>{if(!o)return;D(h.current,[{transform:"translateX(-5px)"},{transform:"translateX(5px)"},{transform:"translateX(-3px)"},{transform:"none"}],{duration:360});const y=setTimeout(r.clearNotice,3200);return()=>clearTimeout(y)},[o,r]);const k=!!a.trim()||i.length>0,_=()=>{k&&(r.send(a),c(""),u(!1),g.current?.focus({preventScroll:!0}))},A=y=>{const L=g.current,E=L?.selectionStart??a.length,O=L?.selectionEnd??a.length,z=a.slice(0,E)+y+a.slice(O);c(z),requestAnimationFrame(()=>{L&&(L.focus({preventScroll:!0}),L.selectionStart=L.selectionEnd=E+y.length)})};return e?s("footer",{class:"dc-composer",ref:x,children:[s("div",{class:"dc-resolved","aria-live":"polite",children:s("p",{children:[t?"This conversation was resolved. ":"","We're not taking new conversations right now. Please come back a little later."]})}),s(Zt,{})]}):t?s("footer",{class:"dc-composer",ref:x,children:[s("div",{class:"dc-resolved",children:[s("p",{children:"This conversation was resolved. Need anything else?"}),s("button",{class:"dc-btn",onClick:r.newConversation,children:[s(M,{name:"plus",size:16})," Start a new conversation"]})]}),s(Zt,{})]}):s("footer",{class:"dc-composer",ref:x,children:[o&&s($s,{text:o.text},o.at),d&&s(Us,{onPick:A,onClose:()=>u(!1)}),s("div",{class:"dc-field",ref:h,children:[i.length>0&&s("div",{class:"dc-tray",children:i.map(y=>s(Ms,{id:y.id,file:y.file,previewUrl:y.previewUrl,onRemove:()=>r.removeFromTray(y.id)},y.id))}),s("div",{class:"dc-input-row",children:[s("textarea",{ref:g,id:"dc-input",rows:1,"aria-label":"Message",placeholder:n,value:a,onInput:y=>c(y.currentTarget.value),onKeyDown:y=>{y.key==="Enter"&&!y.shiftKey&&!y.isComposing&&Pr()&&(y.preventDefault(),_()),y.key==="Escape"&&d&&(y.preventDefault(),u(!1))},onPaste:y=>{const L=[...y.clipboardData?.files??[]];L.length&&(y.preventDefault(),r.addFiles(L))}}),s("button",{class:"dc-tool","aria-label":"Attach a file",onClick:()=>p.current?.click(),children:s(M,{name:"clip",size:20})}),s("button",{class:"dc-tool","data-emoji-toggle":!0,"aria-label":"Emoji","aria-expanded":d,onClick:()=>u(y=>!y),children:s(M,{name:"smile",size:20})}),s("button",{class:"dc-send","aria-label":"Send",disabled:!k,onClick:_,children:s(M,{name:"send",size:18})})]})]}),s("input",{ref:p,type:"file",multiple:!0,hidden:!0,accept:_r.join(","),onChange:y=>{const L=y.currentTarget;r.addFiles([...L.files??[]]),L.value="",g.current?.focus({preventScroll:!0})}}),s(Zt,{})]})}function Zt(){return s("a",{class:"dc-powered",href:"https://deskcord.chat",target:"_blank",rel:"noopener",children:["Powered by ",s(Ur,{})]})}function $s({text:t}){const e=S(null);return N(()=>{D(e.current,[{opacity:0,transform:"translateY(6px) scale(.96)"},{opacity:1,transform:"none"}],{duration:320,easing:ee.spring})},[]),s("div",{class:"dc-toast",role:"alert",children:s("span",{ref:e,children:[s(M,{name:"alert",size:15}),t]})})}function Ms({file:t,previewUrl:e,onRemove:n}){const r=S(null);N(()=>{D(r.current,[{opacity:0,transform:"scale(.6)"},{opacity:1,transform:"none"}],{duration:420,easing:ee.spring})},[]);const i=()=>{const c=D(r.current,[{opacity:1,transform:"none"},{opacity:0,transform:"scale(.6)"}],{duration:180,easing:ee.in,fill:"forwards"});c?c.onfinish=n:n()},o=t.name||"image.png",a=s("button",{class:"rm","aria-label":`Remove ${o}`,onClick:i,children:s(M,{name:"x",size:11})});return e?s("div",{class:"dc-chip img",ref:r,children:[s("img",{src:e,alt:o}),a]}):s("div",{class:"dc-chip file",ref:r,children:[s("span",{class:"dc-ftype",children:"PDF"}),s("span",{class:"tx",children:[s("b",{children:o}),s("small",{children:Wt(t.size)})]}),a]})}function Us({onPick:t,onClose:e}){const[n,r]=j(0),i=S(null);N(()=>{D(i.current,[{opacity:0,transform:"translateY(8px) scale(.94)"},{opacity:1,transform:"none"}],{duration:340,easing:ee.spring})},[]),ce(()=>{const c=d=>{const u=d.composedPath();u.includes(i.current)||u.some(g=>g instanceof Element&&g.hasAttribute("data-emoji-toggle"))||e()};return document.addEventListener("pointerdown",c,!0),()=>document.removeEventListener("pointerdown",c,!0)},[e]);const[,o,a]=Kr[n];return s("div",{class:"dc-emoji",ref:i,role:"dialog","aria-label":"Emoji",onKeyDown:c=>{c.key==="Escape"&&(c.preventDefault(),e())},children:[s("div",{class:"grid",children:[s("div",{class:"cat",children:o}),a.split(" ").map(c=>s("button",{"aria-label":c,onClick:()=>t(c),children:c},c))]}),s("div",{class:"tabs",children:Kr.map(([c,d],u)=>s("button",{"aria-label":d,"aria-pressed":u===n,onClick:()=>r(u),children:c},d))})]})}const Ds=[],Ps=[];function zs({frozenThreadId:t}){const{actions:e}=X(),n=W(T=>T.activeThreadId),r=t!==void 0?t:n,i=W(T=>{const ne=r?T.conversations[r]??null:null,_e=!ne||ne.status==="open";return{conv:ne,outbox:_e?T.outbox:Ds,events:r&&T.events[r]||Ps,typing:!!(r&&T.typing[r]),guild:T.guild,identity:T.identity,open:T.open,accepting:et(T),canGoBack:!!T.token||Object.keys(T.conversations).some(Oe=>Oe!==r)}}),{conv:o,outbox:a,events:c,typing:d,guild:u,identity:g,accepting:p}=i,h=u.onlineCsMembers,x=Array.isArray(h)&&h.length===0,w=x?u.offline_message||qt:null,k=nt(()=>ks(o,a,c,w),[o,a,c,w]),_=k.length===0,A=o?.status==="closed",y=o?.csMember??null,L=S(null),E=S(!0),[O,z]=j(!1),V=k[k.length-1],te=V?.key,F=(()=>{const T=V;return!!T&&(T.type==="out"||T.type==="intro"||T.type==="msg"&&T.m.from==="me")})(),J=T=>{const ne=L.current;ne&&ne.scrollTo({top:ne.scrollHeight,behavior:T&&Ft()?"smooth":"auto"})},Y=S(!1);N(()=>{if(!Y.current){Y.current=!0,J(!1);return}E.current||F?J(!0):z(!0)},[te,k.length]),N(()=>{d&&E.current&&J(!0)},[d]),N(()=>{i.open&&J(!1)},[i.open]),ce(()=>{const T=L.current;if(!T||typeof ResizeObserver!="function")return;const ne=new ResizeObserver(()=>{E.current&&J(!1)});return ne.observe(T),()=>ne.disconnect()},[]);const Z=g.name.trim().split(/\s+/)[0];return s(H,{children:[s("header",{class:"dc-head dc-head--compact",children:[i.canGoBack&&s("button",{class:"dc-hbtn","aria-label":"All conversations",onClick:e.goHome,children:s(M,{name:"left",size:22})}),s(Bs,{memberKey:y?`${y.displayName}:${y.status}`:`g:${h?.length??"?"}`,children:y?s(H,{children:[s(he,{member:y,size:38,withStatus:!0}),s("div",{class:"tx",children:[s("div",{class:"t",children:y.displayName}),s("div",{class:"s",children:s("span",{children:[u.name?`${u.name} · `:"",fs[y.status]]})})]})]}):s(H,{children:[s(Le,{size:38,dot:h?h.length?"online":"offline":null}),s("div",{class:"tx",children:[s("div",{class:"t",children:u.name||"Support"}),s("div",{class:"s",children:h&&h.length>0?s(H,{children:[s("span",{class:"mini",children:Ht(h).map(T=>s(he,{member:T,size:16},T.displayName))}),s("span",{children:jt(h)})]}):s("span",{children:x?"Away · we'll reply as soon as we can":"We typically reply within a few minutes"})})]})]})}),s(Fr,{})]}),s(Hs,{}),s("div",{class:"dc-scroll-wrap",children:[s("div",{class:"dc-scroll",ref:L,role:"log","aria-live":"polite",onScroll:()=>{const T=L.current;T&&(E.current=T.scrollHeight-T.scrollTop-T.clientHeight<90,E.current&&O&&z(!1))},children:[_&&s("div",{class:"dc-welcome",children:[s("div",{class:"stack",children:h&&h.length>0?Ht(h).map(T=>s(he,{member:T,size:44,withStatus:!0},T.displayName)):s(Le,{size:48})}),s("h3",{children:Z&&g.verifiedUserId?`Hi ${Z}, how can we help?`:"How can we help?"}),s("p",{children:x?u.offline_message||qt:h&&h.length?`${jt(h)}. We typically reply within a few minutes.`:"We typically reply within a few minutes."})]}),s(Es,{items:k,member:y}),d&&!A&&s(Fs,{name:y?.displayName??"Support",avatar:y?.displayAvatarURL})]}),O&&s("button",{class:"dc-jump",onClick:()=>{J(!0),z(!1)},children:[s(M,{name:"down",size:16})," New message"]})]}),s(Os,{closed:A,paused:!p&&o?.status!=="open",placeholder:x?"Leave a message…":`Message ${u.name||"us"}…`})]})}function Bs({memberKey:t,children:e}){const n=S(null),r=S(!0);return N(()=>{if(r.current){r.current=!1;return}D(n.current,[{opacity:0,transform:"translateY(6px)"},{opacity:1,transform:"none"}],{duration:340})},[t]),s("div",{class:"dc-head-id",ref:n,children:e})}function Fs({name:t,avatar:e}){const n=S(null);return N(()=>{n.current&&(n.current.style.transformOrigin="bottom left"),D(n.current,[{opacity:0,transform:"translateY(8px) scale(.9)"},{opacity:1,transform:"none"}],{duration:380,easing:ee.spring})},[]),s("div",{class:"dc-typing",ref:n,role:"status","aria-label":`${t} is typing`,children:[s(fe,{name:t,url:e,size:28}),s("div",{class:"dots",children:[s("i",{}),s("i",{}),s("i",{})]})]})}function Hs(){const t=W(a=>a.connection),[e,n]=j("none"),r=S(t),i=S(null);ce(()=>{let a;return t==="down"?n("down"):t==="up"&&r.current==="down"?(n("back"),a=setTimeout(()=>n("none"),2200)):t==="off"&&n("none"),r.current=t,()=>clearTimeout(a)},[t]);const o=e!=="none";return N(()=>{o&&D(i.current,[{opacity:0,transform:"translateY(-100%)"},{opacity:1,transform:"none"}],{duration:300})},[o]),e==="none"?null:s("div",{ref:i,class:`dc-conn ${e==="down"?"is-down":"is-up"}`,role:"status",children:e==="down"?s(H,{children:[s("span",{class:"dc-spin"})," Connection lost. Reconnecting…"]}):s(H,{children:[s(M,{name:"check",size:14})," Back online"]})})}function js(){const{actions:t}=X(),e=W(c=>c.lightbox),n=S(null),r=S(null),i=S(!1),o=c=>{const d=e?.from,u=r.current;if(!d||!u||!Ft())return null;const g=u.getBoundingClientRect();if(!g.width)return null;const h=[{transform:`translate(${d.left-g.left}px, ${d.top-g.top}px) scale(${d.width/g.width}, ${d.height/g.height})`,borderRadius:"28px"},{transform:"none",borderRadius:"10px"}];return u.animate(c?h.reverse():h,{duration:c?320:460,easing:ee.out,fill:c?"forwards":"backwards"})},a=()=>{if(i.current)return;i.current=!0;const c=o(!0);n.current?.querySelectorAll(".bd, .bar").forEach(d=>d.animate([{opacity:1},{opacity:0}],{duration:240,fill:"forwards"})),c?c.onfinish=()=>t.closeLightbox():t.closeLightbox()};return N(()=>{if(!e)return;i.current=!1,D(n.current?.querySelector(".bd"),[{opacity:0},{opacity:1}],{duration:300}),D(n.current?.querySelector(".bar"),[{opacity:0,transform:"translateY(-8px)"},{opacity:1,transform:"none"}],{duration:300,delay:120});const c=r.current;c?.complete?o(!1):c&&(c.onload=()=>o(!1))},[e]),ce(()=>{if(!e)return;const c=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),a())};return document.addEventListener("keydown",c,!0),()=>document.removeEventListener("keydown",c,!0)},[e]),e?s("div",{class:"dc-lightbox",ref:n,role:"dialog","aria-label":e.name,children:[s("div",{class:"bd",onClick:a}),s("div",{class:"bar",children:[s("span",{children:e.name}),s("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:[s(M,{name:"ext",size:15})," Open original"]}),s("button",{class:"x","aria-label":"Close",onClick:a,children:s(M,{name:"x",size:18})})]}),s("div",{class:"pic",onClick:a,children:s("img",{ref:r,src:e.url,alt:e.name})})]}):null}function qs(){const{boot:t,dark:e,guild:n,available:r}=W(a=>({boot:a.boot,dark:a.dark,guild:a.guild,available:rr(a)})),i=nt(()=>Jo({primary:n.primary_color,gradient:n.gradient_color,headerText:n.header_text_color,dark:e}),[n.primary_color,n.gradient_color,n.header_text_color,e]),o=Object.entries(i.vars).map(([a,c])=>`${a}:${c}`).join(";");return Vs(),t!=="ready"||!r?null:s("div",{class:"dc","data-theme":e?"dark":"light","data-pos":n.widget_position==="bottom-left"?"left":"right","data-flat":i.flat?"":void 0,style:o,children:[s(Ys,{}),s(Ks,{}),s(Ws,{}),s(js,{})]})}function Vs(){const{open:t,unread:e}=W(i=>({open:i.open,unread:ir(i.conversations,i.lastReadAt)})),n=cs(),r=e>0&&(!t||!n);ce(()=>{if(!r)return;const i=`(${e}) New message${e>1?"s":""}`;let o=document.title,a=!1;const c=()=>{!a&&document.title!==i&&(o=document.title),a=!a,document.title=a?i:o};c();const d=setInterval(c,2500);return()=>{clearInterval(d),document.title===i&&(document.title=o)}},[r,e])}function Ws(){const{actions:t}=X(),{open:e,unread:n}=W(c=>({open:c.open,unread:ir(c.conversations,c.lastReadAt)})),r=S(null),i=S(null),o=S(n);N(()=>{D(r.current,[{opacity:0,transform:"scale(.4)"},{opacity:1,transform:"none"}],{duration:520,delay:120,easing:ee.spring})},[]),N(()=>{n>o.current&&D(i.current,[{transform:"scale(0)"},{transform:"scale(1.25)",offset:.6},{transform:"scale(1)"}],{duration:420}),o.current=n},[n]);const a=n>0&&!e;return s("button",{ref:r,class:`dc-launcher${e?" is-open":""}${a?" has-unread":""}`,"aria-label":e?"Close chat":a?`Open chat, ${n} unread`:"Open chat","aria-expanded":e,onClick:t.toggle,children:[s("span",{class:"ic ic-chat",children:s(os,{})}),s("span",{class:"ic ic-close",children:s(M,{name:"down",size:24})}),a&&s("span",{class:"dc-badge",ref:i,"aria-hidden":"true",children:n>99?"99+":n})]})}function Ys(){const{actions:t}=X(),e=W(p=>{if(!p.preview||p.open)return null;const h=p.conversations[p.preview.threadId],x=h?.messages.find(w=>w.key===p.preview.key&&!w.deleted);return x?{threadId:h.threadId,message:x,member:h.csMember}:null}),n=S(null),r=S(e);e&&(r.current=e);const i=as(!!e,n,[{opacity:0,transform:"translateY(12px) scale(.94)"},{opacity:1,transform:"none"}],[{opacity:1},{opacity:0,transform:"translateY(6px) scale(.97)"}],{enter:{duration:460,easing:ee.spring}}),o=e??r.current;if(!i||!o)return null;const{message:a,member:c,threadId:d}=o,u=c?.displayName??a.authorName,g=a.text?Nr(Mr(a.text),a.emojis):a.attachments.some(p=>!p.contentType?.startsWith("image/"))?"📄 Sent a file":"📷 Sent an image";return s("div",{ref:n,class:"dc-preview",role:"button",tabIndex:0,"aria-label":`New message from ${u}`,onClick:()=>{t.openConversation(d),t.open()},onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.click()},children:[c?s(he,{member:c,size:34,withStatus:!0}):s(fe,{name:u,size:34}),s("div",{style:"min-width:0",children:[s("div",{class:"who",children:s("b",{children:u})}),s("div",{class:"txt",dangerouslySetInnerHTML:{__html:g}})]}),s("button",{class:"x","aria-label":"Dismiss",onClick:p=>{p.stopPropagation(),t.dismissPreview()},children:s(M,{name:"x",size:12})})]})}function Ks(){const{actions:t}=X(),{open:e,view:n}=W(h=>({open:h.open,view:h.view})),r=S(null),[i,o]=j(e),[a,c]=j(e),[d,u]=j(!1),g=S(0);if(us(r,a),N(()=>{if(e){o(!0),c(!0);return}if(!a)return;const h=r.current?.getRootNode()?.activeElement;h&&r.current?.contains(h)&&h.blur();const x=r.current?.animate([{opacity:1,transform:"none"},{opacity:0,transform:"translateY(10px) scale(.96)"}],{duration:170,easing:ee.in});if(!x){c(!1);return}return x.onfinish=()=>c(!1),()=>x.cancel()},[e]),N(()=>{if(!e||!a)return;const h=r.current;D(h,[{opacity:0},{opacity:1}],{duration:180}),D(h,[{transform:"translateY(18px) scale(.92)"},{transform:"none"}],{duration:520,easing:ee.spring,composite:"add"}),h?.querySelectorAll(".dc-hero > *, .dc-home-body > *, .dc-welcome > *, .dc-head-id, .dc-composer").forEach((x,w)=>D(x,[{opacity:0,transform:"translateY(8px)"},{opacity:1,transform:"none"}],{duration:420,delay:60+w*35}))},[e,a]),!i)return null;const p=h=>n==="chat"&&!!h.dataTransfer?.types.includes("Files");return s("section",{ref:r,class:"dc-panel",role:"dialog","aria-label":"Chat",hidden:!a,onKeyDown:h=>{h.key==="Escape"&&!h.defaultPrevented&&t.close()},onDragEnter:h=>{p(h)&&(h.preventDefault(),g.current++===0&&u(!0))},onDragOver:h=>{d&&h.preventDefault()},onDragLeave:()=>{g.current>0&&--g.current===0&&u(!1)},onDrop:h=>{d&&(h.preventDefault(),g.current=0,u(!1),t.addFiles([...h.dataTransfer?.files??[]]))},children:[s(Js,{}),d&&s(Xs,{})]})}function Xs(){const t=S(null);return N(()=>{D(t.current,[{opacity:0,transform:"scale(.98)"},{opacity:1,transform:"none"}],{duration:200})},[]),s("div",{class:"dc-drop",ref:t,children:[s("div",{class:"ic",children:s(M,{name:"upload",size:26})}),s("b",{children:"Drop to attach"}),s("small",{children:"Images or PDFs, up to 10 MB each"})]})}function Js(){const{store:t}=X(),{view:e,nav:n}=W(a=>({view:a.view,nav:a.nav})),r=`${e}:${n}`,[i,o]=j(()=>[{key:r,view:e,threadId:t.get().activeThreadId}]);return N(()=>{o(a=>a[a.length-1].key===r?a:[{...a[a.length-1],threadId:t.get().navPrev},{key:r,view:e,threadId:null}])},[r]),s("div",{class:"dc-views",children:i.map((a,c)=>s(Zs,{leaving:c<i.length-1,animateIn:i.length>1,back:e==="home",onGone:()=>o(d=>d.filter(u=>u.key!==a.key)),children:a.view==="home"?s(xs,{}):s(zs,{frozenThreadId:c<i.length-1?a.threadId:void 0})},a.key))})}function Zs({leaving:t,animateIn:e,back:n,onGone:r,children:i}){const o=S(null),a=n?-28:28;return N(()=>{e&&D(o.current,[{transform:`translateX(${a}%)`,opacity:0},{transform:"none",opacity:1}],{duration:340})},[]),N(()=>{if(!t)return;const c=D(o.current,[{transform:"none",opacity:1},{transform:`translateX(${-a}%)`,opacity:0}],{duration:300,fill:"forwards"}),d=setTimeout(r,340);return c&&(c.onfinish=r),()=>clearTimeout(d)},[t]),s("div",{ref:o,class:"dc-view",inert:t,style:t?"pointer-events:none":void 0,children:i})}function Xr(){if(document.getElementById("deskcord-root"))return;const t=vi();if(!t)return;const e=Yo(t),n=window.deskcord;n.openChatbox=()=>e.actions.open(),n.closeChatbox=()=>e.actions.close(),n.identify=e.identify,n.logout=()=>{e.logout()};let r=t.theme;const i=matchMedia("(prefers-color-scheme: dark)"),o=()=>e.actions.setDark(r==="dark"||r==="auto"&&i.matches);n.setTheme=g=>{if(g!=="light"&&g!=="dark"&&g!=="auto"){console.error(`[Deskcord] setTheme: unknown theme "${String(g)}" (use "light", "dark" or "auto").`);return}r=g,o()},o(),i.addEventListener("change",o);const a=document.createElement("div");a.id="deskcord-root",a.style.cssText="position:fixed;top:0;left:0;width:0;height:0;z-index:2147483000;",document.body.appendChild(a);const c=a.attachShadow({mode:"open"}),d=document.createElement("style");d.textContent=gi,c.appendChild(d);const u=document.createElement("div");c.appendChild(u),fi(s(Dr.Provider,{value:e,children:s(qs,{})}),u),e.boot()}document.body?Xr():document.addEventListener("DOMContentLoaded",Xr,{once:!0})})();
1
+ (function(){"use strict";var $e,M,cn,pe,ln,dn,ft,un,mt,gt,_t,pn,Ce={},hn=[],yo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,vt=Array.isArray;function le(t,e){for(var n in e)t[n]=e[n];return t}function yt(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function bo(t,e,n){var r,o,i,a={};for(i in e)i=="key"?r=e[i]:i=="ref"?o=e[i]:a[i]=e[i];if(arguments.length>2&&(a.children=arguments.length>3?$e.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)a[i]===void 0&&(a[i]=t.defaultProps[i]);return qe(t,a,r,o,null)}function qe(t,e,n,r,o){var i={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++cn,__i:-1,__u:0};return o==null&&M.vnode!=null&&M.vnode(i),i}function F(t){return t.children}function Fe(t,e){this.props=t,this.context=e}function ve(t,e){if(e==null)return t.__?ve(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?ve(t):null}function fn(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return fn(t)}}function bt(t){(!t.__d&&(t.__d=!0)&&pe.push(t)&&!He.__r++||ln!==M.debounceRendering)&&((ln=M.debounceRendering)||dn)(He)}function He(){var t,e,n,r,o,i,a,c;for(pe.sort(ft);t=pe.shift();)t.__d&&(e=pe.length,r=void 0,i=(o=(n=t).__v).__e,a=[],c=[],n.__P&&((r=le({},o)).__v=o.__v+1,M.vnode&&M.vnode(r),wt(n.__P,r,o,n.__n,n.__P.namespaceURI,32&o.__u?[i]:null,a,i??ve(o),!!(32&o.__u),c),r.__v=o.__v,r.__.__k[r.__i]=r,yn(a,r,c),r.__e!=i&&fn(r)),pe.length>e&&pe.sort(ft));He.__r=0}function mn(t,e,n,r,o,i,a,c,d,u,m){var p,f,w,x,E,k,z=r&&r.__k||hn,y=e.length;for(d=wo(n,e,z,d,y),p=0;p<y;p++)(w=n.__k[p])!=null&&(f=w.__i===-1?Ce:z[w.__i]||Ce,w.__i=p,k=wt(t,w,f,o,i,a,c,d,u,m),x=w.__e,w.ref&&f.ref!=w.ref&&(f.ref&&xt(f.ref,null,w),m.push(w.ref,w.__c||x,w)),E==null&&x!=null&&(E=x),4&w.__u||f.__k===w.__k?d=gn(w,d,t):typeof w.type=="function"&&k!==void 0?d=k:x&&(d=x.nextSibling),w.__u&=-7);return n.__e=E,d}function wo(t,e,n,r,o){var i,a,c,d,u,m=n.length,p=m,f=0;for(t.__k=new Array(o),i=0;i<o;i++)(a=e[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(d=i+f,(a=t.__k[i]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?qe(null,a,null,null,null):vt(a)?qe(F,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?qe(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=t,a.__b=t.__b+1,c=null,(u=a.__i=xo(a,n,d,p))!==-1&&(p--,(c=n[u])&&(c.__u|=2)),c==null||c.__v===null?(u==-1&&f--,typeof a.type!="function"&&(a.__u|=4)):u!=d&&(u==d-1?f--:u==d+1?f++:(u>d?f--:f++,a.__u|=4))):t.__k[i]=null;if(p)for(i=0;i<m;i++)(c=n[i])!=null&&!(2&c.__u)&&(c.__e==r&&(r=ve(c)),bn(c,c));return r}function gn(t,e,n){var r,o;if(typeof t.type=="function"){for(r=t.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=t,e=gn(r[o],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=ve(t)),n.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function xo(t,e,n,r){var o,i,a=t.key,c=t.type,d=e[n];if(d===null||d&&a==d.key&&c===d.type&&!(2&d.__u))return n;if(r>(d!=null&&!(2&d.__u)?1:0))for(o=n-1,i=n+1;o>=0||i<e.length;){if(o>=0){if((d=e[o])&&!(2&d.__u)&&a==d.key&&c===d.type)return o;o--}if(i<e.length){if((d=e[i])&&!(2&d.__u)&&a==d.key&&c===d.type)return i;i++}}return-1}function _n(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||yo.test(e)?n:n+"px"}function Ve(t,e,n,r,o){var i;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||_n(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||_n(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(un,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=n,n?r?n.u=r.u:(n.u=mt,t.addEventListener(e,i?_t:gt,i)):t.removeEventListener(e,i?_t:gt,i);else{if(o=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function vn(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=mt++;else if(e.t<n.u)return;return n(M.event?M.event(e):e)}}}function wt(t,e,n,r,o,i,a,c,d,u){var m,p,f,w,x,E,k,z,y,R,A,O,U,Y,ne,q,G,K=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(d=!!(32&n.__u),i=[c=e.__e=n.__e]),(m=M.__b)&&m(e);e:if(typeof K=="function")try{if(z=e.props,y="prototype"in K&&K.prototype.render,R=(m=K.contextType)&&r[m.__c],A=m?R?R.props.value:m.__:r,n.__c?k=(p=e.__c=n.__c).__=p.__E:(y?e.__c=p=new K(z,A):(e.__c=p=new Fe(z,A),p.constructor=K,p.render=Eo),R&&R.sub(p),p.props=z,p.state||(p.state={}),p.context=A,p.__n=r,f=p.__d=!0,p.__h=[],p._sb=[]),y&&p.__s==null&&(p.__s=p.state),y&&K.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=le({},p.__s)),le(p.__s,K.getDerivedStateFromProps(z,p.__s))),w=p.props,x=p.state,p.__v=e,f)y&&K.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),y&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(y&&K.getDerivedStateFromProps==null&&z!==w&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(z,A),!p.__e&&(p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(z,p.__s,A)===!1||e.__v==n.__v)){for(e.__v!=n.__v&&(p.props=z,p.state=p.__s,p.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(Z){Z&&(Z.__=e)}),O=0;O<p._sb.length;O++)p.__h.push(p._sb[O]);p._sb=[],p.__h.length&&a.push(p);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(z,p.__s,A),y&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(w,x,E)})}if(p.context=A,p.props=z,p.__P=t,p.__e=!1,U=M.__r,Y=0,y){for(p.state=p.__s,p.__d=!1,U&&U(e),m=p.render(p.props,p.state,p.context),ne=0;ne<p._sb.length;ne++)p.__h.push(p._sb[ne]);p._sb=[]}else do p.__d=!1,U&&U(e),m=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++Y<25);p.state=p.__s,p.getChildContext!=null&&(r=le(le({},r),p.getChildContext())),y&&!f&&p.getSnapshotBeforeUpdate!=null&&(E=p.getSnapshotBeforeUpdate(w,x)),c=mn(t,vt(q=m!=null&&m.type===F&&m.key==null?m.props.children:m)?q:[q],e,n,r,o,i,a,c,d,u),p.base=e.__e,e.__u&=-161,p.__h.length&&a.push(p),k&&(p.__E=p.__=null)}catch(Z){if(e.__v=null,d||i!=null)if(Z.then){for(e.__u|=d?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;i[i.indexOf(c)]=null,e.__e=c}else for(G=i.length;G--;)yt(i[G]);else e.__e=n.__e,e.__k=n.__k;M.__e(Z,e,n)}else i==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):c=e.__e=ko(n.__e,e,n,r,o,i,a,d,u);return(m=M.diffed)&&m(e),128&e.__u?void 0:c}function yn(t,e,n){for(var r=0;r<n.length;r++)xt(n[r],n[++r],n[++r]);M.__c&&M.__c(e,t),t.some(function(o){try{t=o.__h,o.__h=[],t.some(function(i){i.call(o)})}catch(i){M.__e(i,o.__v)}})}function ko(t,e,n,r,o,i,a,c,d){var u,m,p,f,w,x,E,k=n.props,z=e.props,y=e.type;if(y=="svg"?o="http://www.w3.org/2000/svg":y=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(u=0;u<i.length;u++)if((w=i[u])&&"setAttribute"in w==!!y&&(y?w.localName==y:w.nodeType==3)){t=w,i[u]=null;break}}if(t==null){if(y==null)return document.createTextNode(z);t=document.createElementNS(o,y,z.is&&z),c&&(M.__m&&M.__m(e,i),c=!1),i=null}if(y===null)k===z||c&&t.data===z||(t.data=z);else{if(i=i&&$e.call(t.childNodes),k=n.props||Ce,!c&&i!=null)for(k={},u=0;u<t.attributes.length;u++)k[(w=t.attributes[u]).name]=w.value;for(u in k)if(w=k[u],u!="children"){if(u=="dangerouslySetInnerHTML")p=w;else if(!(u in z)){if(u=="value"&&"defaultValue"in z||u=="checked"&&"defaultChecked"in z)continue;Ve(t,u,null,w,o)}}for(u in z)w=z[u],u=="children"?f=w:u=="dangerouslySetInnerHTML"?m=w:u=="value"?x=w:u=="checked"?E=w:c&&typeof w!="function"||k[u]===w||Ve(t,u,w,k[u],o);if(m)c||p&&(m.__html===p.__html||m.__html===t.innerHTML)||(t.innerHTML=m.__html),e.__k=[];else if(p&&(t.innerHTML=""),mn(t,vt(f)?f:[f],e,n,r,y=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,a,i?i[0]:n.__k&&ve(n,0),c,d),i!=null)for(u=i.length;u--;)yt(i[u]);c||(u="value",y=="progress"&&x==null?t.removeAttribute("value"):x!==void 0&&(x!==t[u]||y=="progress"&&!x||y=="option"&&x!==k[u])&&Ve(t,u,x,k[u],o),u="checked",E!==void 0&&E!==t[u]&&Ve(t,u,E,k[u],o))}return t}function xt(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(o){M.__e(o,n)}}function bn(t,e,n){var r,o;if(M.unmount&&M.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||xt(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){M.__e(i,e)}r.base=r.__P=null}if(r=t.__k)for(o=0;o<r.length;o++)r[o]&&bn(r[o],e,n||typeof t.type!="function");n||yt(t.__e),t.__c=t.__=t.__e=void 0}function Eo(t,e,n){return this.constructor(t,n)}function Ao(t,e,n){var r,o,i,a;e==document&&(e=document.documentElement),M.__&&M.__(t,e),o=(r=typeof n=="function")?null:e.__k,i=[],a=[],wt(e,t=(!r&&n||e).__k=bo(F,null,[t]),o||Ce,Ce,e.namespaceURI,!r&&n?[n]:o?null:e.firstChild?$e.call(e.childNodes):null,i,!r&&n?n:o?o.__e:e.firstChild,r,a),yn(i,t,a)}function wn(t,e){var n={__c:e="__cC"+pn++,__:t,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,i;return this.getChildContext||(o=new Set,(i={})[e]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&o.forEach(function(c){c.__e=!0,bt(c)})},this.sub=function(a){o.add(a);var c=a.componentWillUnmount;a.componentWillUnmount=function(){o&&o.delete(a),c&&c.call(a)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}$e=hn.slice,M={__e:function(t,e,n,r){for(var o,i,a;e=e.__;)if((o=e.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(t)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(t,r||{}),a=o.__d),a)return o.__E=o}catch(c){t=c}throw t}},cn=0,Fe.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=le({},this.state),typeof t=="function"&&(t=t(le({},n),this.props)),t&&le(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),bt(this))},Fe.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),bt(this))},Fe.prototype.render=F,pe=[],dn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ft=function(t,e){return t.__v.__b-e.__v.__b},He.__r=0,un=/(PointerCapture)$|Capture$/i,mt=0,gt=vn(!1),_t=vn(!0),pn=0;var zo=0;function s(t,e,n,r,o,i){e||(e={});var a,c,d=e;if("ref"in d)for(c in d={},e)c=="ref"?a=e[c]:d[c]=e[c];var u={type:t,props:d,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--zo,__i:-1,__u:0,__source:o,__self:i};if(typeof t=="function"&&(a=t.defaultProps))for(c in a)d[c]===void 0&&(d[c]=a[c]);return M.vnode&&M.vnode(u),u}const Co=':host{all:initial}.dc{--dc-accent: #5865f2;--dc-accent-2: #4a55cc;--dc-on-accent: #fff;--dc-on-grad: #fff;--dc-accent-soft: rgba(88,101,242,.14);--dc-accent-text: #4a55cc;--w-bg: #ffffff;--w-raised: #ffffff;--w-sunken: #f2f3f7;--w-bubble: #f0f1f5;--w-line: rgba(18,22,33,.08);--w-line-strong: rgba(18,22,33,.15);--w-fg: #14171f;--w-fg-2: #3b404c;--w-muted: #6a7080;--w-faint: #9499a5;--w-online: #23a55a;--w-idle: #f0b232;--w-dnd: #f23f43;--w-offline: #80848e;--w-danger: #e5484d;--w-success: #1f9d55;--w-warn: #c98a0c;--w-badge: #f23f43;--w-shadow: 0 1px 2px rgba(16,20,30,.06), 0 10px 28px -8px rgba(16,20,30,.18), 0 30px 70px -18px rgba(16,20,30,.28);--w-card-shadow: 0 1px 2px rgba(16,20,30,.05), 0 6px 18px -10px rgba(16,20,30,.2);--ease-out: cubic-bezier(.22,1,.36,1);--ease-spring: cubic-bezier(.34,1.45,.64,1);--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--edge: 20px;position:fixed;inset:0;z-index:2147483000;pointer-events:none;font-family:var(--font);color:var(--w-fg);font-size:14px;line-height:1.4;text-align:left;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color-scheme:light}.dc[data-theme=dark]{--w-bg: #232428;--w-raised: #2b2d31;--w-sunken: #1c1d21;--w-bubble: #34363c;--w-line: rgba(255,255,255,.07);--w-line-strong: rgba(255,255,255,.13);--w-fg: #f2f3f5;--w-fg-2: #d5d7dc;--w-muted: #a4a8b2;--w-faint: #7d828d;--w-shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 34px -8px rgba(0,0,0,.55), 0 30px 80px -18px rgba(0,0,0,.6);--w-card-shadow: 0 1px 2px rgba(0,0,0,.25);color-scheme:dark}.dc *,.dc *:before,.dc *:after{box-sizing:border-box}:where(.dc) button{font:inherit;color:inherit;margin:0}:where(.dc) :is(p,h1,h2,h3,h4,ul,ol,form){margin:0;padding:0}.dc :focus-visible{outline:2px solid var(--dc-accent);outline-offset:2px}.dc [hidden]{display:none!important}.dc svg{display:block;flex:none}.dc img{max-width:100%}.dc-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.dc-launcher{pointer-events:auto;position:absolute;bottom:calc(var(--edge) + env(safe-area-inset-bottom,0px));right:var(--edge);width:56px;height:56px;border-radius:50%;border:0;padding:0;cursor:pointer;background:linear-gradient(145deg,var(--dc-accent) 0%,var(--dc-accent-2) 100%);color:var(--dc-on-grad);box-shadow:0 2px 4px #10141e1f,0 10px 26px -6px color-mix(in srgb,var(--dc-accent) 60%,transparent);transition:transform .35s var(--ease-spring),opacity .2s}.dc[data-pos=left] .dc-launcher{right:auto;left:var(--edge)}.dc-launcher:hover{transform:translateY(-2px) scale(1.04)}.dc-launcher:active{transform:scale(.93);transition-duration:.1s}.dc-launcher .ic{position:absolute;inset:0;display:grid;place-items:center;transition:transform .4s var(--ease-spring),opacity .2s}.dc-launcher .ic-close{opacity:0;transform:rotate(-90deg) scale(.6)}.dc-launcher.is-open .ic-chat{opacity:0;transform:rotate(90deg) scale(.6)}.dc-launcher.is-open .ic-close{opacity:1;transform:none}.dc-launcher.has-unread:after{content:"";position:absolute;inset:0;border-radius:50%;border:2px solid var(--dc-accent);animation:dc-halo 2.4s var(--ease-out) infinite;pointer-events:none}@keyframes dc-halo{0%{transform:scale(1);opacity:.7}70%,to{transform:scale(1.55);opacity:0}}.dc-badge{position:absolute;top:-3px;right:-3px;min-width:22px;height:22px;padding:0 6px;border-radius:11px;background:var(--w-badge);color:#fff;font:700 12px/22px var(--font);text-align:center;font-variant-numeric:tabular-nums;box-shadow:0 0 0 2.5px #fff}.dc-preview{pointer-events:auto;position:absolute;right:var(--edge);bottom:calc(var(--edge) + 70px + env(safe-area-inset-bottom,0px));width:300px;max-width:calc(100% - 2 * var(--edge));background:var(--w-raised);color:var(--w-fg);border:1px solid var(--w-line);border-radius:18px 18px 6px;padding:12px 14px;box-shadow:var(--w-shadow);cursor:pointer;display:grid;grid-template-columns:34px 1fr;gap:10px;transform-origin:bottom right}.dc[data-pos=left] .dc-preview{right:auto;left:var(--edge);border-radius:18px 18px 18px 6px;transform-origin:bottom left}.dc-preview .who{font-size:12.5px;color:var(--w-muted);margin-bottom:2px}.dc-preview .who b{color:var(--w-fg);font-weight:600}.dc-preview .txt{font-size:14px;color:var(--w-fg-2);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.dc-preview .x{position:absolute;top:-8px;right:-8px;width:24px;height:24px;border-radius:50%;border:0;background:var(--w-fg);color:var(--w-bg);display:grid;place-items:center;cursor:pointer;opacity:0;transition:opacity .15s;padding:0}.dc-preview:hover .x,.dc-preview:focus-within .x{opacity:1}@media (hover: none){.dc-preview .x{opacity:1}}.dc-panel{pointer-events:auto;position:absolute;right:var(--edge);bottom:calc(var(--edge) + 70px + env(safe-area-inset-bottom,0px));width:384px;height:min(680px,calc(100% - 110px));max-width:calc(100% - 2 * var(--edge));background:var(--w-bg);border-radius:22px;box-shadow:var(--w-shadow);border:1px solid var(--w-line);overflow:hidden;display:flex;flex-direction:column;transform-origin:bottom right}.dc[data-pos=left] .dc-panel{right:auto;left:var(--edge);transform-origin:bottom left}.dc[data-theme=dark] .dc-panel{border:0}.dc-views{position:relative;flex:1;min-height:0}.dc-view{position:absolute;inset:0;display:flex;flex-direction:column;background:var(--w-bg)}.dc-head{background:linear-gradient(160deg,var(--dc-accent) 0%,var(--dc-accent-2) 100%);color:var(--dc-on-grad);position:relative;flex:none;isolation:isolate}.dc-head:before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(120% 90% at 100% 0%,rgba(255,255,255,.22),transparent 55%),radial-gradient(80% 60% at 0% 100%,rgba(0,0,0,.12),transparent 60%)}.dc[data-flat] .dc-head:before{display:none}.dc-hbtn{width:34px;height:34px;border-radius:10px;border:0;background:transparent;display:grid;place-items:center;cursor:pointer;color:inherit;flex:none;padding:0;transition:background .15s,transform .2s var(--ease-spring)}.dc-hbtn:hover{background:color-mix(in srgb,currentColor 16%,transparent)}.dc-hbtn:active{transform:scale(.9)}.dc-hbtn .ic-down{display:none}.dc-head--compact{display:flex;align-items:center;gap:6px;padding:12px 10px;min-height:66px}.dc-head-id{flex:1;min-width:0;display:flex;align-items:center;gap:10px;padding-left:4px}.dc-head-id .tx{min-width:0}.dc-head-id .t{font-weight:650;font-size:15.5px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dc-head-id .s{font-size:12.5px;opacity:.85;display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;margin-top:1px}.dc-head-id .s span:last-child{overflow:hidden;text-overflow:ellipsis}.dc-head-id .mini{display:flex;flex:none}.dc-head-id .mini .dc-av{margin-left:-5px;box-shadow:0 0 0 1.5px var(--dc-accent)}.dc-head-id .mini .dc-av:first-child{margin-left:0}.dc-av{--s: 28px;width:var(--s);height:var(--s);border-radius:50%;flex:none;position:relative;display:grid;place-items:center;font:650 calc(var(--s) * .4) / 1 var(--font);color:#fff;letter-spacing:-.02em;background:linear-gradient(140deg,hsl(var(--h, 230) 72% 64%),hsl(calc(var(--h, 230) + 28) 62% 46%))}.dc-av img{width:100%;height:100%;border-radius:50%;object-fit:cover;display:block}.dc-av .dot{position:absolute;right:-2px;bottom:-2px;width:calc(var(--s) * .34);height:calc(var(--s) * .34);min-width:9px;min-height:9px;border-radius:50%;box-shadow:0 0 0 2.5px var(--ring, var(--w-bg))}.dot.online{background:var(--w-online)}.dot.idle{background:var(--w-idle)}.dot.dnd{background:var(--w-dnd)}.dot.offline,.dot.invisible{background:var(--w-offline)}.dc-head .dc-av .dot{--ring: var(--dc-accent-2)}.dc-guild{--s: 36px;width:var(--s);height:var(--s);border-radius:calc(var(--s) * .3);background:var(--dc-accent-2);color:var(--dc-on-grad);display:grid;place-items:center;flex:none;position:relative;font:700 calc(var(--s) * .42) / 1 var(--font);box-shadow:0 0 0 1px #ffffff24 inset}.dc-guild img{width:100%;height:100%;object-fit:cover;border-radius:inherit;display:block}.dc-guild .dot{position:absolute;right:-3px;bottom:-3px;width:11px;height:11px;border-radius:50%;box-shadow:0 0 0 2.5px var(--ring, var(--dc-accent-2))}.dc-hero{padding:16px 16px 58px}.dc-hero .top{display:flex;align-items:center;justify-content:space-between}.dc-hero h2{font:700 26px/1.12 var(--font);letter-spacing:-.02em;margin:22px 4px 6px;text-wrap:balance;color:inherit}.dc-hero p{margin:0 4px;font-size:14.5px;opacity:.88;line-height:1.45}.dc-team{display:flex;align-items:center;gap:10px;margin:16px 4px 0;font-size:13px}.dc-team .stack{display:flex}.dc-team .stack .dc-av{--s: 30px;margin-left:-8px;box-shadow:0 0 0 2px var(--dc-accent-2)}.dc-team .stack .dc-av:first-child{margin-left:0}.dc-team .stack .dc-av .dot{--ring: var(--dc-accent-2)}.dc-home-body{flex:1;min-height:0;overflow-y:auto;margin-top:-40px;padding:0 12px 12px;display:flex;flex-direction:column;gap:10px;position:relative;scrollbar-width:thin}.dc-card{background:var(--w-raised);border:1px solid var(--w-line);border-radius:16px;box-shadow:var(--w-card-shadow)}.dc-cta{display:flex;align-items:center;gap:12px;width:100%;padding:14px 14px 14px 16px;text-align:left;cursor:pointer;color:var(--w-fg);transition:transform .25s var(--ease-spring),box-shadow .2s}.dc-cta:hover{transform:translateY(-1px);box-shadow:var(--w-shadow)}.dc-cta .tx{flex:1;min-width:0}.dc-cta b{display:block;font-size:15px;font-weight:650}.dc-cta small{display:block;font-size:13px;color:var(--w-muted);margin-top:2px}.dc-cta .go{width:36px;height:36px;border-radius:50%;background:var(--dc-accent);color:var(--dc-on-accent);display:grid;place-items:center;flex:none;transition:transform .3s var(--ease-spring)}.dc-cta:hover .go{transform:translate(3px)}.dc-cta.is-paused{cursor:default}.dc-cta.is-paused:hover{transform:none;box-shadow:var(--w-card-shadow)}.dc-eyebrow{font-size:11px;font-weight:600;letter-spacing:.07em;text-transform:uppercase;color:var(--w-faint);padding:12px 16px 2px}.dc-list{padding:4px}.dc-conv{display:flex;gap:12px;align-items:center;width:100%;padding:12px 14px 12px 12px;border:0;background:transparent;text-align:left;cursor:pointer;border-radius:12px;color:var(--w-fg);position:relative;transition:background .15s}.dc-conv:hover{background:var(--w-sunken)}.dc-conv .tx{flex:1;min-width:0}.dc-conv .l1{display:flex;gap:8px;align-items:baseline}.dc-conv .l1 b{font-size:14px;font-weight:600;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dc-conv .l1 time{font-size:12px;color:var(--w-faint);flex:none}.dc-conv .l2{display:block;font-size:13px;color:var(--w-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}.dc-conv.is-unread .l2{color:var(--w-fg);font-weight:550}.dc-conv .count{background:var(--w-badge);color:#fff;font:700 11px/20px var(--font);min-width:20px;height:20px;border-radius:10px;text-align:center;padding:0 6px;flex:none}.dc-conv .chev{color:var(--w-faint);flex:none}.dc-list .dc-conv+.dc-conv:before{content:"";position:absolute;left:64px;right:14px;top:0;height:1px;background:var(--w-line)}.dc-pill{display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:600;padding:1px 7px;border-radius:999px;background:var(--w-sunken);color:var(--w-muted);margin-right:4px;vertical-align:1px}.dc-pill.ok{color:var(--w-success);background:color-mix(in srgb,var(--w-success) 12%,transparent)}.dc-empty{padding:14px 16px 16px;font-size:13px;color:var(--w-muted)}.dc-empty button{border:0;background:none;padding:0;color:var(--dc-accent-text);font-weight:600;cursor:pointer;text-decoration:underline;text-underline-offset:2px}.dc-skel-row{display:flex;gap:12px;align-items:center;padding:12px}.dc-skel-row i,.dc-skel i{display:block;border-radius:999px;background:linear-gradient(90deg,var(--w-sunken) 0%,var(--w-bubble) 40%,var(--w-sunken) 80%);background-size:300% 100%;animation:dc-shimmer 1.2s linear infinite}.dc-skel-row i:first-child{width:40px;height:40px;flex:none}.dc-skel-row span{flex:1;display:flex;flex-direction:column;gap:7px}.dc-skel-row span i{height:10px;width:60%}.dc-skel-row span i+i{width:85%}@keyframes dc-shimmer{0%{background-position:100% 0}to{background-position:-50% 0}}.dc-conn{overflow:hidden;flex:none;font-size:12.5px;font-weight:550;display:flex;align-items:center;justify-content:center;gap:8px;padding:7px 12px}.dc-conn.is-down{background:color-mix(in srgb,var(--w-warn) 14%,var(--w-bg));color:var(--w-warn)}.dc-conn.is-up{background:color-mix(in srgb,var(--w-success) 13%,var(--w-bg));color:var(--w-success)}.dc-spin{width:13px;height:13px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:dc-rot .8s linear infinite}@keyframes dc-rot{to{transform:rotate(360deg)}}.dc-scroll-wrap{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.dc-scroll{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;position:relative;scrollbar-width:thin;scrollbar-color:var(--w-line-strong) transparent;overscroll-behavior:contain}.dc-welcome{padding:34px 28px 10px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:6px}.dc-welcome .stack{display:flex;margin-bottom:8px}.dc-welcome .stack .dc-av{--s: 44px;margin-left:-12px;box-shadow:0 0 0 3px var(--w-bg)}.dc-welcome .stack .dc-av:first-child{margin-left:0}.dc-welcome .stack .dc-av .dot{--ring: var(--w-bg)}.dc-welcome h3{margin:0;font-size:19px;font-weight:700;letter-spacing:-.015em;text-wrap:balance;color:var(--w-fg)}.dc-welcome p{margin:0;font-size:13.5px;color:var(--w-muted);max-width:30ch;line-height:1.5;text-wrap:balance}.dc-msgs{display:flex;flex-direction:column;padding:6px 14px}.dc-day{display:flex;align-items:center;gap:10px;font-size:11px;font-weight:600;letter-spacing:.07em;text-transform:uppercase;color:var(--w-faint);margin:16px 6px 2px}.dc-day:before,.dc-day:after{content:"";flex:1;height:1px;background:var(--w-line)}.dc-row{display:flex;gap:8px;align-items:flex-end;margin-top:2px}.dc-row.is-first{margin-top:12px}.dc-row--me{justify-content:flex-end}.dc-row.is-deleted{animation:dc-collapse .38s var(--ease-out) forwards;overflow:hidden}@keyframes dc-collapse{0%{max-height:600px;opacity:1}to{max-height:0;opacity:0;margin-top:0;transform:scale(.96)}}.dc-row-av{width:28px;flex:none;visibility:hidden}.dc-row.is-last .dc-row-av{visibility:visible}.dc-stack{display:flex;flex-direction:column;gap:3px;max-width:80%;min-width:0;align-items:flex-start}.dc-row--me .dc-stack{align-items:flex-end}.dc-name{display:none;font-size:12px;color:var(--w-muted);margin:0 0 1px 4px}.dc-name b{color:var(--w-fg-2);font-weight:600;margin-right:4px}.dc-row.is-first .dc-name{display:block}.dc-bubble{padding:8px 13px 9px;font-size:14.5px;line-height:1.42;overflow-wrap:anywhere;background:var(--w-bubble);color:var(--w-fg);border-radius:6px 18px 18px 6px;max-width:100%;white-space:normal;transition:background .6s}.dc-row--agent.is-first .dc-bubble{border-top-left-radius:18px}.dc-row--agent.is-last .dc-bubble{border-bottom-left-radius:18px}.dc-row--me .dc-bubble{background:var(--dc-accent);color:var(--dc-on-accent);border-radius:18px 6px 6px 18px}.dc-row--me.is-first .dc-bubble{border-top-right-radius:18px}.dc-row--me.is-last .dc-bubble{border-bottom-right-radius:18px}.dc-row.is-pending .dc-bubble,.dc-row.is-pending .dc-img,.dc-row.is-pending .dc-file{opacity:.62}.dc-bubble a{color:var(--dc-accent-text);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.dc-row--me .dc-bubble a{color:inherit}.dc-bubble code{font:12.5px/1.4 var(--mono);background:color-mix(in srgb,currentColor 11%,transparent);padding:1px 5px;border-radius:5px}.dc-bubble pre{margin:6px 0 2px;padding:9px 11px;border-radius:9px;background:color-mix(in srgb,currentColor 8%,transparent);overflow-x:auto;white-space:pre}.dc-bubble pre code{background:none;padding:0;font-size:12px}.dc-bubble strong{font-weight:650}.dc-bubble .dc-quote{display:inline-block;border-left:3px solid color-mix(in srgb,currentColor 30%,transparent);padding-left:8px}.dc-cemoji{width:20px;height:20px;vertical-align:-5px;display:inline-block;object-fit:contain}.dc-bubble.is-jumbo{background:none!important;padding:0 2px;font-size:40px;line-height:1.15}.dc-bubble.is-jumbo .dc-cemoji{width:46px;height:46px}.dc-spoiler{background:var(--w-fg);color:transparent;border-radius:4px;cursor:pointer;transition:background .25s,color .25s;padding:0 2px}.dc-row--me .dc-spoiler{background:var(--dc-on-accent)}.dc-spoiler.is-shown{background:color-mix(in srgb,currentColor 12%,transparent)!important;color:inherit;cursor:auto}.dc-edited{font-size:11px;color:var(--w-faint);margin-left:4px}.dc-row--me .dc-edited{color:inherit;opacity:.7}.dc-bubble.is-flash{background:color-mix(in srgb,var(--dc-accent) 22%,var(--w-bubble));transition:none}.dc-status{display:none;align-items:center;gap:4px;font-size:11.5px;color:var(--w-faint);margin:1px 4px 0}.dc-row.show-status .dc-status,.dc-status.is-failed,.dc-status.is-pending{display:flex}.dc-status.is-failed{color:var(--w-danger)}.dc-status button{border:0;background:none;padding:0;color:inherit;font-weight:650;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.dc-event{align-self:center;display:flex;align-items:center;gap:7px;font-size:12.5px;color:var(--w-muted);margin:14px 0 4px;padding:5px 12px 5px 6px;border-radius:999px;background:var(--w-sunken);max-width:92%}.dc-event .dc-av{--s: 20px}.dc-event .ic{width:20px;height:20px;border-radius:50%;display:grid;place-items:center;background:var(--w-bg);color:var(--w-muted);flex:none}.dc-event.ok .ic{background:var(--w-success);color:#fff}.dc-event b{color:var(--w-fg-2);font-weight:600}.dc-event time{color:var(--w-faint)}.dc-event.note{border-radius:14px;padding:9px 12px;text-align:center;line-height:1.45}.dc-gallery{display:grid;grid-template-columns:1fr 1fr;gap:4px;width:236px;max-width:100%}.dc-img{position:relative;display:block;width:min(var(--w, 232px),232px);max-width:100%;border:0;padding:0;border-radius:14px;overflow:hidden;background:var(--w-sunken);cursor:zoom-in}.dc-gallery .dc-img{width:100%;aspect-ratio:1!important}.dc-img img{display:block;width:100%;height:100%;object-fit:cover;transition:transform .4s var(--ease-out)}.dc-img:hover img{transform:scale(1.035)}.dc-img.is-uploading,.dc-img.is-failed{cursor:default}.dc-img.is-uploading:after{content:"";position:absolute;inset:0;background:#080a106b}.dc-ring{position:absolute;left:50%;top:50%;width:44px;height:44px;margin:-22px 0 0 -22px;z-index:1;transform:rotate(-90deg)}.dc-ring circle{fill:none;stroke-width:3.2}.dc-ring .bg{stroke:#ffffff4d}.dc-ring .fg{stroke:#fff;stroke-linecap:round;stroke-dasharray:100;transition:stroke-dashoffset .25s var(--ease-out)}.dc-img .pct{position:absolute;left:0;right:0;top:50%;z-index:1;margin-top:26px;text-align:center;color:#fff;font:600 11px/1 var(--font);font-variant-numeric:tabular-nums}.dc-img .fail{position:absolute;inset:0;z-index:1;display:grid;place-items:center;align-content:center;gap:6px;background:color-mix(in srgb,var(--w-danger) 62%,rgba(0,0,0,.4));color:#fff;font-size:12.5px;font-weight:650}.dc-file{position:relative;display:flex;align-items:center;gap:11px;width:248px;max-width:100%;padding:10px;border-radius:14px;background:var(--w-raised);border:1px solid var(--w-line-strong);color:var(--w-fg);text-decoration:none;cursor:pointer;overflow:hidden;text-align:left;transition:transform .25s var(--ease-spring),box-shadow .2s}.dc-file:hover{transform:translateY(-1px);box-shadow:var(--w-card-shadow)}.dc-ftype{width:34px;height:40px;flex:none;position:relative;border-radius:6px;background:#e5484d;color:#fff;font:800 8.5px/1 var(--font);letter-spacing:.04em;display:grid;place-items:end center;padding-bottom:7px;clip-path:polygon(0 0,66% 0,100% 28%,100% 100%,0 100%)}.dc-ftype:after{content:"";position:absolute;top:0;right:0;width:34%;height:28%;background:#fff6;border-bottom-left-radius:4px}.dc-ftype.is-image{background:#3f8cff}.dc-file .tx{flex:1;min-width:0}.dc-file b{display:block;font-size:13.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dc-file small{display:block;font-size:12px;color:var(--w-muted);margin-top:2px;font-variant-numeric:tabular-nums}.dc-file .dl{width:32px;height:32px;border-radius:50%;background:var(--w-sunken);color:var(--w-muted);display:grid;place-items:center;flex:none;transition:background .15s,color .15s}.dc-file:hover .dl{background:var(--dc-accent);color:var(--dc-on-accent)}.dc-file .bar{position:absolute;left:0;bottom:0;height:3px;width:100%;background:var(--w-sunken)}.dc-file .bar i{display:block;height:100%;background:var(--dc-accent);transition:width .25s var(--ease-out);border-radius:0 2px 2px 0}.dc-file.is-failed{border-color:color-mix(in srgb,var(--w-danger) 50%,transparent)}.dc-file.is-failed small{color:var(--w-danger)}.dc-inline-img{display:block;max-width:232px;max-height:232px;border-radius:14px}.dc-skel{display:flex;flex-direction:column;gap:10px;padding:18px 14px}.dc-skel i{height:34px;border-radius:16px}.dc-skel i:nth-child(odd){width:62%}.dc-skel i:nth-child(2n){width:48%;align-self:flex-end}.dc-skel i:nth-child(3){width:70%;height:52px}.dc-intro{align-self:stretch;display:flex;gap:8px;align-items:flex-end;margin-top:12px}.dc-intro .card{flex:1;min-width:0;background:var(--w-raised);border:1px solid var(--w-line-strong);border-radius:18px 18px 18px 6px;padding:14px;box-shadow:var(--w-card-shadow)}.dc-intro h4{margin:0 0 3px;font-size:14.5px;font-weight:650;color:var(--w-fg)}.dc-intro p{margin:0 0 12px;font-size:13px;color:var(--w-muted);line-height:1.45}.dc-intro form{display:flex;flex-direction:column;gap:8px}.dc-in{display:flex;flex-direction:column;gap:4px}.dc-in span{font-size:12px;font-weight:600;color:var(--w-fg-2)}.dc-in input{font:16px/1.3 var(--font);color:var(--w-fg);background:var(--w-bg);border:1px solid var(--w-line-strong);border-radius:11px;padding:9px 11px;outline:0;width:100%;transition:border-color .15s,box-shadow .15s}@media (pointer: fine){.dc-in input{font-size:14.5px}}.dc-in input:focus{border-color:var(--dc-accent);box-shadow:0 0 0 4px var(--dc-accent-soft)}.dc-in input:focus-visible{outline:none}.dc-in.is-err input{border-color:var(--w-danger)}.dc-in em{font-style:normal;font-size:12px;color:var(--w-danger)}.dc-in span small{font-size:11.5px;font-weight:500;color:var(--w-muted);margin-left:3px}.dc-in>small{font-size:12px;color:var(--w-muted);line-height:1.4}.dc-btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;border:0;border-radius:12px;padding:10px 14px;font-weight:650;font-size:14px;background:var(--dc-accent);color:var(--dc-on-accent);cursor:pointer;transition:transform .25s var(--ease-spring),filter .15s}.dc-btn:hover{filter:brightness(1.06)}.dc-btn:active{transform:scale(.96)}.dc-intro .done{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--w-muted)}.dc-intro .done .ok{width:20px;height:20px;border-radius:50%;background:var(--w-success);color:#fff;display:grid;place-items:center;flex:none}.dc-intro .done b{color:var(--w-fg);font-weight:600}.dc-shake{animation:dc-shake .4s}@keyframes dc-shake{20%{transform:translate(-5px)}40%{transform:translate(5px)}60%{transform:translate(-3px)}80%{transform:translate(2px)}}.dc-typing{display:flex;gap:8px;align-items:flex-end;padding:2px 14px 8px}.dc-typing .dots{display:flex;gap:4px;padding:13px 14px;background:var(--w-bubble);border-radius:18px 18px 18px 6px}.dc-typing .dots i{width:7px;height:7px;border-radius:50%;background:var(--w-muted);animation:dc-bounce 1.1s infinite var(--ease-out)}.dc-typing .dots i:nth-child(2){animation-delay:.14s}.dc-typing .dots i:nth-child(3){animation-delay:.28s}@keyframes dc-bounce{0%,60%,to{transform:translateY(0);opacity:.5}30%{transform:translateY(-4px);opacity:1}}.dc-jump{position:absolute;left:50%;bottom:10px;transform:translate(-50%);z-index:2;display:flex;align-items:center;gap:6px;border:0;border-radius:999px;padding:7px 12px 7px 10px;font-size:12.5px;font-weight:600;background:var(--w-fg);color:var(--w-bg);box-shadow:var(--w-card-shadow);cursor:pointer}.dc-composer{flex:none;padding:6px 12px calc(8px + env(safe-area-inset-bottom,0px));position:relative;background:var(--w-bg)}.dc-field{border:1px solid var(--w-line-strong);background:var(--w-raised);border-radius:22px;transition:border-color .2s,box-shadow .2s}.dc-field:focus-within{border-color:color-mix(in srgb,var(--dc-accent) 70%,transparent);box-shadow:0 0 0 4px var(--dc-accent-soft)}.dc-tray{display:flex;gap:10px;padding:12px 12px 2px;overflow-x:auto;scrollbar-width:none}.dc-chip{position:relative;flex:none;height:58px;border-radius:13px;background:var(--w-sunken);border:1px solid var(--w-line)}.dc-chip.img{width:58px}.dc-chip.img img{width:100%;height:100%;object-fit:cover;border-radius:12px;display:block}.dc-chip.file{display:flex;align-items:center;gap:9px;padding:0 30px 0 10px;max-width:200px}.dc-chip.file .dc-ftype{width:28px;height:33px;padding-bottom:5px;font-size:7.5px}.dc-chip.file .tx{min-width:0}.dc-chip.file b{display:block;font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--w-fg)}.dc-chip.file small{font-size:11.5px;color:var(--w-muted)}.dc-chip .rm{position:absolute;top:-7px;right:-7px;width:22px;height:22px;border-radius:50%;border:2px solid var(--w-raised);background:var(--w-fg);color:var(--w-bg);display:grid;place-items:center;cursor:pointer;padding:0;transition:transform .2s var(--ease-spring)}.dc-chip .rm:hover{transform:scale(1.12)}.dc-input-row{display:flex;align-items:flex-end;gap:2px;padding:5px 5px 5px 15px}.dc-input-row textarea{flex:1;min-width:0;border:0;outline:0;resize:none;background:transparent;color:var(--w-fg);font:16px/1.4 var(--font);padding:7px 0;height:37px;max-height:128px;margin:0}@media (pointer: fine){.dc-input-row textarea{font-size:15px;height:35px}}.dc-input-row textarea::placeholder{color:var(--w-faint)}.dc-input-row textarea:focus-visible{outline:none}.dc-tool{width:34px;height:34px;border-radius:50%;border:0;background:transparent;color:var(--w-muted);display:grid;place-items:center;cursor:pointer;flex:none;padding:0;transition:background .15s,color .15s,transform .2s var(--ease-spring)}.dc-tool:hover{background:var(--w-sunken);color:var(--w-fg)}.dc-tool:active{transform:scale(.9)}.dc-tool[aria-expanded=true]{color:var(--dc-accent-text);background:var(--dc-accent-soft)}.dc-send{width:34px;height:34px;border-radius:50%;border:0;display:grid;place-items:center;flex:none;cursor:pointer;margin-left:2px;padding:0;background:var(--dc-accent);color:var(--dc-on-accent);transition:transform .35s var(--ease-spring),background .2s,color .2s,box-shadow .2s;box-shadow:0 4px 12px -4px color-mix(in srgb,var(--dc-accent) 70%,transparent)}.dc-send:disabled{background:var(--w-sunken);color:var(--w-faint);transform:scale(.86);cursor:default;box-shadow:none}.dc-send:not(:disabled):hover{transform:scale(1.07)}.dc-send:not(:disabled):active{transform:scale(.92)}.dc-powered{display:flex;justify-content:center;align-items:center;gap:5px;margin-top:7px;font-size:11px;color:var(--w-faint);text-decoration:none;transition:color .15s}.dc-powered svg{height:9px;width:auto}.dc-powered:hover{color:var(--w-fg-2)}.dc-toast{position:absolute;left:12px;right:12px;bottom:calc(100% + 4px);display:flex;justify-content:center;pointer-events:none;z-index:3}.dc-toast span{display:flex;align-items:center;gap:7px;background:var(--w-fg);color:var(--w-bg);font-size:12.5px;font-weight:550;padding:8px 12px;border-radius:12px;box-shadow:var(--w-shadow);max-width:100%}.dc-toast span svg{color:#ff8b8e}.dc-resolved{display:flex;flex-direction:column;align-items:center;gap:10px;padding:10px 8px 2px;text-align:center}.dc-resolved p{margin:0;font-size:13px;color:var(--w-muted)}.dc-emoji{position:absolute;right:12px;bottom:calc(100% - 2px);width:300px;max-width:calc(100% - 24px);height:268px;background:var(--w-raised);border:1px solid var(--w-line-strong);border-radius:18px;box-shadow:var(--w-shadow);display:flex;flex-direction:column;overflow:hidden;z-index:4;transform-origin:bottom right}.dc-emoji .grid{flex:1;overflow-y:auto;display:grid;grid-template-columns:repeat(8,1fr);padding:8px;gap:2px;align-content:start;scrollbar-width:thin}.dc-emoji .grid button{border:0;background:transparent;font-size:22px;line-height:1;height:34px;border-radius:9px;cursor:pointer;padding:0;transition:background .12s,transform .2s var(--ease-spring)}.dc-emoji .grid button:hover{background:var(--w-sunken);transform:scale(1.18)}.dc-emoji .tabs{display:flex;border-top:1px solid var(--w-line);padding:4px;gap:2px}.dc-emoji .tabs button{flex:1;border:0;background:transparent;font-size:17px;height:32px;border-radius:9px;cursor:pointer;padding:0;filter:grayscale(1);opacity:.6;transition:filter .15s,opacity .15s,background .15s}.dc-emoji .tabs button[aria-pressed=true]{filter:none;opacity:1;background:var(--w-sunken)}.dc-emoji .cat{grid-column:1 / -1;font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--w-faint);padding:6px 4px 4px}.dc-drop{position:absolute;inset:8px;z-index:6;border-radius:18px;display:grid;place-items:center;align-content:center;gap:6px;text-align:center;color:var(--dc-accent-text);background-color:color-mix(in srgb,var(--w-bg) 86%,transparent);backdrop-filter:blur(6px);background-image:linear-gradient(90deg,var(--dc-accent) 50%,transparent 0),linear-gradient(90deg,var(--dc-accent) 50%,transparent 0),linear-gradient(0deg,var(--dc-accent) 50%,transparent 0),linear-gradient(0deg,var(--dc-accent) 50%,transparent 0);background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;background-size:14px 2px,14px 2px,2px 14px,2px 14px;background-position:0 0,0 100%,0 0,100% 0;animation:dc-march .6s linear infinite;pointer-events:none}@keyframes dc-march{to{background-position:14px 0,-14px 100%,0 -14px,100% 14px}}.dc-drop .ic{width:56px;height:56px;border-radius:18px;background:var(--dc-accent);color:var(--dc-on-accent);display:grid;place-items:center;margin:0 auto 6px;animation:dc-float 1.4s ease-in-out infinite}@keyframes dc-float{50%{transform:translateY(-5px)}}.dc-drop b{font-size:16px;color:var(--w-fg)}.dc-drop small{font-size:12.5px;color:var(--w-muted)}.dc-lightbox{pointer-events:auto;position:fixed;inset:0;z-index:20;display:flex;flex-direction:column}.dc-lightbox .bd{position:absolute;inset:0;background:#08090cdb;backdrop-filter:blur(4px)}.dc-lightbox .bar{position:relative;display:flex;align-items:center;gap:10px;padding:calc(12px + env(safe-area-inset-top,0px)) 14px 12px;color:#fff;font-size:13px}.dc-lightbox .bar span{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.85}.dc-lightbox .bar a,.dc-lightbox .bar button{color:#fff;border:0;background:#ffffff1f;border-radius:10px;height:34px;padding:0 12px;display:inline-flex;align-items:center;gap:6px;cursor:pointer;text-decoration:none;font-size:13px}.dc-lightbox .bar button.x{width:34px;padding:0;justify-content:center}.dc-lightbox .pic{position:relative;flex:1;min-height:0;display:grid;place-items:center;padding:8px 20px 28px}.dc-lightbox img{max-width:100%;max-height:100%;border-radius:10px;box-shadow:0 30px 80px #00000080;transform-origin:top left}@media (max-width: 520px),(max-height: 540px){.dc-panel{inset:0;width:auto;height:auto;max-width:none;border-radius:0;border:0;box-shadow:none;padding-top:env(safe-area-inset-top,0px);padding-bottom:max(0px,var(--dc-keyboard, 0px) - env(safe-area-inset-bottom,0px))}@supports (-webkit-touch-callout: none){.dc-panel{transition:padding-bottom .3s cubic-bezier(.2,.85,.4,1)}}.dc-launcher.is-open{opacity:0;pointer-events:none;transform:scale(.6)}.dc-hbtn .ic-x{display:none}.dc-hbtn .ic-down{display:block}}@media (prefers-reduced-motion: reduce){.dc *,.dc *:before,.dc *:after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}}',xn={open_chat:"Open chat",open_chat_unread_one:"Open chat, {count} unread",open_chat_unread_other:"Open chat, {count} unread",close_chat:"Close chat",title_flash_one:"({count}) New message",title_flash_other:"({count}) New messages",preview_from:"New message from {name}",preview_file:"📄 Sent a file",preview_image:"📷 Sent an image",dismiss:"Dismiss",chat:"Chat",drop_title:"Drop to attach",drop_hint:"Images or PDFs, up to 10 MB each",hi_name:"Hi {name} 👋",default_title:"Hi there 👋",default_subtitle:"We typically reply within a few minutes.",default_offline:"No one is online right now. Leave a message and we'll get back to you here.",team_away:"The team is away right now",ongoing:"Ongoing conversation",paused_title:"We're not taking new conversations right now",paused_hint:"Please come back a little later",cta_title:"Send us a message",cta_reply_away:"We'll reply as soon as we're back",cta_reply:"We typically reply within a few minutes",previous:"Previous conversations",past_error:"Couldn't load your previous conversations.",try_again:"Try again",powered_by:"Powered by",snippet_you:"You: {text}",snippet_image:"📷 Image",support:"Support",resolved:"Resolved",all_conversations:"All conversations",header_away:"Away · we'll reply as soon as we can",welcome:"How can we help?",welcome_name:"Hi {name}, how can we help?",welcome_presence:"{presence}. We typically reply within a few minutes.",jump_new:"New message",placeholder:"Message {name}…",placeholder_us:"Message us…",placeholder_away:"Leave a message…",typing:"{name} is typing",connection_lost:"Connection lost. Reconnecting…",back_online:"Back online",presence_1:"{a} is online",presence_2:"{a} and {b} are online",presence_3:"{a}, {b} and {c} are online",presence_more_one:"{a}, {b} and {count} other are online",presence_more_other:"{a}, {b} and {count} others are online",status_online:"Online",status_idle:"Away",status_dnd:"Busy",status_offline:"Offline",joined:"{name} joined the conversation",handoff:"{name} took over the conversation",reopened:"Conversation reopened",resolved_event:"Conversation resolved",edited:"(edited)",sent:"Sent",not_sent:"Not sent",uploading:"Uploading · {pct}%",retry:"Retry",remove:"Remove",waiting_details:"Waiting for your details",sending:"Sending…",open_image:"Open image {name}",download:"Download {name}",spoiler:"Spoiler, click to reveal",intro_title:"Who should we reply to?",intro_text:"Your message is ready. Add your name so the team knows who they're talking to.",name:"Name",name_error:"Tell us what to call you.",email:"Email",optional:"Optional",email_error:"That email doesn't look right.",email_hint:"Strongly recommended, so the team can reply by email after you leave.",send_message:"Send message",resolved_text:"This conversation was resolved. Need anything else?",resolved_paused:"This conversation was resolved. We're not taking new conversations right now. Please come back a little later.",paused_text:"We're not taking new conversations right now. Please come back a little later.",new_conversation:"Start a new conversation",message:"Message",attach:"Attach a file",emoji:"Emoji",send:"Send",emoji_smileys:"Smileys",emoji_people:"People",emoji_objects:"Objects",emoji_symbols:"Symbols",remove_file:"Remove {name}",file_type_error:"“{name}” can't be sent. Send an image or a PDF.",file_size_error:"“{name}” is over 10 MB.",file_count_error_one:"You can attach up to {count} file at once.",file_count_error_other:"You can attach up to {count} files at once.",open_original:"Open original",close:"Close",now:"now",minutes_short:"{count} min",days_short:"{count}d",today:"Today",yesterday:"Yesterday"},kt={en:xn,fr:{open_chat:"Ouvrir le chat",open_chat_unread_one:"Ouvrir le chat, {count} non lu",open_chat_unread_other:"Ouvrir le chat, {count} non lus",close_chat:"Fermer le chat",title_flash_one:"({count}) Nouveau message",title_flash_other:"({count}) Nouveaux messages",preview_from:"Nouveau message de {name}",preview_file:"📄 A envoyé un fichier",preview_image:"📷 A envoyé une image",dismiss:"Ignorer",chat:"Chat",drop_title:"Déposez pour joindre",drop_hint:"Images ou PDF, 10 Mo maximum chacun",hi_name:"Bonjour {name} 👋",default_title:"Bonjour 👋",default_subtitle:"Nous répondons généralement en quelques minutes.",default_offline:"Personne n'est en ligne pour le moment. Laissez un message et nous vous répondrons ici.",team_away:"L'équipe est absente pour le moment",ongoing:"Conversation en cours",paused_title:"Nous ne prenons pas de nouvelles conversations pour le moment",paused_hint:"Revenez un peu plus tard",cta_title:"Envoyez-nous un message",cta_reply_away:"Nous répondrons dès notre retour",cta_reply:"Nous répondons généralement en quelques minutes",previous:"Conversations précédentes",past_error:"Impossible de charger vos conversations précédentes.",try_again:"Réessayer",powered_by:"Propulsé par",snippet_you:"Vous : {text}",snippet_image:"📷 Image",support:"Support",resolved:"Résolue",all_conversations:"Toutes les conversations",header_away:"Absents · nous répondrons dès que possible",welcome:"Comment pouvons-nous vous aider ?",welcome_name:"Bonjour {name}, comment pouvons-nous vous aider ?",welcome_presence:"{presence}. Nous répondons généralement en quelques minutes.",jump_new:"Nouveau message",placeholder:"Écrire à {name}…",placeholder_us:"Écrivez-nous…",placeholder_away:"Laissez un message…",typing:"{name} est en train d'écrire",connection_lost:"Connexion perdue. Reconnexion…",back_online:"De nouveau en ligne",presence_1:"{a} est en ligne",presence_2:"{a} et {b} sont en ligne",presence_3:"{a}, {b} et {c} sont en ligne",presence_more_one:"{a}, {b} et {count} autre sont en ligne",presence_more_other:"{a}, {b} et {count} autres sont en ligne",status_online:"En ligne",status_idle:"Absent",status_dnd:"Occupé",status_offline:"Hors ligne",joined:"{name} a rejoint la conversation",handoff:"{name} a repris la conversation",reopened:"Conversation rouverte",resolved_event:"Conversation résolue",edited:"(modifié)",sent:"Envoyé",not_sent:"Non envoyé",uploading:"Envoi · {pct} %",retry:"Réessayer",remove:"Supprimer",waiting_details:"En attente de vos coordonnées",sending:"Envoi…",open_image:"Ouvrir l'image {name}",download:"Télécharger {name}",spoiler:"Spoiler, cliquez pour afficher",intro_title:"À qui devons-nous répondre ?",intro_text:"Votre message est prêt. Ajoutez votre nom pour que l'équipe sache à qui elle parle.",name:"Nom",name_error:"Dites-nous comment vous appeler.",email:"E-mail",optional:"Facultatif",email_error:"Cette adresse e-mail ne semble pas valide.",email_hint:"Fortement recommandé, pour que l'équipe puisse vous répondre par e-mail après votre départ.",send_message:"Envoyer le message",resolved_text:"Cette conversation a été résolue. Besoin d'autre chose ?",resolved_paused:"Cette conversation a été résolue. Nous ne prenons pas de nouvelles conversations pour le moment. Revenez un peu plus tard.",paused_text:"Nous ne prenons pas de nouvelles conversations pour le moment. Revenez un peu plus tard.",new_conversation:"Démarrer une nouvelle conversation",message:"Message",attach:"Joindre un fichier",emoji:"Emoji",send:"Envoyer",emoji_smileys:"Smileys",emoji_people:"Personnes",emoji_objects:"Objets",emoji_symbols:"Symboles",remove_file:"Retirer {name}",file_type_error:"« {name} » ne peut pas être envoyé. Envoyez une image ou un PDF.",file_size_error:"« {name} » dépasse 10 Mo.",file_count_error_one:"Vous pouvez joindre jusqu'à {count} fichier à la fois.",file_count_error_other:"Vous pouvez joindre jusqu'à {count} fichiers à la fois.",open_original:"Ouvrir l'original",close:"Fermer",now:"maintenant",minutes_short:"{count} min",days_short:"{count} j",today:"Aujourd'hui",yesterday:"Hier"},de:{open_chat:"Chat öffnen",open_chat_unread_one:"Chat öffnen, {count} ungelesen",open_chat_unread_other:"Chat öffnen, {count} ungelesen",close_chat:"Chat schließen",title_flash_one:"({count}) Neue Nachricht",title_flash_other:"({count}) Neue Nachrichten",preview_from:"Neue Nachricht von {name}",preview_file:"📄 Hat eine Datei gesendet",preview_image:"📷 Hat ein Bild gesendet",dismiss:"Ausblenden",chat:"Chat",drop_title:"Zum Anhängen ablegen",drop_hint:"Bilder oder PDFs, je bis zu 10 MB",hi_name:"Hallo {name} 👋",default_title:"Hallo 👋",default_subtitle:"Wir antworten in der Regel innerhalb weniger Minuten.",default_offline:"Gerade ist niemand online. Hinterlasse eine Nachricht und wir melden uns hier bei dir.",team_away:"Das Team ist gerade nicht da",ongoing:"Laufende Unterhaltung",paused_title:"Wir nehmen gerade keine neuen Unterhaltungen an",paused_hint:"Bitte versuche es etwas später noch einmal",cta_title:"Schreib uns eine Nachricht",cta_reply_away:"Wir antworten, sobald wir zurück sind",cta_reply:"Wir antworten in der Regel innerhalb weniger Minuten",previous:"Frühere Unterhaltungen",past_error:"Deine früheren Unterhaltungen konnten nicht geladen werden.",try_again:"Erneut versuchen",powered_by:"Bereitgestellt von",snippet_you:"Du: {text}",snippet_image:"📷 Bild",support:"Support",resolved:"Gelöst",all_conversations:"Alle Unterhaltungen",header_away:"Abwesend · wir antworten so bald wie möglich",welcome:"Wie können wir helfen?",welcome_name:"Hallo {name}, wie können wir helfen?",welcome_presence:"{presence}. Wir antworten in der Regel innerhalb weniger Minuten.",jump_new:"Neue Nachricht",placeholder:"Nachricht an {name}…",placeholder_us:"Schreib uns…",placeholder_away:"Hinterlasse eine Nachricht…",typing:"{name} schreibt",connection_lost:"Verbindung verloren. Neuer Versuch…",back_online:"Wieder online",presence_1:"{a} ist online",presence_2:"{a} und {b} sind online",presence_3:"{a}, {b} und {c} sind online",presence_more_one:"{a}, {b} und {count} weitere Person sind online",presence_more_other:"{a}, {b} und {count} weitere sind online",status_online:"Online",status_idle:"Abwesend",status_dnd:"Beschäftigt",status_offline:"Offline",joined:"{name} ist der Unterhaltung beigetreten",handoff:"{name} hat die Unterhaltung übernommen",reopened:"Unterhaltung wieder geöffnet",resolved_event:"Unterhaltung gelöst",edited:"(bearbeitet)",sent:"Gesendet",not_sent:"Nicht gesendet",uploading:"Wird hochgeladen · {pct} %",retry:"Erneut senden",remove:"Entfernen",waiting_details:"Wartet auf deine Angaben",sending:"Wird gesendet…",open_image:"Bild {name} öffnen",download:"{name} herunterladen",spoiler:"Spoiler, zum Anzeigen klicken",intro_title:"Wem sollen wir antworten?",intro_text:"Deine Nachricht ist bereit. Gib deinen Namen an, damit das Team weiß, mit wem es spricht.",name:"Name",name_error:"Sag uns, wie wir dich nennen sollen.",email:"E-Mail",optional:"Optional",email_error:"Diese E-Mail-Adresse sieht nicht richtig aus.",email_hint:"Sehr empfohlen, damit das Team dir per E-Mail antworten kann, wenn du die Seite verlässt.",send_message:"Nachricht senden",resolved_text:"Diese Unterhaltung wurde gelöst. Brauchst du noch etwas?",resolved_paused:"Diese Unterhaltung wurde gelöst. Wir nehmen gerade keine neuen Unterhaltungen an. Bitte versuche es etwas später noch einmal.",paused_text:"Wir nehmen gerade keine neuen Unterhaltungen an. Bitte versuche es etwas später noch einmal.",new_conversation:"Neue Unterhaltung starten",message:"Nachricht",attach:"Datei anhängen",emoji:"Emoji",send:"Senden",emoji_smileys:"Smileys",emoji_people:"Menschen",emoji_objects:"Objekte",emoji_symbols:"Symbole",remove_file:"{name} entfernen",file_type_error:"„{name}“ kann nicht gesendet werden. Sende ein Bild oder eine PDF.",file_size_error:"„{name}“ ist größer als 10 MB.",file_count_error_one:"Du kannst bis zu {count} Datei auf einmal anhängen.",file_count_error_other:"Du kannst bis zu {count} Dateien auf einmal anhängen.",open_original:"Original öffnen",close:"Schließen",now:"jetzt",minutes_short:"{count} Min.",days_short:"{count} T.",today:"Heute",yesterday:"Gestern"},es:{open_chat:"Abrir chat",open_chat_unread_one:"Abrir chat, {count} sin leer",open_chat_unread_other:"Abrir chat, {count} sin leer",close_chat:"Cerrar chat",title_flash_one:"({count}) Mensaje nuevo",title_flash_other:"({count}) Mensajes nuevos",preview_from:"Mensaje nuevo de {name}",preview_file:"📄 Envió un archivo",preview_image:"📷 Envió una imagen",dismiss:"Descartar",chat:"Chat",drop_title:"Suelta para adjuntar",drop_hint:"Imágenes o PDF, hasta 10 MB cada uno",hi_name:"Hola, {name} 👋",default_title:"¡Hola! 👋",default_subtitle:"Solemos responder en pocos minutos.",default_offline:"No hay nadie conectado ahora mismo. Deja un mensaje y te responderemos aquí.",team_away:"El equipo no está disponible ahora mismo",ongoing:"Conversación en curso",paused_title:"No estamos aceptando conversaciones nuevas ahora mismo",paused_hint:"Vuelve un poco más tarde",cta_title:"Envíanos un mensaje",cta_reply_away:"Responderemos en cuanto volvamos",cta_reply:"Solemos responder en pocos minutos",previous:"Conversaciones anteriores",past_error:"No se pudieron cargar tus conversaciones anteriores.",try_again:"Reintentar",powered_by:"Con la tecnología de",snippet_you:"Tú: {text}",snippet_image:"📷 Imagen",support:"Soporte",resolved:"Resuelta",all_conversations:"Todas las conversaciones",header_away:"Ausentes · responderemos lo antes posible",welcome:"¿En qué podemos ayudarte?",welcome_name:"Hola, {name}. ¿En qué podemos ayudarte?",welcome_presence:"{presence}. Solemos responder en pocos minutos.",jump_new:"Mensaje nuevo",placeholder:"Escribe a {name}…",placeholder_us:"Escríbenos…",placeholder_away:"Deja un mensaje…",typing:"{name} está escribiendo",connection_lost:"Conexión perdida. Reconectando…",back_online:"Conectado de nuevo",presence_1:"{a} está en línea",presence_2:"{a} y {b} están en línea",presence_3:"{a}, {b} y {c} están en línea",presence_more_one:"{a}, {b} y {count} persona más están en línea",presence_more_other:"{a}, {b} y {count} personas más están en línea",status_online:"En línea",status_idle:"Ausente",status_dnd:"Ocupado",status_offline:"Desconectado",joined:"{name} se unió a la conversación",handoff:"{name} se hizo cargo de la conversación",reopened:"Conversación reabierta",resolved_event:"Conversación resuelta",edited:"(editado)",sent:"Enviado",not_sent:"No enviado",uploading:"Subiendo · {pct} %",retry:"Reintentar",remove:"Eliminar",waiting_details:"Esperando tus datos",sending:"Enviando…",open_image:"Abrir imagen {name}",download:"Descargar {name}",spoiler:"Spoiler, haz clic para mostrar",intro_title:"¿A quién debemos responder?",intro_text:"Tu mensaje está listo. Añade tu nombre para que el equipo sepa con quién habla.",name:"Nombre",name_error:"Dinos cómo llamarte.",email:"Correo electrónico",optional:"Opcional",email_error:"Ese correo no parece correcto.",email_hint:"Muy recomendable, para que el equipo pueda responderte por correo cuando te vayas.",send_message:"Enviar mensaje",resolved_text:"Esta conversación se ha resuelto. ¿Necesitas algo más?",resolved_paused:"Esta conversación se ha resuelto. No estamos aceptando conversaciones nuevas ahora mismo. Vuelve un poco más tarde.",paused_text:"No estamos aceptando conversaciones nuevas ahora mismo. Vuelve un poco más tarde.",new_conversation:"Iniciar una conversación nueva",message:"Mensaje",attach:"Adjuntar un archivo",emoji:"Emoji",send:"Enviar",emoji_smileys:"Caras",emoji_people:"Personas",emoji_objects:"Objetos",emoji_symbols:"Símbolos",remove_file:"Quitar {name}",file_type_error:"No se puede enviar «{name}». Envía una imagen o un PDF.",file_size_error:"«{name}» supera los 10 MB.",file_count_error_one:"Puedes adjuntar hasta {count} archivo a la vez.",file_count_error_other:"Puedes adjuntar hasta {count} archivos a la vez.",open_original:"Abrir original",close:"Cerrar",now:"ahora",minutes_short:"{count} min",days_short:"{count} d",today:"Hoy",yesterday:"Ayer"},"pt-BR":{open_chat:"Abrir chat",open_chat_unread_one:"Abrir chat, {count} não lida",open_chat_unread_other:"Abrir chat, {count} não lidas",close_chat:"Fechar chat",title_flash_one:"({count}) Nova mensagem",title_flash_other:"({count}) Novas mensagens",preview_from:"Nova mensagem de {name}",preview_file:"📄 Enviou um arquivo",preview_image:"📷 Enviou uma imagem",dismiss:"Dispensar",chat:"Chat",drop_title:"Solte para anexar",drop_hint:"Imagens ou PDFs, até 10 MB cada",hi_name:"Olá, {name} 👋",default_title:"Olá! 👋",default_subtitle:"Costumamos responder em poucos minutos.",default_offline:"Ninguém está online agora. Deixe uma mensagem e responderemos por aqui.",team_away:"A equipe está ausente no momento",ongoing:"Conversa em andamento",paused_title:"Não estamos aceitando novas conversas no momento",paused_hint:"Volte um pouco mais tarde",cta_title:"Envie uma mensagem",cta_reply_away:"Responderemos assim que voltarmos",cta_reply:"Costumamos responder em poucos minutos",previous:"Conversas anteriores",past_error:"Não foi possível carregar suas conversas anteriores.",try_again:"Tentar novamente",powered_by:"Desenvolvido por",snippet_you:"Você: {text}",snippet_image:"📷 Imagem",support:"Suporte",resolved:"Resolvida",all_conversations:"Todas as conversas",header_away:"Ausentes · responderemos assim que possível",welcome:"Como podemos ajudar?",welcome_name:"Olá, {name}! Como podemos ajudar?",welcome_presence:"{presence}. Costumamos responder em poucos minutos.",jump_new:"Nova mensagem",placeholder:"Mensagem para {name}…",placeholder_us:"Escreva para nós…",placeholder_away:"Deixe uma mensagem…",typing:"{name} está digitando",connection_lost:"Conexão perdida. Reconectando…",back_online:"Online novamente",presence_1:"{a} está online",presence_2:"{a} e {b} estão online",presence_3:"{a}, {b} e {c} estão online",presence_more_one:"{a}, {b} e mais {count} pessoa estão online",presence_more_other:"{a}, {b} e mais {count} pessoas estão online",status_online:"Online",status_idle:"Ausente",status_dnd:"Ocupado",status_offline:"Offline",joined:"{name} entrou na conversa",handoff:"{name} assumiu a conversa",reopened:"Conversa reaberta",resolved_event:"Conversa resolvida",edited:"(editada)",sent:"Enviada",not_sent:"Não enviada",uploading:"Enviando · {pct}%",retry:"Tentar novamente",remove:"Remover",waiting_details:"Aguardando seus dados",sending:"Enviando…",open_image:"Abrir imagem {name}",download:"Baixar {name}",spoiler:"Spoiler, clique para revelar",intro_title:"Para quem devemos responder?",intro_text:"Sua mensagem está pronta. Adicione seu nome para a equipe saber com quem está falando.",name:"Nome",name_error:"Diga como devemos chamar você.",email:"E-mail",optional:"Opcional",email_error:"Esse e-mail não parece correto.",email_hint:"Altamente recomendado, para a equipe poder responder por e-mail depois que você sair.",send_message:"Enviar mensagem",resolved_text:"Esta conversa foi resolvida. Precisa de mais alguma coisa?",resolved_paused:"Esta conversa foi resolvida. Não estamos aceitando novas conversas no momento. Volte um pouco mais tarde.",paused_text:"Não estamos aceitando novas conversas no momento. Volte um pouco mais tarde.",new_conversation:"Iniciar uma nova conversa",message:"Mensagem",attach:"Anexar um arquivo",emoji:"Emoji",send:"Enviar",emoji_smileys:"Carinhas",emoji_people:"Pessoas",emoji_objects:"Objetos",emoji_symbols:"Símbolos",remove_file:"Remover {name}",file_type_error:"“{name}” não pode ser enviado. Envie uma imagem ou um PDF.",file_size_error:"“{name}” tem mais de 10 MB.",file_count_error_one:"Você pode anexar até {count} arquivo por vez.",file_count_error_other:"Você pode anexar até {count} arquivos por vez.",open_original:"Abrir original",close:"Fechar",now:"agora",minutes_short:"{count} min",days_short:"{count} d",today:"Hoje",yesterday:"Ontem"},it:{open_chat:"Apri la chat",open_chat_unread_one:"Apri la chat, {count} non letto",open_chat_unread_other:"Apri la chat, {count} non letti",close_chat:"Chiudi la chat",title_flash_one:"({count}) Nuovo messaggio",title_flash_other:"({count}) Nuovi messaggi",preview_from:"Nuovo messaggio da {name}",preview_file:"📄 Ha inviato un file",preview_image:"📷 Ha inviato un'immagine",dismiss:"Ignora",chat:"Chat",drop_title:"Rilascia per allegare",drop_hint:"Immagini o PDF, fino a 10 MB ciascuno",hi_name:"Ciao {name} 👋",default_title:"Ciao 👋",default_subtitle:"Di solito rispondiamo in pochi minuti.",default_offline:"Al momento non c'è nessuno online. Lascia un messaggio e ti risponderemo qui.",team_away:"Il team al momento non è disponibile",ongoing:"Conversazione in corso",paused_title:"Al momento non accettiamo nuove conversazioni",paused_hint:"Torna un po' più tardi",cta_title:"Inviaci un messaggio",cta_reply_away:"Ti risponderemo appena torniamo",cta_reply:"Di solito rispondiamo in pochi minuti",previous:"Conversazioni precedenti",past_error:"Impossibile caricare le tue conversazioni precedenti.",try_again:"Riprova",powered_by:"Powered by",snippet_you:"Tu: {text}",snippet_image:"📷 Immagine",support:"Assistenza",resolved:"Risolta",all_conversations:"Tutte le conversazioni",header_away:"Assenti · risponderemo appena possibile",welcome:"Come possiamo aiutarti?",welcome_name:"Ciao {name}, come possiamo aiutarti?",welcome_presence:"{presence}. Di solito rispondiamo in pochi minuti.",jump_new:"Nuovo messaggio",placeholder:"Scrivi a {name}…",placeholder_us:"Scrivici…",placeholder_away:"Lascia un messaggio…",typing:"{name} sta scrivendo",connection_lost:"Connessione persa. Riconnessione…",back_online:"Di nuovo online",presence_1:"{a} è online",presence_2:"{a} e {b} sono online",presence_3:"{a}, {b} e {c} sono online",presence_more_one:"{a}, {b} e {count} altro sono online",presence_more_other:"{a}, {b} e altri {count} sono online",status_online:"Online",status_idle:"Assente",status_dnd:"Occupato",status_offline:"Offline",joined:"{name} si è unito alla conversazione",handoff:"{name} ha preso in carico la conversazione",reopened:"Conversazione riaperta",resolved_event:"Conversazione risolta",edited:"(modificato)",sent:"Inviato",not_sent:"Non inviato",uploading:"Caricamento · {pct}%",retry:"Riprova",remove:"Rimuovi",waiting_details:"In attesa dei tuoi dati",sending:"Invio…",open_image:"Apri l'immagine {name}",download:"Scarica {name}",spoiler:"Spoiler, clicca per mostrare",intro_title:"A chi dobbiamo rispondere?",intro_text:"Il tuo messaggio è pronto. Aggiungi il tuo nome così il team sa con chi sta parlando.",name:"Nome",name_error:"Dicci come chiamarti.",email:"Email",optional:"Facoltativa",email_error:"Questa email non sembra corretta.",email_hint:"Consigliata, così il team può risponderti via email anche dopo che sei uscito.",send_message:"Invia messaggio",resolved_text:"Questa conversazione è stata risolta. Ti serve altro?",resolved_paused:"Questa conversazione è stata risolta. Al momento non accettiamo nuove conversazioni. Torna un po' più tardi.",paused_text:"Al momento non accettiamo nuove conversazioni. Torna un po' più tardi.",new_conversation:"Inizia una nuova conversazione",message:"Messaggio",attach:"Allega un file",emoji:"Emoji",send:"Invia",emoji_smileys:"Faccine",emoji_people:"Persone",emoji_objects:"Oggetti",emoji_symbols:"Simboli",remove_file:"Rimuovi {name}",file_type_error:"Impossibile inviare «{name}». Invia un'immagine o un PDF.",file_size_error:"«{name}» supera i 10 MB.",file_count_error_one:"Puoi allegare fino a {count} file alla volta.",file_count_error_other:"Puoi allegare fino a {count} file alla volta.",open_original:"Apri originale",close:"Chiudi",now:"ora",minutes_short:"{count} min",days_short:"{count} g",today:"Oggi",yesterday:"Ieri"},nl:{open_chat:"Chat openen",open_chat_unread_one:"Chat openen, {count} ongelezen",open_chat_unread_other:"Chat openen, {count} ongelezen",close_chat:"Chat sluiten",title_flash_one:"({count}) Nieuw bericht",title_flash_other:"({count}) Nieuwe berichten",preview_from:"Nieuw bericht van {name}",preview_file:"📄 Heeft een bestand gestuurd",preview_image:"📷 Heeft een afbeelding gestuurd",dismiss:"Sluiten",chat:"Chat",drop_title:"Loslaten om toe te voegen",drop_hint:"Afbeeldingen of pdf's, elk tot 10 MB",hi_name:"Hoi {name} 👋",default_title:"Hoi daar 👋",default_subtitle:"We reageren meestal binnen een paar minuten.",default_offline:"Er is nu niemand online. Laat een bericht achter, dan reageren we hier.",team_away:"Het team is er nu niet",ongoing:"Lopend gesprek",paused_title:"We nemen op dit moment geen nieuwe gesprekken aan",paused_hint:"Kom straks nog eens terug",cta_title:"Stuur ons een bericht",cta_reply_away:"We reageren zodra we terug zijn",cta_reply:"We reageren meestal binnen een paar minuten",previous:"Eerdere gesprekken",past_error:"Je eerdere gesprekken konden niet worden geladen.",try_again:"Opnieuw proberen",powered_by:"Mogelijk gemaakt door",snippet_you:"Jij: {text}",snippet_image:"📷 Afbeelding",support:"Support",resolved:"Opgelost",all_conversations:"Alle gesprekken",header_away:"Afwezig · we reageren zo snel mogelijk",welcome:"Waarmee kunnen we helpen?",welcome_name:"Hoi {name}, waarmee kunnen we helpen?",welcome_presence:"{presence}. We reageren meestal binnen een paar minuten.",jump_new:"Nieuw bericht",placeholder:"Bericht aan {name}…",placeholder_us:"Stuur ons een bericht…",placeholder_away:"Laat een bericht achter…",typing:"{name} is aan het typen",connection_lost:"Verbinding verbroken. Opnieuw verbinden…",back_online:"Weer online",presence_1:"{a} is online",presence_2:"{a} en {b} zijn online",presence_3:"{a}, {b} en {c} zijn online",presence_more_one:"{a}, {b} en {count} ander zijn online",presence_more_other:"{a}, {b} en {count} anderen zijn online",status_online:"Online",status_idle:"Afwezig",status_dnd:"Bezet",status_offline:"Offline",joined:"{name} neemt deel aan het gesprek",handoff:"{name} heeft het gesprek overgenomen",reopened:"Gesprek heropend",resolved_event:"Gesprek opgelost",edited:"(bewerkt)",sent:"Verzonden",not_sent:"Niet verzonden",uploading:"Uploaden · {pct}%",retry:"Opnieuw",remove:"Verwijderen",waiting_details:"Wacht op je gegevens",sending:"Verzenden…",open_image:"Afbeelding {name} openen",download:"{name} downloaden",spoiler:"Spoiler, klik om te tonen",intro_title:"Naar wie moeten we reageren?",intro_text:"Je bericht staat klaar. Vul je naam in zodat het team weet met wie het praat.",name:"Naam",name_error:"Laat ons weten hoe we je mogen noemen.",email:"E-mail",optional:"Optioneel",email_error:"Dat e-mailadres lijkt niet te kloppen.",email_hint:"Sterk aanbevolen, zodat het team je per e-mail kan antwoorden als je weg bent.",send_message:"Bericht versturen",resolved_text:"Dit gesprek is opgelost. Kunnen we nog ergens mee helpen?",resolved_paused:"Dit gesprek is opgelost. We nemen op dit moment geen nieuwe gesprekken aan. Kom straks nog eens terug.",paused_text:"We nemen op dit moment geen nieuwe gesprekken aan. Kom straks nog eens terug.",new_conversation:"Nieuw gesprek starten",message:"Bericht",attach:"Bestand toevoegen",emoji:"Emoji",send:"Versturen",emoji_smileys:"Smileys",emoji_people:"Mensen",emoji_objects:"Voorwerpen",emoji_symbols:"Symbolen",remove_file:"{name} verwijderen",file_type_error:"‘{name}’ kan niet worden verstuurd. Stuur een afbeelding of een pdf.",file_size_error:"‘{name}’ is groter dan 10 MB.",file_count_error_one:"Je kunt maximaal {count} bestand tegelijk toevoegen.",file_count_error_other:"Je kunt maximaal {count} bestanden tegelijk toevoegen.",open_original:"Origineel openen",close:"Sluiten",now:"nu",minutes_short:"{count} min",days_short:"{count} d",today:"Vandaag",yesterday:"Gisteren"},pl:{open_chat:"Otwórz czat",open_chat_unread_one:"Otwórz czat, {count} nieprzeczytana",open_chat_unread_few:"Otwórz czat, {count} nieprzeczytane",open_chat_unread_many:"Otwórz czat, {count} nieprzeczytanych",open_chat_unread_other:"Otwórz czat, {count} nieprzeczytanych",close_chat:"Zamknij czat",title_flash_one:"({count}) Nowa wiadomość",title_flash_few:"({count}) Nowe wiadomości",title_flash_many:"({count}) Nowych wiadomości",title_flash_other:"({count}) Nowych wiadomości",preview_from:"Nowa wiadomość od: {name}",preview_file:"📄 Wysłano plik",preview_image:"📷 Wysłano obraz",dismiss:"Odrzuć",chat:"Czat",drop_title:"Upuść, aby załączyć",drop_hint:"Obrazy lub pliki PDF, do 10 MB każdy",hi_name:"Cześć, {name} 👋",default_title:"Cześć 👋",default_subtitle:"Zwykle odpowiadamy w ciągu kilku minut.",default_offline:"Nikogo nie ma teraz online. Zostaw wiadomość, a odpowiemy Ci tutaj.",team_away:"Zespołu nie ma w tej chwili",ongoing:"Trwająca rozmowa",paused_title:"Obecnie nie przyjmujemy nowych rozmów",paused_hint:"Wróć trochę później",cta_title:"Napisz do nas",cta_reply_away:"Odpowiemy, gdy tylko wrócimy",cta_reply:"Zwykle odpowiadamy w ciągu kilku minut",previous:"Poprzednie rozmowy",past_error:"Nie udało się wczytać Twoich poprzednich rozmów.",try_again:"Spróbuj ponownie",powered_by:"Obsługiwane przez",snippet_you:"Ty: {text}",snippet_image:"📷 Obraz",support:"Wsparcie",resolved:"Rozwiązana",all_conversations:"Wszystkie rozmowy",header_away:"Nieobecni · odpowiemy najszybciej, jak się da",welcome:"Jak możemy pomóc?",welcome_name:"Cześć, {name}! Jak możemy pomóc?",welcome_presence:"{presence}. Zwykle odpowiadamy w ciągu kilku minut.",jump_new:"Nowa wiadomość",placeholder:"Napisz do: {name}…",placeholder_us:"Napisz do nas…",placeholder_away:"Zostaw wiadomość…",typing:"{name} pisze",connection_lost:"Utracono połączenie. Ponowne łączenie…",back_online:"Znów online",presence_1:"{a} jest online",presence_2:"{a} i {b} są online",presence_3:"{a}, {b} i {c} są online",presence_more_one:"{a}, {b} i {count} inna osoba są online",presence_more_few:"{a}, {b} i {count} inne osoby są online",presence_more_many:"{a}, {b} i {count} innych osób jest online",presence_more_other:"{a}, {b} i {count} innych osób jest online",status_online:"Online",status_idle:"Zaraz wracam",status_dnd:"Zajęty",status_offline:"Offline",joined:"{name} dołącza do rozmowy",handoff:"{name} przejmuje rozmowę",reopened:"Rozmowa wznowiona",resolved_event:"Rozmowa rozwiązana",edited:"(edytowano)",sent:"Wysłano",not_sent:"Nie wysłano",uploading:"Przesyłanie · {pct}%",retry:"Ponów",remove:"Usuń",waiting_details:"Czeka na Twoje dane",sending:"Wysyłanie…",open_image:"Otwórz obraz {name}",download:"Pobierz {name}",spoiler:"Spoiler, kliknij, aby odsłonić",intro_title:"Komu mamy odpowiedzieć?",intro_text:"Twoja wiadomość jest gotowa. Podaj imię, aby zespół wiedział, z kim rozmawia.",name:"Imię",name_error:"Powiedz nam, jak się do Ciebie zwracać.",email:"E-mail",optional:"Opcjonalnie",email_error:"Ten adres e-mail wygląda na nieprawidłowy.",email_hint:"Zalecane, aby zespół mógł odpowiedzieć Ci e-mailem po Twoim wyjściu.",send_message:"Wyślij wiadomość",resolved_text:"Ta rozmowa została rozwiązana. Potrzebujesz czegoś jeszcze?",resolved_paused:"Ta rozmowa została rozwiązana. Obecnie nie przyjmujemy nowych rozmów. Wróć trochę później.",paused_text:"Obecnie nie przyjmujemy nowych rozmów. Wróć trochę później.",new_conversation:"Rozpocznij nową rozmowę",message:"Wiadomość",attach:"Załącz plik",emoji:"Emoji",send:"Wyślij",emoji_smileys:"Buźki",emoji_people:"Ludzie",emoji_objects:"Przedmioty",emoji_symbols:"Symbole",remove_file:"Usuń {name}",file_type_error:"Nie można wysłać „{name}”. Wyślij obraz lub plik PDF.",file_size_error:"„{name}” ma ponad 10 MB.",file_count_error_one:"Możesz załączyć maksymalnie {count} plik naraz.",file_count_error_few:"Możesz załączyć maksymalnie {count} pliki naraz.",file_count_error_many:"Możesz załączyć maksymalnie {count} plików naraz.",file_count_error_other:"Możesz załączyć maksymalnie {count} plików naraz.",open_original:"Otwórz oryginał",close:"Zamknij",now:"teraz",minutes_short:"{count} min",days_short:"{count} d",today:"Dzisiaj",yesterday:"Wczoraj"},ja:{open_chat:"チャットを開く",open_chat_unread_one:"チャットを開く(未読 {count} 件)",open_chat_unread_other:"チャットを開く(未読 {count} 件)",close_chat:"チャットを閉じる",title_flash_one:"({count}) 新着メッセージ",title_flash_other:"({count}) 新着メッセージ",preview_from:"{name} からの新着メッセージ",preview_file:"📄 ファイルを送信しました",preview_image:"📷 画像を送信しました",dismiss:"閉じる",chat:"チャット",drop_title:"ドロップして添付",drop_hint:"画像または PDF、各 10 MB まで",hi_name:"{name} さん、こんにちは 👋",default_title:"こんにちは 👋",default_subtitle:"通常、数分以内にお返事します。",default_offline:"現在オンラインのスタッフはいません。メッセージを残していただければ、こちらでお返事します。",team_away:"現在スタッフは不在です",ongoing:"進行中の会話",paused_title:"現在、新しい会話を受け付けていません",paused_hint:"しばらくしてから再度お越しください",cta_title:"メッセージを送る",cta_reply_away:"戻り次第お返事します",cta_reply:"通常、数分以内にお返事します",previous:"過去の会話",past_error:"過去の会話を読み込めませんでした。",try_again:"再試行",powered_by:"Powered by",snippet_you:"あなた: {text}",snippet_image:"📷 画像",support:"サポート",resolved:"解決済み",all_conversations:"すべての会話",header_away:"不在 · できるだけ早くお返事します",welcome:"どのようなご用件でしょうか?",welcome_name:"{name} さん、どのようなご用件でしょうか?",welcome_presence:"{presence}。通常、数分以内にお返事します。",jump_new:"新着メッセージ",placeholder:"{name} にメッセージを送信…",placeholder_us:"メッセージを入力…",placeholder_away:"メッセージを残す…",typing:"{name} が入力中",connection_lost:"接続が切れました。再接続しています…",back_online:"再接続しました",presence_1:"{a} がオンラインです",presence_2:"{a} と {b} がオンラインです",presence_3:"{a}、{b}、{c} がオンラインです",presence_more_one:"{a}、{b} ほか {count} 名がオンラインです",presence_more_other:"{a}、{b} ほか {count} 名がオンラインです",status_online:"オンライン",status_idle:"離席中",status_dnd:"取り込み中",status_offline:"オフライン",joined:"{name} が会話に参加しました",handoff:"{name} が会話を引き継ぎました",reopened:"会話が再開されました",resolved_event:"会話が解決されました",edited:"(編集済み)",sent:"送信済み",not_sent:"未送信",uploading:"アップロード中 · {pct}%",retry:"再試行",remove:"削除",waiting_details:"お客様情報の入力待ち",sending:"送信中…",open_image:"画像 {name} を開く",download:"{name} をダウンロード",spoiler:"ネタバレ。クリックして表示",intro_title:"どなたにお返事すればよいですか?",intro_text:"メッセージの準備ができました。スタッフが相手を把握できるよう、お名前を入力してください。",name:"お名前",name_error:"お名前を入力してください。",email:"メールアドレス",optional:"任意",email_error:"メールアドレスの形式が正しくないようです。",email_hint:"ページを離れた後もメールでお返事できるよう、入力をおすすめします。",send_message:"メッセージを送信",resolved_text:"この会話は解決済みです。ほかにご用件はありますか?",resolved_paused:"この会話は解決済みです。現在、新しい会話を受け付けていません。しばらくしてから再度お越しください。",paused_text:"現在、新しい会話を受け付けていません。しばらくしてから再度お越しください。",new_conversation:"新しい会話を始める",message:"メッセージ",attach:"ファイルを添付",emoji:"絵文字",send:"送信",emoji_smileys:"スマイリー",emoji_people:"人",emoji_objects:"もの",emoji_symbols:"記号",remove_file:"{name} を削除",file_type_error:"「{name}」は送信できません。画像または PDF を送信してください。",file_size_error:"「{name}」は 10 MB を超えています。",file_count_error_one:"一度に添付できるファイルは {count} 件までです。",file_count_error_other:"一度に添付できるファイルは {count} 件までです。",open_original:"元の画像を開く",close:"閉じる",now:"たった今",minutes_short:"{count}分",days_short:"{count}日",today:"今日",yesterday:"昨日"},tr:{open_chat:"Sohbeti aç",open_chat_unread_one:"Sohbeti aç, {count} okunmamış",open_chat_unread_other:"Sohbeti aç, {count} okunmamış",close_chat:"Sohbeti kapat",title_flash_one:"({count}) Yeni mesaj",title_flash_other:"({count}) Yeni mesaj",preview_from:"{name} kişisinden yeni mesaj",preview_file:"📄 Bir dosya gönderdi",preview_image:"📷 Bir görsel gönderdi",dismiss:"Kapat",chat:"Sohbet",drop_title:"Eklemek için bırakın",drop_hint:"Görseller veya PDF'ler, her biri en fazla 10 MB",hi_name:"Merhaba {name} 👋",default_title:"Merhaba 👋",default_subtitle:"Genellikle birkaç dakika içinde yanıt veririz.",default_offline:"Şu anda kimse çevrimiçi değil. Bir mesaj bırakın, size buradan dönüş yapalım.",team_away:"Ekip şu anda müsait değil",ongoing:"Devam eden sohbet",paused_title:"Şu anda yeni sohbet kabul etmiyoruz",paused_hint:"Lütfen biraz sonra tekrar gelin",cta_title:"Bize mesaj gönderin",cta_reply_away:"Döner dönmez yanıt vereceğiz",cta_reply:"Genellikle birkaç dakika içinde yanıt veririz",previous:"Önceki sohbetler",past_error:"Önceki sohbetleriniz yüklenemedi.",try_again:"Tekrar dene",powered_by:"Destekleyen:",snippet_you:"Siz: {text}",snippet_image:"📷 Görsel",support:"Destek",resolved:"Çözüldü",all_conversations:"Tüm sohbetler",header_away:"Uzakta · en kısa sürede yanıt vereceğiz",welcome:"Size nasıl yardımcı olabiliriz?",welcome_name:"Merhaba {name}, size nasıl yardımcı olabiliriz?",welcome_presence:"{presence}. Genellikle birkaç dakika içinde yanıt veririz.",jump_new:"Yeni mesaj",placeholder:"{name} ekibine yazın…",placeholder_us:"Bize yazın…",placeholder_away:"Bir mesaj bırakın…",typing:"{name} yazıyor",connection_lost:"Bağlantı koptu. Yeniden bağlanılıyor…",back_online:"Yeniden çevrimiçi",presence_1:"{a} çevrimiçi",presence_2:"{a} ve {b} çevrimiçi",presence_3:"{a}, {b} ve {c} çevrimiçi",presence_more_one:"{a}, {b} ve {count} kişi daha çevrimiçi",presence_more_other:"{a}, {b} ve {count} kişi daha çevrimiçi",status_online:"Çevrimiçi",status_idle:"Uzakta",status_dnd:"Meşgul",status_offline:"Çevrimdışı",joined:"{name} sohbete katıldı",handoff:"{name} sohbeti devraldı",reopened:"Sohbet yeniden açıldı",resolved_event:"Sohbet çözüldü",edited:"(düzenlendi)",sent:"Gönderildi",not_sent:"Gönderilmedi",uploading:"Yükleniyor · %{pct}",retry:"Tekrar dene",remove:"Kaldır",waiting_details:"Bilgileriniz bekleniyor",sending:"Gönderiliyor…",open_image:"{name} görselini aç",download:"{name} dosyasını indir",spoiler:"Spoiler, göstermek için tıklayın",intro_title:"Kime yanıt verelim?",intro_text:"Mesajınız hazır. Ekibin kiminle konuştuğunu bilmesi için adınızı ekleyin.",name:"Ad",name_error:"Size nasıl hitap edelim?",email:"E-posta",optional:"İsteğe bağlı",email_error:"Bu e-posta adresi doğru görünmüyor.",email_hint:"Siz ayrıldıktan sonra ekibin e-postayla yanıt verebilmesi için önemle tavsiye edilir.",send_message:"Mesajı gönder",resolved_text:"Bu sohbet çözüldü. Başka bir şeye ihtiyacınız var mı?",resolved_paused:"Bu sohbet çözüldü. Şu anda yeni sohbet kabul etmiyoruz. Lütfen biraz sonra tekrar gelin.",paused_text:"Şu anda yeni sohbet kabul etmiyoruz. Lütfen biraz sonra tekrar gelin.",new_conversation:"Yeni bir sohbet başlat",message:"Mesaj",attach:"Dosya ekle",emoji:"Emoji",send:"Gönder",emoji_smileys:"İfadeler",emoji_people:"İnsanlar",emoji_objects:"Nesneler",emoji_symbols:"Semboller",remove_file:"{name} dosyasını kaldır",file_type_error:"“{name}” gönderilemiyor. Bir görsel veya PDF gönderin.",file_size_error:"“{name}” 10 MB'tan büyük.",file_count_error_one:"Tek seferde en fazla {count} dosya ekleyebilirsiniz.",file_count_error_other:"Tek seferde en fazla {count} dosya ekleyebilirsiniz.",open_original:"Orijinali aç",close:"Kapat",now:"şimdi",minutes_short:"{count} dk",days_short:"{count} g",today:"Bugün",yesterday:"Dün"}},Et=Object.keys(kt);function kn(t){for(const e of t){const n=e?.trim().replace(/_/g,"-").toLowerCase();if(!n)continue;const r=Et.find(a=>a.toLowerCase()===n);if(r)return r;const o=n.split("-")[0],i=Et.find(a=>a.toLowerCase().split("-")[0]===o);if(i)return i}return"en"}let Te="en",En=new Intl.PluralRules(Te);function To(t){Te=t,En=new Intl.PluralRules(t)}function At(){return Te}function An(t,e){return e?t.replace(/\{(\w+)\}/g,(n,r)=>r in e?String(e[r]):n):t}function _(t,e){return An(kt[Te][t]??xn[t],e)}function We(t,e,n){const r=kt[Te],o=r[`${t}_${En.select(e)}`]??r[`${t}_other`];return An(o,{count:e,...n})}const So="https://api.deskcord.chat";function No(){const t=window.deskcord?.settings;if(!t?.app_id)return console.error("[Deskcord] window.deskcord.settings.app_id is missing: check the embed snippet."),null;const e=t.theme==="dark"||t.theme==="auto"?t.theme:"light";return{appId:String(t.app_id),domain:(t.domain??So).replace(/\/+$/,""),user:t.user,theme:e,locale:kn([t.locale,document.documentElement.lang,...navigator.languages??[navigator.language]])}}const jo="DESKCORD_UNAVAILABLE",Ro="DESKCORD_QUOTA_REACHED";class ye extends Error{constructor(e,n){super(`Request failed (${e})`),this.status=e,this.body=n}}class zn extends Error{constructor(){super("Deskcord is temporarily unavailable")}}class Cn extends Error{constructor(){super("This team isn't taking new conversations right now")}}class zt extends Error{}function Tn(t){if(!t)return null;try{return JSON.parse(t)}catch{return t}}function Io(t,e){function n(i,a){if(i===503&&a?.code===jo)throw e(),new zn;if(i===403&&a?.code===Ro)throw new Cn;if(i<200||i>=300)throw new ye(i,a)}async function r(i,a,c,d){const u={};c!==void 0&&(u["Content-Type"]="application/json"),d&&(u.Authorization=`Bearer ${d}`);let m;try{m=await fetch(t+a,{method:i,headers:u,body:c===void 0?void 0:JSON.stringify(c)})}catch(f){throw new zt(String(f))}const p=Tn(await m.text());return n(m.status,p),p}function o(i,a,c,d,u){return new Promise((m,p)=>{const f=new XMLHttpRequest;f.open("POST",t+i),f.setRequestHeader("Authorization",`Bearer ${c}`),f.upload.onprogress=x=>{x.lengthComputable&&d(x.loaded/x.total)},f.onload=()=>{const x=Tn(f.responseText);try{n(f.status,x),m(x)}catch(E){p(E)}},f.onerror=()=>p(new zt("Upload failed"));const w=new FormData;w.append("file",a),u&&w.append("pageUrl",u),f.send(w)})}return{get:(i,a)=>r("GET",i,void 0,a),post:(i,a,c)=>r("POST",i,a,c),upload:o}}const Oo=2048;function Ct(t=typeof window>"u"?void 0:window.location){if(!t||t.protocol!=="https:"&&t.protocol!=="http:")return;const e=`${t.origin}${t.pathname}`;return e.length<=Oo?e:void 0}const Sn=t=>t instanceof ye&&t.status===404;function Mo(t,e){const n=Io(t.domain,e),r=t.appId,o=({name:i,email:a,avatarUrl:c,metadata:d})=>({name:i,...a?{email:a}:{},...c?{avatarUrl:c}:{},...d?{metadata:d}:{}});return{async status(){return!!(await n.get(`/guildSettings/status/${encodeURIComponent(r)}`))?.active},settings(){return n.get(`/guildSettings/${encodeURIComponent(r)}`)},async token(i,a){const c=await n.post("/auth/token",{guildId:r,...o(i)},a);if(!c?.token||c.token==="undefined")throw new Error("No token in /auth/token response");return c.token},async identify(i,a){try{return(await n.post("/auth/identify",{guildId:r,userId:i.userId,userHash:i.userHash,...o(i)},a))?.token??null}catch(c){if(c instanceof ye&&c.status<500)return null;throw c}},async current(i){try{return(await n.get("/conversations/current",i))?.currentConversation??null}catch(a){if(Sn(a))return null;throw a}},async past(i){try{return(await n.get("/conversations/past",i))?.pastConversations??[]}catch(a){if(Sn(a))return[];throw a}},async unreadCount(i){const a=await n.get("/conversations/unread-count",i);return Number(a?.unreadCount)||0},async markRead(i,a){await n.post("/conversations/mark-read",{timestamp:a},i)},send(i,a,c){const d=Ct();return n.post("/conversations/sendMessage",{name:a,content:c,...d?{pageUrl:d}:{}},i)},upload(i,a,c){return n.upload("/conversations/uploadAttachment",a,i,c,Ct())}}}const Nn=20,jn=40,Rn=200,Lo=1024,Do=t=>new TextEncoder().encode(t).length;function In(t,e=Bo){if(t==null)return null;if(typeof t!="object"||Array.isArray(t))return e("metadata ignored: it must be a flat object."),null;const n=[],r={};let o=0,i=2;for(const[a,c]of Object.entries(t)){const d=a.trim(),u=c===null||typeof c=="boolean"||typeof c=="number"&&Number.isFinite(c)||typeof c=="string"&&c.length<=Rn;if(!d||d.length>jn||d==="__proto__"||d in r){n.push(`"${a.slice(0,jn)}" (invalid key)`);continue}if(!u){n.push(`"${d}" (values must be strings of at most ${Rn} characters, numbers, booleans or null)`);continue}const m=Do(`${JSON.stringify(d)}:${JSON.stringify(c)},`);if(o>=Nn||i+m>Lo){n.push(`"${d}" (too much metadata: ${Nn} keys and about 1 KB at most)`);continue}i+=m,o++,r[d]=c}return n.length&&e(`metadata dropped: ${n.join(", ")}.`),o?r:null}function Bo(t){console.warn(`[Deskcord] ${t}`)}const se=Object.create(null);se.open="0",se.close="1",se.ping="2",se.pong="3",se.message="4",se.upgrade="5",se.noop="6";const Ye=Object.create(null);Object.keys(se).forEach(t=>{Ye[se[t]]=t});const Tt={type:"error",data:"parser error"},On=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Mn=typeof ArrayBuffer=="function",Ln=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,St=({type:t,data:e},n,r)=>On&&e instanceof Blob?n?r(e):Dn(e,r):Mn&&(e instanceof ArrayBuffer||Ln(e))?n?r(e):Dn(new Blob([e]),r):r(se[t]+(e||"")),Dn=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function Bn(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Nt;function Po(t,e){if(On&&t.data instanceof Blob)return t.data.arrayBuffer().then(Bn).then(e);if(Mn&&(t.data instanceof ArrayBuffer||Ln(t.data)))return e(Bn(t.data));St(t,!1,n=>{Nt||(Nt=new TextEncoder),e(Nt.encode(n))})}const Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Se=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Pn.length;t++)Se[Pn.charCodeAt(t)]=t;const Uo=t=>{let e=t.length*.75,n=t.length,r,o=0,i,a,c,d;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const u=new ArrayBuffer(e),m=new Uint8Array(u);for(r=0;r<n;r+=4)i=Se[t.charCodeAt(r)],a=Se[t.charCodeAt(r+1)],c=Se[t.charCodeAt(r+2)],d=Se[t.charCodeAt(r+3)],m[o++]=i<<2|a>>4,m[o++]=(a&15)<<4|c>>2,m[o++]=(c&3)<<6|d&63;return u},$o=typeof ArrayBuffer=="function",jt=(t,e)=>{if(typeof t!="string")return{type:"message",data:Un(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:qo(t.substring(1),e)}:Ye[n]?t.length>1?{type:Ye[n],data:t.substring(1)}:{type:Ye[n]}:Tt},qo=(t,e)=>{if($o){const n=Uo(t);return Un(n,e)}else return{base64:!0,data:t}},Un=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},$n="",Fo=(t,e)=>{const n=t.length,r=new Array(n);let o=0;t.forEach((i,a)=>{St(i,!1,c=>{r[a]=c,++o===n&&e(r.join($n))})})},Ho=(t,e)=>{const n=t.split($n),r=[];for(let o=0;o<n.length;o++){const i=jt(n[o],e);if(r.push(i),i.type==="error")break}return r};function Vo(){return new TransformStream({transform(t,e){Po(t,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const i=new DataView(o.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{o=new Uint8Array(9);const i=new DataView(o.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(n)})}})}let Rt;function Ke(t){return t.reduce((e,n)=>e+n.length,0)}function Je(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let o=0;o<e;o++)n[o]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function Wo(t,e){Rt||(Rt=new TextDecoder);const n=[];let r=0,o=-1,i=!1;return new TransformStream({transform(a,c){for(n.push(a);;){if(r===0){if(Ke(n)<1)break;const d=Je(n,1);i=(d[0]&128)===128,o=d[0]&127,o<126?r=3:o===126?r=1:r=2}else if(r===1){if(Ke(n)<2)break;const d=Je(n,2);o=new DataView(d.buffer,d.byteOffset,d.length).getUint16(0),r=3}else if(r===2){if(Ke(n)<8)break;const d=Je(n,8),u=new DataView(d.buffer,d.byteOffset,d.length),m=u.getUint32(0);if(m>Math.pow(2,21)-1){c.enqueue(Tt);break}o=m*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Ke(n)<o)break;const d=Je(n,o);c.enqueue(jt(i?d:Rt.decode(d),e)),r=0}if(o===0||o>t){c.enqueue(Tt);break}}}})}const qn=4;function $(t){if(t)return Yo(t)}function Yo(t){for(var e in $.prototype)t[e]=$.prototype[e];return t}$.prototype.on=$.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},$.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},$.prototype.off=$.prototype.removeListener=$.prototype.removeAllListeners=$.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+t],this},$.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,e)}return this},$.prototype.emitReserved=$.prototype.emit,$.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},$.prototype.hasListeners=function(t){return!!this.listeners(t).length};const ee=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function Fn(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const Ko=ee.setTimeout,Jo=ee.clearTimeout;function Xe(t,e){e.useNativeTimers?(t.setTimeoutFn=Ko.bind(ee),t.clearTimeoutFn=Jo.bind(ee)):(t.setTimeoutFn=ee.setTimeout.bind(ee),t.clearTimeoutFn=ee.clearTimeout.bind(ee))}const Xo=1.33;function Go(t){return typeof t=="string"?Zo(t):Math.ceil((t.byteLength||t.size)*Xo)}function Zo(t){let e=0,n=0;for(let r=0,o=t.length;r<o;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function Qo(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function ei(t){let e={},n=t.split("&");for(let r=0,o=n.length;r<o;r++){let i=n[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}class ti extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class It extends ${constructor(e){super(),this.writable=!1,Xe(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,r){return super.emitReserved("error",new ti(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=jt(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=Qo(e);return n.length?"?"+n:""}}const Hn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Ot=64,ni={};let Vn=0,Ge=0,Wn;function Yn(t){let e="";do e=Hn[t%Ot]+e,t=Math.floor(t/Ot);while(t>0);return e}function Kn(){const t=Yn(+new Date);return t!==Wn?(Vn=0,Wn=t):t+"."+Yn(Vn++)}for(;Ge<Ot;Ge++)ni[Hn[Ge]]=Ge;let Jn=!1;try{Jn=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ri=Jn;function Xn(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||ri))return new XMLHttpRequest}catch{}if(!e)try{return new ee[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Ma(){}function oi(){}const ii=function(){return new Xn({xdomain:!1}).responseType!=null}();class si extends It{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let o=location.port;o||(o=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||o!==e.port}const n=e&&e.forceBase64;this.supportsBinary=ii&&!n,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Ho(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Fo(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Kn()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ae(this.uri(),e)}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(o,i)=>{this.onError("xhr post error",o,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class ae extends ${constructor(e,n){super(),Xe(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.data=n.data!==void 0?n.data:null,this.create()}create(){var e;const n=Fn(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new Xn(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let o in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this.opts.extraHeaders[o])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var o;r.readyState===3&&((o=this.opts.cookieJar)===null||o===void 0||o.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(o){this.setTimeoutFn(()=>{this.onError(o)},0);return}typeof document<"u"&&(this.index=ae.requestsCount++,ae.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=oi,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ae.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(ae.requestsCount=0,ae.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Gn);else if(typeof addEventListener=="function"){const t="onpagehide"in ee?"pagehide":"unload";addEventListener(t,Gn,!1)}}function Gn(){for(let t in ae.requests)ae.requests.hasOwnProperty(t)&&ae.requests[t].abort()}const Mt=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Ze=ee.WebSocket||ee.MozWebSocket,Zn=!0,ai="arraybuffer",Qn=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ci extends It{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,r=Qn?{}:Fn(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=Zn&&!Qn?n?new Ze(e,n):new Ze(e):new Ze(e,n,r)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;St(r,this.supportsBinary,i=>{const a={};try{Zn&&this.ws.send(i)}catch{}o&&Mt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Kn()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}check(){return!!Ze}}class li extends It{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const n=Wo(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),o=Vo();o.readable.pipeTo(e.writable),this.writer=o.writable.getWriter();const i=()=>{r.read().then(({done:c,value:d})=>{c||(this.onPacket(d),i())}).catch(c=>{})};i();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this.writer.write(a).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;this.writer.write(r).then(()=>{o&&Mt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const di={websocket:ci,webtransport:li,polling:si},ui=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,pi=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Lt(t){if(t.length>2e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let o=ui.exec(t||""),i={},a=14;for(;a--;)i[pi[a]]=o[a]||"";return n!=-1&&r!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=hi(i,i.path),i.queryKey=fi(i,i.query),i}function hi(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function fi(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,i){o&&(n[o]=i)}),n}let er=class ze extends ${constructor(e,n={}){super(),this.binaryType=ai,this.writeBuffer=[],e&&typeof e=="object"&&(n=e,e=null),e?(e=Lt(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=Lt(n.host).host),Xe(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ei(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=qn,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new di[e](r)}open(){let e;if(this.opts.rememberUpgrade&&ze.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(e){let n=this.createTransport(e),r=!1;ze.priorWebsocketSuccess=!1;const o=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!r)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;ze.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(m(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function i(){r||(r=!0,m(),n.close(),n=null)}const a=p=>{const f=new Error("probe error: "+p);f.transport=n.name,i(),this.emitReserved("upgradeError",f)};function c(){a("transport closed")}function d(){a("socket closed")}function u(p){n&&p.name!==n.name&&i()}const m=()=>{n.removeListener("open",o),n.removeListener("error",a),n.removeListener("close",c),this.off("close",d),this.off("upgrading",u)};n.once("open",o),n.once("error",a),n.once("close",c),this.once("close",d),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",ze.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const n=this.upgrades.length;for(;e<n;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const n=new Error("server error");n.code=e.data,this.onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const o=this.writeBuffer[r].data;if(o&&(n+=Go(o)),r>0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(e,n,r){return this.sendPacket("message",e,n,r),this}send(e,n,r){return this.sendPacket("message",e,n,r),this}sendPacket(e,n,r,o){if(typeof n=="function"&&(o=n,n=void 0),typeof r=="function"&&(o=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:e,data:n,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),o&&this.once("flush",o),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){ze.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let r=0;const o=e.length;for(;r<o;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}};er.protocol=qn;function mi(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=Lt(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}const gi=typeof ArrayBuffer=="function",_i=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,tr=Object.prototype.toString,vi=typeof Blob=="function"||typeof Blob<"u"&&tr.call(Blob)==="[object BlobConstructor]",yi=typeof File=="function"||typeof File<"u"&&tr.call(File)==="[object FileConstructor]";function Dt(t){return gi&&(t instanceof ArrayBuffer||_i(t))||vi&&t instanceof Blob||yi&&t instanceof File}function Qe(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(Qe(t[n]))return!0;return!1}if(Dt(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Qe(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Qe(t[n]))return!0;return!1}function bi(t){const e=[],n=t.data,r=t;return r.data=Bt(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Bt(t,e){if(!t)return t;if(Dt(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Bt(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Bt(t[r],e));return n}return t}function wi(t,e){return t.data=Pt(t.data,e),delete t.attachments,t}function Pt(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Pt(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Pt(t[n],e));return t}const xi=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ki=5;var N;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(N||(N={}));class Ei{constructor(e){this.replacer=e}encode(e){return(e.type===N.EVENT||e.type===N.ACK)&&Qe(e)?this.encodeAsBinary({type:e.type===N.EVENT?N.BINARY_EVENT:N.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===N.BINARY_EVENT||e.type===N.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=bi(e),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function nr(t){return Object.prototype.toString.call(t)==="[object Object]"}class Ut extends ${constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===N.BINARY_EVENT;r||n.type===N.BINARY_ACK?(n.type=r?N.EVENT:N.ACK,this.reconstructor=new Ai(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Dt(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(N[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===N.BINARY_EVENT||r.type===N.BINARY_ACK){const i=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const a=e.substring(i,n);if(a!=Number(a)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(a)}if(e.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(i,n)}else r.nsp="/";const o=e.charAt(n+1);if(o!==""&&Number(o)==o){const i=n+1;for(;++n;){const a=e.charAt(n);if(a==null||Number(a)!=a){--n;break}if(n===e.length)break}r.id=Number(e.substring(i,n+1))}if(e.charAt(++n)){const i=this.tryParse(e.substr(n));if(Ut.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case N.CONNECT:return nr(n);case N.DISCONNECT:return n===void 0;case N.CONNECT_ERROR:return typeof n=="string"||nr(n);case N.EVENT:case N.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&xi.indexOf(n[0])===-1);case N.ACK:case N.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Ai{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=wi(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const zi=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ut,Encoder:Ei,get PacketType(){return N},protocol:ki},Symbol.toStringTag,{value:"Module"}));function oe(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const Ci=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class rr extends ${constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[oe(e,"open",this.onopen.bind(this)),oe(e,"packet",this.onpacket.bind(this)),oe(e,"error",this.onerror.bind(this)),oe(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(Ci.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const r={type:N.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const a=this.ids++,c=n.pop();this._registerAckCallback(a,c),r.id=a}const o=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!o||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,n){var r;const o=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(o===void 0){this.acks[e]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);n.call(this,new Error("operation has timed out"))},o),a=(...c)=>{this.io.clearTimeoutFn(i),n.apply(this,c)};a.withError=!0,this.acks[e]=a}emitWithAck(e,...n){return new Promise((r,o)=>{const i=(a,c)=>a?o(a):r(c);i.withError=!0,n.push(i),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((o,...i)=>r!==this._queue[0]?void 0:(o!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:N.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case N.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case N.EVENT:case N.BINARY_EVENT:this.onevent(e);break;case N.ACK:case N.BINARY_ACK:this.onack(e);break;case N.DISCONNECT:this.ondisconnect();break;case N.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...o){r||(r=!0,n.packet({type:N.ACK,id:e,data:o}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:N.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function be(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}be.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0},be.prototype.reset=function(){this.attempts=0},be.prototype.setMin=function(t){this.ms=t},be.prototype.setMax=function(t){this.max=t},be.prototype.setJitter=function(t){this.jitter=t};class $t extends ${constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Xe(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new be({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const o=n.parser||zi;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new er(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=oe(n,"open",function(){r.onopen(),e&&e()}),i=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},a=oe(n,"error",i);if(this._timeout!==!1){const c=this._timeout,d=this.setTimeoutFn(()=>{o(),i(new Error("timeout")),n.close()},c);this.opts.autoUnref&&d.unref(),this.subs.push(()=>{this.clearTimeoutFn(d)})}return this.subs.push(o),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(oe(e,"ping",this.onping.bind(this)),oe(e,"data",this.ondata.bind(this)),oe(e,"error",this.onerror.bind(this)),oe(e,"close",this.onclose.bind(this)),oe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Mt(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new rr(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ne={};function et(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=mi(t,e.path||"/socket.io"),r=n.source,o=n.id,i=n.path,a=Ne[o]&&i in Ne[o].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||a;let d;return c?d=new $t(r,e):(Ne[o]||(Ne[o]=new $t(r,e)),d=Ne[o]),n.query&&!e.query&&(e.query=n.queryKey),d.socket(n.path,e)}Object.assign(et,{Manager:$t,Socket:rr,io:et,connect:et});const Ti=["new-support-message","updated-support-message","deleted-support-message","new-customer-message","thread-closed","thread-reopened","thread-assigned","thread-reassigned","support-typing","presence-updated","conversations-paused"];function Si(t,e,n){const r=et(t,{path:"/socket"});let o=!1,i=0,a;for(const c of Ti)r.on(c,d=>n.event(c,d));return r.on("connect",()=>{i=0;const c=Ct();r.emit("identify",{jwt:e,...c?{pageUrl:c}:{}}),n.status(!0)}),r.on("disconnect",c=>{n.status(!1),c==="io server disconnect"&&!o&&(a=setTimeout(()=>r.connect(),Math.min(3e4,1e3*2**i++)))}),r.on("connect_error",()=>n.status(!1)),r.on("error",c=>{c?.message==="Invalid token"&&n.invalidToken()}),{close(){o=!0,clearTimeout(a),r.removeAllListeners(),r.disconnect()}}}const Ni="Customer support";function or(t){const e=t;return!e?.displayName||e.displayName===Ni?null:{displayName:e.displayName,displayAvatarURL:e.displayAvatarURL??"",status:e.status??"offline"}}function ji(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n)|0;return(e>>>0).toString(36)}function ir(t){return t.id?`id:${t.id}`:`d:${t.date}:${t.support?"s":"c"}:${ji(t.content??"")}:${t.attachments?.length??0}`}function tt(t,e){const n=ir(t);return{key:e.get(n)??n,sid:n,from:t.support?"agent":"me",authorName:t.authorName??"",...t.authorAvatarURL?{authorAvatarURL:t.authorAvatarURL}:{},text:t.content??"",date:Number(t.date),attachments:Array.isArray(t.attachments)?t.attachments:[],emojis:t.emojis??{}}}const sr=(t,e)=>t.date-e.date;function ar(t,e){return{threadId:t,status:"open",csMember:null,messages:[],lastMessageDate:e}}function cr(t,e){const n=new Set,r=[];for(const o of t.messages??[]){if(!Number.isFinite(Number(o?.date)))continue;const i=tt(o,e);n.has(i.sid)||(n.add(i.sid),r.push(i))}return r.sort(sr),{threadId:t.threadId,status:t.status==="closed"?"closed":"open",csMember:or(t.csMember),messages:r,lastMessageDate:r[r.length-1]?.date??(Number(t.lastMessageDate)||Date.now())}}function lr(t,e){const n=t.messages.findIndex(o=>o.sid===e.sid),r=n===-1?[...t.messages,e].sort(sr):t.messages.map((o,i)=>i===n?{...e,key:o.key}:o);return{...t,messages:r,lastMessageDate:Math.max(t.lastMessageDate,e.date)}}function dr(t,e,n){if(e){const r=t.messages.find(o=>o.sid===`id:${e}`);if(r)return r}return t.messages.find(r=>r.from==="agent"&&r.date===n)}function ur(t,e,n){return{...t,messages:t.messages.map(r=>r.sid===e?{...r,...n}:r)}}function Ri(t,e){return{...t,messages:t.messages.filter(n=>n.sid!==e)}}function nt(t,e){let n=!1;const r={...t};for(const o of Object.values(t))o.status==="open"&&o.threadId!==e&&(r[o.threadId]={...o,status:"closed"},n=!0);return n?r:t}function pr(t){return Object.values(t).sort((e,n)=>n.lastMessageDate-e.lastMessageDate)}function rt(t){return pr(t).find(e=>e.status==="open")??null}function ot(t){return t.guild.acceptingConversations!==!1}function hr(t){return ot(t)||t.open||rt(t.conversations)!==null}function Ii(t){if(!t)return 0;for(let e=t.messages.length-1;e>=0;e--)if(t.messages[e].from==="agent")return t.messages[e].date;return 0}function fr(t,e){const n=rt(t);return n?n.messages.filter(r=>r.from==="agent"&&!r.deleted&&r.date>e).length:0}function Oi(t,e){const n=t.messages.filter(r=>r.from==="agent").map(r=>r.date).sort((r,o)=>o-r);return e<=0?n[0]??0:e>=n.length?0:n[e]}function Mi(t){for(let e=t.messages.length-1;e>=0;e--)if(t.messages[e].from==="agent"&&t.messages[e].authorName)return t.messages[e].authorName;return null}function mr(t){try{const e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}}function Li(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function qt(t){try{localStorage.removeItem(t)}catch{}}function Di(t){try{const e=document.cookie.split("; ").find(n=>n.startsWith(`${t}=`));return e?decodeURIComponent(e.slice(t.length+1)):null}catch{return null}}function Bi(t){try{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`}catch{}}const gr={name:"",email:"",avatarUrl:"",verifiedUserId:null,metadata:null};function Pi(){return{boot:"loading",activeAt:null,guild:{},dark:!1,locale:"en",open:!1,view:"chat",nav:0,navPrev:null,activeThreadId:null,identity:gr,token:null,conversations:{},synced:!1,past:"idle",outbox:[],tray:[],typing:{},connection:"off",lastReadAt:0,events:{},preview:null,lightbox:null,notice:null}}const Ui=30,_r=200,Ft=t=>`deskcord:${t}`,J=t=>typeof t=="string",je=t=>typeof t=="number"&&Number.isFinite(t);function $i(t){return!t||!J(t.sid)||!J(t.key)||!je(t.date)?null:{key:t.key,sid:t.sid,from:t.from==="me"?"me":"agent",authorName:J(t.authorName)?t.authorName:"",...J(t.authorAvatarURL)?{authorAvatarURL:t.authorAvatarURL}:{},text:J(t.text)?t.text:"",date:t.date,attachments:Array.isArray(t.attachments)?t.attachments:[],emojis:t.emojis&&typeof t.emojis=="object"?t.emojis:{},...t.edited?{edited:!0}:{}}}function qi(t){if(!t||!J(t.threadId)||!t.threadId)return null;const e=(Array.isArray(t.messages)?t.messages:[]).map($i).filter(n=>!!n).slice(-_r);return{threadId:t.threadId,status:t.status==="open"?"open":"closed",csMember:t.csMember??null,messages:e,lastMessageDate:je(t.lastMessageDate)?t.lastMessageDate:e[e.length-1]?.date??0}}function vr(t){return{name:J(t?.name)?t.name:"",email:J(t?.email)?t.email:"",avatarUrl:J(t?.avatarUrl)?t.avatarUrl:"",verifiedUserId:J(t?.verifiedUserId)?t.verifiedUserId:null,metadata:In(t?.metadata,()=>{})}}function Fi(){const t=mr("discord-widget-storage"),e=Di("discord-widget");if(!t&&!e)return null;const n=t?.state??{},r=e||(J(n.token)&&n.token?n.token:null);return qt("discord-widget-storage"),qt("deskcord_last_read"),qt("deskcord_unread_count"),Bi("discord-widget"),{token:r,identity:vr({name:n.username,email:n.email,avatarUrl:n.avatarUrl,verifiedUserId:n.verifiedUserId}),conversations:{},lastReadAt:0,guild:{},activeAt:null,outbox:[]}}function yr(t){const e=mr(Ft(t));if(!e||e.v!==1)return Fi();const n={};for(const o of Array.isArray(e.conversations)?e.conversations:[]){const i=qi(o);i&&(n[i.threadId]=i)}const r=(Array.isArray(e.outbox)?e.outbox:[]).filter(o=>J(o?.localId)&&J(o?.text)&&o.text).map(o=>({localId:o.localId,text:o.text,state:o.state==="held"||o.state==="queued"?o.state:"failed",progress:0,attempts:0,createdAt:je(o.createdAt)?o.createdAt:Date.now()}));return{token:J(e.token)&&e.token?e.token:null,identity:vr(e.identity),conversations:n,lastReadAt:je(e.lastReadAt)?e.lastReadAt:0,guild:e.guild&&typeof e.guild=="object"?e.guild:{},activeAt:je(e.activeAt)?e.activeAt:null,outbox:r}}function Hi(t,e){const n=Object.values(e.conversations).sort((o,i)=>i.lastMessageDate-o.lastMessageDate).slice(0,Ui).map(o=>({...o,messages:o.messages.filter(i=>!i.deleted).slice(-_r)})),r={v:1,token:e.token,identity:e.identity,conversations:n,lastReadAt:e.lastReadAt,guild:e.guild,activeAt:e.activeAt,outbox:e.outbox.filter(o=>!o.file&&o.text).map(({localId:o,text:i,state:a,createdAt:c})=>({localId:o,text:i,state:a,createdAt:c}))};Li(Ft(t),r)}var he,D,Ht,br,it=0,wr=[],P=M,xr=P.__b,kr=P.__r,Er=P.diffed,Ar=P.__c,zr=P.unmount,Cr=P.__;function Re(t,e){P.__h&&P.__h(D,t,it||e),it=0;var n=D.__H||(D.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function H(t){return it=1,Tr(jr,t)}function Tr(t,e,n){var r=Re(he++,2);if(r.t=t,!r.__c&&(r.__=[jr(void 0,e),function(c){var d=r.__N?r.__N[0]:r.__[0],u=r.t(d,c);d!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=D,!D.u)){var o=function(c,d,u){if(!r.__c.__H)return!0;var m=r.__c.__H.__.filter(function(f){return!!f.__c});if(m.every(function(f){return!f.__N}))return!i||i.call(this,c,d,u);var p=r.__c.props!==c;return m.forEach(function(f){if(f.__N){var w=f.__[0];f.__=f.__N,f.__N=void 0,w!==f.__[0]&&(p=!0)}}),i&&i.call(this,c,d,u)||p};D.u=!0;var i=D.shouldComponentUpdate,a=D.componentWillUpdate;D.componentWillUpdate=function(c,d,u){if(this.__e){var m=i;i=void 0,o(c,d,u),i=m}a&&a.call(this,c,d,u)},D.shouldComponentUpdate=o}return r.__N||r.__}function de(t,e){var n=Re(he++,3);!P.__s&&Wt(n.__H,e)&&(n.__=t,n.i=e,D.__H.__h.push(n))}function I(t,e){var n=Re(he++,4);!P.__s&&Wt(n.__H,e)&&(n.__=t,n.i=e,D.__h.push(n))}function T(t){return it=5,st(function(){return{current:t}},[])}function st(t,e){var n=Re(he++,7);return Wt(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function Sr(t){var e=D.context[t.__c],n=Re(he++,9);return n.c=t,e?(n.__==null&&(n.__=!0,e.sub(D)),e.props.value):t.__}function Vi(){for(var t;t=wr.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(at),t.__H.__h.forEach(Vt),t.__H.__h=[]}catch(e){t.__H.__h=[],P.__e(e,t.__v)}}P.__b=function(t){D=null,xr&&xr(t)},P.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Cr&&Cr(t,e)},P.__r=function(t){kr&&kr(t),he=0;var e=(D=t.__c).__H;e&&(Ht===D?(e.__h=[],D.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(e.__h.forEach(at),e.__h.forEach(Vt),e.__h=[],he=0)),Ht=D},P.diffed=function(t){Er&&Er(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(wr.push(e)!==1&&br===P.requestAnimationFrame||((br=P.requestAnimationFrame)||Wi)(Vi)),e.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),Ht=D=null},P.__c=function(t,e){e.some(function(n){try{n.__h.forEach(at),n.__h=n.__h.filter(function(r){return!r.__||Vt(r)})}catch(r){e.some(function(o){o.__h&&(o.__h=[])}),e=[],P.__e(r,n.__v)}}),Ar&&Ar(t,e)},P.unmount=function(t){zr&&zr(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{at(r)}catch(o){e=o}}),n.__H=void 0,e&&P.__e(e,n.__v))};var Nr=typeof requestAnimationFrame=="function";function Wi(t){var e,n=function(){clearTimeout(r),Nr&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);Nr&&(e=requestAnimationFrame(n))}function at(t){var e=D,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),D=e}function Vt(t){var e=D;t.__c=t.__(),D=e}function Wt(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function jr(t,e){return typeof e=="function"?e(t):e}function Yi(t){let e=t;const n=new Set;return{get:()=>e,set(r){const o=typeof r=="function"?r(e):r;e={...e,...o},n.forEach(i=>i())},subscribe(r){return n.add(r),()=>n.delete(r)}}}function Ki(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null||Array.isArray(t)!==Array.isArray(e))return!1;const n=Object.keys(t);return n.length!==Object.keys(e).length?!1:n.every(r=>Object.is(t[r],e[r]))}function Ji(t,e,n=Ki){const[,r]=Tr(c=>c+1,0),o=T(e);o.current=e;const i=e(t.get()),a=T(i);return a.current=i,I(()=>{const c=()=>{n(o.current(t.get()),a.current)||r(0)},d=t.subscribe(c);return c(),d},[t,n]),i}const Rr=["image/png","image/jpeg","image/gif","image/webp","application/pdf"],Xi=10*1024*1024,Ir=10,we=2e3,Gi=8e3,Zi=12*60*60*1e3,Qi=5*60*1e3,es=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Or=256,ts=2048,Mr=t=>es.test(t.trim()),Yt=t=>`${t}${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`,ns=()=>document.visibilityState==="visible"&&document.hasFocus();function Lr(t){try{const e=JSON.parse(atob(t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/")));return Number.isFinite(e.exp)?e.exp*1e3:null}catch{return null}}function rs(t){return typeof t!="string"||!t?"":!/^https:\/\/\S+$/i.test(t)||t.length>ts?(console.warn("[Deskcord] avatarUrl ignored: it must be an https:// URL of at most 2048 characters."),""):t}function os(t){const e=[];let n=t;for(;n.length>we;){let r=n.lastIndexOf(`
2
+ `,we);r<we/2&&(r=n.lastIndexOf(" ",we)),r<we/2&&(r=we),e.push(n.slice(0,r).trim()),n=n.slice(r).trim()}return n&&e.push(n),e}function is(t){const e=Yi(Pi()),{get:n,set:r}=e,o=Mo(t,()=>ne()),i=new Map,a=new Map,c=new Map;let d=null,u=0,m=!1,p,f=null,w=0;const x=[];let E,k,z=0,y=0,R=!1,A=!1;function O(l){w>0?x.push(l):l()}function U(){for(;w===0&&x.length;)x.shift()()}function Y(){ot(n())&&r(l=>({guild:{...l.guild,acceptingConversations:!1}}))}function ne(){r({boot:"hidden",open:!1,activeAt:null}),C()}function q(l,h,v=!1){let g=!0;return r(b=>{const S=b.conversations[l];if(!S&&!v)return g=!1,{};g=!!S;const j=S??ar(l,Date.now());let V={...b.conversations,[l]:h(j)};return S||(V=nt(V,l)),{conversations:V}}),g}function G(l){const h=rt(l.conversations);return h?{view:"chat",activeThreadId:h.threadId}:Object.keys(l.conversations).length||l.token?{view:"home",activeThreadId:null}:{view:"chat",activeThreadId:null}}function K(){R||n().open||r(l=>G(l))}function Z(){const l=n().token;if(!l)return;d?.close();const h=u;r({connection:"connecting"}),setTimeout(()=>{h===u&&!n().synced&&Ee()},3e3),d=Si(t.domain,l,{event:(v,g)=>{h===u&&la(v,g)},status:v=>{h===u&&re(v)},invalidToken:()=>{h===u&&on()}})}function C(){d?.close(),d=null,n().connection!=="off"&&r({connection:"off"})}function re(l){const h=n().connection;l?(r({connection:"up"}),Ee(),_e()):h==="up"&&r({connection:"down"})}async function Ee(){const{token:l,synced:h}=n();if(!l)return;const v=u;z=Date.now();try{const[g,b]=await Promise.all([o.current(l),h?Promise.resolve(null):o.unreadCount(l).catch(()=>null)]);if(v!==u)return;O(()=>ca(g,b))}catch(g){if(v!==u)return;g instanceof ye&&(g.status===401||g.status===403)&&on()}}function Le(){clearTimeout(E),E=setTimeout(()=>void Ee(),400)}function ca(l,h){let v=!1;r(g=>{let b=nt(g.conversations,l?.threadId??null),S=g.lastReadAt;if(l){const j=cr(l,i);if(b={...b,[j.threadId]:j},h!==null){const V=Oi(j,h);v=g.lastReadAt>V,S=Math.max(g.lastReadAt,V)}}return{conversations:b,lastReadAt:S,synced:!0}}),v&&_o(),K()}async function on(){const l=n();if(l.identity.verifiedUserId){Pe();return}if(C(),r({token:null}),l.identity.name)try{await ao()}catch{}}function ao(){const l=n().token;if(l)return Promise.resolve(l);if(!f){const h=u;f=(async()=>{const{name:v,email:g,avatarUrl:b,metadata:S}=n().identity;if(!v)throw new Error("Missing name");const j=await o.token({name:v,email:g,avatarUrl:b,metadata:S});if(h!==u)throw new Error("Visitor changed");return r({token:j}),Z(),j})().finally(()=>{f=null})}return f}function la(l,h){const v=h??{},g=v.threadId;switch(l){case"conversations-paused":Y();return;case"presence-updated":r(b=>({guild:{...b.guild,onlineCsMembers:Array.isArray(v.onlineCsMembers)?v.onlineCsMembers:[]}}));return;case"new-support-message":g&&v.message&&da(g,v.message);return;case"new-customer-message":if(g&&v.message){const b=v.message;O(()=>lo(g,b))}return;case"updated-support-message":g&&v.message&&ua(g,v.message);return;case"deleted-support-message":g&&pa(g,v.messageId,v.messageDate);return;case"thread-closed":g&&(q(g,b=>({...b,status:"closed"})),sn(g));return;case"thread-reopened":g&&(r(b=>({conversations:nt(b.conversations,g),events:co(b,g,"reopened")})),q(g,b=>({...b,status:"open"}))||Le());return;case"thread-assigned":case"thread-reassigned":{if(!g)return;const b=or(v.csMember);q(g,j=>({...j,csMember:b}),!0)||Le(),l==="thread-reassigned"&&b&&r(j=>({events:co(j,g,"handoff",b.displayName)}));return}case"support-typing":g&&ha(g);return}}function co(l,h,v,g){return{...l.events,[h]:[...l.events[h]??[],{key:Yt("e"),kind:v,date:Date.now(),name:g}]}}function lo(l,h){const v=tt(h,i);return Number.isFinite(v.date)?(q(l,b=>lr({...b,status:"open"},v),!0)||Le(),v):null}function da(l,h){const v=lo(l,h);if(sn(l),!v)return;n().open||r({preview:{threadId:l,key:v.key}})}function ua(l,h){const v=n().conversations[l],g=v&&dr(v,h.id,h.date);if(!g)return;const b=tt(h,i);q(l,S=>ur(S,g.sid,{text:b.text,attachments:b.attachments,emojis:b.emojis,edited:!0}))}function pa(l,h,v){const g=n().conversations[l],b=g&&dr(g,h,v);b&&(q(l,S=>ur(S,b.sid,{deleted:!0})),setTimeout(()=>q(l,S=>Ri(S,b.sid)),400))}function ha(l){clearTimeout(c.get(l)),c.set(l,setTimeout(()=>sn(l),Gi)),n().typing[l]||r(h=>({typing:{...h.typing,[l]:!0}}))}function sn(l){clearTimeout(c.get(l)),c.delete(l),n().typing[l]&&r(h=>({typing:{...h.typing,[l]:!1}}))}function uo(l){const h={localId:Yt("l"),progress:0,attempts:0,createdAt:Date.now(),...l};return r(v=>({outbox:[...v.outbox,h]})),h}function De(l,h){r(v=>({outbox:v.outbox.map(g=>g.localId===l?{...g,...h}:g)}))}function po(l){r(h=>({outbox:h.outbox.filter(v=>v.localId!==l)}))}async function _e(){if(!m){m=!0;try{for(;;){const l=n();if(l.boot==="hidden")break;const h=l.outbox.find(v=>v.state==="queued");if(!h||!await fa(h))break}}finally{m=!1}}}async function fa(l){const h=u,v=l.attempts+1;De(l.localId,{state:"sending",progress:0,attempts:v}),w++;try{const g=await ao();if(l.file){const b=await o.upload(g,l.file,S=>De(l.localId,{progress:S}));h===u&&ho(l,{threadId:b.threadId,id:b.id,date:Number.isFinite(b.date)?b.date:Date.now(),content:"",attachments:b.attachments??[]})}else{const b=await o.send(g,n().identity.name,l.text??"");h===u&&ho(l,{threadId:b.threadId,id:b.id,date:b.date,content:l.text??"",attachments:[]})}return!0}catch(g){return h!==u?!0:g instanceof zn?(po(l.localId),!1):g instanceof Cn?(r(S=>({outbox:S.outbox.map(j=>j.localId===l.localId||j.state==="queued"?{...j,state:"failed"}:j)})),Y(),!1):(g instanceof zt||g instanceof ye&&(g.status===401||g.status>=500))&&v<3?(De(l.localId,{state:"queued"}),g instanceof ye&&g.status===401&&await on(),clearTimeout(p),p=setTimeout(()=>void _e(),2e3*v),!1):(De(l.localId,{state:"failed"}),!0)}finally{w--,U()}}function ho(l,h){const v={id:h.id,content:h.content,authorName:n().identity.name,support:!1,date:h.date,attachments:h.attachments};i.set(ir(v),l.localId),l.fileInfo?.previewUrl&&a.set(l.localId,l.fileInfo.previewUrl);const g=tt(v,i);r(b=>{const S=nt(b.conversations,h.threadId),j=S[h.threadId]??ar(h.threadId,h.date),V=b.activeThreadId,Q=V===null||V===h.threadId||b.conversations[V]?.status==="open";return{conversations:{...S,[h.threadId]:lr({...j,status:"open"},g)},outbox:b.outbox.filter(ue=>ue.localId!==l.localId),activeThreadId:Q?h.threadId:V}})}function fo(){n().outbox.some(l=>l.state==="held")&&(r(l=>({outbox:l.outbox.map(h=>h.state==="held"?{...h,state:"queued"}:h)})),_e())}let Be=Promise.resolve();function mo(l){return Be=Be.then(l).catch(h=>console.error("[Deskcord]",h)),Be}async function ma(){let l;do l=Be,await l;while(l!==Be)}function Pe(){u++,C(),i.clear(),a.forEach(l=>URL.revokeObjectURL(l)),a.clear(),c.forEach(clearTimeout),c.clear(),x.length=0,R=!1,r(l=>({token:null,identity:gr,conversations:{},outbox:[],tray:[],typing:{},lastReadAt:0,events:{},preview:null,synced:!1,past:"idle",view:"chat",activeThreadId:null,nav:l.nav+1})),ht()}function ga(l){const{identity:h,token:v}=n();if(h.verifiedUserId){const g=v?Lr(v):null,b=!!v&&(g===null||g>Date.now()),S=l?.userId===h.verifiedUserId&&!!l?.userHash;(l===null||!b&&!S)&&Pe()}l&&go(l)}function go(l){return mo(()=>va(l))}function _a(){return mo(Pe)}async function va(l){if(typeof l?.name!="string"||!l.name.trim()||typeof l.email!="string"||!Mr(l.email)){console.error("[Deskcord] identify() needs at least a name and a valid email.");return}const h=!!(l.userId&&l.userHash),v=n().identity;v.verifiedUserId&&(!h||String(l.userId)!==v.verifiedUserId)&&Pe();const g={name:l.name.trim().slice(0,Or),email:l.email.trim(),avatarUrl:rs(l.avatarUrl),metadata:In(l.metadata)},b=n().identity,S=b.name!==g.name||b.email!==g.email||b.avatarUrl!==g.avatarUrl||JSON.stringify(b.metadata)!==JSON.stringify(g.metadata);r(Q=>({identity:{...g,verifiedUserId:Q.identity.verifiedUserId}})),fo();const j=n().token;if(h){const Q=String(l.userId),ue=j?Lr(j):null;if(b.verifiedUserId===Q&&!S&&ue!==null&&ue-Date.now()>Zi)return;const ka=u,vo=await o.identify({...g,userId:Q,userHash:String(l.userHash)},j);if(ka!==u)return;if(vo){const Ea=b.verifiedUserId!==Q;r(Aa=>({token:vo,identity:{...Aa.identity,verifiedUserId:Q}})),Ea&&(r({past:"idle",synced:!1}),y=0,n().boot==="ready"&&Z());return}console.warn("[Deskcord] Identity verification failed: check that it's enabled (/identity-verification enable) and that userHash is HMAC-SHA256(secret, userId) computed on your server. Continuing without it."),b.verifiedUserId&&(Pe(),r({identity:{...g,verifiedUserId:null}}))}const V=n().token;if(V&&S)try{const Q=await o.token(g,V);r({token:Q})}catch{}}function Ue(){const l=n();if(!l.open||l.view!=="chat"||!l.activeThreadId||!ns())return;const h=Ii(l.conversations[l.activeThreadId]);h>l.lastReadAt&&(r({lastReadAt:h}),_o())}function _o(){clearTimeout(k),k=setTimeout(()=>{const{token:l,lastReadAt:h}=n();l&&h&&o.markRead(l,h).catch(()=>{})},600)}let an,pt=null;function ya(l){return{token:l.token,identity:l.identity,conversations:l.conversations,lastReadAt:l.lastReadAt,guild:l.guild,activeAt:l.activeAt,outbox:l.outbox}}function ht(){clearTimeout(an);const l=ya(n());pt=l,Hi(t.appId,l)}function ba(){const l=n(),h=pt;h&&h.token===l.token&&h.identity===l.identity&&h.conversations===l.conversations&&h.lastReadAt===l.lastReadAt&&h.guild===l.guild&&h.activeAt===l.activeAt&&h.outbox===l.outbox||(clearTimeout(an),an=setTimeout(ht,300))}function wa(l){if(l.key!==Ft(t.appId))return;const h=yr(t.appId),v=n();!h||h.token===v.token||(u++,C(),i.clear(),pt=h,r({token:h.token,identity:h.identity,conversations:h.conversations,lastReadAt:h.lastReadAt,outbox:[],synced:!1,past:"idle",activeThreadId:null,view:"chat",nav:v.nav+1}),r(g=>G(g)),h.token&&v.boot==="ready"&&Z())}async function xa(){const l=yr(t.appId);l&&(r({...l}),pt=null),r(b=>G(b)),ga(t.user),e.subscribe(ba),e.subscribe(Ue),ht();const h=n().activeAt;h&&Date.now()-h<7*24*60*60*1e3&&r({boot:"ready"});let v=!1,g=null;try{[v,g]=await Promise.all([o.status(),o.settings().catch(()=>null)])}catch{v=!1}if(!v){ne();return}r(b=>({boot:"ready",activeAt:Date.now(),guild:g?{...b.guild,...g}:b.guild})),A&&Ae.open(),await ma(),n().token&&Z(),_e()}if(typeof window<"u"){window.addEventListener("storage",wa),window.addEventListener("pagehide",ht),window.addEventListener("online",()=>void _e());const l=()=>{Ue(),document.visibilityState==="visible"&&n().connection==="up"&&Date.now()-z>3e4&&Ee()};document.addEventListener("visibilitychange",l),window.addEventListener("focus",l)}const Ae={open(){if(n().boot!=="ready"){A=n().boot==="loading";return}hr(n())&&(A=!1,r({open:!0,preview:null}),Ue(),n().view==="home"&&Ae.loadPast())},close(){r({open:!1,lightbox:null})},toggle(){n().open?Ae.close():Ae.open()},goHome(){R=!0,r(l=>({view:"home",nav:l.nav+1,navPrev:l.activeThreadId})),Ae.loadPast()},openConversation(l){R=!0;const h=n();if(h.view==="chat"&&h.activeThreadId===l){r({preview:null}),Ue();return}r(v=>({view:"chat",activeThreadId:l,nav:v.nav+1,navPrev:v.activeThreadId,preview:null})),Ue()},newConversation(){R=!0;const l=rt(n().conversations);r(h=>({view:"chat",activeThreadId:l?.threadId??null,nav:h.nav+1,navPrev:h.activeThreadId}))},dismissPreview(){r({preview:null})},async loadPast(l=!1){const h=n();if(!h.token||h.past==="loading"||!l&&h.past==="done"&&Date.now()-y<Qi)return;const v=u;r({past:"loading"});try{const g=await o.past(h.token);if(v!==u)return;y=Date.now(),r(b=>{const S={...b.conversations};for(const j of g)!j?.threadId||S[j.threadId]?.status==="open"||(S[j.threadId]={...cr(j,i),status:"closed"});return{conversations:S,past:"done"}})}catch{v===u&&r({past:"error"})}},send(l){const h=n(),v=!h.identity.name,g=v?"held":"queued";h.activeThreadId&&h.conversations[h.activeThreadId]?.status==="closed"&&r({activeThreadId:null});for(const b of os(l.trim()))uo({text:b,state:g});for(const b of h.tray)uo({state:g,file:b.file,fileInfo:{name:b.file.name||"image.png",size:b.file.size,type:b.file.type,previewUrl:b.previewUrl,width:b.width,height:b.height}});r({tray:[]}),v||_e()},completeIntro(l,h){r(v=>({identity:{...v.identity,name:l.trim().slice(0,Or),email:h.trim()}})),fo()},retry(l){De(l,{state:"queued",attempts:0}),_e()},discard(l){const h=n().outbox.find(v=>v.localId===l);h?.fileInfo?.previewUrl&&URL.revokeObjectURL(h.fileInfo.previewUrl),po(l)},addFiles(l){let h=null;const v=[];for(const g of l){if(!Rr.includes(g.type)){h=_("file_type_error",{name:g.name});continue}if(g.size>Xi){h=_("file_size_error",{name:g.name});continue}if(n().tray.length+v.length>=Ir){h=We("file_count_error",Ir);break}const b=g.type.startsWith("image/"),S={id:Yt("f"),file:g,previewUrl:b?URL.createObjectURL(g):null,width:4,height:3};if(v.push(S),S.previewUrl){const j=new Image;j.onload=()=>{const V=j.naturalWidth||4,Q=j.naturalHeight||3;r(ue=>({tray:ue.tray.map(ce=>ce.id===S.id?{...ce,width:V,height:Q}:ce)})),r(ue=>({outbox:ue.outbox.map(ce=>ce.fileInfo&&ce.fileInfo.previewUrl===S.previewUrl?{...ce,fileInfo:{...ce.fileInfo,width:V,height:Q}}:ce)}))},j.src=S.previewUrl}}return v.length&&r(g=>({tray:[...g.tray,...v]})),h&&r({notice:{text:h,at:Date.now()}}),h},removeFromTray(l){const h=n().tray.find(v=>v.id===l);h?.previewUrl&&URL.revokeObjectURL(h.previewUrl),r(v=>({tray:v.tray.filter(g=>g.id!==l)}))},openLightbox(l,h,v){r({lightbox:{url:l,name:h,from:v}})},closeLightbox(){r({lightbox:null})},clearNotice(){r({notice:null})},setLocale(l){To(l),n().locale!==l&&r({locale:l})},setDark(l){n().dark!==l&&r({dark:l})}};return{store:e,actions:Ae,boot:xa,identify:go,logout:_a,localPreview:l=>a.get(l)??null}}const ss="#5865F2",as=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;function ct(t){const e=t?.trim().match(as);if(!e)return null;let n=e[1];n.length===3&&(n=[...n].map(o=>o+o).join(""));const r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function Dr([t,e,n]){const r=o=>(o/=255,o<=.03928?o/12.92:((o+.055)/1.055)**2.4);return .2126*r(t)+.7152*r(e)+.0722*r(n)}function xe(t,e){const[n,r]=[Dr(t),Dr(e)].sort((o,i)=>i-o);return(n+.05)/(r+.05)}const Br=(t,e,n)=>t.map((r,o)=>Math.round(r+(e[o]-r)*n)),Ie=t=>`rgb(${t.join(",")})`,fe=[255,255,255],lt=[17,19,24],Pr=[0,0,0];function cs(t){const e=ct(t.primary)??ct(ss),n=ct(t.gradient)??Br(e,Pr,.17),r=xe(e,fe)>=2.6?fe:lt,o=Math.min(xe(e,fe),xe(n,fe)),i=Math.min(xe(e,lt),xe(n,lt)),a=ct(t.headerText)??(o>=2.6||o>=i?fe:lt),c=t.dark?[43,45,49]:fe;let d=e;for(let u=0;u<24&&xe(d,c)<4.5;u++)d=Br(d,t.dark?fe:Pr,.08);return{vars:{"--dc-accent":Ie(e),"--dc-accent-2":Ie(n),"--dc-on-accent":Ie(r),"--dc-on-grad":Ie(a),"--dc-accent-text":Ie(d),"--dc-accent-soft":`rgba(${e.join(",")},${t.dark?.24:.14})`},flat:e.join()===n.join()}}const te={out:"cubic-bezier(.22,1,.36,1)",spring:"cubic-bezier(.34,1.45,.64,1)",in:"cubic-bezier(.4,0,1,1)"},ls=typeof matchMedia=="function"?matchMedia("(prefers-reduced-motion: reduce)"):null;function Kt(){return!ls?.matches}function B(t,e,n={}){return!t||typeof t.animate!="function"?null:t.animate(e,{duration:300,easing:te.out,fill:"backwards",...n,...Kt()?{}:{duration:1,delay:0}})}function ds(t){return t?t.finished.then(()=>{},()=>{}):Promise.resolve()}function Ur(t){return t.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}const us=/\.(gif|jpe?g|png|webp|apng)$/i,$r=/https?:\/\/[^\s<]+[^\s<.,:;!?"')\]]/g;function ps(t){try{const{protocol:e,pathname:n}=new URL(t);return(e==="https:"||e==="http:")&&us.test(n)}catch{return!1}}function hs(t){const e=[],n=t.replace($r,r=>ps(r)?(e.push(r),""):r);return{text:e.length?n.replace(/[ \t]{2,}/g," ").trim():t,images:e}}function fs(t,e,n,r){return r[t]?.imageURL??`https://cdn.discordapp.com/emojis/${n}.${e?"gif":"webp"}?size=48`}function qr(t,e={}){let n=Ur(t);const r=[],o=i=>`${r.push(i)-1}`;return n=n.replace(/```(?:[a-z0-9+-]*\n)?([\s\S]*?)```/gi,(i,a)=>o(`<pre><code>${a.replace(/^\n+|\n+$/g,"")}</code></pre>`)),n=n.replace(/`([^`\n]+)`/g,(i,a)=>o(`<code>${a}</code>`)),n=n.replace(/&lt;(a?):(\w+):(\d+)&gt;/g,(i,a,c,d)=>o(`<img class="dc-cemoji" alt=":${c}:" title=":${c}:" src="${Ur(fs(`<${a}:${c}:${d}>`,a==="a",d,e))}">`)),n=n.replace(/\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/g,(i,a,c)=>o(`<a href="${c}" target="_blank" rel="noopener noreferrer nofollow">${a}</a>`)),n=n.replace($r,i=>o(`<a href="${i}" target="_blank" rel="noopener noreferrer nofollow">${i.replace(/^https?:\/\//,"")}</a>`)),n=n.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<u>$1</u>").replace(/\*(?!\s)(.+?)\*/g,"<em>$1</em>").replace(/(^|[\s(])_(?!\s)(.+?)_(?=$|[\s).,!?])/gm,"$1<em>$2</em>").replace(/~~(.+?)~~/g,"<s>$1</s>").replace(/\|\|(.+?)\|\|/g,`<span class="dc-spoiler" tabindex="0" role="button" aria-label="${_("spoiler")}">$1</span>`).replace(/^&gt; (.*)$/gm,'<span class="dc-quote">$1</span>').replace(/^[-*] (?=\S)/gm,"• ").replace(/\n/g,"<br>"),n.replace(/\u0001(\d+)\u0001/g,(i,a)=>r[Number(a)])}const Fr=Intl.Segmenter,Hr=Fr?new Fr:null;function ms(t){const e=t.replace(/<a?:\w+:\d+>/g,"⭐").replace(/\s+/g,"");return!e||!/^(?:\p{Extended_Pictographic}|\p{Emoji_Modifier}|[\u{1F1E6}-\u{1F1FF}]|‍|️|⃣)+$/u.test(e)?!1:(Hr?[...Hr.segment(e)].length:[...e].length)<=3}function Vr(t){return t.replace(/<a?:(\w+):\d+>/g,":$1:").replace(/```[\s\S]*?```/g,"[code]").replace(/[*_`|~]/g,"").replace(/\s+/g," ").trim()}const gs={x:"M6 6l12 12M18 6 6 18",down:"m6 9 6 6 6-6",left:"m15 18-6-6 6-6",right:"m9 18 6-6-6-6",send:"M12 19V5M5.5 11.5 12 5l6.5 6.5",arrow:"M5 12h14M13 6l6 6-6 6",clip:"m20.5 11.5-8.3 8.3a5.2 5.2 0 0 1-7.4-7.4l8.6-8.6a3.5 3.5 0 0 1 4.9 4.9l-8.5 8.6a1.75 1.75 0 0 1-2.5-2.5l7.9-7.9",check:"m5 12.5 4.5 4.5L19 7.5",dl:"M12 4v11m-5-5 5 5 5-5M5 20h14",retry:"M4 12a8 8 0 0 1 14-5.3M20 4v4h-4M20 12a8 8 0 0 1-14 5.3M4 20v-4h4",plus:"M12 5v14M5 12h14",upload:"M12 16V4m-5 5 5-5 5 5M5 20h14",ext:"M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"};function L({name:t,size:e=18,class:n}){const r={width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:n};return t==="smile"?s("svg",{...r,children:[s("circle",{cx:"12",cy:"12",r:"9"}),s("path",{d:"M8.5 14.5a4.5 4.5 0 0 0 7 0"}),s("circle",{cx:"9",cy:"9.8",r:"1.1",fill:"currentColor",stroke:"none"}),s("circle",{cx:"15",cy:"9.8",r:"1.1",fill:"currentColor",stroke:"none"})]}):t==="clock"?s("svg",{...r,children:[s("circle",{cx:"12",cy:"12",r:"8.5"}),s("path",{d:"M12 7.5V12l3 2"})]}):t==="alert"?s("svg",{...r,children:[s("circle",{cx:"12",cy:"12",r:"9"}),s("path",{d:"M12 7.5v5.5"}),s("circle",{cx:"12",cy:"16.3",r:"1.2",fill:"currentColor",stroke:"none"})]}):s("svg",{...r,children:s("path",{d:gs[t]})})}function _s(){return s("svg",{width:"26",height:"26",viewBox:"0 0 24 24","aria-hidden":"true",children:[s("path",{fill:"currentColor",d:"M12 3.5c4.97 0 9 3.36 9 7.5s-4.03 7.5-9 7.5c-.98 0-1.92-.13-2.8-.37L5.1 20.1c-.5.25-1.06-.22-.9-.75l1.02-3.34C3.84 14.7 3 12.93 3 11c0-4.14 4.03-7.5 9-7.5Z"}),s("circle",{cx:"8.6",cy:"11",r:"1.25",fill:"var(--dc-accent)"}),s("circle",{cx:"12",cy:"11",r:"1.25",fill:"var(--dc-accent)"}),s("circle",{cx:"15.4",cy:"11",r:"1.25",fill:"var(--dc-accent)"})]})}function Wr(){return s("svg",{viewBox:"0 0 642 74","aria-label":"Deskcord",children:s("path",{fill:"currentColor",d:"M23.9 73.2C19.43 73.2 15.37 72.07 11.7 69.8 8.1 67.53 5.23 64.43 3.1 60.5 1.03 56.5 0 51.97 0 46.9c0-5.13 1.07-9.67 3.2-13.6 2.13-4 5.03-7.13 8.7-9.4 3.73-2.33 7.87-3.5 12.4-3.5 3.47 0 6.5.63 9.1 1.9 2.6 1.2 4.73 2.97 6.4 5.3V0h15v72H41.5l-1.7-6.5c-1 1.4-2.23 2.7-3.7 3.9-1.4 1.13-3.1 2.03-5.1 2.7-2 .73-4.37 1.1-7.1 1.1Zm3.9-13.1c2.47 0 4.63-.57 6.5-1.7 1.93-1.13 3.4-2.7 4.4-4.7 1.07-2 1.6-4.3 1.6-6.9s-.53-4.9-1.6-6.9c-1-2-2.47-3.57-4.4-4.7-1.87-1.13-4.03-1.7-6.5-1.7-2.4 0-4.57.57-6.5 1.7-1.87 1.13-3.33 2.7-4.4 4.7-1.07 2-1.6 4.27-1.6 6.8 0 2.6.53 4.93 1.6 7 1.07 2 2.53 3.57 4.4 4.7 1.93 1.13 4.1 1.7 6.5 1.7Zm58.81 13.1c-5.2 0-9.77-1.07-13.7-3.2-3.93-2.2-7.03-5.23-9.3-9.1-2.2-3.93-3.3-8.43-3.3-13.5 0-5.2 1.1-9.83 3.3-13.9 2.2-4.07 5.27-7.27 9.2-9.6 3.93-2.33 8.5-3.5 13.7-3.5 5.07 0 9.5 1.1 13.3 3.3 3.8 2.2 6.77 5.2 8.9 9 2.2 3.73 3.3 8.07 3.3 13 0 .67-.03 1.43-.1 2.3 0 .8-.07 1.63-.2 2.5H71.01v-8.7h25.7c-.13-2.8-1.17-5.03-3.1-6.7-1.87-1.73-4.2-2.6-7-2.6-2.13 0-4.07.5-5.8 1.5-1.73 1-3.13 2.5-4.2 4.5-1 2-1.5 4.53-1.5 7.6v3c0 2.33.43 4.4 1.3 6.2.93 1.8 2.23 3.2 3.9 4.2 1.73 1 3.77 1.5 6.1 1.5 2.2 0 4-.43 5.4-1.3 1.47-.93 2.6-2.1 3.4-3.5h15.3c-.93 3.2-2.53 6.1-4.8 8.7-2.27 2.53-5.030 4.57-8.3 6.1-3.27 1.47-6.87 2.2-10.8 2.2Zm51.43 0c-4.73 0-8.83-.73-12.3-2.2-3.4-1.53-6.1-3.6-8.1-6.2-1.93-2.6-3.03-5.53-3.3-8.8h14.9c.27 1.13.73 2.17 1.4 3.1.73.87 1.7 1.57 2.9 2.1 1.27.47 2.67.7 4.2.7 1.67 0 3-.2 4-.6 1.07-.47 1.87-1.07 2.4-1.8.53-.73.8-1.5.8-2.3 0-1.27-.4-2.23-1.2-2.9-.73-.67-1.83-1.2-3.3-1.6-1.47-.47-3.23-.9-5.3-1.3-2.4-.53-4.8-1.13-7.2-1.8-2.33-.73-4.43-1.630-6.3-2.7-1.8-1.07-3.27-2.43-4.4-4.1-1.07-1.73-1.6-3.83-1.6-6.3 0-3 .83-5.7 2.5-8.1 1.67-2.47 4.07-4.4 7.2-5.8 3.13-1.47 6.93-2.2 11.4-2.2 6.33 0 11.3 1.4 14.9 4.2 3.6 2.8 5.73 6.57 6.4 11.3h-14c-.4-1.33-1.23-2.33-2.5-3-1.27-.73-2.87-1.1-4.8-1.1-2.2 0-3.87.37-5 1.1-1.13.73-1.7 1.7-1.7 2.9 0 .8.37 1.53 1.1 2.2.8.6 1.93 1.13 3.4 1.6 1.47.47 3.27.93 5.4 1.4 4.07.87 7.57 1.8 10.5 2.8 3 1 5.33 2.47 7 4.4 1.67 1.87 2.47 4.6 2.4 8.2.07 3.27-.8 6.17-2.6 8.7-1.73 2.53-4.23 4.53-7.5 6-3.27 1.4-7.17 2.1-11.7 2.1Zm60.6-1.2-20.8-27.6 18.5-22.8h17.7l-24.9 29.2v-12L217.24 72h-18.6Zm-33.6 0V0h15v72h-15Zm74.47 1.2c-5.2 0-9.8-1.13-13.8-3.4-3.93-2.27-7.03-5.37-9.3-9.3-2.2-3.93-3.3-8.43-3.3-13.5 0-5.2 1.1-9.77 3.3-13.7 2.27-4 5.37-7.13 9.3-9.4 4-2.33 8.6-3.5 13.8-3.5 6.6 0 12.13 1.73 16.6 5.2 4.53 3.47 7.4 8.3 8.6 14.5h-15.9c-.6-2.13-1.73-3.8-3.4-5-1.67-1.2-3.67-1.8-6-1.8-2.2 0-4.13.57-5.8 1.7-1.6 1.07-2.87 2.63-3.8 4.7-.93 2-1.4 4.37-1.4 7.1 0 2.07.27 3.93.8 5.6.53 1.67 1.27 3.1 2.2 4.3 1 1.2 2.17 2.13 3.5 2.8 1.33.6 2.83.9 4.5.9 1.6 0 3-.27 4.2-.8 1.27-.53 2.33-1.3 3.2-2.3.93-1 1.6-2.23 2-3.7h15.9c-1.2 6-4.07 10.77-8.6 14.3-4.53 3.53-10.07 5.3-16.6 5.3Zm55.02 0c-4.87 0-9.23-1.13-13.1-3.4-3.87-2.27-6.93-5.37-9.2-9.3-2.27-4-3.4-8.53-3.4-13.6 0-5.2 1.13-9.77 3.4-13.7 2.27-4 5.33-7.13 9.2-9.4 3.93-2.27 8.3-3.4 13.1-3.4 4.93 0 9.33 1.13 13.2 3.4 3.87 2.27 6.93 5.4 9.2 9.4 2.27 3.93 3.4 8.47 3.4 13.6 0 5.13-1.13 9.7-3.4 13.7-2.27 3.93-5.33 7.03-9.2 9.3-3.87 2.27-8.27 3.4-13.2 3.4Zm0-13c2 0 3.77-.5 5.3-1.5 1.6-1 2.87-2.5 3.8-4.5.93-2 1.4-4.47 1.4-7.4s-.47-5.4-1.4-7.4c-.93-2-2.17-3.5-3.7-4.5-1.53-1-3.3-1.5-5.3-1.5s-3.8.5-5.4 1.5c-1.53 1-2.77 2.5-3.7 4.5-.93 2-1.4 4.47-1.4 7.4s.47 5.4 1.4 7.4c.93 2 2.17 3.5 3.7 4.5 1.6 1 3.37 1.5 5.3 1.5Zm31.32 11.8V21.6h13.3l1.4 9.2c1.33-2.13 2.9-3.97 4.7-5.5 1.8-1.53 3.87-2.73 6.2-3.6 2.4-.87 4.97-1.3 7.7-1.3v15.9h-5c-2 0-3.83.23-5.5.7-1.6.4-3 1.1-4.2 2.1-1.13 1-2.03 2.37-2.7 4.1-.6 1.67-.9 3.77-.9 6.3V72h-15Zm58 1.2c-4.47 0-8.53-1.13-12.2-3.4-3.6-2.27-6.47-5.37-8.6-9.3-2.07-4-3.1-8.53-3.1-13.6 0-5.13 1.07-9.67 3.2-13.6 2.13-4 5.03-7.13 8.7-9.4 3.73-2.33 7.87-3.5 12.4-3.5 3.47 0 6.5.63 9.1 1.9 2.6 1.2 4.73 2.97 6.4 5.3V0h15v72h-13.3l-1.7-6.5c-1 1.4-2.23 2.7-3.7 3.9-1.4 1.13-3.1 2.03-5.1 2.7-2 .73-4.37 1.1-7.1 1.1Zm3.9-13.1c2.47 0 4.63-.57 6.5-1.7 1.93-1.13 3.4-2.7 4.4-4.7 1.07-2 1.6-4.3 1.6-6.9s-.53-4.9-1.6-6.9c-1-2-2.47-3.57-4.4-4.7-1.87-1.13-4.03-1.7-6.5-1.7-2.4 0-4.57.57-6.5 1.7-1.87 1.13-3.33 2.7-4.4 4.7-1.07 2-1.6 4.27-1.6 6.8 0 2.6.53 4.93 1.6 7 1.07 2 2.53 3.57 4.4 4.7 1.93 1.13 4.1 1.7 6.5 1.7Zm41.01 12.4c-2.73 0-4.97-.8-6.7-2.4-1.67-1.67-2.5-3.67-2.5-6 0-2.4.83-4.4 2.5-6 1.73-1.67 3.97-2.5 6.7-2.5 2.67 0 4.83.83 6.5 2.5 1.67 1.6 2.5 3.6 2.5 6 0 2.33-.83 4.33-2.5 6-1.67 1.6-3.83 2.4-6.5 2.4Zm38.66.7c-5.2 0-9.8-1.13-13.8-3.4-3.93-2.27-7.03-5.37-9.3-9.3-2.2-3.93-3.3-8.43-3.3-13.5 0-5.2 1.1-9.77 3.3-13.7 2.27-4 5.37-7.13 9.3-9.4 4-2.33 8.6-3.5 13.8-3.5 6.6 0 12.13 1.73 16.6 5.2 4.53 3.47 7.4 8.3 8.6 14.5h-15.9c-.6-2.13-1.73-3.8-3.4-5-1.67-1.2-3.67-1.8-6-1.8-2.2 0-4.13.57-5.8 1.7-1.6 1.07-2.87 2.63-3.8 4.7-.93 2-1.4 4.37-1.4 7.1 0 2.070.27 3.93.8 5.6.53 1.67 1.27 3.1 2.2 4.3 1 1.2 2.17 2.13 3.5 2.8 1.33.6 2.83.9 4.5.9 1.6 0 3-.27 4.2-.8 1.27-.53 2.33-1.3 3.2-2.3.93-1 1.6-2.23 2-3.7h15.9c-1.2 6-4.07 10.77-8.6 14.3-4.53 3.53-10.07 5.3-16.6 5.3ZM498.24 72V0h15v28.8c1.6-2.53 3.77-4.57 6.5-6.1 2.73-1.53 5.93-2.3 9.6-2.3 4.27 0 7.83.9 10.7 2.7 2.87 1.8 5.03 4.43 6.5 7.9 1.47 3.4 2.2 7.53 2.2 12.4V72h-14.9V44.8c0-3.73-.8-6.63-2.4-8.7-1.53-2.07-4-3.1-7.4-3.1-2 0-3.83.5-5.5 1.5-1.67 1-2.97 2.43-3.9 4.3-.93 1.8-1.4 3.97-1.4 6.5V72h-15Zm74.19 1.2c-4.2 0-7.7-.67-10.5-2-2.73-1.33-4.77-3.13-6.1-5.4-1.27-2.33-1.9-4.9-1.9-7.7 0-3 .73-5.63 2.2-7.9 1.53-2.33 3.9-4.17 7.1-5.5 3.2-1.4 7.23-2.1 12.1-2.1h12.2c0-2.27-.3-4.13-.9-5.6-.53-1.47-1.43-2.57-2.7-3.3-1.27-.73-3-1.1-5.2-1.1-2.33 0-4.3.47-5.9 1.4-1.6.93-2.6 2.4-3 4.4h-14.4c.33-3.6 1.5-6.73 3.5-9.4 2.07-2.67 4.8-4.77 8.2-6.3 3.4-1.53 7.3-2.3 11.7-2.3 4.8 0 8.97.8 12.5 2.4 3.53 1.53 6.27 3.8 8.2 6.8 2 3 3 6.73 3 11.2V72h-12.5l-1.8-7.3c-.73 1.27-1.6 2.43-2.6 3.5-1 1-2.17 1.9-3.5 2.7-1.33.73-2.8 1.3-4.4 1.7-1.6.4-3.37.6-5.3.6Zm3.7-11.4c1.6 0 3-.27 4.2-.8 1.2-.53 2.23-1.27 3.1-2.2.87-.93 1.57-2 2.1-3.2.6-1.27 1.03-2.63 1.3-4.1v-.1h-9.7c-1.67 0-3.07.23-4.2.7-1.07.4-1.87 1-2.4 1.8-.53.8-.8 1.73-.8 2.8 0 1.13.27 2.1.8 2.9.6.73 1.37 1.3 2.3 1.7 1 .33 2.1.5 3.3.5ZM632.3 72c-3.67 0-6.9-.57-9.7-1.7-2.8-1.2-4.97-3.13-6.5-5.8-1.53-2.67-2.3-6.3-2.3-10.9V34.1h-8.6V21.6h8.6l1.6-14.2h13.4v14.2h12.9v12.5h-12.9v19.7c0 2 .43 3.43 1.3 4.3.93.8 2.5 1.2 4.7 1.2h6.9V72h-9.4Z"})})}const Yr=wn(null),X=()=>Sr(Yr);function W(t){return Ji(X().store,t)}function ie(){return W(t=>t.locale)}function vs(t){const[,e]=H(0);de(()=>{const n=setInterval(()=>e(r=>r+1),t);return()=>clearInterval(n)},[t])}function ys(t,e,n,r,o={}){const[i,a]=H(t),c=T(t);c.current=t;const d=T(null);return I(()=>{if(t){d.current?.cancel(),d.current=null,i||a(!0);return}if(!i)return;const u=B(e.current,r,{duration:160,fill:"forwards",...o.exit});d.current=u,ds(u).then(()=>{!c.current&&d.current===u&&a(!1)})},[t]),I(()=>{t&&i&&B(e.current,n,{duration:380,...o.enter})},[t,i]),i}function bs(){const t=()=>document.visibilityState==="visible"&&document.hasFocus(),[e,n]=H(t);return de(()=>{const r=()=>n(t());return document.addEventListener("visibilitychange",r),window.addEventListener("focus",r),window.addEventListener("blur",r),()=>{document.removeEventListener("visibilitychange",r),window.removeEventListener("focus",r),window.removeEventListener("blur",r)}},[]),e}const Kr=()=>typeof matchMedia=="function"&&matchMedia("(pointer: fine)").matches,ws="(max-width: 520px), (max-height: 540px)",Jr="input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea";function xs(t,e,n){const r=getComputedStyle(t);return Math.abs(n)>=Math.abs(e)?!/auto|scroll/.test(r.overflowY)||t.scrollHeight<=t.clientHeight?!1:n>0?t.scrollTop>0:t.scrollTop+t.clientHeight<t.scrollHeight-1:!/auto|scroll/.test(r.overflowX)||t.scrollWidth<=t.clientWidth?!1:e>0?t.scrollLeft>0:t.scrollLeft+t.clientWidth<t.scrollWidth-1}function ks(t,e){I(()=>{const n=window.visualViewport,r=t.current,o=r?.parentElement;if(!e||!n||!r||!o||typeof matchMedia!="function")return;const i=matchMedia(ws),a=r.getRootNode(),c=()=>{const A=a.activeElement;return A?.matches(Jr)&&r.contains(A)?A:null},d=()=>{const A=c(),O=A?.closest(".dc-scroll");if(!A||!O)return;const U=A.getBoundingClientRect(),Y=O.getBoundingClientRect();U.bottom>Y.bottom?O.scrollTop+=U.bottom-Y.bottom+12:U.top<Y.top&&(O.scrollTop-=Y.top-U.top+12)};let u=0;const m=()=>{let A=0;if(i.matches&&c()&&(A=Math.round(window.innerHeight-n.height-n.offsetTop),A<80&&(A=0)),A===u)return;const O=A>u;u=A,r.style.setProperty("--dc-keyboard",`${A}px`),O&&d()};let p=0;const f=()=>{cancelAnimationFrame(p),p=requestAnimationFrame(m)},w=A=>{A.target===r&&A.propertyName==="padding-bottom"&&u&&d()};let x=0,E=0,k=!1;const z=A=>{x=A.touches[0].clientX,E=A.touches[0].clientY,k=!1},y=A=>{if(!i.matches||A.touches.length>1||!A.cancelable)return;const{clientX:O,clientY:U}=A.touches[0],Y=O-x,ne=U-E;Math.abs(Y)+Math.abs(ne)>6&&(k=!0),x=O,E=U;for(let q=A.target;q&&q!==o;q=q.parentElement)if(xs(q,Y,ne))return;A.preventDefault()},R=A=>{const O=A.target;!i.matches||k||!A.cancelable||!O.matches(Jr)||c()===O&&u||(A.preventDefault(),c()===O&&O.blur(),O.focus({preventScroll:!0}))};return m(),n.addEventListener("resize",m),n.addEventListener("scroll",m),i.addEventListener("change",m),o.addEventListener("focusin",f),o.addEventListener("focusout",f),r.addEventListener("transitionend",w),o.addEventListener("touchstart",z,{passive:!0}),o.addEventListener("touchmove",y,{passive:!1}),o.addEventListener("touchend",R),()=>{cancelAnimationFrame(p),n.removeEventListener("resize",m),n.removeEventListener("scroll",m),i.removeEventListener("change",m),o.removeEventListener("focusin",f),o.removeEventListener("focusout",f),r.removeEventListener("transitionend",w),o.removeEventListener("touchstart",z),o.removeEventListener("touchmove",y),o.removeEventListener("touchend",R),r.style.removeProperty("--dc-keyboard")}},[e])}function Es(t){let e=0;for(let n=0;n<t.length;n++)e=(e*31+t.charCodeAt(n))%360;return e}const Xr=t=>(t.trim()[0]??"?").toUpperCase();function me({name:t,url:e,size:n=28,status:r}){const[o,i]=H(!1);return s("span",{class:"dc-av",style:`--s:${n}px;--h:${Es(t)}`,title:t,children:[e&&!o?s("img",{src:e,alt:"",loading:"lazy",onError:()=>i(!0)}):Xr(t),r&&s("i",{class:`dot ${r}`})]})}function ge({member:t,size:e,withStatus:n}){return s(me,{name:t.displayName,url:t.displayAvatarURL,size:e,status:n?t.status:null})}function Oe({size:t=36,dot:e}){const{iconURL:n,name:r}=W(a=>({iconURL:a.guild.iconURL,name:a.guild.name})),[o,i]=H(!1);return s("span",{class:"dc-guild",style:`--s:${t}px`,children:[n&&!o?s("img",{src:n,alt:"",onError:()=>i(!0)}):Xr(r||"S"),e&&s("i",{class:`dot ${e}`})]})}const dt={online:3,idle:2,dnd:1};function Jt(t,e=3){return[...t].sort((n,r)=>(dt[r.status]??0)-(dt[n.status]??0)).slice(0,e).reverse()}function Xt(t){const e=[...t].sort((i,a)=>(dt[a.status]??0)-(dt[i.status]??0)).map(i=>i.displayName),[n,r,o]=e;return e.length===1?_("presence_1",{a:n}):e.length===2?_("presence_2",{a:n,b:r}):e.length===3?_("presence_3",{a:n,b:r,c:o}):We("presence_more",e.length-2,{a:n,b:r})}function As(t){return _(t==="online"?"status_online":t==="idle"?"status_idle":t==="dnd"?"status_dnd":"status_offline")}const ut=6e4,Gt=60*ut,Me=24*Gt;function ke(t){return new Date(t).toLocaleTimeString(At(),{hour:"2-digit",minute:"2-digit"})}function zs(t,e=Date.now()){if(!Number.isFinite(t))return"";const n=e-t;return n<ut?_("now"):n<Gt?_("minutes_short",{count:Math.floor(n/ut)}):n<Me&&new Date(t).getDate()===new Date(e).getDate()?ke(t):n<7*Me?_("days_short",{count:Math.max(1,Math.floor(n/Me))}):new Date(t).toLocaleDateString(At(),{day:"numeric",month:"short"})}function Cs(t,e=Date.now()){const n=new Date(e);return n.setHours(0,0,0,0),t>=n.getTime()?_("today"):t>=n.getTime()-Me?_("yesterday"):new Date(t).toLocaleDateString(At(),{weekday:"short",day:"numeric",month:"short"})}function Ts(t){const e=new Date(t);return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}function Zt(t){return Number.isFinite(t)?t<1024*1024?`${Math.max(1,Math.round(t/1024))} KB`:`${(t/1024/1024).toFixed(1)} MB`:""}function Qt(t){const e=t.lastIndexOf(".");return e>0&&e<t.length-1?t.slice(e+1).toUpperCase().slice(0,4):"FILE"}const Ss={MIN:ut,HOUR:Gt,DAY:Me};function Gr(){const{actions:t}=X();return s("button",{class:"dc-hbtn","aria-label":_("close_chat"),onClick:t.close,children:[s(L,{name:"x",size:20,class:"ic-x"}),s(L,{name:"down",size:22,class:"ic-down"})]})}function Ns(){const{actions:t}=X(),{guild:e,identity:n,conversations:r,past:o,lastReadAt:i,accepting:a}=W(k=>({guild:k.guild,accepting:ot(k),identity:k.identity,conversations:k.conversations,past:k.past,lastReadAt:k.lastReadAt}));vs(3e4),ie();const c=st(()=>pr(r),[r]),d=c.find(k=>k.status==="open"),u=c.filter(k=>k.status==="closed"&&k.messages.length),m=e.onlineCsMembers,p=Array.isArray(m)&&m.length===0,f=n.name.trim().split(/\s+/)[0],w=e.header_title||(f?_("hi_name",{name:f}):_("default_title")),x=p?e.offline_message||_("default_offline"):e.header_subtitle||_("default_subtitle"),E=d?d.messages.filter(k=>k.from==="agent"&&k.date>i).length:0;return s(F,{children:[s("header",{class:"dc-head dc-hero",children:[s("div",{class:"top",children:[s(Oe,{size:36}),s(Gr,{})]}),s("h2",{children:w}),s("p",{children:x}),m&&m.length>0&&s("div",{class:"dc-team",children:[s("span",{class:"stack",children:Jt(m).map(k=>s(ge,{member:k,size:30,withStatus:!0},k.displayName))}),s("span",{children:Xt(m)})]}),p&&s("div",{class:"dc-team",children:_("team_away")})]}),s("div",{class:"dc-home-body",children:[d?s("div",{class:"dc-card",children:[s("div",{class:"dc-eyebrow",children:_("ongoing")}),s("div",{class:"dc-list",children:s(Qr,{conv:d,unread:E,onOpen:()=>t.openConversation(d.threadId)})})]}):a?s("button",{class:"dc-card dc-cta",onClick:t.newConversation,children:[s("span",{class:"tx",children:[s("b",{children:_("cta_title")}),s("small",{children:_(p?"cta_reply_away":"cta_reply")})]}),s("span",{class:"go",children:s(L,{name:"arrow",size:18})})]}):s("div",{class:"dc-card dc-cta is-paused","aria-live":"polite",children:s("span",{class:"tx",children:[s("b",{children:_("paused_title")}),s("small",{children:_("paused_hint")})]})}),(u.length>0||o==="loading"||o==="error")&&s("div",{class:"dc-card",children:[s("div",{class:"dc-eyebrow",children:_("previous")}),s("div",{class:"dc-list",children:[u.map(k=>s(Qr,{conv:k,unread:0,onOpen:()=>t.openConversation(k.threadId)},k.threadId)),o==="loading"&&u.length===0&&s(F,{children:[s(Zr,{}),s(Zr,{})]})]}),o==="error"&&s("p",{class:"dc-empty",children:[_("past_error")," ",s("button",{onClick:()=>void t.loadPast(!0),children:_("try_again")})]})]}),s("a",{class:"dc-powered",href:"https://deskcord.chat",target:"_blank",rel:"noopener",children:[_("powered_by")," ",s(Wr,{})]})]})]})}function Zr(){return s("div",{class:"dc-skel-row","aria-hidden":"true",children:[s("i",{}),s("span",{children:[s("i",{}),s("i",{})]})]})}function js(t){for(let e=t.messages.length-1;e>=0;e--){const n=t.messages[e];if(n.deleted)continue;const r=n.text?Vr(n.text):n.attachments.length?n.attachments[0].contentType?.startsWith("image/")?_("snippet_image"):`📄 ${n.attachments[0].name}`:"";if(r)return n.from==="me"?_("snippet_you",{text:r}):r}return""}function Qr({conv:t,unread:e,onOpen:n}){const r=W(a=>a.guild.name);ie();const o=t.status==="closed",i=t.csMember?.displayName??Mi(t);return s("button",{class:`dc-conv${e?" is-unread":""}`,onClick:n,children:[t.csMember?s(ge,{member:t.csMember,size:40,withStatus:!o}):i?s(me,{name:i,size:40}):s(Oe,{size:40}),s("span",{class:"tx",children:[s("span",{class:"l1",children:[s("b",{children:i??r??_("support")}),s("time",{children:zs(t.lastMessageDate)})]}),s("span",{class:"l2",children:[o&&s("span",{class:"dc-pill ok",children:_("resolved")}),js(t)]})]}),e>0?s("span",{class:"count",children:e}):s("span",{class:"chev",children:s(L,{name:"right",size:16})})]})}const Rs=5*Ss.MIN;function Is(t,e,n,r){const o=[];let i="",a=null,c=!1,d=!1,u=!1;const m=x=>{const E=Ts(x);E!==i&&(o.push({type:"day",key:`day-${E}`,date:x}),i=E,a=null)},p=(x,E)=>{const k=a,z=!!k&&k.side===x&&E-k.date<Rs;if(z){const y=o[o.length-1];(y.type==="msg"||y.type==="out")&&(y.last=!1)}return a={side:x,date:E},!z},f=[...(t?.messages??[]).map(x=>({date:x.date,m:x})),...n.map(x=>({date:x.date,e:x}))].sort((x,E)=>x.date-E.date);for(const x of f){if(m(x.date),x.e){o.push({type:"event",key:x.e.key,e:x.e}),a=null;continue}const E=x.m;E.from==="agent"?(d=!0,c||(c=!0,o.push({type:"joined",key:`joined-${E.key}`,name:E.authorName,avatar:E.authorAvatarURL,date:E.date}),a=null)):u=!0;const k=p(E.from==="me"?"me":`a:${E.authorName}`,E.date);o.push({type:"msg",key:E.key,m:E,first:k,last:!0,status:!1})}let w=!1;for(const x of e){m(x.createdAt),u=!0;const E=p("me",x.createdAt);o.push({type:"out",key:x.localId,o:x,first:E,last:!0}),x.state==="held"&&(w=!0)}if(!e.length)for(let x=o.length-1;x>=0;x--){const E=o[x];if(E.type==="msg"&&E.m.from==="me"){E.status=!0;break}}return w&&o.push({type:"intro",key:"intro"}),r&&u&&!d&&t?.status!=="closed"&&o.push({type:"note",key:"offline-note",text:r}),t?.status==="closed"&&o.push({type:"resolved",key:"resolved",date:t.lastMessageDate}),o}const eo=wn({mounted:{current:!1}});function Os({items:t,member:e}){const n=T(!1);return I(()=>{n.current=!0},[]),s(eo.Provider,{value:{mounted:n},children:s("div",{class:"dc-msgs",onClick:r=>{const o=r.target.closest?.(".dc-spoiler");o&&o.classList.add("is-shown")},onKeyDown:r=>{const o=r.target;(r.key==="Enter"||r.key===" ")&&o.classList?.contains("dc-spoiler")&&(r.preventDefault(),o.classList.add("is-shown"))},children:t.map(r=>s(Ms,{item:r,member:e},r.key))})})}function Ms({item:t,member:e}){const{mounted:n}=Sr(eo),r=T(null);switch(ie(),I(()=>{if(!n.current)return;const o=t.type==="out"||t.type==="msg"&&t.m.from==="me",i=t.type==="msg"||t.type==="out";r.current&&(r.current.style.transformOrigin=o?"bottom right":i?"bottom left":"center"),B(r.current,[{opacity:0,transform:`translateY(10px) scale(${i?.94:.98})`},{opacity:1,transform:"none"}],{duration:420,easing:te.spring})},[]),t.type){case"day":return s("div",{ref:r,class:"dc-day",children:Cs(t.date)});case"joined":return s("div",{ref:r,class:"dc-event",children:[s(me,{name:t.name,url:t.avatar??(e?.displayName===t.name?e.displayAvatarURL:null),size:20}),s("span",{children:to("joined",t.name)}),s("time",{children:ke(t.date)})]});case"event":return s("div",{ref:r,class:"dc-event",children:[t.e.kind==="handoff"?s(F,{children:[s(me,{name:t.e.name??"?",size:20}),s("span",{children:to("handoff",t.e.name??"")})]}):s(F,{children:[s("span",{class:"ic",children:s(L,{name:"retry",size:12})}),s("span",{children:_("reopened")})]}),s("time",{children:ke(t.e.date)})]});case"resolved":return s("div",{ref:r,class:"dc-event ok",children:[s("span",{class:"ic",children:s(L,{name:"check",size:12})}),s("span",{children:_("resolved_event")})]});case"note":return s("div",{ref:r,class:"dc-event note",children:s("span",{children:t.text})});case"intro":return s("div",{ref:r,children:s(qs,{})});case"msg":return t.m.from==="me"?s(Ds,{ref_:r,m:t.m,first:t.first,last:t.last,status:t.status}):s(Ls,{ref_:r,m:t.m,first:t.first,last:t.last,member:e});case"out":return s(Bs,{ref_:r,o:t.o,first:t.first,last:t.last})}}function to(t,e){const[n,r=""]=_(t).split("{name}");return s(F,{children:[n,s("b",{children:e}),r]})}function en({text:t,emojis:e,edited:n}){const r=T(null),o=T(!0),{text:i,images:a}=hs(t);return I(()=>{if(o.current){o.current=!1;return}B(r.current,[{filter:"brightness(1.25) saturate(1.3)"},{filter:"none"}],{duration:900})},[t]),s(F,{children:[i&&s("div",{ref:r,class:`dc-bubble${ms(i)?" is-jumbo":""}`,dangerouslySetInnerHTML:{__html:qr(i,e)+(n?`<span class="dc-edited">${_("edited")}</span>`:"")}}),a.map(c=>s("img",{class:"dc-inline-img",src:c,alt:"",loading:"lazy"},c))]})}function tn(t,e,n,r=""){return`dc-row dc-row--${t}${e?" is-first":""}${n?" is-last":""}${r}`}function Ls({ref_:t,m:e,first:n,last:r,member:o}){const i=o&&o.displayName===e.authorName?o:null;return s("div",{ref:t,class:tn("agent",n,r,e.deleted?" is-deleted":""),title:ke(e.date),children:[s("div",{class:"dc-row-av",children:e.authorAvatarURL||!i?s(me,{name:e.authorName||"?",url:e.authorAvatarURL,size:28}):s(ge,{member:i,size:28})}),s("div",{class:"dc-stack",children:[s("div",{class:"dc-name",children:[s("b",{children:e.authorName}),ke(e.date)]}),s(en,{text:e.text,emojis:e.emojis,edited:e.edited}),s(ro,{list:e.attachments,localUrl:null})]})]})}function Ds({ref_:t,m:e,first:n,last:r,status:o}){const{localPreview:i}=X();return s("div",{ref:t,class:tn("me",n,r,o?" show-status":""),title:ke(e.date),children:s("div",{class:"dc-stack",children:[s(en,{text:e.text,emojis:e.emojis,edited:e.edited}),s(ro,{list:e.attachments,localUrl:i(e.key)}),s("div",{class:"dc-status",children:[s(L,{name:"check",size:12})," ",_("sent")]})]})})}function Bs({ref_:t,o:e,first:n,last:r}){const{actions:o}=X(),i=e.state==="failed",a=e.fileInfo,c=Math.round(e.progress*100);return s("div",{ref:t,class:tn("me",n,r,i?"":" is-pending"),children:s("div",{class:"dc-stack",children:[e.text&&s(en,{text:e.text,emojis:{}}),a&&(a.previewUrl?s("div",{class:`dc-img is-${i?"failed":"uploading"}`,style:`--w:${no(a.width,a.height)}px;aspect-ratio:${a.width}/${a.height}`,children:[s("img",{src:a.previewUrl,alt:a.name}),!i&&s(Ps,{value:e.state==="sending"?c:0}),i&&s("span",{class:"fail",children:[s(L,{name:"retry",size:20}),_("not_sent")]})]}):s("div",{class:`dc-file is-${i?"failed":"uploading"}`,children:[s("span",{class:"dc-ftype",children:Qt(a.name)}),s("span",{class:"tx",children:[s("b",{children:a.name}),s("small",{children:i?_("not_sent"):e.state==="sending"?_("uploading",{pct:c}):Zt(a.size)})]}),!i&&s("span",{class:"bar",children:s("i",{style:`width:${e.state==="sending"?c:0}%`})})]})),i?s("div",{class:"dc-status is-failed",children:[s(L,{name:"alert",size:13})," ",_("not_sent")," ·"," ",s("button",{onClick:()=>o.retry(e.localId),children:_("retry")})," ·"," ",s("button",{onClick:()=>o.discard(e.localId),children:_("remove")})]}):s("div",{class:"dc-status is-pending",children:[s(L,{name:"clock",size:12})," ",e.state==="held"?_("waiting_details"):_("sending")]})]})})}function Ps({value:t}){return s(F,{children:[s("svg",{class:"dc-ring",viewBox:"0 0 36 36","aria-hidden":"true",children:[s("circle",{class:"bg",cx:"18",cy:"18",r:"15"}),s("circle",{class:"fg",cx:"18",cy:"18",r:"15",pathLength:100,style:`stroke-dashoffset:${100-t}`})]}),s("span",{class:"pct",children:[t,"%"]})]})}const nn=t=>t.contentType?t.contentType.startsWith("image/"):/\.(png|jpe?g|gif|webp)$/i.test(t.name);function no(t,e){return!t||!e?232:e>t?Math.max(120,Math.round(232*t/e)):232}function ro({list:t,localUrl:e}){if(!t.length)return null;const n=t.filter(nn),r=t.filter(o=>!nn(o));return s(F,{children:[n.length>1?s("div",{class:"dc-gallery",children:n.map(o=>s(oo,{a:o,src:o.proxyURL||o.url},o.url))}):n[0]&&s(oo,{a:n[0],src:e??(n[0].proxyURL||n[0].url)}),r.map(o=>s($s,{a:o},o.url))]})}function oo({a:t,src:e}){const{actions:n}=X(),r=t.width&&t.height?`${t.width}/${t.height}`:"4/3";return s("button",{class:"dc-img",style:`--w:${no(t.width,t.height)}px;aspect-ratio:${r}`,"aria-label":_("open_image",{name:t.name}),onClick:o=>n.openLightbox(t.url||e,t.name,o.currentTarget.getBoundingClientRect()),children:s("img",{src:e,alt:t.name,loading:"lazy"})})}async function Us(t){try{const e=await fetch(t.url);if(!e.ok)throw new Error(String(e.status));const n=URL.createObjectURL(await e.blob()),r=document.createElement("a");r.href=n,r.download=t.name,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch{window.open(t.url,"_blank","noopener,noreferrer")}}function $s({a:t}){return s("button",{class:"dc-file",onClick:()=>void Us(t),"aria-label":_("download",{name:t.name}),children:[s("span",{class:`dc-ftype${nn(t)?" is-image":""}`,children:Qt(t.name)}),s("span",{class:"tx",children:[s("b",{children:t.name}),s("small",{children:[Zt(t.size)," · ",Qt(t.name)]})]}),s("span",{class:"dl",children:s(L,{name:"dl",size:16})})]})}function qs(){const{actions:t}=X(),e=W(p=>p.identity);ie();const[n,r]=H(e.name),[o,i]=H(e.email),[a,c]=H({}),d=T(null),u=T(null);I(()=>{Kr()&&setTimeout(()=>u.current?.focus({preventScroll:!0}),350)},[]);const m=p=>{p.preventDefault();const f={name:n.trim()?void 0:_("name_error"),email:!o.trim()||Mr(o)?void 0:_("email_error")};if(c(f),f.name||f.email){B(d.current,[{transform:"translateX(-5px)"},{transform:"translateX(5px)"},{transform:"translateX(-3px)"},{transform:"none"}],{duration:360});return}t.completeIntro(n,o)};return s("div",{class:"dc-intro",children:[s(Oe,{size:28}),s("div",{class:"card",ref:d,children:[s("h4",{children:_("intro_title")}),s("p",{children:_("intro_text")}),s("form",{onSubmit:m,noValidate:!0,children:[s("label",{class:`dc-in${a.name?" is-err":""}`,children:[s("span",{children:_("name")}),s("input",{ref:u,id:"dc-name",name:"name",autocomplete:"name",placeholder:"Ada Lovelace",maxLength:256,value:n,onInput:p=>r(p.currentTarget.value)}),a.name&&s("em",{children:a.name})]}),s("label",{class:`dc-in${a.email?" is-err":""}`,children:[s("span",{children:[_("email")," ",s("small",{children:_("optional")})]}),s("input",{id:"dc-email",name:"email",type:"email",autocomplete:"email",placeholder:"ada@example.com","aria-describedby":"dc-email-hint",value:o,onInput:p=>i(p.currentTarget.value)}),a.email?s("em",{children:a.email}):s("small",{id:"dc-email-hint",children:_("email_hint")})]}),s("button",{class:"dc-btn",type:"submit",children:[s(L,{name:"send",size:15})," ",_("send_message")]})]})]})]})}const io=[["😀","emoji_smileys","😀 😃 😄 😁 😆 😅 😂 🤣 😊 😇 🙂 😉 😍 🥰 😘 😋 😜 🤪 🤓 😎 🥳 😏 😒 😔 😕 🙁 😣 😩 🥺 😢 😭 😤 😠 🤯 😳 😱 🤗 🤔 🤫 😐 🙄 😬 😴 😷"],["👋","emoji_people","👋 🤚 ✋ 👌 🤌 ✌️ 🤞 🤟 🤘 👈 👉 👆 👇 👍 👎 ✊ 👊 👏 🙌 🫶 🙏 💪 ✍️ 👀"],["🎮","emoji_objects","💻 🖥️ ⌨️ 🖱️ 📱 🎮 🕹️ 🎧 📦 📎 📌 📝 📅 🔒 🔑 🛠️ ⚙️ 🧪 💡 🔋 📈 📉 🧾 💳 🗂️"],["❤️","emoji_symbols","❤️ 🧡 💛 💚 💙 💜 🖤 🤍 💯 ✅ ❌ ⚠️ ❓ ❗ 🔥 ✨ ⭐ 🎉 🎊 🚀 💬 🆗 🆒 ⏳ 🌊"]];function Fs({closed:t,paused:e,placeholder:n}){const{actions:r}=X(),{tray:o,notice:i}=W(y=>({tray:y.tray,notice:y.notice}));ie();const[a,c]=H(""),[d,u]=H(!1),m=T(null),p=T(null),f=T(null),w=T(null),x=T(t);I(()=>{const y=m.current;y&&(y.style.height="",y.style.height=`${Math.min(y.scrollHeight,128)}px`)},[a,t]),I(()=>{x.current!==t&&(B(w.current,[{opacity:0,transform:"translateY(10px)"},{opacity:1,transform:"none"}],{duration:380}),x.current=t)},[t]),de(()=>{if(!i)return;B(f.current,[{transform:"translateX(-5px)"},{transform:"translateX(5px)"},{transform:"translateX(-3px)"},{transform:"none"}],{duration:360});const y=setTimeout(r.clearNotice,3200);return()=>clearTimeout(y)},[i,r]);const E=!!a.trim()||o.length>0,k=()=>{E&&(r.send(a),c(""),u(!1),m.current?.focus({preventScroll:!0}))},z=y=>{const R=m.current,A=R?.selectionStart??a.length,O=R?.selectionEnd??a.length,U=a.slice(0,A)+y+a.slice(O);c(U),requestAnimationFrame(()=>{R&&(R.focus({preventScroll:!0}),R.selectionStart=R.selectionEnd=A+y.length)})};return e?s("footer",{class:"dc-composer",ref:w,children:[s("div",{class:"dc-resolved","aria-live":"polite",children:s("p",{children:_(t?"resolved_paused":"paused_text")})}),s(rn,{})]}):t?s("footer",{class:"dc-composer",ref:w,children:[s("div",{class:"dc-resolved",children:[s("p",{children:_("resolved_text")}),s("button",{class:"dc-btn",onClick:r.newConversation,children:[s(L,{name:"plus",size:16})," ",_("new_conversation")]})]}),s(rn,{})]}):s("footer",{class:"dc-composer",ref:w,children:[i&&s(Hs,{text:i.text},i.at),d&&s(Ws,{onPick:z,onClose:()=>u(!1)}),s("div",{class:"dc-field",ref:f,children:[o.length>0&&s("div",{class:"dc-tray",children:o.map(y=>s(Vs,{id:y.id,file:y.file,previewUrl:y.previewUrl,onRemove:()=>r.removeFromTray(y.id)},y.id))}),s("div",{class:"dc-input-row",children:[s("textarea",{ref:m,id:"dc-input",rows:1,"aria-label":_("message"),placeholder:n,value:a,onInput:y=>c(y.currentTarget.value),onKeyDown:y=>{y.key==="Enter"&&!y.shiftKey&&!y.isComposing&&Kr()&&(y.preventDefault(),k()),y.key==="Escape"&&d&&(y.preventDefault(),u(!1))},onPaste:y=>{const R=[...y.clipboardData?.files??[]];R.length&&(y.preventDefault(),r.addFiles(R))}}),s("button",{class:"dc-tool","aria-label":_("attach"),onClick:()=>p.current?.click(),children:s(L,{name:"clip",size:20})}),s("button",{class:"dc-tool","data-emoji-toggle":!0,"aria-label":_("emoji"),"aria-expanded":d,onClick:()=>u(y=>!y),children:s(L,{name:"smile",size:20})}),s("button",{class:"dc-send","aria-label":_("send"),disabled:!E,onClick:k,children:s(L,{name:"send",size:18})})]})]}),s("input",{ref:p,type:"file",multiple:!0,hidden:!0,accept:Rr.join(","),onChange:y=>{const R=y.currentTarget;r.addFiles([...R.files??[]]),R.value="",m.current?.focus({preventScroll:!0})}}),s(rn,{})]})}function rn(){return s("a",{class:"dc-powered",href:"https://deskcord.chat",target:"_blank",rel:"noopener",children:[_("powered_by")," ",s(Wr,{})]})}function Hs({text:t}){const e=T(null);return I(()=>{B(e.current,[{opacity:0,transform:"translateY(6px) scale(.96)"},{opacity:1,transform:"none"}],{duration:320,easing:te.spring})},[]),s("div",{class:"dc-toast",role:"alert",children:s("span",{ref:e,children:[s(L,{name:"alert",size:15}),t]})})}function Vs({file:t,previewUrl:e,onRemove:n}){const r=T(null);I(()=>{B(r.current,[{opacity:0,transform:"scale(.6)"},{opacity:1,transform:"none"}],{duration:420,easing:te.spring})},[]);const o=()=>{const c=B(r.current,[{opacity:1,transform:"none"},{opacity:0,transform:"scale(.6)"}],{duration:180,easing:te.in,fill:"forwards"});c?c.onfinish=n:n()},i=t.name||"image.png",a=s("button",{class:"rm","aria-label":_("remove_file",{name:i}),onClick:o,children:s(L,{name:"x",size:11})});return e?s("div",{class:"dc-chip img",ref:r,children:[s("img",{src:e,alt:i}),a]}):s("div",{class:"dc-chip file",ref:r,children:[s("span",{class:"dc-ftype",children:"PDF"}),s("span",{class:"tx",children:[s("b",{children:i}),s("small",{children:Zt(t.size)})]}),a]})}function Ws({onPick:t,onClose:e}){const[n,r]=H(0),o=T(null);I(()=>{B(o.current,[{opacity:0,transform:"translateY(8px) scale(.94)"},{opacity:1,transform:"none"}],{duration:340,easing:te.spring})},[]),de(()=>{const c=d=>{const u=d.composedPath();u.includes(o.current)||u.some(m=>m instanceof Element&&m.hasAttribute("data-emoji-toggle"))||e()};return document.addEventListener("pointerdown",c,!0),()=>document.removeEventListener("pointerdown",c,!0)},[e]);const[,i,a]=io[n];return s("div",{class:"dc-emoji",ref:o,role:"dialog","aria-label":_("emoji"),onKeyDown:c=>{c.key==="Escape"&&(c.preventDefault(),e())},children:[s("div",{class:"grid",children:[s("div",{class:"cat",children:_(i)}),a.split(" ").map(c=>s("button",{"aria-label":c,onClick:()=>t(c),children:c},c))]}),s("div",{class:"tabs",children:io.map(([c,d],u)=>s("button",{"aria-label":_(d),"aria-pressed":u===n,onClick:()=>r(u),children:c},d))})]})}const Ys=[],Ks=[];function Js({frozenThreadId:t}){const{actions:e}=X(),n=W(C=>C.activeThreadId),r=t!==void 0?t:n,o=W(C=>{const re=r?C.conversations[r]??null:null,Ee=!re||re.status==="open";return{conv:re,outbox:Ee?C.outbox:Ys,events:r&&C.events[r]||Ks,typing:!!(r&&C.typing[r]),guild:C.guild,identity:C.identity,open:C.open,accepting:ot(C),canGoBack:!!C.token||Object.keys(C.conversations).some(Le=>Le!==r)}}),{conv:i,outbox:a,events:c,typing:d,guild:u,identity:m,accepting:p}=o;ie();const f=u.onlineCsMembers,w=Array.isArray(f)&&f.length===0,x=w?u.offline_message||_("default_offline"):null,E=st(()=>Is(i,a,c,x),[i,a,c,x]),k=E.length===0,z=i?.status==="closed",y=i?.csMember??null,R=T(null),A=T(!0),[O,U]=H(!1),Y=E[E.length-1],ne=Y?.key,q=(()=>{const C=Y;return!!C&&(C.type==="out"||C.type==="intro"||C.type==="msg"&&C.m.from==="me")})(),G=C=>{const re=R.current;re&&re.scrollTo({top:re.scrollHeight,behavior:C&&Kt()?"smooth":"auto"})},K=T(!1);I(()=>{if(!K.current){K.current=!0,G(!1);return}A.current||q?G(!0):U(!0)},[ne,E.length]),I(()=>{d&&A.current&&G(!0)},[d]),I(()=>{o.open&&G(!1)},[o.open]),de(()=>{const C=R.current;if(!C||typeof ResizeObserver!="function")return;const re=new ResizeObserver(()=>{A.current&&G(!1)});return re.observe(C),()=>re.disconnect()},[]);const Z=m.name.trim().split(/\s+/)[0];return s(F,{children:[s("header",{class:"dc-head dc-head--compact",children:[o.canGoBack&&s("button",{class:"dc-hbtn","aria-label":_("all_conversations"),onClick:e.goHome,children:s(L,{name:"left",size:22})}),s(Xs,{memberKey:y?`${y.displayName}:${y.status}`:`g:${f?.length??"?"}`,children:y?s(F,{children:[s(ge,{member:y,size:38,withStatus:!0}),s("div",{class:"tx",children:[s("div",{class:"t",children:y.displayName}),s("div",{class:"s",children:s("span",{children:[u.name?`${u.name} · `:"",As(y.status)]})})]})]}):s(F,{children:[s(Oe,{size:38,dot:f?f.length?"online":"offline":null}),s("div",{class:"tx",children:[s("div",{class:"t",children:u.name||_("support")}),s("div",{class:"s",children:f&&f.length>0?s(F,{children:[s("span",{class:"mini",children:Jt(f).map(C=>s(ge,{member:C,size:16},C.displayName))}),s("span",{children:Xt(f)})]}):s("span",{children:_(w?"header_away":"cta_reply")})})]})]})}),s(Gr,{})]}),s(Zs,{}),s("div",{class:"dc-scroll-wrap",children:[s("div",{class:"dc-scroll",ref:R,role:"log","aria-live":"polite",onScroll:()=>{const C=R.current;C&&(A.current=C.scrollHeight-C.scrollTop-C.clientHeight<90,A.current&&O&&U(!1))},children:[k&&s("div",{class:"dc-welcome",children:[s("div",{class:"stack",children:f&&f.length>0?Jt(f).map(C=>s(ge,{member:C,size:44,withStatus:!0},C.displayName)):s(Oe,{size:48})}),s("h3",{children:Z&&m.verifiedUserId?_("welcome_name",{name:Z}):_("welcome")}),s("p",{children:w?u.offline_message||_("default_offline"):f&&f.length?_("welcome_presence",{presence:Xt(f)}):_("default_subtitle")})]}),s(Os,{items:E,member:y}),d&&!z&&s(Gs,{name:y?.displayName??_("support"),avatar:y?.displayAvatarURL})]}),O&&s("button",{class:"dc-jump",onClick:()=>{G(!0),U(!1)},children:[s(L,{name:"down",size:16})," ",_("jump_new")]})]}),s(Fs,{closed:z,paused:!p&&i?.status!=="open",placeholder:w?_("placeholder_away"):u.name?_("placeholder",{name:u.name}):_("placeholder_us")})]})}function Xs({memberKey:t,children:e}){const n=T(null),r=T(!0);return I(()=>{if(r.current){r.current=!1;return}B(n.current,[{opacity:0,transform:"translateY(6px)"},{opacity:1,transform:"none"}],{duration:340})},[t]),s("div",{class:"dc-head-id",ref:n,children:e})}function Gs({name:t,avatar:e}){const n=T(null);return I(()=>{n.current&&(n.current.style.transformOrigin="bottom left"),B(n.current,[{opacity:0,transform:"translateY(8px) scale(.9)"},{opacity:1,transform:"none"}],{duration:380,easing:te.spring})},[]),s("div",{class:"dc-typing",ref:n,role:"status","aria-label":_("typing",{name:t}),children:[s(me,{name:t,url:e,size:28}),s("div",{class:"dots",children:[s("i",{}),s("i",{}),s("i",{})]})]})}function Zs(){const t=W(a=>a.connection);ie();const[e,n]=H("none"),r=T(t),o=T(null);de(()=>{let a;return t==="down"?n("down"):t==="up"&&r.current==="down"?(n("back"),a=setTimeout(()=>n("none"),2200)):t==="off"&&n("none"),r.current=t,()=>clearTimeout(a)},[t]);const i=e!=="none";return I(()=>{i&&B(o.current,[{opacity:0,transform:"translateY(-100%)"},{opacity:1,transform:"none"}],{duration:300})},[i]),e==="none"?null:s("div",{ref:o,class:`dc-conn ${e==="down"?"is-down":"is-up"}`,role:"status",children:e==="down"?s(F,{children:[s("span",{class:"dc-spin"})," ",_("connection_lost")]}):s(F,{children:[s(L,{name:"check",size:14})," ",_("back_online")]})})}function Qs(){const{actions:t}=X(),e=W(c=>c.lightbox),n=T(null),r=T(null),o=T(!1),i=c=>{const d=e?.from,u=r.current;if(!d||!u||!Kt())return null;const m=u.getBoundingClientRect();if(!m.width)return null;const f=[{transform:`translate(${d.left-m.left}px, ${d.top-m.top}px) scale(${d.width/m.width}, ${d.height/m.height})`,borderRadius:"28px"},{transform:"none",borderRadius:"10px"}];return u.animate(c?f.reverse():f,{duration:c?320:460,easing:te.out,fill:c?"forwards":"backwards"})},a=()=>{if(o.current)return;o.current=!0;const c=i(!0);n.current?.querySelectorAll(".bd, .bar").forEach(d=>d.animate([{opacity:1},{opacity:0}],{duration:240,fill:"forwards"})),c?c.onfinish=()=>t.closeLightbox():t.closeLightbox()};return I(()=>{if(!e)return;o.current=!1,B(n.current?.querySelector(".bd"),[{opacity:0},{opacity:1}],{duration:300}),B(n.current?.querySelector(".bar"),[{opacity:0,transform:"translateY(-8px)"},{opacity:1,transform:"none"}],{duration:300,delay:120});const c=r.current;c?.complete?i(!1):c&&(c.onload=()=>i(!1))},[e]),de(()=>{if(!e)return;const c=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),a())};return document.addEventListener("keydown",c,!0),()=>document.removeEventListener("keydown",c,!0)},[e]),e?s("div",{class:"dc-lightbox",ref:n,role:"dialog","aria-label":e.name,children:[s("div",{class:"bd",onClick:a}),s("div",{class:"bar",children:[s("span",{children:e.name}),s("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:[s(L,{name:"ext",size:15})," ",_("open_original")]}),s("button",{class:"x","aria-label":_("close"),onClick:a,children:s(L,{name:"x",size:18})})]}),s("div",{class:"pic",onClick:a,children:s("img",{ref:r,src:e.url,alt:e.name})})]}):null}function ea(){const{boot:t,dark:e,locale:n,guild:r,available:o}=W(c=>({boot:c.boot,dark:c.dark,locale:c.locale,guild:c.guild,available:hr(c)})),i=st(()=>cs({primary:r.primary_color,gradient:r.gradient_color,headerText:r.header_text_color,dark:e}),[r.primary_color,r.gradient_color,r.header_text_color,e]),a=Object.entries(i.vars).map(([c,d])=>`${c}:${d}`).join(";");return ta(),t!=="ready"||!o?null:s("div",{class:"dc",lang:n,"data-theme":e?"dark":"light","data-pos":r.widget_position==="bottom-left"?"left":"right","data-flat":i.flat?"":void 0,style:a,children:[s(ra,{}),s(oa,{}),s(na,{}),s(Qs,{})]})}function ta(){const{open:t,unread:e}=W(i=>({open:i.open,unread:fr(i.conversations,i.lastReadAt)})),n=bs(),r=ie(),o=e>0&&(!t||!n);de(()=>{if(!o)return;const i=We("title_flash",e);let a=document.title,c=!1;const d=()=>{!c&&document.title!==i&&(a=document.title),c=!c,document.title=c?i:a};d();const u=setInterval(d,2500);return()=>{clearInterval(u),document.title===i&&(document.title=a)}},[o,e,r])}function na(){const{actions:t}=X(),{open:e,unread:n}=W(c=>({open:c.open,unread:fr(c.conversations,c.lastReadAt)})),r=T(null),o=T(null),i=T(n);ie(),I(()=>{B(r.current,[{opacity:0,transform:"scale(.4)"},{opacity:1,transform:"none"}],{duration:520,delay:120,easing:te.spring})},[]),I(()=>{n>i.current&&B(o.current,[{transform:"scale(0)"},{transform:"scale(1.25)",offset:.6},{transform:"scale(1)"}],{duration:420}),i.current=n},[n]);const a=n>0&&!e;return s("button",{ref:r,class:`dc-launcher${e?" is-open":""}${a?" has-unread":""}`,"aria-label":e?_("close_chat"):a?We("open_chat_unread",n):_("open_chat"),"aria-expanded":e,onClick:t.toggle,children:[s("span",{class:"ic ic-chat",children:s(_s,{})}),s("span",{class:"ic ic-close",children:s(L,{name:"down",size:24})}),a&&s("span",{class:"dc-badge",ref:o,"aria-hidden":"true",children:n>99?"99+":n})]})}function ra(){const{actions:t}=X(),e=W(p=>{if(!p.preview||p.open)return null;const f=p.conversations[p.preview.threadId],w=f?.messages.find(x=>x.key===p.preview.key&&!x.deleted);return w?{threadId:f.threadId,message:w,member:f.csMember}:null}),n=T(null),r=T(e);ie(),e&&(r.current=e);const o=ys(!!e,n,[{opacity:0,transform:"translateY(12px) scale(.94)"},{opacity:1,transform:"none"}],[{opacity:1},{opacity:0,transform:"translateY(6px) scale(.97)"}],{enter:{duration:460,easing:te.spring}}),i=e??r.current;if(!o||!i)return null;const{message:a,member:c,threadId:d}=i,u=c?.displayName??a.authorName,m=a.text?qr(Vr(a.text),a.emojis):a.attachments.some(p=>!p.contentType?.startsWith("image/"))?_("preview_file"):_("preview_image");return s("div",{ref:n,class:"dc-preview",role:"button",tabIndex:0,"aria-label":_("preview_from",{name:u}),onClick:()=>{t.openConversation(d),t.open()},onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.click()},children:[c?s(ge,{member:c,size:34,withStatus:!0}):s(me,{name:u,size:34}),s("div",{style:"min-width:0",children:[s("div",{class:"who",children:s("b",{children:u})}),s("div",{class:"txt",dangerouslySetInnerHTML:{__html:m}})]}),s("button",{class:"x","aria-label":_("dismiss"),onClick:p=>{p.stopPropagation(),t.dismissPreview()},children:s(L,{name:"x",size:12})})]})}function oa(){const{actions:t}=X(),{open:e,view:n}=W(f=>({open:f.open,view:f.view})),r=T(null),[o,i]=H(e),[a,c]=H(e),[d,u]=H(!1),m=T(0);if(ie(),ks(r,a),I(()=>{if(e){i(!0),c(!0);return}if(!a)return;const f=r.current?.getRootNode()?.activeElement;f&&r.current?.contains(f)&&f.blur();const w=r.current?.animate([{opacity:1,transform:"none"},{opacity:0,transform:"translateY(10px) scale(.96)"}],{duration:170,easing:te.in});if(!w){c(!1);return}return w.onfinish=()=>c(!1),()=>w.cancel()},[e]),I(()=>{if(!e||!a)return;const f=r.current;B(f,[{opacity:0},{opacity:1}],{duration:180}),B(f,[{transform:"translateY(18px) scale(.92)"},{transform:"none"}],{duration:520,easing:te.spring,composite:"add"}),f?.querySelectorAll(".dc-hero > *, .dc-home-body > *, .dc-welcome > *, .dc-head-id, .dc-composer").forEach((w,x)=>B(w,[{opacity:0,transform:"translateY(8px)"},{opacity:1,transform:"none"}],{duration:420,delay:60+x*35}))},[e,a]),!o)return null;const p=f=>n==="chat"&&!!f.dataTransfer?.types.includes("Files");return s("section",{ref:r,class:"dc-panel",role:"dialog","aria-label":_("chat"),hidden:!a,onKeyDown:f=>{f.key==="Escape"&&!f.defaultPrevented&&t.close()},onDragEnter:f=>{p(f)&&(f.preventDefault(),m.current++===0&&u(!0))},onDragOver:f=>{d&&f.preventDefault()},onDragLeave:()=>{m.current>0&&--m.current===0&&u(!1)},onDrop:f=>{d&&(f.preventDefault(),m.current=0,u(!1),t.addFiles([...f.dataTransfer?.files??[]]))},children:[s(sa,{}),d&&s(ia,{})]})}function ia(){const t=T(null);return I(()=>{B(t.current,[{opacity:0,transform:"scale(.98)"},{opacity:1,transform:"none"}],{duration:200})},[]),s("div",{class:"dc-drop",ref:t,children:[s("div",{class:"ic",children:s(L,{name:"upload",size:26})}),s("b",{children:_("drop_title")}),s("small",{children:_("drop_hint")})]})}function sa(){const{store:t}=X(),{view:e,nav:n}=W(a=>({view:a.view,nav:a.nav})),r=`${e}:${n}`,[o,i]=H(()=>[{key:r,view:e,threadId:t.get().activeThreadId}]);return I(()=>{i(a=>a[a.length-1].key===r?a:[{...a[a.length-1],threadId:t.get().navPrev},{key:r,view:e,threadId:null}])},[r]),s("div",{class:"dc-views",children:o.map((a,c)=>s(aa,{leaving:c<o.length-1,animateIn:o.length>1,back:e==="home",onGone:()=>i(d=>d.filter(u=>u.key!==a.key)),children:a.view==="home"?s(Ns,{}):s(Js,{frozenThreadId:c<o.length-1?a.threadId:void 0})},a.key))})}function aa({leaving:t,animateIn:e,back:n,onGone:r,children:o}){const i=T(null),a=n?-28:28;return I(()=>{e&&B(i.current,[{transform:`translateX(${a}%)`,opacity:0},{transform:"none",opacity:1}],{duration:340})},[]),I(()=>{if(!t)return;const c=B(i.current,[{transform:"none",opacity:1},{transform:`translateX(${-a}%)`,opacity:0}],{duration:300,fill:"forwards"}),d=setTimeout(r,340);return c&&(c.onfinish=r),()=>clearTimeout(d)},[t]),s("div",{ref:i,class:"dc-view",inert:t,style:t?"pointer-events:none":void 0,children:o})}function so(){if(document.getElementById("deskcord-root"))return;const t=No();if(!t)return;const e=is(t),n=window.deskcord;n.openChatbox=()=>e.actions.open(),n.closeChatbox=()=>e.actions.close(),n.identify=e.identify,n.logout=()=>{e.logout()};let r=t.theme;const o=matchMedia("(prefers-color-scheme: dark)"),i=()=>e.actions.setDark(r==="dark"||r==="auto"&&o.matches);n.setTheme=m=>{if(m!=="light"&&m!=="dark"&&m!=="auto"){console.error(`[Deskcord] setTheme: unknown theme "${String(m)}" (use "light", "dark" or "auto").`);return}r=m,i()},i(),o.addEventListener("change",i),e.actions.setLocale(t.locale),n.setLocale=m=>{const p=kn([String(m)]);p==="en"&&!/^en\b/i.test(String(m))&&console.error(`[Deskcord] setLocale: unsupported locale "${String(m)}" (use one of ${Et.join(", ")}). Falling back to English.`),e.actions.setLocale(p)};const a=document.createElement("div");a.id="deskcord-root",a.style.cssText="position:fixed;top:0;left:0;width:0;height:0;z-index:2147483000;",document.body.appendChild(a);const c=a.attachShadow({mode:"open"}),d=document.createElement("style");d.textContent=Co,c.appendChild(d);const u=document.createElement("div");c.appendChild(u),Ao(s(Yr.Provider,{value:e,children:s(ea,{})}),u),e.boot()}document.body?so():document.addEventListener("DOMContentLoaded",so,{once:!0})})();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "deskcord",
3
3
  "private": false,
4
- "version": "1.3.1",
4
+ "version": "1.5.0",
5
5
  "author": "Maxime Bertonnier <m.bertonnier@gmail.com>",
6
6
  "homepage": "https://deskcord.chat",
7
7
  "type": "module",