owncast/static/web/_next/static/chunks/2122-7b82b6548f85871d.js
2023-07-10 01:36:23 +00:00

1 line
No EOL
11 KiB
JavaScript
Vendored

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2122],{82122:function(e,t,n){n.r(t),n.d(t,{default:function(){return q}});var r=n(87462),i=n(4942),a=n(71002),u=n(97685),o=n(45987),c=n(67294),s=n(94184),l=n.n(s),f=n(15105),d=n(8410),v=n(42550),m=n(15671),g=n(43144);function h(){return"function"==typeof BigInt}function N(e){var t=e.trim(),n=t.startsWith("-");n&&(t=t.slice(1)),(t=t.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,"")).startsWith(".")&&(t="0".concat(t));var r=t||"0",i=r.split("."),a=i[0]||"0",u=i[1]||"0";"0"===a&&"0"===u&&(n=!1);var o=n?"-":"";return{negative:n,negativeStr:o,trimStr:r,integerStr:a,decimalStr:u,fullStr:"".concat(o).concat(r)}}function p(e){var t=String(e);return!Number.isNaN(Number(t))&&t.includes("e")}function S(e){var t=String(e);if(p(e)){var n=Number(t.slice(t.indexOf("e-")+2)),r=t.match(/\.(\d+)/);return(null==r?void 0:r[1])&&(n+=r[1].length),n}return t.includes(".")&&E(t)?t.length-t.indexOf(".")-1:0}function b(e){var t=String(e);if(p(e)){if(e>Number.MAX_SAFE_INTEGER)return String(h()?BigInt(e).toString():Number.MAX_SAFE_INTEGER);if(e<Number.MIN_SAFE_INTEGER)return String(h()?BigInt(e).toString():Number.MIN_SAFE_INTEGER);t=e.toFixed(S(t))}return N(t).fullStr}function E(e){return"number"==typeof e?!Number.isNaN(e):!!e&&(/^\s*-?\d+(\.\d+)?\s*$/.test(e)||/^\s*-?\d+\.\s*$/.test(e)||/^\s*-?\.\d+\s*$/.test(e))}function y(e){var t="number"==typeof e?b(e):N(e).fullStr;return t.includes(".")?N(t.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:e+"0"}var I=function(){function e(t){if((0,m.Z)(this,e),this.origin="",this.number=void 0,this.empty=void 0,!t&&0!==t||!String(t).trim()){this.empty=!0;return}this.origin=String(t),this.number=Number(t)}return(0,g.Z)(e,[{key:"negate",value:function(){return new e(-this.toNumber())}},{key:"add",value:function(t){if(this.isInvalidate())return new e(t);var n=Number(t);if(Number.isNaN(n))return this;var r=this.number+n;if(r>Number.MAX_SAFE_INTEGER)return new e(Number.MAX_SAFE_INTEGER);if(r<Number.MIN_SAFE_INTEGER)return new e(Number.MIN_SAFE_INTEGER);var i=Math.max(S(this.number),S(n));return new e(r.toFixed(i))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return Number.isNaN(this.number)}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(e){return this.toNumber()===(null==e?void 0:e.toNumber())}},{key:"lessEquals",value:function(e){return 0>=this.add(e.negate().toString()).toNumber()}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e?this.isInvalidate()?"":b(this.number):this.origin}}]),e}(),k=function(){function e(t){if((0,m.Z)(this,e),this.origin="",this.negative=void 0,this.integer=void 0,this.decimal=void 0,this.decimalLen=void 0,this.empty=void 0,this.nan=void 0,!t&&0!==t||!String(t).trim()){this.empty=!0;return}if(this.origin=String(t),"-"===t){this.nan=!0;return}var n=t;if(p(n)&&(n=Number(n)),E(n="string"==typeof n?n:b(n))){var r=N(n);this.negative=r.negative;var i=r.trimStr.split(".");this.integer=BigInt(i[0]);var a=i[1]||"0";this.decimal=BigInt(a),this.decimalLen=a.length}else this.nan=!0}return(0,g.Z)(e,[{key:"getMark",value:function(){return this.negative?"-":""}},{key:"getIntegerStr",value:function(){return this.integer.toString()}},{key:"getDecimalStr",value:function(){return this.decimal.toString().padStart(this.decimalLen,"0")}},{key:"alignDecimal",value:function(e){return BigInt("".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(e,"0")))}},{key:"negate",value:function(){var t=new e(this.toString());return t.negative=!t.negative,t}},{key:"add",value:function(t){if(this.isInvalidate())return new e(t);var n=new e(t);if(n.isInvalidate())return this;var r=Math.max(this.getDecimalStr().length,n.getDecimalStr().length),i=N((this.alignDecimal(r)+n.alignDecimal(r)).toString()),a=i.negativeStr,u=i.trimStr,o="".concat(a).concat(u.padStart(r+1,"0"));return new e("".concat(o.slice(0,-r),".").concat(o.slice(-r)))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return this.nan}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(e){return this.toString()===(null==e?void 0:e.toString())}},{key:"lessEquals",value:function(e){return 0>=this.add(e.negate().toString()).toNumber()}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e?this.isInvalidate()?"":N("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),e}();function w(e){return h()?new k(e):new I(e)}function Z(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(""===e)return"";var i=N(e),a=i.negativeStr,u=i.integerStr,o=i.decimalStr,c="".concat(t).concat(o),s="".concat(a).concat(u);if(n>=0){var l=Number(o[n]);return l>=5&&!r?Z(w(e).add("".concat(a,"0.").concat("0".repeat(n)).concat(10-l)).toString(),t,n,r):0===n?s:"".concat(s).concat(t).concat(o.padEnd(n,"0").slice(0,n))}return".0"===c?s:"".concat(s).concat(c)}var M=n(31131);function x(e){var t=e.prefixCls,n=e.upNode,a=e.downNode,u=e.upDisabled,o=e.downDisabled,s=e.onStep,f=c.useRef(),d=c.useRef();d.current=s;var v=function(e,t){e.preventDefault(),d.current(t),f.current=setTimeout(function e(){d.current(t),f.current=setTimeout(e,200)},600)},m=function(){clearTimeout(f.current)};if(c.useEffect(function(){return m},[]),(0,M.Z)())return null;var g="".concat(t,"-handler"),h=l()(g,"".concat(g,"-up"),(0,i.Z)({},"".concat(g,"-up-disabled"),u)),N=l()(g,"".concat(g,"-down"),(0,i.Z)({},"".concat(g,"-down-disabled"),o)),p={unselectable:"on",role:"button",onMouseUp:m,onMouseLeave:m};return c.createElement("div",{className:"".concat(g,"-wrap")},c.createElement("span",(0,r.Z)({},p,{onMouseDown:function(e){v(e,!0)},"aria-label":"Increase Value","aria-disabled":u,className:h}),n||c.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-up-inner")})),c.createElement("span",(0,r.Z)({},p,{onMouseDown:function(e){v(e,!1)},"aria-label":"Decrease Value","aria-disabled":o,className:N}),a||c.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-down-inner")})))}var R=n(80334),_=n(75164),D=function(){var e=(0,c.useRef)(0),t=function(){_.Z.cancel(e.current)};return(0,c.useEffect)(function(){return t},[]),function(n){t(),e.current=(0,_.Z)(function(){n()})}},T=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","controls","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep"],C=function(e,t){return e||t.isEmpty()?t.toString():t.toNumber()},A=function(e){var t=w(e);return t.isInvalidate()?null:t},F=c.forwardRef(function(e,t){var n,s,m,g=e.prefixCls,h=void 0===g?"rc-input-number":g,N=e.className,p=e.style,I=e.min,k=e.max,M=e.step,_=void 0===M?1:M,F=e.defaultValue,q=e.value,B=e.disabled,G=e.readOnly,$=e.upHandler,O=e.downHandler,P=e.keyboard,W=e.controls,H=void 0===W||W,L=e.stringMode,U=e.parser,V=e.formatter,X=e.precision,K=e.decimalSeparator,Q=e.onChange,j=e.onInput,z=e.onPressEnter,J=e.onStep,Y=(0,o.Z)(e,T),ee="".concat(h,"-input"),et=c.useRef(null),en=c.useState(!1),er=(0,u.Z)(en,2),ei=er[0],ea=er[1],eu=c.useRef(!1),eo=c.useRef(!1),ec=c.useRef(!1),es=c.useState(function(){return w(null!=q?q:F)}),el=(0,u.Z)(es,2),ef=el[0],ed=el[1],ev=c.useCallback(function(e,t){return t?void 0:X>=0?X:Math.max(S(e),S(_))},[X,_]),em=c.useCallback(function(e){var t=String(e);if(U)return U(t);var n=t;return K&&(n=n.replace(K,".")),n.replace(/[^\w.-]+/g,"")},[U,K]),eg=c.useRef(""),eh=c.useCallback(function(e,t){if(V)return V(e,{userTyping:t,input:String(eg.current)});var n="number"==typeof e?b(e):e;if(!t){var r=ev(n,t);E(n)&&(K||r>=0)&&(n=Z(n,K||".",r))}return n},[V,ev,K]),eN=c.useState(function(){var e=null!=F?F:q;return ef.isInvalidate()&&["string","number"].includes((0,a.Z)(e))?Number.isNaN(e)?"":e:eh(ef.toString(),!1)}),ep=(0,u.Z)(eN,2),eS=ep[0],eb=ep[1];function eE(e,t){eb(eh(e.isInvalidate()?e.toString(!1):e.toString(!t),t))}eg.current=eS;var ey=c.useMemo(function(){return A(k)},[k,X]),eI=c.useMemo(function(){return A(I)},[I,X]),ek=c.useMemo(function(){return!(!ey||!ef||ef.isInvalidate())&&ey.lessEquals(ef)},[ey,ef]),ew=c.useMemo(function(){return!(!eI||!ef||ef.isInvalidate())&&ef.lessEquals(eI)},[eI,ef]),eZ=(n=et.current,s=(0,c.useRef)(null),[function(){try{var e=n.selectionStart,t=n.selectionEnd,r=n.value,i=r.substring(0,e),a=r.substring(t);s.current={start:e,end:t,value:r,beforeTxt:i,afterTxt:a}}catch(e){}},function(){if(n&&s.current&&ei)try{var e=n.value,t=s.current,r=t.beforeTxt,i=t.afterTxt,a=t.start,u=e.length;if(e.endsWith(i))u=e.length-s.current.afterTxt.length;else if(e.startsWith(r))u=r.length;else{var o=r[a-1],c=e.indexOf(o,a-1);-1!==c&&(u=c+1)}n.setSelectionRange(u,u)}catch(e){(0,R.ZP)(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(e.message))}}]),eM=(0,u.Z)(eZ,2),ex=eM[0],eR=eM[1],e_=function(e){return ey&&!e.lessEquals(ey)?ey:eI&&!eI.lessEquals(e)?eI:null},eD=function(e){return!e_(e)},eT=function(e,t){var n=e,r=eD(n)||n.isEmpty();if(n.isEmpty()||t||(n=e_(n)||n,r=!0),!G&&!B&&r){var i,a=n.toString(),u=ev(a,t);return u>=0&&!eD(n=w(Z(a,".",u)))&&(n=w(Z(a,".",u,!0))),n.equals(ef)||(i=n,void 0===q&&ed(i),null==Q||Q(n.isEmpty()?null:C(L,n)),void 0===q&&eE(n,t)),n}return ef},eC=D(),eA=function e(t){if(ex(),eb(t),!eo.current){var n=w(em(t));n.isNaN()||eT(n,!0)}null==j||j(t),eC(function(){var n=t;U||(n=t.replace(/。/g,".")),n!==t&&e(n)})},eF=function(e){if((!e||!ek)&&(e||!ew)){eu.current=!1;var t,n=w(ec.current?y(_):_);e||(n=n.negate());var r=eT((ef||w(0)).add(n.toString()),!1);null==J||J(C(L,r),{offset:ec.current?y(_):_,type:e?"up":"down"}),null===(t=et.current)||void 0===t||t.focus()}},eq=function(e){var t=w(em(eS)),n=t;n=t.isNaN()?ef:eT(t,e),void 0!==q?eE(ef,!1):n.isNaN()||eE(n,!1)};return(0,d.o)(function(){ef.isInvalidate()||eE(ef,!1)},[X]),(0,d.o)(function(){var e=w(q);ed(e);var t=w(em(eS));e.equals(t)&&eu.current&&!V||eE(e,eu.current)},[q]),(0,d.o)(function(){V&&eR()},[eS]),c.createElement("div",{className:l()(h,N,(m={},(0,i.Z)(m,"".concat(h,"-focused"),ei),(0,i.Z)(m,"".concat(h,"-disabled"),B),(0,i.Z)(m,"".concat(h,"-readonly"),G),(0,i.Z)(m,"".concat(h,"-not-a-number"),ef.isNaN()),(0,i.Z)(m,"".concat(h,"-out-of-range"),!ef.isInvalidate()&&!eD(ef)),m)),style:p,onFocus:function(){ea(!0)},onBlur:function(){eq(!1),ea(!1),eu.current=!1},onKeyDown:function(e){var t=e.which,n=e.shiftKey;eu.current=!0,n?ec.current=!0:ec.current=!1,t===f.Z.ENTER&&(eo.current||(eu.current=!1),eq(!1),null==z||z(e)),!1!==P&&!eo.current&&[f.Z.UP,f.Z.DOWN].includes(t)&&(eF(f.Z.UP===t),e.preventDefault())},onKeyUp:function(){eu.current=!1,ec.current=!1},onCompositionStart:function(){eo.current=!0},onCompositionEnd:function(){eo.current=!1,eA(et.current.value)},onBeforeInput:function(){eu.current=!0}},H&&c.createElement(x,{prefixCls:h,upNode:$,downNode:O,upDisabled:ek,downDisabled:ew,onStep:eF}),c.createElement("div",{className:"".concat(ee,"-wrap")},c.createElement("input",(0,r.Z)({autoComplete:"off",role:"spinbutton","aria-valuemin":I,"aria-valuemax":k,"aria-valuenow":ef.isInvalidate()?null:ef.toString(),step:_},Y,{ref:(0,v.sQ)(et,t),className:ee,value:eS,onChange:function(e){eA(e.target.value)},disabled:B,readOnly:G}))))});F.displayName="InputNumber";var q=F}}]);