owncast/static/web/_next/static/chunks/9266.024e8c7e247613ac.js
2023-08-13 12:42:48 +00:00

1 line
No EOL
8.7 KiB
JavaScript
Vendored

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9266],{79266:function(e,n,t){"use strict";t.r(n),t.d(n,{UserDropdown:function(){return G}});var o=t(85893),r=t(82891),a=t(65400),i=t(94184),l=t.n(i),c=t(4480),s=t(67294),u=t(46977),d=t(5152),f=t.n(d),p=t(4511),h=t(44974),v=t(27345),b=t.n(v),y=t(69183);let m=f()(()=>t.e(8244).then(t.t.bind(t,18244,23)),{loadableGenerated:{webpack:()=>[18244]},ssr:!1}),k=f()(()=>t.e(775).then(t.t.bind(t,10775,23)),{loadableGenerated:{webpack:()=>[10775]},ssr:!1}),g=f()(()=>t.e(6275).then(t.t.bind(t,6275,23)),{loadableGenerated:{webpack:()=>[6275]},ssr:!1}),w=f()(()=>t.e(531).then(t.t.bind(t,40531,23)),{loadableGenerated:{webpack:()=>[40531]},ssr:!1}),E=f()(()=>t.e(4504).then(t.t.bind(t,4504,23)),{loadableGenerated:{webpack:()=>[4504]},ssr:!1}),C=f()(()=>t.e(5672).then(t.t.bind(t,65672,23)),{loadableGenerated:{webpack:()=>[65672]},ssr:!1}),L=f()(()=>t.e(5412).then(t.t.bind(t,95412,23)),{loadableGenerated:{webpack:()=>[95412]},ssr:!1}),j=f()(()=>Promise.all([t.e(1130),t.e(6697),t.e(9614)]).then(t.bind(t,29614)).then(e=>e.Modal),{loadableGenerated:{webpack:()=>[29614]},ssr:!1}),_=f()(()=>Promise.all([t.e(5596),t.e(1130),t.e(4104),t.e(1024),t.e(1749),t.e(7752),t.e(4749),t.e(6229)]).then(t.bind(t,7783)).then(e=>e.NameChangeModal),{loadableGenerated:{webpack:()=>[7783]},ssr:!1}),x=f()(()=>Promise.all([t.e(5596),t.e(1130),t.e(4104),t.e(1024),t.e(1700),t.e(3068),t.e(8469),t.e(7116)]).then(t.bind(t,78513)).then(e=>e.AuthModal),{loadableGenerated:{webpack:()=>[78513]},ssr:!1}),G=e=>{let{id:n,username:t,hideTitleOnMobile:i=!1,showToggleChatOption:d=!0}=e,[f,v]=(0,s.useState)(!1),[G,S]=(0,s.useState)(!1),[I,D]=(0,c.FV)(h.vZ),[A,O]=(0,s.useState)(null),P=(0,c.sJ)(h.Q),N=()=>{d&&D(I===h.gG.VISIBLE?h.gG.HIDDEN:h.gG.VISIBLE)},K=()=>{v(!1)},M=()=>{A&&A.close(),O(null),D(h.gG.VISIBLE)},T=d&&P.chatAvailable&&(I===h.gG.HIDDEN||I===h.gG.VISIBLE),U=d&&P.chatAvailable&&(I===h.gG.HIDDEN||I===h.gG.VISIBLE||I===h.gG.POPPED_OUT);(0,u.y1)("c",N,{enableOnContentEditable:!1},[I===h.gG.VISIBLE]);let R=(0,c.sJ)(h.db);if(!R)return null;let{displayName:V}=R,B=[{key:0,icon:(0,o.jsx)(k,{}),label:"Change name",onClick:()=>{v(!0)}},{key:1,icon:(0,o.jsx)(g,{}),label:"Authenticate",onClick:()=>S(!0)}];return T&&B.push({key:3,"aria-expanded":I===h.gG.VISIBLE,className:b().chatToggle,icon:(0,o.jsx)(C,{}),label:I===h.gG.VISIBLE?"Hide Chat":"Show Chat",onClick:N}),U&&B.push({key:4,icon:A?(0,o.jsx)(w,{}):(0,o.jsx)(E,{}),label:A?"Put chat back":"Pop out chat",onClick:A?M:()=>{M();let e=window.open("/embed/chat/readwrite","_blank","popup");e.addEventListener("beforeunload",M),O(e),D(h.gG.POPPED_OUT)}}),(0,o.jsx)(p.SV,{fallbackRender:e=>{let{error:n,resetErrorBoundary:t}=e;return(0,o.jsx)(y.A,{componentName:"UserDropdown",message:n.message,retryFunction:t})},children:(0,o.jsxs)("div",{className:b().root,children:[(0,o.jsx)(r.default,{menu:{items:B},trigger:["click"],children:(0,o.jsxs)(a.default,{id:n,type:"primary",icon:(0,o.jsx)(L,{className:b().userIcon}),children:[(0,o.jsx)("span",{className:l()([b().username,i&&b().hideTitleOnMobile]),children:t||V}),(0,o.jsx)(m,{})]})}),(0,o.jsx)(j,{title:"Change Chat Display Name",open:f,handleCancel:K,children:(0,o.jsx)(_,{closeModal:K})}),(0,o.jsx)(j,{title:"Authenticate",open:G,handleCancel:()=>S(!1),children:(0,o.jsx)(x,{})})]})})}},27345:function(e){e.exports={root:"UserDropdown_root__XCKtE","ant-space":"UserDropdown_ant-space__NT8a9","ant-space-item":"UserDropdown_ant-space-item__D6AUQ",username:"UserDropdown_username__1vJf_",hideTitleOnMobile:"UserDropdown_hideTitleOnMobile__Nd7fp",chatToggle:"UserDropdown_chatToggle__MEP4e"}},46977:function(e,n,t){"use strict";t.d(n,{y1:function(){return g}});var o=t(67294);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)}t(85893);var a=["shift","alt","meta","mod","ctrl"],i={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function l(e){return(i[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function c(e,n){return void 0===n&&(n=","),e.split(n)}function s(e,n,t){void 0===n&&(n="+");var o=e.toLocaleLowerCase().split(n).map(function(e){return l(e)});return r({},{alt:o.includes("alt"),ctrl:o.includes("ctrl")||o.includes("control"),shift:o.includes("shift"),meta:o.includes("meta"),mod:o.includes("mod")},{keys:o.filter(function(e){return!a.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([l(e.key),l(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&p([l(e.key),l(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];u.has("meta")&&u.forEach(function(e){return!a.includes(e)&&u.delete(e.toLowerCase())}),n.forEach(function(e){return u.add(e.toLowerCase())})}function p(e){var n=Array.isArray(e)?e:[e];"meta"===e?u.clear():n.forEach(function(e){return u.delete(e.toLowerCase())})}function h(e,n){var t=e.target;void 0===n&&(n=!1);var o=t&&t.tagName;return d(n)?!!(o&&n&&n.some(function(e){return e.toLowerCase()===o.toLowerCase()})):!!(o&&n&&!0===n)}var v=function(e,n,t){void 0===t&&(t=!1);var o,r=n.alt,a=n.meta,i=n.mod,c=n.shift,s=n.ctrl,f=n.keys,p=e.key,h=e.code,v=e.ctrlKey,b=e.metaKey,y=e.shiftKey,m=e.altKey,k=l(h),g=p.toLowerCase();if(!t){if(!m===r&&"alt"!==g||!y===c&&"shift"!==g)return!1;if(i){if(!b&&!v)return!1}else if(!b===a&&"meta"!==g&&"os"!==g||!v===s&&"ctrl"!==g&&"control"!==g)return!1}return!!(f&&1===f.length&&(f.includes(g)||f.includes(k)))||(f?(void 0===o&&(o=","),(d(f)?f:f.split(o)).every(function(e){return u.has(e.trim().toLowerCase())})):!f)},b=(0,o.createContext)(void 0),y=(0,o.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),m=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},k="undefined"!=typeof window?o.useLayoutEffect:o.useEffect;function g(e,n,t,r){var a,i=(0,o.useRef)(null),u=(0,o.useRef)(!1),g=t instanceof Array?r instanceof Array?void 0:r:t,w=d(e)?e.join(null==g?void 0:g.splitKey):e,E=t instanceof Array?t:r instanceof Array?r:void 0,C=(0,o.useCallback)(n,null!=E?E:[]),L=(0,o.useRef)(C);E?L.current=C:L.current=n;var j=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(o,r){return o&&e(n[r],t[r])},!0):n===t}((a=(0,o.useRef)(void 0)).current,g)&&(a.current=g),a.current),_=(0,o.useContext)(y).enabledScopes,x=(0,o.useContext)(b);return k(function(){if((null==j?void 0:j.enabled)!==!1&&(e=null==j?void 0:j.scopes,0===_.length&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!e||_.some(function(n){return e.includes(n)})||_.includes("*")))){var e,n=function(e,n){var t;if(void 0===n&&(n=!1),!(h(e,["input","textarea","select"])&&!h(e,null==j?void 0:j.enableOnFormTags)||null!=j&&null!=j.ignoreEventWhen&&j.ignoreEventWhen(e))){if(null!==i.current&&document.activeElement!==i.current&&!i.current.contains(document.activeElement)){m(e);return}(null==(t=e.target)||!t.isContentEditable||null!=j&&j.enableOnContentEditable)&&c(w,null==j?void 0:j.splitKey).forEach(function(t){var o,r,a,i=s(t,null==j?void 0:j.combinationKey);if(v(e,i,null==j?void 0:j.ignoreModifiers)||null!=(a=i.keys)&&a.includes("*")){if(n&&u.current)return;if(("function"==typeof(o=null==j?void 0:j.preventDefault)&&o(e,i)||!0===o)&&e.preventDefault(),"function"==typeof(r=null==j?void 0:j.enabled)?!r(e,i):!0!==r&&void 0!==r){m(e);return}L.current(e,i),n||(u.current=!0)}})}},t=function(e){void 0!==e.key&&(f(l(e.code)),((null==j?void 0:j.keydown)===void 0&&(null==j?void 0:j.keyup)!==!0||null!=j&&j.keydown)&&n(e))},o=function(e){void 0!==e.key&&(p(l(e.code)),u.current=!1,null!=j&&j.keyup&&n(e,!0))},r=i.current||(null==g?void 0:g.document)||document;return r.addEventListener("keyup",o),r.addEventListener("keydown",t),x&&c(w,null==j?void 0:j.splitKey).forEach(function(e){return x.addHotkey(s(e,null==j?void 0:j.combinationKey,null==j?void 0:j.description))}),function(){r.removeEventListener("keyup",o),r.removeEventListener("keydown",t),x&&c(w,null==j?void 0:j.splitKey).forEach(function(e){return x.removeHotkey(s(e,null==j?void 0:j.combinationKey,null==j?void 0:j.description))})}}},[w,j,_]),i}}}]);