owncast/static/web/_next/static/chunks/5596-c57e0f6790463985.js
2023-11-24 06:25:00 +00:00

1 line
No EOL
10 KiB
JavaScript
Vendored

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5596],{59775:function(e,t,n){n.r(t),n.d(t,{BaseInput:function(){return es_BaseInput},default:function(){return h}});var a=n(4942),r=n(71002),o=n(67294),l=n(94184),u=n.n(l);function hasAddon(e){return!!(e.addonBefore||e.addonAfter)}function hasPrefixSuffix(e){return!!(e.prefix||e.suffix||e.allowClear)}function resolveOnChange(e,t,n,a){if(n){var r=t;if("click"===t.type){var o=e.cloneNode(!0);r=Object.create(t,{target:{value:o},currentTarget:{value:o}}),o.value="",n(r);return}if(void 0!==a){r=Object.create(t,{target:{value:e},currentTarget:{value:e}}),e.value=a,n(r);return}n(r)}}function triggerFocus(e,t){if(e){e.focus(t);var n=(t||{}).cursor;if(n){var a=e.value.length;switch(n){case"start":e.setSelectionRange(0,0);break;case"end":e.setSelectionRange(a,a);break;default:e.setSelectionRange(0,a)}}}}function fixControlledValue(e){return null==e?"":String(e)}var es_BaseInput=function(e){var t=e.inputElement,n=e.prefixCls,l=e.prefix,i=e.suffix,s=e.addonBefore,c=e.addonAfter,f=e.className,d=e.style,p=e.affixWrapperClassName,v=e.groupClassName,h=e.wrapperClassName,g=e.disabled,m=e.readOnly,x=e.focused,b=e.triggerFocus,C=e.allowClear,y=e.value,w=e.handleReset,S=e.hidden,A=(0,o.useRef)(null),Z=(0,o.cloneElement)(t,{value:y,hidden:S});if(hasPrefixSuffix(e)){var z,E="".concat(n,"-affix-wrapper"),N=u()(E,(z={},(0,a.Z)(z,"".concat(E,"-disabled"),g),(0,a.Z)(z,"".concat(E,"-focused"),x),(0,a.Z)(z,"".concat(E,"-readonly"),m),(0,a.Z)(z,"".concat(E,"-input-with-clear-btn"),i&&C&&y),z),!hasAddon(e)&&f,p),R=(i||C)&&o.createElement("span",{className:"".concat(n,"-suffix")},function(){if(!C)return null;var e,t=!g&&!m&&y,l="".concat(n,"-clear-icon"),s="object"===(0,r.Z)(C)&&null!=C&&C.clearIcon?C.clearIcon:"✖";return o.createElement("span",{onClick:w,onMouseDown:function(e){return e.preventDefault()},className:u()(l,(e={},(0,a.Z)(e,"".concat(l,"-hidden"),!t),(0,a.Z)(e,"".concat(l,"-has-suffix"),!!i),e)),role:"button",tabIndex:-1},s)}(),i);Z=o.createElement("span",{className:N,style:d,hidden:!hasAddon(e)&&S,onClick:function(e){var t;null!==(t=A.current)&&void 0!==t&&t.contains(e.target)&&(null==b||b())},ref:A},l&&o.createElement("span",{className:"".concat(n,"-prefix")},l),(0,o.cloneElement)(t,{style:null,value:y,hidden:null}),R)}if(hasAddon(e)){var P="".concat(n,"-group"),V="".concat(P,"-addon"),k=u()("".concat(n,"-wrapper"),P,h),T=u()("".concat(n,"-group-wrapper"),f,v);return o.createElement("span",{className:T,style:d,hidden:S},o.createElement("span",{className:k},s&&o.createElement("span",{className:V},s),(0,o.cloneElement)(Z,{style:null,hidden:null}),c&&o.createElement("span",{className:V},c)))}return Z},i=n(74902),s=n(87462),c=n(97685),f=n(45987),d=n(98423),p=n(21770),v=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","type","inputClassName"],h=(0,o.forwardRef)(function(e,t){var n,l=e.autoComplete,h=e.onChange,g=e.onFocus,m=e.onBlur,x=e.onPressEnter,b=e.onKeyDown,C=e.prefixCls,y=void 0===C?"rc-input":C,w=e.disabled,S=e.htmlSize,A=e.className,Z=e.maxLength,z=e.suffix,E=e.showCount,N=e.type,R=e.inputClassName,P=(0,f.Z)(e,v),V=(0,p.Z)(e.defaultValue,{value:e.value}),k=(0,c.Z)(V,2),T=k[0],F=k[1],I=(0,o.useState)(!1),B=(0,c.Z)(I,2),D=B[0],K=B[1],_=(0,o.useRef)(null),focus=function(e){_.current&&triggerFocus(_.current,e)};return(0,o.useImperativeHandle)(t,function(){return{focus:focus,blur:function(){var e;null===(e=_.current)||void 0===e||e.blur()},setSelectionRange:function(e,t,n){var a;null===(a=_.current)||void 0===a||a.setSelectionRange(e,t,n)},select:function(){var e;null===(e=_.current)||void 0===e||e.select()},input:_.current}}),(0,o.useEffect)(function(){K(function(e){return(!e||!w)&&e})},[w]),o.createElement(es_BaseInput,(0,s.Z)({},P,{prefixCls:y,className:A,inputElement:(n=(0,d.Z)(e,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","affixWrapperClassName","groupClassName","inputClassName","wrapperClassName","htmlSize"]),o.createElement("input",(0,s.Z)({autoComplete:l},n,{onChange:function(t){void 0===e.value&&F(t.target.value),_.current&&resolveOnChange(_.current,t,h)},onFocus:function(e){K(!0),null==g||g(e)},onBlur:function(e){K(!1),null==m||m(e)},onKeyDown:function(e){x&&"Enter"===e.key&&x(e),null==b||b(e)},className:u()(y,(0,a.Z)({},"".concat(y,"-disabled"),w),R,!hasAddon(e)&&!hasPrefixSuffix(e)&&A),ref:_,size:S,type:void 0===N?"text":N}))),handleReset:function(e){F(""),focus(),_.current&&resolveOnChange(_.current,e,h)},value:fixControlledValue(T),focused:D,triggerFocus:focus,suffix:function(){var e=Number(Z)>0;if(z||E){var t=fixControlledValue(T),n=(0,i.Z)(t).length,l="object"===(0,r.Z)(E)?E.formatter({value:t,count:n,maxLength:Z}):"".concat(n).concat(e?" / ".concat(Z):"");return o.createElement(o.Fragment,null,!!E&&o.createElement("span",{className:u()("".concat(y,"-show-count-suffix"),(0,a.Z)({},"".concat(y,"-show-count-has-suffix"),!!z))},l),z)}return null}(),disabled:w}))})},57239:function(e,t,n){n.r(t),n.d(t,{ResizableTextArea:function(){return A},default:function(){return Z}});var a,r=n(87462),o=n(15671),l=n(43144),u=n(32531),i=n(73568),s=n(67294),c=n(4942),f=n(1413),d=n(71002),p=n(97685),v=n(45987),h=n(48555),g=n(8410),m=n(75164),x=n(21770),b=n(94184),C=n.n(b),y=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],w={};function calculateNodeStyling(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(t&&w[n])return w[n];var a=window.getComputedStyle(e),r=a.getPropertyValue("box-sizing")||a.getPropertyValue("-moz-box-sizing")||a.getPropertyValue("-webkit-box-sizing"),o=parseFloat(a.getPropertyValue("padding-bottom"))+parseFloat(a.getPropertyValue("padding-top")),l=parseFloat(a.getPropertyValue("border-bottom-width"))+parseFloat(a.getPropertyValue("border-top-width")),u={sizingStyle:y.map(function(e){return"".concat(e,":").concat(a.getPropertyValue(e))}).join(";"),paddingSize:o,borderSize:l,boxSizing:r};return t&&n&&(w[n]=u),u}function calculateAutoSizeStyle(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;a||((a=document.createElement("textarea")).setAttribute("tab-index","-1"),a.setAttribute("aria-hidden","true"),document.body.appendChild(a)),e.getAttribute("wrap")?a.setAttribute("wrap",e.getAttribute("wrap")):a.removeAttribute("wrap");var l=calculateNodeStyling(e,n),u=l.paddingSize,i=l.borderSize,s=l.boxSizing,c=l.sizingStyle;a.setAttribute("style","".concat(c,";").concat("\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important;\n pointer-events: none !important;\n")),a.value=e.value||e.placeholder||"";var f=void 0,d=void 0,p=a.scrollHeight;if("border-box"===s?p+=i:"content-box"===s&&(p-=u),null!==r||null!==o){a.value=" ";var v=a.scrollHeight-u;null!==r&&(f=v*r,"border-box"===s&&(f=f+u+i),p=Math.max(f,p)),null!==o&&(d=v*o,"border-box"===s&&(d=d+u+i),t=p>d?"":"hidden",p=Math.min(d,p))}var h={height:p,overflowY:t,resize:"none"};return f&&(h.minHeight=f),d&&(h.maxHeight=d),h}var S=["prefixCls","onPressEnter","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],A=s.forwardRef(function(e,t){var n=e.prefixCls,a=void 0===n?"rc-textarea":n,o=(e.onPressEnter,e.defaultValue),l=e.value,u=e.autoSize,i=e.onResize,b=e.className,y=e.style,w=e.disabled,A=e.onChange,Z=(e.onInternalAutoSize,(0,v.Z)(e,S)),z=(0,x.Z)(o,{value:l,postState:function(e){return null!=e?e:""}}),E=(0,p.Z)(z,2),N=E[0],R=E[1],P=s.useRef();s.useImperativeHandle(t,function(){return{textArea:P.current}});var V=s.useMemo(function(){return u&&"object"===(0,d.Z)(u)?[u.minRows,u.maxRows]:[]},[u]),k=(0,p.Z)(V,2),T=k[0],F=k[1],I=!!u,fixFirefoxAutoScroll=function(){try{if(document.activeElement===P.current){var e=P.current,t=e.selectionStart,n=e.selectionEnd,a=e.scrollTop;P.current.setSelectionRange(t,n),P.current.scrollTop=a}}catch(e){}},B=s.useState(2),D=(0,p.Z)(B,2),K=D[0],_=D[1],j=s.useState(),H=(0,p.Z)(j,2),O=H[0],M=H[1],startResize=function(){_(0)};(0,g.Z)(function(){I&&startResize()},[l,T,F,I]),(0,g.Z)(function(){if(0===K)_(1);else if(1===K){var e=calculateAutoSizeStyle(P.current,!1,T,F);_(2),M(e)}else fixFirefoxAutoScroll()},[K]);var L=s.useRef(),cleanRaf=function(){m.Z.cancel(L.current)};s.useEffect(function(){return cleanRaf},[]);var W=I?O:null,Y=(0,f.Z)((0,f.Z)({},y),W);return(0===K||1===K)&&(Y.overflowY="hidden",Y.overflowX="hidden"),s.createElement(h.default,{onResize:function(e){2===K&&(null==i||i(e),u&&(cleanRaf(),L.current=(0,m.Z)(function(){startResize()})))},disabled:!(u||i)},s.createElement("textarea",(0,r.Z)({},Z,{ref:P,style:Y,className:C()(a,b,(0,c.Z)({},"".concat(a,"-disabled"),w)),disabled:w,value:N,onChange:function(e){R(e.target.value),null==A||A(e)}})))}),Z=function(e){(0,u.Z)(TextArea,e);var t=(0,i.Z)(TextArea);function TextArea(e){(0,o.Z)(this,TextArea),(n=t.call(this,e)).resizableTextArea=void 0,n.focus=function(){n.resizableTextArea.textArea.focus()},n.saveTextArea=function(e){n.resizableTextArea=e},n.handleChange=function(e){var t=n.props.onChange;n.setValue(e.target.value),t&&t(e)},n.handleKeyDown=function(e){var t=n.props,a=t.onPressEnter,r=t.onKeyDown;13===e.keyCode&&a&&a(e),r&&r(e)};var n,a=void 0===e.value||null===e.value?e.defaultValue:e.value;return n.state={value:a},n}return(0,l.Z)(TextArea,[{key:"setValue",value:function(e,t){"value"in this.props||this.setState({value:e},t)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return s.createElement(A,(0,r.Z)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(e){return"value"in e?{value:e.value}:null}}]),TextArea}(s.Component)}}]);