vendor: 16,442 bytes, lines 1-26
1/** 2 * @license 3 * Copyright 2019 Google LLC 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6const t$1=window,e$2=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$3=Symbol(),n$3=new WeakMap;let o$3 = class o{constructor(t,e,n){if(this._$cssResult$=!0,n!==s$3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$2&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=n$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n$3.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new o$3("string"==typeof t?t:t+"",void 0,s$3),i$1=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,s,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[n+1]),t[0]);return new o$3(n,t,s$3)},S$1=(s,n)=>{e$2?s.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((e=>{const n=document.createElement("style"),o=t$1.litNonce;void 0!==o&&n.setAttribute("nonce",o),n.textContent=e.cssText,s.appendChild(n);}));},c$1=e$2?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t; 7 8/** 9 * @license 10 * Copyright 2017 Google LLC 11 * SPDX-License-Identifier: BSD-3-Clause 12 */var s$2;const e$1=window,r$1=e$1.trustedTypes,h$1=r$1?r$1.emptyScript:"",o$2=e$1.reactiveElementPolyfillSupport,n$2={toAttribute(t,i){switch(i){case Boolean:t=t?h$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t);}catch(t){s=null;}}return s}},a$1=(t,i)=>i!==t&&(i==i||t==t),l$2={attribute:!0,type:String,converter:n$2,reflect:!1,hasChanged:a$1},d$1="finalized";let u$1 = class u extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u();}static addInitializer(t){var i;this.finalize(),(null!==(i=this.h)&&void 0!==i?i:this.h=[]).push(t);}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,s)=>{const e=this._$Ep(s,i);void 0!==e&&(this._$Ev.set(e,s),t.push(e));})),t}static createProperty(t,i=l$2){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const s="symbol"==typeof t?Symbol():"__"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e);}}static getPropertyDescriptor(t,i,s){return {get(){return this[i]},set(e){const r=this[t];this[i]=e,this.requestUpdate(t,r,s);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||l$2}static finalize(){if(this.hasOwnProperty(d$1))return !1;this[d$1]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of i)this.createProperty(s,t[s]);}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(i){const s=[];if(Array.isArray(i)){const e=new Set(i.flat(1/0).reverse());for(const i of e)s.unshift(c$1(i));}else void 0!==i&&s.push(c$1(i));return s}static _$Ep(t,i){const s=i.attribute;return !1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)));}addController(t){var i,s;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t));}removeController(t){var i;null===(i=this._$ES)||void 0===i||i.splice(this._$ES.indexOf(t)>>>0,1);}_$Eg(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i]);}));}createRenderRoot(){var t;const s=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return S$1(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}));}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}));}attributeChangedCallback(t,i,s){this._$AK(t,s);}_$EO(t,i,s=l$2){var e;const r=this.constructor._$Ep(t,s);if(void 0!==r&&!0===s.reflect){const h=(void 0!==(null===(e=s.converter)||void 0===e?void 0:e.toAttribute)?s.converter:n$2).toAttribute(i,s.type);this._$El=t,null==h?this.removeAttribute(r):this.setAttribute(r,h),this._$El=null;}}_$AK(t,i){var s;const e=this.constructor,r=e._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=e.getPropertyOptions(r),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(s=t.converter)||void 0===s?void 0:s.fromAttribute)?t.converter:n$2;this._$El=r,this[r]=h.fromAttribute(i,t.type),this._$El=null;}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||a$1)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):e=!1),!this.isUpdatePending&&e&&(this._$E_=this._$Ej());}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,i)=>this[i]=t)),this._$Ei=void 0);let i=!1;const s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(s)):this._$Ek();}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(s);}willUpdate(t){}_$AE(t){var i;null===(i=this._$ES)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return !0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,i)=>this._$EO(i,this[i],t))),this._$EC=void 0),this._$Ek();}updated(t){}firstUpdated(t){}};u$1[d$1]=!0,u$1.elementProperties=new Map,u$1.elementStyles=[],u$1.shadowRootOptions={mode:"open"},null==o$2||o$2({ReactiveElement:u$1}),(null!==(s$2=e$1.reactiveElementVersions)&&void 0!==s$2?s$2:e$1.reactiveElementVersions=[]).push("1.6.2"); 13 14/** 15 * @license 16 * Copyright 2017 Google LLC 17 * SPDX-License-Identifier: BSD-3-Clause 18 */ 19var t;const i=window,s$1=i.trustedTypes,e=s$1?s$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,o$1="$lit$",n$1=`lit$${(Math.random()+"").slice(9)}$`,l$1="?"+n$1,h=`<${l$1}>`,r=document,u=()=>r.createComment(""),d=t=>null===t||"object"!=typeof t&&"function"!=typeof t,c=Array.isArray,v=t=>c(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),a="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${a}(?:([^\\s"'>=/]+)(${a}*=${a}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,w=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=w(1),T=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),E=new WeakMap,C=r.createTreeWalker(r,129,null,!1);function P(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e?e.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,e=[];let l,r=2===i?"<svg>":"",u=f;for(let i=0;i<s;i++){const s=t[i];let d,c,v=-1,a=0;for(;a<s.length&&(u.lastIndex=a,c=u.exec(s),null!==c);)a=u.lastIndex,u===f?"!--"===c[1]?u=_:void 0!==c[1]?u=m:void 0!==c[2]?(y.test(c[2])&&(l=RegExp("</"+c[2],"g")),u=p):void 0!==c[3]&&(u=p):u===p?">"===c[0]?(u=null!=l?l:f,v=-1):void 0===c[1]?v=-2:(v=u.lastIndex-c[2].length,d=c[1],u=void 0===c[3]?p:'"'===c[3]?$:g):u===$||u===g?u=p:u===_||u===m?u=f:(u=p,l=void 0);const w=u===p&&t[i+1].startsWith("/>")?" ":"";r+=u===f?s+h:v>=0?(e.push(d),s.slice(0,v)+o$1+s.slice(v)+n$1+w):s+n$1+(-2===v?(e.push(void 0),i):w);}return [P(t,r+(t[s]||"<?>")+(2===i?"</svg>":"")),e]};class N{constructor({strings:t,_$litType$:i},e){let h;this.parts=[];let r=0,d=0;const c=t.length-1,v=this.parts,[a,f]=V(t,i);if(this.el=N.createElement(a,e),C.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes);}for(;null!==(h=C.nextNode())&&v.length<c;){if(1===h.nodeType){if(h.hasAttributes()){const t=[];for(const i of h.getAttributeNames())if(i.endsWith(o$1)||i.startsWith(n$1)){const s=f[d++];if(t.push(i),void 0!==s){const t=h.getAttribute(s.toLowerCase()+o$1).split(n$1),i=/([.?@])?(.*)/.exec(s);v.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?H:"?"===i[1]?L:"@"===i[1]?z:k});}else v.push({type:6,index:r});}for(const i of t)h.removeAttribute(i);}if(y.test(h.tagName)){const t=h.textContent.split(n$1),i=t.length-1;if(i>0){h.textContent=s$1?s$1.emptyScript:"";for(let s=0;s<i;s++)h.append(t[s],u()),C.nextNode(),v.push({type:2,index:++r});h.append(t[i],u());}}}else if(8===h.nodeType)if(h.data===l$1)v.push({type:2,index:r});else {let t=-1;for(;-1!==(t=h.data.indexOf(n$1,t+1));)v.push({type:7,index:r}),t+=n$1.length-1;}r++;}}static createElement(t,i){const s=r.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){var o,n,l,h;if(i===T)return i;let r=void 0!==e?null===(o=s._$Co)||void 0===o?void 0:o[e]:s._$Cl;const u=d(i)?void 0:i._$litDirective$;return (null==r?void 0:r.constructor)!==u&&(null===(n=null==r?void 0:r._$AO)||void 0===n||n.call(r,!1),void 0===u?r=void 0:(r=new u(t),r._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Co)&&void 0!==l?l:h._$Co=[])[e]=r:s._$Cl=r),void 0!==r&&(i=S(t,r._$AS(t,i.values),r,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:r).importNode(s,!0);C.currentNode=o;let n=C.nextNode(),l=0,h=0,u=e[0];for(;void 0!==u;){if(l===u.index){let i;2===u.type?i=new R(n,n.nextSibling,this,t):1===u.type?i=new u.ctor(n,u.name,u.strings,this,t):6===u.type&&(i=new Z(n,this,t)),this._$AV.push(i),u=e[++h];}l!==(null==u?void 0:u.index)&&(n=C.nextNode(),l++);}return C.currentNode=r,o}v(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{constructor(t,i,s,e){var o;this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cp=null===(o=null==e?void 0:e.isConnected)||void 0===o||o;}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===(null==t?void 0:t.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),d(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):v(t)?this.T(t):this._(t);}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t));}_(t){this._$AH!==A&&d(this._$AH)?this._$AA.nextSibling.data=t:this.$(r.createTextNode(t)),this._$AH=t;}g(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=N.createElement(P(e.h,e.h[0]),this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.v(s);else {const t=new M(o,this),i=t.u(this.options);t.v(s),this.$(i),this._$AH=t;}}_$AC(t){let i=E.get(t.strings);return void 0===i&&E.set(t.strings,i=new N(t)),i}T(t){c(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new R(this.k(u()),this.k(u()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){var i;void 0===this._$AM&&(this._$Cp=t,null===(i=this._$AP)||void 0===i||i.call(this,t));}}class k{constructor(t,i,s,e,o){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A;}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=S(this,t,i,0),n=!d(t)||t!==this._$AH&&t!==T,n&&(this._$AH=t);else {const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=S(this,e[s+l],i,l),h===T&&(h=this._$AH[l]),n||(n=!d(h)||h!==this._$AH[l]),h===A?t=A:t!==A&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h;}n&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}const I=s$1?s$1.emptyScript:"";class L extends k{constructor(){super(...arguments),this.type=4;}j(t){t&&t!==A?this.element.setAttribute(this.name,I):this.element.removeAttribute(this.name);}}class z extends k{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5;}_$AI(t,i=this){var s;if((t=null!==(s=S(this,t,i,0))&&void 0!==s?s:A)===T)return;const e=this._$AH,o=t===A&&e!==A||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==A&&(e===A||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t);}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const B=i.litHtmlPolyfillSupport;null==B||B(N,R),(null!==(t=i.litHtmlVersions)&&void 0!==t?t:i.litHtmlVersions=[]).push("2.7.5");const D=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new R(i.insertBefore(u(),t),t,void 0,null!=s?s:{});}return l._$AI(t),l}; 20 21/** 22 * @license 23 * Copyright 2017 Google LLC 24 * SPDX-License-Identifier: BSD-3-Clause 25 */var l,o;class s extends u$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=D(i,this.renderRoot,this.renderOptions);}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0);}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1);}render(){return T}}s.finalized=!0,s._$litElement$=!0,null===(l=globalThis.litElementHydrateSupport)||void 0===l||l.call(globalThis,{LitElement:s});const n=globalThis.litElementPolyfillSupport;null==n||n({LitElement:s});(null!==(o=globalThis.litElementVersions)&&void 0!==o?o:globalThis.litElementVersions=[]).push("3.3.2"); 26
27//const DEFAULT_EMOJIS = 'ð,thumbs-up;ð,smile-face;ð,party-popper;ð,cool;ð,confused-face;â¤ï¸,red-heart;ð,rocket;ð,eyes;ð,thumbs-down;'; 28const DEFAULT_EMOJIS = 'ð,thumbs-up;ð,party-popper;â¤ï¸,red-heart;ð,cool;ð,smile-face;ð,rocket;'; 29 30class EmojiReaction extends s { 31 static properties = { 32 showAvailable: {attribute: false}, 33 availableReactions: { attribute: false }, 34 availableArrayString: {}, 35 endpoint: {}, 36 reactTargetId: {}, 37 theme: {}, 38 }; 39 // Define scoped styles right with your component, in plain CSS 40 static styles = i$1` 41 /* default light */ 42 .container { 43 --start-smile-border-color-default: #d0d7de; 44 --start-smile-border-color-hover-default: #1f232826; 45 --start-smile-bg-color-default: #f6f8fa; 46 --start-smile-svg-fill-color-default: #656d76; 47 --reaction-got-not-reacted-bg-color-default: transparent; 48 --reaction-got-not-reacted-bg-color-hover-default: #eaeef2; 49 --reaction-got-not-reacted-border-color-default: #d0d7de; 50 --reaction-got-not-reacted-text-color-default: #656d76; 51 --reaction-got-reacted-bg-color-default: transparent; 52 --reaction-got-reacted-bg-color-hover-default: #eaeef2; 53 --reaction-got-reacted-border-color-default: #42b983; 54 --reaction-got-reacted-text-color-default: #42b983; 55 --reaction-available-popup-bg-color-default: #ffffff; 56 --reaction-available-popup-border-color-default: #d0d7de; 57 --reaction-available-popup-box-shadow-default: 0 4px 6px rgba(0,0,0,.04); 58 --reaction-available-emoji-reacted-bg-color-default: #ddf4ff; 59 --reaction-available-emoji-bg-color-hover-default: #f3f4f6; 60 --reaction-available-emoji-z-index-default: 100; 61 --reaction-available-mask-z-index-default: 80; 62 } 63 /* default dark */ 64 .container-dark{ 65 --start-smile-border-color-default: #3b3d42; 66 --start-smile-border-color-hover-default: #3b3d42; 67 --start-smile-bg-color-default: transparent; 68 --start-smile-svg-fill-color-default: #ffffff; 69 --reaction-got-not-reacted-bg-color-default: transparent; 70 --reaction-got-not-reacted-bg-color-hover-default: #272727; 71 --reaction-got-not-reacted-border-color-default: #3b3d42; 72 --reaction-got-not-reacted-text-color-default: #ffffff; 73 --reaction-got-reacted-bg-color-default: #272727; 74 --reaction-got-reacted-bg-color-hover-default: #272727; 75 --reaction-got-reacted-border-color-default: #42b983; 76 --reaction-got-reacted-text-color-default: #42b983; 77 --reaction-available-popup-bg-color-default: #161b22; 78 --reaction-available-popup-border-color-default: #30363d; 79 --reaction-available-popup-box-shadow-default: 0 4px 6px rgba(0,0,0,.04); 80 --reaction-available-emoji-reacted-bg-color-default: #388bfd1a; 81 --reaction-available-emoji-bg-color-hover-default: #30363d; 82 --reaction-available-emoji-z-index-default: 100; 83 --reaction-available-mask-z-index-default: 80; 84 } 85 .anim-scale-in { 86 animation-name: scale-in; 87 animation-duration: .15s; 88 animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5); 89 } 90 91 @keyframes scale-in { 92 0% { 93 opacity: 0; 94 transform: scale(0.5); 95 } 96 100% { 97 opacity: 1; 98 transform: scale(1); 99 } 100 } 101 `; 102 103 // Render the UI as a function of component state 104 render() { 105 var system_theme = localStorage.getItem("theme") || '' 106 if (system_theme == null || system_theme == "undefined" || system_theme == "") { 107 system_theme = window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark"; 108 } 109 return x` 110 <style> 111 #start-smile { 112 border-width: 1px; 113 border-style: solid; 114 border-color: var(--start-smile-border-color, var(--start-smile-border-color-default)); 115 background-color: var(--start-smile-bg-color, var(--start-smile-bg-color-default)); 116 } 117 #start-smile:hover { 118 border-color: var(--start-smile-border-color-hover, var(--start-smile-border-color-hover-default)) !important; 119 } 120 #start-smile-svg { 121 fill: var(--start-smile-svg-fill-color, var(--start-smile-svg-fill-color-default)); 122 } 123 .reaction-got-not-reacted { 124 background-color: var(--reaction-got-not-reacted-bg-color, var(--reaction-got-not-reacted-bg-color-default)); 125 border-width: 1px; 126 border-style: solid; 127 border-color: var(--reaction-got-not-reacted-border-color, var(--reaction-got-not-reacted-border-color-default)); 128 color: var(--reaction-got-not-reacted-text-color, var(--reaction-got-not-reacted-text-color-default)); 129 } 130 .reaction-got-not-reacted:hover { 131 background-color: var(--reaction-got-not-reacted-bg-color-hover, var(--reaction-got-not-reacted-bg-color-hover-default)); 132 } 133 .reaction-got-reacted { 134 background-color: var(--reaction-got-reacted-bg-color, var(--reaction-got-reacted-bg-color-default)); 135 border-width: 1px; 136 border-style: solid; 137 border-color: var(--reaction-got-reacted-border-color, var(--reaction-got-reacted-border-color-default)); 138 color: var(--reaction-got-reacted-text-color, var(--reaction-got-reacted-text-color-default)); 139 } 140 .reaction-got-reacted:hover { 141 background-color: var(--reaction-got-reacted-bg-color-hover, var(--reaction-got-reacted-bg-color-hover-default)); 142 } 143 .reaction-available-popup { 144 background-color: var(--reaction-available-popup-bg-color, var(--reaction-available-popup-bg-color-default)); 145 border-width: 1px; 146 border-style: solid; 147 border-color: var(--reaction-available-popup-border-color, var(--reaction-available-popup-border-color-default));
148 box-shadow: var(--reaction-available-popup-box-shadow, var(--reaction-available-popup-box-shadow-default)); 149 } 150 .reaction-available-emoji { 151 z-index: var(--reaction-available-emoji-z-index, var(--reaction-available-emoji-z-index-default)); 152 } 153 .reaction-available-emoji:hover { 154 background-color: var(--reaction-available-emoji-bg-color-hover, var(--reaction-available-emoji-bg-color-hover-default)); 155 } 156 .reaction-available-emoji-reacted { 157 background-color: var(--reaction-available-emoji-reacted-bg-color, var(--reaction-available-emoji-reacted-bg-color-default)); 158 } 159 .reaction-available-popup::before { 160 position: fixed; 161 top: 0; 162 right: 0; 163 bottom: 0; 164 left: 0; 165 z-index: var(--reaction-available-mask-z-index, var(--reaction-available-mask-z-index-default)); 166 display: block; 167 cursor: default; 168 content: " "; 169 background: transparent; 170 } 171 </style> 172 <!-- container --> 173 <div style="flex-wrap: nowrap; max-width: 100%; display: flex; gap: 0.375rem;height: 1.5rem;" class="${this?.theme === 'dark' || (this?.theme === 'system' && system_theme === 'dark') ? 'container-dark' : 'container'}"> 174 <!-- ç°è²ç¬è¸ --> 175 <div style="position: relative; user-select: none;"> 176 <div id="start-smile" @click="${this._showAvailable}" 177 style="border-radius: 800px; width: 1rem; height: 1rem; line-height: 1rem; padding: 0.25rem;"> 178 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" id="start-smile-svg" style="cursor: pointer;"> 179 <path 180 d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm3.82 1.636a.75.75 0 0 1 1.038.175l.007.009c.103.118.22.222.35.31.264.178.683.37 1.285.37.602 0 1.02-.192 1.285-.371.13-.088.247-.192.35-.31l.007-.008a.75.75 0 0 1 1.222.87l-.022-.015c.02.013.021.015.021.015v.001l-.001.002-.002.003-.005.007-.014.019a2.066 2.066 0 0 1-.184.213c-.16.166-.338.316-.53.445-.63.418-1.37.638-2.127.629-.946 0-1.652-.308-2.126-.63a3.331 3.331 0 0 1-.715-.657l-.014-.02-.005-.006-.002-.003v-.002h-.001l.613-.432-.614.43a.75.75 0 0 1 .183-1.044ZM12 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM5 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm5.25 2.25.592.416a97.71 97.71 0 0 0-.592-.416Z"> 181 </path> 182 </svg> 183 </div> 184 <div class="anim-scale-in reaction-available-popup" @click=${this._closePopup} style="display: ${this.showAvailable ? 'flex' : 'none'}; user-select: none; position: absolute; top: -3rem; font-size: 0.875rem; border-radius: 0.375rem; padding: 0 0.125rem;"> 185 <!-- reactions available --> 186 ${this.availableReactions.map(item => x` 187 <span @click=${this._react} data-name="${item.reaction_name}" class="reaction-available-emoji ${item.meReacted ? 'reaction-available-emoji-reacted' : ''}" style="cursor: pointer; margin: 0.25rem 0.25rem; padding: 0.25rem 0.35rem; border-radius: 0.375rem;">${item.emoji}</span> 188 `)} 189 </div> 190 </div> 191 <!-- reactions got --> 192 <div style="display: flex; overflow-x: auto; gap: 0.375rem;"> 193 ${this.availableReactions.map(item => x` 194 <div @click=${this._react} data-name="${item.reaction_name}" class="${item.meReacted ? 'reaction-got-reacted' : 'reaction-got-not-reacted'}" style="display: ${item?.count && item.count > 0 ? 'flex' : 'none'}; user-select: none; cursor: pointer; justify-content: center; align-items: center; border-radius: 108px; padding: 0 0.25rem; font-size: 0.75rem;"> 195 <span style="pointer-events: none;">${item.emoji}</span><span style="padding:0 0.375rem; pointer-events: none;">${item.count}</span> 196 </div> 197 `)} 198 </div> 199 </div> 200 `; 201 } 202 203 constructor() { 204 super(); 205 // Declare reactive properties 206 this.showAvailable = false; 207 this.availableReactions = []; 208 } 209 210 connectedCallback() { 211 super.connectedCallback(); 212 this.initReactions(); 213 } 214 215 async initReactions() { 216 let arr_string = this?.availableArrayString; 217 if (!arr_string) { 218 arr_string = DEFAULT_EMOJIS; 219 } 220 const arr = arr_string.split(';').map(val => { 221 const [emoji, reaction_name] = val.split(','); 222 if (!emoji || !reaction_name) { 223 return null 224 } 225 return { emoji, reaction_name } 226 }).filter(val => val); 227 // åå§å endpoint 228 if (!this?.endpoint) { 229 this.endpoint = 'https://api.emaction.cool'; 230 } 231 // è¯·æ±æ¥å£ï¼è·ååªäº emoji æ reaction æ°é 232 let url_2_generate_id = ''; 233 const canonical = document.head.querySelector("link[rel='canonical']"); 234 url_2_generate_id = canonical && canonical.href ? canonical.href : window.location.href; 235 const urlObj = new URL(url_2_generate_id); 236 const url_without_hash = urlObj.origin + urlObj.pathname + urlObj.search; 237 if (!this?.reactTargetId) { 238 this.reactTargetId = await this._sha256(url_without_hash); 239 } 240 const { data: { reactionsGot } } = await fetch(this.endpoint + '/reactions?' + new URLSearchParams({ 241 targetId: this.reactTargetId, 242 }), { 243 method: 'GET', 244 }) 245 .then(resp => resp.json()) 246 .then(resp => { 247 if (!resp?.data || !Array.isArray(resp?.data?.reactionsGot)) { 248 throw new Error("è·å reactions åºéï¼") 249 } 250 return resp; 251 }); 252 // è·å¾ç reactions æ°éæ¾å° arr é 253 reactionsGot.forEach(reaction => { 254 arr.forEach(availableReaction => { 255 if (reaction.reaction_name === availableReaction.reaction_name) { 256 availableReaction.count = reaction.count; 257 } 258 }); 259 }); 260 // 读å localStorageï¼è·åå½åç¨æ·ç¹å»è¿ç emoji 261 const storageKey = `meReactedReactions_${this.reactTargetId}`; 262 const meReactedReactions = JSON.parse(window.localStorage.getItem(storageKey) || "[]"); 263 // å½åç¨æ·ç¹å»ç¶ææ¾å° arr 264 meReactedReactions.forEach(reaction_name => { 265 arr.forEach(availableReaction => { 266 if (reaction_name === availableReaction.reaction_name) { 267 availableReaction.meReacted = true; 268 } 269 }); 270 }); 271 // åå§å avaiableArray 272 this.availableReactions = arr; 273 } 274 275 _closePopup(e) { 276 console.log(e.target); 277 this.showAvailable = false;
278 } 279 280 async _react(e) { 281 const { name: reaction_name } = e.target.dataset; 282 const reaction = this.availableReactions.find(ele => ele.reaction_name === reaction_name); 283 if (!reaction) { 284 console.error("æªç¥ç reaction!"); 285 return 286 } 287 const cancel = reaction?.meReacted ? true : false; 288 const count = Math.max(0, reaction?.count ? reaction.count + (cancel ? -1 : 1) : (cancel ? 0 : 1)); 289 const meReacted = !reaction.meReacted; 290 this.availableReactions = this.availableReactions.map(val => { 291 if (val.reaction_name === reaction_name) { 292 val.count = count; 293 val.meReacted = meReacted; 294 } 295 return val 296 }); 297 this.showAvailable = false; 298 // è¯·æ±æ¥å£ï¼æ´æ° react æ°é 299 await fetch(this.endpoint + '/reaction?' + new URLSearchParams({ 300 targetId: this.reactTargetId, 301 reaction_name, 302 diff: cancel ? -1 : 1 303 }), { method: "PATCH"}); 304 // æ´æ° localStorage 305 const storageKey = `meReactedReactions_${this.reactTargetId}`; 306 const meReactedReactionsSet = new Set(JSON.parse(window.localStorage.getItem(storageKey) || "[]")); 307 if (cancel) { 308 meReactedReactionsSet.delete(reaction_name); 309 } else { 310 meReactedReactionsSet.add(reaction_name); 311 } 312 window.localStorage.setItem(storageKey, JSON.stringify(Array.from(meReactedReactionsSet))); 313 } 314 _showAvailable(e) { 315 e.preventDefault(); 316 this.showAvailable = !this.showAvailable; 317 } 318 async _sha256(string) { 319 return Array.from(new Uint8Array( 320 await crypto.subtle.digest('sha-256', new TextEncoder().encode(string)) 321 )) 322 .map(b => b.toString(16).padStart(2, "0")).join("") 323 } 324} 325customElements.define('emoji-reaction', EmojiReaction); 326 327export { EmojiReaction };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.