// ==UserScript== // @name KICK Enhancer // @namespace kick-enhancer/userscript // @version 0.1.1 // @author emy // @description Enhances KICK with viewer counts, stream uptime, content controls, and direct clip downloads. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAW9yTlQBz6J3mgAABtRJREFUWMPFl2uoZWUdxn/P+66199nnnLk2kl0QisBE88J8EaIQ1LwcGZsMRs/UaFcTIa1BQdIvKUp5KYsCZ5Co1BQl1LyATh8SGz+YGTkSUhZEXhh1dDpzbnut9T59eNfZe5+tZknQ+2FtNmu97/P/P//nf3nh/7wEcE7/GCbLEiESDgEFkxyImDT4NGFVpBQgCXHU4ie4snvz8CwRDRYCPALhlV8ZksiHptRkA97NSovLqFuOOCLRHpz/6b9goDqayaIjkBM+NqIjTbMsimCSwYjgROpWpD8F2FfQ0c/8pG0HkhNB6yRO8YCMVQwIqIANhqcEzwBKqXYB0IvTQD+C60j8qmkuhlCBi+xHAKhBpdANQpctMBeNkySnSBngdmCmpTcMqTeZGQXwc9gnm5ahZAqAWg2RRPZUC5Bs9LqgGCGyNt6USIuBghP8SUmw2Ee9kjuBGWA5g7sZYbkG9YB9hpOR9gNSCAayAQONMHBXQhEI+ZUlhFAw9hwH2KDDBEq90ncAnwH6oHIoPgSqgR74r8YzwP723MYp0dR15haNxotV1rg90NAkjFxMHvCrXPzKtRXJtwLnZXCK1eDUQAl+0eZM0N9pwSFzXHQ6rQHtzxDMA/iQ1d2Ap0XYP8HaOz+ny6k31T9CfHEIvkrYTWaD12xmgOfacA7AY4wMQhAG2bPKc6sFN54wYb7Huq0n6aynzvUl34uEi0B98FuBF8Ah4y2IPwgKpBqDnQbgAwO8Km0GAWjB6SaHpQnWnHMa2/aezRe+E4mXgsfBV9QegWXjrYK9QIGH4KGIqzaEvCtliQ0UCaAG3DFqeqzZdhbbH9vCBd8u6VwOrsZobzcKwMbnCu0BZc9DxhgHHxhQuBiJ/EoYXJqgDtOzZ7J9zww7ruzQvaoFj2O1zFnJjuDPC+4FSkSdLfIq2kdXMcyCgLIObIQJReHu9rN1/oNnMHtZh87VbwYf5LAyOBci3ZHVTwXgZEIMb1uKw4r4EsYkTFIuvJ0vzWjHfad79usdJr7bplXgTe0jW2/YibQLKFLdVAvNAva/Bx8YYGoCQgQCYS3mrhM56e6Pp9OO6dK9bqSyjZ/WtIzskXQTUDqlRoKeJgghvGMzCgCR7or3JNJBydue4NHZJ8Ij+5ZZumyE9jRSbPLWbNwp2FdgKilERD4rNe9oQAGwxALdAUYg0WCaXfd5d1Wq/PHpPq/XYeKGNq7xLTpqAl0Lnkf6gQiFFlTvmDpO56cTaBQokAW8UC/ySPnsOANl9j0rISj3z6Wk5qcP+CdbH+aOG/ssf6utbg3jFQO71cjNJH8FVDPpcL3v9xG810emeU/7Fab9Cuvja2+RBSPCUp4JJIVGqFrUoZ/fz63bGqprz/IFvQ4TVw6zwSP93rnziV0mLf5Tb9z2Q76x9kW/3CGsnzdTiwGxHwMvjxeipk1BoO18oGhcg1yx+IuHue3Ue7X7qor+9ZkJ1awuXFpJCePr1lUb9TeevyURX+i7ukaO2BQfpNb56Sgu8NF82ptXekFYNfvlpzGKgr5Qd5mFux/lrq3LWrp81t/sROIlw0YkwAH0hszzoBcowWhjkjvJXpfyN17PBxy1BjATo71g6Ik99MvOVKtPNuKe3/CrmTm9fumFvnoqEr8MXgZ3culmhsDe7f0tEwvNnzXdmxxMRUuaopsOTB7i+aWa+UoUTLFpvBdoTA+t2XnKmTdsnGfunHu4hcLFhcDtoG676WXg6XP52D2dzkvPru1N/j4SjgcdKqQzJph7WqF8ptHUDYU2UmhdeFVFZqAYA/VYoQVb7XTUkBZ7THNdOC/WS3M7iu70NHA2uL+MypLORyF8GEiGBaASYb3R4TlM8SMMtBZXQjB8rgoG2LaVZ2wrdwxt4DAKRxUTa5JTs00Ke4ATuib9RX/c+R4ffsQmvb8wzdeMj0nweElxW8IbQPsCZZ5LqFbSMAxzIE+1yTnVvDLfGzXGjXFqqPmtHko7/f2AWDY+U+hx5N17U//GhurAian75JHxuDMC4di+m2cFuwXxVdwcny7C4PetiLCmGp2FeoJgaxPK7zMrro1jsqeE6LEGoQQhkJizOFXiMSs9CXrxd8EfmuX4tc73pHWNE1Gx3KSCl+KuBuDQSgjK5bXQPZja0PzS6B+gBUxYocAmWWnS8HirhVRRUVIkAlFmP+ZTQWEWc0BSf5bNNwO/Nn5CEonUP8hcekDPvamWvrvrWb+PimJ4lgcFBMXwn1/NPuvNdAYlPgacBjcbtXXRhiRTuU6RkAAOqstD9d5RMAExOREeiPX2LZujjCrqVFIkAa9rngf/VwyML990xUjXHnZX7bzmbff8Cx1fShSwufUVAAAAAElFTkSuQmCC // @homepage https://github.com/sixem/kick-enhancer#readme // @homepageURL https://github.com/sixem/kick-enhancer // @source https://github.com/sixem/kick-enhancer // @supportURL https://github.com/sixem/kick-enhancer/issues // @downloadURL https://raw.githubusercontent.com/sixem/kick-enhancer/main/dist/kick-enhancer.user.js // @updateURL https://raw.githubusercontent.com/sixem/kick-enhancer/main/dist/kick-enhancer.meta.js // @match https://kick.com/* // @grant GM.getValue // @grant GM.setValue // @grant unsafeWindow // @run-at document-start // @noframes // ==/UserScript== /*! * Preact 10.29.7 * Source: https://github.com/preactjs/preact * * The MIT License (MIT) * * Copyright (c) 2015-present Jason Miller * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * --- * * mux.js 6.3.0 * Source: https://github.com/videojs/mux.js * * Apache License * Version 2.0, January 2004 * http://www.apache.org/licenses/ * * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION * * 1. Definitions. * * "License" shall mean the terms and conditions for use, reproduction, * and distribution as defined by Sections 1 through 9 of this document. * * "Licensor" shall mean the copyright owner or entity authorized by * the copyright owner that is granting the License. * * "Legal Entity" shall mean the union of the acting entity and all * other entities that control, are controlled by, or are under common * control with that entity. For the purposes of this definition, * "control" means (i) the power, direct or indirect, to cause the * direction or management of such entity, whether by contract or * otherwise, or (ii) ownership of fifty percent (50%) or more of the * outstanding shares, or (iii) beneficial ownership of such entity. * * "You" (or "Your") shall mean an individual or Legal Entity * exercising permissions granted by this License. * * "Source" form shall mean the preferred form for making modifications, * including but not limited to software source code, documentation * source, and configuration files. * * "Object" form shall mean any form resulting from mechanical * transformation or translation of a Source form, including but * not limited to compiled object code, generated documentation, * and conversions to other media types. * * "Work" shall mean the work of authorship, whether in Source or * Object form, made available under the License, as indicated by a * copyright notice that is included in or attached to the work * (an example is provided in the Appendix below). * * "Derivative Works" shall mean any work, whether in Source or Object * form, that is based on (or derived from) the Work and for which the * editorial revisions, annotations, elaborations, or other modifications * represent, as a whole, an original work of authorship. For the purposes * of this License, Derivative Works shall not include works that remain * separable from, or merely link (or bind by name) to the interfaces of, * the Work and Derivative Works thereof. * * "Contribution" shall mean any work of authorship, including * the original version of the Work and any modifications or additions * to that Work or Derivative Works thereof, that is intentionally * submitted to Licensor for inclusion in the Work by the copyright owner * or by an individual or Legal Entity authorized to submit on behalf of * the copyright owner. For the purposes of this definition, "submitted" * means any form of electronic, verbal, or written communication sent * to the Licensor or its representatives, including but not limited to * communication on electronic mailing lists, source code control systems, * and issue tracking systems that are managed by, or on behalf of, the * Licensor for the purpose of discussing and improving the Work, but * excluding communication that is conspicuously marked or otherwise * designated in writing by the copyright owner as "Not a Contribution." * * "Contributor" shall mean Licensor and any individual or Legal Entity * on behalf of whom a Contribution has been received by Licensor and * subsequently incorporated within the Work. * * 2. Grant of Copyright License. Subject to the terms and conditions of * this License, each Contributor hereby grants to You a perpetual, * worldwide, non-exclusive, no-charge, royalty-free, irrevocable * copyright license to reproduce, prepare Derivative Works of, * publicly display, publicly perform, sublicense, and distribute the * Work and such Derivative Works in Source or Object form. * * 3. Grant of Patent License. Subject to the terms and conditions of * this License, each Contributor hereby grants to You a perpetual, * worldwide, non-exclusive, no-charge, royalty-free, irrevocable * (except as stated in this section) patent license to make, have made, * use, offer to sell, sell, import, and otherwise transfer the Work, * where such license applies only to those patent claims licensable * by such Contributor that are necessarily infringed by their * Contribution(s) alone or by combination of their Contribution(s) * with the Work to which such Contribution(s) was submitted. If You * institute patent litigation against any entity (including a * cross-claim or counterclaim in a lawsuit) alleging that the Work * or a Contribution incorporated within the Work constitutes direct * or contributory patent infringement, then any patent licenses * granted to You under this License for that Work shall terminate * as of the date such litigation is filed. * * 4. Redistribution. You may reproduce and distribute copies of the * Work or Derivative Works thereof in any medium, with or without * modifications, and in Source or Object form, provided that You * meet the following conditions: * * (a) You must give any other recipients of the Work or * Derivative Works a copy of this License; and * * (b) You must cause any modified files to carry prominent notices * stating that You changed the files; and * * (c) You must retain, in the Source form of any Derivative Works * that You distribute, all copyright, patent, trademark, and * attribution notices from the Source form of the Work, * excluding those notices that do not pertain to any part of * the Derivative Works; and * * (d) If the Work includes a "NOTICE" text file as part of its * distribution, then any Derivative Works that You distribute must * include a readable copy of the attribution notices contained * within such NOTICE file, excluding those notices that do not * pertain to any part of the Derivative Works, in at least one * of the following places: within a NOTICE text file distributed * as part of the Derivative Works; within the Source form or * documentation, if provided along with the Derivative Works; or, * within a display generated by the Derivative Works, if and * wherever such third-party notices normally appear. The contents * of the NOTICE file are for informational purposes only and * do not modify the License. You may add Your own attribution * notices within Derivative Works that You distribute, alongside * or as an addendum to the NOTICE text from the Work, provided * that such additional attribution notices cannot be construed * as modifying the License. * * You may add Your own copyright statement to Your modifications and * may provide additional or different license terms and conditions * for use, reproduction, or distribution of Your modifications, or * for any such Derivative Works as a whole, provided Your use, * reproduction, and distribution of the Work otherwise complies with * the conditions stated in this License. * * 5. Submission of Contributions. Unless You explicitly state otherwise, * any Contribution intentionally submitted for inclusion in the Work * by You to the Licensor shall be under the terms and conditions of * this License, without any additional terms or conditions. * Notwithstanding the above, nothing herein shall supersede or modify * the terms of any separate license agreement you may have executed * with Licensor regarding such Contributions. * * 6. Trademarks. This License does not grant permission to use the trade * names, trademarks, service marks, or product names of the Licensor, * except as required for reasonable and customary use in describing the * origin of the Work and reproducing the content of the NOTICE file. * * 7. Disclaimer of Warranty. Unless required by applicable law or * agreed to in writing, Licensor provides the Work (and each * Contributor provides its Contributions) on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied, including, without limitation, any warranties or conditions * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A * PARTICULAR PURPOSE. You are solely responsible for determining the * appropriateness of using or redistributing the Work and assume any * risks associated with Your exercise of permissions under this License. * * 8. Limitation of Liability. In no event and under no legal theory, * whether in tort (including negligence), contract, or otherwise, * unless required by applicable law (such as deliberate and grossly * negligent acts) or agreed to in writing, shall any Contributor be * liable to You for damages, including any direct, indirect, special, * incidental, or consequential damages of any character arising as a * result of this License or out of the use or inability to use the * Work (including but not limited to damages for loss of goodwill, * work stoppage, computer failure or malfunction, or any and all * other commercial damages or losses), even if such Contributor * has been advised of the possibility of such damages. * * 9. Accepting Warranty or Additional Liability. While redistributing * the Work or Derivative Works thereof, You may choose to offer, * and charge a fee for, acceptance of support, warranty, indemnity, * or other liability obligations and/or rights consistent with this * License. However, in accepting such obligations, You may act only * on Your own behalf and on Your sole responsibility, not on behalf * of any other Contributor, and only if You agree to indemnify, * defend, and hold each Contributor harmless for any liability * incurred by, or claims asserted against, such Contributor by reason * of your accepting any such warranty or additional liability. * * END OF TERMS AND CONDITIONS * * APPENDIX: How to apply the Apache License to your work. * * To apply the Apache License to your work, attach the following * boilerplate notice, with the fields enclosed by brackets "[]" * replaced with your own identifying information. (Don't include * the brackets!) The text should be enclosed in the appropriate * comment syntax for the file format. We also recommend that a * file or class name and description of purpose be included on the * same "printed page" as the copyright notice for easier * identification within third-party archives. * * Copyright Brightcove, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ (function(){"use strict";var e=typeof GM<`u`?GM:void 0,t=typeof unsafeWindow<`u`?unsafeWindow:void 0,n={debug:0,info:1,warn:2,error:3,silent:4},r={debug:`color: #8c8c8c`,info:`color: #53fc18`,warn:`color: #f5c451`,error:`color: #ff6b6b`},i=[`background: #53fc18`,`border-radius: 3px`,`color: #071402`,`font-weight: 700`,`padding: 1px 4px`].join(`; `),a=`color: #b0b0b0; font-weight: 600`,o=`color: inherit; font-weight: normal`,s=200,c={colors:!0,filters:[`*`],historyLimit:250,level:`info`},l=[],u=new Set,d,f=1;function p(){let e=S();for(let t of u)try{t(e)}catch(e){console.error(`[KICK Enhancer] Log history listener failed.`,e)}}function m(){d!==void 0&&(globalThis.clearTimeout(d),d=void 0)}function h(){m(),p()}function g(){u.size===0||d!==void 0||(d=globalThis.setTimeout(()=>{d=void 0,p()},s))}function _(e,t){return t===`*`?!0:t.endsWith(`*`)?e.startsWith(t.slice(0,-1)):e===t}function v(e){let t=c.filters.filter(e=>!e.startsWith(`-`)),n=c.filters.filter(e=>e.startsWith(`-`)).map(e=>e.slice(1));return(t.length===0||t.some(t=>_(e,t)))&&!n.some(t=>_(e,t))}function y(e){c.historyLimit<=0||(l.push(e),l.length>c.historyLimit&&(l=c.historyLimit===0?[]:l.slice(-c.historyLimit)),g())}function b(e,t,s){if(y({arguments:s,id:f,level:e,scope:t,timestamp:Date.now()}),f+=1,n[e]x(`${e}:${t}`),debug:(...t)=>b(`debug`,e,t),error:(...t)=>b(`error`,e,t),info:(...t)=>b(`info`,e,t),warn:(...t)=>b(`warn`,e,t)}}function S(){return[...l]}function ee(){l.length!==0&&(l=[],h())}function te(e){return u.add(e),()=>{u.delete(e),u.size===0&&m()}}var C=[`arial`,`verdana`,`tahoma`,`trebuchet`,`georgia`,`monospace`],w=[100,200,300,400,500,600,700,800,900],T={chat:{fontFamily:null,fontSize:null,fontWeight:null,messageDividers:!1,messageSpacing:null},ui:{hideFollowingRecommendations:!1,hideGamblingStreams:!1,hideHomepageCarousel:!1,hideRecommendedChannels:!1,rememberSidebarState:!1,showClipDownloadButtons:!0,showHiddenViewerCounts:!0,showStreamUptime:!1,sidebarCollapsed:!1},version:5};function ne(e){if(!ue(e))return T;let t=ue(e.chat)?e.chat:{},n=ue(e.ui)?e.ui:{};return{chat:{fontFamily:ie(t.fontFamily),fontSize:oe(t.fontSize,10,24),fontWeight:ae(t.fontWeight),messageDividers:t.messageDividers===!0,messageSpacing:oe(t.messageSpacing,0,12)},ui:{hideFollowingRecommendations:n.hideFollowingRecommendations===!0,hideGamblingStreams:n.hideGamblingStreams===!0,hideHomepageCarousel:n.hideHomepageCarousel===!0,hideRecommendedChannels:n.hideRecommendedChannels===!0,rememberSidebarState:n.rememberSidebarState===!0,showClipDownloadButtons:n.showClipDownloadButtons!==!1,showHiddenViewerCounts:n.showHiddenViewerCounts!==!1,showStreamUptime:n.showStreamUptime===!0,sidebarCollapsed:n.sidebarCollapsed===!0},version:5}}function re(e){let t;try{t=JSON.parse(e)}catch{return{ok:!1}}if(!ue(t)||!se(t))return{ok:!1};let n=ne(t);return{compatibilityWarning:!le(t,n),ok:!0,settings:n}}function E(e){return`${JSON.stringify(e,null,2)}\n`}function ie(e){return typeof e==`string`&&C.includes(e)?e:null}function ae(e){return typeof e==`number`&&w.includes(e)?e:null}function oe(e,t,n){return typeof e!=`number`||!Number.isFinite(e)?null:Math.min(n,Math.max(t,Math.round(e)))}function se(e){return ce(e.chat,T.chat)||ce(e.ui,T.ui)}function ce(e,t){return ue(e)&&Object.keys(t).some(t=>Object.prototype.hasOwnProperty.call(e,t))}function le(e,t){if(!ue(t))return Object.is(e,t);if(!ue(e))return!1;let n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(n=>Object.prototype.hasOwnProperty.call(e,n)&&le(e[n],t[n]))}function ue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var de=`settings`,fe=x(`settings`),pe=new Set,D=T,me=Promise.resolve();function he(){for(let e of pe)e(D)}async function ge(){try{let t=await e.getValue(de,``);D=t?ne(JSON.parse(t)):T}catch(e){fe.warn(`Load failed; using defaults`,e),D=T}}function _e(){return D}function ve(){return Se(()=>T)}function ye(e){return Se(()=>e)}function be(e){return pe.add(e),()=>{pe.delete(e)}}function xe(e,t){let n=e(D);return t(n),be(r=>{let i=e(r);Object.is(n,i)||(n=i,t(i))})}function Se(t){let n=t(D);if(n===D)return me;D=n,he();let r=JSON.stringify(D);return me=me.catch(()=>void 0).then(()=>e.setValue(de,r)).catch(e=>{fe.error(`Save failed`,e)}),me}function Ce({fontFamily:e,fontSize:t,fontWeight:n,messageDividers:r,messageSpacing:i}){let a=[e===null?void 0:`font-family: ${we[e]};`,t===null?void 0:`--chatroom-font-size: ${t}px;`,i===null?void 0:`--chatroom-message-spacing: ${i}px;`].filter(e=>e!==void 0),o=[];return a.length>0&&o.push(`#channel-chatroom {\n ${a.join(` `)}\n}`),r&&o.push([`#chatroom-messages > div > [data-index]::after {`,` position: absolute;`,` right: 0;`,` bottom: 0;`,` left: 0;`,` height: 1px;`,` pointer-events: none;`,` content: "";`,` background: #161616;`,`}`].join(` `)),n!==null&&o.push([`#chatroom-messages > div > [data-index] .font-normal[class~="leading-[1.55]"] {`,` font-weight: ${n};`,`}`].join(` `)),o.length===0?``:o.join(` `)}var we={arial:`Arial, Helvetica, sans-serif`,georgia:`Georgia, "Times New Roman", serif`,monospace:`ui-monospace, Consolas, "Courier New", monospace`,tahoma:`Tahoma, Verdana, sans-serif`,trebuchet:`"Trebuchet MS", Arial, sans-serif`,verdana:`Verdana, Geneva, sans-serif`},Te=`kick-enhancer-chat-appearance`,Ee;function De(){Ee?.();let e=!1,t=xe(e=>e.chat,Oe),n=()=>{e||(e=!0,t(),document.getElementById(Te)?.remove(),Ee===n&&(Ee=void 0))};return Ee=n,n}function Oe(e){let t=Ce(e),n=document.getElementById(Te);if(!t){n?.remove();return}if(n){n.textContent!==t&&(n.textContent=t);return}let r=document.createElement(`style`);r.id=Te,r.textContent=t,document.documentElement.append(r)}var ke,O,Ae,k,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve={},He=[],Ue=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,We=Array.isArray;function A(e,t){for(var n in t)e[n]=t[n];return e}function Ge(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ke(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?ke.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return qe(e,o,r,i,null)}function qe(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Ae,__i:-1,__u:0};return i==null&&O.vnode!=null&&O.vnode(a),a}function j(e){return e.children}function M(e,t){this.props=e,this.context=t}function Je(e,t){if(t==null)return e.__?Je(e.__,e.__i+1):null;for(var n;tt&&k.sort(Ne),e=k.shift(),t=k.length,Ye(e)}finally{k.length=Qe.__r=0}}function $e(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v=r&&r.__k||He,y=t.length;for(c=et(n,t,v,c,y),d=0;d0?o=e.__k[a]=qe(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=rt(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:ic?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a+!!u){for(i=n-1,a=n+1;i>=0||a=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function it(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||Ue.test(t)?n:n+`px`}function at(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||it(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||it(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Le,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[Ie]=r[Ie]:(n[Ie]=Re,e.addEventListener(t,a?Be:ze,a)):e.removeEventListener(t,a?Be:ze,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ot(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Fe]==null)t[Fe]=Re++;else if(t[Fe]0?e:We(e)?e.map(ut):e.constructor===void 0?A({},e):null}function dt(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||Ve,_=t.props,v=t.type;if(v==`svg`?i=`http://www.w3.org/2000/svg`:v==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;lnew MutationObserver(e)){if(t.documentElement)return e(),()=>void 0;let r=!0,i=n(()=>{!r||!t.documentElement||(r=!1,i.disconnect(),e())});return i.observe(t,{childList:!0}),()=>{r=!1,i.disconnect()}}var gt=`.ke-confirmation-host{width:100%;min-width:0;height:100%;min-height:0;position:relative;overflow:hidden}.ke-confirmation-layer{z-index:10;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background:#00000052;place-items:center;padding:1rem;display:grid;position:absolute;inset:0}.ke-confirmation-dialog{background:#080808;border:1px solid #303030;border-radius:.45rem;width:min(24rem,100%);padding:1.1rem;box-shadow:0 1rem 3rem #0000008c}.ke-confirmation-dialog__copy{gap:.45rem;display:grid}.ke-confirmation-dialog__title{color:#f2f2f2;margin:0;font-size:1rem;font-weight:700;line-height:1.3}.ke-confirmation-dialog__description{color:#747474;margin:0;font-size:.825rem;font-weight:500;line-height:1.5}.ke-confirmation-dialog__actions{justify-content:flex-end;gap:.65rem;margin-top:1rem;display:flex}.ke-button,.ke-text-field,.ke-select-box__input,.ke-track-bar{box-sizing:border-box;font:inherit}.ke-button{color:#f2f2f2;cursor:pointer;background:#0a0a0a;border:1px solid #1b1b1b;border-radius:.45rem;min-height:2.35rem;padding:0 .85rem;font-size:.875rem;font-weight:650;line-height:1;transition:background .14s,border-color .14s,color .14s}.ke-button:hover:not(:disabled){background:#101010;border-color:#303030}.ke-button:focus-visible{outline-offset:2px;outline:2px solid #53fc18}.ke-button:disabled{cursor:not-allowed;opacity:.45}.ke-button--compact{min-height:2rem;padding-inline:.65rem}.ke-button--primary{color:#071402;background:#53fc18;border-color:#53fc18}.ke-button--primary:hover:not(:disabled){background:#7dff50;border-color:#7dff50}.ke-button--danger{color:#ff6b6b}.ke-form-field{color:#f2f2f2;gap:.4rem;min-width:0;display:grid}.ke-form-field__label{font-size:.875rem;font-weight:650;line-height:1.25;display:block}.ke-form-field__description{color:#747474;font-size:.78rem;font-weight:500;line-height:1.4;display:block}.ke-text-field,.ke-select-box__input{color:#f2f2f2;background:#0a0a0a;border:1px solid #1b1b1b;border-radius:.45rem;outline:none;width:100%;min-height:2.35rem;font-size:.875rem;transition:background .14s,border-color .14s}.ke-text-field:hover:not(:disabled),.ke-select-box__input:hover:not(:disabled){background:#101010;border-color:#303030}.ke-text-field:focus-visible,.ke-select-box__input:focus-visible{border-color:#53fc18;box-shadow:0 0 0 1px #53fc18}.ke-text-field:disabled,.ke-select-box__input:disabled{cursor:not-allowed;opacity:.45}.ke-text-field{-webkit-user-select:text;user-select:text;padding:0 .72rem}.ke-text-field::placeholder{color:#8c8c8c}.ke-text-field-shell{align-items:stretch;display:flex}.ke-text-field-shell .ke-text-field{border-radius:.45rem 0 0 .45rem;flex:auto;min-width:0}.ke-text-field__suffix{color:#8c8c8c;background:#080808;border:1px solid #1b1b1b;border-left:0;border-radius:0 .45rem .45rem 0;flex:none;align-items:center;padding-inline:.7rem;font-size:.875rem;display:flex}.ke-text-field-shell:focus-within .ke-text-field__suffix{border-color:#53fc18}.ke-select-box{display:block;position:relative}.ke-select-box__input{appearance:none;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;cursor:pointer;padding:0 2.2rem 0 .72rem}.ke-select-box__chevron{pointer-events:none;border-bottom:1.5px solid #8c8c8c;border-right:1.5px solid #8c8c8c;width:.45rem;height:.45rem;position:absolute;top:50%;right:.85rem;transform:translateY(-70%)rotate(45deg)}.ke-toggle{color:#f2f2f2;cursor:pointer;justify-content:space-between;align-items:center;gap:1rem;display:flex}.ke-toggle__copy{gap:.4rem;min-width:0;display:grid}.ke-toggle__control{flex:none;position:relative}.ke-toggle__input{opacity:0;pointer-events:none;width:1px;height:1px;position:absolute;overflow:hidden}.ke-toggle__track{background:#0a0a0a;border:1px solid #303030;border-radius:999px;width:2.4rem;height:1.35rem;transition:background .14s,border-color .14s;display:block;position:relative}.ke-toggle__thumb{background:#8c8c8c;border-radius:50%;width:.85rem;height:.85rem;transition:background .14s,transform .14s;position:absolute;top:.18rem;left:.18rem}.ke-toggle__input:checked+.ke-toggle__track{background:#53fc18;border-color:#53fc18}.ke-toggle__input:checked+.ke-toggle__track .ke-toggle__thumb{background:#071402;transform:translate(1.02rem)}.ke-toggle__input:focus-visible+.ke-toggle__track{outline-offset:2px;outline:2px solid #53fc18}.ke-toggle__input:disabled+.ke-toggle__track{opacity:.45}.ke-track-bar__heading{justify-content:space-between;align-items:baseline;gap:1rem;display:flex}.ke-track-bar__value{color:#8c8c8c;font-variant-numeric:tabular-nums;font-size:.78rem}.ke-track-bar{appearance:none;cursor:pointer;background:0 0;outline:none;width:100%;height:1.25rem;margin:0}.ke-track-bar::-webkit-slider-runnable-track{background:linear-gradient(to right, #53fc18 0 var(--ke-track-progress), #1b1b1b var(--ke-track-progress) 100%);border-radius:999px;height:.28rem}.ke-track-bar::-moz-range-track{background:#1b1b1b;border-radius:999px;height:.28rem}.ke-track-bar::-moz-range-progress{background:#53fc18;border-radius:999px;height:.28rem}.ke-track-bar::-webkit-slider-thumb{appearance:none;background:#050505;border:2px solid #53fc18;border-radius:50%;width:1rem;height:1rem;margin-top:-.36rem}.ke-track-bar::-moz-range-thumb{background:#050505;border:2px solid #53fc18;border-radius:50%;width:.8rem;height:.8rem}.ke-track-bar:focus-visible::-webkit-slider-thumb{outline-offset:2px;outline:2px solid #53fc18}.ke-track-bar:focus-visible::-moz-range-thumb{outline-offset:2px;outline:2px solid #53fc18}.ke-list-view{--ke-list-view-scrollbar-gutter:.5rem;-webkit-user-select:none;user-select:none;background:#080808;border:1px solid #1b1b1b;border-radius:.45rem;grid-template-rows:2rem minmax(0,1fr);min-width:0;min-height:0;display:grid;overflow:hidden}.ke-list-view__header-group,.ke-list-view__scroll{box-sizing:border-box;min-width:0;min-height:0;padding-right:var(--ke-list-view-scrollbar-gutter)}.ke-list-view__scroll{--ke-scroll-indicator-right:var(--ke-list-view-scrollbar-gutter)}.ke-list-view__header-group{background:#0a0a0a;border-bottom:1px solid #1b1b1b}.ke-list-view__header,.ke-list-view__row{width:100%;min-width:0;display:grid}.ke-list-view__header{color:#8c8c8c;letter-spacing:.04em;text-transform:uppercase;height:100%;font-size:.72rem;font-weight:700}.ke-list-view__header-cell,.ke-list-view__cell{align-items:center;min-width:0;padding:.42rem .6rem;display:flex;overflow:hidden}.ke-list-view__header-cell:not(:last-child),.ke-list-view__cell:not(:last-child){border-right:1px solid #1b1b1b}.ke-list-view__header-cell[data-align=center],.ke-list-view__cell[data-align=center]{text-align:center;justify-content:center}.ke-list-view__header-cell[data-align=end],.ke-list-view__cell[data-align=end]{text-align:right;justify-content:flex-end}.ke-list-view__header-label,.ke-list-view__cell-content{text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:100%;overflow:hidden}.ke-list-view__body{min-width:0;min-height:100%;position:relative}.ke-list-view__body[data-virtualized=true]{contain:layout paint style}.ke-list-view__row{box-sizing:border-box;color:#f2f2f2;border-bottom:1px solid #1b1b1b;min-height:2.125rem;font-size:.76rem}.ke-list-view__row[data-last-row=true]{border-bottom:0}.ke-list-view__row[data-virtualized=true]{contain:layout paint style;position:absolute;top:0;left:0}.ke-list-view__row:hover{background:#101010}.ke-list-view__row.is-interactive{cursor:pointer}.ke-list-view__row.is-interactive:focus-visible{outline-offset:-1px;outline:1px solid #53fc18}.ke-list-view__empty{color:#8c8c8c;text-align:center;place-items:center;min-height:4rem;padding:1rem;font-size:.78rem;display:grid}.ke-list-view__live-status{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;padding:0;position:absolute;overflow:hidden}.ke-modal{color:#f2f2f2;-webkit-user-select:none;user-select:none;background:0 0;border:1px solid #1b1b1b;border-radius:.65rem;outline:none;width:min(36rem,100vw - 2rem);max-width:none;max-height:calc(100vh - 2rem);margin:auto;padding:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:16px;line-height:1.5;overflow:visible;box-shadow:0 1.5rem 5rem #000000a6}.ke-modal::backdrop{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:#0000009e}.ke-modal,.ke-modal *{box-sizing:border-box}.ke-modal ::selection{color:#000;background:#fff}.ke-modal__surface{border-radius:inherit;background:#050505;max-height:calc(100vh - 2rem);animation:.15s ease-out ke-modal-enter;display:grid;overflow:hidden}.ke-modal__header{border-bottom:1px solid #1b1b1b;justify-content:space-between;align-items:flex-start;gap:1rem;padding:1.25rem 1.25rem 1rem;display:flex}.ke-modal__heading{min-width:0}.ke-modal__identity{align-items:center;gap:.85rem;min-width:0;display:flex}.ke-modal__icon{object-fit:contain;flex:none;width:2.75rem;height:2.75rem}.ke-modal__title{color:#f2f2f2;margin:0;font-size:1.1rem;font-weight:750;line-height:1.25}.ke-modal__description{color:#8c8c8c;margin:.35rem 0 0;font-size:.8rem;font-weight:500;line-height:1.45}.ke-modal__close{place-items:center;width:2rem;min-width:2rem;min-height:2rem;padding:0;font-size:1.3rem;font-weight:400;display:grid}.ke-modal__body{scrollbar-color:#303030 transparent;min-height:0;padding:1.25rem;overflow-y:auto}.ke-modal__footer{background:#080808;border-top:1px solid #1b1b1b;justify-content:flex-end;gap:.65rem;padding:1rem 1.25rem;display:flex}.ke-settings{gap:1.35rem;display:grid}.ke-settings__actions{justify-content:flex-end;display:flex}.ke-workspace-modal{--ke-workspace-modal-gutter:clamp(1rem, 4vw, 2rem);--ke-workspace-modal-height:52rem;--ke-workspace-modal-width:52rem;width:min(var(--ke-workspace-modal-width), 100vw - var(--ke-workspace-modal-gutter));max-height:calc(100dvh - var(--ke-workspace-modal-gutter))}.ke-workspace-modal .ke-modal__surface{height:min(var(--ke-workspace-modal-height), 100dvh - var(--ke-workspace-modal-gutter));grid-template-rows:auto minmax(0,1fr) auto}.ke-workspace-modal .ke-modal__body{padding:0;overflow:hidden}.ke-settings-modal{--ke-workspace-modal-height:46rem}.ke-settings-modal__tabs{width:100%;height:100%}.ke-settings-modal__github{align-items:center;gap:.45rem;margin-right:auto;display:inline-flex}.ke-settings-modal__github:hover:not(:disabled){color:#53fc18;background:#0a0a0a}.ke-settings-modal__github-icon{flex:none;width:1.05rem;height:1.05rem}@keyframes ke-modal-enter{0%{opacity:0;transform:translateY(.35rem)scale(.985)}to{opacity:1;transform:translateY(0)scale(1)}}@media (prefers-reduced-motion:reduce){.ke-modal__surface{animation:none}}.ke-scroll-area{min-width:0;height:100%;min-height:0;position:relative;overflow:hidden}.ke-scroll-area[data-height=content]{height:auto}.ke-scroll-area[data-height=content] .ke-scroll-area__viewport{height:auto;max-height:inherit}.ke-scroll-area[data-height=content] .ke-scroll-area__content{min-height:0}.ke-scroll-area__viewport{overscroll-behavior:contain;scrollbar-width:none;width:100%;min-width:0;height:100%;min-height:0;overflow:auto}.ke-scroll-area__viewport::-webkit-scrollbar{width:0;height:0}.ke-scroll-area__viewport:focus{outline:none}.ke-scroll-area__viewport:focus-visible{outline-offset:-1px;outline:1px solid #1b1b1b}.ke-scroll-area__content{min-width:100%;min-height:100%}.ke-scroll-area[data-scroll-indicators=true]:before,.ke-scroll-area[data-scroll-indicators=true]:after{z-index:1;right:var(--ke-scroll-indicator-right,0);content:"";pointer-events:none;height:.75rem;position:absolute;left:0}.ke-scroll-area[data-scroll-indicators=true][data-overflow-top]:before{background:linear-gradient(#00000080,#0000);top:0}.ke-scroll-area[data-scroll-indicators=true][data-overflow-bottom]:after{background:linear-gradient(#0000,#00000080);bottom:0}.ke-scroll-area__thumb{z-index:2;cursor:default;opacity:0;pointer-events:none;touch-action:none;background:#fff;border-radius:.125rem;width:.25rem;transition:background .14s,opacity .14s;position:absolute;top:0;right:.25rem}.ke-scroll-area__thumb:not([data-visible=true]){display:none}.ke-scroll-area:hover>.ke-scroll-area__thumb[data-visible=true],.ke-scroll-area:focus-within>.ke-scroll-area__thumb[data-visible=true],.ke-scroll-area.is-dragging>.ke-scroll-area__thumb[data-visible=true]{opacity:1;pointer-events:auto;background:#fff}.ke-scroll-area[data-scrollbar=compact]>.ke-scroll-area__thumb{width:.1875rem;right:.15rem}.ke-scroll-area[data-scrollbar=overlay]>.ke-scroll-area__thumb{width:.25rem;right:.3rem}@media (prefers-reduced-motion:reduce){.ke-scroll-area__thumb{transition:none}}.ke-tabs{grid-template-rows:auto minmax(0,1fr);width:100%;min-width:0;height:100%;min-height:0;display:grid;overflow:hidden}.ke-tabs__list{background:#050505;border-bottom:1px solid #1b1b1b;align-items:stretch;min-width:0;min-height:2.5rem;display:flex;overflow:hidden}.ke-tabs__tab{color:#8c8c8c;min-width:0;font:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;background:0 0;border:0;border-bottom:.125rem solid #0000;outline:none;flex:0 auto;padding:.5rem .75rem;font-size:.875rem;font-weight:550;transition:background .14s,color .14s;overflow:hidden}.ke-tabs__tab:hover:not(:disabled){color:#f2f2f2;background:#101010}.ke-tabs__tab:focus-visible{outline-offset:-1px;outline:1px solid #53fc18}.ke-tabs__tab[aria-selected=true]{color:#f2f2f2;border-bottom-color:#f2f2f2}.ke-tabs__tab:disabled{color:#747474;cursor:default;opacity:.45}.ke-tabs__panel{min-width:0;min-height:0;overflow:hidden}.ke-tabs__panel[hidden]{display:none}.ke-tabs__scroll{height:100%}.ke-tabs__panel-content{padding:1rem 1.25rem 1.25rem}.ke-tabs__panel-content--centered{place-items:safe center center;display:grid}`,_t=`kick-enhancer-shared-ui-styles`;function vt(){if(document.getElementById(_t))return;let e=document.createElement(`style`);e.id=_t,e.textContent=gt,document.documentElement.append(e)}var yt=0;Array.isArray;function P(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--yt,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(s in o)c[s]===void 0&&(c[s]=o[s]);return O.vnode&&O.vnode(l),l}function bt({class:e}){return P(`svg`,{"aria-hidden":`true`,class:e,fill:`none`,viewBox:`0 0 24 24`,children:[P(`path`,{d:`M14 8a1 1 0 0 1 1 1v2a1 1 0 0 0 1 1h3.293a.707.707 0 0 1 .5 1.207l-6.939 6.939a1.207 1.207 0 0 1-1.708 0l-6.94-6.94a.707.707 0 0 1 .5-1.206H8a1 1 0 0 0 1-1V9a1 1 0 0 1 1-1z`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`}),P(`path`,{d:`M9 4h6`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`})]})}function xt({class:e}){return P(`svg`,{"aria-hidden":`true`,class:e,fill:`currentColor`,viewBox:`0 0 24 24`,children:P(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})})}function St({class:e}){return P(`svg`,{"aria-hidden":`true`,class:e,fill:`none`,viewBox:`0 0 24 24`,children:[P(`circle`,{cx:`12`,cy:`12`,opacity:`0.25`,r:`9`,stroke:`currentColor`,"stroke-width":`2.5`}),P(`path`,{d:`M12 3a9 9 0 0 1 9 9`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-width":`2.5`})]})}var Ct=`[data-testid="livestream-results-card"]`,wt=`button[aria-label="Open clip modal"]`,Tt=`a[href*="/clips/clip_"]`,Et=/^clip_[A-Za-z0-9_-]+$/,Dt=128;function Ot(e){return e.length<=Dt&&Et.test(e)}function kt(e,t){if(!e)return;let n,r;try{n=new URL(t),r=new URL(e,`${n.origin}/`)}catch{return}if(r.origin!==n.origin)return;let i=r.pathname.split(`/`).filter(Boolean);if(i.length!==3||i[1]!==`clips`)return;let a=i[2];if(Ot(a))return a}function At(e,t){let n=new Set;for(let r of e){let e=kt(r,t);e&&n.add(e)}return n.size===1?n.values().next().value:void 0}function jt(e,t){if(e.querySelector(`button[aria-label="Open clip modal"]`))return At(Array.from(e.querySelectorAll(Tt),e=>e.getAttribute(`href`)),t)}function Mt(e,t,n){e.preventDefault(),e.stopPropagation(),n(t)}function Nt(e,t=queueMicrotask){let n=new Set,r=!0,i=!1;function a(){if(i=!1,!r||n.size===0)return;let t=[...n];n.clear(),e(t)}return{cancel(){r=!1,n.clear()},enqueue(e){r&&(n.add(e),!i&&(i=!0,t(a)))}}}function Pt({clipId:e,onSelectClip:t}){function n(e){e.stopPropagation()}return P(`button`,{"aria-label":`Download source clip`,class:`ke-clip-download-action`,"data-ke-clip-download":!0,onClick:n=>Mt(n,e,t),onMouseDown:n,onPointerDown:n,type:`button`,children:P(bt,{class:`ke-icon ke-clip-download-action__icon`})})}var Ft,F,It,Lt,Rt=0,zt=[],I=O,Bt=I.__b,Vt=I.__r,Ht=I.diffed,Ut=I.__c,Wt=I.unmount,Gt=I.__;function Kt(e,t){I.__h&&I.__h(F,e,Rt||t),Rt=0;var n=F.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function L(e){return Rt=1,qt(tn,e)}function qt(e,t,n){var r=Kt(Ft++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):tn(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=F,!F.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};F.__f=!0;var a=F.shouldComponentUpdate,o=F.componentWillUpdate;F.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},F.shouldComponentUpdate=i}return r.__N||r.__}function R(e,t){var n=Kt(Ft++,3);!I.__s&&en(n.__H,t)&&(n.__=e,n.u=t,F.__H.__h.push(n))}function z(e){return Rt=5,Jt(function(){return{current:e}},[])}function Jt(e,t){var n=Kt(Ft++,7);return en(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function B(e,t){return Rt=8,Jt(function(){return e},t)}function V(){var e=Kt(Ft++,11);if(!e.__){for(var t=F.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||=[0,0];e.__=`P`+n[0]+`-`+n[1]++}return e.__}function Yt(){for(var e;e=zt.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Qt),t.__h.some($t),t.__h=[]}catch(n){t.__h=[],I.__e(n,e.__v)}}}I.__b=function(e){F=null,Bt&&Bt(e)},I.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Gt&&Gt(e,t)},I.__r=function(e){Vt&&Vt(e),Ft=0;var t=(F=e.__c).__H;t&&(It===F?(t.__h=[],F.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Qt),t.__h.some($t),t.__h=[],Ft=0)),It=F},I.diffed=function(e){Ht&&Ht(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(zt.push(t)!==1&&Lt===I.requestAnimationFrame||((Lt=I.requestAnimationFrame)||Zt)(Yt)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),It=F=null},I.__c=function(e,t){t.some(function(e){try{e.__h.some(Qt),e.__h=e.__h.filter(function(e){return!e.__||$t(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],I.__e(n,e.__v)}}),Ut&&Ut(e,t)},I.unmount=function(e){Wt&&Wt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Qt(e)}catch(e){t=e}}),n.__H=void 0,t&&I.__e(t,n.__v))};var Xt=typeof requestAnimationFrame==`function`;function Zt(e){var t,n=function(){clearTimeout(r),Xt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Xt&&(t=requestAnimationFrame(n))}function Qt(e){var t=F,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),F=t}function $t(e){var t=F;e.__c=e.__(),F=t}function en(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function tn(e,t){return typeof t==`function`?t(e):t}var nn=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAABACAYAAABC6cT1AAASRklEQVRo3r2be7AkdXXHP+d0z9y5j2VhEUUqWXwbjQTxSYhloCS+YsRoWaISrSSUUVcERVxXwBJBBUFBnqWQGCuAIsEnagIGKUtUBB8QICslhfISFFzcvXvvnTv9O9/80T09M3cee9Fdu/bO9kz3zK/P73ce3/M952evjqc+p0H+vBbTHgSJ5QgiMhruZBYIyj+BmUgyMkRgGIYjZEFSIgj8oXkWvwy0/8t/zmqPhYe30VozA6G9yfwwYBpJ5VUDwxAq/+9+Xl/rvVH1KsBkYOV5+WIytkj6Sj7DmkONeB8gAzJyZYDhGGYOEmbU387LwQb+VJ25B37LFK2rQe3VCt35+d1ka2YhYk/MPwwcUUtkfWLV4lUfCUZc7fvcqCerPJ83+KBC83mDKUsseVgRQkJmhoNBENV8WN/00p2j6ggJgQzHraAg1VqyuiPbdx+UtNYyPxV4czWPg4IwQkgbIfDo9wYsgk6T4nx3L/JUqqi6OtKdJPV9c0CZenpUrXV5WZT/gpCTZKsUOlKAtMbcPoTx5noAq9R2NROwUmgbODdgGfiE4CzIOp45uVBtBta15r4pt6Hf7F3rTU9pdNXzWvRMY7LQRYKIGdw/gPFWRLbCVkvXslLS1WpA+b5AnBvoowZLWeYAeN8DSvW5RhjUyl/sn5yuToggLDCLHQidOolIauH+foyjEPnoVRwzPPUqjZtjAwJxkdBJBgtZltUXyxUv3ZepEt4GPIo0OJKtsPH+Z3EzImA5JgsdAFOe2XEY7waatQ8dZavGuLkffa27BsbFQsdjbMs8G7jspYjW9fm1yOr6MFkpe18EGTYnWRVh5LgJN415olgusJRyc96JsxFolQ9pw2psI2xt8ir3PZaukOK9Ztqidhq6wa0cUd1lHOEou2KXyrFixN50OUIUVNFh5EoXSMppZG8DTkDMIGlgtlcKK8ZrgQ344O59hrhSxrFY9hubv4l8ujksePchDbPKQZURsBRS/b+q/jUeHE99GiZjcArVyCkkOgvulmX/iPEhjDXlY/avtAZXXDsIV91Bel7ZMa5FOtrgHi0W2G7PHqkSLqKUsu+HbIJpjXgEqQ6Appyp3C13p2dTsW0Bm1+w5ixvBH0YsXZgLTXCmLVC3Xd8OOg6SW83tzuXl4N8tjHpZrOuHhumKnwaVv0/FBJ7rn7ABZbPb0a2Deh0r6Slgm3fuhtrtV6Dczpue9W324pVsx0CkXHAxTF+IniHmW1WUdBqNSbPUp+w9IFa9S+DVX/9yt67v2ui5gXpzg7ptCfE7NYg6Cx28KmMNS973N/hdibiMUCsnMWJK7pjD+/ArYTeZvKfSh282dyxelgVkG1H45Tim9WGUb3KQO4ZU/dA47iX6aXfvtN/y9eKW8laOZH0YsM+ifEnVVxlAAFpFMYe6cgGr6kW+g6hd5D59ahDlk2t1i7MpJ7HkjSQ/PRjCKN2eOp5e3ki3RvwntPu+8HVP7Dv8sWFm/CGQ9IhZpwLPB6IUenGMEQYgpzjApYDdyPe6e7XRtHBG01We+Qr9WoAkw2AdPU8uepndcgeKEjvvdyu/2baZz8uKW4jmzaUdBDOecCTUd9K70i1bFUAxYEHEO/+7R1bv7H749eQPwKhu+GsTjHGPUMvKatjuapY8OvANhb2mysP135cvPQTvOFE4rkY5wNPQ7VNr+7Q2NDV72IeQmxU6lyxxxPmyBsZj/TwGmTXQ42CjeoHTAJ3I/ttguMftBu/lGuaS5ZvxFvTKOmZ5lwA7F8LPWmFJ6EwG0pKDNiGODEi/oMsV5bn/D6Hj9O3IT/SzTtLoPNwQh/Yyvx/rtEzuGz7bXizgUU83YzzMJ5d27SNQWNahUcfdHgGLCCdInSRuUV/0vGIBS8BDJhhVXDuBul+OFa9moHPB37KPFsunaEZV2z/PszkRIqn4HYBxkGl0Bqvuiu9tDH53tLptBFnSDrbROcPEbq34hrEEQzCsu4CGbAQ6KOLpH9vsXtcHD+C1iwKHm/u5yJeWMdpbLR670i1R3v+AnFeSB/DrO35HyY0QN5j7jQ88gCU9HYizlhk24U5jeILy7dgJThab865wKED3nsyxh7NmGik8Am4EPQhNxY8+8OFrgBMboZJ/WCityqK8nQ5wVltOL/BXOdzC7diDZDYB+Ms4GUT/bHRnw/sOMcezIYuUXCCZFt3ltBdYG+qiQWrE6TKe5uTFQkuWGD5LCPapz90DY3pQNLe5pyFcVgvRxlK6FfwlKsUvuYwdQVoozlbtrXvYWceeRCBVcRhjdiscmQqAruwIDt9mmzpM/M/oLW7E8Gj3Pk48Jo62g1mLGOyLRuGncYoAsKBKxHvAh7Agt1n1+9Uwd1wTF7TEKrpPZfILl5g8SPG8vbPb3oR03MZEOvcOQ14Xa2WI4WeEKc1KWbLgWuAY3C7t6027jk7+8gzcu+wXFFUXlVJRId0SdA8aYY185/z66HzY1Sk3SzzUzDeNMQzj1JfTYCeGmN64jrQBszvKOa3ML3bOnbF4UGhMseyLng1yL8U+Acz4uHP+fVEkZCYs8xPwjgSVTzTJPihCRowmmBwjB/JbIOZbV5sFzR3kdAAniiqionJME/w1UU6mwx76PN2I1EEEjOW+YkYb68TG1uRWe2IANTYc1UrfQvSBne7aWl7m9npBrvycMfIcAuCguJK8E3Tlv9644UHl0G56Eyb20aMdwKNgWrDJGxtE4CJrUgvxc8EG8z9+ugUTK+ZZlcf7jiG4/iiiM83Ke67XQ9wwPpDSzfXyJ8IHIHUGqANtEJAYzJROMqL9yjaq6MT30tFkDUb/DEOz2limIJiBuLYJYr992MvXviSt0AUSMu3gU4Ce6hWb43ImTUCktqKz0aFrhIDHJ41/B9EWCrSH0fwZdqWKDBcTRrPmqZ1zjyd/dazF4f4k7Dl5WDrA5eATgR+N5C3jsVqmgxVB7M1YTwK49TM/XCssJR2vfCeSN2ykUEWQewPcfp25p+8J9P85fQBsNujk4hPI05EbKto+AkUkfUJp9VQSYF4NNjHjfzvr/HL2dXCu2Fy87oSkkjJsQOnmTpzijVP3FdzHKMjMVlSpE+BPoyxMIKg0WgCoZ/G0qSiTwCPBTvzRfHal7s7KRW7TvCMHKvIVhECkZGlBs0XOPGJguX19/oPeSMHY2YdIp2FdCqwtMK/7zCmq7/W2NWEQb8QGOvBzpHiUPeMVHR22Yp7XRirK6VuQUTQ+WuHMwqKfZb8QfazA8CzZdAZwCcw2kOF1R0RierThNH3BcYTkJ0dioPccorY+cJ7lCtd0ete5Qeq6DKLBo0XzzF3+lza/bHP8BZf/NipYCxB+gjoHKAzdtFtAvlgE9FeAE8zcZ6I52TkRHth5wreG7LXIdNPfeQ0lJO9Qln7ox1t3fOyjZeUSUPYAimdDFyIqraXAX5Nq2NZRkJYlSuPPROzC6T0F+QtOrGwMwWvqqVmfRUSYbgZbqXD60Sic1iTxilGc93rtD9vefgo8Gwb0gmgz1SUk01IQAahrSZnK7XDE88Bu0Cmp+e0aBfLO8vGM+slWl3jM+vnWgPhZDRovL4Bp7S1uHbLumux/zkZ0MMQ78e4rN+NDcA3m0Q02ogU1vq/HpgdZNh5ivSkRtZA6uetf7/D3hQHbkosbcIUXUjabfcaLICXuVsiqSAuSmQnG2y79FUP0/jKXdBe3JtG6+yanJgEYUeVjXaE+YWBriIV/0Kj+csj0n4Urj2n8AMyskagTkDm5LZE2vw4m/3FTx9Y4Kq9fzKOXk41f2t9ddGV3seqrpCMzFs0j5whPyFYnnnjl9ewsPA7aLTuRzoG+FqtKuMSFa2CehouJgqzQ8nzvwZInpHTeqXwS8E+6+QXG/5Zxy9p0HjXeenHxl5LExkYs4FCwoiRreJk8O4bF+mfp2i8t8nM9JHTh8C2bZDZfaCjgau6yf1Irz2uimI7qKeVKDmTgnlrI2wuYCqhPFDT8GYiGh3as4/Ldjcm9F65eus9mgy0weUyM2TI8bxJc4NRHLvA1qnX7nYgsa0As18ibajoI5sIcWwsKaGhyallsMzMmdU0QYpu81LXTqMyxxaOT3CcPizteJesehqsop6jIdJRM8wc7cw23zB3ICwXAHcgbcD4XkUyDFPIk/m43lRICanASBXHrrLM2yBnqixzm6oenvIHc3K3oTaloYKCVW5YI9TchkoaNeQyA0kZ+VSOH5tIsYWtn3x1c//OF7bfQGNu9meKeDvYRRjP7V+zIcc3zNEF8H2MrwL39bqbJNANEoQVlfkFvc4t1dxGG1FMED1Xf5FopF5qjMexMvZLCopWkN49y9RCMPPpN8y+oPjC9htgNr+Z0AbgX4H9BkrGK/P03jAOfEmKowz/VUpBY2qQnNiUXokQXlrqQPtRGf9CGRnJDHEIkDC+M2TjdfqkscY4quJX9k6UUd8ipzEzw8zxLfinm7nL/nZmf+h0MLcbEBuA2ytMPNrTW1/tG51lnv1q+3WnDwld1qweQ5Doa0rUYHdJEbuxrLUSxrcHhL5a4moJOyKevylov89NApNWlg8r6Glmwwx4n9JWb7I2xY+3Uxxm2O++7reRltt4o4lCL8H4FLDvgNoPzq1j3CrFoVf7V+8/R8evncHf1MQf5ZTdt4lOZGQuVBiN54n4K6vqU90+vYLO5ib5txxXkMJpuEgEnZTRXOqQXZ7XyaJMA2zSCjl7mwVMffyT6PYCltKoTHXxrv5kzSlSUeBZ9t+KOAaz84B9hoTvaUJh5sVNfIcp8n0h3gO2DkxmZq5GNWRU1QeP6tG73VdqqPFnhj+j7KLPqt0NLqcpYcugu0rnZjYiqRi2+W7uIevVW2oLqX5DhII0EMeyPCeKDizMf5m5tXPAmYg9RzITZYsnjtGilQcdIIpea5wNtC6MBH3mqrJG64VhFGW1KIw8z6n028bQo/3+UgN5t61w0upWid1oDCXbnjeIVCDiUpPNgJ0GAx2OEOrDUDX7a1YWNtWD/r3gX9v5qKBc1UeEul2LGLmLLPOq69WsF6s1qOID1KGGMoq6/bf7SF4nPsN0Tw6dItRe/DfQRxALw4Rl2X7mQFBEUHQbDVSWuLyvIa2sAPWMlNLhlkVPkFVnvSbGRIogFXkZ+A1Z9Gphg01eK/qh1OcC+nxp1YTsZJTqOTqGZlMtIhUF0tkYs5htBKYQgfcm0JVhuJzMrQxxRsULVjDbhAIiSr7Q1Ofl3cmyLpGKeobneAhT3o0wdTYom5Aqj0d1PfWLsHqVxhF9OZGKNoqPYdkaxFFY3fWbIbL9/QX8r75/V1CcKmKtl32yXnppd8MiUTw/URys2q+WBl6Q/m+W1jdLIaX+rEvYYof4Xl7F4xXuzAhpbCl7aEeUdRsKRJC0mv1HnuVEkRZIOglnFrMjK8y2txlPPjhecf9BN121pbNu3fkxNc3ax26qv/ty/Tl7aJqADTkc0t+OZrgvU9xyrW4++am2t77tt49FblazPzJ6/evlFp0VGaYZVpl0V4WszuBUpvRu5KZVbMbxPCNS2oriBCybQ7weYx3GcUrpF81nnnN3M5bwvKyl6SsXwp13czSbuYfbyGkChbKuJQBBUlCwh2dmKjQBsqKeX4bBbXq1imgY1HSvVrNdrXNGbpBstfvOlr1Ns5h6kKTjcJvFeBXwcvPsMhFfw5sPpqIokyI3IV13Jtnm1/Os7qbAqraf1WyRMBJTFCvb+PoF7/oNyYa6G9UjgU19ttzd7Ti8qcARRRLLsdoezpbNEFvvgrk//RWKd4HNIv4GONCwA8tBraT8McnsrSZtziqhujoXfQlKRoYjGhME9yCqQgJ1PjvSnVnPl/eHtz58ryBUUChG/M5Eld9tPduXFzDZLwi9A/juUHnS67ZDYUZZ10/d2n5Fi1cbSkisrQxh7JhFuYm2t3tVRh85YaLkMaQyvlZBstqmV4VCsCCszJjyDHKHR9aataY1SyoSZHY7aANwI+BUcKtSM7MyxNNihhbTntGwPjXt+hafZpqc8b0zeZPWYqL962oTjZn1tkt2nVkv0NX9UagfNpQx1kSY6Dwolgtbdbty38O0GhTRwclvrlicT2Ksr91ORMhtu0kUtoyRP2DY/UZGVFprWCZ07zX8PF7KUybYeGSXu2ffidKZmWqCvH/bRR0qahZmENh0q60iiO3B4rzx+zXj5d4gLRV4ih9qKjscsz26Q6nMB+4W0LGCoPP1FlObwV1lTLJEok3c+2Y9m2/YrWPH+X9edoYQgIbGYAAAAABJRU5ErkJggg==`;function rn({clipId:e,onSelectClip:t}){let n=V(),r=`Download source clip (KICK Enhancer)`;return P(j,{children:[P(`button`,{"aria-describedby":n,"aria-label":r,className:`ke-direct-clip-download-action`,"data-ke-direct-clip-download":!0,onClick:n=>Mt(n,e,t),type:`button`,children:[P(`img`,{alt:``,className:`ke-direct-clip-download-action__brand`,draggable:!1,src:nn}),P(bt,{class:`ke-icon ke-direct-clip-download-action__icon`})]}),P(`span`,{className:`ke-direct-clip-download-tooltip`,id:n,role:`tooltip`,children:r})]})}function an(e,t){for(var n in t)e[n]=t[n];return e}function on(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function sn(e,t){this.props=e,this.context=t}function cn(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&(typeof n==`function`?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:on(this.props,e)}function r(t){return this.shouldComponentUpdate=n,Ke(e,t)}return r.displayName=`Memo(`+(e.displayName||e.name)+`)`,r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(sn.prototype=new M).isPureReactComponent=!0,sn.prototype.shouldComponentUpdate=function(e,t){return on(this.props,e)||on(this.state,t)};var ln=O.__b;O.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ln&&ln(e)},typeof Symbol<`u`&&Symbol.for;var un=O.__e;O.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}un(e,t,n,r)};var dn=O.unmount;function fn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=an({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return fn(e,t,n)})),e}function pn(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return pn(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function mn(){this.__u=0,this.o=null,this.__b=null}function hn(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function gn(){this.i=null,this.l=null}O.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),dn&&dn(e)},(mn.prototype=new M).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=hn(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=pn(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},mn.prototype.componentWillUnmount=function(){this.o=[]},mn.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=fn(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&Ke(j,null,e.fallback);return i&&(i.__u&=-33),[Ke(j,null,t.__a?null:e.children),i]};var _n=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.h.removeChild(e)}}}N(Ke(vn,{context:t.context},e.__v),t.v)}function bn(e,t){var n=Ke(yn,{__v:e,h:t});return n.containerInfo=t,n}(gn.prototype=new M).__a=function(e){var t=this,n=hn(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),_n(t,e,r)):i()};n?n(a):a()}},gn.prototype.render=function(e){this.i=null,this.l=new Map;var t=nt(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},gn.prototype.componentDidUpdate=gn.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){_n(e,n,t)})};var xn=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Sn=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Cn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,wn=/[A-Z0-9]/g,Tn=typeof document<`u`,En=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};M.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(M.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Dn=O.event;O.event=function(e){return Dn&&(e=Dn(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var On={configurable:!0,get:function(){return this.class}},kn=O.vnode;O.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||Tn&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||En(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:Cn.test(a)&&(a=s):s=a=`oninput`:i&&Sn.test(a)?a=a.replace(wn,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=nt(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=nt(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",On)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=xn,kn&&kn(e)};var An=O.__r;O.__r=function(e){An&&An(e),e.__c};var jn=O.diffed;O.diffed=function(e){jn&&jn(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};function Mn(e,t,n,r,i){if(e<=0)return{end:0,start:0};let a=Math.max(1,t),o=Number.isFinite(n)?Math.max(0,Math.floor(n)):0,s=Math.floor(Math.max(0,r)/a),c=Math.ceil((Math.max(0,r)+Math.max(0,i))/a);return{end:Math.min(e,Math.max(s+1,c)+o),start:Math.min(e,Math.max(0,s-o))}}var Nn=2;function Pn(e,t,n){let r=Math.max(0,n-t),i=Math.min(r,Math.max(0,e));return{bottom:r-i>Nn,top:i>Nn}}function H(...e){return e.filter(Boolean).join(` `)}function Fn({children:e,className:t,contentClassName:n,heightMode:r=`fill`,minimumThumbSize:i=24,onViewportChange:a,onViewportMetricsChange:o,onViewportScroll:s,scrollIndicators:c=!1,scrollbarVariant:l=`default`,viewportAriaLabel:u,viewportClassName:d,viewportTabIndex:f=0}){let p=z(null),m=z(null),h=z(null),g=z(null),_=z(null),v=z(i),y=z(!1),b=z(null),x=B(()=>{let e=p.current,t=h.current,n=g.current;if(!e||!t||!n)return;let r=e.clientHeight,a=e.scrollHeight,o=Math.max(0,a-r),s=Pn(e.scrollTop,r,a);if(t.toggleAttribute(`data-overflow-top`,c&&s.top),t.toggleAttribute(`data-overflow-bottom`,c&&s.bottom),r<=0||o<=0){y.current=!1,n.removeAttribute(`data-visible`),n.style.height=``,n.style.transform=``;return}let l=Math.min(r,Math.max(Math.max(1,i),Math.round(r/a*r))),u=Math.max(0,r-l),d=Math.round(e.scrollTop/o*u);v.current=l,y.current=!0,n.dataset.visible=`true`,n.style.height=`${l}px`,n.style.transform=`translateY(${d}px)`},[i,c]),S=B(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,x()}))},[x]),ee=B(e=>{p.current=e,a?.(e)},[a]),te=B(e=>{s?.(e.currentTarget),S()},[s,S]);R(()=>{let e=p.current,t=m.current,n=()=>{S(),p.current&&o?.(p.current)},r=typeof ResizeObserver>`u`?null:new ResizeObserver(n);return n(),e&&r?.observe(e),t&&r?.observe(t),()=>{r?.disconnect(),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null)}},[o,S]);let C=B(e=>{!b.current||e.pointerId!==b.current.pointerId||(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),b.current=null,h.current?.classList.remove(`is-dragging`))},[]),w=B(e=>{let t=p.current;e.button!==0||!t||!y.current||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),b.current={pointerId:e.pointerId,startClientY:e.clientY,startScrollTop:t.scrollTop},h.current?.classList.add(`is-dragging`))},[]),T=B(e=>{let t=b.current,n=p.current;if(!t||t.pointerId!==e.pointerId||!n)return;let r=Math.max(0,n.scrollHeight-n.clientHeight),i=Math.max(1,n.clientHeight-v.current),a=(e.clientY-t.startClientY)*r/i;n.scrollTop=Math.min(r,Math.max(0,t.startScrollTop+a))},[]);return P(`div`,{className:H(`ke-scroll-area`,t),"data-height":r,"data-scroll-indicators":c?`true`:void 0,"data-scrollbar":l,ref:h,children:[P(`div`,{"aria-label":u,className:H(`ke-scroll-area__viewport`,d),onScroll:te,ref:ee,tabIndex:f,children:P(`div`,{className:H(`ke-scroll-area__content`,n),ref:m,children:e})}),P(`div`,{"aria-hidden":`true`,className:`ke-scroll-area__thumb`,onLostPointerCapture:C,onPointerCancel:C,onPointerDown:w,onPointerMove:T,onPointerUp:C,ref:g})]})}function In(e,t,n){let r=n!==void 0,i=z(null),a=z(null),o=z(()=>void 0),[s,c]=L(()=>r?Mn(e,n,t,0,0):{end:e,start:0}),l=B(()=>{let a=i.current,o=r&&a?Mn(e,n,t,a.scrollTop,a.clientHeight):{end:e,start:0};c(e=>e.start===o.start&&e.end===o.end?e:o)},[e,t,n,r]);o.current=l;let u=B(()=>{a.current===null&&(a.current=window.requestAnimationFrame(()=>{a.current=null,o.current()}))},[]),d=B(e=>{i.current=e,e&&r&&u()},[u,r]);return R(()=>{r&&u()},[u,l,r]),R(()=>{let e=i.current;if(!r||!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(u);return t.observe(e),()=>t.disconnect()},[u,r]),R(()=>()=>{a.current!==null&&window.cancelAnimationFrame(a.current)},[]),{range:s,scheduleRangeUpdate:u,setViewport:d,virtualized:r}}function Ln({ariaLabel:e,className:t,columns:n,gridTemplateColumns:r,index:i,item:a,itemCount:o,onItemActivate:s,rowHeight:c}){let l=c!==void 0,u={gridTemplateColumns:r,...l?{height:`${c}px`,transform:`translateY(${i*c}px)`}:{}};return P(`div`,{"aria-label":e,"aria-rowindex":i+2,className:H(`ke-list-view__row`,s&&`is-interactive`,t),"data-last-row":i===o-1?`true`:void 0,"data-virtualized":l?`true`:void 0,onClick:s?()=>s(a):void 0,onKeyDown:s?e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),s(a))}:void 0,role:`row`,style:u,tabIndex:s?0:void 0,children:n.map(e=>P(`div`,{className:H(`ke-list-view__cell`,e.cellClassName),"data-align":e.align,"data-column-id":e.id,role:`cell`,children:P(`div`,{className:`ke-list-view__cell-content`,children:e.renderCell(a)})},e.id))})}var Rn=cn(Ln);function zn({ariaLabel:e,ariaLive:t=`off`,className:n,columns:r,emptyContent:i=`No items`,getItemKey:a,getRowAriaLabel:o,getRowClassName:s,heightMode:c=`fill`,items:l,onItemActivate:u,overscan:d=8,rowHeight:f}){if(f!==void 0&&(!Number.isFinite(f)||f<=0))throw Error(`ListView rowHeight must be a positive finite number.`);let p=Jt(()=>r.map(e=>e.width).join(` `),[r]),m={gridTemplateColumns:p},{range:h,scheduleRangeUpdate:g,setViewport:_,virtualized:v}=In(l.length,d,f),y=Math.min(l.length,h.start),b=Math.min(l.length,Math.max(y,h.end)),x=v?l.slice(y,b):l,S=v&&f!==void 0?{height:`${l.length*f}px`}:void 0;return P(`div`,{"aria-colcount":r.length,"aria-label":e,"aria-rowcount":l.length+1,className:H(`ke-list-view`,n),"data-empty":l.length===0?`true`:`false`,role:`table`,children:[P(`div`,{className:`ke-list-view__header-group`,role:`rowgroup`,children:P(`div`,{"aria-rowindex":1,className:`ke-list-view__header`,role:`row`,style:m,children:r.map(e=>P(`div`,{className:`ke-list-view__header-cell`,"data-align":e.align,"data-column-id":e.id,role:`columnheader`,children:P(`span`,{className:`ke-list-view__header-label`,children:e.header})},e.id))})}),P(Fn,{className:`ke-list-view__scroll`,contentClassName:`ke-list-view__scroll-content`,heightMode:c,onViewportChange:_,onViewportScroll:v?g:void 0,scrollIndicators:!0,scrollbarVariant:`compact`,viewportAriaLabel:`${e} rows`,viewportClassName:`ke-list-view__viewport`,viewportTabIndex:u?-1:0,children:[P(`div`,{"aria-live":v?`off`:t,className:`ke-list-view__body`,"data-virtualized":v?`true`:void 0,role:`rowgroup`,style:S,children:l.length===0?P(`div`,{className:`ke-list-view__empty`,role:`status`,children:i}):x.map((e,t)=>{let n=v?y+t:t;return P(Rn,{ariaLabel:o?.(e),className:s?.(e),columns:r,gridTemplateColumns:p,index:n,item:e,itemCount:l.length,onItemActivate:u,rowHeight:f},a(e,n))})}),v&&t!==`off`?P(`span`,{"aria-atomic":`true`,"aria-live":t,className:`ke-list-view__live-status`,children:[l.length,` `,l.length===1?`row`:`rows`]}):null]})]})}function U({children:e,className:t,density:n=`default`,tone:r=`default`,type:i=`button`,...a}){return P(`button`,{...a,className:H(`ke-button`,`ke-button--${n}`,`ke-button--${r}`,t),type:i,children:e})}function Bn({className:e,description:t,id:n,label:r,onValueChange:i,options:a,...o}){let s=V(),c=n??s,l=t?`${c}-description`:void 0;return P(`label`,{className:`ke-form-field`,htmlFor:c,children:[P(`span`,{className:`ke-form-field__label`,children:r}),t?P(`span`,{className:`ke-form-field__description`,id:l,children:t}):null,P(`span`,{className:`ke-select-box`,children:[P(`select`,{...o,"aria-describedby":l,className:H(`ke-select-box__input`,e),id:c,onChange:e=>i?.(e.currentTarget.value),children:a.map(e=>P(`option`,{disabled:e.disabled,value:e.value,children:e.label},e.value))}),P(`span`,{"aria-hidden":`true`,className:`ke-select-box__chevron`})]})]})}function Vn({className:e,description:t,id:n,label:r,onValueChange:i,suffix:a,...o}){let s=V(),c=n??s,l=t?`${c}-description`:void 0,u=a?`${c}-suffix`:void 0,d=[l,u].filter(Boolean).join(` `)||void 0;return P(`label`,{className:`ke-form-field`,htmlFor:c,children:[P(`span`,{className:`ke-form-field__label`,children:r}),t?P(`span`,{className:`ke-form-field__description`,id:l,children:t}):null,P(`span`,{className:a?`ke-text-field-shell`:void 0,children:[P(`input`,{...o,"aria-describedby":d,className:H(`ke-text-field`,e),id:c,onInput:e=>i?.(e.currentTarget.value)}),a?P(`span`,{className:`ke-text-field__suffix`,id:u,children:a}):null]})]})}function W({className:e,description:t,id:n,label:r,onCheckedChange:i,...a}){let o=V(),s=n??o,c=t?`${s}-description`:void 0;return P(`label`,{className:H(`ke-toggle`,e),htmlFor:s,children:[P(`span`,{className:`ke-toggle__copy`,children:[P(`span`,{className:`ke-form-field__label`,children:r}),t?P(`span`,{className:`ke-form-field__description`,id:c,children:t}):null]}),P(`span`,{className:`ke-toggle__control`,children:[P(`input`,{...a,"aria-describedby":c,className:`ke-toggle__input`,id:s,onChange:e=>i?.(e.currentTarget.checked),role:`switch`,type:`checkbox`}),P(`span`,{"aria-hidden":`true`,className:`ke-toggle__track`,children:P(`span`,{className:`ke-toggle__thumb`})})]})]})}function Hn({defaultValue:e,description:t,formatValue:n=String,id:r,label:i,max:a,min:o,onValueChange:s,value:c,...l}){let u=V(),d=r??u,f=t?`${d}-description`:void 0,[p,m]=L(e??o),h=c??p,g=a-o,_=g>0?(h-o)/g*100:0,v=e=>{let t=e.currentTarget.valueAsNumber;c===void 0&&m(t),s?.(t)};return P(`label`,{className:`ke-form-field`,htmlFor:d,children:[P(`span`,{className:`ke-track-bar__heading`,children:[P(`span`,{className:`ke-form-field__label`,children:i}),P(`output`,{className:`ke-track-bar__value`,htmlFor:d,children:n(h)})]}),t?P(`span`,{className:`ke-form-field__description`,id:f,children:t}):null,P(`input`,{...l,"aria-describedby":f,className:`ke-track-bar`,id:d,max:a,min:o,onInput:v,style:{"--ke-track-progress":`${_}%`},type:`range`,value:h})]})}function Un({children:e,className:t,closeLabel:n=`Close settings`,description:r,dismissDisabled:i=!1,footer:a,icon:o,initialFocusRef:s,onRequestClose:c,open:l,title:u}){let d=z(null),f=z(null),p=V(),m=V();R(()=>{let e=d.current;e&&(l&&!e.open?(f.current=document.activeElement instanceof HTMLElement?document.activeElement:null,e.showModal(),s?.current?.focus()):!l&&e.open&&e.close())},[s,l]),R(()=>()=>{f.current?.focus()},[]);let h=()=>{i||(c(),f.current?.focus())};return l?bn(P(`dialog`,{"aria-describedby":r?m:void 0,"aria-labelledby":p,className:H(`ke-modal`,t),onCancel:e=>{e.preventDefault(),h()},onPointerDown:e=>{e.target===e.currentTarget&&h()},ref:d,children:P(`div`,{className:`ke-modal__surface`,children:[P(`header`,{className:`ke-modal__header`,children:[P(`div`,{className:`ke-modal__identity`,children:[o?P(`img`,{alt:``,className:`ke-modal__icon`,draggable:!1,src:o}):null,P(`div`,{className:`ke-modal__heading`,children:[P(`h2`,{className:`ke-modal__title`,id:p,children:u}),r?P(`p`,{className:`ke-modal__description`,id:m,children:r}):null]})]}),P(U,{"aria-label":n,className:`ke-modal__close`,disabled:i,onClick:h,children:P(`span`,{"aria-hidden":`true`,children:`×`})})]}),P(`div`,{className:`ke-modal__body`,children:e}),a?P(`footer`,{className:`ke-modal__footer`,children:a}):null]})}),document.body):null}function Wn(e,t,n){for(let r=1;r<=e.length;r+=1){let i=(t+n*r+e.length)%e.length;if(!e[i].disabled)return i}return-1}function Gn(e,t){let n=t?e.length-1:0,r=t?-1:e.length,i=t?-1:1;for(let t=n;t!==r;t+=i)if(!e[t].disabled)return t;return-1}function Kn({ariaLabel:e,className:t,defaultValue:n,onChange:r,panelClassName:i,tabs:a,value:o}){let s=V(),c=z([]),[l,u]=L(n),d=o!==void 0,f=d?o:l,p=a.findIndex(e=>!e.disabled&&e.id===f);p===-1&&(p=a.findIndex(e=>!e.disabled));let m=e=>{let t=a[e];!t||t.disabled||(d||u(t.id),t.id!==f&&r?.(t.id))},h=(e,t)=>{let n=-1;e.key===`ArrowLeft`?n=Wn(a,t,-1):e.key===`ArrowRight`?n=Wn(a,t,1):e.key===`Home`?n=Gn(a,!1):e.key===`End`&&(n=Gn(a,!0)),n!==-1&&(e.preventDefault(),m(n),c.current[n]?.focus())};return P(`div`,{className:H(`ke-tabs`,t),children:[P(`div`,{"aria-label":e,"aria-orientation":`horizontal`,className:`ke-tabs__list`,role:`tablist`,children:a.map((e,t)=>{let n=t===p;return P(`button`,{"aria-controls":`${s}-panel-${t}`,"aria-selected":n,className:`ke-tabs__tab`,disabled:e.disabled,id:`${s}-tab-${t}`,onClick:()=>m(t),onKeyDown:e=>h(e,t),ref:e=>{c.current[t]=e},role:`tab`,tabIndex:n?0:-1,type:`button`,children:e.label},e.id)})}),a.map((e,t)=>{let n=t===p;return P(`div`,{"aria-labelledby":`${s}-tab-${t}`,className:H(`ke-tabs__panel`,i),hidden:!n,id:`${s}-panel-${t}`,role:`tabpanel`,children:P(Fn,{className:`ke-tabs__scroll`,contentClassName:H(`ke-tabs__panel-content`,e.contentClassName),scrollIndicators:!0,scrollbarVariant:`overlay`,viewportAriaLabel:e.panelAriaLabel??(typeof e.label==`string`?`${e.label} settings`:void 0),viewportTabIndex:n?0:-1,children:e.content})},e.id)})]})}var G=class extends Error{code;constructor(e,t){super(t),this.name=`ClipDownloadError`,this.code=e}};function qn(e){return e instanceof G?{code:e.code,message:e.message}:e instanceof DOMException&&e.name===`AbortError`?{code:`cancelled`,message:`The operation was cancelled.`}:{code:`media-request`,message:`The clip download could not be completed.`}}var Jn=64;function Yn(e,t){Xn(e)||$n(`The direct clip resource is not an MP4 file.`);let n=t?[e,t]:[e],r=n.some(e=>K(e,`moov`)),i=n.some(e=>K(e,`avc1`)||K(e,`avc3`)),a=n.some(e=>K(e,`mp4a`)),o=n.some(e=>K(e,`hev1`)||K(e,`hvc1`)||K(e,`av01`)||K(e,`vp09`));return r||$n(`The MP4 metadata could not be verified within the probe limit.`),(!i||!a||o)&&$n(`The direct MP4 uses unsupported codecs.`),{audioCodec:`aac`,videoCodec:`h264`}}function Xn(e){let t=Math.min(e.byteLength-4,Jn);for(let n=4;n<=t;n+=1)if(Zn(e,n)===`ftyp`){let t=Qn(e,n-4);return t>=8&&n-4+t<=e.byteLength}return!1}function K(e,t){for(let n=4;n+4<=e.byteLength;n+=1){if(Zn(e,n)!==t)continue;let r=Qn(e,n-4);if(r===0||r>=8)return!0}return!1}function Zn(e,t){return String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])}function Qn(e,t){return e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]}function $n(e){throw new G(`unsupported-media`,e)}var er=new Set([`clips.kick.com`]);function tr(e){return e.protocol===`https:`&&er.has(e.hostname.toLowerCase())}async function nr(e,t,n){let r=e.body?.getReader();if(!r)throw new G(`media-request`,`The media response did not contain a readable body.`);let i=[],a=0;try{for(;;){let{done:e,value:n}=await r.read();if(e)break;if(a+=n.byteLength,a>t)throw await r.cancel(),new G(`unsupported-media`,`The media response exceeded the inspection limit.`);i.push(n)}}finally{r.releaseLock()}if(n!==void 0&&a!==n)throw new G(`media-request`,`The media response was truncated.`);let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.byteLength;return o}async function rr(e,t,n,r,i=fetch){let a=t+n-1,o=await i(e,{headers:{Range:`bytes=${t}-${a}`},signal:r});if(or(o),o.status!==206)throw await o.body?.cancel(),new G(`media-request`,`The media server did not honor a required byte range.`);let s=ar(o.headers.get(`content-range`));if(s.start!==t||s.end!==a||s.total<=a)throw await o.body?.cancel(),new G(`media-request`,`The media server returned an unexpected byte range.`);return{bytes:await nr(o,n,n),contentRange:s}}async function ir(e,t,n,r=fetch){let i=await r(e,{headers:{Range:`bytes=0-${t-1}`},signal:n});if(or(i),i.status===206){let e=ar(i.headers.get(`content-range`));if(e.start!==0||e.end>=t||e.endt)throw await i.body?.cancel(),new G(`unsupported-media`,`The media server ignored the bounded inspection request.`);return{bytes:await nr(i,t,a),totalBytes:a}}function ar(e){let t=/^bytes (\d+)-(\d+)\/(\d+)$/.exec(e??``);if(!t)throw new G(`media-request`,`The media response did not contain a valid byte range.`);let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);if(!Number.isSafeInteger(n)||!Number.isSafeInteger(r)||!Number.isSafeInteger(i)||n<0||rvoid 0),new G(`media-request`,`The media request redirected to an untrusted host.`)}function sr(e){if(!e||!/^\d+$/.test(e))return;let t=Number(e);return Number.isSafeInteger(t)&&t>=0?t:void 0}var cr=8*1024*1024,lr=256*1024;function ur(e){return e.kind===`direct-mp4`?{kind:e.kind,logicalSegmentCount:1,sourceBytes:e.sourceBytes,uniqueSourceObjectCount:1}:{duration:e.duration,kind:e.kind,logicalSegmentCount:e.segments.length,sourceBytes:e.sourceBytes,uniqueSourceObjectCount:e.uniqueSourceObjectCount}}var dr=[`#EXT-X-BYTERANGE-START`,`#EXT-X-DISCONTINUITY`,`#EXT-X-GAP`,`#EXT-X-I-FRAMES-ONLY`,`#EXT-X-I-FRAME-STREAM-INF`,`#EXT-X-KEY`,`#EXT-X-MAP`,`#EXT-X-MEDIA:`,`#EXT-X-PART`,`#EXT-X-PRELOAD-HINT`,`#EXT-X-RENDITION-REPORT`,`#EXT-X-SKIP`,`#EXT-X-STREAM-INF`],fr=[`#EXTM3U`,`#EXT-X-ENDLIST`,`#EXT-X-INDEPENDENT-SEGMENTS`,`#EXT-X-MEDIA-SEQUENCE:`,`#EXT-X-PLAYLIST-TYPE:`,`#EXT-X-PROGRAM-DATE-TIME:`,`#EXT-X-TARGETDURATION:`,`#EXT-X-VERSION:`];function pr(e,{isAllowedMediaUrl:t,playlistUrl:n}){let r=gr(n),i=e.split(/\r?\n/),a=[],o=!1,s,c;i[0]?.trim()!==`#EXTM3U`&&q(`The clip response is not an HLS playlist.`);for(let e of i){let n=e.trim();if(!n)continue;if(n===`#EXT-X-ENDLIST`){o=!0;continue}if(n.startsWith(`#EXTINF:`)){s!==void 0&&q(`The playlist contains an incomplete segment.`);let e=n.slice(8).split(`,`)[0],t=Number(e);(!Number.isFinite(t)||t<=0)&&q(`The playlist contains an invalid segment duration.`),s=t;continue}if(n.startsWith(`#EXT-X-BYTERANGE:`)){let e=/^#EXT-X-BYTERANGE:(\d+)@(\d+)$/.exec(n);e||q(`The playlist uses an unsupported implicit byte range.`);let t=Number(e[1]),r=Number(e[2]);mr(r,t),t>8388608&&q(`A clip segment exceeds the safe processing limit.`),c={length:t,offset:r};continue}if(n.startsWith(`#`)){dr.some(e=>n.startsWith(e))&&q(`The clip uses an unsupported HLS layout.`),fr.some(e=>n.startsWith(e))||q(`The clip uses an unsupported HLS tag: ${n}`);continue}s===void 0&&q(`The playlist segment is missing its duration.`),a.length>=256&&q(`The clip contains too many media segments.`);let i=new URL(n,r);t(i)||q(`The playlist contains an untrusted media URL.`),a.push({duration:s,index:a.length,...c??{},url:i.href}),s=void 0,c=void 0}o||q(`Only completed clip playlists are supported.`),(a.length===0||s!==void 0||c!==void 0)&&q(`The playlist does not contain complete media segments.`),hr(a);let l=a.every(e=>e.length!==void 0)?a.reduce((e,t)=>{let n=e+(t.length??0);return Number.isSafeInteger(n)||q(`The playlist media size is invalid.`),n},0):void 0;return{duration:a.reduce((e,t)=>e+t.duration,0),kind:`hls-ts`,playlistUrl:r.href,segments:a,sourceBytes:l,uniqueSourceObjectCount:new Set(a.map(e=>e.url)).size}}function mr(e,t){let n=e+t-1;(!Number.isSafeInteger(e)||!Number.isSafeInteger(t)||e<0||t<=0||!Number.isSafeInteger(n))&&q(`The playlist contains an invalid byte range.`)}function hr(e){let t=new Map;for(let n of e){if(n.length===void 0||n.offset===void 0)continue;let e=t.get(n.url)??[];e.push({end:n.offset+n.length-1,start:n.offset}),t.set(n.url,e)}for(let e of t.values()){e.sort((e,t)=>e.start-t.start);for(let t=1;tvr.has(e)),a=n.filter(e=>e!==_r&&!vr.has(e)&&e!==yr);return(!r||!i||a.length>0)&&wr(`The clip uses unsupported transport-stream codecs.`),{audioCodec:`aac`,metadata:n.includes(yr),videoCodec:`h264`}}function xr(e,t,n){let r=[],i;for(let a=0;a+J<=e.byteLength;a+=J){let o=e[a+1],s=e[a+2],c=e[a+3];if(((o&31)<<8|s)!==t||o&128)continue;let l=c>>4&3;if(l===0||l===2)continue;let u=a+4;if(l===3&&(u+=e[u]+1),!(u>=a+J)){if(o&64){let t=e[u];u+=t+1,r=[],i=void 0}for(let t=u;t131072||c.totalBytes!==c.bytes.byteLength)throw new G(`unsupported-media`,`The clip playlist exceeds the safe inspection limit.`);u=pr(l,{isAllowedMediaUrl:tr,playlistUrl:s.href}),await kr(u,t,n)}else{try{Yn(c.bytes)}catch(e){let r=lr-c.bytes.byteLength;if(r<=0||c.totalBytes<=c.bytes.byteLength)throw e;let i=Math.max(c.bytes.byteLength,c.totalBytes-r),a=c.totalBytes-i,o=(await rr(s.href,i,a,t,n)).bytes;Yn(c.bytes,o)}u={kind:`direct-mp4`,sourceBytes:c.totalBytes,url:s.href}}return{clipId:e,metadata:Ar(a,r),plan:u}}async function kr(e,t,n){let r=e.segments[0];if(!r)throw new G(`unsupported-media`,`The clip playlist does not contain media.`);let i=Math.min(lr,r.length??262144);br(r.length===void 0?(await ir(r.url,i,t,n)).bytes:(await rr(r.url,r.offset??0,i,t,n)).bytes)}function Ar(e,t){let n=Nr(e.category),r=Nr(e.channel),i=Nr(e.creator)??Nr(e.user);return{category:Pr(n?.name,e.category),channel:Pr(r?.username,r?.slug,r?.name),creator:Pr(i?.username,i?.name),duration:Fr(e.duration),likeCount:Ir(e.likes),pageUrl:t,publishedAt:Lr(e.created_at),thumbnailUrl:Rr(e.thumbnail_url??e.thumbnail),title:Pr(e.title),viewCount:Ir(e.views)}}function jr(e,t){let n=[e.id,e.clip_id].filter(e=>typeof e==`string`&&e.startsWith(`clip_`));if(n.length>0&&n.some(e=>e!==t))throw new G(`clip-unavailable`,`KICK returned information for a different clip.`)}function Mr(e){try{let t=Nr(JSON.parse(new TextDecoder().decode(e)));if(t)return t}catch{}throw new G(`clip-unavailable`,`KICK returned malformed clip information.`)}function Nr(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:void 0}function Pr(...e){for(let t of e){if(typeof t!=`string`)continue;let e=t.replace(/\s+/g,` `).trim();if(e)return e.slice(0,Dr)}}function Fr(e){return typeof e==`number`&&Number.isFinite(e)&&e>0&&e<=180?e:void 0}function Ir(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:void 0}function Lr(e){if(typeof e!=`string`)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Rr(e){if(typeof e==`string`)try{let t=new URL(e);return t.protocol===`https:`&&(t.hostname===`kick.com`||t.hostname.endsWith(`.kick.com`))?t.href:void 0}catch{return}}function zr(e){let t;try{t=new URL(e)}catch{throw new G(`unsupported-media`,`KICK returned an invalid clip media URL.`)}if(!tr(t))throw new G(`unsupported-media`,`KICK returned an untrusted clip media URL.`);return t}var Br='(function(){var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),t=e(((e,t)=>{var n=function(){this.init=function(){var e={};this.on=function(t,n){e[t]||(e[t]=[]),e[t]=e[t].concat(n)},this.off=function(t,n){var r;return e[t]?(r=e[t].indexOf(n),e[t]=e[t].slice(),e[t].splice(r,1),r>-1):!1},this.trigger=function(t){var n=e[t],r,i,a;if(n)if(arguments.length===2)for(i=n.length,r=0;r{var n=2**32;t.exports={getUint64:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r;return t.getBigUint64?(r=t.getBigUint64(0),r<2**53-1?Number(r):r):t.getUint32(0)*n+t.getUint32(4)},MAX_UINT32:n}})),r=e(((e,t)=>{var r=n().MAX_UINT32,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,z;(function(){var e;if(E={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>`u`)){for(e in E)E.hasOwnProperty(e)&&(E[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);D=new Uint8Array([105,115,111,109]),k=new Uint8Array([97,118,99,49]),O=new Uint8Array([0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),j=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),M={video:A,audio:j},F=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),P=new Uint8Array([0,0,0,0,0,0,0,0]),I=new Uint8Array([0,0,0,0,0,0,0,0]),L=I,R=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),z=I,N=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),i=function(e){var t=[],n=0,r,i,a;for(r=1;r>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},s=function(){return i(E.ftyp,D,O,D,k)},y=function(e){return i(E.hdlr,M[e])},c=function(e){return i(E.mdat,e)},v=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,e.duration&255,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=e.samplerate&255),i(E.mdhd,t)},_=function(e){return i(E.mdia,v(e),y(e.type),u(e))},l=function(e){return i(E.mfhd,new Uint8Array([0,0,0,0,(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255]))},u=function(e){return i(E.minf,e.type===`video`?i(E.vmhd,N):i(E.smhd,P),a(),x(e))},d=function(e,t){for(var n=[],r=t.length;r--;)n[r]=C(t[r]);return i.apply(null,[E.moof,l(e)].concat(n))},f=function(e){for(var t=e.length,n=[];t--;)n[t]=h(e[t]);return i.apply(null,[E.moov,m(4294967295)].concat(n,p(e)))},p=function(e){for(var t=e.length,n=[];t--;)n[t]=w(e[t]);return i.apply(null,[E.mvex].concat(n))},m=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return i(E.mvhd,t)},b=function(e){var t=e.samples||[],n=new Uint8Array(4+t.length),r,a;for(a=0;a>>8),r.push(t[o].byteLength&255),r=r.concat(Array.prototype.slice.call(t[o]));for(o=0;o>>8),a.push(n[o].byteLength&255),a=a.concat(Array.prototype.slice.call(n[o]));if(s=[E.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(e.width&65280)>>8,e.width&255,(e.height&65280)>>8,e.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i(E.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255,t.length].concat(r,[n.length],a))),i(E.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var c=e.sarRatio[0],l=e.sarRatio[1];s.push(i(E.pasp,new Uint8Array([(c&4278190080)>>24,(c&16711680)>>16,(c&65280)>>8,c&255,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&255])))}return i.apply(null,s)},t=function(e){return i(E.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(e.channelcount&65280)>>8,e.channelcount&255,(e.samplesize&65280)>>8,e.samplesize&255,0,0,0,0,(e.samplerate&65280)>>8,e.samplerate&255,0,0]),o(e))}})(),g=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(e.id&4278190080)>>24,(e.id&16711680)>>16,(e.id&65280)>>8,e.id&255,0,0,0,0,(e.duration&4278190080)>>24,(e.duration&16711680)>>16,(e.duration&65280)>>8,e.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(e.width&65280)>>8,e.width&255,0,0,(e.height&65280)>>8,e.height&255,0,0]);return i(E.tkhd,t)},C=function(e){var t=i(E.tfhd,new Uint8Array([0,0,0,58,(e.id&4278190080)>>24,(e.id&16711680)>>16,(e.id&65280)>>8,e.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),n,a,o,s,c=Math.floor(e.baseMediaDecodeTime/r),l=Math.floor(e.baseMediaDecodeTime%r);return n=i(E.tfdt,new Uint8Array([1,0,0,0,c>>>24&255,c>>>16&255,c>>>8&255,c&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255])),s=92,e.type===`audio`?(a=T(e,s),i(E.traf,t,n,a)):(o=b(e),a=T(e,o.length+s),i(E.traf,t,n,a,o))},h=function(e){return e.duration=e.duration||4294967295,i(E.trak,g(e),_(e))},w=function(e){var t=new Uint8Array([0,0,0,0,(e.id&4278190080)>>24,(e.id&16711680)>>16,(e.id&65280)>>8,e.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.type!==`video`&&(t[t.length-1]=0),i(E.trex,t)},(function(){var e,t,n=function(e,t){var n=0,r=0,i=0,a=0;return e.length&&(e[0].duration!==void 0&&(n=1),e[0].size!==void 0&&(r=2),e[0].flags!==void 0&&(i=4),e[0].compositionTimeOffset!==void 0&&(a=8)),[0,0,n|r|i|a,1,(e.length&4278190080)>>>24,(e.length&16711680)>>>16,(e.length&65280)>>>8,e.length&255,(t&4278190080)>>>24,(t&16711680)>>>16,(t&65280)>>>8,t&255]};t=function(e,t){var r,a,o,s=e.samples||[],c,l;for(t+=20+16*s.length,o=n(s,t),a=new Uint8Array(o.length+s.length*16),a.set(o),r=o.length,l=0;l>>24,a[r++]=(c.duration&16711680)>>>16,a[r++]=(c.duration&65280)>>>8,a[r++]=c.duration&255,a[r++]=(c.size&4278190080)>>>24,a[r++]=(c.size&16711680)>>>16,a[r++]=(c.size&65280)>>>8,a[r++]=c.size&255,a[r++]=c.flags.isLeading<<2|c.flags.dependsOn,a[r++]=c.flags.isDependedOn<<6|c.flags.hasRedundancy<<4|c.flags.paddingValue<<1|c.flags.isNonSyncSample,a[r++]=c.flags.degradationPriority&61440,a[r++]=c.flags.degradationPriority&15,a[r++]=(c.compositionTimeOffset&4278190080)>>>24,a[r++]=(c.compositionTimeOffset&16711680)>>>16,a[r++]=(c.compositionTimeOffset&65280)>>>8,a[r++]=c.compositionTimeOffset&255;return i(E.trun,a)},e=function(e,t){var r,a,o,s=e.samples||[],c,l;for(t+=20+8*s.length,o=n(s,t),r=new Uint8Array(o.length+s.length*8),r.set(o),a=o.length,l=0;l>>24,r[a++]=(c.duration&16711680)>>>16,r[a++]=(c.duration&65280)>>>8,r[a++]=c.duration&255,r[a++]=(c.size&4278190080)>>>24,r[a++]=(c.size&16711680)>>>16,r[a++]=(c.size&65280)>>>8,r[a++]=c.size&255;return i(E.trun,r)},T=function(n,r){return n.type===`audio`?e(n,r):t(n,r)}})(),t.exports={ftyp:s,mdat:c,moof:d,moov:f,initSegment:function(e){var t=s(),n=f(e),r=new Uint8Array(t.byteLength+n.byteLength);return r.set(t),r.set(n,t.byteLength),r}}})),i=e(((e,t)=>{var n=function(e){var t,n,r=[],i=[];for(i.byteLength=0,i.nalCount=0,i.duration=0,r.byteLength=0,t=0;t1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},a=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},o=function(e,t){var n=a();return n.dataOffset=t,n.compositionTimeOffset=e.pts-e.dts,n.duration=e.duration,n.size=4*e.length,n.size+=e.byteLength,e.keyFrame&&(n.flags.dependsOn=2,n.flags.isNonSyncSample=0),n};t.exports={groupNalsIntoFrames:n,groupFramesIntoGops:r,extendFirstKeyFrame:i,generateSampleTable:function(e,t){var n,r,i,a,s,c=t||0,l=[];for(n=0;n{var n=[33,16,5,32,164,27],r=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],i=function(e){for(var t=[];e--;)t.push(0);return t},a=function(e){return Object.keys(e).reduce(function(t,n){return t[n]=new Uint8Array(e[n].reduce(function(e,t){return e.concat(t)},[])),t},{})},o;t.exports=function(){return o||=a({96e3:[n,[227,64],i(154),[56]],88200:[n,[231],i(170),[56]],64e3:[n,[248,192],i(240),[56]],48e3:[n,[255,192],i(268),[55,148,128],i(54),[112]],44100:[n,[255,192],i(268),[55,163,128],i(84),[112]],32e3:[n,[255,192],i(268),[55,234],i(226),[112]],24e3:[n,[255,192],i(268),[55,255,128],i(268),[111,112],i(126),[224]],16e3:[n,[255,192],i(268),[55,255,128],i(268),[111,255],i(269),[223,108],i(195),[1,192]],12e3:[r,i(268),[3,127,248],i(268),[6,255,240],i(268),[13,255,224],i(268),[27,253,128],i(259),[56]],11025:[r,i(268),[3,127,248],i(268),[6,255,240],i(268),[13,255,224],i(268),[27,255,192],i(268),[55,175,128],i(108),[112]],8e3:[r,i(268),[3,121,16],i(47),[7]]}),o}})),o=e(((e,t)=>{var n=9e4,r=function(e){return e*n},i=function(e,t){return e*t},a=function(e){return e/n},o=function(e,t){return e/t};t.exports={ONE_SECOND_IN_TS:n,secondsToVideoTs:r,secondsToAudioTs:i,videoTsToSeconds:a,audioTsToSeconds:o,audioTsToVideoTs:function(e,t){return r(o(e,t))},videoTsToAudioTs:function(e,t){return i(a(e),t)},metadataTsToSeconds:function(e,t,n){return a(n?e:e-t)}}})),s=e(((e,t)=>{var n=a(),r=o(),i=function(e){var t,n,r=0;for(t=0;tr.ONE_SECOND_IN_TS/2))){for(d=n()[e.samplerate],d||=t[0].data,f=0;f=n?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=n?(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0):!1}))},generateSampleTable:function(e){var t,n,r=[];for(t=0;t{var n=o().ONE_SECOND_IN_TS;t.exports={clearDtsInfo:function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},calculateTrackBaseMediaDecodeTime:function(e,t){var r,i,a=e.minSegmentDts;return t||(a-=e.timelineStartInfo.dts),r=e.timelineStartInfo.baseMediaDecodeTime,r+=a,r=Math.max(0,r),e.type===`audio`&&(i=e.samplerate/n,r*=i,r=Math.floor(r)),r},collectDtsInfo:function(e,t){typeof t.pts==`number`&&(e.timelineStartInfo.pts===void 0&&(e.timelineStartInfo.pts=t.pts),e.minSegmentPts===void 0?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),e.maxSegmentPts===void 0?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),typeof t.dts==`number`&&(e.timelineStartInfo.dts===void 0&&(e.timelineStartInfo.dts=t.dts),e.minSegmentDts===void 0?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.maxSegmentDts===void 0?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))}}})),l=e(((e,t)=>{var n=4;t.exports={parseSei:function(e){for(var t=0,r={payloadType:-1,payloadSize:0},i=0,a=0;t{var r=t(),i=l(),a=function e(t){t||={},e.prototype.init.call(this),this.parse708captions_=typeof t.parse708captions!=`boolean`||t.parse708captions,this.captionPackets_=[],this.ccStreams_=[new v(0,0),new v(0,1),new v(1,0),new v(1,1)],this.parse708captions_&&(this.cc708Stream_=new f({captionServices:t.captionServices})),this.reset(),this.ccStreams_.forEach(function(e){e.on(`data`,this.trigger.bind(this,`data`)),e.on(`partialdone`,this.trigger.bind(this,`partialdone`)),e.on(`done`,this.trigger.bind(this,`done`))},this),this.parse708captions_&&(this.cc708Stream_.on(`data`,this.trigger.bind(this,`data`)),this.cc708Stream_.on(`partialdone`,this.trigger.bind(this,`partialdone`)),this.cc708Stream_.on(`done`,this.trigger.bind(this,`done`)))};a.prototype=new r,a.prototype.push=function(e){var t,n,r;if(e.nalUnitType===`sei_rbsp`&&(t=i.parseSei(e.escapedRBSP),t.payload&&t.payloadType===i.USER_DATA_REGISTERED_ITU_T_T35&&(n=i.parseUserData(t),n))){if(e.dts=this.virtualRowCount&&typeof this.beforeRowOverflow==`function`&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(``),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},u.prototype.isEmpty=function(){return this.rows.length===0||this.rows.length===1&&this.rows[0]===``},u.prototype.addText=function(e){this.rows[this.rowIdx]+=e},u.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var d=function(e,t,n){this.serviceNum=e,this.text=``,this.currentWindow=new u(-1),this.windows=[],this.stream=n,typeof t==`string`&&this.createTextDecoder(t)};d.prototype.init=function(e,t){this.startPts=e;for(var n=0;n<8;n++)this.windows[n]=new u(n),typeof t==`function`&&(this.windows[n].beforeRowOverflow=t)},d.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},d.prototype.createTextDecoder=function(e){if(typeof TextDecoder>`u`)this.stream.trigger(`log`,{level:`warn`,message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger(`log`,{level:`warn`,message:`TextDecoder could not be created with `+e+` encoding. `+t})}};var f=function e(t){t||={},e.prototype.init.call(this);var n=this,r=t.captionServices||{},i={},a;Object.keys(r).forEach(function(e){a=r[e],/^SERVICE/.test(e)&&(i[e]=a.encoding)}),this.serviceEncodings=i,this.current708Packet=null,this.services={},this.push=function(e){e.type===3?(n.new708Packet(),n.add708Bytes(e)):(n.current708Packet===null&&n.new708Packet(),n.add708Bytes(e))}};f.prototype=new r,f.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},f.prototype.add708Bytes=function(e){var t=e.ccData,n=t>>>8,r=t&255;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(n),this.current708Packet.data.push(r)},f.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,n=null,r=null,i=0,a=t[i++];for(e.seq=a>>6,e.sizeCode=a&63;i>5,r=a&31,n===7&&r>0&&(a=t[i++],n=a),this.pushServiceBlock(n,i,r),r>0&&(i+=r-1)},f.prototype.pushServiceBlock=function(e,t,n){var r,i=t,a=this.current708Packet.data,o=this.services[e];for(o||=this.initService(e,i);i>5,a.rowLock=(r&16)>>4,a.columnLock=(r&8)>>3,a.priority=r&7,r=n[++e],a.relativePositioning=(r&128)>>7,a.anchorVertical=r&127,r=n[++e],a.anchorHorizontal=r,r=n[++e],a.anchorPoint=(r&240)>>4,a.rowCount=r&15,r=n[++e],a.columnCount=r&63,r=n[++e],a.windowStyle=(r&56)>>3,a.penStyle=r&7,a.virtualRowCount=a.rowCount+1,e},f.prototype.setWindowAttributes=function(e,t){var n=this.current708Packet.data,r=n[e],i=t.currentWindow.winAttr;return r=n[++e],i.fillOpacity=(r&192)>>6,i.fillRed=(r&48)>>4,i.fillGreen=(r&12)>>2,i.fillBlue=r&3,r=n[++e],i.borderType=(r&192)>>6,i.borderRed=(r&48)>>4,i.borderGreen=(r&12)>>2,i.borderBlue=r&3,r=n[++e],i.borderType+=(r&128)>>5,i.wordWrap=(r&64)>>6,i.printDirection=(r&48)>>4,i.scrollDirection=(r&12)>>2,i.justify=r&3,r=n[++e],i.effectSpeed=(r&240)>>4,i.effectDirection=(r&12)>>2,i.displayEffect=r&3,e},f.prototype.flushDisplayed=function(e,t){for(var n=[],r=0;r<8;r++)t.windows[r].visible&&!t.windows[r].isEmpty()&&n.push(t.windows[r].getText());t.endPts=e,t.text=n.join(`\n\n`),this.pushCaption(t),t.startPts=e},f.prototype.pushCaption=function(e){e.text!==``&&(this.trigger(`data`,{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:`cc708_`+e.serviceNum}),e.text=``,e.startPts=e.endPts)},f.prototype.displayWindows=function(e,t){var n=this.current708Packet.data[++e],r=this.getPts(e);this.flushDisplayed(r,t);for(var i=0;i<8;i++)n&1<>4,i.offset=(r&12)>>2,i.penSize=r&3,r=n[++e],i.italics=(r&128)>>7,i.underline=(r&64)>>6,i.edgeType=(r&56)>>3,i.fontStyle=r&7,e},f.prototype.setPenColor=function(e,t){var n=this.current708Packet.data,r=n[e],i=t.currentWindow.penColor;return r=n[++e],i.fgOpacity=(r&192)>>6,i.fgRed=(r&48)>>4,i.fgGreen=(r&12)>>2,i.fgBlue=r&3,r=n[++e],i.bgOpacity=(r&192)>>6,i.bgRed=(r&48)>>4,i.bgGreen=(r&12)>>2,i.bgBlue=r&3,r=n[++e],i.edgeRed=(r&48)>>4,i.edgeGreen=(r&12)>>2,i.edgeBlue=r&3,e},f.prototype.setPenLocation=function(e,t){var n=this.current708Packet.data,r=n[e],i=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,r=n[++e],i.row=r&15,r=n[++e],i.column=r&63,e},f.prototype.reset=function(e,t){var n=this.getPts(e);return this.flushDisplayed(n,t),this.initService(t.serviceNum,e)};var p={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},m=function(e){return e===null?``:(e=p[e]||e,String.fromCharCode(e))},h=14,g=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],_=function(){for(var e=[],t=h+1;t--;)e.push(``);return e},v=function e(t,n){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=n||0,this.name_=`CC`+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(e){var t=e.ccData&32639,n,r,i,a;if(t===this.lastControlCode_){this.lastControlCode_=null;return}if((t&61440)==4096?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),r=t>>>8,i=t&255,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_=`popOn`;else if(t===this.END_OF_CAPTION_)this.mode_=`popOn`,this.clearFormatting(e.pts),this.flushDisplayed(e.pts),n=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=n,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)this.mode_===`popOn`?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=_();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=_();else if(t===this.RESUME_DIRECT_CAPTIONING_)this.mode_!==`paintOn`&&(this.flushDisplayed(e.pts),this.displayed_=_()),this.mode_=`paintOn`,this.startPts_=e.pts;else if(this.isSpecialCharacter(r,i))r=(r&3)<<8,a=m(r|i),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(r,i))this.mode_===`popOn`?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),r=(r&3)<<8,a=m(r|i),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(r,i))this.clearFormatting(e.pts),this[this.mode_](e.pts,` `),this.column_++,(i&14)==14&&this.addFormatting(e.pts,[`i`]),(i&1)==1&&this.addFormatting(e.pts,[`u`]);else if(this.isOffsetControlCode(r,i))this.column_+=i&3;else if(this.isPAC(r,i)){var o=g.indexOf(t&7968);this.mode_===`rollUp`&&(o-this.rollUpRows_+1<0&&(o=this.rollUpRows_-1),this.setRollUp(e.pts,o)),o!==this.row_&&(this.clearFormatting(e.pts),this.row_=o),i&1&&this.formatting_.indexOf(`u`)===-1&&this.addFormatting(e.pts,[`u`]),(t&16)==16&&(this.column_=((t&14)>>1)*4),this.isColorPAC(i)&&(i&14)==14&&this.addFormatting(e.pts,[`i`])}else this.isNormalChar(r)&&(i===0&&(i=null),a=m(r),a+=m(i),this[this.mode_](e.pts,a),this.column_+=a.length)}};v.prototype=new r,v.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e,t){try{return e.trim()}catch{return this.trigger(`log`,{level:`warn`,message:`Skipping a malformed 608 caption at index `+t+`.`}),``}},this).join(`\n`).replace(/^\\n+|\\n+$/g,``);t.length&&this.trigger(`data`,{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},v.prototype.reset=function(){this.mode_=`popOn`,this.topRow_=0,this.startPts_=0,this.displayed_=_(),this.nonDisplayed_=_(),this.lastControlCode_=null,this.column_=0,this.row_=h,this.rollUpRows_=2,this.formatting_=[]},v.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},v.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},v.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},v.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},v.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},v.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},v.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},v.prototype.isNormalChar=function(e){return e>=32&&e<=127},v.prototype.setRollUp=function(e,t){if(this.mode_!==`rollUp`&&(this.row_=h,this.mode_=`rollUp`,this.flushDisplayed(e),this.nonDisplayed_=_(),this.displayed_=_()),t!==void 0&&t!==this.row_)for(var n=0;n`},``);this[this.mode_](e,n)},v.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(e,t){return e+``},``);this.formatting_=[],this[this.mode_](e,t)}},v.prototype.popOn=function(e,t){var n=this.nonDisplayed_[this.row_];n+=t,this.nonDisplayed_[this.row_]=n},v.prototype.rollUp=function(e,t){var n=this.displayed_[this.row_];n+=t,this.displayed_[this.row_]=n},v.prototype.shiftRowsUp_=function(){var e;for(e=0;e{t.exports={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21}})),f=e(((e,n)=>{var r=t(),i=8589934592,a=4294967296,o=`shared`,s=function(e,t){var n=1;for(e>t&&(n=-1);Math.abs(t-e)>a;)e+=n*i;return e},c=function e(t){var n,r;e.prototype.init.call(this),this.type_=t||o,this.push=function(e){this.type_!==o&&e.type!==this.type_||(r===void 0&&(r=e.dts),e.dts=s(e.dts,r),e.pts=s(e.pts,r),n=e.dts,this.trigger(`data`,e))},this.flush=function(){r=n,this.trigger(`done`)},this.endTimeline=function(){this.flush(),this.trigger(`endedtimeline`)},this.discontinuity=function(){r=void 0,n=void 0},this.reset=function(){this.discontinuity(),this.trigger(`reset`)}};c.prototype=new r,n.exports={TimestampRolloverStream:c,handleRollover:s}})),p=e(((e,t)=>{t.exports={typedArrayIndexOf:function(e,t,n){if(!e)return-1;for(var r=n;r{var n=p().typedArrayIndexOf,r={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},i=function(e,t,n){var r,i=``;for(r=t;r`?e.url=o(e.data,t,e.data.length):e.pictureData=e.data.subarray(t,e.data.length))))},"T*":function(e){e.data[0]===r.Utf8&&(e.value=a(e.data,1,e.data.length).replace(/\\0*$/,``),e.values=e.value.split(`\\0`))},TXXX:function(e){var t;e.data[0]===r.Utf8&&(t=n(e.data,0,1),t!==-1&&(e.description=a(e.data,1,t),e.value=a(e.data,t+1,e.data.length).replace(/\\0*$/,``),e.data=e.value))},"W*":function(e){e.url=o(e.data,0,e.data.length).replace(/\\0.*$/,``)},WXXX:function(e){var t;e.data[0]===r.Utf8&&(t=n(e.data,0,1),t!==-1&&(e.description=a(e.data,1,t),e.url=o(e.data,t+1,e.data.length).replace(/\\0.*$/,``)))},PRIV:function(e){var t;for(t=0;t{var r=t(),i=d(),a=m(),o=function(e){var t={descriptor:e&&e.descriptor},n=0,r=[],s=0,c;if(o.prototype.init.call(this),this.dispatchType=i.METADATA_STREAM_TYPE.toString(16),t.descriptor)for(c=0;c>>2;f*=4,f+=d[7]&3,c.timeStamp=f,t.pts===void 0&&t.dts===void 0&&(t.pts=c.timeStamp,t.dts=c.timeStamp),this.trigger(`timestamp`,c)}t.frames.push(c),i+=10,i+=o}while(i{var r=t(),i=u(),a=d(),o=f().TimestampRolloverStream,s,c,l,p=188,m=71;s=function(){var e=new Uint8Array(p),t=0;s.prototype.init.call(this),this.push=function(n){var r=0,i=p,a;for(t?(a=new Uint8Array(n.byteLength+t),a.set(e.subarray(0,t)),a.set(n,t),t=0):a=n;i>>4>1&&(r+=t[r]+1),n.pid===0)n.type=`pat`,e(t.subarray(r),n),this.trigger(`data`,n);else if(n.pid===this.pmtPid)for(n.type=`pmt`,e(t.subarray(r),n),this.trigger(`data`,n);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([t,r,n]):this.processPes_(t,r,n)},this.processPes_=function(e,t,n){n.pid===this.programMapTable.video?n.streamType=a.H264_STREAM_TYPE:n.pid===this.programMapTable.audio?n.streamType=a.ADTS_STREAM_TYPE:n.streamType=this.programMapTable[`timed-metadata`][n.pid],n.type=`pes`,n.data=e.subarray(t),this.trigger(`data`,n)}},c.prototype=new r,c.STREAM_TYPES={h264:27,adts:15},l=function(){var e=this,t=!1,n={data:[],size:0},r={data:[],size:0},i={data:[],size:0},o,s=function(e,t){var n,r=e[0]<<16|e[1]<<8|e[2];t.data=new Uint8Array,r===1&&(t.packetLength=6+(e[4]<<8|e[5]),t.dataAlignmentIndicator=(e[6]&4)!=0,n=e[7],n&192&&(t.pts=(e[9]&14)<<27|(e[10]&255)<<20|(e[11]&254)<<12|(e[12]&255)<<5|(e[13]&254)>>>3,t.pts*=4,t.pts+=(e[13]&6)>>>1,t.dts=t.pts,n&64&&(t.dts=(e[14]&14)<<27|(e[15]&255)<<20|(e[16]&254)<<12|(e[17]&255)<<5|(e[18]&254)>>>3,t.dts*=4,t.dts+=(e[18]&6)>>>1)),t.data=e.subarray(9+e[8]))},c=function(t,n,r){var i=new Uint8Array(t.size),a={type:n},o=0,c=0,l=!1,u;if(!(!t.data.length||t.size<9)){for(a.trackId=t.data[0].pid,o=0;o{var r=t(),i=o().ONE_SECOND_IN_TS,a,s=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];a=function(e){var t,n=0;a.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger(`log`,{level:`warn`,message:`adts skiping bytes `+e+` to `+t+` in frame `+n+` outside syncword`})},this.push=function(r){var a=0,o,c,l,u,d;if(e||(n=0),r.type===`audio`){t&&t.length?(l=t,t=new Uint8Array(l.byteLength+r.data.byteLength),t.set(l),t.set(r.data,l.byteLength)):t=r.data;for(var f;a+7>5,u=((t[a+6]&3)+1)*1024,d=u*i/s[(t[a+2]&60)>>>2],t.byteLength-a>>6&3)+1,channelcount:(t[a+2]&1)<<2|(t[a+3]&192)>>>6,samplerate:s[(t[a+2]&60)>>>2],samplingfrequencyindex:(t[a+2]&60)>>>2,samplesize:16,data:t.subarray(a+7+c,a+o)}),n++,a+=o}typeof f==`number`&&(this.skipWarn_(f,a),f=null),t=t.subarray(a)}},this.flush=function(){n=0,this.trigger(`done`)},this.reset=function(){t=void 0,this.trigger(`reset`)},this.endTimeline=function(){t=void 0,this.trigger(`endedtimeline`)}},a.prototype=new r,n.exports=a})),v=e(((e,t)=>{t.exports=function(e){var t=e.byteLength,n=0,r=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+r},this.loadWord=function(){var i=e.byteLength-t,a=new Uint8Array(4),o=Math.min(4,t);if(o===0)throw Error(`no bytes available`);a.set(e.subarray(i,i+o)),n=new DataView(a.buffer).getUint32(0),r=o*8,t-=o},this.skipBits=function(e){var i;r>e?(n<<=e,r-=e):(e-=r,i=Math.floor(e/8),e-=i*8,t-=i,this.loadWord(),n<<=e,r-=e)},this.readBits=function(e){var i=Math.min(r,e),a=n>>>32-i;return r-=i,r>0?n<<=i:t>0&&this.loadWord(),i=e-i,i>0?a<>>e)return n<<=e,r-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()}})),y=e(((e,n)=>{var r=t(),i=v(),a,o=function(){var e=0,t,n;o.prototype.init.call(this),this.push=function(r){var i;n?(i=new Uint8Array(n.byteLength+r.data.byteLength),i.set(n),i.set(r.data,n.byteLength),n=i):n=r.data;for(var a=n.byteLength;e3&&this.trigger(`data`,n.subarray(e+3)),n=null,e=0,this.trigger(`done`)},this.endTimeline=function(){this.flush(),this.trigger(`endedtimeline`)}},s;o.prototype=new r,s={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},a=function(){var e=new o,t,n,r,c,l,u,d;a.prototype.init.call(this),t=this,this.push=function(t){t.type===`video`&&(n=t.trackId,r=t.pts,c=t.dts,e.push(t))},e.on(`data`,function(e){var i={trackId:n,pts:r,dts:c,data:e,nalUnitTypeCode:e[0]&31};switch(i.nalUnitTypeCode){case 5:i.nalUnitType=`slice_layer_without_partitioning_rbsp_idr`;break;case 6:i.nalUnitType=`sei_rbsp`,i.escapedRBSP=l(e.subarray(1));break;case 7:i.nalUnitType=`seq_parameter_set_rbsp`,i.escapedRBSP=l(e.subarray(1)),i.config=u(i.escapedRBSP);break;case 8:i.nalUnitType=`pic_parameter_set_rbsp`;break;case 9:i.nalUnitType=`access_unit_delimiter_rbsp`;break;default:break}t.trigger(`data`,i)}),e.on(`done`,function(){t.trigger(`done`)}),e.on(`partialdone`,function(){t.trigger(`partialdone`)}),e.on(`reset`,function(){t.trigger(`reset`)}),e.on(`endedtimeline`,function(){t.trigger(`endedtimeline`)}),this.flush=function(){e.flush()},this.partialFlush=function(){e.partialFlush()},this.reset=function(){e.reset()},this.endTimeline=function(){e.endTimeline()},d=function(e,t){var n=8,r=8,i,a;for(i=0;i{var n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],r=function(e,t){var n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],r=(e[t+5]&16)>>4;return n=n>=0?n:0,r?n+20:n+10},i=function e(t,n){return t.length-n<10||t[n]!==73||t[n+1]!==68||t[n+2]!==51?n:(n+=r(t,n),e(t,n))},a=function(e){var t=i(e,0);return e.length>=t+2&&(e[t]&255)==255&&(e[t+1]&240)==240&&(e[t+1]&22)==16},o=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},s=function(e,t,n){var r,i=``;for(r=t;r>5,r=e[t+4]<<3;return e[t+3]&6144|r|n},parseType:function(e,t){return e[t]===73&&e[t+1]===68&&e[t+2]===51?`timed-metadata`:e[t]&!0&&(e[t+1]&240)==240?`audio`:null},parseSampleRate:function(e){for(var t=0;t+5>>2]}return null},parseAacTimestamp:function(e){var t=10,n,r,i;e[5]&64&&(t+=4,t+=o(e.subarray(10,14)));do{if(n=o(e.subarray(t+4,t+8)),n<1)return null;if(i=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]),i===`PRIV`){r=e.subarray(t+10,t+n+10);for(var a=0;a>>2;return l*=4,l+=s[7]&3,l}break}}t+=10,t+=n}while(t{var r=t(),i=b(),a=function(){var e=new Uint8Array,t=0;a.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(n){var r=0,a=0,o,s,c,l;for(e.length?(l=e.length,e=new Uint8Array(n.byteLength+l),e.set(e.subarray(0,l)),e.set(n,l)):e=n;e.length-a>=3;){if(e[a]===73&&e[a+1]===68&&e[a+2]===51){if(e.length-a<10||(r=i.parseId3TagSize(e,a),a+r>e.length))break;s={type:`timed-metadata`,data:e.subarray(a,a+r)},this.trigger(`data`,s),a+=r;continue}else if((e[a]&255)==255&&(e[a+1]&240)==240){if(e.length-a<7||(r=i.parseAdtsSize(e,a),a+r>e.length))break;c={type:`audio`,data:e.subarray(a,a+r),pts:t,dts:t},this.trigger(`data`,c),a+=r;continue}a++}o=e.length-a,e=o>0?e.subarray(a):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger(`reset`)},this.endTimeline=function(){e=new Uint8Array,this.trigger(`endedtimeline`)}};a.prototype=new r,n.exports=a})),S=e(((e,t)=>{t.exports=[`audioobjecttype`,`channelcount`,`samplerate`,`samplingfrequencyindex`,`samplesize`]})),C=e(((e,t)=>{t.exports=[`width`,`height`,`profileIdc`,`levelIdc`,`profileCompatibility`,`sarRatio`]})),w=e(((e,n)=>{var a=t(),l=r(),u=i(),d=s(),f=c(),p=g(),m=o(),h=_(),v=y().H264Stream,w=x(),T=b().isLikelyAacData,E=o().ONE_SECOND_IN_TS,D=S(),O=C(),k,A,j,M,N=function(e,t){t.stream=e,this.trigger(`log`,t)},P=function(e,t){for(var n=Object.keys(t),r=0;r=-r&&a<=n&&(!o||i>a)&&(o=c,i=a)));return o?o.gop:null},this.alignGopsAtStart_=function(e){var t,n,r,a,o=e.byteLength,s=e.nalCount,c=e.duration,l;for(t=n=0;tr.pts){t++;continue}n++,o-=a.byteLength,s-=a.nalCount,c-=a.duration}return n===0?e:n===e.length?null:(l=e.slice(n),l.byteLength=o,l.duration=c,l.nalCount=s,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){for(var t=i.length-1,n=e.length-1,r,a,o=null,s=!1;t>=0&&n>=0;){if(r=i[t],a=e[n],r.pts===a.pts){s=!0;break}if(r.pts>a.pts){t--;continue}t===i.length-1&&(o=n),n--}if(!s&&o===null)return null;var c=s?n:o;if(c===0)return e;var l=e.slice(c),u=l.reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0});return l.byteLength=u.byteLength,l.duration=u.duration,l.nalCount=u.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){i=e}},k.prototype=new a,M=function(e,t){this.numberOfTracks=0,this.metadataStream=t,e||={},e.remux===void 0?this.remuxTracks=!0:this.remuxTracks=!!e.remux,typeof e.keepOriginalTimestamps==`boolean`?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,M.prototype.init.call(this),this.push=function(e){if(e.text)return this.pendingCaptions.push(e);if(e.frames)return this.pendingMetadata.push(e);this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,e.track.type===`video`&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),e.track.type===`audio`&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))}},M.prototype=new a,M.prototype.flush=function(e){var t=0,n={captions:[],captionStreams:{},metadata:[],info:{}},r,i,a,o=0,s;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger(`done`),this.emittedTracks=0);return}}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,O.forEach(function(e){n.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,D.forEach(function(e){n.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?n.type=this.pendingTracks[0].type:n.type=`combined`,this.emittedTracks+=this.pendingTracks.length,a=l.initSegment(this.pendingTracks),n.initSegment=new Uint8Array(a.byteLength),n.initSegment.set(a),n.data=new Uint8Array(this.pendingBytes),s=0;s=this.numberOfTracks&&(this.trigger(`done`),this.emittedTracks=0)},M.prototype.setRemux=function(e){this.remuxTracks=e},j=function(e){var t=this,n=!0,r,i;j.prototype.init.call(this),e||={},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var n={};this.transmuxPipeline_=n,n.type=`aac`,n.metadataStream=new p.MetadataStream,n.aacStream=new w,n.audioTimestampRolloverStream=new p.TimestampRolloverStream(`audio`),n.timedMetadataTimestampRolloverStream=new p.TimestampRolloverStream(`timed-metadata`),n.adtsStream=new h,n.coalesceStream=new M(e,n.metadataStream),n.headOfPipeline=n.aacStream,n.aacStream.pipe(n.audioTimestampRolloverStream).pipe(n.adtsStream),n.aacStream.pipe(n.timedMetadataTimestampRolloverStream).pipe(n.metadataStream).pipe(n.coalesceStream),n.metadataStream.on(`timestamp`,function(e){n.aacStream.setTimestamp(e.timeStamp)}),n.aacStream.on(`data`,function(a){a.type!==`timed-metadata`&&a.type!==`audio`||n.audioSegmentStream||(i||={timelineStartInfo:{baseMediaDecodeTime:t.baseMediaDecodeTime},codec:`adts`,type:`audio`},n.coalesceStream.numberOfTracks++,n.audioSegmentStream=new A(i,e),n.audioSegmentStream.on(`log`,t.getLogTrigger_(`audioSegmentStream`)),n.audioSegmentStream.on(`timingInfo`,t.trigger.bind(t,`audioTimingInfo`)),n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream),t.trigger(`trackinfo`,{hasAudio:!!i,hasVideo:!!r}))}),n.coalesceStream.on(`data`,this.trigger.bind(this,`data`)),n.coalesceStream.on(`done`,this.trigger.bind(this,`done`)),P(this,n)},this.setupTsPipeline=function(){var n={};this.transmuxPipeline_=n,n.type=`ts`,n.metadataStream=new p.MetadataStream,n.packetStream=new p.TransportPacketStream,n.parseStream=new p.TransportParseStream,n.elementaryStream=new p.ElementaryStream,n.timestampRolloverStream=new p.TimestampRolloverStream,n.adtsStream=new h,n.h264Stream=new v,n.captionStream=new p.CaptionStream(e),n.coalesceStream=new M(e,n.metadataStream),n.headOfPipeline=n.packetStream,n.packetStream.pipe(n.parseStream).pipe(n.elementaryStream).pipe(n.timestampRolloverStream),n.timestampRolloverStream.pipe(n.h264Stream),n.timestampRolloverStream.pipe(n.adtsStream),n.timestampRolloverStream.pipe(n.metadataStream).pipe(n.coalesceStream),n.h264Stream.pipe(n.captionStream).pipe(n.coalesceStream),n.elementaryStream.on(`data`,function(a){var o;if(a.type===`metadata`){for(o=a.tracks.length;o--;)!r&&a.tracks[o].type===`video`?(r=a.tracks[o],r.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime):!i&&a.tracks[o].type===`audio`&&(i=a.tracks[o],i.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime);r&&!n.videoSegmentStream&&(n.coalesceStream.numberOfTracks++,n.videoSegmentStream=new k(r,e),n.videoSegmentStream.on(`log`,t.getLogTrigger_(`videoSegmentStream`)),n.videoSegmentStream.on(`timelineStartInfo`,function(r){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=r,n.audioSegmentStream.setEarliestDts(r.dts-t.baseMediaDecodeTime))}),n.videoSegmentStream.on(`processedGopsInfo`,t.trigger.bind(t,`gopInfo`)),n.videoSegmentStream.on(`segmentTimingInfo`,t.trigger.bind(t,`videoSegmentTimingInfo`)),n.videoSegmentStream.on(`baseMediaDecodeTime`,function(e){i&&n.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),n.videoSegmentStream.on(`timingInfo`,t.trigger.bind(t,`videoTimingInfo`)),n.h264Stream.pipe(n.videoSegmentStream).pipe(n.coalesceStream)),i&&!n.audioSegmentStream&&(n.coalesceStream.numberOfTracks++,n.audioSegmentStream=new A(i,e),n.audioSegmentStream.on(`log`,t.getLogTrigger_(`audioSegmentStream`)),n.audioSegmentStream.on(`timingInfo`,t.trigger.bind(t,`audioTimingInfo`)),n.audioSegmentStream.on(`segmentTimingInfo`,t.trigger.bind(t,`audioSegmentTimingInfo`)),n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream)),t.trigger(`trackinfo`,{hasAudio:!!i,hasVideo:!!r})}}),n.coalesceStream.on(`data`,this.trigger.bind(this,`data`)),n.coalesceStream.on(`id3Frame`,function(e){e.dispatchType=n.metadataStream.dispatchType,t.trigger(`id3Frame`,e)}),n.coalesceStream.on(`caption`,this.trigger.bind(this,`caption`)),n.coalesceStream.on(`done`,this.trigger.bind(this,`done`)),P(this,n)},this.setBaseMediaDecodeTime=function(t){var n=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=t),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,f.clearDtsInfo(i),n.audioTimestampRolloverStream&&n.audioTimestampRolloverStream.discontinuity()),r&&(n.videoSegmentStream&&(n.videoSegmentStream.gopCache_=[]),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,f.clearDtsInfo(r),n.captionStream.reset()),n.timestampRolloverStream&&n.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var n=this.transmuxPipeline_;e.remux=t,n&&n.coalesceStream&&n.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(n){n.stream=e,t.trigger(`log`,n)}},this.push=function(e){if(n){var t=T(e);t&&this.transmuxPipeline_.type!==`aac`?this.setupAacPipeline():!t&&this.transmuxPipeline_.type!==`ts`&&this.setupTsPipeline(),n=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){n=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},j.prototype=new a,n.exports={Transmuxer:j,VideoSegmentStream:k,AudioSegmentStream:A,AUDIO_PROPERTIES:D,VIDEO_PROPERTIES:O,generateSegmentTimingInfo:I}}))();let T=new Set([`audio`,`video`]);function E(e){let t,n=[];e.on(`data`,e=>{n.push(e)});function r(t){e.push(t)}function i(){n=[],e.flush();let r=n.length===0&&t!==void 0;if(r)try{e.setRemux(!1),e.flush()}finally{e.setRemux(!0)}if(n.length!==1)throw Error(`The segment produced an unexpected output layout.`);let[i]=n;if(n=[],i.type!==`combined`&&!(r&&T.has(i.type)))throw Error(`The clip did not produce supported audio and video tracks.`);if(i.data.byteLength>8388608)throw Error(`The MP4 fragment exceeds the safe output limit.`);let a;if(i.type===`combined`){if(!t)t=i.initSegment.slice(),a=t.slice();else if(!D(t,i.initSegment))throw Error(`The clip track metadata changes during playback.`)}return{data:i.data,...a?{initSegment:a}:{}}}return{flush:i,push:r}}function D(e,t){if(e.byteLength!==t.byteLength)return!1;for(let n=0;n{let t=e.data;try{if(t.type===`cancel`){O.close();return}if(t.type===`push`){k.push(new Uint8Array(t.bytes)),A({requestId:t.requestId,type:`pushed`});return}let e=k.flush(),n=j(e.data),r=e.initSegment?j(e.initSegment):void 0;A({data:n,...r?{initSegment:r}:{},requestId:t.requestId,type:`fragment`},r?[r,n]:[n])}catch{A({message:`The clip could not be converted to MP4.`,requestId:t.type===`cancel`?void 0:t.requestId,type:`error`})}};function A(e,t=[]){O.postMessage(e,t)}function j(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}})();',Vr=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Br],{type:`text/javascript;charset=utf-8`});function Hr(e){let t;try{if(t=Vr&&(self.URL||self.webkitURL).createObjectURL(Vr),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Br),{name:e?.name})}}var Ur=class{worker=new Hr;nextRequestId=1;pending=new Map;constructor(){this.worker.onmessage=e=>{let t=e.data;if(t.type===`error`){let e=new G(`transmuxing`,t.message);t.requestId===void 0?this.rejectAll(e):this.rejectRequest(t.requestId,e);return}let n=this.pending.get(t.requestId);n&&(this.pending.delete(t.requestId),n.resolve(t))},this.worker.onerror=()=>{this.rejectAll(new G(`transmuxing`,`The MP4 conversion worker stopped unexpectedly.`))}}async push(e){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if((await this.request({bytes:t,requestId:this.nextRequestId,type:`push`},[t])).type!==`pushed`)throw Wr()}async flush(){let e=await this.request({requestId:this.nextRequestId,type:`flush`});if(e.type!==`fragment`)throw Wr();return{data:new Uint8Array(e.data),...e.initSegment?{initSegment:new Uint8Array(e.initSegment)}:{}}}terminate(e=`The MP4 conversion was cancelled.`){this.worker.postMessage({type:`cancel`}),this.worker.terminate(),this.rejectAll(new G(`cancelled`,e))}request(e,t=[]){let n=e.requestId;return this.nextRequestId+=1,new Promise((r,i)=>{this.pending.set(n,{reject:i,resolve:r}),this.worker.postMessage(e,t)})}rejectRequest(e,t){let n=this.pending.get(e);n&&(this.pending.delete(e),n.reject(t))}rejectAll(e){for(let t of this.pending.values())t.reject(e);this.pending.clear()}};function Wr(){return new G(`transmuxing`,`The MP4 conversion worker returned an invalid response.`)}var Gr=256*1024;async function Kr(e,t,n,{createWorker:r=()=>new Ur,fetchImplementation:i=fetch,onProgress:a=()=>void 0}={}){if(e.kind===`direct-mp4`){await Xr(e.url,e.sourceBytes,t,n,i,a);return}let o=r(),s=0,c=0,l=0,u=0;try{for(let r of e.segments){$r(n);let e=await qr(r,o,n,i,e=>{c+=e,a({completedSegments:s,fetchedBytes:c,phase:`fetching`,processedBytes:l,writtenBytes:u})});a({completedSegments:s,fetchedBytes:c,phase:`transmuxing`,processedBytes:l,writtenBytes:u});let d=await o.flush();l+=e,a({completedSegments:s,fetchedBytes:c,phase:`writing`,processedBytes:l,writtenBytes:u}),d.initSegment&&await t.write(d.initSegment),await t.write(d.data),u+=e,s+=1,a({completedSegments:s,fetchedBytes:c,phase:`fetching`,processedBytes:l,writtenBytes:u})}}finally{o.terminate()}}async function qr(e,t,n,r,i){if(e.length!==void 0&&e.offset!==void 0){let a=e.offset+e.length-1,o=await r(e.url,{headers:{Range:`bytes=${e.offset}-${a}`},signal:n});if(or(o),o.status!==206)throw await o.body?.cancel(),new G(`media-request`,`The media server did not honor a required byte range.`);let s=ar(o.headers.get(`content-range`));if(s.start!==e.offset||s.end!==a||s.total<=a)throw await o.body?.cancel(),new G(`media-request`,`The media server returned an unexpected byte range.`);return Jr(o,e.length,t,n,i)}let a=await r(e.url,{signal:n});if(or(a),!a.ok)throw new G(`media-request`,`A clip media segment could not be downloaded.`);return Jr(a,void 0,t,n,i)}async function Jr(e,t,n,r,i){let a=e.body?.getReader();if(!a)throw new G(`media-request`,`A clip media segment did not contain a readable body.`);let o=0;try{for(;;){let{done:e,value:t}=await a.read();if(e)break;if(o+=t.byteLength,o>8388608)throw await a.cancel(),new G(`unsupported-media`,`A clip segment exceeds the safe processing limit.`);i(t.byteLength),await Yr(t,n,r)}}finally{a.releaseLock()}if(t!==void 0&&o!==t)throw new G(`media-request`,`A clip media segment was truncated.`);return o}async function Yr(e,t,n){for(let r=0;r{try{await t.abort(e)}catch{}},close:async()=>{try{await t.close()}catch{throw new G(`file-write`,`The MP4 file could not be finalized.`)}},filename:e.name,write:async e=>{try{await t.write(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}catch{throw new G(`file-write`,`The MP4 file could not be written.`)}}}}function ni(e,t=ri){let n=[],r=!1;return{abort:async()=>{n=[],r=!0},close:async()=>{if(r)return;let i=new Blob(n,{type:`video/mp4`});n=[],r=!0,t(i,e)},filename:e,write:async e=>{if(r)throw new G(`file-write`,`The memory-backed output is already closed.`);n.push(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}}}function ri(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.download=t,r.href=n,r.style.display=`none`,document.body.append(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),0)}var ii=/[\u0000-\u001f<>:"/\\|?*]/g,ai=/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i,oi=180;function si({channel:e,clipId:t,title:n}){let r=[e&&n?`${e} - ${n}`:void 0,n,e?`${e} - ${t}`:void 0,t];for(let e of r){if(!e)continue;let n=ci(e,t);if(n)return n}return t}function ci(e,t){let n=e.replace(ii,` `).replace(/\s+/g,` `).trim().replace(/[ .]+$/g,``);return n.length>oi&&(n=n.slice(0,oi).trimEnd()),ai.test(n)&&(n=`${n}_`),n||=t.replace(ii,` `).trim(),n||`kick-clip`}function li(e,t){return`${ci(e,t)}.mp4`}var ui=new Set([`cancelled`,`completed`,`failed`]),di=new Set([...ui,`ready`]),fi=new Set([`active`,`choosing-destination`,`inspecting`]),pi=new Set([`awaiting-destination`,`ready`]),mi=2,hi=100,gi=1;function _i(e){let t=new Map,n=new Map,r=new Set,i=[],a=[],o=0,s;function c(){for(let e of r)e()}function l(){return{jobs:[...t.values()].map(e=>({...e,queuePosition:e.status===`queued`?a.indexOf(e.id)+1:void 0}))}}function u(r,a=window.location.href){let o=[...t.values()].find(e=>e.clipId===r&&!ui.has(e.status));if(o)return o.id;let s=vi(),l={acknowledged:!1,basename:r,clipId:r,completedSegments:0,createdAt:e.now(),fetchedBytes:0,filename:`${r}.mp4`,id:s,pageUrl:a,phase:`inspecting`,processedBytes:0,status:`inspecting`,writtenBytes:0};return t.set(s,l),n.set(s,{generation:0}),i.push(s),c(),d(),s}function d(){for(;o0;){let e=i.shift(),n=e?t.get(e):void 0;!n||n.status!==`inspecting`||(o+=1,f(n).finally(()=>{--o,d()}))}}async function f(t){let n=ie(t.id),r=n.generation+1,i=new AbortController;n.generation=r,n.abortController=i;try{let a=await e.inspectClip(t.clipId,i.signal,{pageUrl:t.pageUrl});if(!E(t.id,r))return;p(t,n,a),c()}catch(n){if(!E(t.id,r))return;let i=qn(n);t.phase=void 0,t.status=i.code===`cancelled`?`cancelled`:`failed`,t.error=i.code===`cancelled`?void 0:i,t.completedAt=e.now(),t.acknowledged=!1,c()}finally{E(t.id,r)&&(n.abortController=void 0)}}function p(e,t,n){let{metadata:r,plan:i}=n,a=si({channel:r.channel,clipId:e.clipId,title:r.title}),o=ur(i);t.plan=i,e.basename=a,e.category=r.category,e.channel=r.channel,e.creator=r.creator,e.error=void 0,e.filename=li(a,e.clipId),e.likeCount=r.likeCount,e.media={...o,duration:o.duration??r.duration},e.pageUrl=r.pageUrl,e.phase=void 0,e.publishedAt=r.publishedAt,e.status=`ready`,e.thumbnailUrl=r.thumbnailUrl,e.title=r.title,e.viewCount=r.viewCount,e.acknowledged=!1}function m(e,n){let r=t.get(e);!r||r.status!==`ready`||(r.basename=n,r.filename=li(n,r.clipId),c())}function h(e,r){let i=t.get(e),o=n.get(e);if(!(!i||!o||i.status!==`ready`||!o.plan)){if(i.basename=ci(i.basename,i.clipId),i.filename=li(i.basename,i.clipId),i.error=void 0,i.saveStrategy=r,o.saveStrategy=r,s){i.status=`queued`,a.push(e),c();return}s=e,r===`file-system`?g(e):_(e)}}async function g(r){let i=t.get(r),a=n.get(r);if(!i||!a||s!==r||!a.plan||i.status!==`ready`&&i.status!==`awaiting-destination`)return;let o=e.getSaveFilePicker();if(!o){T(i,`Direct file access is unavailable. Use the memory-backed download.`),C(r);return}i.status=`choosing-destination`,c();let l;try{l=await o({excludeAcceptAllOption:!0,suggestedName:i.filename,types:[{accept:{"video/mp4":[`.mp4`]},description:`MP4 video`}]})}catch(e){e instanceof DOMException&&e.name===`AbortError`?(i.status=`ready`,i.error=void 0):T(i,`The file destination could not be selected. You can try again or use the memory-backed download.`),C(r);return}if(!(s!==r||i.status!==`choosing-destination`)){try{a.sink=await e.createFileSystemSink(l),i.filename=a.sink.filename}catch(e){T(i,qn(e).message),C(r);return}await _(r)}}async function _(r){let i=t.get(r),a=n.get(r);if(!i||!a||!a.plan||s!==r)return;let o=a.sink??e.createBlobSink(i.filename),l=new AbortController,u=a.generation+1;a.abortController=l,a.generation=u,a.sink=o,i.acknowledged=!1,i.completedAt=void 0,i.completedSegments=0,i.error=void 0,i.fetchedBytes=0,i.phase=`fetching`,i.processedBytes=0,i.startedAt=e.now(),i.status=`active`,i.writtenBytes=0,c();try{if(await e.downloadMediaPlan(a.plan,o,l.signal,{onProgress:e=>{v(r,u,e)}}),await o.close(),!E(r,u))return;re(a),i.completedAt=e.now(),i.phase=void 0,i.status=`completed`,i.acknowledged=!1,ne(a),C(r)}catch(t){if(!E(r,u))return;await o.abort(t);let n=qn(t);re(a),i.completedAt=e.now(),i.error=n.code===`cancelled`?void 0:n,i.phase=void 0,i.status=n.code===`cancelled`?`cancelled`:`failed`,i.acknowledged=!1,ne(a),C(r)}}function v(e,r,i){let a=t.get(e),o=n.get(e);!a||!o||!E(e,r)||(a.completedSegments=i.completedSegments,a.fetchedBytes=i.fetchedBytes,a.phase=i.phase,a.processedBytes=i.processedBytes,a.writtenBytes=i.writtenBytes,!o.progressTimer&&(o.progressTimer=setTimeout(()=>{o.progressTimer=void 0,E(e,r)&&c()},hi)))}function y(r){let o=t.get(r),l=n.get(r);!o||!l||ui.has(o.status)||(l.generation+=1,l.abortController?.abort(new DOMException(`The operation was cancelled.`,`AbortError`)),l.sink?.abort(`cancelled`),re(l),yi(i,r),yi(a,r),o.completedAt=e.now(),o.error=void 0,o.phase=void 0,o.status=`cancelled`,o.acknowledged=!1,ne(l),s===r?C(r):c())}function b(e){let r=t.get(e),a=n.get(e);!r||!a||!ui.has(r.status)||(a.generation+=1,r.acknowledged=!1,r.completedAt=void 0,r.completedSegments=0,r.error=void 0,r.fetchedBytes=0,r.processedBytes=0,r.saveStrategy=void 0,r.startedAt=void 0,r.writtenBytes=0,a.plan?(r.phase=void 0,r.status=`ready`,c()):(r.phase=`inspecting`,r.status=`inspecting`,i.push(e),c(),d()))}function x(e){let r=t.get(e),i=n.get(e);!r||!i||!di.has(r.status)||(re(i),t.delete(e),n.delete(e),c())}function S(){let e=!1;for(let[r,i]of t){if(!di.has(i.status))continue;let a=n.get(r);a&&re(a),t.delete(r),n.delete(r),e=!0}e&&c()}function ee(){let e=!1;for(let n of t.values())ui.has(n.status)&&!n.acknowledged&&(n.acknowledged=!0,e=!0);e&&c()}function te(){let e=[...t.values()],n=e.filter(e=>fi.has(e.status)).length,r=e.filter(e=>e.status===`queued`||e.status===`awaiting-destination`).length,i=e.some(e=>ui.has(e.status)&&!e.acknowledged)||e.some(e=>pi.has(e.status));return{activeCount:n,attention:i,error:e.some(e=>e.status===`failed`&&!e.acknowledged),queuedCount:r,visible:n>0||r>0||i}}function C(e){s===e&&(s=void 0),w(),c()}function w(){if(!s)for(;a.length>0;){let e=a.shift(),r=e?t.get(e):void 0,i=e?n.get(e):void 0;if(!(!e||!r||!i||r.status!==`queued`)){s=e,i.saveStrategy===`file-system`?(r.status=`awaiting-destination`,r.acknowledged=!1):_(e);return}}}function T(e,t){e.error={code:`file-access`,message:t},e.phase=void 0,e.status=`ready`,e.acknowledged=!1}function ne(e){e.abortController=void 0,e.sink=void 0,e.saveStrategy=void 0}function re(e){e.progressTimer&&=(clearTimeout(e.progressTimer),void 0)}function E(e,t){return n.get(e)?.generation===t}function ie(e){let t=n.get(e);if(!t)throw Error(`Missing runtime for download job ${e}.`);return t}return{acknowledgeAttention:ee,cancel:y,chooseDestination:g,clearInactive:S,getActivitySummary:te,getSnapshot:l,inspectClip:u,remove:x,requestDownload:h,retry:b,subscribe(e){return r.add(e),()=>{r.delete(e)}},updateBasename:m}}function vi(){let e=`clip-download-${gi}`;return gi+=1,e}function yi(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1)}var Y=_i({createBlobSink:ni,createFileSystemSink:ti,downloadMediaPlan:Kr,getSaveFilePicker:ei,inspectClip:Or,now:Date.now}),bi=new Set,xi={open:!1};function Si(e){xi=e;for(let e of bi)e()}function Ci(e,t=window.location.href){let n=Y.inspectClip(e,t);return wi(n),n}function wi(e){Y.acknowledgeAttention(),Si({focusedJobId:e??xi.focusedJobId,open:!0})}function Ti(e){Si({focusedJobId:e,open:xi.open})}function Ei(){Si({...xi,open:!1})}function Di(){return xi}function Oi(e){return bi.add(e),()=>{bi.delete(e)}}var ki=1e3;function Ai(e,t,n,r){if(e<=0||n===void 0||r-nY.subscribe(()=>{t(Y.getSnapshot())}),[]),e}function Mi(){let[e,t]=L(Y.getActivitySummary);return R(()=>Y.subscribe(()=>{let e=Y.getActivitySummary();t(t=>Pi(t,e)?t:e)}),[]),e}function Ni(){let[e,t]=L(Di);return R(()=>Oi(()=>{t(Di())}),[]),e}function Pi(e,t){return e.activeCount===t.activeCount&&e.attention===t.attention&&e.error===t.error&&e.queuedCount===t.queuedCount&&e.visible===t.visible}var Fi=128*1024*1024,Ii=new Intl.DateTimeFormat(void 0,{day:`numeric`,month:`short`,year:`numeric`}),Li=new Intl.NumberFormat,Ri=[{header:`Clip`,id:`clip`,renderCell:e=>P(`div`,{className:`ke-download-queue__clip`,children:[e.thumbnailUrl?P(`img`,{alt:``,className:`ke-download-queue__thumbnail`,referrerPolicy:`no-referrer`,src:e.thumbnailUrl}):null,P(`span`,{className:`ke-download-queue__title`,children:e.title??e.clipId})]}),width:`minmax(12rem, 1fr)`},{align:`center`,header:`Channel`,id:`channel`,renderCell:e=>e.channel??`Unknown`,width:`9rem`},{align:`center`,header:`Status`,id:`status`,renderCell:e=>P(`span`,{className:`ke-download-queue__status`,"data-status":e.status,children:Xi(e)}),width:`9rem`},{align:`center`,header:`Duration`,id:`duration`,renderCell:e=>ta(e.media?.duration),width:`5.5rem`},{align:`center`,header:`Size`,id:`size`,renderCell:e=>e.media?.sourceBytes?ea(e.media.sourceBytes):`Unknown`,width:`6.5rem`}];function zi(){Y.clearInactive(),Vi()}function Bi(e){Y.remove(e),Vi()}function Vi(){Y.getSnapshot().jobs.length===0&&Ei()}function Hi(){let e=Ni(),{activeCount:t}=Mi(),{jobs:n}=ji(),[r,i]=L(`selected`),a=n.filter(e=>e.media!==void 0),o=n.find(({id:t})=>t===e.focusedJobId)??n.at(-1);return R(()=>{e.open&&!o&&Ei()},[e.open,o]),R(()=>{e.open&&o&&o.id!==e.focusedJobId&&Ti(o.id)},[e.focusedJobId,e.open,o]),R(()=>{e.open&&e.focusedJobId&&i(`selected`)},[e.focusedJobId,e.open]),P(Un,{className:`ke-workspace-modal ke-download-center`,closeLabel:`Close Download Manager`,description:`Manage clip downloads.`,footer:P(j,{children:[P(U,{disabled:!n.some(e=>[`cancelled`,`completed`,`failed`,`ready`].includes(e.status)),onClick:zi,children:`Clear inactive`}),P(U,{className:`ke-button--primary`,onClick:Ei,children:`Hide`})]}),icon:nn,onRequestClose:Ei,open:e.open,title:`Download Manager`,children:P(Kn,{ariaLabel:`Download Manager views`,className:`ke-download-center__tabs`,onChange:i,tabs:[{content:o?P(Wi,{job:o}):P(`div`,{className:`ke-download-center__placeholder`,children:`No clip selected.`}),contentClassName:`ke-download-center__selected-panel`,disabled:!o,id:`selected`,label:`Selected`,panelAriaLabel:`Selected clip download details`},{content:P(Ui,{focusedJobId:o?.id,jobs:a,onSelect:e=>{Ti(e),i(`selected`)}}),contentClassName:`ke-download-center__downloads-panel`,id:`downloads`,label:P(`span`,{className:`ke-download-center__tab-label`,children:[`Downloads`,t>0?P(St,{class:`ke-icon ke-download-center__activity-indicator ke-icon--spinner`}):null]}),panelAriaLabel:`Clip download queue and history`}],value:r})})}function Ui({focusedJobId:e,jobs:t,onSelect:n}){return P(zn,{ariaLabel:`Clip downloads`,ariaLive:`polite`,className:`ke-download-queue`,columns:Ri,emptyContent:null,getItemKey:e=>e.id,getRowAriaLabel:e=>`View ${e.title??e.clipId}, ${Xi(e)}`,getRowClassName:t=>t.id===e?`ke-download-queue__row--selected`:void 0,items:t,onItemActivate:e=>n(e.id)})}function Wi({job:e}){return e.status===`inspecting`?P(`section`,{"aria-live":`polite`,className:`ke-download-detail-loading`,role:`status`,children:[P(St,{class:`ke-icon ke-download-detail-loading__icon ke-icon--spinner`}),P(`p`,{children:`Loading clip…`})]}):P(`article`,{className:`ke-download-detail`,children:[P(`section`,{className:`ke-download-detail__summary${e.thumbnailUrl?``:` has-no-thumbnail`}`,children:[e.thumbnailUrl?P(`div`,{className:`ke-download-detail__thumbnail-frame`,children:P(`img`,{alt:``,className:`ke-download-detail__thumbnail`,referrerPolicy:`no-referrer`,src:e.thumbnailUrl})}):null,P(`div`,{className:`ke-download-detail__overview`,children:[P(`header`,{className:`ke-download-detail__header`,children:P(`div`,{className:`ke-download-detail__identity`,children:[e.category||e.publishedAt?P(`div`,{className:`ke-download-detail__context`,children:[e.category?P(`span`,{className:`ke-download-detail__category`,children:e.category}):null,e.publishedAt?P(`time`,{dateTime:new Date(e.publishedAt).toISOString(),children:Ii.format(e.publishedAt)}):null]}):null,P(`h3`,{className:`ke-download-detail__title`,children:e.channel?P(`a`,{className:`ke-download-detail__title-link`,href:`https://kick.com/${encodeURIComponent(e.channel)}/clips/${encodeURIComponent(e.clipId)}`,rel:`noreferrer`,target:`_blank`,children:e.title??`KICK clip`}):e.title??`KICK clip`}),P(`p`,{className:`ke-download-detail__metadata`,children:[e.channel?P(`a`,{className:`ke-download-detail__channel`,href:`https://kick.com/${encodeURIComponent(e.channel)}`,rel:`noreferrer`,target:`_blank`,children:e.channel}):`Unknown channel`,e.creator?P(j,{children:[P(`span`,{"aria-hidden":`true`,className:`ke-download-detail__separator`,children:`–`}),P(`span`,{children:[`Clipped by`,` `,P(`a`,{className:`ke-download-detail__creator`,href:`https://kick.com/${encodeURIComponent(e.creator)}`,rel:`noreferrer`,target:`_blank`,children:e.creator})]})]}):null]})]})}),e.media?P(Ji,{job:e}):null]})]}),e.status===`ready`?P(Gi,{job:e}):null,e.status===`queued`?P(Yi,{message:`Waiting in queue${e.queuePosition?` (position ${e.queuePosition})`:``}.`,children:P(U,{onClick:()=>Y.cancel(e.id),children:`Cancel`})}):null,e.status===`awaiting-destination`?P(Yi,{message:`This download is next. Choose its destination to start.`,children:[P(U,{className:`ke-button--primary`,onClick:()=>{Y.chooseDestination(e.id)},children:`Choose file and start`}),P(U,{onClick:()=>Y.cancel(e.id),children:`Cancel`})]}):null,e.status===`choosing-destination`?P(Yi,{icon:!0,message:`Waiting for a file destination…`}):null,e.status===`active`?P(Ki,{job:e}):null,e.status===`completed`?P(qi,{job:e,message:`Saved ${e.filename}`,primaryLabel:`Download again`}):null,e.status===`failed`?P(qi,{job:e,message:e.error?.message??`The clip download failed.`,primaryLabel:`Retry`}):null,e.status===`cancelled`?P(qi,{job:e,message:`The download was cancelled.`,primaryLabel:`Retry`}):null]})}function Gi({job:e}){let t=!!ei(),n=e.media?.sourceBytes!==void 0&&e.media.sourceBytes>=Fi;return P(`form`,{className:`ke-download-ready`,onSubmit:n=>{n.preventDefault(),Y.requestDownload(e.id,t?`file-system`:`memory`)},children:[P(Vn,{label:`Output filename`,maxLength:180,onValueChange:t=>Y.updateBasename(e.id,t),suffix:`.mp4`,value:e.basename}),e.error?P(`p`,{className:`ke-download-message is-error`,role:`alert`,children:e.error.message}):null,!t&&n?P(`p`,{className:`ke-download-message is-warning`,children:`This browser must keep the final MP4 in memory. The clip is unusually large, so close memory-heavy tabs before continuing.`}):null,t?P(`p`,{className:`ke-download-message`,children:`If you select an existing file, the browser may clear it before processing finishes.`}):null,P(`div`,{className:`ke-download-actions`,children:[P(U,{className:`ke-button--primary`,type:`submit`,children:`Download`}),t?P(U,{onClick:()=>Y.requestDownload(e.id,`memory`),children:`Use memory download`}):null,P(U,{onClick:()=>Bi(e.id),children:`Remove`})]})]})}function Ki({job:e}){let t=e.media?.sourceBytes,n=t&&t>0?Math.min(100,e.writtenBytes/t*100):void 0;return P(`section`,{className:`ke-download-active`,children:[P(`div`,{className:`ke-download-progress`,children:[P(`div`,{className:`ke-download-progress__heading`,children:[P(`span`,{children:e.phase===`fetching`?Qi(e,Date.now()):Zi(e.phase)}),P(`span`,{children:[ea(e.writtenBytes),t?` of ${ea(t)} - ${n?.toFixed(1)}%`:` - ${e.completedSegments}/${e.media?.logicalSegmentCount??`?`} segments`]})]}),P(`progress`,{"aria-label":`Download progress`,className:`ke-download-progress__bar`,max:t??void 0,value:t?e.writtenBytes:void 0})]}),P(`div`,{className:`ke-download-actions`,children:P(U,{tone:`danger`,onClick:()=>Y.cancel(e.id),children:`Cancel`})})]})}function qi({job:e,message:t,primaryLabel:n}){return P(Yi,{error:e.status===`failed`,message:t,children:[P(U,{className:`ke-button--primary`,onClick:()=>Y.retry(e.id),children:n}),P(U,{onClick:()=>Bi(e.id),children:`Remove`})]})}function Ji({job:e}){let t=e.media;return t?P(`dl`,{className:`ke-download-facts`,children:[P(`div`,{children:[P(`dt`,{children:`Duration`}),P(`dd`,{children:ta(t.duration)})]}),P(`div`,{children:[P(`dt`,{children:`Download size`}),P(`dd`,{children:[t.sourceBytes?ea(t.sourceBytes):`Unknown`,P(`span`,{className:`ke-download-facts__secondary`,children:[` `,`(`,t.logicalSegmentCount,` `,t.logicalSegmentCount===1?`segment`:`segments`,`)`]})]})]}),e.viewCount===void 0?null:P(`div`,{children:[P(`dt`,{children:`Views`}),P(`dd`,{children:Li.format(e.viewCount)})]}),e.likeCount===void 0?null:P(`div`,{children:[P(`dt`,{children:`Likes`}),P(`dd`,{children:Li.format(e.likeCount)})]})]}):null}function Yi({children:e,error:t=!1,icon:n=!1,message:r}){return P(`section`,{className:`ke-download-status`,children:[P(`p`,{className:`ke-download-message${t?` is-error`:``}`,role:t?`alert`:`status`,children:[n?P(St,{class:`ke-icon ke-icon--spinner`}):null,P(`span`,{children:r})]}),e?P(`div`,{className:`ke-download-actions`,children:e}):null]})}function Xi(e){return{active:Zi(e.phase),"awaiting-destination":`Choose file`,cancelled:`Cancelled`,"choosing-destination":`Choosing file`,completed:`Completed`,failed:`Failed`,inspecting:`Inspecting`,queued:e.queuePosition?`Queued ${e.queuePosition}`:`Queued`,ready:`Ready`}[e.status]}function Zi(e){return e?{fetching:`Downloading`,inspecting:`Inspecting`,transmuxing:`Converting to MP4`,writing:`Writing MP4`}[e]:`Working`}function Qi(e,t){let n=e.media?.logicalSegmentCount,r=n&&n>1?`Segment ${Math.min(n,e.completedSegments+1)}/${n}`:`Downloading`,i=Ai(e.fetchedBytes,e.media?.sourceBytes,e.startedAt,t);if(!i)return r;let a=i.remainingSeconds===void 0?``:` - ${$i(i.remainingSeconds)} remaining`;return`${r}: ${ea(i.bytesPerSecond)}/s${a}`}function $i(e){let t=Math.max(1,Math.ceil(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m`:r>0?`${r}m ${i}s`:`${i}s`}function ea(e){if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`],n=e/1024,r=t[0];for(let e=1;e=1024;e+=1)n/=1024,r=t[e];return`${n.toFixed(n>=100?0:1)} ${r}`}function ta(e){if(!e)return`Unknown`;let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}function na({isCardConnected:e,isMountConnected:t,mount:n,resolve:r,unmount:i,update:a}){let o=new WeakMap,s=new Set;function c(e){i(e.mount),o.delete(e.card),s.delete(e)}function l(e){let i=o.get(e),l=r(e);if(!l){i&&c(i);return}if(i&&i.container===l.container&&t(i.mount)){i.clipId!==l.clipId&&(i.clipId=l.clipId,a(i.mount,l));return}i&&c(i);let u={card:e,clipId:l.clipId,container:l.container,mount:n(l)};o.set(e,u),s.add(u)}return{reconcile:l,removeDisconnected(){for(let n of s)(!e(n.card)||!t(n.mount))&&c(n)},teardown(){for(let e of[...s])c(e)}}}var ra=`.ke-clip-download-host,.ke-download-center-host{display:contents}.ke-direct-clip-download-host{flex:none;display:flex;position:relative}.ke-direct-clip-download-action{box-sizing:border-box;width:auto;height:2.5rem;color:var(--neon-secondary-onSecondary,#fff);cursor:pointer;background:#212931;border:0;border-radius:.25rem;outline:0;flex:none;justify-content:center;align-items:center;gap:.15rem;padding:0 .5rem;transition:none;display:flex}.ke-direct-clip-download-action:hover{background:#2d3442}.ke-direct-clip-download-action:focus-visible{outline-offset:2px;outline:2px solid #fff}.ke-direct-clip-download-action:active{transform:scale(.95)}.ke-direct-clip-download-action__brand{object-fit:contain;pointer-events:none;flex:none;width:1.05rem;height:1.05rem;display:block}.ke-direct-clip-download-action__icon{pointer-events:none;flex:none;width:1rem;height:1rem;display:block}.ke-direct-clip-download-tooltip{z-index:1000;visibility:hidden;color:#fff;opacity:0;pointer-events:none;background:#232629;border-radius:.25rem;width:max-content;max-width:16rem;padding:.35rem .5rem;font-size:.75rem;font-weight:600;line-height:1.25;position:absolute;bottom:calc(100% + .5rem);left:50%;transform:translate(-50%)}.ke-direct-clip-download-tooltip:after{content:"";border:.3rem solid #0000;border-top-color:#232629;position:absolute;top:100%;left:50%;transform:translate(-50%)}.ke-direct-clip-download-host:hover .ke-direct-clip-download-tooltip,.ke-direct-clip-download-host:focus-within .ke-direct-clip-download-tooltip{visibility:visible;opacity:1}.ke-clip-download-action{z-index:203;box-sizing:border-box;color:#fff;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);cursor:pointer;background:#000000d1;border:0;border-radius:4px;outline:0;justify-content:center;align-items:center;width:1.75rem;height:1.75rem;padding:0;transition:none;display:flex;position:absolute;top:4px;right:4px}.ke-clip-download-action:hover{box-shadow:none;color:#53fc18;background:#000000d1;border:0;transform:none}.ke-clip-download-action:hover>.ke-clip-download-action__icon{transform:none}.ke-clip-download-action:focus-visible{outline-offset:2px;outline:2px solid #fff}.ke-clip-download-action:active{transform:scale(.94)}.ke-clip-download-action__icon{pointer-events:none;width:1.125rem;height:1.125rem;transition:none;display:block}`,ia=`.ke-modal.ke-download-center{--ke-workspace-modal-height:36rem;--ke-workspace-modal-width:68rem}.ke-download-center__tabs{min-width:0;min-height:0}.ke-download-center__tab-label{align-items:center;gap:.5rem;display:inline-flex}.ke-download-center__activity-indicator{color:#53fc18}.ke-tabs__panel-content.ke-download-center__selected-panel{width:100%;height:100%;min-height:100%;padding:0}.ke-tabs__panel-content.ke-download-center__downloads-panel{min-height:100%;padding:0;position:relative}.ke-download-center__placeholder{color:#8c8c8c;text-align:center;margin:0;padding:1rem;font-size:.8rem}.ke-list-view.ke-download-queue{background-color:#080808;border:0;border-radius:0;position:absolute;inset:0}.ke-download-queue__clip{align-items:center;gap:.65rem;min-width:0;display:flex}.ke-download-queue__thumbnail{aspect-ratio:16/9;object-fit:cover;background:#0a0a0a;border-radius:.25rem;flex:none;width:3.5rem}.ke-download-queue__title{text-overflow:ellipsis;white-space:nowrap;color:#f2f2f2;font-weight:700;overflow:hidden}.ke-download-queue .ke-list-view__row{min-height:0}.ke-download-queue__row--selected{box-shadow:inset .2rem 0 #53fc18}.ke-download-queue__status{color:#8c8c8c;text-overflow:ellipsis;white-space:nowrap;border:1px solid #303030;border-radius:.3rem;align-items:center;max-width:100%;padding:.15rem .45rem;font-size:.68rem;font-weight:700;line-height:1.35;display:inline-flex;overflow:hidden}.ke-download-queue__status[data-status=active],.ke-download-queue__status[data-status=ready]{color:#53fc18;border-color:#53fc1866}.ke-download-queue__status[data-status=awaiting-destination],.ke-download-queue__status[data-status=choosing-destination],.ke-download-queue__status[data-status=inspecting],.ke-download-queue__status[data-status=queued]{color:#f2b84b;border-color:#f2b84b66}.ke-download-queue__status[data-status=completed]{color:#65a9ff;border-color:#65a9ff66}.ke-download-queue__status[data-status=failed]{color:#ff6b6b;border-color:#ff6b6b73}.ke-download-detail{flex-direction:column;gap:1.5rem;min-height:100%;padding:1.5rem;display:flex}.ke-download-detail-loading{color:#8c8c8c;flex-direction:column;justify-content:center;align-items:center;gap:.65rem;width:100%;height:100%;display:flex}.ke-download-detail-loading p{margin:0;font-size:.8rem}.ke-download-detail-loading__icon{color:#f2f2f2;width:1.35rem;height:1.35rem}.ke-download-detail__summary{grid-template-columns:minmax(18rem,24rem) minmax(0,1fr);align-items:start;gap:1.5rem;min-width:0;display:grid}.ke-download-detail__summary.has-no-thumbnail{grid-template-columns:minmax(0,1fr)}.ke-download-detail__overview{min-width:0;padding-top:0}.ke-download-detail__header{align-items:center;gap:.9rem;min-width:0;display:flex}.ke-download-detail__thumbnail-frame{aspect-ratio:16/9;background:#0a0a0a;border-radius:.25rem;min-width:0;min-height:0;position:relative;overflow:hidden}.ke-download-detail__thumbnail{object-fit:cover;width:100%;height:100%;position:absolute;inset:0}.ke-download-detail__identity{min-width:0;overflow:hidden}.ke-download-detail__context{color:#747474;flex-wrap:wrap;align-items:center;gap:.55rem;min-width:0;margin-bottom:.65rem;font-size:.72rem;font-weight:500;display:flex}.ke-download-detail__category{color:#53fc18;text-overflow:ellipsis;white-space:nowrap;border:1px solid #53fc1866;border-radius:.3rem;max-width:100%;padding:.12rem .45rem;font-size:.68rem;font-weight:750;line-height:1.35;overflow:hidden}.ke-download-detail__title{color:#f2f2f2;text-overflow:ellipsis;white-space:nowrap;width:100%;margin:0;font-size:1.1rem;font-weight:700;line-height:1.25;overflow:hidden}.ke-download-detail__title-link{color:inherit;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;display:block;overflow:hidden}.ke-download-detail__title-link:hover{text-decoration:underline}.ke-download-detail__metadata{color:#8c8c8c;flex-wrap:wrap;align-items:baseline;gap:.4rem;margin:.45rem 0 0;font-size:.8rem;font-weight:500;display:flex}.ke-download-detail__channel,.ke-download-detail__creator{text-decoration:none}.ke-download-detail__channel:hover,.ke-download-detail__creator:hover{text-decoration:underline}.ke-download-detail__channel{color:#53fc18}.ke-download-detail__separator{color:#747474}.ke-download-detail__creator{color:#f2f2f2;font-weight:650}.ke-download-facts{border-top:1px solid #1b1b1b;border-bottom:1px solid #1b1b1b;grid-template-columns:repeat(2,minmax(0,1fr));margin:1rem 0 0;display:grid}.ke-download-facts div{align-content:start;gap:.2rem;min-width:0;padding:.65rem 0;display:grid}.ke-download-facts div:nth-child(2n){border-left:1px solid #1b1b1b;padding-left:1rem}.ke-download-facts div:nth-child(n+3){border-top:1px solid #1b1b1b}.ke-download-facts dt{color:#747474;letter-spacing:.035em;text-transform:uppercase;font-size:.68rem;font-weight:700}.ke-download-facts dd{color:#f2f2f2;font-variant-numeric:tabular-nums;margin:0;font-size:.86rem;font-weight:700}.ke-download-facts__secondary{color:#8c8c8c;font-size:inherit;white-space:nowrap;font-weight:600}.ke-download-ready,.ke-download-active,.ke-download-status{border-top:1px solid #1b1b1b;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:1rem;width:100%;min-height:3.85rem;margin-top:auto;padding-top:1.5rem;display:grid}.ke-download-ready{align-items:end}.ke-download-ready>.ke-form-field .ke-form-field__label{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.ke-download-ready>.ke-download-message{grid-column:1/-1}.ke-download-ready>.ke-download-actions{grid-area:1/2}.ke-download-active>.ke-download-actions{border-left:1px solid #1b1b1b;align-self:stretch;align-items:center;padding-left:1rem}.ke-download-actions{flex-wrap:wrap;gap:.65rem;display:flex}.ke-download-message{color:#8c8c8c;align-items:center;gap:.55rem;margin:0;font-size:.8rem;line-height:1.5;display:flex}.ke-download-message.is-error{color:#ff6b6b}.ke-download-message.is-warning{color:#f5c451;background:#19150d;border:1px solid #6c5528;border-radius:.45rem;padding:.65rem .75rem}.ke-icon--spinner{flex:none;width:1rem;height:1rem;animation:.8s linear infinite ke-icon-spin}.ke-download-progress__heading{color:#f2f2f2;font-variant-numeric:tabular-nums;justify-content:space-between;gap:1rem;font-size:.78rem;display:flex}.ke-download-progress{gap:.55rem;min-width:0;display:grid}.ke-download-progress__bar{appearance:none;background:#1b1b1b;border:0;border-radius:999px;width:100%;height:.55rem;overflow:hidden}.ke-download-progress__bar::-webkit-progress-bar{background:#1b1b1b}.ke-download-progress__bar::-webkit-progress-value{background:#53fc18}.ke-download-progress__bar::-moz-progress-bar{background:#53fc18}@keyframes ke-icon-spin{to{transform:rotate(1turn)}}@media (width<=44rem){.ke-download-detail__summary{grid-template-columns:minmax(0,1fr)}.ke-download-detail__overview{padding-top:0}.ke-download-detail__thumbnail-frame{display:none}}@media (width<=34rem){.ke-download-queue .ke-list-view__header,.ke-download-queue .ke-list-view__row{grid-template-columns:minmax(12rem,1fr) 9rem!important}.ke-download-queue :is(.ke-list-view__header-cell,.ke-list-view__cell)[data-column-id=channel],.ke-download-queue :is(.ke-list-view__header-cell,.ke-list-view__cell)[data-column-id=duration],.ke-download-queue :is(.ke-list-view__header-cell,.ke-list-view__cell)[data-column-id=size]{display:none}.ke-download-detail{gap:1rem;padding:1rem}.ke-download-detail__thumbnail-frame{width:100%}.ke-download-ready,.ke-download-active,.ke-download-status{grid-template-columns:1fr;min-height:0}.ke-download-ready>.ke-download-actions,.ke-download-active>.ke-download-actions,.ke-download-status>.ke-download-actions{grid-area:auto/1}.ke-download-active>.ke-download-actions{border-top:1px solid #1b1b1b;border-left:0;padding-top:1rem;padding-left:0}}@media (prefers-reduced-motion:reduce){.ke-icon--spinner{animation:none}}`,aa=`kick-enhancer-clip-download-styles`,oa=`kick-enhancer-download-center`,sa=`[data-ke-clip-download]`,ca=`[data-ke-clip-download-host]`,la=`[data-testid="follow-button"]`,ua=`[data-ke-direct-clip-download-host]`,da=x(`clip-downloads`),fa;function pa(e){da.info(`Manager opened`,{clipId:e}),Ci(e)}function ma(){if(vt(),document.getElementById(aa))return;let e=document.createElement(`style`);e.id=aa,e.textContent=`${ra}\n${ia}`,document.documentElement.append(e)}function ha(){if(document.getElementById(oa)||!document.body)return;let e=document.createElement(`span`);e.id=oa,e.className=`ke-download-center-host`,document.body.append(e),N(P(Hi,{}),e)}function ga(e=pa){fa?.();let t,n=_e().ui.showClipDownloadButtons,r,i,a,o=!1,s=na({isCardConnected:e=>e.isConnected,isMountConnected:e=>e.isConnected,mount:({card:t,clipId:n,container:r})=>{for(let e of t.querySelectorAll(sa))e.remove();for(let e of t.querySelectorAll(ca))e.remove();let i=document.createElement(`span`);return i.className=`ke-clip-download-host`,i.setAttribute(`data-ke-clip-download-host`,``),r.append(i),N(P(Pt,{clipId:n,onSelectClip:e}),i),i},resolve:e=>{let t=jt(e,window.location.origin),n=e.querySelector(wt)?.parentElement;return t&&n?{card:e,clipId:t,container:n}:void 0},unmount:e=>{N(null,e),e.remove()},update:(t,{clipId:n})=>{N(P(Pt,{clipId:n,onSelectClip:e}),t)}}),c=Nt(e=>{if(!(o||!n)){s.removeDisconnected();for(let t of e)t?.isConnected&&s.reconcile(t)}});function l(){i&&=(N(null,i),i.remove(),r=void 0,void 0)}function u(){i&&!i.isConnected&&(N(null,i),r=void 0,i=void 0);let t=n?kt(window.location.href,window.location.origin):void 0,a=t?document.querySelector(la):void 0,o=a?.parentElement;if(!t||!a||!o){l();return}if(i&&i.parentElement===o){r!==t&&(N(P(rn,{clipId:t,onSelectClip:e}),i),r=t);return}l();for(let e of document.querySelectorAll(ua))e.remove();let s=document.createElement(`span`);s.className=`ke-direct-clip-download-host`,s.setAttribute(`data-ke-direct-clip-download-host`,``),a.after(s),N(P(rn,{clipId:t,onSelectClip:e}),s),r=t,i=s}function d(e){let t=e.closest(Ct);t&&c.enqueue(t)}function f(e){if(e instanceof Element){d(e);for(let t of e.querySelectorAll(Ct))c.enqueue(t)}}function p(e){ha(),u();let t=!1;for(let n of e){if(n.type===`attributes`){d(n.target);continue}n.removedNodes.length>0&&(t=!0),d(n.target);for(let e of n.addedNodes)f(e)}t&&c.enqueue(void 0)}function m(){if(!o){if(ma(),ha(),u(),n)for(let e of document.querySelectorAll(Ct))c.enqueue(e);t=new MutationObserver(p),t.observe(document.documentElement,{attributeFilter:[`href`],attributes:!0,childList:!0,subtree:!0})}}let h=ht(m);a=xe(e=>e.ui.showClipDownloadButtons,e=>{if(n!==e){if(n=e,!e){s.teardown(),l();return}u();for(let e of document.querySelectorAll(Ct))c.enqueue(e)}});let g=()=>{if(o)return;o=!0,h(),t?.disconnect(),a?.(),c.cancel(),s.teardown(),l();let e=document.getElementById(oa);e&&(N(null,e),e.remove()),document.getElementById(aa)?.remove(),fa===g&&(fa=void 0)};return fa=g,g}var _a=`[data-testid=following] [data-testid=followed-livestreams]+section{display:none!important}`;function va(e,t,n){let r=document.getElementById(e);if(!n){r?.remove();return}if(r)return;let i=document.createElement(`style`);i.id=e,i.textContent=t,document.documentElement.append(i)}function ya({id:e,selectEnabled:t,styles:n}){let r;return function(){r?.();let i=!1,a=xe(t,t=>va(e,n,t)),o=()=>{i||(i=!0,a(),va(e,n,!1),r===o&&(r=void 0))};return r=o,o}}var ba=ya({id:`kick-enhancer-hide-following-recommendations`,selectEnabled:e=>e.ui.hideFollowingRecommendations,styles:_a}),xa=`#sidebar-wrapper [data-kick-enhancer-gambling-stream]{display:none!important}[data-testid=followed-livestreams] [data-testid=livestream-results-card]:has(a[href="/category/slots"]){display:none!important}`,Sa=`kick-enhancer-hide-gambling-streams`,Ca=`data-kick-enhancer-gambling-stream`,wa=`a[data-testid^="sidebar-following-channel-"]`,Ta=[`[data-testid="followed-livestreams"]`,`#sidebar-wrapper`].join(`, `),Ea=!1,Da=!1,Oa,ka;function Aa(e){va(Sa,xa,e)}function ja(){let e=new Set;for(let t of document.querySelectorAll(`[data-testid="followed-livestreams"] [data-testid="livestream-results-card"]:has(a[href="/category/slots"])`)){let n=t.querySelector(`a[data-testid="media-card-thumbnail"]`)?.getAttribute(`href`);n&&e.add(n)}return e}function Ma(e,t){let n=e.getAttribute(`href`);return n&&t.has(n)?!0:[...e.querySelectorAll(`span`)].some(e=>e.textContent?.trim()===`Slots & Casino`)}function Na(){if(Oa=void 0,!Ea){for(let e of document.querySelectorAll(`[${Ca}]`))e.removeAttribute(Ca);return}let e=ja();for(let t of document.querySelectorAll(wa))(t.closest(`button`)??t).toggleAttribute(Ca,Ma(t,e))}function Pa(){!Da||Oa!==void 0||(Oa=window.requestAnimationFrame(Na))}function Fa(e){return e.some(e=>(e.target instanceof Element?e.target:e.target.parentElement)?.closest(Ta)?!0:[...e.addedNodes,...e.removedNodes].some(e=>e instanceof Element&&(e.matches(Ta)||!!e.querySelector(Ta))))}function Ia(){ka?.(),Da=!0;let e=new MutationObserver(e=>{Ea&&Fa(e)&&Pa()});e.observe(document.documentElement,{characterData:!0,childList:!0,subtree:!0});let t=xe(e=>e.ui.hideGamblingStreams,e=>{Ea=e,Aa(Ea),Pa()}),n=!1,r=()=>{n||(n=!0,Da=!1,e.disconnect(),t(),Oa!==void 0&&(window.cancelAnimationFrame(Oa),Oa=void 0),Ea=!1,Aa(!1),Na(),ka===r&&(ka=void 0))};return ka=r,r}var La=ya({id:`kick-enhancer-hide-homepage-carousel`,selectEnabled:e=>e.ui.hideHomepageCarousel,styles:`:is(#main-container main div:has(>[data-testid=carousel]),#main-container main div:has(>div>[aria-hidden=true].invisible.aspect-video)){display:none!important}`}),Ra=ya({id:`kick-enhancer-hide-recommended-channels`,selectEnabled:e=>e.ui.hideRecommendedChannels,styles:`#sidebar-wrapper section:has([data-testid^=sidebar-recommended-channel-]){display:none!important}#sidebar-wrapper section:has([data-testid^=sidebar-recommended-channel-])+div:has([data-testid*=recommended]){display:none!important}`}),za=[`button[aria-controls="sidebar-wrapper"]`,`button[aria-label="Collapse sidebar"]`,`button[aria-label="Expand sidebar"]`,`button[data-testid="sidebar-collapse"]`,`button[data-testid="sidebar-expand"]`].join(`, `),Ba=x(`sidebar`),Va=null,Ha=!1,X=!1,Ua=!1,Wa,Ga;function Ka(){return document.querySelector(za)}function qa(){return document.querySelector(`[data-sidebar][data-chat][data-theatre]`)??document.querySelector(`[data-sidebar]`)}function Ja(){let e=qa()?.getAttribute(`data-sidebar`);if(e===`true`)return!1;if(e===`false`)return!0;let t=Ka()?.getAttribute(`aria-expanded`);if(t===`true`)return!1;if(t===`false`)return!0}function Ya(){if(!Ha||!Ua||!X)return;let e=Ja();if(e===void 0)return;let t=_e().ui.sidebarCollapsed;if(e===t){Ua=!1;return}let n=Ka();n&&(Ua=!1,Wa=t,Ba.info(`Restoring state`,{collapsed:t}),n.click())}function Xa(){Ha&&(Ua=!0,Wa=void 0,queueMicrotask(Ya))}function Za(e){_e().ui.sidebarCollapsed!==e&&(Ba.info(`State saved`,{collapsed:e}),Se(t=>({...t,ui:{...t.ui,sidebarCollapsed:e}})))}function Qa(e){let t=e?Ja():void 0;return Ba.info(e?`Memory enabled`:`Memory disabled`),Se(n=>({...n,ui:{...n.ui,rememberSidebarState:e,sidebarCollapsed:t??n.ui.sidebarCollapsed}}))}function $a(){Ga?.(),Ha=!0,X=_e().ui.rememberSidebarState,Va=qa();let e=new MutationObserver(e=>{let t=qa();if(t!==Va&&(Va=t,X&&Xa()),e.some(e=>e.type===`attributes`&&e.attributeName===`data-sidebar`&&e.target===t)){let e=Ja();if(e===void 0)return;if(Wa!==void 0){e===Wa&&(Wa=void 0);return}if(Ua){Ya();return}X&&Za(e)}Ua&&e.some(e=>e.type===`childList`)&&Ya()});e.observe(document.documentElement,{attributeFilter:[`data-sidebar`],attributes:!0,childList:!0,subtree:!0});let t=be(e=>{e.ui.rememberSidebarState!==X&&(X=e.ui.rememberSidebarState,X?Xa():(Ua=!1,Wa=void 0))});X&&Xa();let n=!1,r=()=>{n||(n=!0,Ha=!1,e.disconnect(),t(),Va=null,X=!1,Ua=!1,Wa=void 0,Ga===r&&(Ga=void 0))};return Ga=r,r}var eo=new Set([`about`,`browse`,`category`,`dashboard`,`following`,`privacy`,`search`,`settings`,`subscriptions`,`terms`]),to=/^[a-z0-9][a-z0-9_-]*$/i;function no(e){if(typeof e!=`string`)return;let t=ao(e).trim().toLowerCase();if(!(!t||eo.has(t)||!to.test(t)))return t}function ro(e){if(e)try{let t=new URL(e,window.location.href);return t.hostname!==`kick.com`&&t.hostname!==`www.kick.com`?void 0:io(t.pathname)}catch{return}}function io(e){let t=e.split(`/`).filter(Boolean);if(t.length===1)return no(t[0])}function ao(e){try{return decodeURIComponent(e)}catch{return e}}var oo=300*1e3,so=/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)?$/;function co(e){if(typeof e!=`string`)return;let t=e.trim();if(!t)return;let n=so.test(t)?`${t.replace(` `,`T`)}Z`:t,r=Date.parse(n);return Number.isFinite(r)&&r>=0?r:void 0}function lo(e,t=Date.now()){if(!Number.isFinite(e)||!Number.isFinite(t)||e>t+oo)return;let n=Math.floor(Math.max(0,t-e)/(60*1e3));if(n<1)return`<1m`;if(n<60)return`${n}m`;let r=Math.floor(n/60),i=n%60;if(r<24)return i>0?`${r}h ${i}m`:`${r}h`;let a=Math.floor(r/24),o=r%24;return o>0?`${a}d ${o}h`:`${a}d`}var uo={CHANNEL_DETAILS:`channel-details`,FEATURED_LIVESTREAMS:`featured`,FOLLOWED_CHANNELS:`followed-channels`,PAGINATED_RECOMMENDED_LIVESTREAMS:`recommendations`,RECOMMENDED_LIVESTREAMS:`recommendations`,SIDEBAR_LIVESTREAMS:`sidebar-recommendations`,USER_LIVESTREAMS:`user-livestreams`};function fo(e,t,n){if(e===`CURRENT_VIEWERS`)return{currentViewers:yo(t,n),kind:`current-viewers`};let r=uo[e],i=[];return i=e===`SIDEBAR_LIVESTREAMS`||e===`FEATURED_LIVESTREAMS`||e===`PAGINATED_RECOMMENDED_LIVESTREAMS`?xo(t,`data`,`livestreams`):e===`RECOMMENDED_LIVESTREAMS`?xo(t,`data`):e===`FOLLOWED_CHANNELS`?xo(t,`channels`):e===`USER_LIVESTREAMS`?Array.isArray(t)?t:[]:[t],{kind:`streams`,streams:i.map(t=>po(e,r,t,n)).filter(e=>e!==void 0)}}function po(e,t,n,r){if(wo(n))return e===`CHANNEL_DETAILS`?mo(n,t,r):e===`FOLLOWED_CHANNELS`?ho(n,t,r):e===`USER_LIVESTREAMS`?go(n,t,r):_o(n,t,r)}function mo(e,t,n){if(!wo(e.livestream))return;let r=e.livestream,i=wo(r.channel)?r.channel:void 0,a=no(e.slug)??no(i?.slug),o=So(r.viewer_count)??So(r.viewers),s=vo(r);if(!(!a||o===void 0))return bo({capturedAt:n,channelId:Z(e.id)??Z(r.channel_id),channelSlug:a,isLive:Co(r.is_live??e.is_live,!0),livestreamId:Z(r.id),showViewCount:Co(r.show_view_count??e.show_view_count,!0),source:t,...s===void 0?{}:{startedAt:s},viewerCount:o})}function ho(e,t,n){let r=no(e.channel_slug),i=So(e.viewer_count),a=Co(e.is_live,!1),o=vo(e);if(!(!r||i===void 0||!a))return bo({capturedAt:n,channelSlug:r,isLive:a,showViewCount:Co(e.show_view_count,!0),source:t,...o===void 0?{}:{startedAt:o},viewerCount:i})}function go(e,t,n){let r=wo(e.channel)?e.channel:void 0,i=no(r?.slug),a=So(e.viewer_count)??So(e.viewers),o=Co(e.is_live,!1),s=vo(e);if(!(!i||a===void 0||!o))return bo({capturedAt:n,channelId:Z(r?.id)??Z(e.channel_id),channelSlug:i,isLive:o,livestreamId:Z(e.id),showViewCount:Co(e.show_view_count,!0),source:t,...s===void 0?{}:{startedAt:s},viewerCount:a})}function _o(e,t,n){let r=wo(e.channel)?e.channel:void 0,i=no(r?.slug),a=So(e.viewer_count),o=vo(e);if(!(!i||a===void 0))return bo({capturedAt:n,channelId:Z(r?.id),channelSlug:i,isLive:!0,livestreamId:Z(e.id),showViewCount:Co(e.show_view_count,!0),source:t,...o===void 0?{}:{startedAt:o},viewerCount:a})}function vo(e){return co(e.start_time)??co(e.started_at)??co(e.created_at)}function yo(e,t){return Array.isArray(e)?e.map(e=>{if(!wo(e))return;let n=Z(e.livestream_id),r=So(e.viewers);if(n===void 0||r===void 0)return;let i=typeof e.show_view_count==`boolean`?e.show_view_count:void 0;return{capturedAt:t,livestreamId:n,...i===void 0?{}:{showViewCount:i},viewerCount:r}}).filter(e=>e!==void 0):[]}function bo(e){return e}function xo(e,...t){let n=e;for(let e of t){if(!wo(n))return[];n=n[e]}return Array.isArray(n)?n:[]}function So(e){if(!(typeof e!=`number`||!Number.isFinite(e)||e<0))return Math.floor(e)}function Z(e){let t=typeof e==`string`&&/^(0|[1-9]\d*)$/.test(e)?Number(e):e;if(!(typeof t!=`number`||!Number.isSafeInteger(t)||t<0))return t}function Co(e,t){return typeof e==`boolean`?e:e===0||e===`0`||e===`false`?!1:e===1||e===`1`||e===`true`||t}function wo(e){return typeof e==`object`&&!!e}async function To(e,t){let n=performance.now();try{let r=await fetch(e,{credentials:`include`,headers:{Accept:`application/json`,"x-app-platform":`web`},signal:t}),i=performance.now()-n;if(!r.ok)return{durationMs:i,httpStatus:r.status,kind:`failed`,summary:`KICK returned HTTP ${r.status}.`};try{let e=await r.json();return{durationMs:i,httpStatus:r.status,kind:`passed`,payload:e}}catch(e){if(t.aborted||Eo(e))throw e;return{durationMs:i,httpStatus:r.status,kind:`failed`,summary:`KICK returned a response that was not valid JSON.`}}}catch(e){if(t.aborted||Eo(e))throw e;return{durationMs:performance.now()-n,kind:`failed`,summary:`Network request failed before KICK responded.`}}}function Eo(e){return e instanceof DOMException&&e.name===`AbortError`}var Do=[`CHANNEL_DETAILS`,`CURRENT_VIEWERS`,`FOLLOWED_CHANNELS`,`USER_LIVESTREAMS`,`SIDEBAR_LIVESTREAMS`,`RECOMMENDED_LIVESTREAMS`,`PAGINATED_RECOMMENDED_LIVESTREAMS`,`FEATURED_LIVESTREAMS`],Oo={CHANNEL_DETAILS:`Channel details`,CURRENT_VIEWERS:`Current viewers`,FEATURED_LIVESTREAMS:`Featured streams`,FOLLOWED_CHANNELS:`Followed channels`,PAGINATED_RECOMMENDED_LIVESTREAMS:`Discovery list`,RECOMMENDED_LIVESTREAMS:`Recommended streams`,SIDEBAR_LIVESTREAMS:`Sidebar streams`,USER_LIVESTREAMS:`User livestreams`},ko=200,Ao=x(`diagnostics`),jo=new Map,Mo=new Set,No;function Po(e,t,n,r){let i=t.kind===`streams`?t.streams:[],a=t.kind===`streams`?i.length:t.currentViewers.length,o={endpoint:e,hiddenViewerCounts:t.kind===`streams`?i.filter(e=>!e.showViewCount).length:t.currentViewers.filter(e=>e.showViewCount===!1).length,observedAt:n,records:a,source:r,startTimes:i.filter(e=>e.startedAt!==void 0).length};return jo.set(e,o),Lo(),o}function Fo(){return Do.flatMap(e=>{let t=jo.get(e);return t?[t]:[]})}function Io(e){return Mo.add(e),()=>{Mo.delete(e),Mo.size===0&&No!==void 0&&(globalThis.clearTimeout(No),No=void 0)}}function Lo(){Mo.size===0||No!==void 0||(No=globalThis.setTimeout(()=>{No=void 0,zo()},ko))}async function Ro(e,t){let n=no(e);if(!n)return[{endpoint:`CHANNEL_DETAILS`,status:`failed`,summary:`Enter a valid KICK channel name.`},Bo(`Channel check did not run.`)];Ao.info(`Checks started`,{slug:n});let r=await To(new URL(`/api/v2/channels/${encodeURIComponent(n)}`,window.location.origin),t);if(r.kind===`failed`){let e=[{durationMs:r.durationMs,endpoint:`CHANNEL_DETAILS`,...r.httpStatus===void 0?{}:{httpStatus:r.httpStatus},status:`failed`,summary:r.summary},Bo(`No livestream ID was available for this check.`)];return Ao.warn(`Checks failed`,{endpoint:`CHANNEL_DETAILS`,slug:n}),e}let i=Date.now(),a=fo(`CHANNEL_DETAILS`,r.payload,i),o=a.kind===`streams`?a.streams.find(e=>e.channelSlug===n&&e.isLive):void 0;if(!o){let e=Vo(r.payload),t=[{durationMs:r.durationMs,endpoint:`CHANNEL_DETAILS`,httpStatus:r.httpStatus,status:e?`unavailable`:`degraded`,summary:e?`Channel resolved, but it is not live.`:`Response was reachable but no usable live stream was found.`},Bo(e?`The channel is offline.`:`The channel response did not expose a livestream ID.`)];return Ao.info(`Checks complete`,{status:t[0].status,slug:n}),t}let s={durationMs:r.durationMs,endpoint:`CHANNEL_DETAILS`,httpStatus:r.httpStatus,status:o.livestreamId===void 0?`degraded`:`passed`,summary:[`viewers=${o.viewerCount.toLocaleString()}`,`count=${o.showViewCount?`public`:`hidden`}`,`started=${o.startedAt===void 0?`no`:`yes`}`,`livestream=${o.livestreamId??`missing`}`].join(`; `)};if(o.livestreamId===void 0)return[s,Bo(`The live response did not include a livestream ID.`)];let c=new URL(`/current-viewers`,window.location.origin);c.searchParams.append(`ids[]`,String(o.livestreamId));let l=await To(c,t);if(l.kind===`failed`){let e={durationMs:l.durationMs,endpoint:`CURRENT_VIEWERS`,...l.httpStatus===void 0?{}:{httpStatus:l.httpStatus},status:`failed`,summary:l.summary};return Ao.warn(`Checks failed`,{endpoint:`CURRENT_VIEWERS`,slug:n}),[s,e]}let u=fo(`CURRENT_VIEWERS`,l.payload,Date.now()),d=u.kind===`current-viewers`?u.currentViewers.find(({livestreamId:e})=>e===o.livestreamId):void 0,f={durationMs:l.durationMs,endpoint:`CURRENT_VIEWERS`,httpStatus:l.httpStatus,status:d?`passed`:`degraded`,summary:d?`viewers=${d.viewerCount.toLocaleString()}`:`No matching viewer record.`};return Ao.info(`Checks complete`,{status:f.status,slug:n}),[s,f]}function zo(){let e=Fo();for(let t of Mo)try{t(e)}catch(e){console.error(`[KICK Enhancer] Endpoint observation listener failed.`,e)}}function Bo(e){return{endpoint:`CURRENT_VIEWERS`,status:`unavailable`,summary:e}}function Vo(e){return typeof e==`object`&&!!e&&`livestream`in e&&e.livestream===null}var Ho=5,Uo=10,Wo=30*1e3,Go=120*1e3,Ko=60*1e3,qo=x(`viewer-counts:network`),Jo=class{options;#e=new Map;#t=new Set;#n=new Set;#r=new Set;#i=new Map;#a=new Set;#o=new AbortController;#s;#c=0;#l;#u=!1;#d=0;#f=0;#p;#m=!1;#h;constructor(e){this.options=e}start(){this.#u||(this.#u=!0,document.addEventListener(`visibilitychange`,this.#T),this.#l=window.setInterval(()=>{this.#x()},Wo),this.#p=window.setInterval(()=>{this.#S()},Go))}stop(){this.#u&&(this.#u=!1,this.#d+=1,this.#o.abort(),this.#o=new AbortController,this.#s=void 0,this.#r.clear(),this.#t.clear(),this.#n.clear(),this.#a.clear(),this.#e.clear(),this.#i.clear(),document.removeEventListener(`visibilitychange`,this.#T),this.#l!==void 0&&(window.clearInterval(this.#l),this.#l=void 0),this.#p!==void 0&&(window.clearInterval(this.#p),this.#p=void 0),this.#h!==void 0&&(window.clearTimeout(this.#h),this.#h=void 0))}beginRoute(){this.#u&&(this.#d+=1,this.#o.abort(),this.#o=new AbortController,this.#s=void 0,this.#r.clear(),this.#t.clear(),this.#n.clear(),this.#a.clear(),this.#e.clear())}syncTargets(e,t){if(!this.#u)return;this.#a.clear();for(let t of e)this.#a.add(t);this.#s=t;let n=Date.now();for(let e of this.#r)this.#a.has(e)||this.#r.delete(e);for(let e of this.#t)this.#a.has(e)||this.#t.delete(e);for(let[e,t]of this.#i)t<=n&&!this.#a.has(e)&&!this.#e.has(e)&&this.#i.delete(e);for(let n of e)Yo(this.options.store.get(n),n===t)?this.#g(n):this.#r.delete(n);this.#_()}#g(e){let t=Date.now();if(this.#r.has(e)||this.#e.has(e))return;let n=this.#i.get(e);if(n!==void 0&&n>t){this.#b(n-t);return}this.#r.add(e)}#_(){for(;this.#u&&this.#c0;){let e=this.#r.values().next().value;if(!e)return;this.#r.delete(e);let t=this.options.store.get(e);if(!this.#a.has(e)||!Yo(t,e===this.#s))continue;let n=this.#d;this.#c+=1,this.#e.set(e,n),this.#v(e,n).finally(()=>{--this.#c,this.#e.get(e)===n&&this.#e.delete(e),this.#_()})}}async#v(e,t){let n=new URL(`/api/v2/channels/${encodeURIComponent(e)}`,window.location.origin);try{let r=await To(n,this.#o.signal);if(r.kind===`failed`)throw Error(r.summary);if(!this.#u||t!==this.#d)return;let i=Date.now(),a=fo(`CHANNEL_DETAILS`,r.payload,i);if(Po(`CHANNEL_DETAILS`,a,i,`fallback`),a.kind!==`streams`||a.streams.length===0||!a.streams.some(e=>e.isLive)){this.options.store.remove(e),this.#y(e),this.options.onData();return}this.#i.delete(e),this.options.store.upsertStreams(a.streams),this.options.onData();let o=a.streams.find(t=>t.channelSlug===e);e===this.#s&&await this.#C(new Set([e])),o&&!o.showViewCount?qo.info(`Fallback resolved`,{slug:e,viewerCount:o.viewerCount}):qo.debug(`Channel fetched`,{slug:e})}catch(t){Eo(t)||(this.#y(e),qo.warn(`Channel fetch failed`,{error:Xo(t),slug:e}))}}#y(e){this.#i.set(e,Date.now()+Ko),this.#b(Ko)}#b(e){this.#h!==void 0||!this.#u||(this.#h=window.setTimeout(()=>{this.#h=void 0;for(let e of this.#a)Yo(this.options.store.get(e),e===this.#s)?this.#g(e):this.#r.delete(e);this.#_()},Math.max(250,e)))}async#x(){let e=this.#s;e&&await this.#C(new Set([e]))}async#S(){await this.#C(this.#a)}async#C(e){if(!(!this.#u||document.hidden)){for(let t of e)this.#n.has(t)||this.#t.add(t);if(!(this.#m||this.#t.size===0)){this.#m=!0;try{for(;this.#u&&!document.hidden&&this.#t.size>0;){let e=new Set(this.#t);this.#t.clear(),this.#n.clear();for(let t of e)this.#n.add(t);await this.#w(e),this.#n.clear()}}finally{this.#n.clear(),this.#m=!1,this.#u&&!document.hidden&&this.#t.size>0&&this.#C(new Set)}}}}async#w(e){this.options.store.prune();let t=[...this.options.store.getLivestreamIds(e)];if(t.length===0){this.options.onData();return}let n=this.#d,r=0;try{for(let e=0;ee));r+=this.options.store.upsertCurrentViewers(c.currentViewers),r+=this.options.store.removeLivestreamIds(i.filter(t=>!e.has(t)))}}r>0&&qo.debug(`Refresh complete`,{livestreams:t.length,updated:r})}catch(e){!Eo(e)&&Date.now()-this.#f>=Ko&&(this.#f=Date.now(),qo.warn(`Refresh failed`,{error:Xo(e)}))}finally{this.#u&&n===this.#d&&this.options.onData()}}#T=()=>{document.hidden||this.#S()}};function Yo(e,t){return!e||e.startedAt===void 0||t&&e.livestreamId===void 0||e.showViewCount&&e.source!==`channel-details`&&e.source!==`current-viewers`}function Xo(e){return e instanceof Error?e.message:String(e)}var Zo=new Set([`https://kick.com`,`https://www.kick.com`]),Qo=[{endpoint:`SIDEBAR_LIVESTREAMS`,matches:es(`/api/v1/recommendations/livestreams/sidebar`)},{endpoint:`RECOMMENDED_LIVESTREAMS`,matches:es(`/api/v1/recommendations/livestreams`)},{endpoint:`PAGINATED_RECOMMENDED_LIVESTREAMS`,matches:es(`/api/v1/recommendations/livestreams/list`)},{endpoint:`FEATURED_LIVESTREAMS`,matches:es(`/api/v1/livestreams/featured`)},{endpoint:`FOLLOWED_CHANNELS`,matches:$o(`/api/v2/channels/followed`)},{endpoint:`CHANNEL_DETAILS`,matches:e=>Zo.has(e.origin)&&/^\/api\/v2\/channels\/[^/]+$/.test(e.pathname)},{endpoint:`CURRENT_VIEWERS`,matches:$o(`/current-viewers`)},{endpoint:`USER_LIVESTREAMS`,matches:$o(`/api/v1/user/livestreams`)}];function $o(e){return t=>Zo.has(t.origin)&&t.pathname===e}function es(e){return t=>t.origin===`https://web.kick.com`&&t.pathname===e}function ts(e,t=window.location.href){try{let n=new URL(e,t);return Qo.find(({matches:e})=>e(n))?.endpoint}catch{return}}var ns=`kick-enhancer-viewer-counts`,rs=`KICK_ENHANCER_API_RESPONSE`;function is(e){return e===`CHANNEL_DETAILS`||e===`CURRENT_VIEWERS`||e===`FEATURED_LIVESTREAMS`||e===`FOLLOWED_CHANNELS`||e===`PAGINATED_RECOMMENDED_LIVESTREAMS`||e===`RECOMMENDED_LIVESTREAMS`||e===`SIDEBAR_LIVESTREAMS`||e===`USER_LIVESTREAMS`}function as(e){return os(e)?e.source===`kick-enhancer-viewer-counts`&&e.type===`KICK_ENHANCER_API_RESPONSE`&&is(e.endpoint)&&typeof e.url==`string`&&typeof e.timestamp==`number`&&Number.isFinite(e.timestamp)&&`payload`in e:!1}function os(e){return typeof e==`object`&&!!e}var ss=x(`viewer-counts:capture`);function cs(){let e=t;try{if(e.__kickEnhancerViewerCountHookInstalled)return!0;let t=e.Response.prototype.json,n=Object.getOwnPropertyDescriptor(e.Response.prototype,`json`),r=new Proxy(t,{apply(t,n,r){let i=Reflect.apply(t,n,r),a=ts(n.url,e.location.href);return a&&i.then(t=>{let r={endpoint:a,payload:t,source:ns,timestamp:Date.now(),type:rs,url:n.url};e.postMessage(r,e.location.origin)}).catch(()=>{}),i}});return Object.defineProperty(e.Response.prototype,"json",{...n,configurable:!0,value:r,writable:!0}),e.__kickEnhancerViewerCountHookInstalled=!0,ss.info(`Installed`),!0}catch(e){return ss.warn(`Unavailable; using fallback`,e),!1}}var ls=`[data-ke-viewer-count]`,us=`[data-ke-stream-uptime]`,ds=[ls,us].join(`, `),fs=[`#sidebar-wrapper a[data-testid^="sidebar-following-channel-"]`,`#sidebar-wrapper a[data-testid^="sidebar-recommended-channel-"]`].join(`, `),ps=`[data-testid="livestream-results-card"]`,ms=`a[data-testid="media-card-thumbnail"][href]`,hs=/^(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?\s*[km]?$/i;function gs(e){let t,n=0;for(let r of e.querySelectorAll(`span, p, div`)){if(r.closest(`[data-ke-viewer-count], [data-ke-stream-uptime]`)||r.querySelector(`[data-ke-viewer-count], [data-ke-stream-uptime]`))continue;let e=r.textContent?.trim()??``;if(e.toLowerCase()!==`live`&&!vs(e))continue;let i=r.childElementCount===0?2:1,a=r.parentElement?.textContent??``;r.parentElement?.querySelector(`.bg-green-500`)&&(i+=6),(a.trim().length<=e.length+8||r.parentElement?.classList.contains(`items-center`))&&(i+=2),i>n&&(t=r,n=i)}return t}function _s(e){if(e<1e3)return String(e);let t=e<1e6?1e3:1e6,n=e<1e6?`K`:`M`,r=Math.round(e/t*10)/10;return`${Number.isInteger(r)?r:r.toFixed(1)}${n}`}function vs(e){return hs.test(e?.trim()??``)}function ys(e,t,n){let r=new Set,i=0,a=0;for(let o of document.querySelectorAll(ps)){if(Cs(o,n)){t.removeCount(o,`card`),t.removeUptime(o,`card`);continue}let s=o.querySelector(ms),c=ro(s?.getAttribute(`href`)),l=s?Ss(s):void 0;if(!s||!c||!l){t.removeCount(o,`card`),t.removeUptime(o,`card`);continue}r.add(c);let u=e.get(c);if(n.showStreamUptime?i+=bs(t,s,l,c,u?.startedAt):t.removeUptime(s,`card`),!n.showHiddenViewerCounts||xs(s)||!u||u.showViewCount){t.removeCount(o,`card`);continue}let d=t.findCount(s,`card`)??document.createElement(`div`);if(t.updateCount(d,{className:`ke-viewer-count-card`,count:u.viewerCount,slug:c,target:`card`})||!d.querySelector(`:scope > span`)){let e=document.createElement(`span`);e.textContent=_s(u.viewerCount),d.replaceChildren(e,` watching`)}d.parentElement!==s&&s.append(d),a+=1}return{targetSlugs:r,uptimes:i,viewerCounts:a}}function bs(e,t,n,r,i){if(i===void 0)return e.restoreNativeCardLiveBadge(n),e.removeUptime(t,`card`),0;let a=lo(i);if(!a)return e.restoreNativeCardLiveBadge(n),e.removeUptime(t,`card`),0;let o=e.findUptime(t,`card`)??document.createElement(`div`);return e.updateUptime(o,{className:`ke-stream-uptime-card`,label:`Live for ${a}`,slug:r,startedAt:i,target:`card`,text:a}),e.hideNativeCardLiveBadge(n,r),o.parentElement!==t&&t.append(o),1}function xs(e){return[...e.querySelectorAll(`[title]`)].some(e=>{if(e.closest(`[data-ke-viewer-count]`))return!1;let t=e.getAttribute(`title`),n=e.parentElement?.textContent??``;return vs(t)&&/\bwatching\b/i.test(n)})}function Ss(e){return[...e.querySelectorAll(`div, span`)].find(e=>!e.closest(ds)&&e.childElementCount===0&&e.textContent?.trim().toLowerCase()===`live`)}function Cs(e,t){return t.hideGamblingStreams&&e.closest(`[data-testid="followed-livestreams"]`)&&e.querySelector(`a[href="/category/slots"]`)?!0:!!(t.hideFollowingRecommendations&&e.closest(`[data-testid="following"]`)&&!e.closest(`[data-testid="followed-livestreams"]`))}var ws=Array.from({length:30},(e,t)=>t%10),Ts=new WeakMap;function Es(e,t){let n=Math.abs(t).toLocaleString(),r=Ts.get(e);if(r?.value===n)return;if(Ds(r),Os()){e.textContent=n,Ts.set(e,{animations:[],value:n});return}let i=document.createDocumentFragment(),a=[],o=0;for(let e of n){if(!/\d/.test(e)){let t=document.createElement(`span`);t.className=`ke-animated-number__separator`,t.textContent=e,i.append(t);continue}let t=document.createElement(`span`);t.className=`ke-animated-number__digit`;let n=document.createElement(`span`);n.className=`ke-animated-number__reel`;for(let e of ws){let t=document.createElement(`span`);t.className=`ke-animated-number__cell`,t.textContent=String(e),n.append(t)}t.append(n),i.append(t),a.push({digit:Number(e),element:n,index:o,viewport:t}),o+=1}e.replaceChildren(i);let s={animations:[],value:n};Ts.set(e,s),s.frame=window.requestAnimationFrame(()=>{if(s.frame=void 0,!(Ts.get(e)!==s||!e.isConnected))for(let e of a){let t=e.viewport.getBoundingClientRect().height;if(t<=0)continue;let n=-(20+e.digit)*t,r=e.element.animate([{transform:`translateY(0)`},{offset:.82,transform:`translateY(${n-t*.3}px)`},{offset:.93,transform:`translateY(${n+t*.1}px)`},{transform:`translateY(${n}px)`}],{delay:e.index*35,duration:520+e.index*70,easing:`cubic-bezier(0.2, 0.8, 0.2, 1)`,fill:`backwards`});e.element.style.transform=`translateY(${n}px)`,s.animations.push(r)}})}function Ds(e){if(e){e.frame!==void 0&&window.cancelAnimationFrame(e.frame);for(let t of e.animations)t.cancel()}}function Os(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function ks(e,t,n){let r=new Set,i=document.querySelector(`${ls}[data-ke-target="channel"]`);if(!n)return i?.remove(),{rendered:0,targetSlugs:r};let a=io(window.location.pathname),o=document.querySelector(`[data-testid="livestream-title"]`);if(!a||!o)return i?.remove(),{rendered:0,targetSlugs:r};if(document.querySelector(`[data-testid="viewer-count"]:not([data-ke-viewer-count])`))return i?.remove(),{rendered:0,slug:a,targetSlugs:r};r.add(a);let s=e.get(a);if(!s||s.showViewCount)return i?.remove(),{rendered:0,slug:a,targetSlugs:r};let c=i??document.createElement(`div`);t.updateCount(c,{className:`ke-viewer-count-channel`,count:s.viewerCount,slug:a,target:`channel`});let l=c.querySelector(`.ke-viewer-count-channel__value`);if(!l){let e=document.createElement(`span`);e.className=`ke-viewer-count-channel__content`,l=document.createElement(`span`),l.className=[`ke-animated-number`,`ke-viewer-count-channel__value`].join(` `),l.setAttribute(`aria-hidden`,`true`),e.append(l,` watching`),c.replaceChildren(js(),e)}Es(l,s.viewerCount);let u=As();return u&&(c.parentElement!==u||c!==u.firstElementChild)?u.prepend(c):!u&&c.parentElement!==o.parentElement&&o.insertAdjacentElement(`afterend`,c),{rendered:1,slug:a,targetSlugs:r}}function As(){let e=document.querySelector(`[data-testid="sub-button"], [data-testid="gift-sub-button"]`)?.parentElement,t=e?.parentElement?.lastElementChild;return t instanceof HTMLElement&&t!==e?t:void 0}function js(){let e=`http://www.w3.org/2000/svg`,t=document.createElementNS(e,`svg`);t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`viewBox`,`0 0 32 32`);for(let n of[`M4 19V28H7V22H16V28H28V19H4Z`,`M10.75 17.5C14.4775 17.5 17.5 14.4775 17.5 10.75C17.5 7.0225 14.4775 4 10.75 4C7.0225 4 4 7.0225 4 10.75C4 14.4775 7.0225 17.5 10.75 17.5ZM10.75 7C12.82 7 14.5 8.68 14.5 10.75C14.5 12.82 12.82 14.5 10.75 14.5C8.68 14.5 7 12.82 7 10.75C7 8.68 8.68 7 10.75 7Z`,`M23.5 17.5C25.9853 17.5 28 15.4853 28 13C28 10.5147 25.9853 8.5 23.5 8.5C21.0147 8.5 19 10.5147 19 13C19 15.4853 21.0147 17.5 23.5 17.5Z`]){let r=document.createElementNS(e,`path`);r.setAttribute(`d`,n),t.append(r)}return t}function Ms(e,t){let n=String(t.count),r=e.dataset.keCount!==n||e.dataset.keSlug!==t.slug||e.dataset.keTarget!==t.target;Ns(e,t.className),Ps(e,`keCount`,n),Ps(e,`keSlug`,t.slug),Ps(e,`keTarget`,t.target),Ps(e,`keViewerCount`,``),t.text!==void 0&&e.textContent!==t.text&&(e.textContent=t.text);let i=`${t.count.toLocaleString()} viewers`;return e.getAttribute(`aria-label`)!==i&&e.setAttribute(`aria-label`,i),r}function Ns(e,t){e.className!==t&&(e.className=t)}function Ps(e,t,n){e.dataset[t]!==n&&(e.dataset[t]=n)}var Fs=`[data-ke-sidebar-uptime-container]`,Is=`[data-ke-tooltip-uptime-container]`,Ls=`[data-ke-native-card-live-hidden]`,Rs=class{#e=new Set;finalize(){this.#t(),Hs(),Vs(),Us()}findCount(e,t){return e.querySelector(`${ls}[data-ke-target="${t}"]`)}findUptime(e,t){return e.querySelector(`${us}[data-ke-target="${t}"]`)}hideNativeCardLiveBadge(e,t){e.dataset.keNativeCardLiveHidden=t}hideNativeLiveLabel(e,t){e.textContent?.trim().toLowerCase()===`live`&&(e.dataset.keNativeLiveHidden=t)}markUptimeContainer(e,t,n){if(t===`sidebar`){e.dataset.keSidebarUptimeContainer=n;return}e.dataset.keTooltipUptimeContainer=n}removeCount(e,t){this.findCount(e,t)?.remove()}removeUptime(e,t){this.findUptime(e,t)?.remove()}restoreNativeCardLiveBadge(e){e?.removeAttribute(`data-ke-native-card-live-hidden`)}restoreNativeLiveLabel(e){e?.removeAttribute(`data-ke-native-live-hidden`)}updateCount(e,t){let n=Ms(e,t);return this.#e.add(e),n}updateUptime(e,t){e.className!==t.className&&(e.className=t.className),Bs(e,`keSlug`,t.slug),Bs(e,`keStartedAt`,String(t.startedAt)),Bs(e,`keTarget`,t.target),Bs(e,`keStreamUptime`,``),e.textContent!==t.text&&(e.textContent=t.text),e.getAttribute(`aria-label`)!==t.label&&e.setAttribute(`aria-label`,t.label),this.#e.add(e)}#t(){for(let e of document.querySelectorAll(ds))this.#e.has(e)||e.remove()}};function zs(){for(let e of document.querySelectorAll(ds))e.remove();for(let e of document.querySelectorAll(`[data-ke-native-live-hidden]`))e.removeAttribute(`data-ke-native-live-hidden`);for(let e of document.querySelectorAll(Ls))e.removeAttribute(`data-ke-native-card-live-hidden`);for(let e of document.querySelectorAll([Fs,Is].join(`, `)))e.removeAttribute(`data-ke-sidebar-uptime-container`),e.removeAttribute(`data-ke-tooltip-uptime-container`)}function Bs(e,t,n){e.dataset[t]!==n&&(e.dataset[t]=n)}function Vs(){for(let e of document.querySelectorAll(`[data-ke-native-live-hidden]`)){let t=e.parentElement,n=e.dataset.keNativeLiveHidden,r=t?.querySelector(ls);(!r||r.dataset.keSlug!==n)&&e.removeAttribute(`data-ke-native-live-hidden`)}}function Hs(){for(let e of document.querySelectorAll(Ls)){let t=e.closest(ms)?.querySelector(`${us}[data-ke-target="card"]`),n=e.dataset.keNativeCardLiveHidden;(!t||t.dataset.keSlug!==n)&&e.removeAttribute(`data-ke-native-card-live-hidden`)}}function Us(){Ws(Fs,`data-ke-sidebar-uptime-container`,`sidebar`),Ws(Is,`data-ke-tooltip-uptime-container`,`tooltip`)}function Ws(e,t,n){for(let r of document.querySelectorAll(e)){let e=r.querySelector(`${us}[data-ke-target="${n}"]`),i=r.getAttribute(t);(!e||e.dataset.keSlug!==i)&&r.removeAttribute(t)}}function Gs(e,t){return t.hideRecommendedChannels&&e.matches(`a[data-testid^="sidebar-recommended-channel-"]`)?!0:!!(t.hideGamblingStreams&&e.closest(`[data-kick-enhancer-gambling-stream]`))}function Ks(e,t){for(let e of Ys(t)){let t=document.getElementById(e),n=t?.closest(`[data-radix-popper-content-wrapper]`)??t?.closest(`[role="tooltip"]`);if(n&&!n.closest(`#sidebar-wrapper`))return n}let n=new Set;for(let e of document.querySelectorAll(`[role="tooltip"], [data-radix-popper-content-wrapper]`)){let t=e.closest(`[data-radix-popper-content-wrapper]`)??e;t.closest(`#sidebar-wrapper`)||n.add(t)}return[...n].find(t=>Xs(t,e.displayName))}function qs(e,t){for(let n of e.querySelectorAll(`span, p, div`)){if(n.childElementCount>0||n.textContent?.trim()!==t.trim())continue;let e=n.parentElement;for(let t=0;e&&t<3;t+=1){if(e.classList.contains(`flex`)||window.getComputedStyle(e).display===`flex`)return e;e=e.parentElement}}}function Js(){return document.querySelector(`[data-sidebar][data-chat][data-theatre], [data-sidebar]`)?.getAttribute(`data-sidebar`)!==`false`&&document.querySelector(`button[aria-controls="sidebar-wrapper"], button[aria-label="Collapse sidebar"], button[aria-label="Expand sidebar"], button[data-testid="sidebar-collapse"], button[data-testid="sidebar-expand"]`)?.getAttribute(`aria-expanded`)!==`false`}function Ys(e){let t=new Set;for(let n of[`aria-describedby`,`aria-controls`])for(let r of(e.getAttribute(n)??``).split(/\s+/))r&&t.add(r);return t}function Xs(e,t){let n=t.trim().toLowerCase();return[...e.querySelectorAll(`span, p, div`)].some(e=>!e.closest(ds)&&e.childElementCount===0&&e.textContent?.trim().toLowerCase()===n)}function Zs(e,t,n,r){let i=new Set,a=r.showStreamUptime&&Js(),o=0,s=0;for(let c of n){let n=Gs(c,r),l=ro(c.getAttribute(`href`)),u=gs(c),d=u?.parentElement,f=!!(!n&&l&&u&&d),p=vs(u?.textContent),m=f&&r.showHiddenViewerCounts&&!p,h=f&&a,g;(m||h)&&l&&(i.add(l),g=e.get(l)),!m||!l||!u||!d||!g||g.showViewCount?(t.removeCount(c,`sidebar`),t.restoreNativeLiveLabel(u)):(Qs(t,c,u,d,l,g.viewerCount),s+=1),!h||!l||!d||g?.startedAt===void 0?t.removeUptime(c,`sidebar`):o+=$s(t,c,d,l,g.startedAt)}return{targetSlugs:i,uptimes:o,viewerCounts:s}}function Qs(e,t,n,r,i,a){e.hideNativeLiveLabel(n,i);let o=e.findCount(t,`sidebar`)??document.createElement(`span`);e.updateCount(o,{className:`ke-viewer-count-sidebar`,count:a,slug:i,target:`sidebar`,text:_s(a)}),o.parentElement!==r&&r.append(o)}function $s(e,t,n,r,i){let a=lo(i);if(!a)return e.removeUptime(t,`sidebar`),0;let o=e.findUptime(t,`sidebar`)??document.createElement(`span`);return e.updateUptime(o,{className:`ke-stream-uptime-sidebar`,label:`Live for ${a}`,slug:r,startedAt:i,target:`sidebar`,text:a}),e.markUptimeContainer(n,`sidebar`,r),o.parentElement!==n&&n.append(o),1}function ec(e,t,n,r,i){let a=new Set,o=0,s=0;if(!r||!i.showHiddenViewerCounts&&!i.showStreamUptime)return{targetSlugs:a,uptimes:o,viewerCounts:s};let c=n.find(e=>ro(e.getAttribute(`href`))===r.slug);if(!c||Gs(c,i))return{targetSlugs:a,uptimes:o,viewerCounts:s};a.add(r.slug);let l=e.get(r.slug);if(!l)return{targetSlugs:a,uptimes:o,viewerCounts:s};let u=i.showHiddenViewerCounts&&!l.showViewCount,d=i.showStreamUptime?l.startedAt:void 0,f=d===void 0?void 0:lo(d);if(!u&&!f)return{targetSlugs:a,uptimes:o,viewerCounts:s};let p=Ks(r,c);if(!p)return{targetSlugs:a,uptimes:o,viewerCounts:s};let m=gs(p),h=m?.parentElement??qs(p,r.displayName);if(!h)return{targetSlugs:a,uptimes:o,viewerCounts:s};if(u&&!(m&&vs(m.textContent))){m&&t.hideNativeLiveLabel(m,r.slug);let e=t.findCount(p,`tooltip`)??document.createElement(`span`);t.updateCount(e,{className:[`ke-viewer-count-tooltip`,m?``:`ke-viewer-count-tooltip--standalone`].filter(Boolean).join(` `),count:l.viewerCount,slug:r.slug,target:`tooltip`,text:_s(l.viewerCount)}),e.parentElement!==h&&h.append(e),s=1}if(f&&d!==void 0){let e=t.findUptime(p,`tooltip`)??document.createElement(`span`);t.updateUptime(e,{className:`ke-stream-uptime-tooltip`,label:`Live for ${f}`,slug:r.slug,startedAt:d,target:`tooltip`,text:f}),t.markUptimeContainer(h,`tooltip`,r.slug),e.parentElement!==h&&h.append(e),o=1}return{targetSlugs:a,uptimes:o,viewerCounts:s}}var tc=x(`viewer-counts:render`);function nc(e,t,n){let r=new Rs,i=[...document.querySelectorAll(fs)];try{let a=rc(`channel`,()=>ks(e,r,n.showHiddenViewerCounts),ic),o=rc(`cards`,()=>ys(e,r,n),ac),s=rc(`sidebar`,()=>Zs(e,r,i,n),ac),c=rc(`sidebar-tooltip`,()=>ec(e,r,i,t,n),ac);return{...a.slug?{activeChannelSlug:a.slug}:{},counts:{cardUptimes:o.uptimes,cards:o.viewerCounts,channel:a.rendered,sidebar:s.viewerCounts,sidebarUptimes:s.uptimes,tooltipUptimes:c.uptimes,tooltips:c.viewerCounts},targetSlugs:oc(a,o,s,c)}}finally{r.finalize()}}function rc(e,t,n){try{return t()}catch(t){return tc.error(`Surface render failed`,{error:t instanceof Error?t.message:String(t),surface:e}),n()}}function ic(){return{rendered:0,targetSlugs:new Set}}function ac(){return{targetSlugs:new Set,uptimes:0,viewerCounts:0}}function oc(...e){let t=new Set;for(let n of e)for(let e of n.targetSlugs)t.add(e);return t}var sc=300*1e3,cc=500,lc={"channel-details":6,"current-viewers":7,featured:2,"followed-channels":4,recommendations:2,"sidebar-recommendations":3,"user-livestreams":5},uc=class{#e=new Map;#t=new Map;#n=new Map;upsertStreams(e){let t=0;for(let n of e){let e=this.#n.get(n.channelSlug);if(!e||dc(e,n)){let r=e?fc(e,n):n;e?.livestreamId!==void 0&&e.livestreamId!==r.livestreamId&&(this.#t.delete(e.livestreamId),this.#e.delete(e.livestreamId)),this.#n.set(r.channelSlug,r),t+=1}let r=this.#n.get(n.channelSlug);r?.livestreamId!==void 0&&this.#t.set(r.livestreamId,r.channelSlug)}return this.prune(),t}upsertCurrentViewers(e){let t=0;for(let n of e){let e=this.#e.get(n.livestreamId);(!e||n.capturedAt>=e.capturedAt)&&(this.#e.set(n.livestreamId,n),t+=1)}return this.prune(),t}get(e,t=Date.now()){let n=this.#n.get(e);if(!n||!n.isLive)return;if(n.livestreamId===void 0)return t-n.capturedAt<=sc?n:void 0;let r=this.#e.get(n.livestreamId);return!(r!==void 0&&t-r.capturedAt<=sc)||r.capturedAtsc&&this.#e.delete(t);if(this.#n.size<=cc)return;let t=[...this.#n.values()].sort((e,t)=>e.capturedAt-t.capturedAt).slice(0,this.#n.size-cc);for(let e of t)this.remove(e.channelSlug)}clear(){this.#e.clear(),this.#t.clear(),this.#n.clear()}};function dc(e,t){return t.capturedAt===e.capturedAt?lc[t.source]>=lc[e.source]:t.capturedAt>e.capturedAt}function fc(e,t){let n=e.livestreamId===void 0||t.livestreamId===void 0||e.livestreamId===t.livestreamId,r=n&&!e.showViewCount&&t.showViewCount&&t.source===`channel-details`,i=n&&t.startedAt===void 0?e.startedAt:t.startedAt;return{...t,...i===void 0?{}:{startedAt:i},...r?{showViewCount:!1}:{}}}var pc=`[data-ke-viewer-count],[data-ke-stream-uptime]{box-sizing:border-box;white-space:nowrap;font-family:inherit}.ke-viewer-count-card,.ke-stream-uptime-card{z-index:20;color:var(--neon-surface-onSurface,#fff);font-variant-numeric:tabular-nums;pointer-events:none;border-radius:.25rem;padding:0 .25rem;line-height:1.5rem;position:absolute}.ke-viewer-count-card{background:var(--neon-surface-lowest,#0e0f12);font-size:.875rem;font-weight:600;bottom:.375rem;left:.375rem}.ke-stream-uptime-card{background:#0b0b0c;align-items:center;gap:.25rem;font-size:.75rem;font-weight:500;display:inline-flex;top:.375rem;left:.375rem}.ke-stream-uptime-card:before{content:"";background:var(--neon-primary-base,#53fc18);border-radius:9999px;flex:none;width:.5rem;height:.5rem}.ke-viewer-count-sidebar,.ke-viewer-count-tooltip{color:inherit;flex:none;align-items:center;font-size:.875rem;font-weight:600;line-height:1.25rem;display:inline-flex}.ke-stream-uptime-tooltip{color:var(--neon-surface-onSurfaceSecondary,#9fa6ad);font-variant-numeric:tabular-nums;pointer-events:none;white-space:nowrap;font-size:.6875rem;font-weight:500;line-height:1rem;position:absolute;top:100%;right:0}[data-ke-tooltip-uptime-container],[data-ke-sidebar-uptime-container]{position:relative}.ke-stream-uptime-sidebar{color:var(--neon-surface-onSurfaceSecondary,#9fa6ad);font-variant-numeric:tabular-nums;pointer-events:none;white-space:nowrap;font-size:.6875rem;font-weight:500;line-height:1rem;position:absolute;top:100%;right:0}.ke-viewer-count-tooltip--standalone{gap:.25rem;margin-left:auto}.ke-viewer-count-tooltip--standalone:before{content:"";background:var(--neon-primary-base,#53fc18);border-radius:9999px;width:.5rem;height:.5rem}.ke-viewer-count-channel{min-height:1.375rem;color:var(--neon-surface-onSurface,#fff);align-items:center;gap:.25rem;font-size:.875rem;font-weight:700;line-height:1.25rem;display:inline-flex}.ke-viewer-count-channel svg{fill:currentColor;flex:none;width:1rem;height:1rem}.ke-viewer-count-channel__content{color:var(--neon-surface-onSurfaceSecondary,#9fa6ad);align-items:center;gap:.25rem;display:inline-flex}.ke-viewer-count-channel__value{color:var(--neon-primary-base,#53fc18)}.ke-animated-number{font-variant-numeric:tabular-nums;align-items:center;display:inline-flex}.ke-animated-number__digit{width:1ch;height:1.25rem;display:inline-block;position:relative;overflow:hidden}.ke-animated-number__reel{will-change:transform;flex-direction:column;width:100%;display:flex;position:absolute;top:0;left:0}.ke-animated-number__cell{flex:0 0 1.25rem;justify-content:center;align-items:center;width:100%;height:1.25rem;line-height:1.25rem;display:flex}.ke-animated-number__separator{height:1.25rem;line-height:1.25rem;display:inline-block}[data-ke-native-live-hidden],[data-ke-native-card-live-hidden]{display:none!important}`,mc=`kick-enhancer-viewer-count-styles`,hc=150,gc=60*1e3,_c=x(`viewer-counts`),vc=new uc,yc=new Jo({onData:()=>$(`network`),store:vc}),bc=!1,xc=!1,Sc,Q=!1,Cc,wc,Tc,Ec,Dc=``,Oc=window.location.href,kc,Ac=1/0,jc=``,Mc,Nc,Pc=!1,Fc,Ic,Lc;function Rc(){bc||(bc=!0,window.addEventListener(`message`,qc),cs())}function zc(){Fc?.();let e=_e();Bc(e.ui.showHiddenViewerCounts,e.ui.showStreamUptime),Ic=be(e=>{Bc(e.ui.showHiddenViewerCounts,e.ui.showStreamUptime)});let t=!1,n=()=>{t||(t=!0,Ic?.(),Ic=void 0,Q=!1,Pc=!1,Hc(),Wc(),Fc===n&&(Fc=void 0))};return Fc=n,n}function Bc(e,t){let n=Q;if(Q=e||t,Pc=t,Q){if(!n){Vc();return}Gc(),$(`settings`,0);return}n&&(Hc(),Wc(),_c.info(`Disabled`))}function Vc(){if(document.documentElement){Uc();return}Sc||=ht(()=>{Sc=void 0,Uc()})}function Hc(){Sc?.(),Sc=void 0}function Uc(){!Q||xc||!document.documentElement||(Hc(),xc=!0,Oc=window.location.href,va(mc,pc,!0),yc.start(),Jc(),$c(),document.addEventListener(`pointerover`,Xc,!0),document.addEventListener(`pointerout`,Zc,!0),document.addEventListener(`focusin`,Xc,!0),document.addEventListener(`focusout`,Zc,!0),Gc(),$(`enabled`,0),_c.info(`Enabled`))}function Wc(){if(!xc){Nc=void 0,zs(),va(mc,pc,!1);return}xc=!1,yc.stop(),kc?.disconnect(),kc=void 0,el(),document.removeEventListener(`pointerover`,Xc,!0),document.removeEventListener(`pointerout`,Zc,!0),document.removeEventListener(`focusin`,Xc,!0),document.removeEventListener(`focusout`,Zc,!0),Mc!==void 0&&(window.clearTimeout(Mc),Mc=void 0,Ac=1/0,jc=``),Kc(),Nc=void 0,zs(),va(mc,pc,!1)}function Gc(){if(!xc||!Pc){Kc();return}Lc===void 0&&(Lc=window.setInterval(()=>{document.hidden||$(`uptime`,0)},gc))}function Kc(){Lc!==void 0&&(window.clearInterval(Lc),Lc=void 0)}function qc(e){if(e.source!==window&&e.source!==t||e.origin!==window.location.origin||!as(e.data))return;let n=e.data;if(ts(n.url,window.location.href)!==n.endpoint||Math.abs(Date.now()-n.timestamp)>60*1e3)return;let r=fo(n.endpoint,n.payload,n.timestamp);Po(n.endpoint,r,n.timestamp,`captured`);let i=r.kind===`streams`?r.streams.length:0,a=r.kind===`streams`?r.streams.filter(e=>!e.showViewCount).length:0,o=r.kind===`streams`?vc.upsertStreams(r.streams):vc.upsertCurrentViewers(r.currentViewers);n.endpoint===`PAGINATED_RECOMMENDED_LIVESTREAMS`&&Q&&a>0&&_c.info(`Hidden data captured`,{hiddenStreams:a,streams:i,updated:o}),o!==0&&(n.endpoint!==`CURRENT_VIEWERS`&&_c.debug(`Data captured`,{endpoint:n.endpoint,updated:o}),Q&&$(`capture`))}function Jc(){kc||!document.documentElement||(kc=new MutationObserver(e=>{window.location.href!==Oc&&tl(),e.some(e=>!nl(e))&&$(`mutation`)}),kc.observe(document.documentElement,{attributeFilter:[`data-sidebar`,`data-testid`,`href`],attributes:!0,characterData:!0,childList:!0,subtree:!0}))}function $(e,t=hc){if(!Q||!xc)return;let n=performance.now()+Math.max(0,t);Mc!==void 0&&n>=Ac||(Mc!==void 0&&window.clearTimeout(Mc),Ac=n,jc=e,Mc=window.setTimeout(()=>{let e=jc;Mc=void 0,Ac=1/0,jc=``,Yc(e)},Math.max(0,n-performance.now())))}function Yc(e){if(!Q)return;let t=nc(vc,Nc,_e().ui);yc.syncTargets(t.targetSlugs,t.activeChannelSlug);let n=JSON.stringify(t.counts);if(n!==Dc){Dc=n;let r={reason:e,...t.counts,targets:t.targetSlugs.size};t.counts.cardUptimes+t.counts.cards+t.counts.channel+t.counts.sidebar+t.counts.sidebarUptimes+t.counts.tooltipUptimes+t.counts.tooltips>0?_c.info(`Rendered`,r):_c.debug(`Surfaces updated`,r)}}function Xc(e){if(!(e.target instanceof Element))return;let t=e.target.closest(fs),n=ro(t?.getAttribute(`href`));if(!t||!n)return;let r=t.querySelector(`img[alt]`)?.alt.trim()||Qc(t);r&&(Nc={displayName:r,slug:n},$(`sidebar-hover`,0))}function Zc(e){if(!(e.target instanceof Element))return;let t=e.target.closest(fs),n=ro(t?.getAttribute(`href`));if(!t||!n||Nc?.slug!==n)return;let r=e.relatedTarget;r instanceof Node&&t.contains(r)||(Nc=void 0,$(`sidebar-hover-end`,0))}function Qc(e){for(let t of e.querySelectorAll(`span`)){let e=t.textContent?.trim();if(e&&e.toLowerCase()!==`live`&&!/^\d+(?:\.\d+)?[km]?$/i.test(e))return e}}function $c(){Tc||Ec||(Cc=window.history.pushState,wc=window.history.replaceState,Tc=function(...e){Reflect.apply(Cc,this,e),tl()},Ec=function(...e){Reflect.apply(wc,this,e),tl()},window.history.pushState=Tc,window.history.replaceState=Ec,window.addEventListener(`popstate`,tl))}function el(){window.removeEventListener(`popstate`,tl),Cc&&window.history.pushState===Tc&&(window.history.pushState=Cc),wc&&window.history.replaceState===Ec&&(window.history.replaceState=wc),Cc=void 0,wc=void 0,Tc=void 0,Ec=void 0}function tl(){window.location.href!==Oc&&(Oc=window.location.href,Nc=void 0,yc.beginRoute(),$(`route`,0),_c.debug(`Route changed`,{pathname:window.location.pathname}))}function nl(e){if((e.target instanceof Element?e.target:e.target.parentElement)?.closest(`#chatroom-messages, #channel-chatroom, [data-ke-viewer-count], [data-ke-stream-uptime]`))return!0;let t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(e=>e instanceof Element&&(e.matches(`[data-ke-viewer-count], [data-ke-stream-uptime]`)||!!e.closest(`[data-ke-viewer-count], [data-ke-stream-uptime]`)))}function rl(...e){let t=!1;return()=>{if(!t){t=!0;for(let t=e.length-1;t>=0;--t)e[t]?.()}}}function il({cancelLabel:e=`Cancel`,confirmLabel:t=`OK`,confirmTone:n=`primary`,description:r,onCancel:i,onConfirm:a,onDismiss:o,open:s,title:c}){let l=z(null),u=V(),d=V();if(R(()=>{if(!s)return;let e=document.activeElement instanceof HTMLElement?document.activeElement:null;return l.current?.querySelector(`button`)?.focus(),()=>{e?.isConnected&&e.focus()}},[s]),!s)return null;let f=o??i;return P(`div`,{className:`ke-confirmation-layer`,children:P(`div`,{"aria-describedby":d,"aria-labelledby":u,"aria-modal":`true`,className:`ke-confirmation-dialog`,onKeyDown:e=>{if(e.key===`Escape`){f&&(e.preventDefault(),e.stopPropagation(),f());return}if(e.key!==`Tab`)return;let t=l.current?.querySelectorAll(`button:not(:disabled)`),n=t?.item(0),r=t?.item((t?.length??1)-1);!n||!r||(e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus()))},ref:l,role:`alertdialog`,children:[P(`div`,{className:`ke-confirmation-dialog__copy`,children:[P(`h3`,{className:`ke-confirmation-dialog__title`,id:u,children:c}),P(`p`,{className:`ke-confirmation-dialog__description`,id:d,children:r})]}),P(`div`,{className:`ke-confirmation-dialog__actions`,children:[i?P(U,{onClick:i,children:e}):null,P(U,{onClick:a,tone:n,children:t})]})]})})}var al={name:`kick-enhancer`,version:`0.1.1`,private:!0,description:`Enhances KICK with viewer counts, stream uptime, content controls, and direct clip downloads.`,homepage:`https://github.com/sixem/kick-enhancer#readme`,repository:{type:`git`,url:`https://github.com/sixem/kick-enhancer.git`},bugs:{url:`https://github.com/sixem/kick-enhancer/issues`},type:`module`,packageManager:`pnpm@10.33.0`,scripts:{dev:`node scripts/dev.mjs`,build:`pnpm typecheck && vite build`,"build:greasyfork":`pnpm typecheck && vite build --mode greasyfork`,preview:`vite preview`,test:`node --test --experimental-transform-types tests/*.test.mjs`,typecheck:`tsc --noEmit`},dependencies:{"mux.js":`6.3.0`,preact:`^10.29.7`},devDependencies:{"@preact/preset-vite":`^2.10.6`,"happy-dom":`^20.11.1`,"sass-embedded":`^1.100.0`,typescript:`^6.0.2`,vite:`^8.1.5`,"vite-plugin-monkey":`^8.1.0`}};function ol({onImportError:e,onImportRequest:t}){let n=z(null),r=()=>e(),i=async e=>{let n=e.currentTarget,i=n.files?.[0];if(n.value=``,!i)return;if(i.size>64*1024)return r();let a;try{a=await i.text()}catch{return r()}let o=re(a);if(!o.ok)return r();t(o.settings,o.compatibilityWarning)};return P(`section`,{className:`ke-about`,"aria-labelledby":`ke-about-title`,children:[P(`img`,{alt:``,className:`ke-about__icon`,draggable:!1,src:nn}),P(`div`,{className:`ke-about__identity`,children:[P(`h3`,{className:`ke-about__title`,id:`ke-about-title`,children:`KICK Enhancer`}),P(`p`,{className:`ke-about__version`,children:[`Version `,al.version]})]}),P(`p`,{className:`ke-about__description`,children:`A userscript that makes KICK cleaner and puts useful viewing information back in sight.`}),P(`div`,{className:`ke-about__actions`,children:[P(U,{onClick:()=>n.current?.click(),children:`Import settings`}),P(U,{onClick:()=>{sl(new Blob([E(_e())],{type:`application/json;charset=utf-8`}),`kick-enhancer-settings-v5.json`)},children:`Export settings`}),P(`input`,{accept:`.json,application/json`,hidden:!0,onChange:e=>void i(e),ref:n,type:`file`})]})]})}function sl(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.download=t,r.href=n,r.hidden=!0,document.body.append(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),0)}var cl=20,ll=3,ul=500,dl=/authorization|cookie|credential|password|playback|secret|session|signature|token/i,fl=/https?:\/\/[^\s"'<>]+/gi;function pl(e){let t=new Date(e.timestamp),n=Number.isNaN(t.getTime())?`Invalid time`:t.toISOString(),r=e.arguments.map(e=>hl(e)).join(` `);return`${n} [${e.level.toUpperCase()}] [${e.scope}] ${r}`}function ml(e){return e.arguments.map(gl).join(`; `)}function hl(e){if(typeof e==`string`)return yl(e);if(e===null||typeof e==`number`||typeof e==`boolean`||e===void 0)return String(e);if(typeof e==`bigint`)return`${e}n`;if(typeof e==`symbol`)return e.description?`Symbol(${e.description})`:`Symbol()`;if(typeof e==`function`)return`[Function ${e.name||`anonymous`}]`;try{return JSON.stringify(vl(e,0,new WeakSet))}catch{return`[Unserializable value]`}}function gl(e){if(e instanceof Error)return`${e.name}: ${yl(e.message)}`;if(typeof e!=`object`||!e||Array.isArray(e))return hl(e);let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return hl(e);let n=vl(e,0,new WeakSet),r=typeof n==`object`&&n?Object.entries(n):[];return r.length===0?`{}`:r.map(([e,t])=>`${e}=${_l(t)}`).join(`; `)}function _l(e){return typeof e==`string`?e:e===null||typeof e==`number`||typeof e==`boolean`||e===void 0?String(e):JSON.stringify(e)}function vl(e,t,n){if(typeof e==`string`)return yl(e);if(e===null||typeof e==`number`||typeof e==`boolean`||e===void 0)return e;if(typeof e==`bigint`)return`${e}n`;if(typeof e!=`object`)return String(e);if(e instanceof Error)return{message:yl(e.message),name:e.name};if(t>=ll)return`[Max depth]`;if(n.has(e))return`[Circular]`;if(n.add(e),Array.isArray(e)){let r=e.slice(0,cl).map(e=>vl(e,t+1,n));return e.length>cl&&r.push(`[${e.length-cl} more items]`),r}let r={};for(let[i,a]of Object.entries(e))r[i]=dl.test(i)?`[Redacted]`:vl(a,t+1,n);return r}function yl(e){let t=e.replace(/\bBearer\s+\S+/gi,`Bearer [Redacted]`).replace(fl,bl);return t.length>ul?`${t.slice(0,ul)}…`:t}function bl(e){try{let t=new URL(e),n=t.search||t.hash?`?[redacted]`:``;return`${t.origin}${t.pathname}${n}`}catch{return`[Invalid URL]`}}var xl=[],Sl=[],Cl=[{label:`All levels`,value:`all`},{label:`Debug`,value:`debug`},{label:`Info`,value:`info`},{label:`Warnings`,value:`warn`},{label:`Errors`,value:`error`}],wl=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,hourCycle:`h23`,minute:`2-digit`,second:`2-digit`}),Tl=[{header:`Endpoint`,id:`endpoint`,renderCell:e=>Oo[e.endpoint],width:`7.5rem`},{align:`center`,header:`Status`,id:`status`,renderCell:e=>P(kl,{label:e.status,tone:e.status}),width:`7.2rem`},{align:`center`,header:`Response`,id:`response`,renderCell:Ml,width:`6.6rem`},{cellClassName:`ke-diagnostics__details-cell`,header:`Details`,id:`details`,renderCell:e=>e.summary,width:`minmax(12rem, 1fr)`}],El=[{header:`Endpoint`,id:`endpoint`,renderCell:e=>Oo[e.endpoint],width:`9rem`},{align:`center`,header:`State`,id:`state`,renderCell:e=>P(kl,{label:e.observation?`observed`:`not seen`,tone:e.observation?`observed`:`not-seen`}),width:`7.2rem`},{align:`center`,header:`Last seen`,id:`last-seen`,renderCell:e=>e.observation?Pl(e.observation.observedAt):`—`,width:`6.2rem`},{cellClassName:`ke-diagnostics__details-cell`,header:`Normalized result`,id:`details`,renderCell:e=>Nl(e.observation),width:`minmax(12rem, 1fr)`}],Dl=[{align:`center`,header:`Level`,id:`level`,renderCell:e=>P(kl,{label:e.level,tone:e.level}),width:`6.25rem`},{align:`center`,header:`Time`,id:`time`,renderCell:e=>Pl(e.timestamp),width:`5.3rem`},{align:`center`,header:`Scope`,id:`scope`,renderCell:e=>P(kl,{label:e.scope,tone:jl(e.scope)}),width:`10rem`},{cellClassName:`ke-diagnostics__log-message`,header:`Message`,id:`message`,renderCell:ml,width:`minmax(14rem, 1fr)`}];function Ol({active:e,onShowMessage:t}){let n=z(null),[r,i]=L(()=>io(window.location.pathname)??``),[a,o]=L([]),[s,c]=L(!1),[l,u]=L(()=>e?Fo():Sl),[d,f]=L(()=>e?S():xl),[p,m]=L(`all`),[h,g]=L(`all`);R(()=>{if(!e){f(xl),u(Sl),n.current?.abort();return}f(S()),u(Fo());let t=te(f),r=Io(u);return()=>{t(),r(),n.current?.abort()}},[e]);let _=Jt(()=>{let e=new Map(l.map(e=>[e.endpoint,e]));return Do.map(t=>({endpoint:t,observation:e.get(t)}))},[l]),v=Jt(()=>[{label:`All scopes`,value:`all`},...[...new Set(d.map(e=>e.scope))].sort().map(e=>({label:e,value:e}))],[d]),y=Jt(()=>d.filter(e=>(p===`all`||e.level===p)&&(h===`all`||e.scope===h)).reverse(),[p,h,d]),b=async()=>{n.current?.abort();let e=new AbortController;n.current=e,c(!0);try{o(await Ro(r,e.signal))}catch{e.signal.aborted||o([{endpoint:`CHANNEL_DETAILS`,status:`failed`,summary:`The endpoint check stopped unexpectedly.`},{endpoint:`CURRENT_VIEWERS`,status:`unavailable`,summary:`The channel check did not complete.`}])}finally{n.current===e&&(n.current=null,c(!1))}},x=async()=>{if(y.length===0){t(`No logs to copy`,`No visible log entries match the current filters.`);return}let e=y.map(pl).reverse().join(` `);try{await navigator.clipboard.writeText(e),t(`Session log copied`,`Copied ${y.length} log ${y.length===1?`entry`:`entries`} to the clipboard.`)}catch{t(`Could not copy session log`,`Could not access the clipboard. Check your browser permissions and try again.`)}};return P(`div`,{className:`ke-diagnostics`,children:[P(`section`,{"aria-labelledby":`ke-diagnostics-checks-title`,className:`ke-diagnostics__section`,children:[P(`div`,{className:`ke-diagnostics__section-heading`,children:P(`div`,{children:[P(`h3`,{className:`ke-diagnostics__title`,id:`ke-diagnostics-checks-title`,children:`Endpoint health`}),P(`p`,{className:`ke-diagnostics__description`,children:`Run the same channel and viewer requests used by stream enhancements. Checks only run when requested.`})]})}),P(`form`,{className:`ke-diagnostics__check-controls`,onSubmit:e=>{e.preventDefault(),s||b()},children:[P(Vn,{autoComplete:`off`,label:`KICK channel`,onValueChange:i,placeholder:`channel-name`,spellcheck:!1,value:r}),P(U,{className:`ke-button--primary`,disabled:s,type:`submit`,children:s?`Checking…`:`Run checks`})]}),P(zn,{ariaLabel:`Endpoint check results`,ariaLive:`polite`,className:`ke-diagnostics__check-list`,columns:Tl,emptyContent:s?`Contacting KICK…`:`Run checks to test endpoints.`,getItemKey:e=>e.endpoint,heightMode:`content`,items:a})]}),P(`section`,{"aria-labelledby":`ke-diagnostics-observed-title`,className:`ke-diagnostics__section`,children:[P(`div`,{className:`ke-diagnostics__section-heading`,children:P(`div`,{children:[P(`h3`,{className:`ke-diagnostics__title`,id:`ke-diagnostics-observed-title`,children:`Observed responses`}),P(`p`,{className:`ke-diagnostics__description`,children:`Passive summaries from KICK responses already used by the page or Enhancer. No response bodies are retained.`})]})}),P(zn,{ariaLabel:`Observed viewer endpoint responses`,className:`ke-diagnostics__observation-list`,columns:El,getItemKey:e=>e.endpoint,items:_})]}),P(`section`,{"aria-labelledby":`ke-diagnostics-logs-title`,className:`ke-diagnostics__section`,children:[P(`div`,{className:`ke-diagnostics__section-heading`,children:P(`div`,{children:[P(`h3`,{className:`ke-diagnostics__title`,id:`ke-diagnostics-logs-title`,children:`Session log`}),P(`p`,{className:`ke-diagnostics__description`,children:`Latest 250 entries from this page load. Sensitive fields and URL queries are redacted when displayed or copied.`})]})}),P(`div`,{className:`ke-diagnostics__log-controls`,children:[P(Bn,{label:`Level`,onValueChange:m,options:Cl,value:p}),P(Bn,{label:`Scope`,onValueChange:g,options:v,value:h}),P(`div`,{className:`ke-diagnostics__actions`,children:[P(U,{onClick:()=>void x(),children:`Copy`}),P(U,{onClick:()=>{ee(),g(`all`)},tone:`danger`,children:`Clear`})]})]}),P(zn,{ariaLabel:`KICK Enhancer session logs`,ariaLive:`polite`,className:`ke-diagnostics__log-list`,columns:Dl,emptyContent:`No log entries match these filters.`,getItemKey:e=>e.id,items:y,rowHeight:36})]})]})}function kl({label:e,tone:t}){return P(`span`,{className:`ke-diagnostics__pill`,"data-tone":t,children:P(`span`,{className:`ke-diagnostics__pill-label`,children:e})})}var Al=[`scope-blue`,`scope-cyan`,`scope-green`,`scope-amber`,`scope-violet`,`scope-rose`];function jl(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;return Al[t%Al.length]??Al[0]}function Ml(e){let t=e.durationMs===void 0?void 0:`${Math.round(e.durationMs)}ms`;return e.httpStatus===void 0?t??`—`:t?`${e.httpStatus} (${t})`:String(e.httpStatus)}function Nl(e){if(!e)return`No matching response seen this session.`;let t=e.source===`captured`?`page traffic`:`fallback request`;return[`normalized=${e.records}`,`hidden=${e.hiddenViewerCounts}`,`startTimes=${e.startTimes}`,`source=${t}`].join(`; `)}function Pl(e){let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown`:wl.format(t)}function Fl(e){return Jl(`fontSize`,e===null?null:oe(e,10,24))}function Il(e){return Jl(`fontFamily`,ie(e))}function Ll(e){return Jl(`fontWeight`,ae(e))}function Rl(e){return Jl(`messageDividers`,e)}function zl(e){return Jl(`messageSpacing`,e===null?null:oe(e,0,12))}function Bl(){return Se(e=>e.chat.fontFamily===null&&e.chat.fontSize===null&&e.chat.fontWeight===null&&!e.chat.messageDividers&&e.chat.messageSpacing===null?e:{...e,chat:{fontFamily:null,fontSize:null,fontWeight:null,messageDividers:!1,messageSpacing:null}})}function Vl(e){return Yl(`showClipDownloadButtons`,e)}function Hl(e){return Yl(`showHiddenViewerCounts`,e)}function Ul(e){return Yl(`showStreamUptime`,e)}function Wl(e){return Yl(`hideFollowingRecommendations`,e)}function Gl(e){return Yl(`hideGamblingStreams`,e)}function Kl(e){return Yl(`hideHomepageCarousel`,e)}function ql(e){return Yl(`hideRecommendedChannels`,e)}function Jl(e,t){return Se(n=>({...n,chat:{...n.chat,[e]:t}}))}function Yl(e,t){return Se(n=>({...n,ui:{...n.ui,[e]:t}}))}function Xl({settings:e}){return P(`div`,{className:`ke-settings`,children:[P(W,{checked:e.showHiddenViewerCounts,description:`Restore KICK-reported viewer counts on live channels.`,label:`Show hidden viewer counts`,onCheckedChange:e=>{Hl(e)}}),P(W,{checked:e.showStreamUptime,description:`Show how long live streams have been running on thumbnails and sidebar tooltips.`,label:`Show stream uptime`,onCheckedChange:e=>{Ul(e)}}),P(W,{checked:e.showClipDownloadButtons,description:`Show KICK Enhancer download actions on clip cards and clip pages.`,label:`Show clip download buttons`,onCheckedChange:e=>{Vl(e)}})]})}function Zl({open:e,settings:t}){let n=Jt(()=>({fontSize:tu(`--chatroom-font-size`,14,10,24),messageSpacing:tu(`--chatroom-message-spacing`,4,0,12)}),[e]);return P(`div`,{className:`ke-settings`,children:[P(Bn,{description:`Change the typeface used throughout the chatroom.`,label:`Chat font`,onValueChange:e=>{Il(e==="default"?null:e)},options:eu,value:t.fontFamily??`default`}),P(Hn,{description:`Adjust message text without changing usernames, timestamps, or controls.`,formatValue:e=>t.fontWeight===null?`KICK default (${e})`:String(e),label:`Message font weight`,max:900,min:100,onValueChange:e=>{Ll(e)},step:100,value:t.fontWeight??400}),P(Hn,{description:`Adjust chat messages, timestamps, replies, and emotes together.`,formatValue:e=>t.fontSize===null?`KICK default (${e}px)`:`${e}px`,label:`Chat font size`,max:24,min:10,onValueChange:e=>{Fl(e)},step:1,value:t.fontSize??n.fontSize}),P(Hn,{description:`Adjust the vertical space inside each chat message.`,formatValue:e=>t.messageSpacing===null?`KICK default (${e}px)`:`${e}px`,label:`Message spacing`,max:12,min:0,onValueChange:e=>{zl(e)},step:1,value:t.messageSpacing??n.messageSpacing}),P(W,{checked:t.messageDividers,description:`Add a subtle divider between chat messages.`,label:`Message dividers`,onCheckedChange:e=>{Rl(e)}}),P(`div`,{className:`ke-settings__actions`,children:P(U,{density:`compact`,disabled:t.fontFamily===null&&t.fontSize===null&&t.fontWeight===null&&!t.messageDividers&&t.messageSpacing===null,onClick:()=>{Bl()},children:`Use KICK defaults`})})]})}function Ql({settings:e}){return P(`div`,{className:`ke-settings`,children:[P(W,{checked:e.hideHomepageCarousel,description:`Remove the featured autoplaying stream and chat from the homepage.`,label:`Hide homepage carousel`,onCheckedChange:e=>{Kl(e)}}),P(W,{checked:e.hideGamblingStreams,description:`Hide live followed gambling streams.`,label:`Hide followed gambling streams`,onCheckedChange:e=>{Gl(e)}}),P(W,{checked:e.hideFollowingRecommendations,description:`Remove the "Channels you might like" section from the Following page.`,label:`Hide "Channels you might like"`,onCheckedChange:e=>{Wl(e)}})]})}function $l({settings:e}){return P(`div`,{className:`ke-settings`,children:[P(W,{checked:e.hideRecommendedChannels,description:`Remove recommended channels and their controls from the sidebar.`,label:`Hide recommended channels`,onCheckedChange:e=>{ql(e)}}),P(W,{checked:e.rememberSidebarState,description:`Restore the sidebar to its last expanded or collapsed state on reloads.`,label:`Remember sidebar state`,onCheckedChange:e=>{Qa(e)}})]})}var eu=[{label:`KICK default`,value:`default`},{label:`Arial`,value:`arial`},{label:`Verdana`,value:`verdana`},{label:`Tahoma`,value:`tahoma`},{label:`Trebuchet MS`,value:`trebuchet`},{label:`Georgia`,value:`georgia`},{label:`Monospace`,value:`monospace`}];function tu(e,t,n,r){return oe(Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)),n,r)??t}var nu=`https://github.com/sixem/kick-enhancer`;function ru({onRequestClose:e,open:t,settings:n}){let[r,i]=L(`about`),[a,o]=L(null),s=a!==null,c=()=>o(null);R(()=>{t||o(null)},[t]);let l=(e,t)=>{o({description:t,onConfirm:c,onDismiss:c,title:e})};return P(Un,{className:`ke-workspace-modal ke-settings-modal`,description:`Customize how KICK behaves and looks.`,dismissDisabled:s,footer:P(j,{children:[P(U,{"aria-label":`Open KICK Enhancer on GitHub`,className:`ke-settings-modal__github`,disabled:s,onClick:()=>{window.open(nu,`_blank`,`noopener,noreferrer`)},children:[P(xt,{class:`ke-settings-modal__github-icon`}),`GitHub`]}),P(U,{disabled:s,onClick:()=>{o({confirmLabel:`Reset settings`,confirmTone:`danger`,description:`This restores every KICK Enhancer setting to its default value.`,onCancel:c,onConfirm:()=>{ve(),c()},title:`Reset all settings?`})},tone:`danger`,children:`Reset to defaults`}),P(U,{className:`ke-button--primary`,disabled:s,onClick:e,children:`Done`})]}),icon:nn,onRequestClose:e,open:t,title:`KICK Enhancer`,children:P(`div`,{className:`ke-confirmation-host`,children:[P(`div`,{"aria-hidden":s||void 0,className:`ke-settings-modal__tabs`,inert:s,children:P(Kn,{ariaLabel:`KICK Enhancer settings`,onChange:i,tabs:[{content:P(ol,{onImportError:()=>l(`Could not import settings`,`Choose a valid KICK Enhancer settings JSON file and try again.`),onImportRequest:(e,t)=>{o({confirmLabel:`Import settings`,description:t?`Some values are missing, unknown, or invalid. Compatible settings will be imported and unsupported values will use current defaults.`:`This will replace every current setting with the values from this file.`,onCancel:c,onConfirm:()=>{ye(e),c()},title:t?`Import settings with warnings?`:`Import settings?`})}}),contentClassName:`ke-tabs__panel-content--centered`,id:`about`,label:`About`},{content:P(Xl,{settings:n.ui}),id:`streams`,label:`Streams / Clips`},{content:P(Zl,{open:t,settings:n.chat}),id:`chat`,label:`Chat`},{content:P(Ql,{settings:n.ui}),id:`content`,label:`Content`},{content:P($l,{settings:n.ui}),id:`sidebar`,label:`Sidebar`},{content:P(Ol,{active:r===`diagnostics`,onShowMessage:l}),id:`diagnostics`,label:`Diagnostics`}],value:r})}),a?P(il,{...a,open:!0}):null]})})}function iu(){let[e,t]=L(_e);return R(()=>be(t),[]),e}var au=`.ke-about{text-align:center;justify-items:center;gap:1rem;display:grid}.ke-about__icon{object-fit:contain;width:4rem;height:4rem}.ke-about__identity{gap:.2rem;display:grid}.ke-about__title{color:#f2f2f2;margin:0;font-size:1.2rem;font-weight:750;line-height:1.25}.ke-about__version{color:#8c8c8c;font-variant-numeric:tabular-nums;margin:0;font-size:.75rem}.ke-about__description{color:#747474;margin:0;font-size:.825rem;font-weight:500;line-height:1.5}.ke-about__actions{flex-wrap:wrap;justify-content:center;gap:.65rem;display:flex}.ke-diagnostics{gap:1.5rem;display:grid}.ke-diagnostics__section{gap:.8rem;min-width:0;display:grid}.ke-diagnostics__section-heading{justify-content:space-between;align-items:flex-start;gap:1rem;min-width:0;display:flex}.ke-diagnostics__title{color:#f2f2f2;margin:0;font-size:.9rem;font-weight:750;line-height:1.3}.ke-diagnostics__description{color:#747474;margin:.25rem 0 0;font-size:.76rem;font-weight:500;line-height:1.45}.ke-diagnostics__check-controls{grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:.65rem;display:grid}.ke-diagnostics__actions{flex:none;gap:.45rem;display:flex}.ke-diagnostics__check-list{max-height:8.5rem}.ke-diagnostics__check-list .ke-list-view__empty{text-overflow:ellipsis;white-space:nowrap;min-height:2.125rem;padding:.42rem .6rem;overflow:hidden}.ke-diagnostics__observation-list{height:13rem}.ke-diagnostics__log-list{height:13.25rem}.ke-diagnostics__pill{box-sizing:border-box;color:#8c8c8c;letter-spacing:.03em;text-transform:capitalize;border:1px solid #303030;border-radius:.3rem;justify-content:center;align-items:center;min-width:4.8rem;max-width:100%;padding:.12rem .42rem;font-size:.68rem;font-weight:750;line-height:1.35;display:inline-flex;overflow:hidden}.ke-diagnostics__pill[data-tone=passed],.ke-diagnostics__pill[data-tone=observed]{color:#53fc18;border-color:#53fc1866}.ke-diagnostics__pill[data-tone=degraded],.ke-diagnostics__pill[data-tone=unavailable],.ke-diagnostics__pill[data-tone=warn]{color:#f5c451;border-color:#f5c45166}.ke-diagnostics__pill[data-tone=failed],.ke-diagnostics__pill[data-tone=error]{color:#ff6b6b;border-color:#ff6b6b73}.ke-diagnostics__pill[data-tone=debug],.ke-diagnostics__pill[data-tone=info],.ke-diagnostics__pill[data-tone=warn],.ke-diagnostics__pill[data-tone=error]{text-transform:uppercase}.ke-diagnostics__pill[data-tone=info],.ke-diagnostics__pill[data-tone=scope-blue]{color:#a9cfff;border-color:#75b2ff6b}.ke-diagnostics__pill[data-tone^=scope-]{text-transform:none}.ke-diagnostics__pill[data-tone=scope-cyan]{color:#8bdce4;border-color:#5fd6e16b}.ke-diagnostics__pill[data-tone=scope-green]{color:#8eea70;border-color:#53fc185c}.ke-diagnostics__pill[data-tone=scope-amber]{color:#f5c451;border-color:#f5c45166}.ke-diagnostics__pill[data-tone=scope-violet]{color:#c6a9ff;border-color:#b38eff6b}.ke-diagnostics__pill[data-tone=scope-rose]{color:#f09bbb;border-color:#f280aa6b}.ke-diagnostics__pill-label{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.ke-diagnostics__details-cell{align-items:flex-start}.ke-diagnostics__details-cell .ke-list-view__cell-content{text-overflow:clip;white-space:normal;line-height:1.4;overflow:visible}.ke-diagnostics__log-controls{grid-template-columns:8rem minmax(0,1fr) auto;align-items:end;gap:.65rem;display:grid}.ke-diagnostics__log-message .ke-list-view__cell-content{line-height:1.4}@media (width<=36rem){.ke-diagnostics__section-heading{display:grid}.ke-diagnostics__actions{justify-content:flex-start}.ke-diagnostics__check-controls,.ke-diagnostics__log-controls{grid-template-columns:1fr}}.kick-enhancer-host{display:contents}.kick-enhancer-button{box-sizing:border-box;width:2.25rem;height:2.25rem;color:var(--neon-secondary-onSecondary,#fff);cursor:pointer;-webkit-user-select:none;user-select:none;background:var(--neon-secondary-base,#42474d);border:0;border-radius:.25rem;outline:0;flex:none;justify-content:center;align-items:center;padding:0;transition:background-color .15s,transform .1s;display:flex;position:relative;overflow:hidden}.kick-enhancer-button:after{pointer-events:none;content:"";border-radius:inherit;background:0 0;position:absolute;inset:0}.kick-enhancer-button:hover:after{background:var(--neon-stateLayer-surfaceHover,#f0f1f20a)}.kick-enhancer-button:focus-visible{outline:2px solid var(--neon-focusLight,#fff);outline-offset:2px}.kick-enhancer-button:active{transform:scale(.95)}.kick-enhancer-button__icon{pointer-events:none;object-fit:contain;width:1.25rem;height:1.25rem;display:block}.kick-enhancer-download-button{overflow:visible}.kick-enhancer-download-button__icon{pointer-events:none;width:1.25rem;height:1.25rem}.kick-enhancer-download-button__badge{color:#071402;background:#53fc18;border:1px solid #050505;border-radius:.3rem;place-items:center;min-width:1rem;height:1rem;padding-inline:.2rem;font-size:.625rem;font-weight:800;line-height:1;display:grid;position:absolute;top:-.3rem;right:-.3rem}.kick-enhancer-download-button.needs-attention{box-shadow:inset 0 0 0 1px #53fc18}.kick-enhancer-download-button.is-error{box-shadow:inset 0 0 0 1px #ff6b6b}#sidebar-wrapper .bg-outline-decorative.h-px{display:none!important}#main-container :where(a[href^="/category/"].bg-secondary-base,a[href^="/category/"] .bg-secondary-base,:has(>a[href^="/category/"])>.bg-secondary-base,span.bg-secondary-base.rounded-full){background-color:#212931;border-radius:.3rem}`,ou=`button[data-testid="kicks-top-nav"]`,su=`nav button[data-testid="login"]`;function cu(e=document){return(e.querySelector(ou)??e.querySelector(su))?.parentElement??null}function lu(){let[e,t]=L(!1),n=Mi(),r=iu(),i=n.activeCount+n.queuedCount;return P(j,{children:[n.visible?P(`button`,{"aria-label":n.attention?`Open Download Manager; a download needs attention`:`Open Download Manager`,class:`kick-enhancer-button kick-enhancer-download-button${n.error?` is-error`:``}${n.attention?` needs-attention`:``}`,"data-kick-enhancer":`download-activity`,onClick:()=>wi(),type:`button`,children:[n.activeCount>0?P(St,{class:`ke-icon kick-enhancer-download-button__icon ke-icon--spinner`}):P(bt,{class:`ke-icon kick-enhancer-download-button__icon`}),i>0?P(`span`,{"aria-label":`${i} active or queued downloads`,className:`kick-enhancer-download-button__badge`,children:i>9?`9+`:i}):null]}):null,P(`button`,{"aria-label":`Open KICK Enhancer settings`,class:`kick-enhancer-button`,"data-kick-enhancer":`top-nav-button`,onClick:()=>t(!0),type:`button`,children:P(`img`,{alt:``,class:`kick-enhancer-button__icon`,draggable:!1,src:nn})}),P(ru,{onRequestClose:()=>t(!1),open:e,settings:r})]})}var uu=`kick-enhancer-top-nav`,du=`kick-enhancer-styles`,fu=null,pu;function mu(){if(vt(),document.getElementById(du))return;let e=document.createElement(`style`);e.id=du,e.textContent=au,document.documentElement.append(e)}function hu(){if(fu&&!fu.isConnected&&(N(null,fu),fu=null),document.getElementById(uu))return;let e=cu();if(!e)return;let t=document.createElement(`span`);t.id=uu,t.className=`kick-enhancer-host`,e.prepend(t),fu=t,N(P(lu,{}),t)}function gu(){pu?.(),mu(),hu();let e=!1,t=!1,n=new MutationObserver(()=>{t||e||document.getElementById(uu)||(e=!0,queueMicrotask(()=>{e=!1,t||hu()}))});n.observe(document.documentElement,{childList:!0,subtree:!0});let r=()=>{if(t)return;t=!0,n.disconnect();let e=fu??document.getElementById(uu);e&&(N(null,e),e.remove()),fu=null,document.getElementById(du)?.remove(),pu===r&&(pu=void 0)};return pu=r,r}var _u=x(`app`),vu;Rc();async function yu(){await ge(),vu?.(),vu=rl(De(),ga(),zc(),ba(),Ia(),La(),Ra(),$a(),gu()),_u.info(`Ready`)}yu()})();