2023-05-16 10:50:42 +08:00

1 line
15 KiB
JavaScript
Executable File

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReactChatView=e(require("react")):t.ReactChatView=e(t.React)}(this,function(t){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=3)}([function(t,e,r){(function(t,r){function n(t,e){return t.set(e[0],e[1]),t}function o(t,e){return t.add(e),t}function i(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r,t););return t}function c(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}function u(t,e,r,n){var o=-1,i=t?t.length:0;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}function a(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function l(t,e){return null==t?void 0:t[e]}function s(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function f(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}function p(t,e){return function(r){return t(e(r))}}function h(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r}function d(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function b(){this.__data__=Fe?Fe(null):{}}function y(t){return this.has(t)&&delete this.__data__[t]}function v(t){var e=this.__data__;if(Fe){var r=e[t];return r===Et?void 0:r}return ve.call(e,t)?e[t]:void 0}function _(t){var e=this.__data__;return Fe?void 0!==e[t]:ve.call(e,t)}function g(t,e){return this.__data__[t]=Fe&&void 0===e?Et:e,this}function j(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function m(){this.__data__=[]}function w(t){var e=this.__data__,r=C(e,t);return!(r<0)&&(r==e.length-1?e.pop():xe.call(e,r,1),!0)}function O(t){var e=this.__data__,r=C(e,t);return r<0?void 0:e[r][1]}function T(t){return C(this.__data__,t)>-1}function S(t,e){var r=this.__data__,n=C(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}function x(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function P(){this.__data__={hash:new d,map:new(Ie||j),string:new d}}function A(t){return ct(this,t).delete(t)}function E(t){return ct(this,t).get(t)}function R(t){return ct(this,t).has(t)}function I(t,e){return ct(this,t).set(t,e),this}function L(t){this.__data__=new j(t)}function k(){this.__data__=new j}function H(t){return this.__data__.delete(t)}function F(t){return this.__data__.get(t)}function M(t){return this.__data__.has(t)}function q(t,e){var r=this.__data__;if(r instanceof j){var n=r.__data__;if(!Ie||n.length<At-1)return n.push([t,e]),this;r=this.__data__=new x(n)}return r.set(t,e),this}function D(t,e){var r=Ve(t)||_t(t)?a(t.length,String):[],n=r.length,o=!!n;for(var i in t)!e&&!ve.call(t,i)||o&&("length"==i||ft(i,n))||r.push(i);return r}function U(t,e,r){var n=t[e];ve.call(t,e)&&vt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function C(t,e){for(var r=t.length;r--;)if(vt(t[r][0],e))return r;return-1}function $(t,e){return t&&nt(e,St(e),t)}function N(t,e,r,n,o,c,u){var a;if(n&&(a=c?n(t,o,c,u):n(t)),void 0!==a)return a;if(!Ot(t))return t;var l=Ve(t);if(l){if(a=at(t),!e)return rt(t,a)}else{var f=Be(t),p=f==Ht||f==Ft;if(ze(t))return G(t,e);if(f==Dt||f==It||p&&!c){if(s(t))return c?t:{};if(a=lt(p?{}:t),!e)return ot(t,$(a,t))}else{if(!oe[f])return c?t:{};a=st(t,f,N,e)}}u||(u=new L);var h=u.get(t);if(h)return h;if(u.set(t,a),!l)var d=r?it(t):St(t);return i(d||t,function(o,i){d&&(i=o,o=t[i]),U(a,i,N(o,e,r,n,i,t,u))}),a}function W(t){return Ot(t)?Te(t):{}}function B(t,e,r){var n=e(t);return Ve(t)?n:c(n,r(t))}function V(t){return _e.call(t)}function z(t){return!(!Ot(t)||ht(t))&&(mt(t)||s(t)?ge:re).test(bt(t))}function Y(t){if(!dt(t))return Ee(t);var e=[];for(var r in Object(t))ve.call(t,r)&&"constructor"!=r&&e.push(r);return e}function G(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function X(t){var e=new t.constructor(t.byteLength);return new we(e).set(new we(t)),e}function J(t,e){var r=e?X(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}function K(t,e,r){return u(e?r(f(t),!0):f(t),n,new t.constructor)}function Q(t){var e=new t.constructor(t.source,ee.exec(t));return e.lastIndex=t.lastIndex,e}function Z(t,e,r){return u(e?r(h(t),!0):h(t),o,new t.constructor)}function tt(t){return Ne?Object(Ne.call(t)):{}}function et(t,e){var r=e?X(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function rt(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function nt(t,e,r,n){r||(r={});for(var o=-1,i=e.length;++o<i;){var c=e[o],u=n?n(r[c],t[c],c,r,t):void 0;U(r,c,void 0===u?t[c]:u)}return r}function ot(t,e){return nt(t,We(t),e)}function it(t){return B(t,St,We)}function ct(t,e){var r=t.__data__;return pt(e)?r["string"==typeof e?"string":"hash"]:r.map}function ut(t,e){var r=l(t,e);return z(r)?r:void 0}function at(t){var e=t.length,r=t.constructor(e);return e&&"string"==typeof t[0]&&ve.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function lt(t){return"function"!=typeof t.constructor||dt(t)?{}:W(Oe(t))}function st(t,e,r,n){var o=t.constructor;switch(e){case Wt:return X(t);case Lt:case kt:return new o(+t);case Bt:return J(t,n);case Vt:case zt:case Yt:case Gt:case Xt:case Jt:case Kt:case Qt:case Zt:return et(t,n);case Mt:return K(t,n,r);case qt:case $t:return new o(t);case Ut:return Q(t);case Ct:return Z(t,n,r);case Nt:return tt(t)}}function ft(t,e){return!!(e=null==e?Rt:e)&&("number"==typeof t||ne.test(t))&&t>-1&&t%1==0&&t<e}function pt(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function ht(t){return!!be&&be in t}function dt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||he)}function bt(t){if(null!=t){try{return ye.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function yt(t){return N(t,!1,!0)}function vt(t,e){return t===e||t!==t&&e!==e}function _t(t){return jt(t)&&ve.call(t,"callee")&&(!Se.call(t,"callee")||_e.call(t)==It)}function gt(t){return null!=t&&wt(t.length)&&!mt(t)}function jt(t){return Tt(t)&&gt(t)}function mt(t){var e=Ot(t)?_e.call(t):"";return e==Ht||e==Ft}function wt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Rt}function Ot(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Tt(t){return!!t&&"object"==typeof t}function St(t){return gt(t)?D(t):Y(t)}function xt(){return[]}function Pt(){return!1}var At=200,Et="__lodash_hash_undefined__",Rt=9007199254740991,It="[object Arguments]",Lt="[object Boolean]",kt="[object Date]",Ht="[object Function]",Ft="[object GeneratorFunction]",Mt="[object Map]",qt="[object Number]",Dt="[object Object]",Ut="[object RegExp]",Ct="[object Set]",$t="[object String]",Nt="[object Symbol]",Wt="[object ArrayBuffer]",Bt="[object DataView]",Vt="[object Float32Array]",zt="[object Float64Array]",Yt="[object Int8Array]",Gt="[object Int16Array]",Xt="[object Int32Array]",Jt="[object Uint8Array]",Kt="[object Uint8ClampedArray]",Qt="[object Uint16Array]",Zt="[object Uint32Array]",te=/[\\^$.*+?()[\]{}|]/g,ee=/\w*$/,re=/^\[object .+?Constructor\]$/,ne=/^(?:0|[1-9]\d*)$/,oe={};oe[It]=oe["[object Array]"]=oe[Wt]=oe[Bt]=oe[Lt]=oe[kt]=oe[Vt]=oe[zt]=oe[Yt]=oe[Gt]=oe[Xt]=oe[Mt]=oe[qt]=oe[Dt]=oe[Ut]=oe[Ct]=oe[$t]=oe[Nt]=oe[Jt]=oe[Kt]=oe[Qt]=oe[Zt]=!0,oe["[object Error]"]=oe[Ht]=oe["[object WeakMap]"]=!1;var ie="object"==typeof t&&t&&t.Object===Object&&t,ce="object"==typeof self&&self&&self.Object===Object&&self,ue=ie||ce||Function("return this")(),ae="object"==typeof e&&e&&!e.nodeType&&e,le=ae&&"object"==typeof r&&r&&!r.nodeType&&r,se=le&&le.exports===ae,fe=Array.prototype,pe=Function.prototype,he=Object.prototype,de=ue["__core-js_shared__"],be=function(){var t=/[^.]+$/.exec(de&&de.keys&&de.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ye=pe.toString,ve=he.hasOwnProperty,_e=he.toString,ge=RegExp("^"+ye.call(ve).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),je=se?ue.Buffer:void 0,me=ue.Symbol,we=ue.Uint8Array,Oe=p(Object.getPrototypeOf,Object),Te=Object.create,Se=he.propertyIsEnumerable,xe=fe.splice,Pe=Object.getOwnPropertySymbols,Ae=je?je.isBuffer:void 0,Ee=p(Object.keys,Object),Re=ut(ue,"DataView"),Ie=ut(ue,"Map"),Le=ut(ue,"Promise"),ke=ut(ue,"Set"),He=ut(ue,"WeakMap"),Fe=ut(Object,"create"),Me=bt(Re),qe=bt(Ie),De=bt(Le),Ue=bt(ke),Ce=bt(He),$e=me?me.prototype:void 0,Ne=$e?$e.valueOf:void 0;d.prototype.clear=b,d.prototype.delete=y,d.prototype.get=v,d.prototype.has=_,d.prototype.set=g,j.prototype.clear=m,j.prototype.delete=w,j.prototype.get=O,j.prototype.has=T,j.prototype.set=S,x.prototype.clear=P,x.prototype.delete=A,x.prototype.get=E,x.prototype.has=R,x.prototype.set=I,L.prototype.clear=k,L.prototype.delete=H,L.prototype.get=F,L.prototype.has=M,L.prototype.set=q;var We=Pe?p(Pe,Object):xt,Be=V;(Re&&Be(new Re(new ArrayBuffer(1)))!=Bt||Ie&&Be(new Ie)!=Mt||Le&&"[object Promise]"!=Be(Le.resolve())||ke&&Be(new ke)!=Ct||He&&"[object WeakMap]"!=Be(new He))&&(Be=function(t){var e=_e.call(t),r=e==Dt?t.constructor:void 0,n=r?bt(r):void 0;if(n)switch(n){case Me:return Bt;case qe:return Mt;case De:return"[object Promise]";case Ue:return Ct;case Ce:return"[object WeakMap]"}return e});var Ve=Array.isArray,ze=Ae||Pt;r.exports=yt}).call(e,r(8),r(9)(t))},function(t,e,r){t.exports=r(6)()},function(e,r){e.exports=t},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(2),l=n(a),s=r(1),f=n(s),p=r(0),h=n(p),d=!1;try{var b=Object.defineProperty({},"passive",{get:function(){d=!0}});window.addEventListener("test",null,b)}catch(t){}var y=function(t){function e(t){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.onScroll=function(){if(r.scrollable.scrollTop!==r.scrollTop){if(r.shouldTriggerLoad()){r.setState({isInfiniteLoading:!0});r.props.onInfiniteLoad().then(function(){return r.setState({isInfiniteLoading:!1})})}r.updateScrollTop()}},r.pollScroll=function(){r.onScroll(),r.rafRequestId=window.requestAnimationFrame(r.pollScroll)},r.isPassedThreshold=function(t,e,r,n,o){return t?r<=e:r>=n-o-e},r.rafRequestId=null,r.scrollTop=0,r.scrollHeight=void 0,r.state={isInfiniteLoading:!1},r}return c(e,t),u(e,[{key:"componentDidMount",value:function(){var t=this.props.flipped?this.scrollable.scrollHeight-this.scrollable.clientHeight:0;this.scrollable.scrollTop=t,this.scrollTop=t,d?this.scrollable.addEventListener("scroll",this.onScroll,{passive:!0}):this.rafRequestId=window.requestAnimationFrame(this.pollScroll),"function"==typeof this.props.returnScrollable&&this.props.returnScrollable(this.scrollable)}},{key:"componentDidUpdate",value:function(){this.updateScrollTop()}},{key:"componentWillUnmount",value:function(){this.scrollable.removeEventListener("scroll",this.onScroll,{passive:!0}),window.cancelAnimationFrame(this.rafRequestId)}},{key:"shouldTriggerLoad",value:function(){return this.isPassedThreshold(this.props.flipped,this.props.scrollLoadThreshold,this.scrollable.scrollTop,this.scrollable.scrollHeight,this.scrollable.clientHeight)&&!this.state.isInfiniteLoading&&this.props.shouldTriggerLoad()}},{key:"updateScrollTop",value:function(){var t=this.scrollable.scrollTop+(this.props.flipped?this.scrollable.scrollHeight-(this.scrollHeight||0):0),e=this.scrollHeight?this.scrollHeight-this.scrollable.scrollHeight:0;this.props.flipped&&e>0&&(t+=e),t!==this.scrollable.scrollTop&&(this.scrollable.scrollTop=t),this.scrollTop=this.scrollable.scrollTop,this.scrollHeight=this.scrollable.scrollHeight}},{key:"render",value:function(){var t=this,e=(0,h.default)(this.props.children);this.props.flipped&&!this.props.reversed&&e.reverse();var r=l.default.createElement("div",{ref:function(e){t.loadingSpinner=e}},this.state.isInfiniteLoading?this.props.loadingSpinnerDelegate:null);return l.default.createElement("div",{className:this.props.className,ref:function(e){t.scrollable=e},style:{overflowX:"hidden",overflowY:"auto"}},l.default.createElement("div",{ref:function(e){t.smoothScrollingWrapper=e}},this.props.flipped?r:null,e,this.props.flipped?null:r))}}]),e}(a.Component);y.propTypes={flipped:f.default.bool,reversed:f.default.bool,scrollLoadThreshold:f.default.number,shouldTriggerLoad:f.default.func,onInfiniteLoad:f.default.func.isRequired,loadingSpinnerDelegate:f.default.element,className:f.default.string,children:f.default.node,returnScrollable:f.default.func},e.default=y,y.defaultProps={flipped:!1,scrollLoadThreshold:10,shouldTriggerLoad:function(){return!0},loadingSpinnerDelegate:l.default.createElement("div",null),className:""},t.exports=e.default},function(t,e,r){"use strict";function n(t){return function(){return t}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(t){return t},t.exports=o},function(t,e,r){"use strict";function n(t,e,r,n,i,c,u,a){if(o(e),!t){var l;if(void 0===e)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[r,n,i,c,u,a],f=0;l=new Error(e.replace(/%s/g,function(){return s[f++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var o=function(t){};t.exports=n},function(t,e,r){"use strict";var n=r(4),o=r(5),i=r(7);t.exports=function(){function t(t,e,r,n,c,u){u!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function e(){return t}t.isRequired=t;var r={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return r.checkPropTypes=n,r.PropTypes=r,r}},function(t,e,r){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}}])});