diff --git a/cmd/telesrv-admin/readstore.go b/cmd/telesrv-admin/readstore.go index b0bc17df..fbfca184 100644 --- a/cmd/telesrv-admin/readstore.go +++ b/cmd/telesrv-admin/readstore.go @@ -392,6 +392,7 @@ WHERE NOT u.is_bot OR lower((u.username)::text) LIKE $3 OR p.username_lower = $4 OR lower(TRIM(BOTH FROM ((u.first_name)::text || ' '::text || (u.last_name)::text))) LIKE $3 + OR lower(COALESCE(ap.login_email, '')) LIKE $3 ) AND ($5::bigint = 0 OR (COALESCE(a.last_active_at, '0001-01-01 00:00:00+00'::timestamptz), u.id) < (to_timestamp(($5::double precision) / 1000000.0), $6::bigint)) ORDER BY COALESCE(a.last_active_at, '0001-01-01 00:00:00+00'::timestamptz) DESC, u.id DESC diff --git a/cmd/telesrv-admin/web/dist/assets/index-COMz6S13.js b/cmd/telesrv-admin/web/dist/assets/index-COMz6S13.js new file mode 100644 index 00000000..04a0363e --- /dev/null +++ b/cmd/telesrv-admin/web/dist/assets/index-COMz6S13.js @@ -0,0 +1,10 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-Ee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u(),n=f();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},m={};function h(e){return l.call(m,e)?!0:l.call(p,e)?!1:d.test(e)?m[e]=!0:(p[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{re=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ne(e):``}function ae(e){switch(e.tag){case 5:return ne(e.type);case 16:return ne(`Lazy`);case 13:return ne(`Suspense`);case 19:return ne(`SuspenseList`);case 0:case 2:case 15:return e=ie(e.type,!1),e;case 11:return e=ie(e.type.render,!1),e;case 1:return e=ie(e.type,!0),e;default:return``}}function oe(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?oe(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}function se(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return oe(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function ce(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function le(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ue(e){var t=le(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function z(e){e._valueTracker||=ue(e)}function de(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=le(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function fe(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function B(e,t){var n=t.checked;return R({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function pe(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=ce(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function me(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function he(e,t){me(e,t);var n=ce(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?_e(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&_e(e,t.type,ce(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ge(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function _e(e,t,n){(t!==`number`||fe(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ve=Array.isArray;function ye(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=Te.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function De(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Oe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ke=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Oe).forEach(function(e){ke.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Oe[t]=Oe[e]})});function Ae(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Oe.hasOwnProperty(e)&&Oe[e]?(``+t).trim():t+`px`}function je(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ae(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Me=R({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ne(e,t){if(t){if(Me[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Pe(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Fe=null;function Ie(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Le=null,Re=null,ze=null;function Be(e){if(e=Ai(e)){if(typeof Le!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Mi(t),Le(e.stateNode,e.type,t))}}function Ve(e){Re?ze?ze.push(e):ze=[e]:Re=e}function He(){if(Re){var e=Re,t=ze;if(ze=Re=null,Be(e),t)for(e=0;e>>=0,e===0?32:31-(K(e)/q|0)|0}var Y=64,X=4194304;function xt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function St(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=xt(a))):r=xt(s)}else o=n&~i,o===0?a!==0&&(r=xt(a)):r=xt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Ot(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-bt(t),e[t]=n}function kt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Wn),qn=` `,Jn=!1;function Yn(e,t){switch(e){case`keyup`:return Hn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Xn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Zn=!1;function Qn(e,t){switch(e){case`compositionend`:return Xn(t);case`keypress`:return t.which===32?(Jn=!0,qn):null;case`textInput`:return e=t.data,e===qn&&Jn?null:e;default:return null}}function $n(e,t){if(Zn)return e===`compositionend`||!Un&&Yn(e,t)?(e=pn(),fn=dn=un=null,Zn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=br(n)}}function Sr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Cr(){for(var e=window,t=fe();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=fe(e.document)}return t}function wr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Tr(e){var t=Cr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Sr(n.ownerDocument.documentElement,n)){if(r!==null&&wr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=xr(n,a);var o=xr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n=document.documentMode,Dr=null,Or=null,kr=null,Ar=!1;function jr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ar||Dr==null||Dr!==fe(r)||(r=Dr,`selectionStart`in r&&wr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kr&&yr(kr,r)||(kr=r,r=ri(Or,`onSelect`),0Pi||(e.current=Ni[Pi],Ni[Pi]=null,Pi--)}function Li(e,t){Pi++,Ni[Pi]=e.current,e.current=t}var Ri={},zi=Fi(Ri),Bi=Fi(!1),Vi=Ri;function Hi(e,t){var n=e.type.contextTypes;if(!n)return Ri;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ui(e){return e=e.childContextTypes,e!=null}function Wi(){Ii(Bi),Ii(zi)}function Gi(e,t,n){if(zi.current!==Ri)throw Error(r(168));Li(zi,t),Li(Bi,n)}function Ki(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,se(e)||`Unknown`,a));return R({},n,i)}function qi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ri,Vi=zi.current,Li(zi,e),Li(Bi,Bi.current),!0}function Ji(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Ki(e,t,Vi),i.__reactInternalMemoizedMergedChildContext=e,Ii(Bi),Ii(zi),Li(zi,e)):Ii(Bi),Li(Bi,n)}var Yi=null,Xi=!1,Zi=!1;function Qi(e){Yi===null?Yi=[e]:Yi.push(e)}function $i(e){Xi=!0,Qi(e)}function ea(){if(!Zi&&Yi!==null){Zi=!0;var e=0,t=jt;try{var n=Yi;for(jt=1;e>=o,i-=o,ca=1<<32-bt(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),ga&&ua(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ga&&ua(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ga&&ua(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ga&&ua(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&Aa(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Oa(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=Oa(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(ve(i))return h(e,r,i,o);if(ee(i))return g(e,r,i,o);ka(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ma=ja(!0),Na=ja(!1),Pa=Fi(null),Fa=null,Ia=null,La=null;function Ra(){La=Ia=Fa=null}function za(e){var t=Pa.current;Ii(Pa),e._currentValue=t}function Ba(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Va(e,t){Fa=e,La=Ia=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(js=!0),e.firstContext=null)}function Ha(e){var t=e._currentValue;if(La!==e)if(e={context:e,memoizedValue:t,next:null},Ia===null){if(Fa===null)throw Error(r(308));Ia=e,Fa.dependencies={lanes:0,firstContext:e}}else Ia=Ia.next=e;return t}var Ua=null;function Wa(e){Ua===null?Ua=[e]:Ua.push(e)}function Ga(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Wa(t)):(n.next=i.next,i.next=n),t.interleaved=n,Ka(e,r)}function Ka(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var qa=!1;function Ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ya(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Xa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Bc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Ka(e,n)}return i=r.interleaved,i===null?(t.next=t,Wa(r)):(t.next=i.next,i.next=t),r.interleaved=t,Ka(e,n)}function Qa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,At(e,n)}}function $a(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function eo(e,t,n,r){var i=e.updateQueue;qa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=R({},d,f);break a;case 2:qa=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Jc|=o,e.lanes=o,e.memoizedState=d}}function to(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=_o.transition;_o.transition={};try{e(!1),t()}finally{jt=n,_o.transition=r}}function is(){return jo().memoizedState}function as(e,t,n){var r=pl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ss(e))cs(t,n);else if(n=Ga(e,t,n,r),n!==null){var i=fl();ml(n,e,r,i),ls(n,t,r)}}function os(e,t,n){var r=pl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ss(e))cs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Q(s,o)){var c=t.interleaved;c===null?(i.next=i,Wa(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Ga(e,t,i,r),n!==null&&(i=fl(),ml(n,e,r,i),ls(n,t,r))}}function ss(e){var t=e.alternate;return e===yo||t!==null&&t===yo}function cs(e,t){Co=So=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ls(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,At(e,n)}}var us={readContext:Ha,useCallback:Eo,useContext:Eo,useEffect:Eo,useImperativeHandle:Eo,useInsertionEffect:Eo,useLayoutEffect:Eo,useMemo:Eo,useReducer:Eo,useRef:Eo,useState:Eo,useDebugValue:Eo,useDeferredValue:Eo,useTransition:Eo,useMutableSource:Eo,useSyncExternalStore:Eo,useId:Eo,unstable_isNewReconciler:!1},ds={readContext:Ha,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:Ha,useEffect:qo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Go(4194308,4,Zo.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Go(4194308,4,e,t)},useInsertionEffect:function(e,t){return Go(4,2,e,t)},useMemo:function(e,t){var n=Ao();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ao();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=as.bind(null,yo,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:Ho,useDebugValue:$o,useDeferredValue:function(e){return Ao().memoizedState=e},useTransition:function(){var e=Ho(!1),t=e[0];return e=rs.bind(null,e[1]),Ao().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=yo,a=Ao();if(ga){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Vc===null)throw Error(r(349));vo&30||Lo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,qo(zo.bind(null,i,o,e),[e]),i.flags|=2048,Uo(9,Ro.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Ao(),t=Vc.identifierPrefix;if(ga){var n=la,r=ca;n=(r&~(1<<32-bt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=wo++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Ci]=t,e[wi]=i,tc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Pe(n,i),n){case`dialog`:Xr(`cancel`,e),Xr(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:Xr(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;oel&&(t.flags|=128,i=!0,ic(s,!1),t.lanes=4194304)}else{if(!i)if(e=po(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ic(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!ga)return ac(t),null}else 2*dt()-s.renderingStartTime>el&&n!==1073741824&&(t.flags|=128,i=!0,ic(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(ac(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=dt(),t.sibling=null,n=fo.current,Li(fo,i?n&1|2:n&1),t);case 22:case 23:return wl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Wc&1073741824&&(ac(t),t.subtreeFlags&6&&(t.flags|=8192)):ac(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function sc(e,t){switch(pa(t),t.tag){case 1:return Ui(t.type)&&Wi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return co(),Ii(Bi),Ii(zi),ho(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return uo(t),null;case 13:if(Ii(fo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ta()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ii(fo),null;case 4:return co(),null;case 10:return za(t.type._context),null;case 22:case 23:return wl(),null;case 24:return null;default:return null}}var cc=!1,lc=!1,uc=typeof WeakSet==`function`?WeakSet:Set,$=null;function dc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Rl(e,t,n)}else n.current=null}function fc(e,t,n){try{n()}catch(n){Rl(e,t,n)}}var pc=!1;function mc(e,t){if(di=nn,e=Cr(),wr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(fi={focusedElem:e,selectionRange:n},nn=!1,$=t;$!==null;)if(t=$,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:ms(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Rl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return h=pc,pc=!1,h}function hc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&fc(t,n,a)}i=i.next}while(i!==r)}}function gc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function _c(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function vc(e){var t=e.alternate;t!==null&&(e.alternate=null,vc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ci],delete t[wi],delete t[Ei],delete t[Di],delete t[Oi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function yc(e){return e.tag===5||e.tag===3||e.tag===4}function bc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||yc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ui));else if(r!==4&&(e=e.child,e!==null))for(xc(e,t,n),e=e.sibling;e!==null;)xc(e,t,n),e=e.sibling}function Sc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Sc(e,t,n),e=e.sibling;e!==null;)Sc(e,t,n),e=e.sibling}var Cc=null,wc=!1;function Tc(e,t,n){for(n=n.child;n!==null;)Ec(e,t,n),n=n.sibling}function Ec(e,t,n){if(vt&&typeof vt.onCommitFiberUnmount==`function`)try{vt.onCommitFiberUnmount(G,n)}catch{}switch(n.tag){case 5:lc||dc(n,t);case 6:var r=Cc,i=wc;Cc=null,Tc(e,t,n),Cc=r,wc=i,Cc!==null&&(wc?(e=Cc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Cc.removeChild(n.stateNode));break;case 18:Cc!==null&&(wc?(e=Cc,n=n.stateNode,e.nodeType===8?yi(e.parentNode,n):e.nodeType===1&&yi(e,n),en(e)):yi(Cc,n.stateNode));break;case 4:r=Cc,i=wc,Cc=n.stateNode.containerInfo,wc=!0,Tc(e,t,n),Cc=r,wc=i;break;case 0:case 11:case 14:case 15:if(!lc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&fc(n,t,o),i=i.next}while(i!==r)}Tc(e,t,n);break;case 1:if(!lc&&(dc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Rl(n,t,e)}Tc(e,t,n);break;case 21:Tc(e,t,n);break;case 22:n.mode&1?(lc=(r=lc)||n.memoizedState!==null,Tc(e,t,n),lc=r):Tc(e,t,n);break;default:Tc(e,t,n)}}function Dc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new uc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Oc(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=dt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Ic(i/1960))-i,10e?16:e,ol===null)var i=!1;else{if(e=ol,ol=null,sl=0,Bc&6)throw Error(r(331));var a=Bc;for(Bc|=4,$=e.current;$!==null;){var o=$,s=o.child;if($.flags&16){var c=o.deletions;if(c!==null){for(var l=0;ldt()-$c?Tl(e,0):Xc|=n),hl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=X,X<<=1,!(X&130023424)&&(X=4194304)):t=1);var n=fl();e=Ka(e,t),e!==null&&(Ot(e,t,n),hl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Bi.current)js=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return js=!1,ec(e,t,n);js=!!(e.flags&131072)}else js=!1,ga&&t.flags&1048576&&da(t,ia,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;Qs(e,t),e=t.pendingProps;var a=Hi(t,zi.current);Va(t,n),a=Oo(null,t,i,e,a,n);var o=ko();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ui(i)?(o=!0,qi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Ja(t),a.updater=gs,t.stateNode=a,a._reactInternals=t,bs(t,i,e,n),t=Bs(null,t,i,!0,o,n)):(t.tag=0,ga&&o&&fa(t),Ms(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(Qs(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=ms(i,e),a){case 0:t=Rs(null,t,i,e,n);break a;case 1:t=zs(null,t,i,e,n);break a;case 11:t=Ns(null,t,i,e,n);break a;case 14:t=Ps(null,t,i,ms(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ms(i,a),Rs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ms(i,a),zs(e,t,i,a,n);case 3:a:{if(Vs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,Ya(e,t),eo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=xs(Error(r(423)),t),t=Hs(e,t,i,n,a);break a}else if(i!==a){a=xs(Error(r(424)),t),t=Hs(e,t,i,n,a);break a}else for(ha=bi(t.stateNode.containerInfo.firstChild),ma=t,ga=!0,_a=null,n=Na(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ta(),i===a){t=$s(e,t,n);break a}Ms(e,t,i,n)}t=t.child}return t;case 5:return lo(t),e===null&&xa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,pi(i,a)?s=null:o!==null&&pi(i,o)&&(t.flags|=32),Ls(e,t),Ms(e,t,s,n),t.child;case 6:return e===null&&xa(t),null;case 13:return Gs(e,t,n);case 4:return so(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ma(t,null,i,n):Ms(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ms(i,a),Ns(e,t,i,a,n);case 7:return Ms(e,t,t.pendingProps,n),t.child;case 8:return Ms(e,t,t.pendingProps.children,n),t.child;case 12:return Ms(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Li(Pa,i._currentValue),i._currentValue=s,o!==null)if(Q(o.value,s)){if(o.children===a.children&&!Bi.current){t=$s(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=Xa(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ba(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ba(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Ms(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Va(t,n),a=Ha(a),i=i(a),t.flags|=1,Ms(e,t,i,n),t.child;case 14:return i=t.type,a=ms(i,t.pendingProps),a=ms(i.type,a),Ps(e,t,i,a,n);case 15:return Fs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ms(i,a),Qs(e,t),t.tag=1,Ui(i)?(e=!0,qi(t)):e=!1,Va(t,n),vs(t,i,a),bs(t,i,a,n),Bs(null,t,i,!0,e,n);case 19:return Zs(e,t,n);case 22:return Is(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return st(e,t)}function Gl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return Zl(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Kl(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Kl(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=Kl(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Dt(0),this.expirationTimes=Dt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ja(a),e}function ru(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),g=c(u()),_=c(h(),1),v=class extends Error{status;constructor(e,t){super(t),this.status=e}},y=`telesrv_admin_csrf`,b=`X-CSRF-Token`,x=``;function S(e){x=(e??``).trim()}function C(){if(typeof document>`u`)return``;for(let e of document.cookie.split(`;`)){let t=e.trim(),n=t.indexOf(`=`);if(!(n<=0||t.slice(0,n)!==y))try{return decodeURIComponent(t.slice(n+1))}catch{return t.slice(n+1)}}return``}function w(){return C()||x}function T(e){let t=(e??`GET`).toUpperCase();return t!==`GET`&&t!==`HEAD`&&t!==`OPTIONS`}function E(e){if(!e)return{};if(e instanceof Headers){let t={};return e.forEach((e,n)=>{t[n]=e}),t}return Array.isArray(e)?Object.fromEntries(e):{...e}}async function D(e,t={}){let n=typeof FormData<`u`&&t.body instanceof FormData?{}:{"Content-Type":`application/json`};if(Object.assign(n,E(t.headers)),T(t.method)){let e=w();e&&(n[b]=e)}let r=await fetch(e,{credentials:`same-origin`,...t,headers:n}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok){let e=a?.error||a?.Error||a?.message||r.statusText;throw new v(r.status,e)}return a}function O(e){return e instanceof Error?e.message:String(e)}var k={session:()=>D(`/api/session`),login:async e=>{let t=await D(`/api/login`,{method:`POST`,body:JSON.stringify({secret:e})});return S(t.csrf_token),t},logout:()=>D(`/api/logout`,{method:`POST`,body:`{}`}),accounts:e=>D(`/api/accounts?${e.toString()}`),accountStats:()=>D(`/api/accounts/stats`),account:e=>D(`/api/accounts/${e}`),channels:e=>D(`/api/channels?${e.toString()}`),channel:e=>D(`/api/channels/${e}`),bots:e=>D(`/api/bots?${e.toString()}`),bot:e=>D(`/api/bots/${e}`),collectibleUsernames:e=>D(`/api/collectible-usernames?${e.toString()}`),collectibleUsername:e=>D(`/api/collectible-usernames/${encodeURIComponent(e)}`),accountRatings:e=>D(`/api/account-ratings?${e.toString()}`),accountRating:e=>D(`/api/account-ratings/${encodeURIComponent(e)}`),storageStats:()=>D(`/api/storage/stats`),storageAccounts:e=>D(`/api/storage/accounts?${e.toString()}`),verificationApplications:e=>D(`/api/verification/applications?${e.toString()}`),verificationApplication:e=>D(`/api/verification/applications/${encodeURIComponent(e)}`),verificationCounts:()=>D(`/api/verification/counts`),botVerifiers:e=>D(`/api/botverification/verifiers?${e.toString()}`),verificationIcons:e=>D(`/api/botverification/icons?${e.toString()}`),customVerifications:e=>D(`/api/botverification/marks?${e.toString()}`),customVerificationRequests:e=>D(`/api/botverification/requests?${e.toString()}`),customVerificationRequest:e=>D(`/api/botverification/requests/${encodeURIComponent(e)}`),botVerificationCounts:()=>D(`/api/botverification/counts`),emoji:e=>D(`/api/emoji?${e.toString()}`),emojiAnimation:e=>D(`/api/emoji/${encodeURIComponent(e)}/animation`),messages:e=>D(`/api/messages?${e.toString()}`),message:(e,t)=>D(`/api/messages/detail?${new URLSearchParams({owner_user_id:String(e),msg_id:String(t)}).toString()}`),groupMessages:e=>D(`/api/messages/groups?${e.toString()}`),groupMessage:(e,t)=>D(`/api/messages/groups/detail?${new URLSearchParams({channel_id:String(e),msg_id:String(t)}).toString()}`),moderationCases:e=>D(`/api/moderation/cases?${e.toString()}`),moderationCase:e=>D(`/api/moderation/cases/${e}`),moderationReport:e=>D(`/api/moderation/reports/${e}`),claimModerationCase:(e,t)=>D(`/api/moderation/cases/${e}/claim`,{method:`POST`,body:JSON.stringify({expected_version:t})}),decideModerationCase:(e,t)=>D(`/api/moderation/cases/${e}/decide`,{method:`POST`,body:JSON.stringify(t)}),reviewModerationAppeal:(e,t,n)=>D(`/api/moderation/cases/${e}/appeals/${t}/review`,{method:`POST`,body:JSON.stringify(n)}),gifts:()=>D(`/api/gifts`),stickerSets:e=>D(`/api/stickers?kind=${encodeURIComponent(e)}`),stickerSetDocuments:e=>D(`/api/stickers/${encodeURIComponent(e)}/documents`),stickerDocumentAnimationURL:e=>`/api/stickers/documents/${encodeURIComponent(e)}/animation`,createStickerSet:e=>D(`/api/actions/create-sticker-set`,{method:`POST`,body:e}),addStickerToSet:e=>D(`/api/actions/add-sticker-to-set`,{method:`POST`,body:e}),defaultGifts:()=>D(`/api/default-gifts`),defaultGiftAnimation:e=>D(`/api/default-gifts/${e}/animation`),officialGifts:()=>D(`/api/official-gifts`),officialGiftAnimation:e=>D(`/api/official-gifts/${encodeURIComponent(e)}/animation`),giftAnimation:e=>D(`/api/gifts/${encodeURIComponent(e)}/animation`),giftCollectibles:e=>D(`/api/gifts/${encodeURIComponent(e)}/collectibles`),giftCollectibleAnimation:(e,t,n)=>D(`/api/gifts/${encodeURIComponent(e)}/collectibles/${t}/${encodeURIComponent(n)}/animation`),importGift:e=>D(`/api/actions/import-gift`,{method:`POST`,body:e}),importDefaultGift:e=>D(`/api/actions/import-default-gift`,{method:`POST`,body:JSON.stringify(e)}),importOfficialGift:e=>D(`/api/actions/import-official-gift`,{method:`POST`,body:JSON.stringify(e)}),publishGiftCollectibles:(e,t)=>D(`/api/actions/publish-gift-collectibles?gift_id=${encodeURIComponent(e)}`,{method:`POST`,body:t}),action:(e,t)=>D(e,{method:`POST`,body:JSON.stringify(t)})},A=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),j=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),M={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},N=(0,g.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,g.createElement)(`svg`,{ref:c,...M,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:j(`lucide`,i),...s},[...o.map(([e,t])=>(0,g.createElement)(e,t)),...Array.isArray(a)?a:[a]])),P=(e,t)=>{let n=(0,g.forwardRef)(({className:n,...r},i)=>(0,g.createElement)(N,{ref:i,iconNode:t,className:j(`lucide-${A(e)}`,n),...r}));return n.displayName=`${e}`,n},F=P(`BadgeCheck`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),I=P(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),L=P(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ee=P(`CircleX`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),R=P(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),te=P(`ShieldX`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m14.5 9.5-5 5`,key:`17q4r4`}],[`path`,{d:`m9.5 9.5 5 5`,key:`18nt4w`}]]),ne=P(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),re=P(`ArrowLeftRight`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),ie=P(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),ae=P(`AtSign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),oe=P(`Ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.9 4.9 14.2 14.2`,key:`1m5liu`}]]),se=P(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),ce=P(`Building2`,[[`path`,{d:`M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z`,key:`1b4qmf`}],[`path`,{d:`M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2`,key:`i71pzd`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2`,key:`10jefs`}],[`path`,{d:`M10 6h4`,key:`1itunk`}],[`path`,{d:`M10 10h4`,key:`tcdvrf`}],[`path`,{d:`M10 14h4`,key:`kelpxr`}],[`path`,{d:`M10 18h4`,key:`1ulq68`}]]),le=P(`Cable`,[[`path`,{d:`M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1`,key:`10bnsj`}],[`path`,{d:`M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9`,key:`1eqmu1`}],[`path`,{d:`M21 21v-2h-4`,key:`14zm7j`}],[`path`,{d:`M3 5h4V3`,key:`z442eg`}],[`path`,{d:`M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3`,key:`ebdjd7`}]]),ue=P(`Calculator`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`line`,{x1:`8`,x2:`16`,y1:`6`,y2:`6`,key:`x4nwl0`}],[`line`,{x1:`16`,x2:`16`,y1:`14`,y2:`18`,key:`wjye3r`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]),z=P(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),de=P(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),fe=P(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),B=P(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),pe=P(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),me=P(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),he=P(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ge=P(`FileJson2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),_e=P(`FileJson`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),ve=P(`Flame`,[[`path`,{d:`M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z`,key:`96xj49`}]]),ye=P(`Gem`,[[`path`,{d:`M6 3h12l4 6-10 13L2 9Z`,key:`1pcd5k`}],[`path`,{d:`M11 3 8 9l4 13 4-13-3-6`,key:`1fcu3u`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),be=P(`Gift`,[[`rect`,{x:`3`,y:`8`,width:`18`,height:`4`,rx:`1`,key:`bkv52`}],[`path`,{d:`M12 8v13`,key:`1c76mn`}],[`path`,{d:`M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7`,key:`6wjy6b`}],[`path`,{d:`M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5`,key:`1ihvrl`}]]),V=P(`Handshake`,[[`path`,{d:`m11 17 2 2a1 1 0 1 0 3-3`,key:`efffak`}],[`path`,{d:`m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4`,key:`9pr0kb`}],[`path`,{d:`m21 3 1 11h-2`,key:`1tisrp`}],[`path`,{d:`M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3`,key:`1uvwmv`}],[`path`,{d:`M3 4h8`,key:`1ep09j`}]]),xe=P(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Se=P(`ImageOff`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),Ce=P(`LayoutDashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),we=P(`LifeBuoy`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.93 4.93 4.24 4.24`,key:`1ymg45`}],[`path`,{d:`m14.83 9.17 4.24-4.24`,key:`1cb5xl`}],[`path`,{d:`m14.83 14.83 4.24 4.24`,key:`q42g0n`}],[`path`,{d:`m9.17 14.83-4.24 4.24`,key:`bqpfvv`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]),Te=P(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),Ee=P(`MessageSquareText`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M13 8H7`,key:`14i4kc`}],[`path`,{d:`M17 12H7`,key:`16if0g`}]]),De=P(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),Oe=P(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),ke=P(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),Ae=P(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),je=P(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Me=P(`PowerOff`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ne=P(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Pe=P(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Fe=P(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),Ie=P(`Send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Le=P(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Re=P(`ShieldAlert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),ze=P(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Be=P(`ShieldOff`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Ve=P(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),He=P(`Smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),H=P(`Stamp`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M19.27 13.73A2.5 2.5 0 0 0 17.5 13h-11A2.5 2.5 0 0 0 4 15.5V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-1.5c0-.66-.26-1.3-.73-1.77Z`,key:`1sy9ra`}],[`path`,{d:`M14 13V8.5C14 7 15 7 15 5a3 3 0 0 0-3-3c-1.66 0-3 1-3 3s1 2 1 3.5V13`,key:`cnxgux`}]]),Ue=P(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),We=P(`Sticker`,[[`path`,{d:`M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3Z`,key:`1wis1t`}],[`path`,{d:`M14 3v4a2 2 0 0 0 2 2h4`,key:`36rjfy`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M10 16s.8 1 2 1c1.3 0 2-1 2-1`,key:`1vvgv3`}]]),Ge=P(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Ke=P(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),qe=P(`Trophy`,[[`path`,{d:`M6 9H4.5a2.5 2.5 0 0 1 0-5H6`,key:`17hqa7`}],[`path`,{d:`M18 9h1.5a2.5 2.5 0 0 0 0-5H18`,key:`lmptdp`}],[`path`,{d:`M4 22h16`,key:`57wxv0`}],[`path`,{d:`M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22`,key:`1nw9bq`}],[`path`,{d:`M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22`,key:`1np0yb`}],[`path`,{d:`M18 2H6v7a6 6 0 0 0 12 0V2Z`,key:`u46fv3`}]]),Je=P(`Undo2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Ye=P(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),Xe=P(`User`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Ze=P(`Users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`1da9ce`}]]),Qe=P(`Vault`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}],[`path`,{d:`m7.9 7.9 2.7 2.7`,key:`hpeyl3`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}],[`path`,{d:`m13.4 10.6 2.7-2.7`,key:`264c1n`}],[`circle`,{cx:`7.5`,cy:`16.5`,r:`.5`,fill:`currentColor`,key:`nkw3mc`}],[`path`,{d:`m7.9 16.1 2.7-2.7`,key:`p81g5e`}],[`circle`,{cx:`16.5`,cy:`16.5`,r:`.5`,fill:`currentColor`,key:`fubopw`}],[`path`,{d:`m13.4 13.4 2.7 2.7`,key:`abhel3`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),$e=P(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function et(e){let t=e.trim();return!t||t.startsWith(`+`)?t:/^\d+$/.test(t)?`+${t}`:t}function U(e){let t=e.trim();return t?t.startsWith(`@`)?t:`@${t}`:``}function tt(e){return`${e.FirstName||``} ${e.LastName||``}`.trim()||`-`}function nt(e){return e.Broadcast&&!e.Megagroup?`Channel`:e.Megagroup&&e.Forum?`Supergroup / Forum`:e.Megagroup?`Supergroup`:`Channel / Group`}function W(e){if(!e||e.startsWith(`0001-`))return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString()}function rt(e){if(!e||e<=0)return``;let t=new Date(e*1e3);return Number.isNaN(t.getTime())?``:t.toLocaleString()}function it(e){let t=(e??``).trim();if(!/^https?:\/\//i.test(t))return``;try{let e=new URL(t);return e.protocol!==`http:`&&e.protocol!==`https:`?``:e.href}catch{return``}}function at(e){if(!e.trim())return 0;let t=Number.parseInt(e,10);return Number.isFinite(t)?t:0}function ot(e){let t=(e??``).trim();if(!t)return 0;let n=Number(t);return Number.isFinite(n)?n:0}function st(e){let t=(e??``).trim();if(!t)return`0`;let n=Number(t);return Number.isFinite(n)?n.toLocaleString():t}var ct={XTR:0,TON:9,USD:2,EUR:2,RUB:2};function lt(e){let t=(e??``).trim().toUpperCase();return t in ct?ct[t]:2}function ut(e,t){let n=(e??``).trim();if(!n)return`0`;if(!/^-?\d+$/.test(n))return n;let r=lt(t),i=n.startsWith(`-`),a=(i?n.slice(1):n).replace(/^0+(?=\d)/,``).padStart(r+1,`0`),o=a.slice(0,a.length-r)||`0`,s=r>0?a.slice(a.length-r):``;r>2&&(s=s.replace(/0+$/,``));let c=i?`-`:``;return s?`${c}${dt(o)}.${s}`:`${c}${dt(o)}`}function dt(e){return e.replace(/\B(?=(\d{3})+(?!\d))/g,` `)}function ft(e,t){let n=(t??``).trim().toUpperCase(),r=ut(e,n);return n?`${r} ${n}`:r}function pt(e,t){let n=(e??``).trim().replace(/\s+/g,``).replace(`,`,`.`);if(!n)return`0`;if(!/^\d*(\.\d*)?$/.test(n)||n===`.`)return null;let r=lt(t),[i,a=``]=n.split(`.`);if(a.length>r)return null;let o=`${i||`0`}${a.padEnd(r,`0`)}`.replace(/^0+(?=\d)/,``);return o===``?`0`:o}function mt(e){let t=(e??``).trim();if(!t||!/^\d+$/.test(t))return`0 B`;let n=Number(t);if(!Number.isFinite(n))return`${t} B`;let r=[`B`,`KB`,`MB`,`GB`,`TB`,`PB`],i=n,a=0;for(;i>=1024&&a0?`+${n.toLocaleString()}`:n.toLocaleString():t}function gt(e,t=`msg ids invalid`){let n=e.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean).map(e=>Number.parseInt(e,10));if(n.length===0||n.some(e=>!Number.isFinite(e)||e<=0))throw Error(t);return n}var _t=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),G=o(((e,t)=>{t.exports=_t()}))();function vt({title:e,eyebrow:t,children:n,actions:r}){return(0,G.jsxs)(`div`,{className:`page-frame`,children:[(0,G.jsxs)(`div`,{className:`page-title-row`,children:[(0,G.jsxs)(`div`,{children:[t&&(0,G.jsx)(`div`,{className:`eyebrow`,children:t}),(0,G.jsx)(`h2`,{children:e})]}),r&&(0,G.jsx)(`div`,{className:`page-actions`,children:r})]}),n]})}function yt({children:e}){return(0,G.jsx)(`div`,{className:`query-panel`,children:e})}function bt({main:e,side:t}){return(0,G.jsxs)(`div`,{className:`split-layout`,children:[(0,G.jsx)(`div`,{className:`split-main`,children:e}),(0,G.jsx)(`aside`,{className:`split-side`,children:t})]})}function K({title:e,text:t,action:n}){return(0,G.jsxs)(`div`,{className:`section-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:e}),t&&(0,G.jsx)(`p`,{children:t})]}),n&&(0,G.jsx)(`div`,{className:`section-action`,children:n})]})}function q({children:e}){return(0,G.jsxs)(`div`,{className:`alert`,children:[(0,G.jsx)(I,{size:16}),` `,(0,G.jsx)(`span`,{children:e})]})}function J({children:e,tone:t=`neutral`}){return(0,G.jsx)(`span`,{className:`badge ${t}`,children:e})}function Y({label:e,value:t,tone:n=`neutral`,mono:r=!1}){return(0,G.jsxs)(`div`,{className:`metric ${n}`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`strong`,{className:r?`mono`:``,children:t})]})}function X({label:e,value:t,mono:n=!1}){return(0,G.jsxs)(`div`,{className:`summary-item`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`strong`,{className:n?`mono`:``,children:t})]})}function xt({rows:e}){return(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Command ID`}),(0,G.jsx)(`th`,{children:`Action`}),(0,G.jsx)(`th`,{children:`Actor`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Dry-run`}),(0,G.jsx)(`th`,{children:`Reason`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[e.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:e.ID}),(0,G.jsx)(`td`,{className:`mono`,children:e.CommandID}),(0,G.jsx)(`td`,{children:e.Action}),(0,G.jsx)(`td`,{children:e.Actor}),(0,G.jsx)(`td`,{children:e.Status}),(0,G.jsx)(`td`,{children:e.DryRun?`Yes`:`No`}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Reason}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)})]},e.ID)),e.length===0&&(0,G.jsx)(St,{colSpan:8})]})]})})}function St({colSpan:e}){return(0,G.jsx)(`tr`,{children:(0,G.jsx)(`td`,{colSpan:e,className:`empty-cell`,children:`No results`})})}function Ct({label:e}){return(0,G.jsx)(`section`,{className:`surface`,children:(0,G.jsx)(`div`,{className:`loading-line`,children:e})})}function wt({value:e}){return(0,G.jsx)(`pre`,{className:`json-block`,children:e||`{}`})}function Tt({username:e,collectibles:t}){let n=U(e??``),r=t??[];return r.length===0?(0,G.jsx)(G.Fragment,{children:n||`-`}):(0,G.jsxs)(G.Fragment,{children:[n,(0,G.jsx)(`ul`,{className:`username-branch`,children:r.map(e=>(0,G.jsxs)(`li`,{className:e.Active?``:`inactive`,children:[(0,G.jsx)(`span`,{children:U(e.Username)}),!e.Active&&(0,G.jsx)(`em`,{children:`inactive`})]},e.Username))})]})}var Et=`verification.review`,Dt=`botverification.review`,Ot=`botverification.manage`,kt=(0,g.createContext)([]);function At({permissions:e,children:t}){return(0,G.jsx)(kt.Provider,{value:e,children:t})}function jt(){let e=(0,g.useContext)(kt);return(0,g.useMemo)(()=>({permissions:e,can:t=>e.includes(`*`)||e.includes(t)}),[e])}function Mt(e){return jt().can(e)}function Nt({permission:e,children:t}){let{can:n}=jt();return n(e)?(0,G.jsx)(G.Fragment,{children:t}):(0,G.jsx)(Pt,{permission:e})}function Pt({permission:e}){return(0,G.jsxs)(vt,{title:`Not enough rights`,eyebrow:`Console / Access`,children:[(0,G.jsx)(q,{children:`This session was not granted the ${e} permission, so the section stays closed.`}),(0,G.jsx)(`section`,{className:`section-block`,children:(0,G.jsx)(`div`,{className:`entity-head`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`entity-title`,children:[(0,G.jsx)(Be,{size:16}),` `,`Section unavailable`]}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:`Ask an operator to add the permission to TELESRV_ADMIN_UI_PERMISSIONS and sign in again.`})]})})})]})}function Ft(){return{href:`${window.location.pathname}${window.location.search}`,path:window.location.pathname,search:new URLSearchParams(window.location.search)}}function It(e){return e.startsWith(`/bot-verification`)?`Third-party verification`:e.startsWith(`/verification`)?`Official Verification`:e.startsWith(`/collectible-usernames`)?`Collectible Usernames`:e.startsWith(`/account-ratings`)?`Account Rating`:e.startsWith(`/storage`)?`Storage`:e.startsWith(`/accounts`)?`Accounts`:e.startsWith(`/channels`)?`Supergroups and Channels`:e.startsWith(`/bots`)?`Bots`:e.startsWith(`/moderation`)?`Reports and Moderation`:e.startsWith(`/emoji`)?`Emoji`:e.startsWith(`/messages`)?`Message Audit`:e.startsWith(`/give-gifts`)?`Give Gifts`:e.startsWith(`/gifts`)?`Star Gifts`:e.startsWith(`/stickers`)?`Stickers`:e.startsWith(`/emoji`)?`Emoji`:`Operations Console`}var Lt=`telesrv.admin.theme`,Rt=(0,g.createContext)(null);function zt(e){document.documentElement.setAttribute(`data-theme`,e),document.documentElement.style.colorScheme=e}function Bt({children:e}){let[t,n]=(0,g.useState)(()=>Ut());(0,g.useEffect)(()=>{zt(t);try{localStorage.setItem(Lt,t)}catch{}},[t]),(0,g.useEffect)(()=>{if(!window.matchMedia)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=e=>{let t=null;try{t=localStorage.getItem(Lt)}catch{t=null}t!==`light`&&t!==`dark`&&n(e.matches?`dark`:`light`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let r=(0,g.useCallback)(e=>n(e),[]),i=(0,g.useCallback)(()=>n(e=>e===`dark`?`light`:`dark`),[]),a=(0,g.useMemo)(()=>({theme:t,setTheme:r,toggleTheme:i}),[t,r,i]);return(0,G.jsx)(Rt.Provider,{value:a,children:e})}function Vt(){let e=(0,g.useContext)(Rt);if(!e)throw Error(`useTheme must be used inside ThemeProvider`);return e}function Ht(){let{theme:e,toggleTheme:t}=Vt(),n=e===`light`?`Switch to dark theme`:`Switch to light theme`;return(0,G.jsx)(`button`,{className:`theme-toggle`,type:`button`,onClick:t,"aria-label":n,title:n,children:e===`dark`?(0,G.jsx)(Ge,{size:16}):(0,G.jsx)(De,{size:16})})}function Ut(){try{let e=localStorage.getItem(Lt);if(e===`light`||e===`dark`)return e}catch{}try{if(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches)return`dark`}catch{}return`light`}function Wt({href:e,navigate:t,className:n,children:r}){return(0,G.jsx)(`a`,{className:n,href:e,onClick:n=>{n.preventDefault(),t(e)},children:r})}function Gt(){return(0,G.jsxs)(`div`,{className:`boot-screen`,children:[(0,G.jsxs)(`div`,{className:`brand compact brand-elevated`,children:[(0,G.jsx)(`span`,{className:`brand-mark`,children:(0,G.jsx)(`img`,{src:`/logo.png`,alt:`OwpenGram`})}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:`OwpenGram`}),(0,G.jsx)(`small`,{children:`Admin Console`})]})]}),(0,G.jsx)(`div`,{className:`loader-bar`})]})}function Kt({actor:e,route:t,navigate:n,onLogout:r,children:i}){let a=Mt(Et),o=Mt(Dt),s=t.path.startsWith(`/messages`),[c,l]=(0,g.useState)(s);(0,g.useEffect)(()=>{s&&l(!0)},[s]);async function u(){await k.logout().catch(()=>void 0),r()}return(0,G.jsxs)(`div`,{className:`shell`,children:[(0,G.jsxs)(`aside`,{className:`sidebar`,children:[(0,G.jsxs)(Wt,{className:`brand`,href:`/`,navigate:n,children:[(0,G.jsx)(`span`,{className:`brand-mark`,children:(0,G.jsx)(`img`,{src:`/logo.png`,alt:`OwpenGram`})}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:`OwpenGram`}),(0,G.jsx)(`small`,{children:`Admin Console`})]})]}),(0,G.jsx)(`div`,{className:`sidebar-label`,children:`Navigation`}),(0,G.jsxs)(`nav`,{className:`nav-list`,"aria-label":`Primary navigation`,children:[(0,G.jsx)(qt,{icon:(0,G.jsx)(Ce,{size:16}),href:`/`,route:t,navigate:n,children:`Overview`}),(0,G.jsx)(qt,{icon:(0,G.jsx)(Ze,{size:16}),href:`/accounts`,route:t,navigate:n,children:`Accounts`}),(0,G.jsx)(qt,{icon:(0,G.jsx)(ze,{size:16}),href:`/channels`,route:t,navigate:n,children:`Supergroups / Channels`}),(0,G.jsx)(qt,{icon:(0,G.jsx)(se,{size:16}),href:`/bots`,route:t,navigate:n,children:`Bots`}),(0,G.jsx)(qt,{icon:(0,G.jsx)(Re,{size:16}),href:`/moderation`,route:t,navigate:n,children:`Reports / Moderation`}),a&&(0,G.jsx)(qt,{icon:(0,G.jsx)(F,{size:16}),href:`/verification`,route:t,navigate:n,children:`Verification`}),o&&(0,G.jsx)(qt,{icon:(0,G.jsx)(H,{size:16}),href:`/bot-verification`,route:t,navigate:n,children:`Third-party marks`}),(0,G.jsx)(qt,{icon:(0,G.jsx)(ae,{size:16}),href:`/collectible-usernames`,route:t,navigate:n,children:`NFT Usernames`}),(0,G.jsx)(qt,{icon:(0,G.jsx)(qe,{size:16}),href:`/account-ratings`,route:t,navigate:n,children:`Account Rating`}),(0,G.jsx)(qt,{icon:(0,G.jsx)(pe,{size:16}),href:`/storage`,route:t,navigate:n,children:`Storage`}),(0,G.jsx)(qt,{icon:(0,G.jsx)(be,{size:16}),href:`/gifts`,route:t,navigate:n,children:`Star Gifts`}),(0,G.jsx)(qt,{icon:(0,G.jsx)(Ie,{size:16}),href:`/give-gifts`,route:t,navigate:n,children:`Give Gifts`}),(0,G.jsx)(qt,{icon:(0,G.jsx)(We,{size:16}),href:`/stickers`,route:t,navigate:n,children:`Stickers`}),(0,G.jsx)(qt,{icon:(0,G.jsx)(He,{size:16}),href:`/emoji`,route:t,navigate:n,children:`Emoji`}),(0,G.jsxs)(`div`,{className:`nav-section ${s?`active`:``} ${c?`open`:``}`,children:[(0,G.jsxs)(`button`,{className:`nav-section-toggle`,type:`button`,"aria-expanded":c,onClick:()=>l(e=>!e),children:[(0,G.jsx)(Ee,{size:16}),(0,G.jsx)(`span`,{children:`Messages`}),(0,G.jsx)(de,{className:`nav-section-chevron`,size:15})]}),c&&(0,G.jsxs)(`div`,{className:`nav-children`,children:[(0,G.jsx)(qt,{href:`/messages/private`,route:t,navigate:n,activeWhen:e=>e===`/messages`||e===`/messages/detail`||e.startsWith(`/messages/private`),children:`Private`}),(0,G.jsx)(qt,{href:`/messages/groups`,route:t,navigate:n,activeWhen:e=>e.startsWith(`/messages/groups`),children:`Groups`})]})]})]})]}),(0,G.jsxs)(`div`,{className:`workspace`,children:[(0,G.jsxs)(`header`,{className:`topbar`,children:[(0,G.jsx)(`div`,{children:(0,G.jsx)(`h1`,{children:It(t.path)})}),(0,G.jsxs)(`div`,{className:`topbar-actions`,children:[(0,G.jsx)(Ht,{}),(0,G.jsx)(`span`,{className:`actor-pill`,children:`Actor: ${e}`}),(0,G.jsxs)(`button`,{className:`btn ghost icon-text`,type:`button`,onClick:u,title:`Log out`,children:[(0,G.jsx)(Te,{size:16}),` `,`Log out`]})]})]}),(0,G.jsx)(`main`,{className:`content`,children:i})]})]})}function qt({href:e,route:t,navigate:n,icon:r,children:i,activeWhen:a}){return(0,G.jsxs)(Wt,{className:`nav-item ${(a?a(t.path):e===`/`?t.path===`/`:t.path.startsWith(e))?`active`:``}`,href:e,navigate:n,children:[r??(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`nav-dot`}),(0,G.jsx)(`span`,{children:i})]})}function Jt({onLogin:e}){let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(!1);async function s(n){n.preventDefault(),o(!0),i(``);try{let n=await k.login(t);e({actor:n.actor,permissions:n.permissions??[]})}catch(e){i(O(e))}finally{o(!1)}}return(0,G.jsxs)(`main`,{className:`login-page`,children:[(0,G.jsxs)(`div`,{className:`bg-orbs`,"aria-hidden":`true`,children:[(0,G.jsx)(`div`,{className:`bg-orb bg-orb--1`}),(0,G.jsx)(`div`,{className:`bg-orb bg-orb--2`}),(0,G.jsx)(`div`,{className:`bg-orb bg-orb--3`})]}),(0,G.jsxs)(`section`,{className:`login-panel`,children:[(0,G.jsxs)(`div`,{className:`login-head`,children:[(0,G.jsxs)(`div`,{className:`brand brand-elevated`,children:[(0,G.jsx)(`span`,{className:`brand-mark`,children:(0,G.jsx)(`img`,{src:`/logo.png`,alt:`OwpenGram`})}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:`OwpenGram`}),(0,G.jsx)(`small`,{children:`Admin Console`})]})]}),(0,G.jsxs)(`div`,{className:`login-head-actions`,children:[(0,G.jsx)(Ht,{}),(0,G.jsx)(`span`,{className:`login-chip`,children:`Local access`})]})]}),(0,G.jsxs)(`div`,{className:`login-copy`,children:[(0,G.jsx)(`h1`,{children:`Operations Admin`}),(0,G.jsx)(`p`,{children:`Enter credentials to open the console.`})]}),r&&(0,G.jsx)(q,{children:r}),(0,G.jsxs)(`form`,{className:`form-stack`,onSubmit:s,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Admin password or token`}),(0,G.jsx)(`input`,{autoFocus:!0,type:`password`,value:t,autoComplete:`current-password`,onChange:e=>n(e.target.value)})]}),(0,G.jsx)(`button`,{className:`btn primary full`,type:`submit`,disabled:a,children:a?`Logging in`:`Log in`})]})]})]})}var Yt=m();function Z({label:e,path:t,payload:n,icon:r,compact:i=!1,tone:a=`danger`,disabled:o=!1,onDone:s,onError:c}){let[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(null),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1);function b(){f(``),m(null),_(``)}async function x(e){if(!d.trim()){_(`Please enter an operation reason`);return}y(!0),_(``);try{let r={...n(),reason:d,confirm:e};m(await k.action(t,r)),e&&s?.()}catch(e){_(c?.(e)||O(e))}finally{y(!1)}}let S=p?.dry_run&&!p.error,C=`btn ${a===`danger`?`danger`:a===`warn`?`warn`:``} ${i?`compact-btn`:``}`,w=(0,g.useMemo)(()=>{try{return n()}catch(e){return{payload_error:O(e)}}},[l,n]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:C,type:`button`,disabled:o,onClick:()=>{b(),u(!0)},children:[r,e]}),l&&(0,Yt.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":e,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`Action Flow`}),(0,G.jsx)(`h2`,{children:e})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:()=>u(!1),"aria-label":`Close`,children:(0,G.jsx)($e,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body`,children:[(0,G.jsxs)(`div`,{className:`command-steps`,children:[(0,G.jsxs)(`div`,{className:`command-step ${d.trim()?`done`:`active`}`,children:[(0,G.jsx)(`span`,{children:`1`}),(0,G.jsx)(`strong`,{children:`Enter reason`})]}),(0,G.jsxs)(`div`,{className:`command-step ${p?.dry_run?`done`:d.trim()?`active`:``}`,children:[(0,G.jsx)(`span`,{children:`2`}),(0,G.jsx)(`strong`,{children:`Dry-run check`})]}),(0,G.jsxs)(`div`,{className:`command-step ${p&&!p.dry_run&&!p.error?`done`:S?`active`:``}`,children:[(0,G.jsx)(`span`,{children:`3`}),(0,G.jsx)(`strong`,{children:`Confirm execution`})]})]}),(0,G.jsxs)(`label`,{className:`form-field`,children:[(0,G.jsx)(`span`,{children:`Operation reason`}),(0,G.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:3,placeholder:`Describe why this operation is being performed`})]}),(0,G.jsxs)(`div`,{className:`command-preview`,children:[(0,G.jsxs)(`div`,{className:`preview-head`,children:[(0,G.jsx)(_e,{size:14}),` `,`Request preview`]}),(0,G.jsx)(wt,{value:JSON.stringify(w,null,2)})]}),h&&(0,G.jsx)(q,{children:h}),p&&(0,G.jsxs)(`div`,{className:`result-box`,children:[(0,G.jsxs)(`div`,{className:`result-title`,children:[p.error?(0,G.jsx)(I,{size:16}):(0,G.jsx)(L,{size:16}),(0,G.jsx)(`strong`,{children:p.message||p.error||`Action result`})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Command ID`}),(0,G.jsx)(`strong`,{children:p.command_id})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsx)(`strong`,{children:p.status})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Dry-run`}),(0,G.jsx)(`strong`,{children:p.dry_run?`Yes`:`No`})]}),(0,G.jsx)(`div`,{className:`result-message`,children:p.message||p.error}),p.details&&(0,G.jsx)(wt,{value:JSON.stringify(p.details,null,2)})]})]}),(0,G.jsxs)(`div`,{className:`modal-actions`,children:[(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>u(!1),children:`Close`}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>x(!1),disabled:v,children:[v?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Ae,{size:15}),p?`Run dry-run again`:`Run dry-run first`]}),(0,G.jsxs)(`button`,{className:`btn danger icon-text`,type:`button`,onClick:()=>x(!0),disabled:v||!S,children:[(0,G.jsx)(L,{size:15}),`Confirm execution`]})]})]})}),document.body)]})}function Xt({rows:e,userID:t,onDone:n}){let[r,i]=(0,g.useState)(()=>new Set);(0,g.useEffect)(()=>{i(new Set)},[t]);let a=(0,g.useMemo)(()=>e.filter(e=>!r.has(e.Hash)),[e,r]);function o(e){i(t=>e(t)),n()}return(0,G.jsxs)(`div`,{className:`authorization-block`,children:[(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table authorization-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Device`}),(0,G.jsx)(`th`,{children:`Platform`}),(0,G.jsx)(`th`,{children:`IP`}),(0,G.jsx)(`th`,{children:`Last active`}),(0,G.jsx)(`th`,{className:`device-actions-head`,children:`Actions`})]})}),(0,G.jsxs)(`tbody`,{children:[a.map(n=>(0,G.jsxs)(`tr`,{children:[(0,G.jsxs)(`td`,{className:`device-text`,children:[n.DeviceModel,` `,n.SystemVersion]}),(0,G.jsxs)(`td`,{className:`device-text`,children:[n.Platform,` `,n.AppVersion]}),(0,G.jsx)(`td`,{children:n.IP}),(0,G.jsx)(`td`,{children:W(n.ActiveAt)}),(0,G.jsx)(`td`,{className:`device-actions-cell`,children:(0,G.jsxs)(`div`,{className:`device-actions`,children:[(0,G.jsx)(Z,{label:`Revoke current`,icon:(0,G.jsx)(Te,{size:13}),compact:!0,path:`/api/actions/revoke-sessions`,payload:()=>({user_id:t,hash:n.Hash}),onDone:()=>o(e=>new Set([...e,n.Hash]))}),(0,G.jsx)(Z,{label:`Keep current`,icon:(0,G.jsx)(ze,{size:13}),compact:!0,path:`/api/actions/revoke-sessions`,payload:()=>({user_id:t,keep_hash:n.Hash}),onDone:()=>o(()=>new Set(e.filter(e=>e.Hash!==n.Hash).map(e=>e.Hash)))})]})})]},n.Hash)),a.length===0&&(0,G.jsx)(St,{colSpan:5})]})]})}),(0,G.jsx)(`div`,{className:`danger-zone`,children:(0,G.jsx)(Z,{label:`Revoke all devices`,icon:(0,G.jsx)(le,{size:15}),path:`/api/actions/revoke-sessions`,payload:()=>({user_id:t,revoke_all:!0}),onDone:()=>o(()=>new Set(e.map(e=>e.Hash)))})})]})}function Zt({scam:e,fake:t}){return!e&&!t?null:(0,G.jsxs)(G.Fragment,{children:[e&&(0,G.jsx)(J,{tone:`danger`,children:`SCAM`}),t&&(0,G.jsx)(J,{tone:`danger`,children:`FAKE`})]})}function Qt({idKey:e,id:t,path:n,scam:r,fake:i,onDone:a}){return(0,G.jsxs)(`div`,{className:`action-stack`,children:[(0,G.jsx)(Z,{label:r?`Clear SCAM`:`Mark as SCAM`,icon:(0,G.jsx)(Re,{size:15}),tone:`danger`,path:n,payload:()=>({[e]:t,scam:!r,fake:r?i:!1}),onDone:a}),(0,G.jsx)(Z,{label:i?`Clear FAKE`:`Mark as FAKE`,icon:(0,G.jsx)(te,{size:15}),tone:`danger`,path:n,payload:()=>({[e]:t,fake:!i,scam:i?r:!1}),onDone:a})]})}function $t({id:e,support:t,onDone:n}){return(0,G.jsx)(Z,{label:t?`Clear support`:`Mark as support`,icon:(0,G.jsx)(we,{size:15}),tone:`neutral`,path:`/api/actions/set-support`,payload:()=>({user_id:e,support:!t}),onDone:n})}function en({idKey:e,id:t,path:n,current:r,onDone:i}){let[a,o]=(0,g.useState)(r.replace(/^@/,``));return(0,G.jsxs)(`div`,{className:`attr-block`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Username`}),(0,G.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`username`})]}),(0,G.jsx)(Z,{label:`Set username`,icon:(0,G.jsx)(ae,{size:15}),tone:`neutral`,path:n,payload:()=>({[e]:t,username:a.trim().replace(/^@/,``)}),onDone:i})]})}function tn({idKey:e,id:t,path:n,onDone:r}){let[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!0),[c,l]=(0,g.useState)(`0`),[u,d]=(0,g.useState)(``);return(0,G.jsxs)(`div`,{className:`attr-block`,children:[(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked)}),` `,`Profile color`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),` `,`Enable color`]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Color index`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,max:`20`,value:c,onChange:e=>l(e.target.value)})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Background emoji ID`}),(0,G.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`0`})]}),(0,G.jsx)(Z,{label:`Set color`,icon:(0,G.jsx)(Oe,{size:15}),tone:`neutral`,path:n,payload:()=>({[e]:t,for_profile:i,has_color:o,color:at(c),background_emoji_id:u.trim()||`0`}),onDone:r})]})}function nn({idKey:e,id:t,path:n,onDone:r}){let[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(`0`);return(0,G.jsxs)(`div`,{className:`attr-block`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Emoji document ID`}),(0,G.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`0 = clear`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Until (unix, 0 = permanent)`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,value:o,onChange:e=>s(e.target.value)})]}),(0,G.jsx)(Z,{label:`Set emoji status`,icon:(0,G.jsx)(He,{size:15}),tone:`neutral`,path:n,payload:()=>({[e]:t,document_id:i.trim()||`0`,until:at(o)}),onDone:r})]})}function rn({channel:e,onDone:t}){let[n,r]=(0,g.useState)(e.Gigagroup),[i,a]=(0,g.useState)(e.AntiSpam),[o,s]=(0,g.useState)(e.ParticipantsHidden),[c,l]=(0,g.useState)(e.NoForwards),[u,d]=(0,g.useState)(e.JoinToSend),[f,p]=(0,g.useState)(e.JoinRequest),[m,h]=(0,g.useState)(String(e.SlowmodeSeconds));(0,g.useEffect)(()=>{r(e.Gigagroup),a(e.AntiSpam),s(e.ParticipantsHidden),l(e.NoForwards),d(e.JoinToSend),p(e.JoinRequest),h(String(e.SlowmodeSeconds))},[e]);function _(){let t={channel_id:e.ID};return n!==e.Gigagroup&&(t.gigagroup=n),i!==e.AntiSpam&&(t.antispam=i),o!==e.ParticipantsHidden&&(t.participants_hidden=o),c!==e.NoForwards&&(t.noforwards=c),u!==e.JoinToSend&&(t.join_to_send=u),f!==e.JoinRequest&&(t.join_request=f),at(m)!==e.SlowmodeSeconds&&(t.slowmode_seconds=at(m)),t}return(0,G.jsxs)(`div`,{className:`attr-block`,children:[(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked)}),` `,`Gigagroup`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked)}),` `,`Aggressive anti-spam`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),` `,`Hide members`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked)}),` `,`Restrict forwarding`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked)}),` `,`Join to send messages`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>p(e.target.checked)}),` `,`Join by request`]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Slowmode (seconds)`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,max:`86400`,value:m,onChange:e=>h(e.target.value)})]}),(0,G.jsx)(Z,{label:`Apply settings`,icon:(0,G.jsx)(Le,{size:15}),tone:`warn`,path:`/api/actions/set-channel-settings`,payload:_,onDone:t})]})}function an({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(`1`),[u,d]=(0,g.useState)(`1000`),[f,p]=(0,g.useState)(()=>on(new Date(Date.now()+7*864e5))),[m,h]=(0,g.useState)(``);async function _(){s(!0),a(``);try{let t=await k.account(e);r(t),t.Restriction.Frozen&&(t.Restriction.Until&&p(on(new Date(t.Restriction.Until))),h(t.Restriction.AppealURL||``))}catch(e){a(O(e))}finally{s(!1)}}if((0,g.useEffect)(()=>{_()},[e]),i)return(0,G.jsx)(q,{children:i});if(!n)return(0,G.jsx)(Ct,{label:o?`Loading account detail`:`Waiting for data`});let v=n.Account;return(0,G.jsx)(vt,{title:`Account #${v.ID}`,eyebrow:`Account Profile`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>t(`/accounts`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),children:(0,G.jsx)(bt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:tt(v)}),(0,G.jsxs)(`div`,{className:`entity-subtitle`,children:[U(v.Username)||`No username`,` · `,et(v.Phone)||`No phone`]}),v.Collectibles?.length>0&&(0,G.jsx)(`div`,{className:`entity-subtitle`,children:(0,G.jsx)(Tt,{username:``,collectibles:v.Collectibles})})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[v.PremiumUntil>0?(0,G.jsx)(J,{tone:`good`,children:`Premium`}):(0,G.jsx)(J,{children:`Not premium`}),n.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Not verified`}),(0,G.jsx)(Zt,{scam:n.Scam,fake:n.Fake}),v.Frozen?(0,G.jsx)(J,{tone:`danger`,children:`Account frozen`}):(0,G.jsx)(J,{children:`Account active`})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`User ID`,value:String(v.ID),mono:!0}),(0,G.jsx)(X,{label:`Last active`,value:rt(n.LastSeenAt)||`-`}),(0,G.jsx)(X,{label:`Premium expires`,value:v.PremiumUntil>0?rt(v.PremiumUntil):`None`}),(0,G.jsx)(X,{label:`Stars balance`,value:`${n.StarsBalance} / ${n.StarsGranted?`initial grant applied`:`initial grant pending`}`}),(0,G.jsx)(X,{label:`Updated`,value:W(v.UpdatedAt)||`-`}),(0,G.jsx)(X,{label:`Authorized devices`,value:String(n.Authorizations.length)}),(0,G.jsx)(X,{label:`Account flags`,value:`support=${n.Support} bot=${n.Bot}`}),(0,G.jsx)(X,{label:`Restriction`,value:n.HasRestriction?n.Restriction.Reason||`Restricted`:`None`}),(0,G.jsx)(X,{label:`Frozen since`,value:n.Restriction.Since?W(n.Restriction.Since):`None`}),(0,G.jsx)(X,{label:`Appeal deadline`,value:n.Restriction.Until?W(n.Restriction.Until):`None`}),(0,G.jsx)(X,{label:`Appeal URL`,value:n.Restriction.AppealURL||`None`}),(0,G.jsx)(X,{label:`Created`,value:W(v.CreatedAt)||`-`})]}),n.About&&(0,G.jsx)(`p`,{className:`about-text`,children:n.About}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Authorized Devices`,text:`${n.Authorizations.length} authorizations`}),(0,G.jsx)(Xt,{rows:n.Authorizations,userID:v.ID,onDone:_})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Recent Admin Actions`,text:`Last 30 audit rows`}),(0,G.jsx)(xt,{rows:n.AuditLogs})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Account Actions`}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Appeal deadline`}),(0,G.jsx)(`input`,{"aria-label":`Freeze appeal deadline`,value:f,onChange:e=>p(e.target.value),type:`datetime-local`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Appeal URL`}),(0,G.jsx)(`input`,{"aria-label":`Freeze appeal URL`,value:m,onChange:e=>h(e.target.value),type:`url`,placeholder:`https://...`})]}),(0,G.jsx)(Z,{label:v.Frozen?`Update freeze`:`Freeze account`,icon:(0,G.jsx)(I,{size:15}),path:`/api/actions/set-frozen`,payload:()=>({user_id:v.ID,frozen:!0,freeze_until:new Date(f).toISOString(),freeze_appeal_url:m.trim()}),onDone:_}),v.Frozen&&(0,G.jsx)(Z,{label:`Unfreeze account`,icon:(0,G.jsx)(I,{size:15}),path:`/api/actions/set-frozen`,payload:()=>({user_id:v.ID,frozen:!1}),onDone:_}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Premium duration (months)`}),(0,G.jsx)(`input`,{"aria-label":`Set premium duration in months`,value:c,onChange:e=>l(e.target.value),type:`number`,min:`1`,max:`120`})]}),(0,G.jsxs)(`div`,{className:`action-stack`,children:[(0,G.jsx)(Z,{label:`Set premium`,icon:(0,G.jsx)(ne,{size:15}),tone:`warn`,path:`/api/actions/grant-premium`,payload:()=>({user_id:v.ID,months:at(c)}),onDone:_}),(0,G.jsx)(Z,{label:`Clear premium`,icon:(0,G.jsx)(ne,{size:15}),tone:`warn`,path:`/api/actions/grant-premium`,payload:()=>({user_id:v.ID,months:0}),onDone:_}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Stars to grant`}),(0,G.jsx)(`input`,{"aria-label":`Set Stars amount to grant`,value:u,onChange:e=>d(e.target.value),type:`number`,min:`1`,max:`1000000000`})]}),(0,G.jsx)(Z,{label:`Grant Stars`,icon:(0,G.jsx)(Ue,{size:15}),tone:`warn`,path:`/api/actions/grant-stars`,payload:()=>({user_id:v.ID,amount:at(u)}),onDone:_}),(0,G.jsx)(Z,{label:n.Verified?`Clear verified`:`Set verified`,icon:(0,G.jsx)(F,{size:15}),tone:`warn`,path:`/api/actions/set-verified`,payload:()=>({user_id:v.ID,verified:!n.Verified}),onDone:_})]}),(0,G.jsx)(Qt,{idKey:`user_id`,id:v.ID,path:`/api/actions/set-account-flags`,scam:n.Scam,fake:n.Fake,onDone:_}),(0,G.jsx)(`div`,{className:`dock-title`,children:`Attributes`}),(0,G.jsx)($t,{id:v.ID,support:n.Support,onDone:_}),(0,G.jsx)(en,{idKey:`user_id`,id:v.ID,path:`/api/actions/set-account-username`,current:v.Username,onDone:_}),(0,G.jsx)(tn,{idKey:`user_id`,id:v.ID,path:`/api/actions/set-account-color`,onDone:_}),(0,G.jsx)(nn,{idKey:`user_id`,id:v.ID,path:`/api/actions/set-account-emoji-status`,onDone:_})]})})})}function on(e){return new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function sn({navigate:e}){let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(`50`),[s,c]=(0,g.useState)([]),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(``);async function v(e=!1){let n=r.trim();m(!0),_(``);let i=new URLSearchParams({limit:a});t.trim()&&i.set(`min_level`,t.trim()),n&&i.set(`q`,n),e&&d&&i.set(`before_id`,d);try{let t=await k.accountRatings(i),n=t.rows??[];c(t=>e?[...t,...n]:n),f(t.next_before_id??``),u(!!t.has_more)}catch(e){_(O(e))}finally{m(!1)}}(0,g.useEffect)(()=>{v(!1)},[]);let y=s.reduce((e,t)=>Math.max(e,t.Level),0),b=s.filter(e=>ot(e.PendingStars)!==0).length,x=s.length>0?(s.reduce((e,t)=>e+t.Level,0)/s.length).toFixed(1):`0`;return(0,G.jsxs)(vt,{title:`Account rating leaderboard`,eyebrow:`Rating / Leaderboard`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>v(!1),disabled:p,children:[(0,G.jsx)(Pe,{size:15,className:p?`spin`:``}),` `,`Refresh`]}),children:[h&&(0,G.jsx)(q,{children:h}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Loaded rows`,value:String(s.length)}),(0,G.jsx)(Y,{label:`Top level`,value:String(y),tone:`good`}),(0,G.jsx)(Y,{label:`Average level`,value:x}),(0,G.jsx)(Y,{label:`With pending points`,value:String(b),tone:b?`warn`:`neutral`})]}),(0,G.jsx)(yt,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),v(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Search by username, name or user ID`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Min level`}),(0,G.jsx)(`input`,{className:`small-input`,value:t,onChange:e=>n(e.target.value),type:`number`,min:`0`,placeholder:`0`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:a,onChange:e=>o(e.target.value),type:`number`,min:`1`,max:`200`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:p,children:[p?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Fe,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`User ID`}),(0,G.jsx)(`th`,{children:`Username`}),(0,G.jsx)(`th`,{children:`Level`}),(0,G.jsx)(`th`,{children:`Points`}),(0,G.jsx)(`th`,{children:`Progress to next level`}),(0,G.jsx)(`th`,{children:`Pending`}),(0,G.jsx)(`th`,{children:`Computed`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[s.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:t.UserID}),(0,G.jsx)(`td`,{children:U(t.Username)||t.FirstName||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsx)(cn,{level:t.Level})}),(0,G.jsx)(`td`,{className:`mono`,children:st(t.Stars)}),(0,G.jsx)(`td`,{children:(0,G.jsx)(un,{row:t})}),(0,G.jsx)(`td`,{className:`mono`,children:ot(t.PendingStars)===0?`-`:st(t.PendingStars)}),(0,G.jsx)(`td`,{children:W(t.ComputedAt)||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/account-ratings/${t.UserID}`),children:[(0,G.jsx)(qe,{size:14}),` `,`Details`,` `,(0,G.jsx)(B,{size:14})]})})]},t.UserID)),s.length===0&&(0,G.jsx)(St,{colSpan:8})]})]})}),l&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>v(!0),disabled:p,children:[p?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function cn({level:e}){return(0,G.jsx)(J,{tone:e>=10?`good`:e>=5?`warn`:`neutral`,children:`Level ${e}`})}function ln(e){let t=ot(e.Stars),n=ot(e.CurrentLevelStars),r=ot(e.NextLevelStars),i=r-n;return{percent:i>0?Math.min(100,Math.max(0,(t-n)/i*100)):0,remaining:Math.max(0,r-t),target:r,stars:t}}function un({row:e}){if(!e.HasNextLevel)return(0,G.jsx)(`span`,{className:`progress-note`,children:`Max level reached`});let{percent:t,remaining:n,target:r}=ln(e);return(0,G.jsxs)(`div`,{className:`progress-cell`,children:[(0,G.jsx)(`div`,{className:`progress-bar`,role:`img`,"aria-label":`${Math.round(t)}%`,children:(0,G.jsx)(`span`,{style:{width:`${t}%`}})}),(0,G.jsx)(`small`,{children:`${st(String(n))} left to reach ${st(String(r))}`})]})}function dn({userID:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(``);async function u(){s(!0),a(``);try{r(await k.accountRating(e))}catch(e){a(O(e))}finally{s(!1)}}if((0,g.useEffect)(()=>{u()},[e]),i&&!n)return(0,G.jsx)(q,{children:i});if(!n)return(0,G.jsx)(Ct,{label:o?`Loading account rating…`:`Waiting for data`});let d=n.rating,f=n.events??[],p=ot(d.PendingStars),m=ln(d),h=d.UserID||e;return(0,G.jsxs)(vt,{title:`Rating of ${U(d.Username)||d.FirstName||d.UserID}`,eyebrow:`Rating / Component breakdown`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/account-ratings`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:u,disabled:o,children:[(0,G.jsx)(Pe,{size:15,className:o?`spin`:``}),` `,`Refresh`]})]}),children:[i&&(0,G.jsx)(q,{children:i}),(0,G.jsx)(bt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:U(d.Username)||d.FirstName||`Unnamed bot`}),(0,G.jsxs)(`div`,{className:`entity-subtitle`,children:[`User ID`,`: `,d.UserID]})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(cn,{level:d.Level}),p!==0&&(0,G.jsx)(J,{tone:`warn`,children:`Pending ${ht(d.PendingStars)}`})]})]}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Points`,value:st(d.Stars),mono:!0}),(0,G.jsx)(Y,{label:`Level`,value:String(d.Level),tone:`good`}),(0,G.jsx)(Y,{label:`Next level threshold`,value:d.HasNextLevel?st(d.NextLevelStars):`Max level reached`,mono:d.HasNextLevel}),(0,G.jsx)(Y,{label:`Points to next level`,value:d.HasNextLevel?st(String(m.remaining)):`-`,mono:!0,tone:d.HasNextLevel&&m.percent>=80?`good`:`neutral`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`How the rating adds up`,text:`Contribution of every source: stars, activity, moderation penalties and manual corrections.`}),(0,G.jsx)(fn,{rating:d}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Current level threshold`,value:st(d.CurrentLevelStars),mono:!0}),(0,G.jsx)(X,{label:`Next level threshold`,value:d.HasNextLevel?st(d.NextLevelStars):`Max level reached`,mono:d.HasNextLevel}),(0,G.jsx)(X,{label:`Computed`,value:W(d.ComputedAt)||`-`}),(0,G.jsx)(X,{label:`Updated`,value:W(d.UpdatedAt)||`-`})]}),(0,G.jsx)(`div`,{className:`progress-wide`,children:(0,G.jsx)(un,{row:d})})]}),p!==0&&(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Pending points`,text:`Already earned, but counted towards the rating only on the date below.`}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Pending`,value:ht(d.PendingStars),mono:!0}),(0,G.jsx)(X,{label:`Applied on`,value:W(d.PendingDate)||`-`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Rating events`,text:`Every rating change with its source, actor and reason.`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Source`}),(0,G.jsx)(`th`,{children:`Change`}),(0,G.jsx)(`th`,{children:`Reason`}),(0,G.jsx)(`th`,{children:`Actor`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[f.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:e.ID}),(0,G.jsx)(`td`,{children:(0,G.jsx)(mn,{kind:e.Kind})}),(0,G.jsx)(`td`,{className:`mono`,children:ht(e.Amount)}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Reason||`-`}),(0,G.jsx)(`td`,{children:e.Actor||`-`}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)||`-`})]},e.ID)),f.length===0&&(0,G.jsx)(St,{colSpan:6})]})]})})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Rating operations`}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/accounts/${d.UserID}`),children:[(0,G.jsx)(Xe,{size:15}),` `,`Open account`]}),(0,G.jsx)(`div`,{className:`action-stack`,children:(0,G.jsx)(Z,{label:`Recompute`,icon:(0,G.jsx)(ue,{size:15}),tone:`neutral`,path:`/api/actions/recompute-account-rating`,payload:()=>({user_id:h}),onDone:u})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Rebuilds the rating from stars, activity, penalties and manual corrections.`}),(0,G.jsx)(`div`,{className:`dock-title`,children:`Manual correction`}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Value (negative allowed)`}),(0,G.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),type:`number`,step:`1`,placeholder:`-500`})]}),(0,G.jsx)(`div`,{className:`action-stack`,children:(0,G.jsx)(Z,{label:`Apply correction`,icon:(0,G.jsx)(Ve,{size:15}),tone:`warn`,path:`/api/actions/adjust-account-rating`,payload:()=>({user_id:h,amount:String(Number.parseInt(c.trim()||`0`,10)||0)}),onDone:()=>{l(``),u()}})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The value is added to the manual component; a negative number lowers the rating.`})]})})]})}function fn({rating:e}){let t=[{key:`stars`,label:`Stars`,hint:`Purchased and received stars`,value:ot(e.StarsComponent)},{key:`activity`,label:`Activity`,hint:`Messages, sessions and long-term engagement`,value:ot(e.ActivityComponent)},{key:`penalty`,label:`Penalties`,hint:`Moderation decisions and restrictions`,value:-ot(e.PenaltyComponent)},{key:`manual`,label:`Manual corrections`,hint:`Adjustments made by admins`,value:ot(e.ManualComponent)}],n=Math.max(1,...t.map(e=>Math.abs(e.value))),r=Math.max(0,t.reduce((e,t)=>e+t.value,0)),i=ot(e.Stars),a=ot(e.PendingStars);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`breakdown-list`,children:[t.map(e=>{let t=Math.min(100,Math.abs(e.value)/n*100),r=e.value<0?`danger`:e.value>0?`good`:``;return(0,G.jsxs)(`div`,{className:`breakdown-row`,children:[(0,G.jsxs)(`div`,{className:`breakdown-label`,children:[(0,G.jsx)(`strong`,{children:e.label}),(0,G.jsx)(`small`,{children:e.hint})]}),(0,G.jsx)(`div`,{className:`progress-bar ${r}`,role:`img`,"aria-label":String(e.value),children:(0,G.jsx)(`span`,{style:{width:`${t}%`}})}),(0,G.jsx)(`div`,{className:`breakdown-value mono ${r}`,children:ht(String(e.value))})]},e.key)}),(0,G.jsxs)(`div`,{className:`breakdown-row total`,children:[(0,G.jsx)(`div`,{className:`breakdown-label`,children:(0,G.jsx)(`strong`,{children:`Total rating`})}),(0,G.jsx)(`div`,{className:`breakdown-value mono`,children:st(e.Stars)})]})]}),a===0&&r!==i&&(0,G.jsx)(q,{children:`Components add up to ${st(String(r))} while the stored rating is ${st(e.Stars)}. Recompute to resolve the drift.`}),a!==0&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Components already include ${ht(e.PendingStars)} that reaches the score only on the date below.`})]})}var pn={stars:`Stars`,activity:`Activity`,moderation:`Moderation`,manual:`Manual`,recompute:`Recompute`};function mn({kind:e}){return(0,G.jsx)(J,{tone:e===`moderation`?`danger`:e===`manual`?`warn`:e===`recompute`?`neutral`:`good`,children:pn[e]})}var hn=[[`#FF885E`,`#FF516A`],[`#FFCD6A`,`#FFA85C`],[`#82B1FF`,`#665FFF`],[`#A0DE7E`,`#54CB68`],[`#53EDD6`,`#28C9B7`],[`#72D5FD`,`#2A9EF1`],[`#E0A2F3`,`#D669ED`]];function gn(e){return hn[Math.abs(e)%hn.length]}function _n(e){let t=Array.from(e);return t.length>0?t[0]:``}function vn(e,t,n){let r=`${e} ${t}`.trim().split(/\s+/).filter(Boolean),i=r.length>0?r:n?[n]:[];if(i.length===0)return`T`;let a=_n(i[0]);return i.length>1&&(a+=_n(i[i.length-1])),a.toUpperCase()}function yn({userID:e,firstName:t,lastName:n,username:r=``,size:i=34}){let[a,o]=(0,g.useState)(!1);if((0,g.useEffect)(()=>{o(!1)},[e]),a){let[a,o]=gn(e);return(0,G.jsx)(`div`,{className:`avatar-fallback`,style:{width:i,height:i,background:`linear-gradient(135deg, ${a}, ${o})`,fontSize:Math.round(i*.42)},children:vn(t,n,r)})}return(0,G.jsx)(`img`,{className:`avatar-photo-img`,src:`/api/accounts/${e}/avatar`,alt:``,loading:`lazy`,style:{width:i,height:i},onError:()=>o(!0)})}function bn(e){return e.reduce((e,t)=>(e.devices+=t.DeviceCount,e),{devices:0})}function xn(e){return e.reduce((e,t)=>(t.Megagroup&&(e.megagroups+=1),t.Broadcast&&(e.broadcasts+=1),t.Verified&&(e.verified+=1),e),{megagroups:0,broadcasts:0,verified:0})}var Sn={beforeID:0,beforeActiveUS:0};function Cn({navigate:e}){let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(50),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)([]),[d,f]=(0,g.useState)(Sn),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(``);async function v(e,t){m(!0),_(``);let n=new URLSearchParams({limit:String(r)});e.trim()&&n.set(`q`,e.trim()),(t.beforeID||t.beforeActiveUS)&&(n.set(`before_id`,String(t.beforeID)),n.set(`before_active_us`,String(t.beforeActiveUS)));try{let e=await k.accounts(n);return o(e),e}catch(e){return _(O(e)),null}finally{m(!1)}}async function y(){u([]),f(Sn),await v(t,Sn)}async function b(){if(!a?.has_more)return;let e={beforeID:a.next_before_id,beforeActiveUS:a.next_before_active_us};await v(t,e)&&(u(e=>[...e,d]),f(e))}async function x(){if(l.length===0)return;let e=l[l.length-1];await v(t,e)&&(u(e=>e.slice(0,-1)),f(e))}async function S(){try{c(await k.accountStats())}catch{}}(0,g.useEffect)(()=>{y(),S()},[]);let C=bn(a?.rows??[]),w=l.length>0&&!p,T=!!a?.has_more&&!p;return(0,G.jsxs)(vt,{title:`Accounts`,eyebrow:a?.listing===!1?`Search results`:`Recently active accounts`,actions:(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>{y(),S()},disabled:p,children:[(0,G.jsx)(Pe,{size:15}),` `,`Refresh`]}),children:[h&&(0,G.jsx)(q,{children:h}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Total users`,value:s?String(s.total):`…`}),(0,G.jsx)(Y,{label:`Online now`,value:s?String(s.online):`…`,tone:`good`}),(0,G.jsx)(Y,{label:`Online device records`,value:String(C.devices)})]}),(0,G.jsx)(yt,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),placeholder:`User ID / phone / username / email / name`})]}),(0,G.jsxs)(`label`,{className:`gift-page-size`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsxs)(`select`,{value:String(r),onChange:e=>i(Number(e.target.value)),children:[(0,G.jsx)(`option`,{value:`10`,children:`10`}),(0,G.jsx)(`option`,{value:`20`,children:`20`}),(0,G.jsx)(`option`,{value:`50`,children:`50`}),(0,G.jsx)(`option`,{value:`100`,children:`100`})]})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:p,children:[p?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Fe,{size:15}),` `,`Search`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>void x(),disabled:!w,children:[(0,G.jsx)(fe,{size:15}),` `,`Previous page`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>void b(),disabled:!T,children:[(0,G.jsx)(B,{size:15}),` `,`Next page`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`avatar-col`}),(0,G.jsx)(`th`,{children:`User ID`}),(0,G.jsx)(`th`,{children:`Phone`}),(0,G.jsx)(`th`,{children:`Username`}),(0,G.jsx)(`th`,{children:`Name`}),(0,G.jsx)(`th`,{children:`Login email`}),(0,G.jsx)(`th`,{children:`Device`}),(0,G.jsx)(`th`,{children:`Last active`}),(0,G.jsx)(`th`,{children:`Premium`}),(0,G.jsx)(`th`,{children:`Verified`}),(0,G.jsx)(`th`,{children:`Frozen`}),(0,G.jsx)(`th`,{children:`Updated`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[a?.rows.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`avatar-col`,children:(0,G.jsx)(yn,{userID:t.ID,firstName:t.FirstName,lastName:t.LastName,username:t.Username})}),(0,G.jsx)(`td`,{className:`mono`,children:t.ID}),(0,G.jsx)(`td`,{children:et(t.Phone)}),(0,G.jsx)(`td`,{children:(0,G.jsx)(Tt,{username:t.Username,collectibles:t.Collectibles})}),(0,G.jsx)(`td`,{children:tt(t)}),(0,G.jsx)(`td`,{children:t.LoginEmail||(0,G.jsx)(`span`,{className:`muted-cell`,children:`None`})}),(0,G.jsx)(`td`,{children:t.DeviceCount}),(0,G.jsx)(`td`,{children:W(t.LastActiveAt)}),(0,G.jsx)(`td`,{children:t.PremiumUntil>0?(0,G.jsxs)(J,{tone:`good`,children:[`Premium`,` `,rt(t.PremiumUntil)]}):(0,G.jsx)(J,{children:`None`})}),(0,G.jsxs)(`td`,{children:[t.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Not verified`}),` `,(0,G.jsx)(Zt,{scam:t.Scam,fake:t.Fake})]}),(0,G.jsx)(`td`,{children:t.Frozen?(0,G.jsx)(J,{tone:`danger`,children:`Frozen`}):(0,G.jsx)(J,{children:`Normal`})}),(0,G.jsx)(`td`,{children:W(t.UpdatedAt)}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/accounts/${t.ID}`),children:[`Details`,` `,(0,G.jsx)(B,{size:14})]})})]},t.ID)),(!a||a.rows.length===0)&&(0,G.jsx)(St,{colSpan:12})]})]})})]})}function wn({label:e,value:t,onChange:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``);async function d(){c(!0),u(``);let e=new URLSearchParams({limit:`20`});r.trim()&&e.set(`q`,r.trim());try{o((await k.accounts(e)).rows)}catch(e){u(O(e))}finally{c(!1)}}return(0,g.useEffect)(()=>{d()},[]),(0,G.jsxs)(`div`,{className:`entity-picker`,children:[(0,G.jsxs)(`div`,{className:`picker-head`,children:[(0,G.jsx)(`span`,{children:e}),t?(0,G.jsxs)(`button`,{className:`link-button`,type:`button`,onClick:()=>n(null),children:[(0,G.jsx)($e,{size:13}),` `,`Clear`]}):null]}),t?(0,G.jsxs)(`div`,{className:`selected-entity`,children:[(0,G.jsx)(z,{size:15}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:tt(t)}),(0,G.jsx)(`span`,{className:`mono`,children:t.ID})]}),(0,G.jsx)(`span`,{children:U(t.Username)||et(t.Phone)||`-`})]}):null,(0,G.jsxs)(`div`,{className:`picker-search`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())},placeholder:`Search user_id / phone / username`}),(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:d,disabled:s,children:s?(0,G.jsx)(R,{size:14,className:`spin`}):`Search`})]}),l&&(0,G.jsx)(`div`,{className:`picker-error`,children:l}),(0,G.jsxs)(`div`,{className:`picker-results`,children:[a.map(e=>(0,G.jsxs)(`button`,{className:`picker-row ${t?.ID===e.ID?`selected`:``}`,type:`button`,onClick:()=>n(e),children:[(0,G.jsx)(`span`,{className:`mono`,children:e.ID}),(0,G.jsx)(`strong`,{children:tt(e)}),(0,G.jsx)(`span`,{children:U(e.Username)||et(e.Phone)||`-`}),e.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Regular`})]},e.ID)),a.length===0&&!s?(0,G.jsx)(`div`,{className:`picker-empty`,children:`No results`}):null]})]})}function Tn({label:e,value:t,onChange:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``);async function d(){c(!0),u(``);let e=new URLSearchParams({limit:`20`});r.trim()&&e.set(`q`,r.trim().replace(/^@/,``));try{o((await k.bots(e)).rows??[])}catch(e){u(O(e))}finally{c(!1)}}return(0,g.useEffect)(()=>{d()},[]),(0,G.jsxs)(`div`,{className:`entity-picker`,children:[(0,G.jsxs)(`div`,{className:`picker-head`,children:[(0,G.jsx)(`span`,{children:e}),t?(0,G.jsxs)(`button`,{className:`link-button`,type:`button`,onClick:()=>n(null),children:[(0,G.jsx)($e,{size:13}),` `,`Clear`]}):null]}),t?(0,G.jsxs)(`div`,{className:`selected-entity`,children:[(0,G.jsx)(z,{size:15}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:t.FirstName||`-`}),(0,G.jsx)(`span`,{className:`mono`,children:t.ID})]}),(0,G.jsx)(`span`,{children:U(t.Username)||`-`})]}):null,(0,G.jsxs)(`div`,{className:`picker-search`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())},placeholder:`Bot username or id`}),(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:d,disabled:s,children:s?(0,G.jsx)(R,{size:14,className:`spin`}):`Search`})]}),l&&(0,G.jsx)(`div`,{className:`picker-error`,children:l}),(0,G.jsxs)(`div`,{className:`picker-results`,children:[a.map(e=>(0,G.jsxs)(`button`,{className:`picker-row ${t?.ID===e.ID?`selected`:``}`,type:`button`,onClick:()=>n(e),children:[(0,G.jsx)(`span`,{className:`mono`,children:e.ID}),(0,G.jsx)(`strong`,{children:e.FirstName||`-`}),(0,G.jsx)(`span`,{children:U(e.Username)||`-`}),e.System?(0,G.jsx)(J,{tone:`warn`,children:`System`}):(0,G.jsx)(J,{children:`Regular`})]},e.ID)),a.length===0&&!s?(0,G.jsx)(`div`,{className:`picker-empty`,children:`No results`}):null]})]})}function En({label:e,value:t,onChange:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``);async function d(){c(!0),u(``);let e=new URLSearchParams({limit:`20`});r.trim()&&e.set(`q`,r.trim());try{o((await k.channels(e)).rows)}catch(e){u(O(e))}finally{c(!1)}}return(0,g.useEffect)(()=>{d()},[]),(0,G.jsxs)(`div`,{className:`entity-picker`,children:[(0,G.jsxs)(`div`,{className:`picker-head`,children:[(0,G.jsx)(`span`,{children:e}),t?(0,G.jsxs)(`button`,{className:`link-button`,type:`button`,onClick:()=>n(null),children:[(0,G.jsx)($e,{size:13}),` `,`Clear`]}):null]}),t?(0,G.jsxs)(`div`,{className:`selected-entity`,children:[(0,G.jsx)(z,{size:15}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:t.Title||`-`}),(0,G.jsx)(`span`,{className:`mono`,children:t.ID})]}),(0,G.jsx)(`span`,{children:U(t.Username)||nt(t)})]}):null,(0,G.jsxs)(`div`,{className:`picker-search`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())},placeholder:`Search channel_id / username / title`}),(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:d,disabled:s,children:s?(0,G.jsx)(R,{size:14,className:`spin`}):`Search`})]}),l&&(0,G.jsx)(`div`,{className:`picker-error`,children:l}),(0,G.jsxs)(`div`,{className:`picker-results`,children:[a.map(e=>(0,G.jsxs)(`button`,{className:`picker-row ${t?.ID===e.ID?`selected`:``}`,type:`button`,onClick:()=>n(e),children:[(0,G.jsx)(`span`,{className:`mono`,children:e.ID}),(0,G.jsx)(`strong`,{children:e.Title||`-`}),(0,G.jsx)(`span`,{children:U(e.Username)||nt(e)}),e.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:nt(e)})]},e.ID)),a.length===0&&!s?(0,G.jsx)(`div`,{className:`picker-empty`,children:`No results`}):null]})]})}function Dn({navigate:e}){let[t,n]=(0,g.useState)(`all`),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(`50`),[s,c]=(0,g.useState)([]),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(`vault`),[b,x]=(0,g.useState)(null),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(``),[E,D]=(0,g.useState)(`XTR`),[A,j]=(0,g.useState)(``),[M,N]=(0,g.useState)(``),[P,F]=(0,g.useState)(``),[I,L]=(0,g.useState)(``),[ee,te]=(0,g.useState)(``),[ne,re]=(0,g.useState)(``);async function ie(e=!1){m(!0),_(``);let n=new URLSearchParams({limit:a});t!==`all`&&n.set(`status`,t),r.trim()&&n.set(`q`,r.trim().replace(/^@/,``)),e&&d&&n.set(`before_id`,d);try{let t=await k.collectibleUsernames(n),r=t.rows??[];c(t=>e?[...t,...r]:r),f(t.next_before_id??``),u(!!t.has_more)}catch(e){_(O(e))}finally{m(!1)}}(0,g.useEffect)(()=>{ie(!1)},[]);let oe=s.filter(e=>e.Status===`vault`).length,se=s.filter(e=>e.Status===`owned`).length,ce=s.filter(e=>e.Status===`burned`).length,le=pt(A,E),ue=M?pt(P,M):`0`,z=le===null,fe=ue===null;function pe(){let e={username:w.trim().replace(/^@/,``),currency:E,amount:le??`0`};if(v===`user`&&b&&(e.owner_user_id=String(b.ID)),v===`channel`&&S&&(e.owner_channel_id=String(S.ID)),M&&(e.crypto_currency=M,e.crypto_amount=ue??`0`),I.trim()&&(e.url=I.trim()),ee){let t=Date.parse(`${ee}T${ne||`00:00`}:00Z`);Number.isFinite(t)&&(e.purchase_date=Math.floor(t/1e3))}return e}return(0,G.jsxs)(vt,{title:`Collectible usernames`,eyebrow:`NFT usernames / Registry`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>ie(!1),disabled:p,children:[(0,G.jsx)(Pe,{size:15,className:p?`spin`:``}),` `,`Refresh`]}),children:[h&&(0,G.jsx)(q,{children:h}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Loaded rows`,value:String(s.length)}),(0,G.jsx)(Y,{label:`In vault`,value:String(oe)}),(0,G.jsx)(Y,{label:`Held by owners`,value:String(se),tone:`good`}),(0,G.jsx)(Y,{label:`Burned`,value:String(ce),tone:ce?`danger`:`neutral`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Mint a collectible username`,text:`Creates the asset together with its purchase record. Keep the owner as vault to mint it unassigned.`}),(0,G.jsxs)(`div`,{className:`toolbar`,role:`group`,"aria-label":`Owner type`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`btn ${v===`vault`?`primary`:``}`,onClick:()=>y(`vault`),children:[(0,G.jsx)(Qe,{size:15}),` `,`Vault (no owner)`]}),(0,G.jsx)(`button`,{type:`button`,className:`btn ${v===`user`?`primary`:``}`,onClick:()=>y(`user`),children:`User owner`}),(0,G.jsx)(`button`,{type:`button`,className:`btn ${v===`channel`?`primary`:``}`,onClick:()=>y(`channel`),children:`Channel owner`})]}),v===`user`&&(0,G.jsx)(wn,{label:`User owner`,value:b,onChange:x}),v===`channel`&&(0,G.jsx)(En,{label:`Channel owner`,value:S,onChange:C}),(0,G.jsxs)(`div`,{className:`bot-create-fields`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Username`}),(0,G.jsx)(`input`,{value:w,onChange:e=>T(e.target.value),placeholder:`durov`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Currency`}),(0,G.jsxs)(`select`,{value:E,onChange:e=>D(e.target.value),children:[(0,G.jsx)(`option`,{value:`XTR`,children:`XTR`}),(0,G.jsx)(`option`,{value:`TON`,children:`TON`}),(0,G.jsx)(`option`,{value:`USD`,children:`USD`})]})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Amount (${E})`}),(0,G.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),inputMode:`decimal`,placeholder:`1000`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Crypto currency`}),(0,G.jsxs)(`select`,{value:M,onChange:e=>N(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`None`}),(0,G.jsx)(`option`,{value:`TON`,children:`TON`})]})]}),M!==``&&(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Crypto amount (${M})`}),(0,G.jsx)(`input`,{value:P,onChange:e=>F(e.target.value),inputMode:`decimal`,placeholder:`12.5`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Marketplace URL`}),(0,G.jsx)(`input`,{value:I,onChange:e=>L(e.target.value),placeholder:`https://fragment.com/username/durov`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Purchase date (UTC)`}),(0,G.jsx)(`input`,{value:ee,onChange:e=>te(e.target.value),type:`date`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Purchase time (UTC)`}),(0,G.jsx)(`input`,{value:ne,onChange:e=>re(e.target.value),type:`time`,step:60,disabled:!ee})]})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Amounts are typed in whole ${E} and stored as the smallest units the API and fragment.collectibleInfo carry, so clients render the price you meant. Up to ${String(lt(E))} decimal places. Clients will show: ${ft(le??`0`,E)}.`}),z&&(0,G.jsx)(q,{children:`That is not a valid ${E} amount: digits only, with at most ${String(lt(E))} decimal places.`}),M!==``&&fe&&(0,G.jsx)(q,{children:`That is not a valid ${M} amount: digits only, with at most ${String(lt(M))} decimal places.`}),(0,G.jsxs)(`div`,{className:`bot-create-actions`,children:[(0,G.jsx)(`span`,{className:`bot-create-note`,children:`Username, currency and amount are required; the dry-run checks availability first.`}),(0,G.jsx)(Z,{disabled:z||fe,label:`Mint username`,icon:(0,G.jsx)(je,{size:15}),tone:`neutral`,path:`/api/actions/mint-collectible-username`,payload:pe,onDone:()=>ie(!1)})]})]}),(0,G.jsx)(yt,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),ie(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Search by username`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsxs)(`select`,{value:t,onChange:e=>n(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All statuses`}),(0,G.jsx)(`option`,{value:`vault`,children:`Vault`}),(0,G.jsx)(`option`,{value:`owned`,children:`Owned`}),(0,G.jsx)(`option`,{value:`burned`,children:`Burned`})]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:a,onChange:e=>o(e.target.value),type:`number`,min:`1`,max:`200`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:p,children:[p?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Fe,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Username`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Owner`}),(0,G.jsx)(`th`,{children:`Price`}),(0,G.jsx)(`th`,{children:`Purchase date (UTC)`}),(0,G.jsx)(`th`,{children:`Transfers`}),(0,G.jsx)(`th`,{children:`Updated`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[s.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:(0,G.jsx)(`strong`,{children:U(t.Username)})}),(0,G.jsx)(`td`,{children:(0,G.jsx)(On,{status:t.Status})}),(0,G.jsx)(`td`,{children:kn(t,`Vault`)}),(0,G.jsx)(`td`,{className:`mono`,children:An(t)}),(0,G.jsx)(`td`,{children:W(t.PurchaseDate)||`-`}),(0,G.jsx)(`td`,{className:`mono`,children:t.TransferCount}),(0,G.jsx)(`td`,{children:W(t.UpdatedAt)||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/collectible-usernames/${t.ID}`),children:[(0,G.jsx)(ae,{size:14}),` `,`Details`,` `,(0,G.jsx)(B,{size:14})]})})]},t.ID)),s.length===0&&(0,G.jsx)(St,{colSpan:8})]})]})}),l&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>ie(!0),disabled:p,children:[p?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function On({status:e}){return e===`owned`?(0,G.jsx)(J,{tone:`good`,children:`Owned`}):e===`burned`?(0,G.jsxs)(J,{tone:`danger`,children:[(0,G.jsx)(ve,{size:12}),` `,`Burned`]}):(0,G.jsxs)(J,{children:[(0,G.jsx)(Qe,{size:12}),` `,`Vault`]})}function kn(e,t){return!e.OwnerPeerType||e.OwnerPeerID===``||e.OwnerPeerID===`0`?t:`${U(e.OwnerUsername)||e.OwnerName||e.OwnerPeerID} · ${e.OwnerPeerType}:${e.OwnerPeerID}`}function An(e){let t=ft(e.Amount,e.Currency);return e.CryptoCurrency&&e.CryptoAmount&&e.CryptoAmount!==`0`?`${t} (${ft(e.CryptoAmount,e.CryptoCurrency)})`:t}function jn({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(`user`),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(null);async function m(){s(!0),a(``);try{r(await k.collectibleUsername(e))}catch(e){a(O(e))}finally{s(!1)}}if((0,g.useEffect)(()=>{m()},[e]),i&&!n)return(0,G.jsx)(q,{children:i});if(!n)return(0,G.jsx)(Ct,{label:o?`Loading collectible username…`:`Waiting for data`});let h=n.asset,_=n.transfers??[],v=`Vault`,y=!!h.OwnerPeerType&&h.OwnerPeerID!==``&&h.OwnerPeerID!==`0`,b=h.Status===`burned`;function x(){y&&t(h.OwnerPeerType===`channel`?`/channels/${h.OwnerPeerID}`:`/accounts/${h.OwnerPeerID}`)}function S(){let e={username:h.Username};return c===`user`&&u&&(e.to_user_id=String(u.ID)),c===`channel`&&f&&(e.to_channel_id=String(f.ID)),e}return(0,G.jsxs)(vt,{title:`Collectible ${U(h.Username)}`,eyebrow:`NFT usernames / Asset`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/collectible-usernames`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:m,disabled:o,children:[(0,G.jsx)(Pe,{size:15,className:o?`spin`:``}),` `,`Refresh`]})]}),children:[i&&(0,G.jsx)(q,{children:i}),(0,G.jsx)(bt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:U(h.Username)}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:`Asset #${h.ID}`})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(On,{status:h.Status}),(0,G.jsx)(J,{tone:h.TransferCount>0?`warn`:`neutral`,children:`${h.TransferCount} transfers`}),h.Status===`owned`&&(0,G.jsx)(J,{tone:h.RegistryActive?`good`:`warn`,children:h.RegistryActive?`Active in profile`:`Hidden in profile`})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Owner`,value:kn(h,v)}),(0,G.jsx)(X,{label:`Price`,value:An(h),mono:!0}),(0,G.jsx)(X,{label:`Purchase date (UTC)`,value:W(h.PurchaseDate)||`-`}),(0,G.jsx)(X,{label:`Original owner`,value:Pn(h.OriginalOwnerPeerType,h.OriginalOwnerPeerID,v,h.OriginalOwnerUsername)}),(0,G.jsx)(X,{label:`Transfers`,value:String(h.TransferCount),mono:!0}),(0,G.jsx)(X,{label:`Created`,value:W(h.CreatedAt)||`-`}),(0,G.jsx)(X,{label:`Updated`,value:W(h.UpdatedAt)||`-`})]}),(0,G.jsxs)(`div`,{className:`toolbar`,children:[y&&(0,G.jsx)(`button`,{className:`row-link`,type:`button`,onClick:x,children:h.OwnerPeerType===`channel`?`Open owner channel`:`Open owner account`}),h.URL&&(0,G.jsxs)(`a`,{className:`row-link`,href:h.URL,target:`_blank`,rel:`noreferrer noopener`,children:[(0,G.jsx)(me,{size:14}),` `,`Open marketplace page`]})]}),!b&&(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Transfer ownership`,text:`Pick the recipient; the transfer is appended to the provenance history.`}),(0,G.jsxs)(`div`,{className:`toolbar`,role:`group`,"aria-label":`Recipient type`,children:[(0,G.jsx)(`button`,{type:`button`,className:`btn ${c===`user`?`primary`:``}`,onClick:()=>l(`user`),children:`To user`}),(0,G.jsx)(`button`,{type:`button`,className:`btn ${c===`channel`?`primary`:``}`,onClick:()=>l(`channel`),children:`To channel`})]}),c===`user`?(0,G.jsx)(wn,{label:`To user`,value:u,onChange:d}):(0,G.jsx)(En,{label:`To channel`,value:f,onChange:p}),(0,G.jsxs)(`div`,{className:`bot-create-actions`,children:[(0,G.jsx)(`span`,{className:`bot-create-note`,children:`The current owner loses the username immediately after confirmation.`}),(0,G.jsx)(Z,{label:`Transfer`,icon:(0,G.jsx)(re,{size:15}),tone:`warn`,path:`/api/actions/transfer-collectible-username`,payload:S,onDone:m})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Provenance history`,text:`Mint, transfer, revoke and burn events in chronological order.`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Event`}),(0,G.jsx)(`th`,{children:`From`}),(0,G.jsx)(`th`,{children:`To`}),(0,G.jsx)(`th`,{children:`Price`}),(0,G.jsx)(`th`,{children:`Actor`}),(0,G.jsx)(`th`,{children:`Reason`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[_.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:e.ID}),(0,G.jsx)(`td`,{children:(0,G.jsx)(Nn,{kind:e.Kind})}),(0,G.jsx)(`td`,{className:`mono`,children:Pn(e.FromPeerType,e.FromPeerID,v,e.FromUsername)}),(0,G.jsx)(`td`,{className:`mono`,children:Pn(e.ToPeerType,e.ToPeerID,v,e.ToUsername)}),(0,G.jsx)(`td`,{className:`mono`,children:e.Amount&&e.Amount!==`0`?ft(e.Amount,e.Currency):`-`}),(0,G.jsx)(`td`,{children:e.Actor||`-`}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Reason||`-`}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)||`-`})]},e.ID)),_.length===0&&(0,G.jsx)(St,{colSpan:8})]})]})})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Asset operations`}),b?(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This username is burned — no further operations are possible.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`action-stack`,children:(0,G.jsx)(Z,{label:`Revoke to vault`,icon:(0,G.jsx)(Je,{size:15}),tone:`warn`,path:`/api/actions/revoke-collectible-username`,payload:()=>({username:h.Username,burn:!1}),onDone:m})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Takes the username away from its owner and returns it to the vault; it can be issued again later.`}),(0,G.jsxs)(`div`,{className:`danger-zone`,children:[(0,G.jsx)(Z,{label:`Burn permanently`,icon:(0,G.jsx)(ve,{size:15}),tone:`danger`,path:`/api/actions/revoke-collectible-username`,payload:()=>({username:h.Username,burn:!0}),onDone:m}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Irreversible: the username is destroyed and can never be issued again.`}),(0,G.jsx)(Z,{label:`Delete record`,icon:(0,G.jsx)(Ke,{size:15}),tone:`danger`,path:`/api/actions/delete-collectible-username`,payload:()=>({username:h.Username}),onDone:()=>t(`/collectible-usernames`)}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Erases the asset and its ownership history, and frees the username for a fresh issue. Use this for a username issued by mistake; a burn keeps the history instead.`})]})]})]})})]})}var Mn={mint:`Mint`,transfer:`Transfer`,burn:`Burn`,revoke:`Revoke`};function Nn({kind:e}){return(0,G.jsx)(J,{tone:e===`burn`?`danger`:e===`revoke`?`warn`:e===`mint`?`good`:`neutral`,children:Mn[e]})}function Pn(e,t,n,r=``){if(!e||t===``||t===`0`)return n;let i=U(r);return i?`${i} · ${e}:${t}`:`${e}:${t}`}function Fn({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``);async function o(){a(``);try{r(await k.channel(e))}catch(e){a(O(e))}}if((0,g.useEffect)(()=>{o()},[e]),i)return(0,G.jsx)(q,{children:i});if(!n)return(0,G.jsx)(Ct,{label:`Loading channel detail`});let s=n.Channel;return(0,G.jsx)(vt,{title:`${nt(s)} #${s.ID}`,eyebrow:`Channel Profile`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>t(`/channels`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),children:(0,G.jsx)(bt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:s.Title||`-`}),(0,G.jsxs)(`div`,{className:`entity-subtitle`,children:[U(s.Username)||`No username`,` · `,`Creator ${s.CreatorUserID}`]})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(J,{children:nt(s)}),s.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Not verified`}),(0,G.jsx)(Zt,{scam:s.Scam,fake:s.Fake}),s.Deleted?(0,G.jsx)(J,{tone:`danger`,children:`Deleted`}):(0,G.jsx)(J,{children:`Valid`})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Channel ID`,value:String(s.ID),mono:!0}),(0,G.jsx)(X,{label:`access_hash`,value:String(s.AccessHash),mono:!0}),(0,G.jsx)(X,{label:`Members`,value:`${s.ParticipantsCount} / Admins ${s.AdminsCount}`}),(0,G.jsx)(X,{label:`Moderation`,value:`Banned ${s.BannedCount} / Kicked ${s.KickedCount}`}),(0,G.jsx)(X,{label:`Channel flags`,value:`broadcast=${s.Broadcast} megagroup=${s.Megagroup} forum=${s.Forum}`}),(0,G.jsx)(X,{label:`top / pinned / PTS`,value:`${s.TopMessageID} / ${s.PinnedMessageID} / ${s.PTS}`}),(0,G.jsx)(X,{label:`Created`,value:rt(s.Date)||`-`}),(0,G.jsx)(X,{label:`Updated`,value:W(s.UpdatedAt)||`-`})]}),s.About&&(0,G.jsx)(`p`,{className:`about-text`,children:s.About}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Recent Admin Actions`,text:`Last 30 audit rows`}),(0,G.jsx)(xt,{rows:n.AuditLogs})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Channel Raw Row`,text:`Database read-only snapshot`}),(0,G.jsx)(wt,{value:n.ChannelJSON})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Channel Actions`}),(0,G.jsx)(Z,{label:s.Verified?`Clear verified`:`Set verified`,icon:(0,G.jsx)(F,{size:15}),tone:`warn`,path:`/api/actions/set-channel-verified`,payload:()=>({channel_id:s.ID,verified:!s.Verified}),onDone:o}),(0,G.jsx)(Qt,{idKey:`channel_id`,id:s.ID,path:`/api/actions/set-channel-flags`,scam:s.Scam,fake:s.Fake,onDone:o}),(0,G.jsx)(`div`,{className:`dock-title`,children:`Settings`}),(0,G.jsx)(rn,{channel:s,onDone:o}),(0,G.jsx)(`div`,{className:`dock-title`,children:`Attributes`}),(0,G.jsx)(en,{idKey:`channel_id`,id:s.ID,path:`/api/actions/set-channel-username`,current:s.Username,onDone:o}),(0,G.jsx)(tn,{idKey:`channel_id`,id:s.ID,path:`/api/actions/set-channel-color`,onDone:o}),(0,G.jsx)(nn,{idKey:`channel_id`,id:s.ID,path:`/api/actions/set-channel-emoji-status`,onDone:o})]})})})}function In({navigate:e}){let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(`50`),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)({beforeID:0,beforeUpdatedUS:0}),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``);async function p(e=!1){u(!0),f(``);let n=new URLSearchParams({limit:r});t.trim()?n.set(`q`,t.trim()):e&&(n.set(`before_id`,String(s.beforeID)),n.set(`before_updated_us`,String(s.beforeUpdatedUS)));try{let e=await k.channels(n);o(e),c({beforeID:e.next_before_id,beforeUpdatedUS:e.next_before_updated_us})}catch(e){f(O(e))}finally{u(!1)}}(0,g.useEffect)(()=>{p(!1)},[]);let m=xn(a?.rows??[]);return(0,G.jsxs)(vt,{title:`Supergroups and Channels`,eyebrow:a?.listing===!1?`Search results`:`Recently updated`,actions:(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>p(!1),disabled:l,children:[(0,G.jsx)(Pe,{size:15}),` `,`Refresh`]}),children:[d&&(0,G.jsx)(q,{children:d}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Entities on page`,value:String(a?.rows.length??0)}),(0,G.jsx)(Y,{label:`Supergroups`,value:String(m.megagroups)}),(0,G.jsx)(Y,{label:`Channels`,value:String(m.broadcasts)}),(0,G.jsx)(Y,{label:`Verified`,value:String(m.verified),tone:`good`})]}),(0,G.jsx)(yt,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),p(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),placeholder:`Channel ID / username / title`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:r,onChange:e=>i(e.target.value),type:`number`,min:`1`,max:`100`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:l,children:[l?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Fe,{size:15}),` `,`Search`]}),a?.listing&&a.has_more&&(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>p(!0),disabled:l,children:[(0,G.jsx)(B,{size:15}),` `,`Next page`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Channel ID`}),(0,G.jsx)(`th`,{children:`Kind`}),(0,G.jsx)(`th`,{children:`Username`}),(0,G.jsx)(`th`,{children:`Title`}),(0,G.jsx)(`th`,{children:`Members`}),(0,G.jsx)(`th`,{children:`Admins`}),(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Verified`}),(0,G.jsx)(`th`,{children:`Updated`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[a?.rows.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:t.ID}),(0,G.jsx)(`td`,{children:nt(t)}),(0,G.jsx)(`td`,{children:U(t.Username)}),(0,G.jsx)(`td`,{children:t.Title}),(0,G.jsx)(`td`,{children:t.ParticipantsCount}),(0,G.jsx)(`td`,{children:t.AdminsCount}),(0,G.jsx)(`td`,{children:t.PTS}),(0,G.jsxs)(`td`,{children:[t.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Not verified`}),` `,(0,G.jsx)(Zt,{scam:t.Scam,fake:t.Fake})]}),(0,G.jsx)(`td`,{children:W(t.UpdatedAt)}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/channels/${t.ID}`),children:[`Details`,` `,(0,G.jsx)(B,{size:14})]})})]},t.ID)),(!a||a.rows.length===0)&&(0,G.jsx)(St,{colSpan:10})]})]})})]})}function Ln({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1);async function c(){s(!0),a(``);try{r(await k.bot(e))}catch(e){a(O(e))}finally{s(!1)}}if((0,g.useEffect)(()=>{c()},[e]),i)return(0,G.jsx)(q,{children:i});if(!n)return(0,G.jsx)(Ct,{label:o?`Loading bot detail`:`Waiting for data`});let l=n.Bot;return(0,G.jsx)(vt,{title:`Bot #${l.ID}`,eyebrow:`Bot Profile`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>t(`/bots`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),children:(0,G.jsx)(bt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:l.FirstName||`Unnamed bot`}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:U(l.Username)||`No username`})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(J,{tone:l.System?`warn`:`neutral`,children:l.System?`System`:`User`}),l.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Not verified`}),(0,G.jsx)(Zt,{scam:l.Scam,fake:l.Fake})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Bot ID`,value:String(l.ID),mono:!0}),(0,G.jsx)(X,{label:`Owner`,value:l.OwnerUserID>0?`${l.OwnerUserID} ${U(n.OwnerUsername)}`.trim():`None`}),(0,G.jsx)(X,{label:`Type`,value:l.System?`System`:`User`}),(0,G.jsx)(X,{label:`Updated`,value:W(l.UpdatedAt)||`-`}),(0,G.jsx)(X,{label:`Created`,value:W(l.CreatedAt)||`-`})]}),n.About&&(0,G.jsx)(`p`,{className:`about-text`,children:n.About}),n.Description&&n.Description.trim()!==n.About.trim()&&(0,G.jsx)(`p`,{className:`about-text`,children:n.Description}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Recent Admin Actions`,text:`Last 30 audit rows`}),(0,G.jsx)(xt,{rows:n.AuditLogs})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Bot Actions`}),(0,G.jsx)(`div`,{className:`action-stack`,children:(0,G.jsx)(Z,{label:l.Verified?`Clear verified`:`Set verified`,icon:(0,G.jsx)(F,{size:15}),tone:`neutral`,path:`/api/actions/set-verified`,payload:()=>({user_id:l.ID,verified:!l.Verified}),onDone:c})}),(0,G.jsx)(Qt,{idKey:`user_id`,id:l.ID,path:`/api/actions/set-account-flags`,scam:l.Scam,fake:l.Fake,onDone:c}),(0,G.jsx)(`div`,{className:`dock-title`,children:`Attributes`}),(0,G.jsx)(en,{idKey:`user_id`,id:l.ID,path:`/api/actions/set-account-username`,current:l.Username,onDone:c}),(0,G.jsx)(tn,{idKey:`user_id`,id:l.ID,path:`/api/actions/set-account-color`,onDone:c}),(0,G.jsx)(nn,{idKey:`user_id`,id:l.ID,path:`/api/actions/set-account-emoji-status`,onDone:c}),l.System?(0,G.jsx)(`p`,{className:`bot-create-note`,children:`System bots are built in and cannot be deleted.`}):(0,G.jsxs)(`div`,{className:`danger-zone`,children:[(0,G.jsx)(Z,{label:`Delete bot`,icon:(0,G.jsx)(Ke,{size:15}),tone:`danger`,path:`/api/actions/delete-bot`,payload:()=>({bot_user_id:l.ID}),onDone:()=>t(`/bots`)}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Permanently deletes this user-created bot and invalidates its token. This cannot be undone.`})]})]})})})}function Rn({navigate:e}){let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(`50`),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(0),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(``),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(``);async function b(e=!1){u(!0),f(``);let n=new URLSearchParams({limit:r});t.trim()?n.set(`q`,t.trim()):e&&n.set(`before_id`,String(s));try{let e=await k.bots(n);o(e),c(e.next_before_id)}catch(e){f(O(e))}finally{u(!1)}}(0,g.useEffect)(()=>{b(!1)},[]);let x=a?.rows??[],S=x.filter(e=>e.Verified).length,C=x.filter(e=>e.System).length;return(0,G.jsxs)(vt,{title:`Bots`,eyebrow:a?.listing===!1?`Search results`:`Recently created bots`,actions:(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>b(!1),disabled:l,children:[(0,G.jsx)(Pe,{size:15}),` `,`Refresh`]}),children:[d&&(0,G.jsx)(q,{children:d}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Bots on page`,value:String(x.length)}),(0,G.jsx)(Y,{label:`Verified`,value:String(S),tone:`good`}),(0,G.jsx)(Y,{label:`System`,value:String(C)})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(`div`,{className:`section-head`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:`Create a system bot`}),(0,G.jsx)(`p`,{children:`Provision a bot account owned by the given user. The token is shown once after confirmation.`})]})}),(0,G.jsxs)(`div`,{className:`bot-create-fields`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Owner user ID`}),(0,G.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),type:`number`,min:`1`,placeholder:`123456789`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Display name`}),(0,G.jsx)(`input`,{value:h,onChange:e=>_(e.target.value),placeholder:`e.g. Service Bot`,maxLength:64})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Username`}),(0,G.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`my_service_bot`})]})]}),(0,G.jsxs)(`div`,{className:`bot-create-actions`,children:[(0,G.jsx)(`span`,{className:`bot-create-note`,children:`Username must be 5-32 characters and end with 'bot'.`}),(0,G.jsx)(Z,{label:`Create bot`,icon:(0,G.jsx)(je,{size:15}),tone:`neutral`,path:`/api/actions/create-bot`,payload:()=>({owner_user_id:at(p),name:h.trim(),username:v.trim().replace(/^@/,``)}),onDone:()=>b(!1)})]})]}),(0,G.jsx)(yt,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),b(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),placeholder:`Bot ID / username`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:r,onChange:e=>i(e.target.value),type:`number`,min:`1`,max:`100`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:l,children:[l?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Fe,{size:15}),` `,`Search`]}),a?.listing&&a.has_more&&(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>b(!0),disabled:l,children:[(0,G.jsx)(B,{size:15}),` `,`Next page`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Bot ID`}),(0,G.jsx)(`th`,{children:`Username`}),(0,G.jsx)(`th`,{children:`Name`}),(0,G.jsx)(`th`,{children:`Owner`}),(0,G.jsx)(`th`,{children:`Verified`}),(0,G.jsx)(`th`,{children:`Type`}),(0,G.jsx)(`th`,{children:`Created`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[x.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:t.ID}),(0,G.jsx)(`td`,{children:U(t.Username)||`-`}),(0,G.jsx)(`td`,{children:t.FirstName||`-`}),(0,G.jsx)(`td`,{className:`mono`,children:t.OwnerUserID>0?t.OwnerUserID:`-`}),(0,G.jsxs)(`td`,{children:[t.Verified?(0,G.jsxs)(J,{tone:`good`,children:[(0,G.jsx)(F,{size:12}),` `,`Verified`]}):(0,G.jsx)(J,{children:`Not verified`}),` `,(0,G.jsx)(Zt,{scam:t.Scam,fake:t.Fake})]}),(0,G.jsx)(`td`,{children:t.System?(0,G.jsx)(J,{tone:`warn`,children:`System`}):(0,G.jsx)(J,{children:`User`})}),(0,G.jsx)(`td`,{children:W(t.CreatedAt)}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/bots/${t.ID}`),children:[(0,G.jsx)(se,{size:14}),` `,`Details`,` `,(0,G.jsx)(B,{size:14})]})})]},t.ID)),x.length===0&&(0,G.jsx)(St,{colSpan:8})]})]})})]})}function zn({navigate:e}){return(0,G.jsx)(`div`,{className:`dashboard-layout`,children:(0,G.jsxs)(`div`,{className:`command-grid`,children:[(0,G.jsx)(Bn,{icon:(0,G.jsx)(Ze,{}),title:`Accounts`,text:`Account status, premium, verification, sessions.`,href:`/accounts`,navigate:e}),(0,G.jsx)(Bn,{icon:(0,G.jsx)(ze,{}),title:`Supergroups and Channels`,text:`Public entities, member counts, verification state.`,href:`/channels`,navigate:e}),(0,G.jsx)(Bn,{icon:(0,G.jsx)(Ee,{}),title:`Message Audit`,text:`Message boxes, updates, outbox state.`,href:`/messages`,navigate:e})]})})}function Bn({icon:e,title:t,text:n,href:r,navigate:i}){return(0,G.jsxs)(Wt,{className:`launcher`,href:r,navigate:i,children:[(0,G.jsx)(`span`,{className:`launcher-icon`,children:e}),(0,G.jsxs)(`span`,{className:`launcher-copy`,children:[(0,G.jsx)(`strong`,{children:t}),(0,G.jsx)(`span`,{children:n})]}),(0,G.jsx)(B,{size:16})]})}function Vn({channelID:e,msgID:t,navigate:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``);async function s(){o(``);try{i(await k.groupMessage(e,t))}catch(e){o(O(e))}}if((0,g.useEffect)(()=>{s()},[e,t]),a)return(0,G.jsx)(q,{children:a});if(!r)return(0,G.jsx)(Ct,{label:`Loading`});let c=r.Message;return(0,G.jsx)(vt,{title:`Group Message #${c.ID}`,eyebrow:`Message Detail`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>n(`/messages/groups`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to group messages`]}),children:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:`Channel / Group ${c.ChannelID}`}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:`Sender ${c.SenderUserID} · ${rt(c.Date)}`})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[c.Deleted?(0,G.jsx)(J,{tone:`danger`,children:`Deleted`}):(0,G.jsx)(J,{children:`Live`}),c.Pinned&&(0,G.jsx)(J,{tone:`warn`,children:`Pinned`}),c.Post&&(0,G.jsx)(J,{children:`Channel post`}),(0,G.jsxs)(J,{children:[`pts `,c.PTS]})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Message ID`,value:String(c.ID),mono:!0}),(0,G.jsx)(X,{label:`Channel / Group`,value:String(c.ChannelID),mono:!0}),(0,G.jsx)(X,{label:`From Peer`,value:`${c.FromPeerType}:${c.FromPeerID}`,mono:!0}),(0,G.jsx)(X,{label:`Views`,value:String(c.ViewsCount)})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Channel Message Row`,text:`channel_messages read-only snapshot`}),(0,G.jsx)(wt,{value:r.MessageJSON})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Channel Row`,text:`channels read-only snapshot`}),(0,G.jsx)(wt,{value:r.ChannelJSON})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Channel Update Events`,text:`durable channel_update_events`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Count`}),(0,G.jsx)(`th`,{children:`Type`}),(0,G.jsx)(`th`,{children:`Message ID`}),(0,G.jsx)(`th`,{children:`Sender`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[r.UpdateEvents.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:e.PTS}),(0,G.jsx)(`td`,{children:e.PTSCount}),(0,G.jsx)(`td`,{children:e.Type}),(0,G.jsx)(`td`,{children:e.MessageID}),(0,G.jsx)(`td`,{children:e.SenderUserID}),(0,G.jsx)(`td`,{children:rt(e.Date)})]},`${e.PTS}-${e.Type}-${e.MessageID}`)),r.UpdateEvents.length===0&&(0,G.jsx)(St,{colSpan:6})]})]})})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Event JSON`}),(0,G.jsxs)(`div`,{className:`raw-grid`,children:[r.UpdateEvents.map(e=>(0,G.jsx)(wt,{value:e.JSON},`${e.PTS}-${e.Type}-json`)),r.UpdateEvents.length===0&&(0,G.jsx)(`div`,{className:`empty-panel`,children:`No results`})]})]})]})})}function Hn({navigate:e}){let[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(`100`),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(``);async function p(e=!1){if(f(``),!t){f(`Search and select a supergroup or channel first`);return}let n=new URLSearchParams({channel_id:String(t.ID),limit:s});if(e&&l?.rows.length){let e=l.rows[l.rows.length-1];n.set(`before_date`,String(e.Date)),n.set(`before_id`,String(e.ID)),i(String(e.Date)),o(String(e.ID))}else r&&n.set(`before_date`,r),a&&n.set(`before_id`,a);try{u(await k.groupMessages(n))}catch(e){f(O(e))}}function m(e){n(e),i(``),o(``),u(null)}let h=l?.rows??[];return(0,G.jsxs)(vt,{title:`Group Messages`,eyebrow:`Supergroup / channel messages`,children:[d&&(0,G.jsx)(q,{children:d}),(0,G.jsxs)(yt,{children:[(0,G.jsx)(`div`,{className:`message-selector-grid single`,children:(0,G.jsx)(En,{label:`Channel / Group`,value:t,onChange:m})}),(0,G.jsxs)(`form`,{className:`toolbar message-query`,onSubmit:e=>{e.preventDefault(),p(!1)},children:[(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`before_date cursor`}),(0,G.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`before_msg_id cursor`}),(0,G.jsx)(`input`,{className:`small-input`,value:s,onChange:e=>c(e.target.value),placeholder:`limit <= 100`}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,children:[(0,G.jsx)(Fe,{size:15}),` `,`Search messages`]}),h.length?(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>p(!0),children:[(0,G.jsx)(B,{size:15}),` `,`Next page`]}):null]})]}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Messages on page`,value:String(h.length)}),(0,G.jsx)(Y,{label:`With media`,value:String(h.filter(e=>e.Media&&e.Media!==`{}`).length)}),(0,G.jsx)(Y,{label:`Channel posts`,value:String(h.filter(e=>e.Post).length)}),(0,G.jsx)(Y,{label:`Channel / Group`,value:t?`${t.Title||nt(t)} (${t.ID})`:`-`})]}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Message ID`}),(0,G.jsx)(`th`,{children:`Time`}),(0,G.jsx)(`th`,{children:`Sender`}),(0,G.jsx)(`th`,{children:`From Peer`}),(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Views`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Body`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[h.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:t.ID}),(0,G.jsx)(`td`,{children:rt(t.Date)}),(0,G.jsx)(`td`,{className:`mono`,children:t.SenderUserID}),(0,G.jsxs)(`td`,{className:`mono`,children:[t.FromPeerType,`:`,t.FromPeerID]}),(0,G.jsx)(`td`,{children:t.PTS}),(0,G.jsx)(`td`,{children:t.ViewsCount}),(0,G.jsx)(`td`,{children:t.Deleted?(0,G.jsx)(J,{tone:`danger`,children:`Deleted`}):t.Pinned?(0,G.jsx)(J,{tone:`warn`,children:`Pinned`}):(0,G.jsx)(J,{children:`Live`})}),(0,G.jsx)(`td`,{className:`truncate`,children:t.Body}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/messages/groups/detail?channel_id=${t.ChannelID}&msg_id=${t.ID}`),children:[`Details`,` `,(0,G.jsx)(B,{size:14})]})})]},`${t.ChannelID}-${t.ID}`)),h.length===0&&(0,G.jsx)(St,{colSpan:9})]})]})})]})}function Un({ownerUserID:e,msgID:t,navigate:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``);async function s(){o(``);try{i(await k.message(e,t))}catch(e){o(O(e))}}if((0,g.useEffect)(()=>{s()},[e,t]),a)return(0,G.jsx)(q,{children:a});if(!r)return(0,G.jsx)(Ct,{label:`Loading`});let c=r.Message;return(0,G.jsx)(vt,{title:`Message #${c.BoxID}`,eyebrow:`Message Detail`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>n(`/messages/private`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to private messages`]}),children:(0,G.jsx)(bt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:`Owner ${c.OwnerUserID} · Peer ${c.PeerID}`}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:`Sender ${c.FromUserID} · ${rt(c.Date)}`})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[c.Deleted?(0,G.jsx)(J,{tone:`danger`,children:`Deleted`}):(0,G.jsx)(J,{children:`Live`}),(0,G.jsxs)(J,{children:[`pts `,c.PTS]}),(0,G.jsx)(J,{children:c.Outgoing?`Outgoing`:`Incoming`})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Message box ID`,value:String(c.BoxID),mono:!0}),(0,G.jsx)(X,{label:`Private message ID`,value:String(c.PrivateMessageID),mono:!0}),(0,G.jsx)(X,{label:`Message sender`,value:String(c.MessageSenderID),mono:!0}),(0,G.jsx)(X,{label:`Time`,value:rt(c.Date)})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Message Box`,text:`message_boxes read-only snapshot`}),(0,G.jsx)(wt,{value:r.MessageJSON})]}),(0,G.jsxs)(`div`,{className:`raw-grid`,children:[(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Dialog Row`,text:`dialogs read-only snapshot`}),(0,G.jsx)(wt,{value:r.DialogJSON})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Private Message Row`,text:`private_messages read-only snapshot`}),(0,G.jsx)(wt,{value:r.PrivateJSON})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Update Events`,text:`durable user_update_events`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Count`}),(0,G.jsx)(`th`,{children:`Type`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[r.UpdateEvents.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:e.PTS}),(0,G.jsx)(`td`,{children:e.PTSCount}),(0,G.jsx)(`td`,{children:e.Type}),(0,G.jsx)(`td`,{children:rt(e.Date)})]},`${e.PTS}-${e.Type}`)),r.UpdateEvents.length===0&&(0,G.jsx)(St,{colSpan:4})]})]})})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Dispatch Queue`,text:`online/offline dispatch_outbox`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`User ID`}),(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Type`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Attempts`}),(0,G.jsx)(`th`,{children:`Updated`})]})}),(0,G.jsxs)(`tbody`,{children:[r.Outbox.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:e.ID}),(0,G.jsx)(`td`,{children:e.TargetUserID}),(0,G.jsx)(`td`,{children:e.PTS}),(0,G.jsx)(`td`,{children:e.EventType}),(0,G.jsx)(`td`,{children:e.Status}),(0,G.jsx)(`td`,{children:e.Attempts}),(0,G.jsx)(`td`,{children:W(e.UpdatedAt)})]},e.ID)),r.Outbox.length===0&&(0,G.jsx)(St,{colSpan:7})]})]})})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Operations`}),(0,G.jsx)(Z,{label:`Delete this message`,icon:(0,G.jsx)(Ke,{size:15}),path:`/api/actions/delete-messages`,payload:()=>({owner_user_id:c.OwnerUserID,peer_id:c.PeerID,ids:[c.BoxID],revoke:!0}),onDone:s})]})})})}function Wn({navigate:e}){let[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(`100`),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(!0),[h,_]=(0,g.useState)(!1),[v,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(`1`),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(``);async function E(e=!1){if(T(``),!t||!r){T(`Search and select the owner user and peer user first`);return}let n=new URLSearchParams({owner_user_id:String(t.ID),peer_id:String(r.ID),limit:l});if(e&&S?.rows.length){let e=S.rows[S.rows.length-1];n.set(`before_date`,String(e.Date)),n.set(`before_id`,String(e.BoxID)),o(String(e.Date)),c(String(e.BoxID))}else a&&n.set(`before_date`,a),s&&n.set(`before_id`,s);try{C(await k.messages(n))}catch(e){T(O(e))}}function D(e){n(e),o(``),c(``),C(null)}function A(e){i(e),o(``),c(``),C(null)}return(0,G.jsxs)(vt,{title:`Private Messages`,eyebrow:`Private message boxes`,children:[w&&(0,G.jsx)(q,{children:w}),(0,G.jsxs)(yt,{children:[(0,G.jsxs)(`div`,{className:`message-selector-grid`,children:[(0,G.jsx)(wn,{label:`Owner user`,value:t,onChange:D}),(0,G.jsx)(wn,{label:`Peer user`,value:r,onChange:A})]}),(0,G.jsxs)(`form`,{className:`toolbar message-query`,onSubmit:e=>{e.preventDefault(),E(!1)},children:[(0,G.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`before_date cursor`}),(0,G.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`before_msg_id cursor`}),(0,G.jsx)(`input`,{className:`small-input`,value:l,onChange:e=>u(e.target.value),placeholder:`limit <= 100`}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,children:[(0,G.jsx)(Fe,{size:15}),` `,`Search messages`]}),S?.rows.length?(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>E(!0),children:[(0,G.jsx)(B,{size:15}),` `,`Next page`]}):null]})]}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Messages on page`,value:String(S?.rows.length??0)}),(0,G.jsx)(Y,{label:`Deleted`,value:String((S?.rows??[]).filter(e=>e.Deleted).length),tone:`danger`}),(0,G.jsx)(Y,{label:`Outgoing`,value:String((S?.rows??[]).filter(e=>e.Outgoing).length)}),(0,G.jsx)(Y,{label:`Owner / Peer`,value:t&&r?`${tt(t)} / ${tt(r)}`:`-`})]}),(0,G.jsxs)(`div`,{className:`operation-row`,children:[(0,G.jsxs)(`div`,{className:`operation-box`,children:[(0,G.jsxs)(`div`,{className:`operation-title`,children:[(0,G.jsx)(Ke,{size:15}),` `,`Delete selected messages`]}),(0,G.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`Message IDs, comma separated`}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),` `,`Revoke for both sides`]}),(0,G.jsx)(Z,{path:`/api/actions/delete-messages`,label:`Dry-run delete`,payload:()=>({owner_user_id:t?.ID??0,peer_id:r?.ID??0,ids:gt(d,`Message IDs are invalid`),revoke:p})})]}),(0,G.jsxs)(`div`,{className:`operation-box`,children:[(0,G.jsxs)(`div`,{className:`operation-title`,children:[(0,G.jsx)(xe,{size:15}),` `,`Clear private history`]}),(0,G.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`max_id cutoff`}),(0,G.jsx)(`input`,{value:b,onChange:e=>x(e.target.value),placeholder:`max_batches`}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),` `,`Revoke for both sides`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>_(e.target.checked)}),` `,`Clear only this side`]}),(0,G.jsx)(Z,{path:`/api/actions/delete-history`,label:`Dry-run clear history`,payload:()=>({owner_user_id:t?.ID??0,peer_id:r?.ID??0,max_id:at(v),max_batches:at(b),just_clear:h,revoke:p})})]})]}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Message ID`}),(0,G.jsx)(`th`,{children:`Time`}),(0,G.jsx)(`th`,{children:`Sender`}),(0,G.jsx)(`th`,{children:`Direction`}),(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Body`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[S?.rows.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:t.BoxID}),(0,G.jsx)(`td`,{children:rt(t.Date)}),(0,G.jsx)(`td`,{className:`mono`,children:t.FromUserID}),(0,G.jsx)(`td`,{children:t.Outgoing?`Outgoing`:`Incoming`}),(0,G.jsx)(`td`,{children:t.PTS}),(0,G.jsx)(`td`,{children:t.Deleted?(0,G.jsx)(J,{tone:`danger`,children:`Deleted`}):(0,G.jsx)(J,{children:`Live`})}),(0,G.jsx)(`td`,{className:`truncate`,children:t.Body}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/messages/private/detail?owner_user_id=${t.OwnerUserID}&msg_id=${t.BoxID}`),children:[`Details`,` `,(0,G.jsx)(B,{size:14})]})})]},`${t.OwnerUserID}-${t.BoxID}`)),(!S||S.rows.length===0)&&(0,G.jsx)(St,{colSpan:8})]})]})})]})}var Gn=c(o(((e,t)=>{typeof document<`u`&&typeof navigator<`u`&&(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.lottie=r())})(e,(function(){var n=``,r=!1,i=-999999,a=function(e){r=!!e},o=function(){return r},s=function(e){n=e},c=function(){return n};function l(e){return document.createElement(e)}function u(e,t){var n,r=e.length,i;for(n=0;n1?n[1]=1:n[1]<=0&&(n[1]=0),L(n[0],n[1],n[2])}function te(e,t){var n=ee(e[0]*255,e[1]*255,e[2]*255);return n[2]+=t,n[2]>1?n[2]=1:n[2]<0&&(n[2]=0),L(n[0],n[1],n[2])}function ne(e,t){var n=ee(e[0]*255,e[1]*255,e[2]*255);return n[0]+=t/360,n[0]>1?--n[0]:n[0]<0&&(n[0]+=1),L(n[0],n[1],n[2])}(function(){var e=[],t,n;for(t=0;t<256;t+=1)n=t.toString(16),e[t]=n.length===1?`0`+n:n;return function(t,n,r){return t<0&&(t=0),n<0&&(n=0),r<0&&(r=0),`#`+e[t]+e[n]+e[r]}})();var re=function(e){g=!!e},ie=function(){return g},ae=function(e){_=e},oe=function(){return _},se=function(){return v},ce=function(e){E=e},le=function(){return E},ue=function(e){y=e};function z(e){return document.createElementNS(`http://www.w3.org/2000/svg`,e)}function de(e){"@babel/helpers - typeof";return de=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},de(e)}var fe=function(){var e=1,t=[],n,r,i={onmessage:function(){},postMessage:function(e){n({data:e})}},a={postMessage:function(e){i.onmessage({data:e})}};function s(e){if(window.Worker&&window.Blob&&o()){var t=new Blob([`var _workerSelf = self; self.onmessage = `,e.toString()],{type:`text/javascript`}),r=URL.createObjectURL(t);return new Worker(r)}return n=e,i}function c(){r||(r=s(function(e){function t(){function e(t,n){var o,s,c=t.length,l,u,d,f;for(s=0;s=0;--t)if(e[t].ty===`sh`)if(e[t].ks.k.i)a(e[t].ks.k);else for(o=e[t].ks.k.length,r=0;rn[0]?!0:n[0]>e[0]?!1:e[1]>n[1]?!0:n[1]>e[1]?!1:e[2]>n[2]?!0:n[2]>e[2]?!1:null}var s=function(){var e=[4,4,14];function t(e){var t=e.t.d;e.t.d={k:[{s:t,t:0}]}}function n(e){var n,r=e.length;for(n=0;n=0;--n)if(e[n].ty===`sh`)if(e[n].ks.k.i)e[n].ks.k.c=e[n].closed;else for(a=e[n].ks.k.length,i=0;i500)&&(this._imageLoaded(),clearInterval(n)),t+=1}.bind(this),50)}function a(t){var n=r(t,this.assetsPath,this.path),i=z(`image`);b?this.testImageLoaded(i):i.addEventListener(`load`,this._imageLoaded,!1),i.addEventListener(`error`,function(){a.img=e,this._imageLoaded()}.bind(this),!1),i.setAttributeNS(`http://www.w3.org/1999/xlink`,`href`,n),this._elementHelper.append?this._elementHelper.append(i):this._elementHelper.appendChild(i);var a={img:i,assetData:t};return a}function o(t){var n=r(t,this.assetsPath,this.path),i=l(`img`);i.crossOrigin=`anonymous`,i.addEventListener(`load`,this._imageLoaded,!1),i.addEventListener(`error`,function(){a.img=e,this._imageLoaded()}.bind(this),!1),i.src=n;var a={img:i,assetData:t};return a}function s(e){var t={assetData:e},n=r(e,this.assetsPath,this.path);return fe.loadData(n,function(e){t.img=e,this._footageLoaded()}.bind(this),function(){t.img={},this._footageLoaded()}.bind(this)),t}function c(e,t){this.imagesLoadedCb=t;var n,r=e.length;for(n=0;nthis.animationData.op&&(this.animationData.op=e.op,this.totalFrames=Math.floor(e.op-this.animationData.ip));var t=this.animationData.layers,n,r=t.length,i=e.layers,a,o=i.length;for(a=0;athis.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger(`enterFrame`),this.renderFrame(),this.trigger(`drawnFrame`)},V.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(e){this.triggerRenderFrameError(e)}},V.prototype.play=function(e){e&&this.name!==e||this.isPaused===!0&&(this.isPaused=!1,this.trigger(`_play`),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger(`_active`)))},V.prototype.pause=function(e){e&&this.name!==e||this.isPaused===!1&&(this.isPaused=!0,this.trigger(`_pause`),this._idle=!0,this.trigger(`_idle`),this.audioController.pause())},V.prototype.togglePause=function(e){e&&this.name!==e||(this.isPaused===!0?this.play():this.pause())},V.prototype.stop=function(e){e&&this.name!==e||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},V.prototype.getMarkerData=function(e){for(var t,n=0;n=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(t>this.totalFrames?t%this.totalFrames:0)||(n=!0,t=this.totalFrames-1):t>=this.totalFrames?(this.playCount+=1,this.checkSegments(t%this.totalFrames)||(this.setCurrentRawFrameValue(t%this.totalFrames),this._completedLoop=!0,this.trigger(`loopComplete`))):this.setCurrentRawFrameValue(t):t<0?this.checkSegments(t%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+t%this.totalFrames),this._completedLoop?this.trigger(`loopComplete`):this._completedLoop=!0):(n=!0,t=0)):this.setCurrentRawFrameValue(t),n&&(this.setCurrentRawFrameValue(t),this.pause(),this.trigger(`complete`))}},V.prototype.adjustSegment=function(e,t){this.playCount=0,e[1]0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=e[0]-e[1],this.timeCompleted=this.totalFrames,this.firstFrame=e[1],this.setCurrentRawFrameValue(this.totalFrames-.001-t)):e[1]>e[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=e[1]-e[0],this.timeCompleted=this.totalFrames,this.firstFrame=e[0],this.setCurrentRawFrameValue(.001+t)),this.trigger(`segmentStart`)},V.prototype.setSegment=function(e,t){var n=-1;this.isPaused&&(this.currentRawFrame+this.firstFramet&&(n=t-e)),this.firstFrame=e,this.totalFrames=t-e,this.timeCompleted=this.totalFrames,n!==-1&&this.goToAndStop(n,!0)},V.prototype.playSegments=function(e,t){if(t&&(this.segments.length=0),be(e[0])===`object`){var n,r=e.length;for(n=0;n=0;--n)t[n].animation.destroy(e)}function T(e,t,n){var r=[].concat([].slice.call(document.getElementsByClassName(`lottie`)),[].slice.call(document.getElementsByClassName(`bodymovin`))),i,a=r.length;for(i=0;i0?n=c:t=c;while(Math.abs(s)>a&&++l=i?g(e,d,t,n):f===0?d:h(e,a,a+c,t,n)}},e}(),Ce=function(){function e(e){return e.concat(m(e.length))}return{double:e}}(),we=function(){return function(e,t,n){var r=0,i=e,a=m(i),o={newElement:s,release:c};function s(){var e;return r?(--r,e=a[r]):e=t(),e}function c(e){r===i&&(a=Ce.double(a),i*=2),n&&n(e),a[r]=e,r+=1}return o}}(),Te=function(){function e(){return{addedLength:0,percents:p(`float32`,le()),lengths:p(`float32`,le())}}return we(8,e)}(),Ee=function(){function e(){return{lengths:[],totalLength:0}}function t(e){var t,n=e.lengths.length;for(t=0;t-.001&&o<.001}function n(n,r,i,a,o,s,c,l,u){if(i===0&&s===0&&u===0)return t(n,r,a,o,c,l);var d=e.sqrt(e.pow(a-n,2)+e.pow(o-r,2)+e.pow(s-i,2)),f=e.sqrt(e.pow(c-n,2)+e.pow(l-r,2)+e.pow(u-i,2)),p=e.sqrt(e.pow(c-a,2)+e.pow(l-o,2)+e.pow(u-s,2)),m=d>f?d>p?d-f-p:p-f-d:p>f?p-f-d:f-d-p;return m>-1e-4&&m<1e-4}var r=function(){return function(e,t,n,r){var i=le(),a,o,s,c,l,u=0,d,f=[],p=[],m=Te.newElement();for(s=n.length,a=0;ao?-1:1,l=!0;l;)if(r[a]<=o&&r[a+1]>o?(s=(o-r[a])/(r[a+1]-r[a]),l=!1):a+=c,a<0||a>=i-1){if(a===i-1)return n[a];l=!1}return n[a]+(n[a+1]-n[a])*s}function l(t,n,r,i,a,o){var s=c(a,o),l=1-s;return[e.round((l*l*l*t[0]+(s*l*l+l*s*l+l*l*s)*r[0]+(s*s*l+l*s*s+s*l*s)*i[0]+s*s*s*n[0])*1e3)/1e3,e.round((l*l*l*t[1]+(s*l*l+l*s*l+l*l*s)*r[1]+(s*s*l+l*s*s+s*l*s)*i[1]+s*s*s*n[1])*1e3)/1e3]}var u=p(`float32`,8);function d(t,n,r,i,a,o,s){a<0?a=0:a>1&&(a=1);var l=c(a,s);o=o>1?1:o;var d=c(o,s),f,p=t.length,m=1-l,h=1-d,g=m*m*m,_=l*m*m*3,v=l*l*m*3,y=l*l*l,b=m*m*h,x=l*m*h+m*l*h+m*m*d,S=l*l*h+m*l*d+l*m*d,C=l*l*d,w=m*h*h,T=l*h*h+m*d*h+m*h*d,E=l*d*h+m*d*d+l*h*d,D=l*d*d,O=h*h*h,k=d*h*h+h*d*h+h*h*d,A=d*d*h+h*d*d+d*h*d,j=d*d*d;for(f=0;f=l.t-n){c.h&&(c=l),i=0;break}if(l.t-n>e){i=a;break}a=v||e=v?x.points.length-1:0;for(f=x.points[S].point.length,d=0;d=T&&C=v)r[0]=b[0],r[1]=b[1],r[2]=b[2];else if(e<=y)r[0]=c.s[0],r[1]=c.s[1],r[2]=c.s[2];else{var j=Pe(c.s),M=Pe(b),N=(e-y)/(v-y);Ne(r,Me(j,M,N))}else for(a=0;a=v?m=1:e1e-6?(f=Math.acos(p),m=Math.sin(f),h=Math.sin((1-n)*f)/m,g=Math.sin(n*f)/m):(h=1-n,g=n),r[0]=h*i+g*c,r[1]=h*a+g*l,r[2]=h*o+g*u,r[3]=h*s+g*d,r}function Ne(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=Math.atan2(2*r*a-2*n*i,1-2*r*r-2*i*i),s=Math.asin(2*n*r+2*i*a),c=Math.atan2(2*n*a-2*r*i,1-2*n*n-2*i*i);e[0]=o/D,e[1]=s/D,e[2]=c/D}function Pe(e){var t=e[0]*D,n=e[1]*D,r=e[2]*D,i=Math.cos(t/2),a=Math.cos(n/2),o=Math.cos(r/2),s=Math.sin(t/2),c=Math.sin(n/2),l=Math.sin(r/2),u=i*a*o-s*c*l;return[s*c*o+i*a*l,s*a*o+i*c*l,i*c*o-s*a*l,u]}function Fe(){var e=this.comp.renderedFrame-this.offsetTime,t=this.keyframes[0].t-this.offsetTime,n=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(e===this._caching.lastFrame||this._caching.lastFrame!==ke&&(this._caching.lastFrame>=n&&e>=n||this._caching.lastFrame=e&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var r=this.interpolateValue(e,this._caching);this.pv=r}return this._caching.lastFrame=e,this.pv}function Ie(e){var t;if(this.propType===`unidimensional`)t=e*this.mult,Ae(this.v-t)>1e-5&&(this.v=t,this._mdf=!0);else for(var n=0,r=this.v.length;n1e-5&&(this.v[n]=t,this._mdf=!0),n+=1}function Le(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var e,t=this.effectsSequence.length,n=this.kf?this.pv:this.data.k;for(e=0;e=this._maxLength&&this.doubleArrayLength(),n){case`v`:a=this.v;break;case`i`:a=this.i;break;case`o`:a=this.o;break;default:a=[];break}(!a[r]||a[r]&&!i)&&(a[r]=We.newElement()),a[r][0]=e,a[r][1]=t},Ge.prototype.setTripleAt=function(e,t,n,r,i,a,o,s){this.setXYAt(e,t,`v`,o,s),this.setXYAt(n,r,`o`,o,s),this.setXYAt(i,a,`i`,o,s)},Ge.prototype.reverse=function(){var e=new Ge;e.setPathData(this.c,this._length);var t=this.v,n=this.o,r=this.i,i=0;this.c&&(e.setTripleAt(t[0][0],t[0][1],r[0][0],r[0][1],n[0][0],n[0][1],0,!1),i=1);var a=this._length-1,o=this._length,s;for(s=i;s=p[p.length-1].t-this.offsetTime)i=p[p.length-1].s?p[p.length-1].s[0]:p[p.length-2].e[0],o=!0;else{for(var m=r,h=p.length-1,g=!0,_,v,y;g&&(_=p[m],v=p[m+1],!(v.t-this.offsetTime>e));)m=v.t-this.offsetTime)d=1;else if(e<_.t-this.offsetTime)d=0;else{var b;y.__fnct?b=y.__fnct:(b=Se.getBezierEasing(_.o.x,_.o.y,_.i.x,_.i.y).get,y.__fnct=b),d=b((e-(_.t-this.offsetTime))/(v.t-this.offsetTime-(_.t-this.offsetTime)))}a=v.s?v.s[0]:_.e[0]}i=_.s[0]}for(l=t._length,u=i.i[0].length,n.lastIndex=r,s=0;sr&&t>r)||(this._caching.lastIndex=i0||e>-1e-6&&e<0?r(e*t)/t:e}function P(){var e=this.props,t=N(e[0]),n=N(e[1]),r=N(e[4]),i=N(e[5]),a=N(e[12]),o=N(e[13]);return`matrix(`+t+`,`+n+`,`+r+`,`+i+`,`+a+`,`+o+`)`}return function(){this.reset=i,this.rotate=a,this.rotateX=o,this.rotateY=s,this.rotateZ=c,this.skew=u,this.skewFromAxis=d,this.shear=l,this.scale=f,this.setTransform=m,this.translate=h,this.transform=g,this.multiply=_,this.applyToPoint=S,this.applyToX=C,this.applyToY=w,this.applyToZ=T,this.applyToPointArray=A,this.applyToTriplePoints=k,this.applyToPointStringified=j,this.toCSS=M,this.to2dCSS=P,this.clone=b,this.cloneFromProps=x,this.equals=y,this.inversePoints=O,this.inversePoint=D,this.getInverseMatrix=E,this._t=this.transform,this.isIdentity=v,this._identity=!0,this._identityCalculated=!1,this.props=p(`float32`,16),this.reset()}}();function Ze(e){"@babel/helpers - typeof";return Ze=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ze(e)}var Qe={},$e=`__[STANDALONE]__`,et=`__[ANIMATIONDATA]__`,U=``;function tt(e){s(e)}function nt(){$e===!0?xe.searchAnimations(et,$e,U):xe.searchAnimations()}function W(e){re(e)}function rt(e){ue(e)}function it(e){return $e===!0&&(e.animationData=JSON.parse(et)),xe.loadAnimation(e)}function at(e){if(typeof e==`string`)switch(e){case`high`:ce(200);break;default:case`medium`:ce(50);break;case`low`:ce(10);break}else!isNaN(e)&&e>1&&ce(e)}function ot(){return typeof navigator<`u`}function st(e,t){e===`expressions`&&ae(t)}function ct(e){switch(e){case`propertyFactory`:return H;case`shapePropertyFactory`:return Ye;case`matrix`:return Xe;default:return null}}Qe.play=xe.play,Qe.pause=xe.pause,Qe.setLocationHref=tt,Qe.togglePause=xe.togglePause,Qe.setSpeed=xe.setSpeed,Qe.setDirection=xe.setDirection,Qe.stop=xe.stop,Qe.searchAnimations=nt,Qe.registerAnimation=xe.registerAnimation,Qe.loadAnimation=it,Qe.setSubframeRendering=W,Qe.resize=xe.resize,Qe.goToAndStop=xe.goToAndStop,Qe.destroy=xe.destroy,Qe.setQuality=at,Qe.inBrowser=ot,Qe.installPlugin=st,Qe.freeze=xe.freeze,Qe.unfreeze=xe.unfreeze,Qe.setVolume=xe.setVolume,Qe.mute=xe.mute,Qe.unmute=xe.unmute,Qe.getRegisteredAnimations=xe.getRegisteredAnimations,Qe.useWebWorker=a,Qe.setIDPrefix=rt,Qe.__getFactory=ct,Qe.version=`5.13.0`;function lt(){document.readyState===`complete`&&(clearInterval(mt),nt())}function ut(e){for(var t=dt.split(`&`),n=0;n=1?a.push({s:e-1,e:t-1}):(a.push({s:e,e:1}),a.push({s:0,e:t-1}));var o=[],s,c=a.length,l;for(s=0;sr+n)){var u=l.s*i<=r?0:(l.s*i-r)/n,d=l.e*i>=r+n?1:(l.e*i-r)/n;o.push([u,d])}return o.length||o.push([0,0]),o},_t.prototype.releasePathsData=function(e){var t,n=e.length;for(t=0;t1?1+r:this.s.v<0?0+r:this.s.v+r,n=this.e.v>1?1+r:this.e.v<0?0+r:this.e.v+r,t>n){var i=t;t=n,n=i}t=Math.round(t*1e4)*1e-4,n=Math.round(n*1e4)*1e-4,this.sValue=t,this.eValue=n}else t=this.sValue,n=this.eValue;var a,o,s=this.shapes.length,c,l,u,d,f,p=0;if(n===t)for(o=0;o=0;--o)if(h=this.shapes[o],h.shape._mdf){for(g=h.localShapeCollection,g.releaseShapes(),this.m===2&&s>1?(b=this.calculateShapeEdges(t,n,h.totalShapeLength,y,p),y+=h.totalShapeLength):b=[[_,v]],l=b.length,c=0;c=1?m.push({s:h.totalShapeLength*(_-1),e:h.totalShapeLength*(v-1)}):(m.push({s:h.totalShapeLength*_,e:h.totalShapeLength}),m.push({s:0,e:h.totalShapeLength*(v-1)}));var x=this.addShapes(h,m[0]);if(m[0].s!==m[0].e){if(m.length>1)if(h.shape.paths.shapes[h.shape.paths._length-1].c){var S=x.pop();this.addPaths(x,g),x=this.addShapes(h,m[1],S)}else this.addPaths(x,g),x=this.addShapes(h,m[1]);this.addPaths(x,g)}}h.shape.paths=g}}else if(this._mdf)for(o=0;ot.e){n.c=!1;break}else t.s<=l&&t.e>=l+u.addedLength?(this.addSegment(i[a].v[s-1],i[a].o[s-1],i[a].i[s],i[a].v[s],n,d,g),g=!1):(p=Oe.getNewSegment(i[a].v[s-1],i[a].v[s],i[a].o[s-1],i[a].i[s],(t.s-l)/u.addedLength,(t.e-l)/u.addedLength,f[s-1]),this.addSegmentFromArray(p,n,d,g),g=!1,n.c=!1),l+=u.addedLength,d+=1;if(i[a].c&&f.length){if(u=f[s-1],l<=t.e){var _=f[s-1].addedLength;t.s<=l&&t.e>=l+_?(this.addSegment(i[a].v[s-1],i[a].o[s-1],i[a].i[0],i[a].v[0],n,d,g),g=!1):(p=Oe.getNewSegment(i[a].v[s-1],i[a].v[0],i[a].o[s-1],i[a].i[0],(t.s-l)/_,(t.e-l)/_,f[s-1]),this.addSegmentFromArray(p,n,d,g),g=!1,n.c=!1)}else n.c=!1;l+=u.addedLength,d+=1}if(n._length&&(n.setXYAt(n.v[h][0],n.v[h][1],`i`,h),n.setXYAt(n.v[n._length-1][0],n.v[n._length-1][1],`o`,n._length-1)),l>t.e)break;a=this.p.keyframes[this.p.keyframes.length-1].t?(r=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/n,0),i=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/n,0)):(r=this.p.pv,i=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/n,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){r=[],i=[];var a=this.px,o=this.py;a._caching.lastFrame+a.offsetTime<=a.keyframes[0].t?(r[0]=a.getValueAtTime((a.keyframes[0].t+.01)/n,0),r[1]=o.getValueAtTime((o.keyframes[0].t+.01)/n,0),i[0]=a.getValueAtTime(a.keyframes[0].t/n,0),i[1]=o.getValueAtTime(o.keyframes[0].t/n,0)):a._caching.lastFrame+a.offsetTime>=a.keyframes[a.keyframes.length-1].t?(r[0]=a.getValueAtTime(a.keyframes[a.keyframes.length-1].t/n,0),r[1]=o.getValueAtTime(o.keyframes[o.keyframes.length-1].t/n,0),i[0]=a.getValueAtTime((a.keyframes[a.keyframes.length-1].t-.01)/n,0),i[1]=o.getValueAtTime((o.keyframes[o.keyframes.length-1].t-.01)/n,0)):(r=[a.pv,o.pv],i[0]=a.getValueAtTime((a._caching.lastFrame+a.offsetTime-.01)/n,a.offsetTime),i[1]=o.getValueAtTime((o._caching.lastFrame+o.offsetTime-.01)/n,o.offsetTime))}else i=e,r=i;this.v.rotate(-Math.atan2(r[1]-i[1],r[0]-i[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function r(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function i(){}function a(e){this._addDynamicProperty(e),this.elem.addDynamicProperty(e),this._isDirty=!0}function o(e,t,n){if(this.elem=e,this.frameId=-1,this.propType=`transform`,this.data=t,this.v=new Xe,this.pre=new Xe,this.appliedTransformations=0,this.initDynamicPropertyContainer(n||e),t.p&&t.p.s?(this.px=H.getProp(e,t.p.x,0,0,this),this.py=H.getProp(e,t.p.y,0,0,this),t.p.z&&(this.pz=H.getProp(e,t.p.z,0,0,this))):this.p=H.getProp(e,t.p||{k:[0,0,0]},1,0,this),t.rx){if(this.rx=H.getProp(e,t.rx,0,D,this),this.ry=H.getProp(e,t.ry,0,D,this),this.rz=H.getProp(e,t.rz,0,D,this),t.or.k[0].ti){var r,i=t.or.k.length;for(r=0;r0;)--n,this._elements.unshift(t[n]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},yt.prototype.resetElements=function(e){var t,n=e.length;for(t=0;t0?Math.floor(f):Math.ceil(f),h=this.pMatrix.props,g=this.rMatrix.props,_=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var v=0;if(f>0){for(;vm;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),--v;p&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-p,!0),v-=p)}r=this.data.m===1?0:this._currentCopies-1,i=this.data.m===1?1:-1,a=this._currentCopies;for(var y,b;a;){if(t=this.elemsData[r].it,n=t[t.length-1].transform.mProps.v.props,b=n.length,t[t.length-1].transform.mProps._mdf=!0,t[t.length-1].transform.op._mdf=!0,t[t.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(r/(this._currentCopies-1)),v!==0){for((r!==0&&i===1||r!==this._currentCopies-1&&i===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]),this.matrix.transform(_[0],_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11],_[12],_[13],_[14],_[15]),this.matrix.transform(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]),y=0;y0&&r<1?[t]:[]:[t-r,t+r].filter(function(e){return e>0&&e<1})},Ct.prototype.split=function(e){if(e<=0)return[St(this.points[0]),this];if(e>=1)return[this,St(this.points[this.points.length-1])];var t=Y(this.points[0],this.points[1],e),n=Y(this.points[1],this.points[2],e),r=Y(this.points[2],this.points[3],e),i=Y(t,n,e),a=Y(n,r,e),o=Y(i,a,e);return[new Ct(this.points[0],t,i,o,!0),new Ct(o,a,r,this.points[3],!0)]};function wt(e,t){var n=e.points[0][t],r=e.points[e.points.length-1][t];if(n>r){var i=r;r=n,n=i}for(var a=X(3*e.a[t],2*e.b[t],e.c[t]),o=0;o0&&a[o]<1){var s=e.point(a[o])[t];sr&&(r=s)}return{min:n,max:r}}Ct.prototype.bounds=function(){return{x:wt(this,0),y:wt(this,1)}},Ct.prototype.boundingBox=function(){var e=this.bounds();return{left:e.x.min,right:e.x.max,top:e.y.min,bottom:e.y.max,width:e.x.max-e.x.min,height:e.y.max-e.y.min,cx:(e.x.max+e.x.min)/2,cy:(e.y.max+e.y.min)/2}};function Tt(e,t,n){var r=e.boundingBox();return{cx:r.cx,cy:r.cy,width:r.width,height:r.height,bez:e,t:(t+n)/2,t1:t,t2:n}}function Et(e){var t=e.bez.split(.5);return[Tt(t[0],e.t1,e.t),Tt(t[1],e.t,e.t2)]}function Dt(e,t){return Math.abs(e.cx-t.cx)*2=a||e.width<=r&&e.height<=r&&t.width<=r&&t.height<=r){i.push([e.t,t.t]);return}var o=Et(e),s=Et(t);Ot(o[0],s[0],n+1,r,i,a),Ot(o[0],s[1],n+1,r,i,a),Ot(o[1],s[0],n+1,r,i,a),Ot(o[1],s[1],n+1,r,i,a)}}Ct.prototype.intersections=function(e,t,n){t===void 0&&(t=2),n===void 0&&(n=7);var r=[];return Ot(Tt(this,0,1),Tt(e,0,1),0,t,r,n),r},Ct.shapeSegment=function(e,t){var n=(t+1)%e.length();return new Ct(e.v[t],e.o[t],e.i[n],e.v[n],!0)},Ct.shapeSegmentInverted=function(e,t){var n=(t+1)%e.length();return new Ct(e.v[n],e.i[n],e.o[t],e.v[t],!0)};function kt(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function At(e,t,n,r){var i=[e[0],e[1],1],a=[t[0],t[1],1],o=[n[0],n[1],1],s=[r[0],r[1],1],c=kt(kt(i,a),kt(o,s));return q(c[2])?null:[c[0]/c[2],c[1]/c[2]]}function jt(e,t,n){return[e[0]+Math.cos(t)*n,e[1]-Math.sin(t)*n]}function Mt(e,t){return Math.hypot(e[0]-t[0],e[1]-t[1])}function Nt(e,t){return K(e[0],t[0])&&K(e[1],t[1])}function Pt(){}u([gt],Pt),Pt.prototype.initModifierProperties=function(e,t){this.getValue=this.processKeys,this.amplitude=H.getProp(e,t.s,0,null,this),this.frequency=H.getProp(e,t.r,0,null,this),this.pointsType=H.getProp(e,t.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function Ft(e,t,n,r,i,a,o){var s=n-Math.PI/2,c=n+Math.PI/2,l=t[0]+Math.cos(n)*r*i,u=t[1]-Math.sin(n)*r*i;e.setTripleAt(l,u,l+Math.cos(s)*a,u-Math.sin(s)*a,l+Math.cos(c)*o,u-Math.sin(c)*o,e.length())}function It(e,t){var n=[t[0]-e[0],t[1]-e[1]],r=-Math.PI*.5;return[Math.cos(r)*n[0]-Math.sin(r)*n[1],Math.sin(r)*n[0]+Math.cos(r)*n[1]]}function Lt(e,t){var n=t===0?e.length()-1:t-1,r=(t+1)%e.length(),i=e.v[n],a=e.v[r],o=It(i,a);return Math.atan2(0,1)-Math.atan2(o[1],o[0])}function Rt(e,t,n,r,i,a,o){var s=Lt(t,n),c=t.v[n%t._length],l=t.v[n===0?t._length-1:n-1],u=t.v[(n+1)%t._length],d=a===2?Math.sqrt((c[0]-l[0])**2+(c[1]-l[1])**2):0,f=a===2?Math.sqrt((c[0]-u[0])**2+(c[1]-u[1])**2):0;Ft(e,t.v[n%t._length],s,o,r,f/((i+1)*2),d/((i+1)*2),a)}function zt(e,t,n,r,i,a){for(var o=0;o1&&t.length>1&&(i=Ut(e[0],t[t.length-1]),i)?[[e[0].split(i[0])[0]],[t[t.length-1].split(i[1])[1]]]:[n,r]}function Gt(e){for(var t,n=1;n1&&(t=Wt(e[e.length-1],e[0]),e[e.length-1]=t[0],e[0]=t[1]),e}function Kt(e,t){var n=e.inflectionPoints(),r,i,a,o;if(n.length===0)return[Vt(e,t)];if(n.length===1||K(n[1],1))return a=e.split(n[0]),r=a[0],i=a[1],[Vt(r,t),Vt(i,t)];a=e.split(n[0]),r=a[0];var s=(n[1]-n[0])/(1-n[0]);return a=a[1].split(s),o=a[0],i=a[1],[Vt(r,t),Vt(o,t),Vt(i,t)]}function qt(){}u([gt],qt),qt.prototype.initModifierProperties=function(e,t){this.getValue=this.processKeys,this.amount=H.getProp(e,t.a,0,null,this),this.miterLimit=H.getProp(e,t.ml,0,null,this),this.lineJoin=t.lj,this._isAnimated=this.amount.effectsSequence.length!==0},qt.prototype.processPath=function(e,t,n,r){var i=Ke.newElement();i.c=e.c;var a=e.length();e.c||--a;var o,s,c,l=[];for(o=0;o=0;--o)c=Ct.shapeSegmentInverted(e,o),l.push(Kt(c,t));l=Gt(l);var u=null,d=null;for(o=0;o0&&(o=!1),o){var u=l(`style`);u.setAttribute(`f-forigin`,n[r].fOrigin),u.setAttribute(`f-origin`,n[r].origin),u.setAttribute(`f-family`,n[r].fFamily),u.type=`text/css`,u.innerText=`@font-face {font-family: `+n[r].fFamily+`; font-style: normal; src: url('`+n[r].fPath+`');}`,t.appendChild(u)}}else if(n[r].fOrigin===`g`||n[r].origin===1){for(s=document.querySelectorAll(`link[f-forigin="g"], link[f-origin="1"]`),c=0;c=55296&&n<=56319){var r=e.charCodeAt(1);r>=56320&&r<=57343&&(t=(n-55296)*1024+r-56320+65536)}return t}function S(e,t){var n=e.toString(16)+t.toString(16);return d.indexOf(n)!==-1}function C(e){return e===s}function w(e){return e===o}function T(e){var t=x(e);return t>=c&&t<=u}function E(e){return T(e.substr(0,2))&&T(e.substr(2,2))}function D(e){return t.indexOf(e)!==-1}function O(e,t){var o=x(e.substr(t,2));if(o!==n)return!1;var s=0;for(t+=2;s<5;){if(o=x(e.substr(t,2)),oa)return!1;s+=1,t+=2}return x(e.substr(t,2))===r}function k(){this.isLoaded=!0}var A=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};return A.isModifier=S,A.isZeroWidthJoiner=C,A.isFlagEmoji=E,A.isRegionalCode=T,A.isCombinedCharacter=D,A.isRegionalFlag=O,A.isVariationSelector=w,A.BLACK_FLAG_CODE_POINT=n,A.prototype={addChars:_,addFonts:g,getCharData:v,getFontByName:b,measureText:y,checkLoadedFonts:m,setIsLoaded:k},A}();function Z(e){this.animationData=e}Z.prototype.getProp=function(e){return this.animationData.slots&&this.animationData.slots[e.sid]?Object.assign(e,this.animationData.slots[e.sid].p):e};function Xt(e){return new Z(e)}function Zt(){}Zt.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(e){this.renderableComponents.indexOf(e)===-1&&this.renderableComponents.push(e)},removeRenderableComponent:function(e){this.renderableComponents.indexOf(e)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(e),1)},prepareRenderableFrame:function(e){this.checkLayerLimits(e)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(e){this.data.ip-this.data.st<=e&&this.data.op-this.data.st>e?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var e,t=this.renderableComponents.length;for(e=0;e.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},pn.prototype.show=function(){},pn.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},pn.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},pn.prototype.resume=function(){this._canPlay=!0},pn.prototype.setRate=function(e){this.audio.rate(e)},pn.prototype.volume=function(e){this._volumeMultiplier=e,this._previousVolume=e*this._volume,this.audio.volume(this._previousVolume)},pn.prototype.getBaseElement=function(){return null},pn.prototype.destroy=function(){},pn.prototype.sourceRectAtTime=function(){},pn.prototype.initExpressions=function(){};function mn(){}mn.prototype.checkLayers=function(e){var t,n=this.layers.length,r;for(this.completeLayers=!0,t=n-1;t>=0;--t)this.elements[t]||(r=this.layers[t],r.ip-r.st<=e-this.layers[t].st&&r.op-r.st>e-this.layers[t].st&&this.buildItem(t)),this.completeLayers=this.elements[t]?this.completeLayers:!1;this.checkPendingElements()},mn.prototype.createItem=function(e){switch(e.ty){case 2:return this.createImage(e);case 0:return this.createComp(e);case 1:return this.createSolid(e);case 3:return this.createNull(e);case 4:return this.createShape(e);case 5:return this.createText(e);case 6:return this.createAudio(e);case 13:return this.createCamera(e);case 15:return this.createFootage(e);default:return this.createNull(e)}},mn.prototype.createCamera=function(){throw Error(`You're using a 3d camera. Try the html renderer.`)},mn.prototype.createAudio=function(e){return new pn(e,this.globalData,this)},mn.prototype.createFootage=function(e){return new fn(e,this.globalData,this)},mn.prototype.buildAllItems=function(){var e,t=this.layers.length;for(e=0;e0&&(this.maskElement.setAttribute(`id`,p),this.element.maskedElement.setAttribute(b,`url(`+c()+`#`+p+`)`),r.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}_n.prototype.getMaskProperty=function(e){return this.viewData[e].prop},_n.prototype.renderFrame=function(e){var t=this.element.finalTransform.mat,n,r=this.masksProperties.length;for(n=0;n1&&(r+=` C`+t.o[i-1][0]+`,`+t.o[i-1][1]+` `+t.i[0][0]+`,`+t.i[0][1]+` `+t.v[0][0]+`,`+t.v[0][1]),n.lastPath!==r){var o=``;n.elem&&(t.c&&(o=e.inv?this.solidPath+r:r),n.elem.setAttribute(`d`,o)),n.lastPath=r}},_n.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var vn=function(){var e={};e.createFilter=t,e.createAlphaToLuminanceFilter=n;function t(e,t){var n=z(`filter`);return n.setAttribute(`id`,e),t!==!0&&(n.setAttribute(`filterUnits`,`objectBoundingBox`),n.setAttribute(`x`,`0%`),n.setAttribute(`y`,`0%`),n.setAttribute(`width`,`100%`),n.setAttribute(`height`,`100%`)),n}function n(){var e=z(`feColorMatrix`);return e.setAttribute(`type`,`matrix`),e.setAttribute(`color-interpolation-filters`,`sRGB`),e.setAttribute(`values`,`0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1`),e}return e}(),yn=function(){var e={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<`u`};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(e.maskType=!1),/firefox/i.test(navigator.userAgent)&&(e.svgLumaHidden=!1),e}(),bn={},xn=`filter_result_`;function Sn(e){var t,n=`SourceGraphic`,r=e.data.ef?e.data.ef.length:0,i=I(),a=vn.createFilter(i,!0),o=0;this.filters=[];var s;for(t=0;t=0&&(n=this.shapeModifiers[e].processShapes(this._isFirstFrame),!n);--e);}},searchProcessedElement:function(e){for(var t=this.processedElements,n=0,r=t.length;n.01)return!1;n+=1}return!0},Ln.prototype.checkCollapsable=function(){if(this.o.length/2!=this.c.length/4)return!1;if(this.data.k.k[0].s)for(var e=0,t=this.data.k.k.length;e0;)c=r.transformers[g].mProps._mdf||c,--h,--g;if(c)for(h=f-r.styles[u].lvl,g=r.transformers.length-1;h>0;)m.multiply(r.transformers[g].mProps.v),--h,--g}else m=e;if(p=r.sh.paths,o=p._length,c){for(s=``,a=0;a=1?v=.99:v<=-1&&(v=-.99);var y=g*v,b=Math.cos(_+t.a.v)*y+a[0],x=Math.sin(_+t.a.v)*y+a[1];r.setAttribute(`fx`,b),r.setAttribute(`fy`,x),i&&!t.g._collapsable&&(t.of.setAttribute(`fx`,b),t.of.setAttribute(`fy`,x))}}}function u(e,t,n){var r=t.style,i=t.d;i&&(i._mdf||n)&&i.dashStr&&(r.pElem.setAttribute(`stroke-dasharray`,i.dashStr),r.pElem.setAttribute(`stroke-dashoffset`,i.dashoffset[0])),t.c&&(t.c._mdf||n)&&r.pElem.setAttribute(`stroke`,`rgb(`+C(t.c.v[0])+`,`+C(t.c.v[1])+`,`+C(t.c.v[2])+`)`),(t.o._mdf||n)&&r.pElem.setAttribute(`stroke-opacity`,t.o.v),(t.w._mdf||n)&&(r.pElem.setAttribute(`stroke-width`,t.w.v),r.msElem&&r.msElem.setAttribute(`stroke-width`,t.w.v))}return n}();function Wn(e,t,n){this.shapes=[],this.shapesData=e.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(e,t,n),this.prevViewData=[]}u([un,gn,Cn,On,wn,dn,Tn],Wn),Wn.prototype.initSecondaryElement=function(){},Wn.prototype.identityMatrix=new Xe,Wn.prototype.buildExpressionInterface=function(){},Wn.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},Wn.prototype.filterUniqueShapes=function(){var e,t=this.shapes.length,n,r,i=this.stylesList.length,a,o=[],s=!1;for(r=0;r1&&s&&this.setShapesAsAnimated(o)}},Wn.prototype.setShapesAsAnimated=function(e){var t,n=e.length;for(t=0;t=0;--c){if(g=this.searchProcessedElement(e[c]),g?t[c]=n[g-1]:e[c]._render=o,e[c].ty===`fl`||e[c].ty===`st`||e[c].ty===`gf`||e[c].ty===`gs`||e[c].ty===`no`)g?t[c].style.closed=e[c].hd:t[c]=this.createStyleElement(e[c],i),e[c]._render&&t[c].style.pElem.parentNode!==r&&r.appendChild(t[c].style.pElem),f.push(t[c].style);else if(e[c].ty===`gr`){if(!g)t[c]=this.createGroupElement(e[c]);else for(d=t[c].it.length,u=0;u1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},Kn.prototype.addEffect=function(e){this.effectsSequence.push(e),this.elem.addDynamicProperty(this)},Kn.prototype.getValue=function(e){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!e)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var t=this.currentData,n=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var r,i=this.effectsSequence.length,a=e||this.data.d.k[this.keysIndex].s;for(r=0;rt);)n+=1;return this.keysIndex!==n&&(this.keysIndex=n),this.data.d.k[this.keysIndex].s},Kn.prototype.buildFinalText=function(e){for(var t=[],n=0,r=e.length,i,a,o=!1,s=!1,c=``;n=55296&&i<=56319?Yt.isRegionalFlag(e,n)?c=e.substr(n,14):(a=e.charCodeAt(n+1),a>=56320&&a<=57343&&(Yt.isModifier(i,a)?(c=e.substr(n,2),o=!0):c=Yt.isFlagEmoji(e.substr(n,4))?e.substr(n,4):e.substr(n,2))):i>56319?(a=e.charCodeAt(n+1),Yt.isVariationSelector(i)&&(o=!0)):Yt.isZeroWidthJoiner(i)&&(o=!0,s=!0),o?(t[t.length-1]+=c,o=!1):t.push(c),n+=c.length;return t},Kn.prototype.completeTextData=function(e){e.__complete=!0;var t=this.elem.globalData.fontManager,n=this.data,r=[],i,a,o,s=0,c,l=n.m.g,u=0,d=0,f=0,p=[],m=0,h=0,g,_,v=t.getFontByName(e.f),y,b=0,x=Jt(v);e.fWeight=x.weight,e.fStyle=x.style,e.finalSize=e.s,e.finalText=this.buildFinalText(e.t),a=e.finalText.length,e.finalLineHeight=e.lh;var S=e.tr/1e3*e.finalSize,C;if(e.sz)for(var w=!0,T=e.sz[0],E=e.sz[1],D,O;w;){O=this.buildFinalText(e.t),D=0,m=0,a=O.length,S=e.tr/1e3*e.finalSize;var k=-1;for(i=0;iT&&O[i]!==` `?(k===-1?a+=1:i=k,D+=e.finalLineHeight||e.finalSize*1.2,O.splice(i,+(k===i),`\r`),k=-1,m=0):(m+=b,m+=S);D+=v.ascent*e.finalSize/100,this.canResize&&e.finalSize>this.minimumFontSize&&Eh?m:h,m=-2*S,c=``,o=!0,f+=1):c=j,t.chars?(y=t.getCharData(j,v.fStyle,t.getFontByName(e.f).fFamily),b=o?0:y.w*e.finalSize/100):b=t.measureText(c,e.f,e.finalSize),j===` `?A+=b+S:(m+=b+S+A,A=0),r.push({l:b,an:b,add:u,n:o,anIndexes:[],val:c,line:f,animatorJustifyOffset:0}),l==2){if(u+=b,c===``||c===` `||i===a-1){for((c===``||c===` `)&&(u-=b);d<=i;)r[d].an=u,r[d].ind=s,r[d].extra=b,d+=1;s+=1,u=0}}else if(l==3){if(u+=b,c===``||i===a-1){for(c===``&&(u-=b);d<=i;)r[d].an=u,r[d].ind=s,r[d].extra=b,d+=1;u=0,s+=1}}else r[s].ind=s,r[s].extra=0,s+=1;if(e.l=r,h=m>h?m:h,p.push(m),e.sz)e.boxWidth=e.sz[0],e.justifyOffset=0;else switch(e.boxWidth=h,e.j){case 1:e.justifyOffset=-e.boxWidth;break;case 2:e.justifyOffset=-e.boxWidth/2;break;default:e.justifyOffset=0}e.lineWidths=p;var M=n.a,N,P;_=M.length;var F,I,L=[];for(g=0;g<_;g+=1){for(N=M[g],N.a.sc&&(e.strokeColorAnim=!0),N.a.sw&&(e.strokeWidthAnim=!0),(N.a.fc||N.a.fh||N.a.fs||N.a.fb)&&(e.fillColorAnim=!0),I=0,F=N.s.b,i=0;i0?i=this.ne.v/100:a=-this.ne.v/100,this.xe.v>0?o=1-this.xe.v/100:s=1+this.xe.v/100;var c=Se.getBezierEasing(i,a,o,s).get,l=0,u=this.finalS,d=this.finalE,f=this.data.sh;if(f===2)l=d===u?+(r>=d):e(0,t(.5/(d-u)+(r-u)/(d-u),1)),l=c(l);else if(f===3)l=d===u?r>=d?0:1:1-e(0,t(.5/(d-u)+(r-u)/(d-u),1)),l=c(l);else if(f===4)d===u?l=0:(l=e(0,t(.5/(d-u)+(r-u)/(d-u),1)),l<.5?l*=2:l=1-2*(l-.5)),l=c(l);else if(f===5){if(d===u)l=0;else{var p=d-u;r=t(e(0,r+.5-u),d-u);var m=-p/2+r,h=p/2;l=Math.sqrt(1-m*m/(h*h))}l=c(l)}else f===6?(d===u?l=0:(r=t(e(0,r+.5-u),d-u),l=(1+Math.cos(Math.PI+Math.PI*2*r/(d-u)))/2),l=c(l)):(r>=n(u)&&(l=r-u<0?e(0,t(t(d,1)-(u-r),1)):e(0,t(d-r,1))),l=c(l));if(this.sm.v!==100){var g=this.sm.v*.01;g===0&&(g=1e-8);var _=.5-g*.5;l<_?l=0:(l=(l-_)/g,l>1&&(l=1))}return l*this.a.v},getValue:function(e){this.iterateDynamicProperties(),this._mdf=e||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,e&&this.data.r===2&&(this.e.v=this._currentTextLength);var t=this.data.r===2?1:100/this.data.totalChars,n=this.o.v/t,r=this.s.v/t+n,i=this.e.v/t+n;if(r>i){var a=r;r=i,i=a}this.finalS=r,this.finalE=i}},u([Ue],r);function i(e,t,n){return new r(e,t,n)}return{getTextSelectorProp:i}}();function Jn(e,t,n){var r={propType:!1},i=H.getProp,a=t.a;this.a={r:a.r?i(e,a.r,0,D,n):r,rx:a.rx?i(e,a.rx,0,D,n):r,ry:a.ry?i(e,a.ry,0,D,n):r,sk:a.sk?i(e,a.sk,0,D,n):r,sa:a.sa?i(e,a.sa,0,D,n):r,s:a.s?i(e,a.s,1,.01,n):r,a:a.a?i(e,a.a,1,0,n):r,o:a.o?i(e,a.o,0,.01,n):r,p:a.p?i(e,a.p,1,0,n):r,sw:a.sw?i(e,a.sw,0,0,n):r,sc:a.sc?i(e,a.sc,1,0,n):r,fc:a.fc?i(e,a.fc,1,0,n):r,fh:a.fh?i(e,a.fh,0,0,n):r,fs:a.fs?i(e,a.fs,0,.01,n):r,fb:a.fb?i(e,a.fb,0,.01,n):r,t:a.t?i(e,a.t,0,0,n):r},this.s=qn.getTextSelectorProp(e,t.s,n),this.s.t=t.s.t}function Yn(e,t,n){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=e,this._renderType=t,this._elem=n,this._animatorsData=m(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(n)}Yn.prototype.searchProperties=function(){var e,t=this._textData.a.length,n,r=H.getProp;for(e=0;e=m+Ce||!x?(T=(m+Ce-g)/h.partialLength,ie=b.point[0]+(h.point[0]-b.point[0])*T,ae=b.point[1]+(h.point[1]-b.point[1])*T,a.translate(-n[0]*f[u].an*.005,-(n[1]*A)*.01),_=!1):x&&(g+=h.partialLength,v+=1,v>=x.length&&(v=0,y+=1,S[y]?x=S[y].points:D.v.c?(v=0,y=0,x=S[y].points):(g-=h.partialLength,x=null)),x&&(b=h,h=x[v],C=h.partialLength));re=f[u].an/2-f[u].add,a.translate(-re,0,0)}else re=f[u].an/2-f[u].add,a.translate(-re,0,0),a.translate(-n[0]*f[u].an*.005,-n[1]*A*.01,0);for(P=0;Pe?this.textSpans[e].span:z(s?`g`:`text`),b<=e){if(c.setAttribute(`stroke-linecap`,`butt`),c.setAttribute(`stroke-linejoin`,`round`),c.setAttribute(`stroke-miterlimit`,`4`),this.textSpans[e].span=c,s){var S=z(`g`);c.appendChild(S),this.textSpans[e].childSpan=S}this.textSpans[e].span=c,this.layerElement.appendChild(c)}c.style.display=`inherit`}if(l.reset(),d&&(o[e].n&&(f=-g,p+=n.yOffset,p+=+!!h,h=!1),this.applyTextPropertiesToMatrix(n,l,o[e].line,f,p),f+=o[e].l||0,f+=g),s){x=this.globalData.fontManager.getCharData(n.finalText[e],r.fStyle,this.globalData.fontManager.getFontByName(n.f).fFamily);var C;if(x.t===1)C=new rr(x.data,this.globalData,this);else{var w=Zn;x.data&&x.data.shapes&&(w=this.buildShapeData(x.data,n.finalSize)),C=new Wn(w,this.globalData,this)}if(this.textSpans[e].glyph){var T=this.textSpans[e].glyph;this.textSpans[e].childSpan.removeChild(T.layerElement),T.destroy()}this.textSpans[e].glyph=C,C._debug=!0,C.prepareFrame(0),C.renderFrame(),this.textSpans[e].childSpan.appendChild(C.layerElement),x.t===1&&this.textSpans[e].childSpan.setAttribute(`transform`,`scale(`+n.finalSize/100+`,`+n.finalSize/100+`)`)}else d&&c.setAttribute(`transform`,`translate(`+l.props[12]+`,`+l.props[13]+`)`),c.textContent=o[e].val,c.setAttributeNS(`http://www.w3.org/XML/1998/namespace`,`xml:space`,`preserve`)}d&&c&&c.setAttribute(`d`,u)}for(;e=0;--t)(this.completeLayers||this.elements[t])&&this.elements[t].prepareFrame(e-this.layers[t].st);if(this.globalData._mdf)for(t=0;t=0;--n)(this.completeLayers||this.elements[n])&&(this.elements[n].prepareFrame(this.renderedFrame-this.layers[n].st),this.elements[n]._mdf&&(this._mdf=!0))}},nr.prototype.renderInnerContent=function(){var e,t=this.layers.length;for(e=0;e=0;--n)e.finalTransform.multiply(e.transforms[n].transform.mProps.v);e._mdf=i},processSequences:function(e){var t,n=this.sequenceList.length;for(t=0;t=1){this.buffers=[];var e=this.globalData.canvasContext,t=cr.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(t);var n=cr.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(n),this.data.tt>=3&&!document._isProxy&&cr.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new ur(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var e=this.globalData;if(e.blendMode!==this.data.bm){e.blendMode=this.data.bm;var t=Qt(this.data.bm);e.canvasContext.globalCompositeOperation=t}},createRenderableComponents:function(){this.maskManager=new dr(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(hn.TRANSFORM_EFFECT)},hideElement:function(){!this.hidden&&(!this.isInRange||this.isTransparent)&&(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(e){e.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var e=this.buffers[0].getContext(`2d`);this.clearCanvas(e),e.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var e=this.buffers[1],t=e.getContext(`2d`);if(this.clearCanvas(t),t.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform),this.comp.getElementById(`tp`in this.data?this.data.tp:this.data.ind-1).renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var n=cr.getLumaCanvas(this.canvasContext.canvas);n.getContext(`2d`).drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(n,0,0)}this.canvasContext.globalCompositeOperation=pr[this.data.tt],this.canvasContext.drawImage(e,0,0),this.canvasContext.globalCompositeOperation=`destination-over`,this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation=`source-over`}},renderFrame:function(e){if(!(this.hidden||this.data.hd)&&!(this.data.td===1&&!e)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var t=this.data.ty===0;this.prepareLayer(),this.globalData.renderer.save(t),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(t),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&=!1}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Xe},fr.prototype.hide=fr.prototype.hideElement,fr.prototype.show=fr.prototype.showElement;function mr(e,t,n,r){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var i=4;t.ty===`rc`?i=5:t.ty===`el`?i=6:t.ty===`sr`&&(i=7),this.sh=Ye.getShapeProp(e,t,i,e);var a,o=n.length,s;for(a=0;a=0;--a){if(d=this.searchProcessedElement(e[a]),d?t[a]=n[d-1]:e[a]._shouldRender=r,e[a].ty===`fl`||e[a].ty===`st`||e[a].ty===`gf`||e[a].ty===`gs`)d?t[a].style.closed=!1:t[a]=this.createStyleElement(e[a],m),l.push(t[a].style);else if(e[a].ty===`gr`){if(!d)t[a]=this.createGroupElement(e[a]);else for(c=t[a].it.length,s=0;s=0;--i)t[i].ty===`tr`?(o=n[i].transform,this.renderShapeTransform(e,o)):t[i].ty===`sh`||t[i].ty===`el`||t[i].ty===`rc`||t[i].ty===`sr`?this.renderPath(t[i],n[i]):t[i].ty===`fl`?this.renderFill(t[i],n[i],o):t[i].ty===`st`?this.renderStroke(t[i],n[i],o):t[i].ty===`gf`||t[i].ty===`gs`?this.renderGradientFill(t[i],n[i],o):t[i].ty===`gr`?this.renderShape(o,t[i].it,n[i].it):t[i].ty;r&&this.drawLayer()},hr.prototype.renderStyledShape=function(e,t){if(this._isFirstFrame||t._mdf||e.transforms._mdf){var n=e.trNodes,r=t.paths,i,a,o,s=r._length;n.length=0;var c=e.transforms.finalTransform;for(o=0;o=1?u=.99:u<=-1&&(u=-.99);var d=c*u,f=Math.cos(l+t.a.v)*d+o[0],p=Math.sin(l+t.a.v)*d+o[1];i=a.createRadialGradient(f,p,0,o[0],o[1],c)}var m,h=e.g.p,g=t.g.c,_=1;for(m=0;ma&&c===`xMidYMid slice`||ii&&s===`meet`||ai&&s===`slice`)?this.transformCanvas.tx=(n-this.transformCanvas.w*(r/this.transformCanvas.h))/2*this.renderConfig.dpr:l===`xMax`&&(ai&&s===`slice`)?this.transformCanvas.tx=(n-this.transformCanvas.w*(r/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,u===`YMid`&&(a>i&&s===`meet`||ai&&s===`meet`||a=0;--e)this.elements[e]&&this.elements[e].destroy&&this.elements[e].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},Q.prototype.renderFrame=function(e,t){if(!(this.renderedFrame===e&&this.renderConfig.clearCanvas===!0&&!t||this.destroyed||e===-1)){this.renderedFrame=e,this.globalData.frameNum=e-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||t,this.globalData.projectInterface.currentFrame=e;var n,r=this.layers.length;for(this.completeLayers||this.checkLayers(e),n=r-1;n>=0;--n)(this.completeLayers||this.elements[n])&&this.elements[n].prepareFrame(e-this.layers[n].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),n=r-1;n>=0;--n)(this.completeLayers||this.elements[n])&&this.elements[n].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},Q.prototype.buildItem=function(e){var t=this.elements;if(!(t[e]||this.layers[e].ty===99)){var n=this.createItem(this.layers[e],this,this.globalData);t[e]=n,n.initExpressions()}},Q.prototype.checkPendingElements=function(){for(;this.pendingElements.length;)this.pendingElements.pop().checkParenting()},Q.prototype.hide=function(){this.animationItem.container.style.display=`none`},Q.prototype.show=function(){this.animationItem.container.style.display=`block`};function yr(){this.opacity=-1,this.transform=p(`float32`,16),this.fillStyle=``,this.strokeStyle=``,this.lineWidth=``,this.lineCap=``,this.lineJoin=``,this.miterLimit=``,this.id=Math.random()}function br(){this.stack=[],this.cArrPos=0,this.cTr=new Xe;var e,t=15;for(e=0;e=0;--t)(this.completeLayers||this.elements[t])&&this.elements[t].renderFrame()},xr.prototype.destroy=function(){var e;for(e=this.layers.length-1;e>=0;--e)this.elements[e]&&this.elements[e].destroy();this.layers=null,this.elements=null},xr.prototype.createComp=function(e){return new xr(e,this.globalData,this)};function Sr(e,t){this.animationItem=e,this.renderConfig={clearCanvas:t&&t.clearCanvas!==void 0?t.clearCanvas:!0,context:t&&t.context||null,progressiveLoad:t&&t.progressiveLoad||!1,preserveAspectRatio:t&&t.preserveAspectRatio||`xMidYMid meet`,imagePreserveAspectRatio:t&&t.imagePreserveAspectRatio||`xMidYMid slice`,contentVisibility:t&&t.contentVisibility||`visible`,className:t&&t.className||``,id:t&&t.id||``,runExpressions:!t||t.runExpressions===void 0||t.runExpressions},this.renderConfig.dpr=t&&t.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=t&&t.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new br,this.elements=[],this.pendingElements=[],this.transformMat=new Xe,this.completeLayers=!1,this.rendererType=`canvas`,this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}return u([Q],Sr),Sr.prototype.createComp=function(e){return new xr(e,this.globalData,this)},_e(`canvas`,Sr),ht.registerModifier(`tm`,_t),ht.registerModifier(`pb`,G),ht.registerModifier(`rp`,yt),ht.registerModifier(`rd`,bt),ht.registerModifier(`zz`,Pt),ht.registerModifier(`op`,qt),Qe}))}))(),1),Kn=0,qn=e=>`${e}-${++Kn}`,Jn=[{center:`#6f5bea`,edge:`#34278f`,pattern:`#a89df5`,text:`#ffffff`},{center:`#32a86b`,edge:`#17613e`,pattern:`#8ee0b3`,text:`#ffffff`},{center:`#df8d2f`,edge:`#8c421e`,pattern:`#ffd08a`,text:`#ffffff`},{center:`#d95878`,edge:`#7b2944`,pattern:`#f5a1b6`,text:`#ffffff`}];function Yn(e){if(!e.length)return e;let t=Math.floor(1e3/e.length),n=1e3%e.length;return e.map((e,r)=>({...e,rarity:String(t+ +(r({key:qn(e),name:``,rarity:`1`,sortOrder:String(t),file:null,animation:null,fileError:``});function Zn(e){let t=e.reduce((e,t)=>{let n=Number(t.backdropID);return Number.isInteger(n)?Math.max(e,n):e},0)+1,n=Jn[e.length%Jn.length];return{key:qn(`backdrop`),name:``,backdropID:String(t),rarity:`1`,sortOrder:String(e.length),...n}}var Qn=e=>Yn([Xn(e,0),Xn(e,1)]),$n=()=>{let e=Zn([]);return Yn([e,Zn([e])])};function er({data:e,compact:t=!1}){let n=(0,g.useRef)(null);return(0,g.useEffect)(()=>{if(!n.current)return;let t=Gn.default.loadAnimation({container:n.current,renderer:`canvas`,loop:!0,autoplay:!0,animationData:structuredClone(e)});return()=>t.destroy()},[e]),(0,G.jsx)(`div`,{className:`collectible-animation ${t?`compact`:``}`,ref:n})}function tr({giftID:e,attribute:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(!1);return(0,g.useEffect)(()=>{let n=!1;return a(!1),k.giftCollectibleAnimation(e,t.kind,t.id).then(e=>{n||r(e)}).catch(()=>{n||a(!0)}),()=>{n=!0}},[e,t.id,t.kind]),i?(0,G.jsx)(`div`,{className:`collectible-animation compact failed`,children:`!`}):n?(0,G.jsx)(er,{data:n,compact:!0}):(0,G.jsx)(`div`,{className:`collectible-animation compact loading`,children:(0,G.jsx)(R,{className:`spin`,size:15})})}async function nr(e){let t=new Uint8Array(await e.arrayBuffer()),n=t;if(t.length>=2&&t[0]===31&&t[1]===139){if(!(`DecompressionStream`in window))throw Error(`This browser cannot preview TGS files`);let e=new Blob([t]).stream().pipeThrough(new DecompressionStream(`gzip`));n=new Uint8Array(await new Response(e).arrayBuffer())}let r=JSON.parse(new TextDecoder().decode(n));if(!r||typeof r!=`object`||Array.isArray(r))throw Error(`Invalid Lottie JSON`);return r}var rr=e=>Number.parseInt(e.replace(`#`,``),16),ir=e=>e.rarity_kind===`permille`?`${e.rarity_permille}‰`:e.rarity_kind,ar={models:`Models`,patterns:`Patterns`},or={model:`Model`,pattern:`Pattern`,backdrop:`Backdrop`},sr={center:`Center`,edge:`Edge`,pattern:`Pattern`,text:`Text`};function cr({gift:e,onClose:t,onPublished:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(!0),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(`100`),[h,_]=(0,g.useState)(`1000`),[v,y]=(0,g.useState)(`gift-${e.GiftID}`),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)(()=>Qn(`model`)),[w,T]=(0,g.useState)(()=>Qn(`pattern`)),[E,D]=(0,g.useState)($n);(0,g.useEffect)(()=>{let t=!1;return k.giftCollectibles(e.GiftID).then(n=>{t||(i(n),n.found&&(m(String(n.upgrade_stars??100)),_(String(n.supply_total??1e3)),y(n.slug_prefix??`gift-${e.GiftID}`)))}).catch(e=>u(O(e))).finally(()=>{t||o(!1)}),()=>{t=!0}},[e.GiftID]);let A=(0,g.useMemo)(()=>({models:S.reduce((e,t)=>e+Number(t.rarity||0),0),patterns:w.reduce((e,t)=>e+Number(t.rarity||0),0),backdrops:E.reduce((e,t)=>e+Number(t.rarity||0),0)}),[S,w,E]),j=()=>f(null),M=(e,t,n)=>{(e===`models`?C:T)(e=>e.map(e=>e.key===t?{...e,...n}:e)),j()};async function N(e,t,n){if(M(e,t.key,{file:n,animation:null,fileError:``}),n)try{let r=await nr(n);M(e,t.key,{animation:r,fileError:``})}catch(n){M(e,t.key,{animation:null,fileError:O(n)})}}function P(e,t=``){if(!b.trim())throw Error(`Please enter an operation reason`);if(S.length<2||w.length<2||E.length<2)throw Error(`Models, patterns, and backdrops must each contain at least two attributes.`);let n=E.map(e=>Number(e.backdropID));if(new Set(n).size!==n.length)throw Error(`Backdrop IDs must be unique within the pool.`);for(let e of[...S,...w])if(!e.file)throw Error(`Every model and pattern needs a TGS or Lottie file.`);let r=new FormData,i=e=>e.map(e=>({name:e.name.trim(),rarity_permille:Number(e.rarity),sort_order:Number(e.sortOrder),file_key:e.key}));r.set(`metadata`,JSON.stringify({command_id:t,reason:b.trim(),confirm:e,upgrade_stars:p,supply_total:Number(h),slug_prefix:v.trim().toLowerCase(),models:i(S),patterns:i(w),backdrops:E.map(e=>({name:e.name.trim(),backdrop_id:Number(e.backdropID),rarity_permille:Number(e.rarity),sort_order:Number(e.sortOrder),center_color:rr(e.center),edge_color:rr(e.edge),pattern_color:rr(e.pattern),text_color:rr(e.text)}))}));for(let e of[...S,...w])r.set(e.key,e.file,e.file.name);return r}async function F(){c(!0),u(``),f(null);try{f(await k.publishGiftCollectibles(e.GiftID,P(!1)))}catch(e){u(O(e))}finally{c(!1)}}async function I(){if(d){c(!0),u(``);try{await k.publishGiftCollectibles(e.GiftID,P(!0,d.command_id)),n(),t()}catch(e){u(O(e))}finally{c(!1)}}}let ee=(e,t,n)=>(0,G.jsxs)(`section`,{className:`collectible-section`,children:[(0,G.jsxs)(`div`,{className:`collectible-section-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:ar[e]}),(0,G.jsx)(`span`,{children:`Permille values are relative regular-upgrade weights; their total does not need to equal 1000.`})]}),(0,G.jsxs)(`div`,{className:`collectible-section-tools`,children:[(0,G.jsxs)(J,{tone:A[e]>0?`good`:`neutral`,children:[A[e],`‰`]}),(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>{n(Yn([...t,Xn(e===`models`?`model`:`pattern`,t.length)])),j()},children:[(0,G.jsx)(je,{size:13}),`Add`]})]})]}),(0,G.jsx)(`div`,{className:`collectible-rows`,children:t.map((r,i)=>(0,G.jsxs)(`div`,{className:`collectible-row animated`,children:[(0,G.jsx)(`div`,{className:`collectible-row-index`,children:i+1}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Name`}),(0,G.jsx)(`input`,{value:r.name,maxLength:128,onChange:t=>M(e,r.key,{name:t.target.value})})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Rarity ‰`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,max:`1000`,value:r.rarity,onChange:t=>M(e,r.key,{rarity:t.target.value})})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Sort order`}),(0,G.jsx)(`input`,{type:`number`,value:r.sortOrder,onChange:t=>M(e,r.key,{sortOrder:t.target.value})})]}),(0,G.jsxs)(`label`,{className:`collectible-file`,children:[(0,G.jsx)(`span`,{children:`Animation file`}),(0,G.jsx)(`input`,{type:`file`,accept:`.tgs,.json,.lottie,application/json,application/x-tgsticker`,onChange:t=>void N(e,r,t.target.files?.[0]??null)}),(0,G.jsxs)(`em`,{children:[(0,G.jsx)(ge,{size:13}),r.file?.name??`Choose file`]})]}),(0,G.jsx)(`div`,{className:`collectible-inline-preview`,children:r.animation?(0,G.jsx)(er,{data:r.animation,compact:!0}):(0,G.jsx)(ne,{size:16})}),(0,G.jsx)(`button`,{className:`icon-btn danger`,type:`button`,disabled:t.length<=2,onClick:()=>{n(Yn(t.filter(e=>e.key!==r.key))),j()},"aria-label":`Remove attribute`,children:(0,G.jsx)(Ke,{size:14})}),r.fileError&&(0,G.jsx)(`span`,{className:`collectible-file-error`,children:r.fileError})]},r.key))})]});return(0,Yt.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal collectible-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`Collectible pool · Gift #${e.GiftID}`,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`Unique gift attributes`}),(0,G.jsx)(`h2`,{children:`Collectible pool · Gift #${e.GiftID}`}),(0,G.jsx)(`p`,{children:e.Title||`Gift #${e.GiftID}`})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:t,disabled:s,"aria-label":`Close`,children:(0,G.jsx)($e,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body collectible-modal-body`,children:[a?(0,G.jsxs)(`div`,{className:`collectible-loading`,children:[(0,G.jsx)(R,{className:`spin`}),`Loading`]}):r?.found?(0,G.jsxs)(`section`,{className:`collectible-active`,children:[(0,G.jsxs)(`div`,{className:`collectible-active-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(ye,{size:18}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Published revision ${r.revision??0}`}),(0,G.jsxs)(`span`,{children:[r.slug_prefix,` · ⭐ `,r.upgrade_stars,` · `,r.issued,` / `,r.supply_total]})]})]}),(0,G.jsx)(J,{tone:`good`,children:`Published`})]}),(0,G.jsxs)(`div`,{className:`collectible-active-grid`,children:[[...r.models??[],...r.patterns??[]].map(t=>(0,G.jsxs)(`article`,{children:[(0,G.jsx)(tr,{giftID:e.GiftID,attribute:t}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[t.name,t.crafted&&(0,G.jsx)(J,{children:`crafted`})]}),(0,G.jsxs)(`span`,{children:[or[t.kind],` · `,ir(t)]})]})]},`${t.kind}-${t.id}`)),(r.backdrops??[]).map(e=>(0,G.jsxs)(`article`,{children:[(0,G.jsx)(`div`,{className:`collectible-backdrop-preview`,style:{background:`radial-gradient(circle, #${(e.center_color??0).toString(16).padStart(6,`0`)}, #${(e.edge_color??0).toString(16).padStart(6,`0`)})`,color:`#${(e.text_color??16777215).toString(16).padStart(6,`0`)}`},children:`Aa`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:e.name}),(0,G.jsxs)(`span`,{children:[`Backdrop`,` · `,ir(e)]})]})]},`backdrop-${e.id}`))]})]}):(0,G.jsxs)(`div`,{className:`collectible-empty`,children:[(0,G.jsx)(ye,{size:22}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`No collectible pool published`}),(0,G.jsx)(`span`,{children:`Publish models, patterns and backdrops to enable upgrades.`})]})]}),(0,G.jsxs)(`section`,{className:`collectible-definition`,children:[(0,G.jsxs)(`div`,{className:`collectible-definition-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Publish a new immutable revision`}),(0,G.jsx)(`span`,{children:`Dry-run checks every file and rarity total before the revision becomes active.`})]}),(0,G.jsxs)(`div`,{className:`gift-format-chips`,children:[(0,G.jsx)(`span`,{children:`TGS`}),(0,G.jsx)(`span`,{children:`Lottie JSON`})]})]}),(0,G.jsxs)(`div`,{className:`gift-fields-grid collectible-main-fields`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Upgrade price in Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:p,onChange:e=>{m(e.target.value),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Unique supply`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:h,onChange:e=>{_(e.target.value),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Public slug prefix`}),(0,G.jsx)(`input`,{value:v,maxLength:48,onChange:e=>{y(e.target.value.toLowerCase()),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Audit reason`}),(0,G.jsx)(`input`,{value:b,maxLength:1e3,placeholder:`Briefly describe why this gift is being imported`,onChange:e=>x(e.target.value)})]})]}),ee(`models`,S,C),ee(`patterns`,w,T),(0,G.jsxs)(`section`,{className:`collectible-section`,children:[(0,G.jsxs)(`div`,{className:`collectible-section-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Backdrops`}),(0,G.jsx)(`span`,{children:`Colors are stored as 24-bit RGB values.`})]}),(0,G.jsxs)(`div`,{className:`collectible-section-tools`,children:[(0,G.jsxs)(J,{tone:A.backdrops>0?`good`:`neutral`,children:[A.backdrops,`‰`]}),(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>{D(Yn([...E,Zn(E)])),j()},children:[(0,G.jsx)(je,{size:13}),`Add`]})]})]}),(0,G.jsx)(`div`,{className:`collectible-rows`,children:E.map((e,t)=>(0,G.jsxs)(`div`,{className:`collectible-row backdrop`,children:[(0,G.jsx)(`div`,{className:`collectible-row-index`,children:t+1}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Name`}),(0,G.jsx)(`input`,{value:e.name,maxLength:128,onChange:t=>{D(E.map(n=>n.key===e.key?{...n,name:t.target.value}:n)),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Backdrop ID`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,value:e.backdropID,onChange:t=>{D(E.map(n=>n.key===e.key?{...n,backdropID:t.target.value}:n)),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Rarity ‰`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,max:`1000`,value:e.rarity,onChange:t=>{D(E.map(n=>n.key===e.key?{...n,rarity:t.target.value}:n)),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Sort order`}),(0,G.jsx)(`input`,{type:`number`,value:e.sortOrder,onChange:t=>{D(E.map(n=>n.key===e.key?{...n,sortOrder:t.target.value}:n)),j()}})]}),[`center`,`edge`,`pattern`,`text`].map(t=>(0,G.jsxs)(`label`,{className:`collectible-color`,children:[(0,G.jsx)(`span`,{children:sr[t]}),(0,G.jsx)(`input`,{type:`color`,value:e[t],onChange:n=>{D(E.map(r=>r.key===e.key?{...r,[t]:n.target.value}:r)),j()}})]},t)),(0,G.jsx)(`div`,{className:`collectible-backdrop-preview`,style:{background:`radial-gradient(circle, ${e.center}, ${e.edge})`,color:e.text},children:`Aa`}),(0,G.jsx)(`button`,{className:`icon-btn danger`,type:`button`,disabled:E.length<=2,onClick:()=>{D(Yn(E.filter(t=>t.key!==e.key))),j()},"aria-label":`Remove attribute`,children:(0,G.jsx)(Ke,{size:14})})]},e.key))})]})]}),l&&(0,G.jsx)(q,{children:l}),d&&(0,G.jsxs)(`div`,{className:`gift-validation`,children:[(0,G.jsxs)(`div`,{className:`gift-validation-head`,children:[(0,G.jsx)(L,{size:17}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Attribute pool is valid`}),(0,G.jsx)(`span`,{children:`Review the normalized assets, then publish this immutable revision.`})]})]}),(0,G.jsx)(`pre`,{children:JSON.stringify(d.details,null,2)})]})]}),(0,G.jsxs)(`div`,{className:`modal-actions`,children:[(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:t,disabled:s,children:`Close`}),(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:F,disabled:s,children:[s?(0,G.jsx)(R,{className:`spin`,size:15}):(0,G.jsx)(ze,{size:15}),`Dry-run validation`]}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:I,disabled:s||!d,children:[(0,G.jsx)(Ye,{size:15}),`Publish revision`]})]})]})}),document.body)}var lr={all:`All`,upgrade:`Upgradable`,craft:`Craftable`,basic:`Not upgradable`},ur=!1;function dr(e){return e.model_count+e.pattern_count+e.backdrop_count}function fr(e){let t=Number(e);return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function pr({giftID:e,revision:t,compact:n=!1}){let r=(0,g.useRef)(null),i=(0,g.useRef)(null),[a,o]=(0,g.useState)(!0),[s,c]=(0,g.useState)(``);(0,g.useEffect)(()=>{let t=!1;return k.giftAnimation(e).then(e=>{t||!r.current||(i.current?.destroy(),i.current=Gn.default.loadAnimation({container:r.current,renderer:`canvas`,loop:!0,autoplay:!0,animationData:structuredClone(e)}))}).catch(e=>c(O(e))),()=>{t=!0,i.current?.destroy(),i.current=null}},[e,t]);function l(){i.current&&(a?i.current.pause():i.current.play(),o(!a))}return(0,G.jsxs)(`div`,{className:`gift-animation-shell ${n?`compact`:``}`,children:[(0,G.jsx)(`div`,{className:`gift-animation`,ref:r,children:s&&(0,G.jsx)(`span`,{children:s})}),(0,G.jsx)(`button`,{className:`gift-play`,type:`button`,onClick:l,"aria-label":a?`Pause`:`Play`,children:a?(0,G.jsx)(ke,{size:14}):(0,G.jsx)(Ae,{size:14})})]})}function mr({sourceGiftID:e}){let t=(0,g.useRef)(null);return(0,g.useEffect)(()=>{let n=!1,r=null;return k.officialGiftAnimation(e).then(e=>{n||!t.current||(r=Gn.default.loadAnimation({container:t.current,renderer:`canvas`,loop:!0,autoplay:!0,animationData:structuredClone(e)}))}).catch(()=>void 0),()=>{n=!0,r?.destroy()}},[e]),(0,G.jsx)(`div`,{className:`gift-animation-shell`,children:(0,G.jsx)(`div`,{className:`gift-animation`,ref:t})})}function hr(){let[e,t]=(0,g.useState)([]),[n,r]=(0,g.useState)(``),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(`official`),[f,p]=(0,g.useState)([]),[m,h]=(0,g.useState)(0),[_,y]=(0,g.useState)([]),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)(`all`),[w,T]=(0,g.useState)(``),[E,D]=(0,g.useState)(!0),[A,j]=(0,g.useState)(`0`),[M,N]=(0,g.useState)(`0`),[P,F]=(0,g.useState)(``),[I,ee]=(0,g.useState)(`0`),[te,ne]=(0,g.useState)(``),[re,ie]=(0,g.useState)(`50`),[ae,oe]=(0,g.useState)(`50`),[se,ce]=(0,g.useState)(`0`),[le,ue]=(0,g.useState)(!0),[z,de]=(0,g.useState)(``),[pe,me]=(0,g.useState)(null),[he,_e]=(0,g.useState)(!1),[ve,be]=(0,g.useState)(``),[V,xe]=(0,g.useState)(``),[Se,Ce]=(0,g.useState)(null),[we,Te]=(0,g.useState)([]),[Ee,De]=(0,g.useState)(!0),[Oe,Ae]=(0,g.useState)(``),[Me,Ne]=(0,g.useState)(!1),[Ie,Le]=(0,g.useState)({done:0,total:0}),[Re,Be]=(0,g.useState)(``),[Ve,He]=(0,g.useState)(null),[H,Ue]=(0,g.useState)(new Set),[We,Ge]=(0,g.useState)(``),[Ke,qe]=(0,g.useState)(!1),[Je,Xe]=(0,g.useState)(``),[Ze,Qe]=(0,g.useState)(10),[et,U]=(0,g.useState)(1);async function tt(){be(``);try{t((await k.gifts()).Gifts??[])}catch(e){be(O(e))}}(0,g.useEffect)(()=>{tt()},[]),(0,g.useEffect)(()=>{!i||u!=="default"||f.length>0||k.defaultGifts().then(e=>p(e.gifts??[])).catch(e=>xe(O(e)))},[i,u,f.length]),(0,g.useEffect)(()=>{!i||u!==`official`||_.length>0||k.officialGifts().then(e=>y(e.gifts??[])).catch(e=>xe(O(e)))},[i,u,_.length]),(0,g.useMemo)(()=>f.find(e=>e.id===m)??null,[f,m]);let nt=(0,g.useMemo)(()=>_.find(e=>e.source_gift_id===w)??null,[_,w]),rt=(0,g.useMemo)(()=>({all:_.length,upgrade:_.filter(e=>e.can_upgrade).length,craft:_.filter(e=>e.can_craft).length,basic:_.filter(e=>!e.can_upgrade).length}),[_]),it=(0,g.useMemo)(()=>{let e=b.trim().toLowerCase();return _.filter(t=>(S===`all`||S===`upgrade`&&t.can_upgrade||S===`craft`&&t.can_craft||S===`basic`&&!t.can_upgrade)&&(!e||t.source_gift_id.includes(e)||t.title.toLowerCase().includes(e)))},[_,b,S]),at=(0,g.useMemo)(()=>{let t=n.trim().toLowerCase();return t?e.filter(e=>String(e.GiftID).includes(t)||e.Title.toLowerCase().includes(t)||e.SourceFormat.toLowerCase().includes(t)):e},[e,n]);(0,g.useEffect)(()=>{U(1)},[n,Ze]);let ot=Ze===`all`?1:Math.max(1,Math.ceil(at.length/Ze)),st=Math.min(et,ot),ct=(0,g.useMemo)(()=>{if(Ze===`all`)return at;let e=(st-1)*Ze;return at.slice(e,e+Ze)},[at,st,Ze]),lt=ct.length===0?0:Ze===`all`?1:(st-1)*Ze+1,ut=lt===0?0:lt+ct.length-1,dt=ct.length>0&&ct.every(e=>H.has(e.GiftID));function ft(e){Ue(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function pt(){Ue(e=>{if(dt){let t=new Set(e);for(let e of ct)t.delete(e.GiftID);return t}let t=new Set(e);for(let e of ct)t.add(e.GiftID);return t})}async function mt(e){if(!We.trim()){Xe(`Please enter an operation reason`);return}qe(!0),Xe(``);let t=Array.from(H),n=0;for(let r of t)try{await k.action(`/api/actions/set-gift-enabled`,{gift_id:r,enabled:e,reason:We.trim(),confirm:!0})}catch{n++}qe(!1),n>0?Xe(`${n} of ${t.length} failed`):(Ue(new Set),Ge(``)),await tt()}function ht(e,t=``){if(!c)throw Error(`Choose a TGS or Lottie file first`);if(!z.trim())throw Error(`Please enter an operation reason`);let n=new FormData;return n.set(`metadata`,JSON.stringify({command_id:t,reason:z.trim(),confirm:e,gift_id:I,title:te.trim(),stars:re,convert_stars:ae,enabled:le,sort_order:Number(se)})),n.set(`file`,c,c.name),n}function gt(e,t=``){if(!m)throw Error(`Choose a default gift first`);if(!z.trim())throw Error(`Please enter an operation reason`);return{command_id:t,reason:z.trim(),confirm:e,id:m}}function _t(e,t=``){if(!w)throw Error(`Choose an official gift first`);if(!z.trim())throw Error(`Please enter an operation reason`);return{command_id:t,reason:z.trim(),confirm:e,source_gift_id:w,gift_id:I,title:te.trim(),stars:re,convert_stars:ae,enabled:le,sort_order:Number(se),include_collectible:E,upgrade_stars:A,supply_total:Number(M),slug_prefix:P.trim().toLowerCase()}}function bt(e){T(e.source_gift_id),ne(e.title||`Unnamed official gift #${e.source_gift_id}`),ie(String(e.stars)),oe(String(e.convert_stars)),D(e.can_upgrade),j(e.upgrade_stars),N(String(e.availability_total||1)),F(`official-${e.source_gift_id}`),me(null)}async function K(e){Ce(e),Te([]),De(!0),Ae(``),Ne(!1),Le({done:0,total:0}),Be(``),He(null);try{Te(e==="default"?f.length>0?f:(await k.defaultGifts()).gifts??[]:_.length>0?_:(await k.officialGifts()).gifts??[])}catch(e){Be(O(e))}}function X(){Me||Ce(null)}async function xt(){if(!Se)return;if(!Oe.trim()){Be(`Please enter an operation reason`);return}let e=Se;Ne(!0),Be(``),He(null),Le({done:0,total:we.length});let t=0,n=0,r=0,i=[];for(let a of we){let o=e==="default"?a.title:a.title||`#${a.source_gift_id}`;try{let r=e==="default"?await k.importDefaultGift({command_id:`bulk-default-gift-${a.id}`,reason:Oe.trim(),confirm:!0,id:a.id,enabled:Ee}):await k.importOfficialGift({command_id:`bulk-official-gift-${a.source_gift_id}`,reason:Oe.trim(),confirm:!0,source_gift_id:a.source_gift_id,include_collectible:a.can_upgrade,enabled:Ee});r.already_executed||r.details?.skipped?n++:t++}catch(e){e instanceof v&&e.message===`COMMAND_ID_CONFLICT`?n++:(r++,i.push(`${o}: ${O(e)}`))}Le(e=>({...e,done:e.done+1}))}Ne(!1),He({imported:t,skipped:n,failed:r,errors:i}),await tt()}async function Ct(){_e(!0),xe(``),me(null);try{me(u==="default"?await k.importDefaultGift(gt(!1)):u===`official`?await k.importOfficialGift(_t(!1)):await k.importGift(ht(!1)))}catch(e){xe(O(e))}finally{_e(!1)}}async function wt(){if(pe){_e(!0),xe(``);try{u==="default"?await k.importDefaultGift(gt(!0,pe.command_id)):u===`official`?await k.importOfficialGift(_t(!0,pe.command_id)):await k.importGift(ht(!0,pe.command_id)),me(null),l(null),ee(`0`),ne(``),h(0),T(``),await tt(),a(!1)}catch(e){xe(O(e))}finally{_e(!1)}}}function Tt(){ee(`0`),ne(``),ie(`50`),oe(`50`),ce(`0`),ue(!0),de(``),l(null),me(null),xe(``),d(`official`),h(0),T(``),x(``),C(`all`),Ne(!1),Le({done:0,total:0}),Be(``),a(!0)}function Et(e){ee(e.GiftID),ne(e.Title),ie(String(e.Stars)),oe(String(e.ConvertStars)),ce(String(e.SortOrder)),ue(e.Enabled),de(``),l(null),me(null),xe(``),d(`file`),h(0),T(``),a(!0)}let Dt=u==="default"?m>0:u===`official`?!!w:!!c;return(0,G.jsxs)(vt,{title:`Star Gift Catalog`,eyebrow:`Catalog, immutable revisions and animation assets`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>tt(),disabled:he,children:[(0,G.jsx)(Pe,{size:15}),` `,`Refresh`]}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:Tt,children:[(0,G.jsx)(je,{size:15}),` `,`Add gift`]})]}),children:[ve&&(0,G.jsx)(q,{children:ve}),(0,G.jsxs)(`div`,{className:`metric-row gift-metrics`,children:[(0,G.jsx)(Y,{label:`Catalog entries`,value:String(e.length)}),(0,G.jsx)(Y,{label:`Enabled`,value:String(e.filter(e=>e.Enabled).length),tone:`good`}),(0,G.jsx)(Y,{label:`Received gifts`,value:e.reduce((e,t)=>e+BigInt(t.ReceivedCount),0n).toString()}),(0,G.jsx)(Y,{label:`Accepted formats`,value:`TGS / Lottie`})]}),(0,G.jsx)(yt,{children:(0,G.jsxs)(`div`,{className:`toolbar`,children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`Search gift ID, title or format`})]}),(0,G.jsxs)(`label`,{className:`gift-page-size`,children:[(0,G.jsx)(`span`,{children:`Per page`}),(0,G.jsxs)(`select`,{value:String(Ze),onChange:e=>Qe(e.target.value===`all`?`all`:Number(e.target.value)),children:[(0,G.jsx)(`option`,{value:`10`,children:`10`}),(0,G.jsx)(`option`,{value:`20`,children:`20`}),(0,G.jsx)(`option`,{value:`50`,children:`50`}),(0,G.jsx)(`option`,{value:`100`,children:`100`}),(0,G.jsx)(`option`,{value:`all`,children:`All`})]})]}),(0,G.jsx)(`span`,{className:`gift-list-summary`,children:`Showing ${at.length} of ${e.length}`})]})}),H.size>0&&(0,G.jsxs)(`div`,{className:`gift-bulk-toolbar`,children:[(0,G.jsx)(`span`,{className:`gift-bulk-count`,children:`${H.size} selected`}),(0,G.jsxs)(`label`,{className:`gift-reason-field gift-bulk-reason`,children:[(0,G.jsx)(`span`,{children:`Audit reason`}),(0,G.jsx)(`input`,{value:We,placeholder:`Briefly describe why this gift is being imported`,onChange:e=>Ge(e.target.value)})]}),(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>mt(!0),disabled:Ke,children:[Ke?(0,G.jsx)(R,{className:`spin`,size:14}):(0,G.jsx)(L,{size:14}),` `,`Enable selected`]}),(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>mt(!1),disabled:Ke,children:[Ke?(0,G.jsx)(R,{className:`spin`,size:14}):(0,G.jsx)(ke,{size:14}),` `,`Disable selected`]}),(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>{Ue(new Set),Xe(``)},disabled:Ke,children:`Close`}),Je&&(0,G.jsx)(`span`,{className:`gift-bulk-error`,children:Je})]}),(0,G.jsx)(`div`,{className:`table-wrap gift-table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table gift-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`gift-select-col`,children:(0,G.jsx)(`input`,{type:`checkbox`,checked:dt,onChange:pt,"aria-label":`Select all visible gifts`})}),(0,G.jsx)(`th`,{children:`Animation file`}),(0,G.jsx)(`th`,{children:`ID / Revision`}),(0,G.jsx)(`th`,{children:`Display title`}),(0,G.jsx)(`th`,{children:`Price / Conversion`}),(0,G.jsx)(`th`,{children:`Source`}),(0,G.jsx)(`th`,{children:`Received gifts`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Updated`}),(0,G.jsx)(`th`,{children:`Actions`})]})}),(0,G.jsxs)(`tbody`,{children:[ct.map(e=>(0,G.jsxs)(`tr`,{className:e.Enabled?``:`gift-row-disabled`,children:[(0,G.jsx)(`td`,{className:`gift-select-col`,children:(0,G.jsx)(`input`,{type:`checkbox`,checked:H.has(e.GiftID),onChange:()=>ft(e.GiftID),"aria-label":`Select gift ${e.GiftID}`})}),(0,G.jsx)(`td`,{children:(0,G.jsx)(pr,{giftID:e.GiftID,revision:e.Revision,compact:!0})}),(0,G.jsxs)(`td`,{className:`mono`,children:[e.GiftID,` / `,e.Revision]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{className:`gift-table-title`,children:e.Title||`Gift #${e.GiftID}`}),(0,G.jsxs)(`span`,{className:`gift-sort-order`,children:[`Sort order`,`: `,e.SortOrder]})]}),(0,G.jsxs)(`td`,{children:[(0,G.jsxs)(`strong`,{className:`gift-table-price`,children:[`⭐ `,e.Stars]}),(0,G.jsxs)(`span`,{className:`gift-convert-price`,children:[`→ `,e.ConvertStars]})]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(J,{children:e.SourceFormat}),(0,G.jsx)(`span`,{className:`gift-source-size`,children:fr(e.AnimationSize)})]}),(0,G.jsx)(`td`,{children:e.ReceivedCount}),(0,G.jsx)(`td`,{children:(0,G.jsx)(J,{tone:e.Enabled?`good`:`neutral`,children:e.Enabled?`Enabled`:`Disabled`})}),(0,G.jsx)(`td`,{children:W(e.UpdatedAt)}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`div`,{className:`gift-table-actions`,children:[(0,G.jsxs)(`button`,{className:`btn compact-btn collectible-button`,type:`button`,onClick:()=>s(e),children:[(0,G.jsx)(ye,{size:13}),`Attribute pool`]}),(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>Et(e),children:`New revision`}),(0,G.jsx)(Z,{compact:!0,tone:`neutral`,label:e.Enabled?`Disable`:`Enable`,path:`/api/actions/set-gift-enabled`,payload:()=>({gift_id:e.GiftID,enabled:!e.Enabled}),onDone:()=>void tt()})]})})]},e.GiftID)),ct.length===0&&(0,G.jsx)(St,{colSpan:10})]})]})}),Ze!==`all`&&at.length>0&&(0,G.jsxs)(`div`,{className:`gift-pager`,children:[(0,G.jsx)(`span`,{className:`gift-pager-range`,children:`Showing ${lt}-${ut} of ${at.length}`}),(0,G.jsxs)(`div`,{className:`gift-pager-controls`,children:[(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>U(e=>Math.max(1,e-1)),disabled:st<=1,children:[(0,G.jsx)(fe,{size:14}),` `,`Previous`]}),(0,G.jsx)(`span`,{className:`gift-pager-page`,children:`Page ${st} of ${ot}`}),(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>U(e=>Math.min(ot,e+1)),disabled:st>=ot,children:[`Next`,` `,(0,G.jsx)(B,{size:14})]})]})]}),i&&(0,Yt.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal gift-import-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":I===`0`?`Import a Star Gift`:`Create revision for gift #${I}`,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`Gift catalog operation`}),(0,G.jsx)(`h2`,{children:I===`0`?`Import a Star Gift`:`Create revision for gift #${I}`})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:()=>a(!1),disabled:he,"aria-label":`Close`,children:(0,G.jsx)($e,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body gift-import-modal-body`,children:[(0,G.jsxs)(`div`,{className:`command-steps`,children:[(0,G.jsxs)(`div`,{className:`command-step ${Dt?`done`:`active`}`,children:[(0,G.jsx)(`span`,{children:`1`}),(0,G.jsx)(`strong`,{children:`File and details`})]}),(0,G.jsxs)(`div`,{className:`command-step ${pe?`done`:Dt?`active`:``}`,children:[(0,G.jsx)(`span`,{children:`2`}),(0,G.jsx)(`strong`,{children:`Dry-run validation`})]}),(0,G.jsxs)(`div`,{className:`command-step ${pe?`active`:``}`,children:[(0,G.jsx)(`span`,{children:`3`}),(0,G.jsx)(`strong`,{children:`Confirm import`})]})]}),I===`0`&&(0,G.jsxs)(`div`,{className:`gift-source-tabs`,children:[ur,(0,G.jsx)(`button`,{className:`btn ${u===`official`?`primary`:``}`,type:`button`,onClick:()=>{d(`official`),me(null)},children:`Official snapshot`}),(0,G.jsx)(`button`,{className:`btn ${u===`file`?`primary`:``}`,type:`button`,onClick:()=>{d(`file`),me(null)},children:`Upload file`})]}),u===`official`&&I===`0`?(0,G.jsxs)(`section`,{className:`official-gift-picker`,children:[(0,G.jsxs)(`div`,{className:`gift-import-note`,children:[(0,G.jsx)(`span`,{children:`Choose a verified gift from data/official-gifts. Complete collectible pools are imported atomically.`}),(0,G.jsxs)(`div`,{className:`gift-format-chips`,children:[(0,G.jsx)(`span`,{children:_.length}),(0,G.jsx)(`span`,{children:`SHA-256`})]})]}),(0,G.jsx)(`div`,{className:`official-gift-bulk-import`,children:(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>K(`official`),children:[(0,G.jsx)(Ye,{size:14}),` `,`Import all official gifts`]})}),(0,G.jsxs)(`div`,{className:`official-gift-tools`,children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:b,onChange:e=>x(e.target.value),placeholder:`Search official gift ID or title`})]}),(0,G.jsx)(`span`,{children:`Showing ${it.length} of ${_.length}`})]}),(0,G.jsx)(`div`,{className:`official-gift-categories`,role:`group`,"aria-label":`Official gift capability category`,children:[`all`,`upgrade`,`craft`,`basic`].map(e=>(0,G.jsxs)(`button`,{className:S===e?`active`:``,type:`button`,"aria-pressed":S===e,onClick:()=>C(e),children:[lr[e],(0,G.jsx)(`span`,{children:rt[e]})]},e))}),(0,G.jsxs)(`div`,{className:`official-gift-list`,role:`listbox`,"aria-label":`Choose an official gift`,children:[it.map(e=>{let t=e.source_gift_id===w;return(0,G.jsxs)(`button`,{className:`official-gift-option ${t?`selected`:``}`,type:`button`,role:`option`,"aria-selected":t,onClick:()=>bt(e),children:[(0,G.jsxs)(`span`,{className:`official-gift-option-head`,children:[(0,G.jsx)(`strong`,{children:e.title||`Unnamed official gift #${e.source_gift_id}`}),(0,G.jsxs)(`span`,{className:`mono`,children:[`#`,e.source_gift_id]})]}),(0,G.jsxs)(`span`,{className:`official-gift-option-meta`,children:[(0,G.jsxs)(`span`,{children:[`⭐ `,e.stars]}),(0,G.jsx)(`span`,{children:`${dr(e)} attributes`})]}),(0,G.jsxs)(`span`,{className:`official-gift-capabilities`,children:[(0,G.jsx)(`span`,{className:e.can_upgrade?`yes`:`no`,children:e.can_upgrade?`Can upgrade`:`Cannot upgrade`}),(0,G.jsx)(`span`,{className:e.can_craft?`craft`:`no`,children:e.can_craft?`Can Craft`:`Cannot Craft`})]})]},e.source_gift_id)}),it.length===0&&(0,G.jsx)(`div`,{className:`official-gift-empty`,children:`No official gifts match this category and search.`})]}),nt&&(0,G.jsxs)(`div`,{className:`official-gift-selected`,children:[(0,G.jsx)(mr,{sourceGiftID:nt.source_gift_id}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:nt.title||`Unnamed official gift #${nt.source_gift_id}`}),(0,G.jsx)(`span`,{className:`mono`,children:nt.source_gift_id}),(0,G.jsxs)(`small`,{children:[nt.model_count,` `,`Models`,` · `,nt.pattern_count,` `,`Patterns`,` · `,nt.backdrop_count,` `,`Backdrops`]}),(0,G.jsxs)(`span`,{className:`official-gift-capabilities`,children:[(0,G.jsx)(`span`,{className:nt.can_upgrade?`yes`:`no`,children:nt.can_upgrade?`Can upgrade`:`Cannot upgrade`}),(0,G.jsx)(`span`,{className:nt.can_craft?`craft`:`no`,children:nt.can_craft?`Can Craft`:`Cannot Craft`})]})]})]}),nt?.can_upgrade&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>{D(e.target.checked),me(null)}}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Import the complete collectible pool, including crafted models`})]}),E&&(0,G.jsxs)(`div`,{className:`gift-fields-grid`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Upgrade price in Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:A,onChange:e=>{j(e.target.value),me(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Unique supply`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:M,onChange:e=>{N(e.target.value),me(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Public slug prefix`}),(0,G.jsx)(`input`,{value:P,maxLength:48,onChange:e=>{F(e.target.value.toLowerCase()),me(null)}})]})]})]}),(0,G.jsxs)(`div`,{className:`gift-fields-grid`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Display title`}),(0,G.jsx)(`input`,{value:te,maxLength:128,placeholder:`e.g. Celebration Star`,onChange:e=>{ne(e.target.value),me(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Price in Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:re,onChange:e=>{ie(e.target.value),me(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Conversion Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,value:ae,onChange:e=>{oe(e.target.value),me(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Sort order`}),(0,G.jsx)(`input`,{type:`number`,value:se,onChange:e=>{ce(e.target.value),me(null)}})]})]}),(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:le,onChange:e=>{ue(e.target.checked),me(null)}}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Enable after import`})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`gift-import-note`,children:[(0,G.jsx)(`span`,{children:`Upload TGS or plain Lottie JSON. Lottie is normalized and compressed to TGS.`}),(0,G.jsxs)(`div`,{className:`gift-format-chips`,"aria-label":`Accepted formats`,children:[(0,G.jsx)(`span`,{children:`TGS`}),(0,G.jsx)(`span`,{children:`Lottie JSON`})]})]}),(0,G.jsxs)(`label`,{className:`gift-file-picker ${c?`has-file`:``}`,children:[(0,G.jsx)(`input`,{type:`file`,accept:`.tgs,.json,.lottie,application/json,application/x-tgsticker`,onChange:e=>{l(e.target.files?.[0]??null),me(null)}}),(0,G.jsx)(`span`,{className:`gift-file-icon`,children:(0,G.jsx)(ge,{size:22})}),(0,G.jsxs)(`span`,{className:`gift-file-copy`,children:[(0,G.jsx)(`span`,{className:`gift-field-label`,children:`Animation file`}),(0,G.jsx)(`strong`,{children:c?c.name:`Drop or choose a TGS / Lottie file`}),(0,G.jsx)(`small`,{children:c?fr(c.size):`TGS, JSON or Lottie · validated before import`})]}),(0,G.jsx)(`span`,{className:`gift-file-action`,children:c?`Change file`:`Choose file`})]}),(0,G.jsxs)(`div`,{className:`gift-fields-grid`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Display title`}),(0,G.jsx)(`input`,{value:te,maxLength:128,placeholder:`e.g. Celebration Star`,onChange:e=>{ne(e.target.value),me(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Price in Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:re,onChange:e=>{ie(e.target.value),me(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Conversion Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,value:ae,onChange:e=>{oe(e.target.value),me(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Sort order`}),(0,G.jsx)(`input`,{type:`number`,value:se,onChange:e=>{ce(e.target.value),me(null)}})]})]}),(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:le,onChange:e=>{ue(e.target.checked),me(null)}}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Enable after import`})]})]}),(0,G.jsxs)(`label`,{className:`gift-reason-field`,children:[(0,G.jsx)(`span`,{children:`Audit reason`}),(0,G.jsx)(`input`,{value:z,placeholder:`Briefly describe why this gift is being imported`,onChange:e=>de(e.target.value)})]}),V&&(0,G.jsx)(q,{children:V}),pe&&(0,G.jsxs)(`div`,{className:`gift-validation`,children:[(0,G.jsxs)(`div`,{className:`gift-validation-head`,children:[(0,G.jsx)(L,{size:17}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Validation passed`}),(0,G.jsx)(`span`,{children:`Review the normalized metadata, then confirm the import.`})]})]}),(0,G.jsx)(`pre`,{children:JSON.stringify(pe.details,null,2)})]})]}),(0,G.jsxs)(`div`,{className:`modal-actions`,children:[(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>a(!1),disabled:he,children:`Close`}),(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:Ct,disabled:he,children:[he?(0,G.jsx)(R,{className:`spin`,size:15}):(0,G.jsx)(ze,{size:15}),`Dry-run validation`]}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:wt,disabled:he||!pe,children:[(0,G.jsx)(Ye,{size:15}),`Confirm import`]})]})]})}),document.body),Se&&(0,Yt.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal gift-bulk-import-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":Se==="default"?`Import all default gifts`:`Import all official gifts`,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`Gift catalog operation`}),(0,G.jsx)(`h2`,{children:Se==="default"?`Import all default gifts`:`Import all official gifts`})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:X,disabled:Me,"aria-label":`Close`,children:(0,G.jsx)($e,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body`,children:[(0,G.jsx)(`div`,{className:`gift-import-note`,children:(0,G.jsx)(`span`,{children:`${we.length} gifts available to import`})}),(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ee,disabled:Me,onChange:e=>De(e.target.checked)}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Enable after import`})]}),(0,G.jsxs)(`label`,{className:`gift-reason-field`,children:[(0,G.jsx)(`span`,{children:`Audit reason`}),(0,G.jsx)(`input`,{value:Oe,placeholder:`Briefly describe why this gift is being imported`,disabled:Me,onChange:e=>Ae(e.target.value)})]}),Me&&(0,G.jsxs)(`div`,{className:`gift-bulk-import-progress`,children:[(0,G.jsx)(`div`,{className:`gift-bulk-import-progress-bar`,children:(0,G.jsx)(`div`,{style:{width:`${Ie.total?Math.round(Ie.done/Ie.total*100):0}%`}})}),(0,G.jsx)(`span`,{children:`Importing ${Ie.done} of ${Ie.total}`})]}),Re&&(0,G.jsx)(q,{children:Re}),Ve&&(0,G.jsxs)(`div`,{className:`gift-validation`,children:[(0,G.jsxs)(`div`,{className:`gift-validation-head`,children:[(0,G.jsx)(L,{size:17}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Import complete`}),(0,G.jsx)(`span`,{children:`Imported ${Ve.imported}, skipped ${Ve.skipped}, failed ${Ve.failed}`})]})]}),Ve.errors.length>0&&(0,G.jsx)(`pre`,{children:Ve.errors.join(` +`)})]})]}),(0,G.jsxs)(`div`,{className:`modal-actions`,children:[(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:X,disabled:Me,children:`Close`}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:xt,disabled:Me||we.length===0,children:[Me?(0,G.jsx)(R,{className:`spin`,size:15}):(0,G.jsx)(Ye,{size:15}),` `,`Start import`]})]})]})}),document.body),o&&(0,G.jsx)(cr,{gift:o,onClose:()=>s(null),onPublished:()=>void tt()})]})}function gr({documentID:e,className:t=``,showError:n=!0}){let r=(0,g.useRef)(null),i=(0,g.useRef)(null),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(null);return(0,g.useEffect)(()=>{let t=!1,n=null;return o(``),c(null),fetch(k.stickerDocumentAnimationURL(e),{credentials:`same-origin`}).then(async e=>{if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||e.statusText)}if((e.headers.get(`content-type`)??``).includes(`json`)){let n=await e.json();if(t||!r.current)return;i.current?.destroy(),i.current=Gn.default.loadAnimation({container:r.current,renderer:`canvas`,loop:!0,autoplay:!0,animationData:n});return}let a=await e.blob();t||(n=URL.createObjectURL(a),c(n))}).catch(e=>{t||o(O(e))}),()=>{t=!0,i.current?.destroy(),i.current=null,n&&URL.revokeObjectURL(n)}},[e]),(0,G.jsxs)(`div`,{className:`sticker-doc-cell ${t}`.trim(),children:[s?(0,G.jsx)(`img`,{className:`sticker-doc-image`,src:s,alt:``}):(0,G.jsx)(`div`,{className:`sticker-doc-canvas`,ref:r}),a&&n&&(0,G.jsx)(`span`,{className:`sticker-doc-error`,children:a})]})}function _r({kind:e,onClose:t,onCreated:n}){let r=e===`emoji`?`emoji`:`sticker`,[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(``),[m,h]=(0,g.useState)(!1),[_,v]=(0,g.useState)(``);async function y(){if(!i.trim()||!o.trim()||!c.trim()||!u){v(`Title, short name, emoji and a first ${r} file are required.`);return}if(!f.trim()){v(`Please enter an operation reason`);return}h(!0),v(``);try{let r=new FormData;r.set(`metadata`,JSON.stringify({command_id:``,reason:f.trim(),confirm:!0,title:i.trim(),short_name:o.trim().toLowerCase(),kind:e,emoji:c.trim()})),r.set(`file`,u,u.name),await k.createStickerSet(r),n(),t()}catch(e){v(O(e))}finally{h(!1)}}return(0,Yt.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`Create a new ${r} pack`,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`New set`}),(0,G.jsx)(`h2`,{children:`Create a new ${r} pack`})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:t,disabled:m,"aria-label":`Close`,children:(0,G.jsx)($e,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body`,children:[(0,G.jsxs)(`div`,{className:`gift-fields-grid`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Title`}),(0,G.jsx)(`input`,{value:i,maxLength:64,onChange:e=>a(e.target.value)})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Short name`}),(0,G.jsx)(`input`,{value:o,maxLength:32,onChange:e=>s(e.target.value),placeholder:`lowercase_short_name`})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Emoji`}),(0,G.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),placeholder:`e.g. 😀`})]})]}),(0,G.jsxs)(`label`,{className:`gift-file-picker ${u?`has-file`:``}`,children:[(0,G.jsx)(`input`,{type:`file`,accept:`.tgs,.json,.webp,application/json,application/x-tgsticker,image/webp`,onChange:e=>d(e.target.files?.[0]??null)}),(0,G.jsxs)(`span`,{className:`gift-file-copy`,children:[(0,G.jsx)(`span`,{className:`gift-field-label`,children:`First ${r}`}),(0,G.jsx)(`strong`,{children:u?u.name:`Choose a TGS, Lottie JSON, or WebP file`})]}),(0,G.jsx)(`span`,{className:`gift-file-action`,children:u?`Change file`:`Choose file`})]}),(0,G.jsxs)(`label`,{className:`gift-reason-field`,children:[(0,G.jsx)(`span`,{children:`Audit reason`}),(0,G.jsx)(`input`,{value:f,placeholder:`Briefly describe why this gift is being imported`,onChange:e=>p(e.target.value)})]}),_&&(0,G.jsx)(q,{children:_})]}),(0,G.jsxs)(`div`,{className:`modal-actions`,children:[(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:t,disabled:m,children:`Close`}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:y,disabled:m,children:[m?(0,G.jsx)(R,{className:`spin`,size:15}):(0,G.jsx)(Ye,{size:15}),`Create ${r} pack`]})]})]})}),document.body)}var vr=24;function Q({set:e,onClose:t}){let n=e.Kind===`emoji`?`emoji`:`sticker`,[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(1),l=(0,g.useCallback)(()=>{let t=!1;return o(``),k.stickerSetDocuments(e.ID).then(e=>{t||i(e.document_ids??[])}).catch(e=>{t||o(O(e))}),()=>{t=!0}},[e.ID]);(0,g.useEffect)(()=>(i(null),c(1),l()),[l]);let u=r?.length??0,d=Math.max(1,Math.ceil(u/vr)),f=Math.min(s,d),p=(f-1)*vr,m=r?.slice(p,p+vr)??[],h=m.length===0?0:p+1,_=h===0?0:h+m.length-1;return(0,Yt.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal sticker-preview-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":e.Title||`#${e.ID}`,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`Set contents`}),(0,G.jsx)(`h2`,{children:e.Title||`#${e.ID}`})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:t,"aria-label":`Close`,children:(0,G.jsx)($e,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body`,children:[(0,G.jsx)(yr,{setID:e.ID,noun:n,onAdded:l}),a&&(0,G.jsx)(q,{children:a}),!a&&r===null&&(0,G.jsxs)(`div`,{className:`loading-line`,children:[(0,G.jsx)(R,{className:`spin`,size:18}),` `,`Loading`]}),r!==null&&u===0&&!a&&(0,G.jsx)(`div`,{className:`empty-panel`,children:`This set has no documents.`}),m.length>0&&(0,G.jsx)(`div`,{className:`sticker-doc-grid`,children:m.map(t=>(0,G.jsxs)(`div`,{className:`sticker-doc-grid-cell`,children:[(0,G.jsx)(gr,{documentID:t}),(0,G.jsx)(Z,{compact:!0,tone:`danger`,label:`Remove`,icon:(0,G.jsx)(Ke,{size:12}),path:`/api/actions/remove-sticker-from-set`,payload:()=>({set_id:e.ID,document_id:t}),onDone:l})]},t))},f),u>vr&&(0,G.jsxs)(`div`,{className:`gift-pager`,children:[(0,G.jsx)(`span`,{className:`gift-pager-range`,children:`Showing ${h}-${_} of ${u}`}),(0,G.jsxs)(`div`,{className:`gift-pager-controls`,children:[(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>c(e=>Math.max(1,e-1)),disabled:f<=1,children:[(0,G.jsx)(fe,{size:14}),` `,`Previous`]}),(0,G.jsx)(`span`,{className:`gift-pager-page`,children:`Page ${f} of ${d}`}),(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>c(e=>Math.min(d,e+1)),disabled:f>=d,children:[`Next`,` `,(0,G.jsx)(B,{size:14})]})]})]})]})]})}),document.body)}function yr({setID:e,noun:t,onAdded:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``);async function p(){if(!r){f(`Choose a ${t} file first`);return}if(!a.trim()){f(`An emoji is required.`);return}if(!s.trim()){f(`Please enter an operation reason`);return}u(!0),f(``);try{let t=new FormData;t.set(`metadata`,JSON.stringify({command_id:``,reason:s.trim(),confirm:!0,set_id:e,emoji:a.trim()})),t.set(`file`,r,r.name),await k.addStickerToSet(t),i(null),o(``),c(``),n()}catch(e){f(O(e))}finally{u(!1)}}return(0,G.jsxs)(`div`,{className:`sticker-add-form`,children:[(0,G.jsxs)(`label`,{className:`gift-file-picker compact ${r?`has-file`:``}`,children:[(0,G.jsx)(`input`,{type:`file`,accept:`.tgs,.json,.webp,application/json,application/x-tgsticker,image/webp`,onChange:e=>i(e.target.files?.[0]??null)}),(0,G.jsx)(`span`,{className:`gift-file-copy`,children:(0,G.jsx)(`strong`,{children:r?r.name:`Choose a TGS, Lottie JSON, or WebP file`})})]}),(0,G.jsx)(`input`,{className:`small-input`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g. 😀`}),(0,G.jsx)(`input`,{className:`small-input`,value:s,onChange:e=>c(e.target.value),placeholder:`Describe why this operation is being performed`}),(0,G.jsxs)(`button`,{className:`btn primary compact-btn`,type:`button`,onClick:p,disabled:l,children:[l?(0,G.jsx)(R,{className:`spin`,size:14}):(0,G.jsx)(je,{size:14}),` `,`Add ${t}`]}),d&&(0,G.jsx)(`span`,{className:`sticker-add-form-error`,children:d})]})}function br({kind:e}){let[t,n]=(0,g.useState)([]),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(10),[d,f]=(0,g.useState)(1),[p,m]=(0,g.useState)({}),[h,_]=(0,g.useState)({}),[v,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(!1),S=e===`emoji`?`Emoji`:`Stickers`,C=e===`emoji`?`Custom-emoji packs — system packs aren't shown here, they're not hand-edited`:`Sticker packs — system packs (dice, animated emoji, gifts) aren't shown here, they're not hand-edited`,w=e===`emoji`?`emoji`:`sticker`;async function T(){o(!0),c(``);try{n((await k.stickerSets(e)).rows??[])}catch(e){c(O(e))}finally{o(!1)}}(0,g.useEffect)(()=>{T()},[e]);let E=(0,g.useMemo)(()=>{let e=r.trim().toLowerCase();return e?t.filter(t=>String(t.ID).includes(e)||t.ShortName.toLowerCase().includes(e)||t.Title.toLowerCase().includes(e)):t},[t,r]);(0,g.useEffect)(()=>{f(1)},[r,l,e]);let D=l===`all`?1:Math.max(1,Math.ceil(E.length/l)),A=Math.min(d,D),j=(0,g.useMemo)(()=>{if(l===`all`)return E;let e=(A-1)*l;return E.slice(e,e+l)},[E,A,l]),M=j.length===0?0:l===`all`?1:(A-1)*l+1,N=M===0?0:M+j.length-1,P=(0,g.useMemo)(()=>({total:t.length,official:t.filter(e=>e.Official).length,archived:t.filter(e=>e.Archived).length}),[t]);return(0,G.jsxs)(vt,{title:S,eyebrow:C,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>T(),disabled:a,children:[(0,G.jsx)(Pe,{size:15}),` `,`Refresh`]}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:()=>x(!0),children:[(0,G.jsx)(je,{size:15}),` `,`Create ${w} pack`]})]}),children:[s&&(0,G.jsx)(q,{children:s}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Total sets`,value:String(P.total)}),(0,G.jsx)(Y,{label:`Official`,value:String(P.official),tone:`good`}),(0,G.jsx)(Y,{label:`Archived`,value:String(P.archived),tone:P.archived>0?`warn`:`neutral`})]}),(0,G.jsx)(yt,{children:(0,G.jsxs)(`div`,{className:`toolbar`,children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Search set ID, short name or title`})]}),(0,G.jsxs)(`label`,{className:`gift-page-size`,children:[(0,G.jsx)(`span`,{children:`Per page`}),(0,G.jsxs)(`select`,{value:String(l),onChange:e=>u(e.target.value===`all`?`all`:Number(e.target.value)),children:[(0,G.jsx)(`option`,{value:`10`,children:`10`}),(0,G.jsx)(`option`,{value:`20`,children:`20`}),(0,G.jsx)(`option`,{value:`50`,children:`50`}),(0,G.jsx)(`option`,{value:`100`,children:`100`}),(0,G.jsx)(`option`,{value:`all`,children:`All`})]})]}),(0,G.jsx)(`span`,{className:`gift-list-summary`,children:`Showing ${E.length} of ${t.length}`})]})}),(0,G.jsx)(`div`,{className:`table-wrap gift-table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Logo`}),(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Short name`}),(0,G.jsx)(`th`,{children:`Title`}),(0,G.jsx)(`th`,{children:`Documents`}),(0,G.jsx)(`th`,{children:`Official`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Sort order`}),(0,G.jsx)(`th`,{children:`Actions`})]})}),(0,G.jsxs)(`tbody`,{children:[j.map(e=>(0,G.jsxs)(`tr`,{className:e.Archived?`gift-row-disabled`:``,children:[(0,G.jsx)(`td`,{children:e.CoverDocumentID?(0,G.jsx)(gr,{documentID:e.CoverDocumentID,className:`list-thumb`,showError:!1}):(0,G.jsx)(`div`,{className:`sticker-list-thumb-empty`,children:(0,G.jsx)(Se,{size:14})})}),(0,G.jsx)(`td`,{className:`mono`,children:e.ID}),(0,G.jsx)(`td`,{className:`mono`,children:e.ShortName||(0,G.jsx)(`span`,{className:`muted-cell`,children:`None`})}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`div`,{className:`sort-order-editor`,children:[(0,G.jsx)(`input`,{className:`small-input title-input`,value:h[e.ID]??e.Title,onChange:t=>_(n=>({...n,[e.ID]:t.target.value}))}),(0,G.jsx)(Z,{compact:!0,tone:`neutral`,label:`Save`,path:`/api/actions/rename-sticker-set`,payload:()=>({set_id:e.ID,title:(h[e.ID]??e.Title).trim()}),onDone:()=>void T()})]})}),(0,G.jsx)(`td`,{children:e.Count}),(0,G.jsx)(`td`,{children:e.Official?(0,G.jsx)(J,{tone:`good`,children:`Yes`}):(0,G.jsx)(J,{children:`No`})}),(0,G.jsx)(`td`,{children:e.Archived?(0,G.jsx)(J,{tone:`danger`,children:`Archived`}):(0,G.jsx)(J,{tone:`good`,children:`Enabled`})}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`div`,{className:`sort-order-editor`,children:[(0,G.jsx)(`input`,{type:`number`,className:`small-input`,value:p[e.ID]??String(e.SortOrder),onChange:t=>m(n=>({...n,[e.ID]:t.target.value}))}),(0,G.jsx)(Z,{compact:!0,tone:`neutral`,label:`Save`,path:`/api/actions/set-sticker-set-sort-order`,payload:()=>({set_id:e.ID,sort_order:Number(p[e.ID]??e.SortOrder)}),onDone:()=>void T()})]})}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`div`,{className:`gift-table-actions`,children:[(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>y(e),children:[(0,G.jsx)(he,{size:13}),` `,`View`]}),(0,G.jsx)(Z,{compact:!0,tone:`neutral`,label:e.Archived?`Unarchive`:`Archive`,path:`/api/actions/set-sticker-set-archived`,payload:()=>({set_id:e.ID,archived:!e.Archived}),onDone:()=>void T()}),(0,G.jsx)(Z,{compact:!0,tone:`danger`,label:`Delete`,path:`/api/actions/delete-sticker-set`,payload:()=>({set_id:e.ID}),onDone:()=>void T()})]})})]},e.ID)),j.length===0&&(0,G.jsx)(St,{colSpan:9})]})]})}),l!==`all`&&E.length>0&&(0,G.jsxs)(`div`,{className:`gift-pager`,children:[(0,G.jsx)(`span`,{className:`gift-pager-range`,children:`Showing ${M}-${N} of ${E.length}`}),(0,G.jsxs)(`div`,{className:`gift-pager-controls`,children:[(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>f(e=>Math.max(1,e-1)),disabled:A<=1,children:[(0,G.jsx)(fe,{size:14}),` `,`Previous`]}),(0,G.jsx)(`span`,{className:`gift-pager-page`,children:`Page ${A} of ${D}`}),(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>f(e=>Math.min(D,e+1)),disabled:A>=D,children:[`Next`,` `,(0,G.jsx)(B,{size:14})]})]})]}),v&&(0,G.jsx)(Q,{set:v,onClose:()=>y(null)}),b&&(0,G.jsx)(_r,{kind:e,onClose:()=>x(!1),onCreated:()=>void T()})]})}function xr({loader:e,cacheKey:t,className:n,playOnHover:r=!0,onError:i}){let a=(0,g.useRef)(null),o=(0,g.useRef)(null);(0,g.useEffect)(()=>{let t=!1;return e().then(e=>{t||!a.current||(o.current?.destroy(),o.current=Gn.default.loadAnimation({container:a.current,renderer:`canvas`,loop:!0,autoplay:!1,animationData:structuredClone(e)}),o.current.goToAndStop(0,!0))}).catch(()=>i?.()),()=>{t=!0,o.current?.destroy(),o.current=null}},[t]);function s(){r&&o.current?.play()}function c(){r&&o.current?.goToAndStop(0,!0)}return(0,G.jsx)(`div`,{className:n,ref:a,onMouseEnter:s,onMouseLeave:c})}var Sr=`777000`;function Cr(e){let t=e.rarity_permille>0?` · ${(e.rarity_permille/10).toFixed(1)}%`:``;return`${e.name||`#${e.id}`}${t}`}function wr({gift:e,onDone:t}){let[n,r]=(0,g.useState)(`user`),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(!1),[m,h]=(0,g.useState)(null),[_,v]=(0,g.useState)(``),[y,b]=(0,g.useState)(`0`),[x,S]=(0,g.useState)(`0`),[C,w]=(0,g.useState)(`0`),[T,E]=(0,g.useState)(``),[D,A]=(0,g.useState)(null),[j,M]=(0,g.useState)(``),[N,P]=(0,g.useState)(!1),F=n===`user`?i?.ID??0:o?.ID??0,ee=n===`user`&&f;(0,g.useEffect)(()=>{p(!1),h(null),v(``),b(`0`),S(`0`),w(`0`),A(null),M(``)},[e.GiftID]),(0,g.useEffect)(()=>{if(!ee||m)return;let t=!1;return v(``),k.giftCollectibles(e.GiftID).then(e=>{t||h(e)}).catch(e=>{t||v(O(e))}),()=>{t=!0}},[ee,m,e.GiftID]);function te(t){return{gift_id:e.GiftID,sender_user_id:Number(Sr),user_id:n===`user`?F:0,channel_id:n===`channel`?F:0,hide_name:u,message:c.trim(),upgrade:ee,model_attribute_id:ee?y:`0`,pattern_attribute_id:ee?x:`0`,backdrop_attribute_id:ee?C:`0`,reason:T.trim(),confirm:t}}let ne=(0,g.useMemo)(()=>te(!1),[e.GiftID,n,F,c,u,f,y,x,C,T]),re=D?.dry_run&&!D.error;async function ie(e){if(F<=0){M(`Select a recipient first`);return}if(!T.trim()){M(`Please enter an operation reason`);return}P(!0),M(``);try{let n=await k.action(`/api/actions/give-gift`,te(e));A(n),e&&!n.error&&t?.()}catch(e){M(O(e))}finally{P(!1)}}return(0,G.jsxs)(`div`,{className:`give-gift-form`,children:[(0,G.jsxs)(`div`,{className:`give-gift-summary`,children:[(0,G.jsx)(be,{size:16}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:e.Title||`Gift #${e.GiftID}`}),(0,G.jsxs)(`span`,{className:`mono`,children:[`#`,e.GiftID,` · ⭐ `,e.Stars]})]})]}),(0,G.jsxs)(`div`,{className:`give-gift-tabs`,role:`group`,"aria-label":`Recipient type`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`btn ${n===`user`?`primary`:``}`,onClick:()=>{r(`user`),A(null)},children:[(0,G.jsx)(Xe,{size:15}),` `,`User`]}),(0,G.jsxs)(`button`,{type:`button`,className:`btn ${n===`channel`?`primary`:``}`,onClick:()=>{r(`channel`),p(!1),A(null)},children:[(0,G.jsx)(Ze,{size:15}),` `,`Channel`]})]}),n===`user`?(0,G.jsx)(wn,{label:`Recipient user`,value:i,onChange:e=>{a(e),A(null)}}):(0,G.jsx)(En,{label:`Recipient channel`,value:o,onChange:e=>{s(e),A(null)}}),(0,G.jsxs)(`label`,{className:`form-field`,children:[(0,G.jsx)(`span`,{children:`Sender account ID`}),(0,G.jsx)(`input`,{value:Sr,disabled:!0,readOnly:!0}),(0,G.jsx)(`small`,{className:`field-hint`,children:`Gifts are always sent from the system account 777000 (Telesrv).`})]}),(0,G.jsxs)(`label`,{className:`form-field`,children:[(0,G.jsx)(`span`,{children:`Attached message (optional)`}),(0,G.jsx)(`textarea`,{value:c,rows:2,maxLength:128,onChange:e=>{l(e.target.value),A(null)},placeholder:`Shown with the gift`})]}),(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>{d(e.target.checked),A(null)}}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Hide sender name from recipient`})]}),n===`user`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>{p(e.target.checked),e.target.checked||(b(`0`),S(`0`),w(`0`)),A(null)}}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Deliver as upgraded collectible`})]}),f&&(0,G.jsx)(`p`,{className:`give-gift-upgrade-note`,children:`The gift is minted as a unique collectible. Pick specific attributes below, or leave them on Random to draw from the published pool. The collectible number is assigned automatically. Requires a published collectible upgrade with remaining supply.`}),f&&_&&(0,G.jsx)(q,{children:_}),f&&m&&(0,G.jsxs)(`div`,{className:`gift-fields-grid give-gift-attrs`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Model`}),(0,G.jsxs)(`select`,{value:y,onChange:e=>{b(e.target.value),A(null)},children:[(0,G.jsx)(`option`,{value:`0`,children:`Random`}),(m.models??[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:Cr(e)},e.id))]})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Pattern`}),(0,G.jsxs)(`select`,{value:x,onChange:e=>{S(e.target.value),A(null)},children:[(0,G.jsx)(`option`,{value:`0`,children:`Random`}),(m.patterns??[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:Cr(e)},e.id))]})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Backdrop`}),(0,G.jsxs)(`select`,{value:C,onChange:e=>{w(e.target.value),A(null)},children:[(0,G.jsx)(`option`,{value:`0`,children:`Random`}),(m.backdrops??[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:Cr(e)},e.id))]})]})]})]}),(0,G.jsxs)(`label`,{className:`form-field`,children:[(0,G.jsx)(`span`,{children:`Operation reason`}),(0,G.jsx)(`textarea`,{value:T,rows:2,onChange:e=>E(e.target.value),placeholder:`Describe why this operation is being performed`})]}),(0,G.jsxs)(`div`,{className:`command-preview`,children:[(0,G.jsx)(`div`,{className:`preview-head`,children:`Request preview`}),(0,G.jsx)(wt,{value:JSON.stringify(ne,null,2)})]}),j&&(0,G.jsx)(q,{children:j}),D&&(0,G.jsxs)(`div`,{className:`result-box`,children:[(0,G.jsxs)(`div`,{className:`result-title`,children:[D.error?(0,G.jsx)(I,{size:16}):(0,G.jsx)(L,{size:16}),(0,G.jsx)(`strong`,{children:D.message||D.error||`Action result`})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Command ID`}),(0,G.jsx)(`strong`,{children:D.command_id})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsx)(`strong`,{children:D.status})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Dry-run`}),(0,G.jsx)(`strong`,{children:D.dry_run?`Yes`:`No`})]}),D.details&&(0,G.jsx)(wt,{value:JSON.stringify(D.details,null,2)})]}),(0,G.jsxs)(`div`,{className:`give-gift-form-actions`,children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>ie(!1),disabled:N,children:[N?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Ae,{size:15}),D?`Run dry-run again`:`Run dry-run first`]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`button`,onClick:()=>ie(!0),disabled:N||!re,children:[(0,G.jsx)(be,{size:15}),`Give gift`]})]})]})}function Tr(){let[e,t]=(0,g.useState)([]),[n,r]=(0,g.useState)(``),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(!1);async function u(){l(!0),s(``);try{let e=(await k.gifts()).Gifts??[];t(e),a(t=>t??e[0]??null)}catch(e){s(O(e))}finally{l(!1)}}(0,g.useEffect)(()=>{u()},[]);let d=(0,g.useMemo)(()=>{let t=n.trim().toLowerCase();return t?e.filter(e=>String(e.GiftID).includes(t)||e.Title.toLowerCase().includes(t)):e},[e,n]);return(0,G.jsxs)(vt,{title:`Give Gifts`,eyebrow:`Grant catalog gifts to any user or channel`,actions:(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>u(),disabled:c,children:[(0,G.jsx)(Pe,{size:15}),` `,`Refresh`]}),children:[o&&(0,G.jsx)(q,{children:o}),(0,G.jsx)(`p`,{className:`give-gift-upgrade-note`,children:`Pick a gift to grant. Delivery is free of charge and sent from the system account 777000 (Telesrv) by default.`}),(0,G.jsxs)(`div`,{className:`give-gift-layout`,children:[(0,G.jsxs)(`section`,{className:`give-gift-picker`,children:[(0,G.jsxs)(`div`,{className:`give-gift-picker-head`,children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`Search by title or gift ID`})]}),(0,G.jsx)(`span`,{className:`gift-list-summary`,children:`Showing ${d.length} of ${e.length}`})]}),(0,G.jsxs)(`div`,{className:`give-gift-picker-list`,role:`listbox`,"aria-label":`Select a gift`,children:[d.map(e=>{let t=i?.GiftID===e.GiftID;return(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,className:`give-gift-option ${t?`selected`:``} ${e.Enabled?``:`gift-row-disabled`}`,onClick:()=>a(e),children:[(0,G.jsx)(xr,{className:`give-gift-thumb`,cacheKey:`${e.GiftID}:${e.Revision}`,loader:()=>k.giftAnimation(e.GiftID)}),(0,G.jsxs)(`span`,{className:`give-gift-option-info`,children:[(0,G.jsx)(`strong`,{children:e.Title||`Gift #${e.GiftID}`}),(0,G.jsxs)(`span`,{className:`mono`,children:[`#`,e.GiftID]})]}),(0,G.jsx)(`span`,{className:`give-gift-option-price`,children:e.Enabled?(0,G.jsxs)(J,{children:[`⭐ `,e.Stars]}):(0,G.jsx)(J,{tone:`neutral`,children:`Disabled`})})]},e.GiftID)}),d.length===0&&!c&&(0,G.jsx)(`div`,{className:`official-gift-empty`,children:`No results`})]})]}),(0,G.jsx)(`section`,{className:`give-gift-panel`,children:i?(0,G.jsx)(wr,{gift:i,onDone:()=>void u()},i.GiftID):(0,G.jsxs)(`div`,{className:`give-gift-empty-panel`,children:[(0,G.jsx)(be,{size:26}),(0,G.jsx)(`p`,{children:`Select a gift from the list to start.`})]})})]})]})}var Er=`open,in_review,action_pending,action_failed,appeal_review`,Dr=[{value:Er,label:`Active queue`},{value:`open,in_review,action_pending,action_failed,resolved,dismissed,appeal_review`,label:`All statuses`},{value:`open`,label:`Open`},{value:`in_review`,label:`In review`},{value:`action_pending`,label:`Action pending`},{value:`action_failed`,label:`Action failed`},{value:`appeal_review`,label:`Appeal review`},{value:`resolved`,label:`Resolved`},{value:`dismissed`,label:`Dismissed`}];function Or({navigate:e}){let[t,n]=(0,g.useState)(Er),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``);async function d(){c(!0),u(``);try{let e=new URLSearchParams({statuses:t,limit:`100`});r.trim()&&e.set(`assigned_to`,r.trim()),o((await k.moderationCases(e)).cases)}catch(e){u(O(e))}finally{c(!1)}}(0,g.useEffect)(()=>{d()},[]);let f=a.filter(e=>e.Status===`action_pending`||e.Status===`action_failed`).length,p=a.filter(e=>e.Severity===4).length;return(0,G.jsxs)(vt,{title:`Reports and Moderation`,eyebrow:`Moderation / Cases`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:d,disabled:s,children:[(0,G.jsx)(Pe,{size:15,className:s?`spin`:``}),` `,`Refresh`]}),children:[l&&(0,G.jsx)(q,{children:l}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Current queue`,value:String(a.length)}),(0,G.jsx)(Y,{label:`Critical cases`,value:String(p),tone:p?`danger`:`neutral`}),(0,G.jsx)(Y,{label:`Pending / failed actions`,value:String(f),tone:f?`warn`:`good`})]}),(0,G.jsx)(yt,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),d()},children:[(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsx)(`select`,{"aria-label":`Case status filter`,value:t,onChange:e=>n(e.target.value),children:Dr.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Reviewer`}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Leave blank for all`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:s,children:[(0,G.jsx)(Re,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Case`}),(0,G.jsx)(`th`,{children:`Target`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Severity`}),(0,G.jsx)(`th`,{children:`Reports / Reporters`}),(0,G.jsx)(`th`,{children:`Reviewer`}),(0,G.jsx)(`th`,{children:`Latest report`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[a.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsxs)(`td`,{className:`mono`,children:[`#`,t.ID]}),(0,G.jsx)(`td`,{className:`mono`,children:Pr(t.Target.Type,t.Target.ID)}),(0,G.jsx)(`td`,{children:(0,G.jsx)(kr,{status:t.Status})}),(0,G.jsx)(`td`,{children:(0,G.jsx)(jr,{value:t.Severity})}),(0,G.jsxs)(`td`,{children:[t.ReportCount,` / `,t.DistinctReporterCount]}),(0,G.jsx)(`td`,{children:t.AssignedTo||`-`}),(0,G.jsx)(`td`,{children:W(t.LastReportAt)}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/moderation/${t.ID}`),children:[`Review`,` `,(0,G.jsx)(B,{size:14})]})})]},t.ID)),a.length===0&&(0,G.jsx)(St,{colSpan:8})]})]})})]})}function kr({status:e}){return(0,G.jsx)(J,{tone:e===`resolved`||e===`dismissed`?`good`:e===`action_failed`?`danger`:e===`action_pending`?`warn`:`neutral`,children:Nr(`status`,e)})}var Ar={low:`Low`,medium:`Medium`,high:`High`,critical:`Critical`};function jr({value:e}){let t=[``,`low`,`medium`,`high`,`critical`][e];return(0,G.jsx)(J,{tone:e>=4?`danger`:e>=3?`warn`:`neutral`,children:t?Ar[t]:e})}var Mr={status:{open:`Open`,in_review:`In review`,action_pending:`Action pending`,action_failed:`Action failed`,appeal_review:`Appeal review`,resolved:`Resolved`,dismissed:`Dismissed`},targetType:{channel:`Channel`,chat:`Group`,user:`Account`},source:{account_peer:`Account / peer`,antispam_false_positive:`Anti-spam false positive`,channel_spam:`Channel spam`,encrypted_spam:`Encrypted-chat spam`,ephemeral:`Ephemeral media`,messages:`Messages`,messages_spam:`Message spam`,profile_photo:`Profile photo`,reaction:`Reaction`,sponsored:`Sponsored message`,story:`Story`},reason:{child_abuse:`Child abuse`,copyright:`Copyright`,fake:`Fake`,geo_irrelevant:`Location-irrelevant`,illegal_drugs:`Illegal drugs`,other:`Other`,personal_details:`Personal details`,pornography:`Pornography`,spam:`Spam`,violence:`Violence`}};function Nr(e,t){return Mr[e]?.[t]??t}function Pr(e,t){return`${Nr(`targetType`,e)} #${t}`}function Fr({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(`no_violation`),[u,d]=(0,g.useState)(``),[f,p]=(0,g.useState)(``),[m,h]=(0,g.useState)(!0),[_,v]=(0,g.useState)(!1),[y,b]=(0,g.useState)(``);function x(e){a(e),e&&(d(e.Items.filter(e=>e.Kind===`message`).map(e=>Number(e.ItemID)).filter(e=>Number.isSafeInteger(e)&&e>0).join(`, `)),p(String(e.ReporterUserID)))}async function S(){b(``);try{let t=await k.moderationCase(e);r(t);let n=t.ReportIDs[0];x(n?await k.moderationReport(n):null)}catch(e){b(O(e))}}(0,g.useEffect)(()=>{S()},[e]);let C=(0,g.useMemo)(()=>Ir(c,n?.Case.Target.Type,Lr(u),Number(f),m),[c,n?.Case.Target.Type,u,f,m]),w=(0,g.useMemo)(()=>n?Rr(n):{actions:[],label:`None`,blocked:!1},[n]);async function T(){if(n){v(!0),b(``);try{await k.claimModerationCase(e,n.Case.Version),await S()}catch(e){b(O(e))}finally{v(!1)}}}async function E(){if(!n||!o.trim()){b(`A review reason is required.`);return}if(c===`delete_messages`&&C.length===0){b(n.Case.Target.Type===`user`?`Private-message deletion requires valid evidence message IDs and the reporter's owner_user_id.`:`Channel-message deletion requires at least one valid evidence message ID.`);return}if(window.confirm(`Submit the “${zr(c)}” decision? The action will run through the durable action queue.`)){v(!0),b(``);try{r((await k.decideModerationCase(e,{expected_version:n.Case.Version,reason:o.trim(),kind:c===`no_violation`?`no_violation`:`violation`,actions:C})).case),s(``)}catch(e){b(O(e))}finally{v(!1)}}}async function D(t,i){if(!n||!o.trim()){b(`An appeal review reason is required.`);return}if(window.confirm(i?`Grant this appeal?`:`Deny this appeal?`)){v(!0);try{r((await k.reviewModerationAppeal(e,t,{expected_version:n.Case.Version,reason:o.trim(),granted:i,actions:i?w.actions:[]})).case),s(``)}catch(e){b(O(e))}finally{v(!1)}}}if(y&&!n)return(0,G.jsx)(q,{children:y});if(!n)return(0,G.jsx)(Ct,{label:`Loading moderation case…`});let A=n.Case,j=A.Status===`open`||A.Status===`in_review`||A.Status===`appeal_review`,M=(A.Status===`in_review`||A.Status===`action_failed`)&&!!A.AssignedTo,N=M&&(A.Status!==`action_failed`||c!==`no_violation`),P=n.Appeals.find(e=>e.Status===`pending`);return(0,G.jsxs)(vt,{title:`Review case #${A.ID}`,eyebrow:`Moderation / Case detail`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>t(`/moderation`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to queue`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:S,children:[(0,G.jsx)(Pe,{size:15}),` `,`Refresh`]})]}),children:[y&&(0,G.jsx)(q,{children:y}),(0,G.jsx)(bt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:Pr(A.Target.Type,A.Target.ID)}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:`Version ${A.Version} · Updated ${W(A.UpdatedAt)}`})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(kr,{status:A.Status}),(0,G.jsx)(jr,{value:A.Severity})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Target`,value:Pr(A.Target.Type,A.Target.ID),mono:!0}),(0,G.jsx)(X,{label:`Reports`,value:`${A.ReportCount} reports from ${A.DistinctReporterCount} reporters`}),(0,G.jsx)(X,{label:`Reviewer`,value:A.AssignedTo||`-`}),(0,G.jsx)(X,{label:`First / latest report`,value:`${W(A.FirstReportAt)} / ${W(A.LastReportAt)}`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Report evidence`,text:`Shows up to the latest 100 reports; snapshots are frozen when reports are admitted.`}),(0,G.jsx)(`div`,{className:`toolbar`,children:n.ReportIDs.map(e=>(0,G.jsxs)(`button`,{className:`btn`,onClick:async()=>x(await k.moderationReport(e)),children:[`#`,e]},e))}),i&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Source / Reason`,value:`${Nr(`source`,i.Source)} / ${Nr(`reason`,i.Reason)}`}),(0,G.jsx)(X,{label:`Reporter`,value:String(i.ReporterUserID),mono:!0}),(0,G.jsx)(X,{label:`Option`,value:i.Option,mono:!0}),(0,G.jsx)(X,{label:`Time`,value:W(i.CreatedAt)})]}),i.Comment&&(0,G.jsx)(`p`,{className:`about-text`,children:i.Comment}),(0,G.jsx)(wt,{value:JSON.stringify(i,null,2)})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Decision and action audit`,text:`Actions run idempotently through a lease worker; failures retain their error and attempt count.`}),(0,G.jsx)(wt,{value:JSON.stringify({decisions:n.Decisions,actions:n.Actions},null,2)})]}),n.Appeals.length>0&&(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Appeals`}),(0,G.jsx)(wt,{value:JSON.stringify(n.Appeals,null,2)})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Case actions`}),j&&(0,G.jsxs)(`button`,{className:`btn primary icon-text`,disabled:_,onClick:T,children:[(0,G.jsx)(ze,{size:15}),` `,A.AssignedTo?`Renew claim`:`Claim case`]}),(0,G.jsxs)(`label`,{className:`field`,children:[(0,G.jsx)(`span`,{children:`Review reason`}),(0,G.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),rows:5})]}),(0,G.jsxs)(`label`,{className:`field`,children:[(0,G.jsx)(`span`,{children:`Decision template`}),(0,G.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),children:[(0,G.jsx)(`option`,{value:`no_violation`,children:`No violation (dismiss report)`}),(0,G.jsx)(`option`,{value:`scam`,children:`Mark as SCAM`}),(0,G.jsx)(`option`,{value:`fake`,children:`Mark as FAKE`}),(0,G.jsx)(`option`,{value:`freeze`,children:`Freeze account`}),(0,G.jsx)(`option`,{value:`scam_freeze`,children:`SCAM + freeze`}),(0,G.jsx)(`option`,{value:`fake_freeze`,children:`FAKE + freeze`}),(0,G.jsx)(`option`,{value:`delete_messages`,children:`Delete messages covered by evidence`}),(0,G.jsx)(`option`,{value:`delete_account`,children:`Delete account`})]})]}),c===`delete_messages`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`field`,children:[(0,G.jsx)(`span`,{children:`Evidence message IDs (comma-separated)`}),(0,G.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`101, 102`})]}),A.Target.Type===`user`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`field`,children:[(0,G.jsx)(`span`,{children:`Private-chat owner_user_id`}),(0,G.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),inputMode:`numeric`})]}),(0,G.jsxs)(`label`,{className:`field checkbox-field`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked)}),(0,G.jsx)(`span`,{children:`Revoke for both sides`})]})]}),(0,G.jsx)(q,{children:`The server will verify again that every message ID exists in this case's immutable report evidence.`})]}),A.Status===`action_failed`&&c===`no_violation`&&(0,G.jsx)(q,{children:`The action was partially executed and cannot be changed directly to no violation. Select a new action to retry while retaining the previous failure audit.`}),M&&(0,G.jsxs)(`button`,{className:`btn danger icon-text`,disabled:_||!N,onClick:E,children:[(0,G.jsx)(L,{size:15}),` `,A.Status===`action_failed`?`Retry action`:`Submit decision`]}),P&&A.AssignedTo&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Appeal review #${P.ID}`}),(0,G.jsx)(X,{label:`Automatic remedy after approval`,value:w.label}),w.blocked&&(0,G.jsx)(q,{children:`The case contains a completed irreversible deletion. It cannot be marked as approved and restored; deny it or escalate for manual handling.`}),(0,G.jsx)(`button`,{className:`btn`,disabled:_,onClick:()=>D(P.ID,!1),children:`Deny appeal`}),(0,G.jsx)(`button`,{className:`btn primary`,disabled:_||w.blocked,onClick:()=>D(P.ID,!0),children:`Grant appeal`})]})]})})]})}function Ir(e,t,n,r,i){switch(e){case`scam`:return[{kind:`mark_scam`,payload:{}}];case`fake`:return[{kind:`mark_fake`,payload:{}}];case`freeze`:return[{kind:`freeze_account`,payload:{}}];case`scam_freeze`:return[{kind:`mark_scam`,payload:{}},{kind:`freeze_account`,payload:{}}];case`fake_freeze`:return[{kind:`mark_fake`,payload:{}},{kind:`freeze_account`,payload:{}}];case`delete_messages`:return n.length===0?[]:t===`channel`?[{kind:`delete_channel_message`,payload:{ids:n}}]:t===`user`&&Number.isSafeInteger(r)&&r>0?[{kind:`delete_private_message`,payload:{owner_user_id:r,ids:n,revoke:i}}]:[];case`delete_account`:return[{kind:`delete_account`,payload:{}}];default:return[]}}function Lr(e){let t=e.split(/[,\s]+/).filter(Boolean).map(Number);return t.length===0||t.some(e=>!Number.isSafeInteger(e)||e<=0)?[]:[...new Set(t)]}function Rr(e){let t=!1,n=!1,r=!1;for(let i of[...e.Actions].sort((e,t)=>e.ID-t.ID))if(i.Status===`succeeded`)switch(i.Kind){case`mark_scam`:case`mark_fake`:t=!0;break;case`clear_peer_flags`:t=!1;break;case`freeze_account`:n=!0;break;case`unfreeze_account`:n=!1;break;case`delete_private_message`:case`delete_channel_message`:case`delete_account`:r=!0;break}let i=[],a=[];return t&&(i.push({kind:`clear_peer_flags`,payload:{}}),a.push(`Clear SCAM / FAKE`)),n&&(i.push({kind:`unfreeze_account`,payload:{}}),a.push(`Unfreeze account`)),{actions:i,label:a.join(` + `)||`No recovery action needed`,blocked:r}}function zr(e){return{no_violation:`No violation (dismiss report)`,scam:`Mark as SCAM`,fake:`Mark as FAKE`,freeze:`Freeze account`,scam_freeze:`SCAM + freeze`,fake_freeze:`FAKE + freeze`,delete_messages:`Delete messages covered by evidence`,delete_account:`Delete account`}[e]}function Br({navigate:e}){let[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)([]),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(0),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``);async function p(){try{n(await k.storageStats())}catch{}}async function m(e=!1){u(!0),f(``);let t=new URLSearchParams({limit:`50`,offset:String(e?s:0)});try{let n=await k.storageAccounts(t),r=n.rows??[];i(t=>e?[...t,...r]:r),c(n.next_offset),o(!!n.has_more)}catch(e){f(O(e))}finally{u(!1)}}function h(){p(),m(!1)}(0,g.useEffect)(()=>{h()},[]);let _=t?Math.max(0,Number(t.LogicalBytes)-Number(t.PhysicalBytes)):0;return(0,G.jsxs)(vt,{title:`Storage`,eyebrow:`Media / Storage usage`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:h,disabled:l,children:[(0,G.jsx)(Pe,{size:15,className:l?`spin`:``}),` `,`Refresh`]}),children:[d&&(0,G.jsx)(q,{children:d}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Physical usage (on disk / S3)`,value:t?mt(t.PhysicalBytes):`-`}),(0,G.jsx)(Y,{label:`Logical usage (sum per account)`,value:t?mt(t.LogicalBytes):`-`}),(0,G.jsx)(Y,{label:`Saved by dedup`,value:mt(String(_)),tone:_>0?`good`:`neutral`}),(0,G.jsx)(Y,{label:`Backend`,value:t?.BackendKind??`-`})]}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Documents`,value:t?st(t.DocumentCount):`-`}),(0,G.jsx)(Y,{label:`Photos`,value:t?st(t.PhotoCount):`-`}),(0,G.jsx)(Y,{label:`Accounts with media`,value:t?st(t.AccountCount):`-`}),(0,G.jsx)(Y,{label:`Unattributed`,value:t?mt(t.UnattributedBytes):`-`,tone:t&&Number(t.UnattributedBytes)>0?`warn`:`neutral`})]}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`User ID`}),(0,G.jsx)(`th`,{children:`Account`}),(0,G.jsx)(`th`,{children:`Storage used`}),(0,G.jsx)(`th`,{children:`Files`})]})}),(0,G.jsxs)(`tbody`,{children:[r.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:e.UserID}),(0,G.jsx)(`td`,{children:U(e.Username)||e.FirstName||`-`}),(0,G.jsx)(`td`,{className:`mono`,children:mt(e.Bytes)}),(0,G.jsx)(`td`,{className:`mono`,children:st(e.FileCount)})]},e.UserID)),r.length===0&&(0,G.jsx)(St,{colSpan:4})]})]})}),a&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>m(!0),disabled:l,children:[l?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function Vr(e){let t=e.toLowerCase();return t.includes(`tgsticker`)||t.includes(`lottie`)||t.includes(`json`)}function Hr({row:e}){let[t,n]=(0,g.useState)(!Vr(e.MimeType));return(0,g.useEffect)(()=>{n(!Vr(e.MimeType))},[e.DocumentID,e.MimeType]),t?(0,G.jsx)(`div`,{className:`emoji-picker-glyph`,children:e.Alt||`🙂`}):(0,G.jsx)(xr,{className:`emoji-picker-anim`,cacheKey:e.DocumentID,loader:()=>k.emojiAnimation(e.DocumentID),onError:()=>n(!0)})}function Ur({label:e,value:t,onChange:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``),d=a.find(e=>e.DocumentID===t)??null;async function f(){c(!0),u(``);let e=new URLSearchParams({limit:`24`});r.trim()&&e.set(`q`,r.trim());try{o((await k.emoji(e)).rows??[])}catch(e){u(O(e))}finally{c(!1)}}return(0,g.useEffect)(()=>{f()},[]),(0,G.jsxs)(`div`,{className:`entity-picker`,children:[(0,G.jsxs)(`div`,{className:`picker-head`,children:[(0,G.jsx)(`span`,{children:e}),t?(0,G.jsxs)(`button`,{className:`link-button`,type:`button`,onClick:()=>n(``),children:[(0,G.jsx)($e,{size:13}),` `,`Clear`]}):null]}),t?(0,G.jsxs)(`div`,{className:`selected-entity`,children:[(0,G.jsx)(z,{size:15}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:d?.Alt||`—`}),(0,G.jsx)(`span`,{className:`mono`,children:t})]}),(0,G.jsx)(`span`,{children:d?.SetTitle||`-`})]}):null,(0,G.jsxs)(`div`,{className:`picker-search`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),f())},placeholder:`Search document ID or emoji`}),(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:f,disabled:s,children:s?(0,G.jsx)(R,{size:14,className:`spin`}):`Search`})]}),l&&(0,G.jsx)(`div`,{className:`picker-error`,children:l}),(0,G.jsxs)(`div`,{className:`picker-results emoji-picker-results`,children:[a.map(e=>(0,G.jsxs)(`button`,{className:`picker-row emoji-picker-row ${t===e.DocumentID?`selected`:``}`,type:`button`,onClick:()=>n(e.DocumentID),children:[(0,G.jsx)(Hr,{row:e}),(0,G.jsx)(`span`,{className:`mono`,children:e.DocumentID}),(0,G.jsx)(`span`,{children:e.SetTitle||`—`})]},e.DocumentID)),a.length===0&&!s?(0,G.jsx)(`div`,{className:`picker-empty`,children:`No results`}):null]})]})}var Wr=[`pending`,`approved`,`rejected`,`revoked`],Gr=[`user`,`channel`],Kr={pending:`Pending`,approved:`Approved`,rejected:`Rejected`,revoked:`Mark revoked`},qr={user:`Account`,channel:`Channel`};function Jr({navigate:e}){let{can:t}=jt(),n=t(Ot),r=t(Et),[i,a]=(0,g.useState)(`requests`),[o,s]=(0,g.useState)([]),[c,l]=(0,g.useState)([]),[u,d]=(0,g.useState)(``),[f,p]=(0,g.useState)(!1);async function m(){d(``),p(!1);try{let[e,t]=await Promise.all([k.botVerifiers(new URLSearchParams({limit:`200`})),k.verificationIcons(new URLSearchParams({limit:`200`}))]);s(e.rows??[]),l(t.rows??[])}catch(e){if(e instanceof v&&e.status===403){s([]),l([]),p(!0);return}d(O(e))}}return(0,g.useEffect)(()=>{m()},[]),(0,G.jsxs)(vt,{title:`Third-party verification`,eyebrow:`Third-party verification / Verifiers, icons, marks`,actions:r?(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>e(`/verification`),children:[(0,G.jsx)(me,{size:15}),` `,`Official verification`]}):void 0,children:[u&&(0,G.jsx)(q,{children:u}),f&&(0,G.jsx)(q,{children:`The server refused the verifier roster and the icon catalogue for this session (403), so both lists are empty here — applications can still be reviewed.`}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`A verifier company's icon — not the official checkmark`,text:`A third-party mark is a verifier bot's own icon, drawn right BEFORE the name of an account, a bot or a channel, plus one line of description in the profile. It says “this verifier vouches for this peer”, and nothing more.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The icon is a custom emoji document. The client fetches it through messages.getCustomEmojiDocuments, so a document id that resolves to nothing renders as no badge at all — which is why marks are granted from the catalogue below rather than from a typed number.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The official checkmark is a different mechanism, granted by the platform in the Verification section. The two are stored, shown and taken away separately, and neither one implies the other.`}),!n&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This session can read the section and decide applications, but not change verifiers or the icon catalogue — that needs the botverification.manage permission.`})]}),(0,G.jsx)(`div`,{className:`toolbar`,role:`group`,"aria-label":`Third-party verification`,children:[{key:`requests`,label:`Applications`,icon:(0,G.jsx)(H,{size:15})},{key:`verifiers`,label:`Verifiers`,icon:(0,G.jsx)(ce,{size:15})},{key:`icons`,label:`Icon catalogue`,icon:(0,G.jsx)(We,{size:15})},{key:`marks`,label:`Granted marks`,icon:(0,G.jsx)(F,{size:15})}].map(e=>(0,G.jsxs)(`button`,{className:`btn icon-text ${i===e.key?`primary`:``}`,type:`button`,"aria-pressed":i===e.key,onClick:()=>a(e.key),children:[e.icon,` `,e.label]},e.key))}),i===`requests`&&(0,G.jsx)(Yr,{navigate:e,verifiers:o}),i===`verifiers`&&(0,G.jsx)(Xr,{verifiers:o,icons:c,canManage:n,onChanged:m,navigate:e}),i===`icons`&&(0,G.jsx)(Zr,{icons:c,verifiers:o,canManage:n,onChanged:m}),i===`marks`&&(0,G.jsx)(Qr,{verifiers:o,canManage:n,navigate:e})]})}function Yr({navigate:e,verifiers:t}){let[n,r]=(0,g.useState)(`pending`),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(`all`),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(`50`),[f,p]=(0,g.useState)([]),[m,h]=(0,g.useState)({}),[_,v]=(0,g.useState)(!1),[y,b]=(0,g.useState)(``),[x,S]=(0,g.useState)(!1),[C,w]=(0,g.useState)(``);async function T(e=!1){S(!0),w(``);let t=new URLSearchParams({limit:u});n!==`all`&&t.set(`status`,n),i&&t.set(`verifier_bot_id`,i),o!==`all`&&t.set(`peer_type`,o),c.trim()&&t.set(`q`,c.trim().replace(/^@/,``)),e&&y&&t.set(`before_id`,y);try{let n=await k.customVerificationRequests(t),r=n.rows??[];p(t=>e?[...t,...r]:r),b(n.next_before_id??``),v(!!n.has_more)}catch(e){w(O(e))}finally{S(!1)}}async function E(){try{h((await k.botVerificationCounts()).counts??{})}catch(e){w(O(e))}}(0,g.useEffect)(()=>{T(!1),E()},[]);function D(){T(!1),E()}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Application queue`,text:`Applications filed with a verifier bot by the owner of the peer. The counters cover the whole queue, not the page below.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:D,disabled:x,children:[(0,G.jsx)(Pe,{size:15,className:x?`spin`:``}),` `,`Refresh`]})}),C&&(0,G.jsx)(q,{children:C}),(0,G.jsx)(`div`,{className:`metric-row`,children:Wr.map(e=>(0,G.jsx)(Y,{label:Kr[e],value:m[e]??`0`,mono:!0,tone:ni(e,m[e]??`0`)},e))})]}),(0,G.jsx)(yt,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),T(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),placeholder:`Application id, peer id, username or title`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsxs)(`select`,{value:n,onChange:e=>r(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All statuses`}),Wr.map(e=>(0,G.jsx)(`option`,{value:e,children:Kr[e]},e))]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Verifier`}),(0,G.jsx)($r,{value:i,verifiers:t,onChange:a})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Peer type`}),(0,G.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All types`}),Gr.map(e=>(0,G.jsx)(`option`,{value:e,children:qr[e]},e))]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:u,onChange:e=>d(e.target.value),type:`number`,min:`1`,max:`200`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:x,children:[x?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Fe,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Verifier`}),(0,G.jsx)(`th`,{children:`Peer`}),(0,G.jsx)(`th`,{children:`Applicant`}),(0,G.jsx)(`th`,{children:`Stated reason`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Filed`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[f.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/bot-verification/${t.ID}`),children:[`#`,t.ID]})}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{children:U(t.VerifierBotUsername)||t.VerifierBotID}),(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:t.VerifierBotID})]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{children:ri(t)}),(0,G.jsxs)(`div`,{className:`entity-subtitle mono`,children:[qr[t.PeerType],` · `,t.PeerID]})]}),(0,G.jsxs)(`td`,{children:[U(t.ApplicantUsername)||`-`,(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:t.ApplicantUserID})]}),(0,G.jsx)(`td`,{className:`truncate`,children:t.Reason||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsx)(ei,{status:t.Status})}),(0,G.jsx)(`td`,{children:W(t.CreatedAt)||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/bot-verification/${t.ID}`),children:[(0,G.jsx)(H,{size:14}),` `,`Details`,` `,(0,G.jsx)(B,{size:14})]})})]},t.ID)),f.length===0&&(0,G.jsx)(St,{colSpan:8})]})]})}),_&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>T(!0),disabled:x,children:[x?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function Xr({verifiers:e,icons:t,canManage:n,onChanged:r,navigate:i}){let[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)(``),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(``),[h,_]=(0,g.useState)(!1),v=t.filter(e=>e.Active),y=v.map(e=>({value:e.DocumentID,label:`${e.Name} · ${e.DocumentID}`}));if(l&&!y.some(e=>e.value===l)){let e=t.find(e=>e.DocumentID===l);y.unshift({value:l,label:`${e?.Name??l} · ${l} (Retired)`})}function b(e){c(e),o(null),u(e.IconDocumentID),f(e.CompanyName),m(e.DefaultDescription),_(e.CanModifyCustomDescription)}function x(){c(null),o(null),u(``),f(``),m(``),_(!1)}function S(){return{bot_id:s?s.BotID:a?String(a.ID):`0`,icon_document_id:l||`0`,company_name:d.trim(),default_description:p.trim(),can_modify_custom_description:h,version:s?s.Version:`0`}}return(0,G.jsxs)(G.Fragment,{children:[n&&(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:s?`Update verifier`:`Grant verifier status`,text:`The bot gets an icon from the catalogue and a company name to vouch under. The same call updates an existing verifier, which is why it carries a version.`,action:s?(0,G.jsx)(`button`,{className:`btn icon-text`,type:`button`,onClick:x,children:`Cancel update`}):void 0}),s?(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Updating ${U(s.BotUsername)||s.BotID} — version ${s.Version} is sent as the optimistic lock, so a row somebody else changed meanwhile is refused instead of overwritten.`}):(0,G.jsx)(Tn,{label:`Bot`,value:a,onChange:o}),(0,G.jsxs)(`div`,{className:`bot-create-fields`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Icon from the catalogue`}),(0,G.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`Pick an icon`}),y.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Company`}),(0,G.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`Acme Verification Ltd`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Default description`}),(0,G.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`Verified by Acme`})]})]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>_(e.target.checked)}),`The verifier may replace the description per peer`]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This is botVerifierSettings.can_modify_custom_description: with it off, every mark this verifier grants carries the default description above, whatever the applicant asked for.`}),v.length===0&&(0,G.jsx)(q,{children:`The catalogue has no active icon, so there is nothing to grant. Add one in the icon catalogue first.`}),(0,G.jsxs)(`div`,{className:`bot-create-actions`,children:[(0,G.jsx)(`span`,{className:`bot-create-note`,children:`The bot can mark peers as soon as the row exists and is enabled.`}),(0,G.jsx)(Z,{label:s?`Update verifier`:`Grant verifier status`,icon:(0,G.jsx)(je,{size:15}),tone:`neutral`,path:`/api/actions/grant-bot-verifier`,payload:S,onDone:()=>{x(),r()}})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Verifier bots`,text:`Bots allowed to hand out their own mark. Verifier status is granted per deployment, so every row here is a badge printer an operator switched on by hand.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:r,children:[(0,G.jsx)(Pe,{size:15}),` `,`Refresh`]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Bot`}),(0,G.jsx)(`th`,{children:`Company`}),(0,G.jsx)(`th`,{children:`Icon`}),(0,G.jsx)(`th`,{children:`Own description`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Marks`}),(0,G.jsx)(`th`,{children:`Granted by`}),(0,G.jsx)(`th`,{children:`Updated`}),n&&(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[e.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`button`,{className:`row-link`,type:`button`,onClick:()=>i(`/bots/${e.BotID}`),children:(0,G.jsx)(`strong`,{children:U(e.BotUsername)||e.BotName||e.BotID})}),(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:e.BotID})]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{children:e.CompanyName||`-`}),(0,G.jsx)(`div`,{className:`entity-subtitle truncate`,children:e.DefaultDescription||`Not set`})]}),(0,G.jsxs)(`td`,{children:[e.IconName||`-`,(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:e.IconDocumentID})]}),(0,G.jsx)(`td`,{children:e.CanModifyCustomDescription?`Yes`:`No`}),(0,G.jsx)(`td`,{children:e.Enabled?(0,G.jsx)(J,{tone:`good`,children:`Enabled`}):(0,G.jsx)(J,{tone:`warn`,children:`disabled`})}),(0,G.jsx)(`td`,{className:`mono`,children:String(e.MarkCount??`0`)}),(0,G.jsxs)(`td`,{children:[e.GrantedBy||`-`,(0,G.jsx)(`div`,{className:`entity-subtitle truncate`,children:e.GrantReason||`-`})]}),(0,G.jsx)(`td`,{children:W(e.UpdatedAt)||`-`}),n&&(0,G.jsx)(`td`,{children:(0,G.jsxs)(`div`,{className:`row-actions`,children:[(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>b(e),children:`Edit`}),(0,G.jsx)(Z,{label:e.Enabled?`Disable`:`Enable`,icon:e.Enabled?(0,G.jsx)(Me,{size:14}):(0,G.jsx)(Ne,{size:14}),tone:e.Enabled?`warn`:`neutral`,compact:!0,path:`/api/actions/set-bot-verifier-enabled`,payload:()=>({bot_id:e.BotID,enabled:!e.Enabled}),onDone:r}),(0,G.jsx)(Z,{label:`Revoke status`,icon:(0,G.jsx)(Ke,{size:14}),tone:`danger`,compact:!0,path:`/api/actions/revoke-bot-verifier`,payload:()=>({bot_id:e.BotID}),onDone:r})]})})]},e.BotID)),e.length===0&&(0,G.jsx)(St,{colSpan:n?9:8})]})]})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Disabling is the per-verifier kill switch: the marks already granted keep rendering, but the bot can no longer mark anything new and its settings stop being projected into botInfo.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Revoking verifier status removes the row and every mark this verifier granted — the icon disappears from all of its peers at once.`})]})]})}function Zr({icons:e,verifiers:t,canManage:n,onChanged:r}){let[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(``);function u(){let e={document_id:i.trim()||`0`,name:o.trim()};return c&&(e.owner_bot_id=c),e}return(0,G.jsxs)(G.Fragment,{children:[n&&(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Add or rename an icon`,text:`Search and pick any custom-emoji document already on this deployment (including bundled/system ones). Adding an id that already exists renames it instead of duplicating it.`}),(0,G.jsx)(Ur,{label:`Document`,value:i,onChange:a}),(0,G.jsxs)(`div`,{className:`bot-create-fields`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Name`}),(0,G.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`Acme blue tick`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Owner`}),(0,G.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`Shared`}),t.map(e=>(0,G.jsx)(`option`,{value:e.BotID,children:`${e.CompanyName||e.BotID} · ${U(e.BotUsername)||e.BotID}`},e.BotID))]})]})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`A document id that resolves to nothing produces an invisible badge: the peer is marked in the database and the client draws nothing.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`A shared icon may be granted to any verifier; picking an owner reserves it for that one bot.`}),(0,G.jsxs)(`div`,{className:`bot-create-actions`,children:[(0,G.jsx)(`span`,{className:`bot-create-note`,children:`Adding an icon grants nothing by itself — it only makes the document available to grant.`}),(0,G.jsx)(Z,{label:`Save icon`,icon:(0,G.jsx)(je,{size:15}),tone:`neutral`,path:`/api/actions/upsert-verification-icon`,payload:u,onDone:()=>{a(``),s(``),l(``),r()}})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Icon catalogue`,text:`The custom emoji documents a verifier may mark with. Nothing else can be used as an icon, so the catalogue is where a wrong badge is prevented rather than fixed.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:r,children:[(0,G.jsx)(Pe,{size:15}),` `,`Refresh`]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Document ID`}),(0,G.jsx)(`th`,{children:`Name`}),(0,G.jsx)(`th`,{children:`Owner`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Verifiers using it`}),(0,G.jsx)(`th`,{children:`Filed`}),n&&(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[e.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:e.DocumentID}),(0,G.jsx)(`td`,{children:(0,G.jsx)(`strong`,{children:e.Name||`-`})}),(0,G.jsx)(`td`,{children:e.OwnerBotID&&e.OwnerBotID!==`0`?(0,G.jsxs)(G.Fragment,{children:[U(e.OwnerBotUsername)||e.OwnerBotID,(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:e.OwnerBotID})]}):(0,G.jsx)(J,{children:`Shared`})}),(0,G.jsx)(`td`,{children:e.Active?(0,G.jsx)(J,{tone:`good`,children:`Active`}):(0,G.jsx)(J,{tone:`warn`,children:`Retired`})}),(0,G.jsx)(`td`,{className:`mono`,children:String(e.UsedByVerifiers??`0`)}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)||`-`}),n&&(0,G.jsx)(`td`,{children:(0,G.jsx)(`div`,{className:`row-actions`,children:(0,G.jsx)(Z,{label:e.Active?`Retire`:`Activate`,icon:e.Active?(0,G.jsx)(Me,{size:14}):(0,G.jsx)(Ne,{size:14}),tone:e.Active?`warn`:`neutral`,compact:!0,path:`/api/actions/set-verification-icon-active`,payload:()=>({icon_id:e.ID,active:!e.Active}),onDone:r})})})]},e.ID)),e.length===0&&(0,G.jsx)(St,{colSpan:n?7:6})]})]})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Retiring an icon stops it from being granted to anybody new. Marks already carrying it keep it: the icon is copied onto the mark when it is granted.`})]})]})}function Qr({verifiers:e,canManage:t,navigate:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(`all`),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(`50`),[d,f]=(0,g.useState)([]),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(``);async function S(e=!1){y(!0),x(``);let t=new URLSearchParams({limit:l});r&&t.set(`verifier_bot_id`,r),a!==`all`&&t.set(`peer_type`,a),s.trim()&&t.set(`q`,s.trim().replace(/^@/,``)),e&&h&&t.set(`before_id`,h);try{let n=await k.customVerifications(t),r=n.rows??[];f(t=>e?[...t,...r]:r),_(n.next_before_id??``),m(!!n.has_more)}catch(e){x(O(e))}finally{y(!1)}}return(0,g.useEffect)(()=>{S(!1)},[]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Granted marks`,text:`Every peer currently carrying a third-party mark, whoever granted it — an operator decision, the verifier bot itself, or the peer's owner through bots.setCustomVerification.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>S(!1),disabled:v,children:[(0,G.jsx)(Pe,{size:15,className:v?`spin`:``}),` `,`Refresh`]})}),b&&(0,G.jsx)(q,{children:b})]}),(0,G.jsx)(yt,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),S(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Peer id, username or title`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Verifier`}),(0,G.jsx)($r,{value:r,verifiers:e,onChange:i})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Peer type`}),(0,G.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All types`}),Gr.map(e=>(0,G.jsx)(`option`,{value:e,children:qr[e]},e))]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:l,onChange:e=>u(e.target.value),type:`number`,min:`1`,max:`200`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:v,children:[v?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Fe,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Verifier`}),(0,G.jsx)(`th`,{children:`Peer`}),(0,G.jsx)(`th`,{children:`Description`}),(0,G.jsx)(`th`,{children:`Icon`}),(0,G.jsx)(`th`,{children:`Filed`}),t&&(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[d.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsxs)(`td`,{className:`mono`,children:[`#`,e.ID]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{children:e.CompanyName||U(e.VerifierBotUsername)||e.VerifierBotID}),(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:U(e.VerifierBotUsername)||e.VerifierBotID})]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`button`,{className:`row-link`,type:`button`,onClick:()=>n(ii(e.PeerType,e.PeerID)),children:(0,G.jsx)(`strong`,{children:ri(e)})}),(0,G.jsxs)(`div`,{className:`entity-subtitle mono`,children:[qr[e.PeerType],` · `,e.PeerID]})]}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Description||`Not set`}),(0,G.jsx)(`td`,{className:`mono`,children:e.IconDocumentID}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)||`-`}),t&&(0,G.jsx)(`td`,{children:(0,G.jsx)(`div`,{className:`row-actions`,children:(0,G.jsx)(Z,{label:`Remove mark`,icon:(0,G.jsx)(oe,{size:14}),tone:`danger`,compact:!0,path:`/api/actions/revoke-custom-verification`,payload:()=>({verifier_bot_id:e.VerifierBotID,peer_type:e.PeerType,peer_id:e.PeerID}),onDone:()=>S(!1)})})})]},e.ID)),d.length===0&&(0,G.jsx)(St,{colSpan:t?7:6})]})]})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Removing a mark clears the icon and the description from the peer. The application it came from keeps its history.`}),p&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>S(!0),disabled:v,children:[v?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function $r({value:e,verifiers:t,onChange:n}){return(0,G.jsxs)(`select`,{value:e,onChange:e=>n(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`All verifiers`}),t.map(e=>(0,G.jsx)(`option`,{value:e.BotID,children:`${e.CompanyName||e.BotID} · ${U(e.BotUsername)||e.BotID}`+(e.Enabled?``:` (disabled)`)},e.BotID))]})}function ei({status:e}){return(0,G.jsx)(J,{tone:ti(e),children:Kr[e]})}function ti(e){return e===`approved`?`good`:e===`pending`?`warn`:e===`rejected`?`danger`:`neutral`}function ni(e,t){return e===`pending`?t!==`0`&&t!==``?`warn`:`neutral`:e===`approved`?`good`:`neutral`}function ri(e){return U(e.PeerUsername)||e.PeerTitle||`#${e.PeerID}`}function ii(e,t){return e===`channel`?`/channels/${t}`:`/accounts/${t}`}function ai({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(``);async function f(){l(!0),d(``);try{r(await k.customVerificationRequest(e))}catch(e){d(O(e))}finally{l(!1)}}function p(){s(!1),f()}(0,g.useEffect)(()=>{f()},[e]);function m(e){if(e instanceof v&&e.status===409)return s(!0),f(),`Another admin has already changed this application. The data has been reloaded — check the status before deciding again.`}if(u&&!n)return(0,G.jsx)(q,{children:u});if(!n)return(0,G.jsx)(Ct,{label:`Loading the application…`});let h=n.request,_=si(n.verifier),y=n.mark_active,b=h.Status===`pending`,x=h.Status===`approved`,S=i.trim(),C=h.RequestedDescription.trim(),w=!!_?.CanModifyCustomDescription&&C!==``,T=w?C:(_?.DefaultDescription??``).trim();function E(){let e={version:h.Version};return S&&(e.internal_note=S),e}function D(){a(``),s(!1),f()}return(0,G.jsxs)(vt,{title:`Application #${h.ID}`,eyebrow:`Third-party verification / Review`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/bot-verification`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:p,disabled:c,children:[(0,G.jsx)(Pe,{size:15,className:c?`spin`:``}),` `,`Refresh`]})]}),children:[u&&(0,G.jsx)(q,{children:u}),o&&(0,G.jsx)(q,{children:`Another admin has already changed this application. The data has been reloaded — check the status before deciding again.`}),(0,G.jsx)(bt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:ri(h)}),(0,G.jsxs)(`div`,{className:`entity-subtitle mono`,children:[`#`,h.ID,` · `,qr[h.PeerType],`:`,h.PeerID,` · v`,h.Version]})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(ei,{status:h.Status}),y?(0,G.jsxs)(J,{tone:`good`,children:[(0,G.jsx)(F,{size:12}),` `,`Mark is live`]}):(0,G.jsx)(J,{tone:`neutral`,children:`No mark on the peer`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`A verifier company's icon — not the official checkmark`,text:`A third-party mark is a verifier bot's own icon, drawn right BEFORE the name of an account, a bot or a channel, plus one line of description in the profile. It says “this verifier vouches for this peer”, and nothing more.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The icon is a custom emoji document. The client fetches it through messages.getCustomEmojiDocuments, so a document id that resolves to nothing renders as no badge at all — which is why marks are granted from the catalogue below rather than from a typed number.`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Verifier`,text:`The company whose icon the peer would carry, as its row stands right now.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/bots/${h.VerifierBotID}`),children:[(0,G.jsx)(ce,{size:15}),` `,`Open verifier bot`]})}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Company`,value:_?.CompanyName||`-`}),(0,G.jsx)(X,{label:`Bot`,value:U(h.VerifierBotUsername)||`-`}),(0,G.jsx)(X,{label:`Verifier bot ID`,value:h.VerifierBotID,mono:!0}),(0,G.jsx)(X,{label:`Document ID`,value:_?.IconDocumentID||`-`,mono:!0}),(0,G.jsx)(X,{label:`Name`,value:_?.IconName||`-`}),(0,G.jsx)(X,{label:`Own description`,value:_?.CanModifyCustomDescription?`Yes`:`No`})]}),(0,G.jsx)(oi,{label:`Default description`,children:_?.DefaultDescription?(0,G.jsx)(`p`,{className:`about-text`,children:_.DefaultDescription}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not set`})}),!_&&(0,G.jsx)(q,{children:`The verifier row is gone: its status was revoked after this application was filed. There is no icon to grant, so the application can only be rejected.`}),_&&!_.Enabled&&(0,G.jsx)(q,{children:`This verifier is disabled. It cannot mark anything new until an operator enables it again.`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Peer`,text:`The account, bot or channel the icon would be attached to.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(ii(h.PeerType,h.PeerID)),children:[(0,G.jsx)(me,{size:15}),` `,`Open peer`]})}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Type`,value:qr[h.PeerType]}),(0,G.jsx)(X,{label:`Username`,value:U(h.PeerUsername)||`-`}),(0,G.jsx)(X,{label:`Title`,value:h.PeerTitle||`-`}),(0,G.jsx)(X,{label:`Peer ID`,value:h.PeerID,mono:!0})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Applicant`,text:`Who filed the application with the verifier bot.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/accounts/${h.ApplicantUserID}`),children:[(0,G.jsx)(Xe,{size:15}),` `,`Open account`]})}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Username`,value:U(h.ApplicantUsername)||`-`}),(0,G.jsx)(X,{label:`User ID`,value:h.ApplicantUserID,mono:!0}),(0,G.jsx)(X,{label:`Filed`,value:W(h.CreatedAt)||`-`}),(0,G.jsx)(X,{label:`Updated`,value:W(h.UpdatedAt)||`-`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Application`,text:`What the applicant wrote, rendered as plain text.`}),(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Correlation ID`,value:h.CorrelationID||`-`,mono:!0}),(0,G.jsx)(X,{label:`Status`,value:Kr[h.Status]})]}),(0,G.jsx)(oi,{label:`Stated reason`,children:h.Reason?(0,G.jsx)(`p`,{className:`about-text`,children:h.Reason}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not set`})}),(0,G.jsx)(oi,{label:`Requested description`,children:C?(0,G.jsx)(`p`,{className:`about-text`,children:C}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not set`})}),(0,G.jsx)(oi,{label:`Description the mark would carry`,children:T?(0,G.jsx)(`p`,{className:`about-text`,children:T}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not set`})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Resolved the same way the backend resolves it: the applicant's wording only when this verifier may set its own description, otherwise the verifier's default.`}),C!==``&&!w&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This verifier may not set a per-peer description, so the requested wording is ignored and the default is applied.`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Decision`,text:`What was decided, by whom, and with which wording.`}),(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Decided by`,value:h.DecidedBy||`-`}),(0,G.jsx)(X,{label:`Approved`,value:W(h.ApprovedAt)||`-`}),(0,G.jsx)(X,{label:`Rejected`,value:W(h.RejectedAt)||`-`}),(0,G.jsx)(X,{label:`Version (optimistic lock)`,value:h.Version,mono:!0})]}),(0,G.jsx)(oi,{label:`Decision reason`,children:h.DecisionReason?(0,G.jsx)(`p`,{className:`about-text`,children:h.DecisionReason}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`No decision yet`})}),(0,G.jsx)(oi,{label:`Internal note · admins only`,children:h.InternalNote?(0,G.jsx)(`p`,{className:`about-text`,children:h.InternalNote}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not set`})})]})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsxs)(`div`,{className:`dock-title`,children:[(0,G.jsx)(H,{size:14}),` `,`Decision`]}),!b&&!x&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This status has no available actions.`}),(b||x)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Internal note`}),(0,G.jsx)(`textarea`,{value:i,onChange:e=>a(e.target.value),rows:3,placeholder:`Handover note for other admins`})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Optional. Stored with the decision and visible to admins only — never sent to the applicant.`})]}),b&&(0,G.jsxs)(G.Fragment,{children:[!_&&(0,G.jsx)(q,{children:`The verifier row is gone: its status was revoked after this application was filed. There is no icon to grant, so the application can only be rejected.`}),_&&!_.Enabled&&(0,G.jsx)(q,{children:`This verifier is disabled. It cannot mark anything new until an operator enables it again.`}),y&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This peer already carries this verifier's mark; approving refreshes the description and records the decision.`}),(0,G.jsxs)(`div`,{className:`action-stack`,children:[(0,G.jsx)(Z,{label:`Approve`,icon:(0,G.jsx)(L,{size:15}),tone:`neutral`,path:`/api/botverification/requests/${h.ID}/approve`,payload:E,onDone:D,onError:m}),(0,G.jsx)(Z,{label:`Reject`,icon:(0,G.jsx)(ee,{size:15}),tone:`warn`,path:`/api/botverification/requests/${h.ID}/reject`,payload:E,onDone:D,onError:m})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Puts the verifier's icon before the peer's name and its description in the profile, and messages the applicant.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The reason is mandatory: it is the wording the applicant is told, so write what exactly was missing.`})]}),x&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`dock-title`,children:[(0,G.jsx)(Be,{size:14}),` `,`Danger zone`]}),(0,G.jsxs)(`div`,{className:`danger-zone`,children:[(0,G.jsx)(Z,{label:`Revoke mark`,icon:(0,G.jsx)(oe,{size:15}),tone:`danger`,path:`/api/botverification/requests/${h.ID}/revoke`,payload:E,onDone:D,onError:m}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Takes the icon and the description off the peer and closes the application as revoked. The official checkmark, if the peer has one, is untouched.`}),!y&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The peer carries no mark right now — revoking only closes the application.`})]})]})]})})]})}function oi({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:e}),t]})}function si(e){return!e||!e.BotID||e.BotID===`0`?null:e}var ci=[`draft`,`submitted`,`in_review`,`approved`,`rejected`,`cancelled`],li=[`bot`,`channel`,`supergroup`,`user`],ui={draft:`Draft`,submitted:`Submitted`,in_review:`In review`,approved:`Approved`,rejected:`Rejected`,cancelled:`Cancelled`},di={bot:`Bot`,channel:`Channel`,supergroup:`Supergroup`,user:`User`};function fi({navigate:e}){let[t,n]=(0,g.useState)(`all`),[r,i]=(0,g.useState)(`all`),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(`50`),[d,f]=(0,g.useState)([]),[p,m]=(0,g.useState)({}),[h,_]=(0,g.useState)(!1),[v,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(``);async function w(e=!1){x(!0),C(``);let n=new URLSearchParams({limit:l});t!==`all`&&n.set(`status`,t),r!==`all`&&n.set(`target_type`,r),a.trim()&&n.set(`reviewer`,a.trim()),s.trim()&&n.set(`q`,s.trim().replace(/^@/,``)),e&&v&&n.set(`before_id`,v);try{let t=await k.verificationApplications(n),r=t.rows??[];f(t=>e?[...t,...r]:r),y(t.next_before_id??``),_(!!t.has_more)}catch(e){C(O(e))}finally{x(!1)}}async function T(){try{m((await k.verificationCounts()).counts??{})}catch(e){C(O(e))}}(0,g.useEffect)(()=>{w(!1),T()},[]);function E(){w(!1),T()}return(0,G.jsxs)(vt,{title:`Verification queue`,eyebrow:`Verification / Queue`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:E,disabled:b,children:[(0,G.jsx)(Pe,{size:15,className:b?`spin`:``}),` `,`Refresh`]}),children:[S&&(0,G.jsx)(q,{children:S}),(0,G.jsx)(`div`,{className:`metric-row`,children:ci.map(e=>(0,G.jsx)(Y,{label:ui[e],value:p[e]??`0`,mono:!0,tone:hi(e,p[e]??`0`)},e))}),(0,G.jsx)(yt,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),w(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Fe,{size:15}),(0,G.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Application id, peer id, username or title`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsxs)(`select`,{value:t,onChange:e=>n(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All statuses`}),ci.map(e=>(0,G.jsx)(`option`,{value:e,children:ui[e]},e))]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Target type`}),(0,G.jsxs)(`select`,{value:r,onChange:e=>i(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All types`}),li.map(e=>(0,G.jsx)(`option`,{value:e,children:di[e]},e))]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Reviewer`}),(0,G.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`Any reviewer`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:l,onChange:e=>u(e.target.value),type:`number`,min:`1`,max:`200`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:b,children:[b?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Fe,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Target`}),(0,G.jsx)(`th`,{children:`Applicant`}),(0,G.jsx)(`th`,{children:`Category`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Submitted`}),(0,G.jsx)(`th`,{children:`Reviewer`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[d.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/verification/${t.ID}`),children:[`#`,t.ID]})}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{children:gi(t)}),(0,G.jsxs)(`div`,{className:`entity-subtitle mono`,children:[di[t.TargetType],` · `,t.TargetID]}),t.TargetVerified&&(0,G.jsxs)(J,{tone:`good`,children:[(0,G.jsx)(F,{size:12}),` `,`Badge already on`]})]}),(0,G.jsxs)(`td`,{children:[U(t.ApplicantUsername)||t.ApplicantName||`-`,(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:t.ApplicantUserID})]}),(0,G.jsx)(`td`,{children:t.Category||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsx)(pi,{status:t.Status})}),(0,G.jsx)(`td`,{children:W(t.SubmittedAt)||`-`}),(0,G.jsx)(`td`,{children:t.ReviewerAdminID||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/verification/${t.ID}`),children:[(0,G.jsx)(ze,{size:14}),` `,`Details`,` `,(0,G.jsx)(B,{size:14})]})})]},t.ID)),d.length===0&&(0,G.jsx)(St,{colSpan:8})]})]})}),h&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>w(!0),disabled:b,children:[b?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function pi({status:e}){return(0,G.jsx)(J,{tone:mi(e),children:ui[e]})}function mi(e){return e===`approved`?`good`:e===`submitted`||e===`in_review`?`warn`:e===`rejected`?`danger`:`neutral`}function hi(e,t){return e===`submitted`||e===`in_review`?t!==`0`&&t!==``?`warn`:`neutral`:e===`approved`?`good`:`neutral`}function gi(e){return U(e.TargetUsername)||e.TargetTitle||`#${e.TargetID}`}function _i(e){return e.TargetType===`bot`?`/bots/${e.TargetID}`:e.TargetType===`user`?`/accounts/${e.TargetID}`:`/channels/${e.TargetID}`}var vi={created:`Created`,updated:`Updated`,submitted:`Submitted`,claimed:`Claimed`,approved:`Approved`,rejected:`Rejected`,cancelled:`Cancelled`,revoked:`Badge revoked`,notified:`Applicant notified`};function yi({id:e,navigate:t}){let{can:n}=jt(),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``);async function p(){u(!0),f(``);try{i(await k.verificationApplication(e))}catch(e){f(O(e))}finally{u(!1)}}function m(){c(!1),p()}(0,g.useEffect)(()=>{p()},[e]);function h(e){if(e instanceof v&&e.status===409)return c(!0),p(),`Another admin has already changed this application. The data has been reloaded — check the status before deciding again.`}if(d&&!r)return(0,G.jsx)(q,{children:d});if(!r)return(0,G.jsx)(Ct,{label:`Loading the application…`});let _=r.application,y=r.events??[],b=r.applicant_controls_target,x=r.target_verified,S=_.Status===`submitted`,C=_.Status===`submitted`||_.Status===`in_review`,w=_.Status===`approved`&&n(`verification.revoke`),T=a.trim();function E(){let e={version:_.Version};return T&&(e.internal_note=T),e}function D(){o(``),c(!1),p()}return(0,G.jsxs)(vt,{title:`Application #${_.ID}`,eyebrow:`Verification / Review`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/verification`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:m,disabled:l,children:[(0,G.jsx)(Pe,{size:15,className:l?`spin`:``}),` `,`Refresh`]})]}),children:[d&&(0,G.jsx)(q,{children:d}),s&&(0,G.jsx)(q,{children:`Another admin has already changed this application. The data has been reloaded — check the status before deciding again.`}),(0,G.jsx)(bt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:gi(_)}),(0,G.jsxs)(`div`,{className:`entity-subtitle mono`,children:[`#`,_.ID,` · `,di[_.TargetType],`:`,_.TargetID,` · v`,_.Version]})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(pi,{status:_.Status}),x&&(0,G.jsxs)(J,{tone:`good`,children:[(0,G.jsx)(F,{size:12}),` `,`Badge already on`]}),(0,G.jsx)(J,{tone:b?`good`:`danger`,children:b?`Control confirmed`:`No control over the target`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Target`,text:`The peer the badge would be attached to, as it exists right now.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(_i(_)),children:[(0,G.jsx)(me,{size:15}),` `,`Open target`]})}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Type`,value:di[_.TargetType]}),(0,G.jsx)(X,{label:`Username`,value:U(_.TargetUsername)||`-`}),(0,G.jsx)(X,{label:`Title`,value:_.TargetTitle||`-`}),(0,G.jsx)(X,{label:`Peer ID`,value:_.TargetID,mono:!0})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Applicant`,text:`Who filed the application and whether they still hold rights on the target.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/accounts/${_.ApplicantUserID}`),children:[(0,G.jsx)(Xe,{size:15}),` `,`Open account`]})}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Username`,value:U(_.ApplicantUsername)||`-`}),(0,G.jsx)(X,{label:`Name`,value:_.ApplicantName||`-`}),(0,G.jsx)(X,{label:`User ID`,value:_.ApplicantUserID,mono:!0}),(0,G.jsx)(X,{label:`Submitted`,value:W(_.SubmittedAt)||`-`})]}),b?(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The applicant controls the target right now — checked against the live records, not against the submission snapshot.`}):(0,G.jsx)(q,{children:`The applicant no longer controls the target. Approving would hand the badge to someone who does not hold the peer — normally a reason to reject.`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Application`,text:`Everything the applicant submitted, rendered as plain text.`}),(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Category`,value:_.Category||`-`}),(0,G.jsx)(X,{label:`Correlation ID`,value:_.CorrelationID||`-`,mono:!0}),(0,G.jsx)(X,{label:`Created`,value:W(_.CreatedAt)||`-`}),(0,G.jsx)(X,{label:`Updated`,value:W(_.UpdatedAt)||`-`})]}),(0,G.jsx)(bi,{label:`Description`,children:_.Description?(0,G.jsx)(`p`,{className:`about-text`,children:_.Description}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not provided`})}),(0,G.jsx)(bi,{label:`Official website`,children:_.OfficialWebsite?(0,G.jsx)(`div`,{className:`about-text`,children:(0,G.jsx)(xi,{value:_.OfficialWebsite})}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not provided`})}),(0,G.jsx)(bi,{label:`Social links`,children:(0,G.jsx)(Si,{values:_.SocialLinks})}),(0,G.jsx)(bi,{label:`Press coverage`,children:(0,G.jsx)(Si,{values:_.PressLinks})}),(0,G.jsx)(bi,{label:`Applicant comment`,children:_.AdditionalNote?(0,G.jsx)(`p`,{className:`about-text`,children:_.AdditionalNote}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not provided`})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Only http:// and https:// links are clickable and open in a new tab; anything else is shown as text.`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Decision`,text:`What was decided, by whom, and with which wording.`}),(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Reviewer`,value:_.ReviewerAdminID||`-`}),(0,G.jsx)(X,{label:`Decided`,value:W(_.ReviewedAt)||`-`}),(0,G.jsx)(X,{label:`Status`,value:ui[_.Status]}),(0,G.jsx)(X,{label:`Version (optimistic lock)`,value:_.Version,mono:!0})]}),(0,G.jsx)(bi,{label:`Decision reason`,children:_.DecisionReason?(0,G.jsx)(`p`,{className:`about-text`,children:_.DecisionReason}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`No decision yet`})}),(0,G.jsx)(bi,{label:`Internal note · admins only`,children:_.InternalNote?(0,G.jsx)(`p`,{className:`about-text`,children:_.InternalNote}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not provided`})})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`History`,text:`Immutable trail of every status transition, with actor and reason.`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Event`}),(0,G.jsx)(`th`,{children:`From → to`}),(0,G.jsx)(`th`,{children:`Actor`}),(0,G.jsx)(`th`,{children:`Reason`}),(0,G.jsx)(`th`,{children:`Internal note`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[y.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:(0,G.jsx)(Ci,{kind:e.Kind})}),(0,G.jsxs)(`td`,{className:`mono`,children:[e.FromStatus||`-`,` → `,e.ToStatus||`-`]}),(0,G.jsx)(`td`,{children:e.Actor||`-`}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Reason||`-`}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Note||`-`}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)||`-`})]},e.ID)),y.length===0&&(0,G.jsx)(St,{colSpan:6})]})]})})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Review actions`}),!S&&!C&&!w&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This status has no available actions.`}),S&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`action-stack`,children:(0,G.jsx)(Z,{label:`Take into review`,icon:(0,G.jsx)(V,{size:15}),tone:`neutral`,path:`/api/verification/applications/${_.ID}/claim`,payload:()=>({version:_.Version}),onDone:D,onError:h})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Assigns the application to you and moves it to in review, so two reviewers never work on the same one.`})]}),(C||w)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Internal note`}),(0,G.jsx)(`textarea`,{value:a,onChange:e=>o(e.target.value),rows:3,placeholder:`Handover note for other reviewers`})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Optional. Stored with the decision and visible to admins only — never sent to the applicant.`})]}),C&&(0,G.jsxs)(G.Fragment,{children:[!b&&(0,G.jsx)(q,{children:`The applicant no longer controls the target. Approving would hand the badge to someone who does not hold the peer — normally a reason to reject.`}),x&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The target already carries the badge; approving only records the decision.`}),(0,G.jsxs)(`div`,{className:`action-stack`,children:[(0,G.jsx)(Z,{label:`Approve`,icon:(0,G.jsx)(L,{size:15}),tone:`neutral`,path:`/api/verification/applications/${_.ID}/approve`,payload:E,onDone:D,onError:h}),(0,G.jsx)(Z,{label:`Reject`,icon:(0,G.jsx)(ee,{size:15}),tone:`warn`,path:`/api/verification/applications/${_.ID}/reject`,payload:E,onDone:D,onError:h})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Grants the official badge to the target and closes the application.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The reason is mandatory: it is the wording the applicant is told, so write what exactly was missing.`})]}),w&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`dock-title`,children:[(0,G.jsx)(Be,{size:14}),` `,`Danger zone`]}),(0,G.jsxs)(`div`,{className:`danger-zone`,children:[(0,G.jsx)(Z,{label:`Revoke verification`,icon:(0,G.jsx)(oe,{size:15}),tone:`danger`,path:`/api/actions/revoke-verification`,payload:()=>{let e={target_type:_.TargetType,target_id:_.TargetID};return T&&(e.internal_note=T),e},onDone:D,onError:h}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Clears the badge from the target. The approved application stays in history.`}),!x&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The target carries no badge right now — there is nothing to revoke.`})]})]})]})})]})}function bi({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:e}),t]})}function xi({value:e}){let t=it(e);return t?(0,G.jsxs)(`a`,{className:`row-link`,href:t,target:`_blank`,rel:`noopener noreferrer`,children:[e,` `,(0,G.jsx)(me,{size:13})]}):(0,G.jsx)(`span`,{className:`mono`,children:e})}function Si({values:e}){let t=(e??[]).filter(e=>e.trim()!==``);return t.length===0?(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not provided`}):(0,G.jsx)(`div`,{className:`about-text`,children:t.map((e,t)=>(0,G.jsx)(`div`,{children:(0,G.jsx)(xi,{value:e})},`${t}-${e}`))})}function Ci({kind:e}){return(0,G.jsx)(J,{tone:e===`approved`?`good`:e===`rejected`||e===`revoked`||e===`cancelled`?`danger`:e===`submitted`||e===`claimed`?`warn`:`neutral`,children:vi[e]})}function wi({route:e,navigate:t}){let n=e.path.match(/^\/accounts\/(\d+)$/)?.[1],r=e.path.match(/^\/channels\/(\d+)$/)?.[1],i=e.path.match(/^\/bots\/(\d+)$/)?.[1],a=e.path.match(/^\/moderation\/(\d+)$/)?.[1],o=e.path.match(/^\/collectible-usernames\/(\d+)$/)?.[1],s=e.path.match(/^\/account-ratings\/(\d+)$/)?.[1],c=e.path.match(/^\/verification\/(\d+)$/)?.[1],l=e.path.match(/^\/bot-verification\/(\d+)$/)?.[1];return l?(0,G.jsx)(Nt,{permission:Dt,children:(0,G.jsx)(ai,{id:l,navigate:t})}):e.path===`/bot-verification`?(0,G.jsx)(Nt,{permission:Dt,children:(0,G.jsx)(Jr,{navigate:t})}):c?(0,G.jsx)(Nt,{permission:Et,children:(0,G.jsx)(yi,{id:c,navigate:t})}):e.path===`/verification`?(0,G.jsx)(Nt,{permission:Et,children:(0,G.jsx)(fi,{navigate:t})}):o?(0,G.jsx)(jn,{id:o,navigate:t}):s?(0,G.jsx)(dn,{userID:s,navigate:t}):e.path===`/collectible-usernames`?(0,G.jsx)(Dn,{navigate:t}):e.path===`/account-ratings`?(0,G.jsx)(sn,{navigate:t}):e.path===`/storage`?(0,G.jsx)(Br,{navigate:t}):n?(0,G.jsx)(an,{id:Number(n),navigate:t}):r?(0,G.jsx)(Fn,{id:Number(r),navigate:t}):i?(0,G.jsx)(Ln,{id:Number(i),navigate:t}):a?(0,G.jsx)(Fr,{id:Number(a),navigate:t}):e.path===`/accounts`?(0,G.jsx)(Cn,{navigate:t}):e.path===`/channels`?(0,G.jsx)(In,{navigate:t}):e.path===`/bots`?(0,G.jsx)(Rn,{navigate:t}):e.path===`/moderation`?(0,G.jsx)(Or,{navigate:t}):e.path===`/emoji`?(0,G.jsx)(br,{kind:`emoji`}):e.path===`/gifts`?(0,G.jsx)(hr,{}):e.path===`/stickers`?(0,G.jsx)(br,{kind:`stickers`}):e.path===`/give-gifts`?(0,G.jsx)(Tr,{}):e.path===`/messages/detail`||e.path===`/messages/private/detail`?(0,G.jsx)(Un,{ownerUserID:Number(e.search.get(`owner_user_id`)||`0`),msgID:Number(e.search.get(`msg_id`)||`0`),navigate:t}):e.path===`/messages/groups/detail`?(0,G.jsx)(Vn,{channelID:Number(e.search.get(`channel_id`)||`0`),msgID:Number(e.search.get(`msg_id`)||`0`),navigate:t}):e.path===`/messages/groups`?(0,G.jsx)(Hn,{navigate:t}):e.path===`/messages`||e.path===`/messages/private`?(0,G.jsx)(Wn,{navigate:t}):(0,G.jsx)(zn,{navigate:t})}function Ti(){let[e,t]=(0,g.useState)(void 0),[n,r]=(0,g.useState)(()=>Ft());(0,g.useEffect)(()=>{let e=()=>r(Ft());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,g.useEffect)(()=>{k.session().then(e=>t(e)).catch(()=>t(null))},[]);let i=e=>{window.history.pushState(null,``,e),r(Ft())};return e===void 0?(0,G.jsx)(Gt,{}):e===null?(0,G.jsx)(Jt,{onLogin:t}):(0,G.jsx)(At,{permissions:e.permissions??[],children:(0,G.jsx)(Kt,{actor:e.actor,route:n,navigate:i,onLogout:()=>t(null),children:(0,G.jsx)(wi,{route:n,navigate:i})})})}_.createRoot(document.getElementById(`root`)).render((0,G.jsx)(g.StrictMode,{children:(0,G.jsx)(Bt,{children:(0,G.jsx)(Ti,{})})})); \ No newline at end of file diff --git a/cmd/telesrv-admin/web/dist/assets/index-CmjlUwWc.js b/cmd/telesrv-admin/web/dist/assets/index-CmjlUwWc.js deleted file mode 100644 index b88b138c..00000000 --- a/cmd/telesrv-admin/web/dist/assets/index-CmjlUwWc.js +++ /dev/null @@ -1,10 +0,0 @@ -var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-Ee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u(),n=f();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},m={};function h(e){return l.call(m,e)?!0:l.call(p,e)?!1:d.test(e)?m[e]=!0:(p[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` -`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{re=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ne(e):``}function ae(e){switch(e.tag){case 5:return ne(e.type);case 16:return ne(`Lazy`);case 13:return ne(`Suspense`);case 19:return ne(`SuspenseList`);case 0:case 2:case 15:return e=ie(e.type,!1),e;case 11:return e=ie(e.type.render,!1),e;case 1:return e=ie(e.type,!0),e;default:return``}}function oe(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?oe(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}function se(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return oe(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function ce(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function le(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ue(e){var t=le(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function z(e){e._valueTracker||=ue(e)}function de(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=le(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function fe(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function pe(e,t){var n=t.checked;return R({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function me(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=ce(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function he(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function ge(e,t){he(e,t);var n=ce(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?ve(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&ve(e,t.type,ce(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _e(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function ve(e,t,n){(t!==`number`||fe(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ye=Array.isArray;function be(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=Ee.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Oe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ke={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ae=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(ke).forEach(function(e){Ae.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ke[t]=ke[e]})});function je(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||ke.hasOwnProperty(e)&&ke[e]?(``+t).trim():t+`px`}function Me(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=je(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ne=R({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Pe(e,t){if(t){if(Ne[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Fe(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Ie=null;function Le(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Re=null,ze=null,Be=null;function Ve(e){if(e=Ai(e)){if(typeof Re!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Mi(t),Re(e.stateNode,e.type,t))}}function He(e){ze?Be?Be.push(e):Be=[e]:ze=e}function Ue(){if(ze){var e=ze,t=Be;if(Be=ze=null,Ve(e),t)for(e=0;e>>=0,e===0?32:31-(G(e)/St|0)|0}var wt=64,K=4194304;function q(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function J(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=q(a))):r=q(s)}else o=n&~i,o===0?a!==0&&(r=q(a)):r=q(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Ot(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-xt(t),e[t]=n}function kt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Wn),qn=` `,Jn=!1;function Yn(e,t){switch(e){case`keyup`:return Hn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Xn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Zn=!1;function Qn(e,t){switch(e){case`compositionend`:return Xn(t);case`keypress`:return t.which===32?(Jn=!0,qn):null;case`textInput`:return e=t.data,e===qn&&Jn?null:e;default:return null}}function $n(e,t){if(Zn)return e===`compositionend`||!Un&&Yn(e,t)?(e=pn(),fn=dn=un=null,Zn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=br(n)}}function Sr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Cr(){for(var e=window,t=fe();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=fe(e.document)}return t}function wr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Tr(e){var t=Cr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Sr(n.ownerDocument.documentElement,n)){if(r!==null&&wr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=xr(n,a);var o=xr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n=document.documentMode,Dr=null,Or=null,kr=null,Ar=!1;function jr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ar||Dr==null||Dr!==fe(r)||(r=Dr,`selectionStart`in r&&wr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kr&&yr(kr,r)||(kr=r,r=ri(Or,`onSelect`),0Pi||(e.current=Ni[Pi],Ni[Pi]=null,Pi--)}function Li(e,t){Pi++,Ni[Pi]=e.current,e.current=t}var Ri={},zi=Fi(Ri),Bi=Fi(!1),Vi=Ri;function Hi(e,t){var n=e.type.contextTypes;if(!n)return Ri;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ui(e){return e=e.childContextTypes,e!=null}function Wi(){Ii(Bi),Ii(zi)}function Gi(e,t,n){if(zi.current!==Ri)throw Error(r(168));Li(zi,t),Li(Bi,n)}function Ki(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,se(e)||`Unknown`,a));return R({},n,i)}function qi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ri,Vi=zi.current,Li(zi,e),Li(Bi,Bi.current),!0}function Ji(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Ki(e,t,Vi),i.__reactInternalMemoizedMergedChildContext=e,Ii(Bi),Ii(zi),Li(zi,e)):Ii(Bi),Li(Bi,n)}var Yi=null,Xi=!1,Zi=!1;function Qi(e){Yi===null?Yi=[e]:Yi.push(e)}function $i(e){Xi=!0,Qi(e)}function ea(){if(!Zi&&Yi!==null){Zi=!0;var e=0,t=jt;try{var n=Yi;for(jt=1;e>=o,i-=o,ca=1<<32-xt(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),ga&&ua(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ga&&ua(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ga&&ua(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ga&&ua(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&Aa(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Oa(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=Oa(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(ye(i))return h(e,r,i,o);if(ee(i))return g(e,r,i,o);ka(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ma=ja(!0),Na=ja(!1),Pa=Fi(null),Fa=null,Ia=null,La=null;function Ra(){La=Ia=Fa=null}function za(e){var t=Pa.current;Ii(Pa),e._currentValue=t}function Ba(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Va(e,t){Fa=e,La=Ia=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(js=!0),e.firstContext=null)}function Ha(e){var t=e._currentValue;if(La!==e)if(e={context:e,memoizedValue:t,next:null},Ia===null){if(Fa===null)throw Error(r(308));Ia=e,Fa.dependencies={lanes:0,firstContext:e}}else Ia=Ia.next=e;return t}var Ua=null;function Wa(e){Ua===null?Ua=[e]:Ua.push(e)}function Ga(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Wa(t)):(n.next=i.next,i.next=n),t.interleaved=n,Ka(e,r)}function Ka(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var qa=!1;function Ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ya(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Xa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Bc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Ka(e,n)}return i=r.interleaved,i===null?(t.next=t,Wa(r)):(t.next=i.next,i.next=t),r.interleaved=t,Ka(e,n)}function Qa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,At(e,n)}}function $a(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function eo(e,t,n,r){var i=e.updateQueue;qa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=R({},d,f);break a;case 2:qa=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Jc|=o,e.lanes=o,e.memoizedState=d}}function to(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=_o.transition;_o.transition={};try{e(!1),t()}finally{jt=n,_o.transition=r}}function is(){return jo().memoizedState}function as(e,t,n){var r=pl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ss(e))cs(t,n);else if(n=Ga(e,t,n,r),n!==null){var i=fl();ml(n,e,r,i),ls(n,t,r)}}function os(e,t,n){var r=pl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ss(e))cs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Q(s,o)){var c=t.interleaved;c===null?(i.next=i,Wa(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Ga(e,t,i,r),n!==null&&(i=fl(),ml(n,e,r,i),ls(n,t,r))}}function ss(e){var t=e.alternate;return e===yo||t!==null&&t===yo}function cs(e,t){Co=So=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ls(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,At(e,n)}}var us={readContext:Ha,useCallback:Eo,useContext:Eo,useEffect:Eo,useImperativeHandle:Eo,useInsertionEffect:Eo,useLayoutEffect:Eo,useMemo:Eo,useReducer:Eo,useRef:Eo,useState:Eo,useDebugValue:Eo,useDeferredValue:Eo,useTransition:Eo,useMutableSource:Eo,useSyncExternalStore:Eo,useId:Eo,unstable_isNewReconciler:!1},ds={readContext:Ha,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:Ha,useEffect:qo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Go(4194308,4,Zo.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Go(4194308,4,e,t)},useInsertionEffect:function(e,t){return Go(4,2,e,t)},useMemo:function(e,t){var n=Ao();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ao();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=as.bind(null,yo,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:Ho,useDebugValue:$o,useDeferredValue:function(e){return Ao().memoizedState=e},useTransition:function(){var e=Ho(!1),t=e[0];return e=rs.bind(null,e[1]),Ao().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=yo,a=Ao();if(ga){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Vc===null)throw Error(r(349));vo&30||Lo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,qo(zo.bind(null,i,o,e),[e]),i.flags|=2048,Uo(9,Ro.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Ao(),t=Vc.identifierPrefix;if(ga){var n=la,r=ca;n=(r&~(1<<32-xt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=wo++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Ci]=t,e[wi]=i,tc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Fe(n,i),n){case`dialog`:Xr(`cancel`,e),Xr(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:Xr(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;oel&&(t.flags|=128,i=!0,ic(s,!1),t.lanes=4194304)}else{if(!i)if(e=po(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ic(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!ga)return ac(t),null}else 2*dt()-s.renderingStartTime>el&&n!==1073741824&&(t.flags|=128,i=!0,ic(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(ac(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=dt(),t.sibling=null,n=fo.current,Li(fo,i?n&1|2:n&1),t);case 22:case 23:return wl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Wc&1073741824&&(ac(t),t.subtreeFlags&6&&(t.flags|=8192)):ac(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function sc(e,t){switch(pa(t),t.tag){case 1:return Ui(t.type)&&Wi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return co(),Ii(Bi),Ii(zi),ho(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return uo(t),null;case 13:if(Ii(fo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ta()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ii(fo),null;case 4:return co(),null;case 10:return za(t.type._context),null;case 22:case 23:return wl(),null;case 24:return null;default:return null}}var cc=!1,lc=!1,uc=typeof WeakSet==`function`?WeakSet:Set,$=null;function dc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Rl(e,t,n)}else n.current=null}function fc(e,t,n){try{n()}catch(n){Rl(e,t,n)}}var pc=!1;function mc(e,t){if(di=nn,e=Cr(),wr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(fi={focusedElem:e,selectionRange:n},nn=!1,$=t;$!==null;)if(t=$,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:ms(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Rl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return h=pc,pc=!1,h}function hc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&fc(t,n,a)}i=i.next}while(i!==r)}}function gc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function _c(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function vc(e){var t=e.alternate;t!==null&&(e.alternate=null,vc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ci],delete t[wi],delete t[Ei],delete t[Di],delete t[Oi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function yc(e){return e.tag===5||e.tag===3||e.tag===4}function bc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||yc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ui));else if(r!==4&&(e=e.child,e!==null))for(xc(e,t,n),e=e.sibling;e!==null;)xc(e,t,n),e=e.sibling}function Sc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Sc(e,t,n),e=e.sibling;e!==null;)Sc(e,t,n),e=e.sibling}var Cc=null,wc=!1;function Tc(e,t,n){for(n=n.child;n!==null;)Ec(e,t,n),n=n.sibling}function Ec(e,t,n){if(yt&&typeof yt.onCommitFiberUnmount==`function`)try{yt.onCommitFiberUnmount(vt,n)}catch{}switch(n.tag){case 5:lc||dc(n,t);case 6:var r=Cc,i=wc;Cc=null,Tc(e,t,n),Cc=r,wc=i,Cc!==null&&(wc?(e=Cc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Cc.removeChild(n.stateNode));break;case 18:Cc!==null&&(wc?(e=Cc,n=n.stateNode,e.nodeType===8?yi(e.parentNode,n):e.nodeType===1&&yi(e,n),tn(e)):yi(Cc,n.stateNode));break;case 4:r=Cc,i=wc,Cc=n.stateNode.containerInfo,wc=!0,Tc(e,t,n),Cc=r,wc=i;break;case 0:case 11:case 14:case 15:if(!lc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&fc(n,t,o),i=i.next}while(i!==r)}Tc(e,t,n);break;case 1:if(!lc&&(dc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Rl(n,t,e)}Tc(e,t,n);break;case 21:Tc(e,t,n);break;case 22:n.mode&1?(lc=(r=lc)||n.memoizedState!==null,Tc(e,t,n),lc=r):Tc(e,t,n);break;default:Tc(e,t,n)}}function Dc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new uc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Oc(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=dt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Ic(i/1960))-i,10e?16:e,ol===null)var i=!1;else{if(e=ol,ol=null,sl=0,Bc&6)throw Error(r(331));var a=Bc;for(Bc|=4,$=e.current;$!==null;){var o=$,s=o.child;if($.flags&16){var c=o.deletions;if(c!==null){for(var l=0;ldt()-$c?Tl(e,0):Xc|=n),hl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=K,K<<=1,!(K&130023424)&&(K=4194304)):t=1);var n=fl();e=Ka(e,t),e!==null&&(Ot(e,t,n),hl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Bi.current)js=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return js=!1,ec(e,t,n);js=!!(e.flags&131072)}else js=!1,ga&&t.flags&1048576&&da(t,ia,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;Qs(e,t),e=t.pendingProps;var a=Hi(t,zi.current);Va(t,n),a=Oo(null,t,i,e,a,n);var o=ko();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ui(i)?(o=!0,qi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Ja(t),a.updater=gs,t.stateNode=a,a._reactInternals=t,bs(t,i,e,n),t=Bs(null,t,i,!0,o,n)):(t.tag=0,ga&&o&&fa(t),Ms(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(Qs(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=ms(i,e),a){case 0:t=Rs(null,t,i,e,n);break a;case 1:t=zs(null,t,i,e,n);break a;case 11:t=Ns(null,t,i,e,n);break a;case 14:t=Ps(null,t,i,ms(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ms(i,a),Rs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ms(i,a),zs(e,t,i,a,n);case 3:a:{if(Vs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,Ya(e,t),eo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=xs(Error(r(423)),t),t=Hs(e,t,i,n,a);break a}else if(i!==a){a=xs(Error(r(424)),t),t=Hs(e,t,i,n,a);break a}else for(ha=bi(t.stateNode.containerInfo.firstChild),ma=t,ga=!0,_a=null,n=Na(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ta(),i===a){t=$s(e,t,n);break a}Ms(e,t,i,n)}t=t.child}return t;case 5:return lo(t),e===null&&xa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,pi(i,a)?s=null:o!==null&&pi(i,o)&&(t.flags|=32),Ls(e,t),Ms(e,t,s,n),t.child;case 6:return e===null&&xa(t),null;case 13:return Gs(e,t,n);case 4:return so(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ma(t,null,i,n):Ms(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ms(i,a),Ns(e,t,i,a,n);case 7:return Ms(e,t,t.pendingProps,n),t.child;case 8:return Ms(e,t,t.pendingProps.children,n),t.child;case 12:return Ms(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Li(Pa,i._currentValue),i._currentValue=s,o!==null)if(Q(o.value,s)){if(o.children===a.children&&!Bi.current){t=$s(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=Xa(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ba(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ba(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Ms(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Va(t,n),a=Ha(a),i=i(a),t.flags|=1,Ms(e,t,i,n),t.child;case 14:return i=t.type,a=ms(i,t.pendingProps),a=ms(i.type,a),Ps(e,t,i,a,n);case 15:return Fs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ms(i,a),Qs(e,t),t.tag=1,Ui(i)?(e=!0,qi(t)):e=!1,Va(t,n),vs(t,i,a),bs(t,i,a,n),Bs(null,t,i,!0,e,n);case 19:return Zs(e,t,n);case 22:return Is(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return st(e,t)}function Gl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return Zl(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Kl(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Kl(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=Kl(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Dt(0),this.expirationTimes=Dt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ja(a),e}function ru(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),g=c(u()),_=c(h(),1),v=class extends Error{status;constructor(e,t){super(t),this.status=e}},y=`telesrv_admin_csrf`,b=`X-CSRF-Token`,x=``;function S(e){x=(e??``).trim()}function C(){if(typeof document>`u`)return``;for(let e of document.cookie.split(`;`)){let t=e.trim(),n=t.indexOf(`=`);if(!(n<=0||t.slice(0,n)!==y))try{return decodeURIComponent(t.slice(n+1))}catch{return t.slice(n+1)}}return``}function w(){return C()||x}function T(e){let t=(e??`GET`).toUpperCase();return t!==`GET`&&t!==`HEAD`&&t!==`OPTIONS`}function E(e){if(!e)return{};if(e instanceof Headers){let t={};return e.forEach((e,n)=>{t[n]=e}),t}return Array.isArray(e)?Object.fromEntries(e):{...e}}async function D(e,t={}){let n=typeof FormData<`u`&&t.body instanceof FormData?{}:{"Content-Type":`application/json`};if(Object.assign(n,E(t.headers)),T(t.method)){let e=w();e&&(n[b]=e)}let r=await fetch(e,{credentials:`same-origin`,...t,headers:n}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok){let e=a?.error||a?.Error||a?.message||r.statusText;throw new v(r.status,e)}return a}function O(e){return e instanceof Error?e.message:String(e)}var k={session:()=>D(`/api/session`),login:async e=>{let t=await D(`/api/login`,{method:`POST`,body:JSON.stringify({secret:e})});return S(t.csrf_token),t},logout:()=>D(`/api/logout`,{method:`POST`,body:`{}`}),accounts:e=>D(`/api/accounts?${e.toString()}`),accountStats:()=>D(`/api/accounts/stats`),account:e=>D(`/api/accounts/${e}`),channels:e=>D(`/api/channels?${e.toString()}`),channel:e=>D(`/api/channels/${e}`),bots:e=>D(`/api/bots?${e.toString()}`),bot:e=>D(`/api/bots/${e}`),collectibleUsernames:e=>D(`/api/collectible-usernames?${e.toString()}`),collectibleUsername:e=>D(`/api/collectible-usernames/${encodeURIComponent(e)}`),accountRatings:e=>D(`/api/account-ratings?${e.toString()}`),accountRating:e=>D(`/api/account-ratings/${encodeURIComponent(e)}`),storageStats:()=>D(`/api/storage/stats`),storageAccounts:e=>D(`/api/storage/accounts?${e.toString()}`),verificationApplications:e=>D(`/api/verification/applications?${e.toString()}`),verificationApplication:e=>D(`/api/verification/applications/${encodeURIComponent(e)}`),verificationCounts:()=>D(`/api/verification/counts`),botVerifiers:e=>D(`/api/botverification/verifiers?${e.toString()}`),verificationIcons:e=>D(`/api/botverification/icons?${e.toString()}`),customVerifications:e=>D(`/api/botverification/marks?${e.toString()}`),customVerificationRequests:e=>D(`/api/botverification/requests?${e.toString()}`),customVerificationRequest:e=>D(`/api/botverification/requests/${encodeURIComponent(e)}`),botVerificationCounts:()=>D(`/api/botverification/counts`),emoji:e=>D(`/api/emoji?${e.toString()}`),emojiAnimation:e=>D(`/api/emoji/${encodeURIComponent(e)}/animation`),messages:e=>D(`/api/messages?${e.toString()}`),message:(e,t)=>D(`/api/messages/detail?${new URLSearchParams({owner_user_id:String(e),msg_id:String(t)}).toString()}`),groupMessages:e=>D(`/api/messages/groups?${e.toString()}`),groupMessage:(e,t)=>D(`/api/messages/groups/detail?${new URLSearchParams({channel_id:String(e),msg_id:String(t)}).toString()}`),moderationCases:e=>D(`/api/moderation/cases?${e.toString()}`),moderationCase:e=>D(`/api/moderation/cases/${e}`),moderationReport:e=>D(`/api/moderation/reports/${e}`),claimModerationCase:(e,t)=>D(`/api/moderation/cases/${e}/claim`,{method:`POST`,body:JSON.stringify({expected_version:t})}),decideModerationCase:(e,t)=>D(`/api/moderation/cases/${e}/decide`,{method:`POST`,body:JSON.stringify(t)}),reviewModerationAppeal:(e,t,n)=>D(`/api/moderation/cases/${e}/appeals/${t}/review`,{method:`POST`,body:JSON.stringify(n)}),gifts:()=>D(`/api/gifts`),stickerSets:e=>D(`/api/stickers?kind=${encodeURIComponent(e)}`),stickerSetDocuments:e=>D(`/api/stickers/${encodeURIComponent(e)}/documents`),stickerDocumentAnimationURL:e=>`/api/stickers/documents/${encodeURIComponent(e)}/animation`,createStickerSet:e=>D(`/api/actions/create-sticker-set`,{method:`POST`,body:e}),addStickerToSet:e=>D(`/api/actions/add-sticker-to-set`,{method:`POST`,body:e}),defaultGifts:()=>D(`/api/default-gifts`),defaultGiftAnimation:e=>D(`/api/default-gifts/${e}/animation`),officialGifts:()=>D(`/api/official-gifts`),officialGiftAnimation:e=>D(`/api/official-gifts/${encodeURIComponent(e)}/animation`),giftAnimation:e=>D(`/api/gifts/${encodeURIComponent(e)}/animation`),giftCollectibles:e=>D(`/api/gifts/${encodeURIComponent(e)}/collectibles`),giftCollectibleAnimation:(e,t,n)=>D(`/api/gifts/${encodeURIComponent(e)}/collectibles/${t}/${encodeURIComponent(n)}/animation`),importGift:e=>D(`/api/actions/import-gift`,{method:`POST`,body:e}),importDefaultGift:e=>D(`/api/actions/import-default-gift`,{method:`POST`,body:JSON.stringify(e)}),importOfficialGift:e=>D(`/api/actions/import-official-gift`,{method:`POST`,body:JSON.stringify(e)}),publishGiftCollectibles:(e,t)=>D(`/api/actions/publish-gift-collectibles?gift_id=${encodeURIComponent(e)}`,{method:`POST`,body:t}),action:(e,t)=>D(e,{method:`POST`,body:JSON.stringify(t)})},A=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),j=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),M={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},N=(0,g.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,g.createElement)(`svg`,{ref:c,...M,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:j(`lucide`,i),...s},[...o.map(([e,t])=>(0,g.createElement)(e,t)),...Array.isArray(a)?a:[a]])),P=(e,t)=>{let n=(0,g.forwardRef)(({className:n,...r},i)=>(0,g.createElement)(N,{ref:i,iconNode:t,className:j(`lucide-${A(e)}`,n),...r}));return n.displayName=`${e}`,n},F=P(`BadgeCheck`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),I=P(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),L=P(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ee=P(`CircleX`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),R=P(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),te=P(`ShieldX`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m14.5 9.5-5 5`,key:`17q4r4`}],[`path`,{d:`m9.5 9.5 5 5`,key:`18nt4w`}]]),ne=P(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),re=P(`ArrowLeftRight`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),ie=P(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),ae=P(`AtSign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),oe=P(`Ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.9 4.9 14.2 14.2`,key:`1m5liu`}]]),se=P(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),ce=P(`Building2`,[[`path`,{d:`M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z`,key:`1b4qmf`}],[`path`,{d:`M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2`,key:`i71pzd`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2`,key:`10jefs`}],[`path`,{d:`M10 6h4`,key:`1itunk`}],[`path`,{d:`M10 10h4`,key:`tcdvrf`}],[`path`,{d:`M10 14h4`,key:`kelpxr`}],[`path`,{d:`M10 18h4`,key:`1ulq68`}]]),le=P(`Cable`,[[`path`,{d:`M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1`,key:`10bnsj`}],[`path`,{d:`M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9`,key:`1eqmu1`}],[`path`,{d:`M21 21v-2h-4`,key:`14zm7j`}],[`path`,{d:`M3 5h4V3`,key:`z442eg`}],[`path`,{d:`M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3`,key:`ebdjd7`}]]),ue=P(`Calculator`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`line`,{x1:`8`,x2:`16`,y1:`6`,y2:`6`,key:`x4nwl0`}],[`line`,{x1:`16`,x2:`16`,y1:`14`,y2:`18`,key:`wjye3r`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]),z=P(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),de=P(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),fe=P(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),pe=P(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),me=P(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),he=P(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),ge=P(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),_e=P(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ve=P(`FileJson2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),ye=P(`FileJson`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),be=P(`Flame`,[[`path`,{d:`M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z`,key:`96xj49`}]]),xe=P(`Gem`,[[`path`,{d:`M6 3h12l4 6-10 13L2 9Z`,key:`1pcd5k`}],[`path`,{d:`M11 3 8 9l4 13 4-13-3-6`,key:`1fcu3u`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),B=P(`Gift`,[[`rect`,{x:`3`,y:`8`,width:`18`,height:`4`,rx:`1`,key:`bkv52`}],[`path`,{d:`M12 8v13`,key:`1c76mn`}],[`path`,{d:`M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7`,key:`6wjy6b`}],[`path`,{d:`M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5`,key:`1ihvrl`}]]),Se=P(`Handshake`,[[`path`,{d:`m11 17 2 2a1 1 0 1 0 3-3`,key:`efffak`}],[`path`,{d:`m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4`,key:`9pr0kb`}],[`path`,{d:`m21 3 1 11h-2`,key:`1tisrp`}],[`path`,{d:`M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3`,key:`1uvwmv`}],[`path`,{d:`M3 4h8`,key:`1ep09j`}]]),Ce=P(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),we=P(`ImageOff`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),Te=P(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Ee=P(`LayoutDashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),De=P(`LifeBuoy`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.93 4.93 4.24 4.24`,key:`1ymg45`}],[`path`,{d:`m14.83 9.17 4.24-4.24`,key:`1cb5xl`}],[`path`,{d:`m14.83 14.83 4.24 4.24`,key:`q42g0n`}],[`path`,{d:`m9.17 14.83-4.24 4.24`,key:`bqpfvv`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]),Oe=P(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),ke=P(`MessageSquareText`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M13 8H7`,key:`14i4kc`}],[`path`,{d:`M17 12H7`,key:`16if0g`}]]),Ae=P(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),je=P(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),Me=P(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),Ne=P(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Pe=P(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Fe=P(`PowerOff`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ie=P(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Le=P(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Re=P(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),ze=P(`Send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Be=P(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ve=P(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),He=P(`ShieldAlert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ue=P(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),V=P(`ShieldOff`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),We=P(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Ge=P(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),Ke=P(`Smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),qe=P(`Stamp`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M19.27 13.73A2.5 2.5 0 0 0 17.5 13h-11A2.5 2.5 0 0 0 4 15.5V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-1.5c0-.66-.26-1.3-.73-1.77Z`,key:`1sy9ra`}],[`path`,{d:`M14 13V8.5C14 7 15 7 15 5a3 3 0 0 0-3-3c-1.66 0-3 1-3 3s1 2 1 3.5V13`,key:`cnxgux`}]]),Je=P(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Ye=P(`Sticker`,[[`path`,{d:`M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3Z`,key:`1wis1t`}],[`path`,{d:`M14 3v4a2 2 0 0 0 2 2h4`,key:`36rjfy`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M10 16s.8 1 2 1c1.3 0 2-1 2-1`,key:`1vvgv3`}]]),Xe=P(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),H=P(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),Ze=P(`Trophy`,[[`path`,{d:`M6 9H4.5a2.5 2.5 0 0 1 0-5H6`,key:`17hqa7`}],[`path`,{d:`M18 9h1.5a2.5 2.5 0 0 0 0-5H18`,key:`lmptdp`}],[`path`,{d:`M4 22h16`,key:`57wxv0`}],[`path`,{d:`M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22`,key:`1nw9bq`}],[`path`,{d:`M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22`,key:`1np0yb`}],[`path`,{d:`M18 2H6v7a6 6 0 0 0 12 0V2Z`,key:`u46fv3`}]]),Qe=P(`Undo2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),$e=P(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),et=P(`User`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),tt=P(`Users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`1da9ce`}]]),nt=P(`Vault`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}],[`path`,{d:`m7.9 7.9 2.7 2.7`,key:`hpeyl3`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}],[`path`,{d:`m13.4 10.6 2.7-2.7`,key:`264c1n`}],[`circle`,{cx:`7.5`,cy:`16.5`,r:`.5`,fill:`currentColor`,key:`nkw3mc`}],[`path`,{d:`m7.9 16.1 2.7-2.7`,key:`p81g5e`}],[`circle`,{cx:`16.5`,cy:`16.5`,r:`.5`,fill:`currentColor`,key:`fubopw`}],[`path`,{d:`m13.4 13.4 2.7 2.7`,key:`abhel3`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),rt=P(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function it(e){let t=e.trim();return!t||t.startsWith(`+`)?t:/^\d+$/.test(t)?`+${t}`:t}function U(e){let t=e.trim();return t?t.startsWith(`@`)?t:`@${t}`:``}function at(e){return`${e.FirstName||``} ${e.LastName||``}`.trim()||`-`}function ot(e){return e.Broadcast&&!e.Megagroup?`Channel`:e.Megagroup&&e.Forum?`Supergroup / Forum`:e.Megagroup?`Supergroup`:`Channel / Group`}function W(e){if(!e||e.startsWith(`0001-`))return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString()}function st(e){if(!e||e<=0)return``;let t=new Date(e*1e3);return Number.isNaN(t.getTime())?``:t.toLocaleString()}function ct(e){let t=(e??``).trim();if(!/^https?:\/\//i.test(t))return``;try{let e=new URL(t);return e.protocol!==`http:`&&e.protocol!==`https:`?``:e.href}catch{return``}}function lt(e){if(!e.trim())return 0;let t=Number.parseInt(e,10);return Number.isFinite(t)?t:0}function ut(e){let t=(e??``).trim();if(!t)return 0;let n=Number(t);return Number.isFinite(n)?n:0}function dt(e){let t=(e??``).trim();if(!t)return`0`;let n=Number(t);return Number.isFinite(n)?n.toLocaleString():t}var ft={XTR:0,TON:9,USD:2,EUR:2,RUB:2};function pt(e){let t=(e??``).trim().toUpperCase();return t in ft?ft[t]:2}function mt(e,t){let n=(e??``).trim();if(!n)return`0`;if(!/^-?\d+$/.test(n))return n;let r=pt(t),i=n.startsWith(`-`),a=(i?n.slice(1):n).replace(/^0+(?=\d)/,``).padStart(r+1,`0`),o=a.slice(0,a.length-r)||`0`,s=r>0?a.slice(a.length-r):``;r>2&&(s=s.replace(/0+$/,``));let c=i?`-`:``;return s?`${c}${ht(o)}.${s}`:`${c}${ht(o)}`}function ht(e){return e.replace(/\B(?=(\d{3})+(?!\d))/g,` `)}function gt(e,t){let n=(t??``).trim().toUpperCase(),r=mt(e,n);return n?`${r} ${n}`:r}function _t(e,t){let n=(e??``).trim().replace(/\s+/g,``).replace(`,`,`.`);if(!n)return`0`;if(!/^\d*(\.\d*)?$/.test(n)||n===`.`)return null;let r=pt(t),[i,a=``]=n.split(`.`);if(a.length>r)return null;let o=`${i||`0`}${a.padEnd(r,`0`)}`.replace(/^0+(?=\d)/,``);return o===``?`0`:o}function vt(e){let t=(e??``).trim();if(!t||!/^\d+$/.test(t))return`0 B`;let n=Number(t);if(!Number.isFinite(n))return`${t} B`;let r=[`B`,`KB`,`MB`,`GB`,`TB`,`PB`],i=n,a=0;for(;i>=1024&&a0?`+${n.toLocaleString()}`:n.toLocaleString():t}function bt(e,t=`msg ids invalid`){let n=e.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean).map(e=>Number.parseInt(e,10));if(n.length===0||n.some(e=>!Number.isFinite(e)||e<=0))throw Error(t);return n}var xt=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),G=o(((e,t)=>{t.exports=xt()}))();function St({title:e,eyebrow:t,children:n,actions:r}){return(0,G.jsxs)(`div`,{className:`page-frame`,children:[(0,G.jsxs)(`div`,{className:`page-title-row`,children:[(0,G.jsxs)(`div`,{children:[t&&(0,G.jsx)(`div`,{className:`eyebrow`,children:t}),(0,G.jsx)(`h2`,{children:e})]}),r&&(0,G.jsx)(`div`,{className:`page-actions`,children:r})]}),n]})}function Ct({children:e}){return(0,G.jsx)(`div`,{className:`query-panel`,children:e})}function wt({main:e,side:t}){return(0,G.jsxs)(`div`,{className:`split-layout`,children:[(0,G.jsx)(`div`,{className:`split-main`,children:e}),(0,G.jsx)(`aside`,{className:`split-side`,children:t})]})}function K({title:e,text:t,action:n}){return(0,G.jsxs)(`div`,{className:`section-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:e}),t&&(0,G.jsx)(`p`,{children:t})]}),n&&(0,G.jsx)(`div`,{className:`section-action`,children:n})]})}function q({children:e}){return(0,G.jsxs)(`div`,{className:`alert`,children:[(0,G.jsx)(I,{size:16}),` `,(0,G.jsx)(`span`,{children:e})]})}function J({children:e,tone:t=`neutral`}){return(0,G.jsx)(`span`,{className:`badge ${t}`,children:e})}function Tt({label:e,value:t,tone:n}){return(0,G.jsxs)(`div`,{className:`status-item ${n}`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`strong`,{children:t})]})}function Y({label:e,value:t,tone:n=`neutral`,mono:r=!1}){return(0,G.jsxs)(`div`,{className:`metric ${n}`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`strong`,{className:r?`mono`:``,children:t})]})}function X({label:e,value:t,mono:n=!1}){return(0,G.jsxs)(`div`,{className:`summary-item`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`strong`,{className:n?`mono`:``,children:t})]})}function Et({rows:e}){return(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Command ID`}),(0,G.jsx)(`th`,{children:`Action`}),(0,G.jsx)(`th`,{children:`Actor`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Dry-run`}),(0,G.jsx)(`th`,{children:`Reason`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[e.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:e.ID}),(0,G.jsx)(`td`,{className:`mono`,children:e.CommandID}),(0,G.jsx)(`td`,{children:e.Action}),(0,G.jsx)(`td`,{children:e.Actor}),(0,G.jsx)(`td`,{children:e.Status}),(0,G.jsx)(`td`,{children:e.DryRun?`Yes`:`No`}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Reason}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)})]},e.ID)),e.length===0&&(0,G.jsx)(Dt,{colSpan:8})]})]})})}function Dt({colSpan:e}){return(0,G.jsx)(`tr`,{children:(0,G.jsx)(`td`,{colSpan:e,className:`empty-cell`,children:`No results`})})}function Ot({label:e}){return(0,G.jsx)(`section`,{className:`surface`,children:(0,G.jsx)(`div`,{className:`loading-line`,children:e})})}function kt({value:e}){return(0,G.jsx)(`pre`,{className:`json-block`,children:e||`{}`})}function At({username:e,collectibles:t}){let n=U(e??``),r=t??[];return r.length===0?(0,G.jsx)(G.Fragment,{children:n||`-`}):(0,G.jsxs)(G.Fragment,{children:[n,(0,G.jsx)(`ul`,{className:`username-branch`,children:r.map(e=>(0,G.jsxs)(`li`,{className:e.Active?``:`inactive`,children:[(0,G.jsx)(`span`,{children:U(e.Username)}),!e.Active&&(0,G.jsx)(`em`,{children:`inactive`})]},e.Username))})]})}var jt=`verification.review`,Mt=`botverification.review`,Nt=`botverification.manage`,Pt=(0,g.createContext)([]);function Ft({permissions:e,children:t}){return(0,G.jsx)(Pt.Provider,{value:e,children:t})}function It(){let e=(0,g.useContext)(Pt);return(0,g.useMemo)(()=>({permissions:e,can:t=>e.includes(`*`)||e.includes(t)}),[e])}function Lt(e){return It().can(e)}function Rt({permission:e,children:t}){let{can:n}=It();return n(e)?(0,G.jsx)(G.Fragment,{children:t}):(0,G.jsx)(zt,{permission:e})}function zt({permission:e}){return(0,G.jsxs)(St,{title:`Not enough rights`,eyebrow:`Console / Access`,children:[(0,G.jsx)(q,{children:`This session was not granted the ${e} permission, so the section stays closed.`}),(0,G.jsx)(`section`,{className:`section-block`,children:(0,G.jsx)(`div`,{className:`entity-head`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`entity-title`,children:[(0,G.jsx)(V,{size:16}),` `,`Section unavailable`]}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:`Ask an operator to add the permission to TELESRV_ADMIN_UI_PERMISSIONS and sign in again.`})]})})})]})}function Bt(){return{href:`${window.location.pathname}${window.location.search}`,path:window.location.pathname,search:new URLSearchParams(window.location.search)}}function Vt(e){return e.startsWith(`/bot-verification`)?`Third-party verification`:e.startsWith(`/verification`)?`Official Verification`:e.startsWith(`/collectible-usernames`)?`Collectible Usernames`:e.startsWith(`/account-ratings`)?`Account Rating`:e.startsWith(`/storage`)?`Storage`:e.startsWith(`/accounts`)?`Accounts`:e.startsWith(`/channels`)?`Supergroups and Channels`:e.startsWith(`/bots`)?`Bots`:e.startsWith(`/moderation`)?`Reports and Moderation`:e.startsWith(`/emoji`)?`Emoji`:e.startsWith(`/messages`)?`Message Audit`:e.startsWith(`/give-gifts`)?`Give Gifts`:e.startsWith(`/gifts`)?`Star Gifts`:e.startsWith(`/stickers`)?`Stickers`:e.startsWith(`/emoji`)?`Emoji`:`Operations Console`}function Ht(e){return e.startsWith(`/bot-verification`)?`Console / Third-party verification`:e.startsWith(`/verification`)?`Console / Verification`:e.startsWith(`/collectible-usernames`)?`Console / Collectible usernames`:e.startsWith(`/account-ratings`)?`Console / Account rating`:e.startsWith(`/storage`)?`Console / Storage`:e.startsWith(`/accounts`)?`Console / Accounts`:e.startsWith(`/channels`)?`Console / Channels`:e.startsWith(`/bots`)?`Console / Bots`:e.startsWith(`/moderation`)?`Console / Moderation`:e.startsWith(`/emoji`)?`Console / Emoji`:e.startsWith(`/messages`)?`Console / Messages`:e.startsWith(`/give-gifts`)?`Console / Give Gifts`:e.startsWith(`/gifts`)?`Console / Star Gifts`:e.startsWith(`/stickers`)?`Console / Stickers`:e.startsWith(`/emoji`)?`Console / Emoji`:`Console / Overview`}var Ut=`telesrv.admin.theme`,Wt=(0,g.createContext)(null);function Gt(e){document.documentElement.setAttribute(`data-theme`,e),document.documentElement.style.colorScheme=e}function Kt({children:e}){let[t,n]=(0,g.useState)(()=>Yt());(0,g.useEffect)(()=>{Gt(t);try{localStorage.setItem(Ut,t)}catch{}},[t]),(0,g.useEffect)(()=>{if(!window.matchMedia)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=e=>{let t=null;try{t=localStorage.getItem(Ut)}catch{t=null}t!==`light`&&t!==`dark`&&n(e.matches?`dark`:`light`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let r=(0,g.useCallback)(e=>n(e),[]),i=(0,g.useCallback)(()=>n(e=>e===`dark`?`light`:`dark`),[]),a=(0,g.useMemo)(()=>({theme:t,setTheme:r,toggleTheme:i}),[t,r,i]);return(0,G.jsx)(Wt.Provider,{value:a,children:e})}function qt(){let e=(0,g.useContext)(Wt);if(!e)throw Error(`useTheme must be used inside ThemeProvider`);return e}function Jt(){let{theme:e,toggleTheme:t}=qt(),n=e===`light`?`Switch to dark theme`:`Switch to light theme`;return(0,G.jsx)(`button`,{className:`theme-toggle`,type:`button`,onClick:t,"aria-label":n,title:n,children:e===`dark`?(0,G.jsx)(Xe,{size:16}):(0,G.jsx)(Ae,{size:16})})}function Yt(){try{let e=localStorage.getItem(Ut);if(e===`light`||e===`dark`)return e}catch{}try{if(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches)return`dark`}catch{}return`light`}function Xt({href:e,navigate:t,className:n,children:r}){return(0,G.jsx)(`a`,{className:n,href:e,onClick:n=>{n.preventDefault(),t(e)},children:r})}function Zt(){return(0,G.jsxs)(`div`,{className:`boot-screen`,children:[(0,G.jsxs)(`div`,{className:`brand compact brand-elevated`,children:[(0,G.jsx)(`span`,{className:`brand-mark`,children:(0,G.jsx)(`img`,{src:`/logo.png`,alt:`OwpenGram`})}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:`OwpenGram`}),(0,G.jsx)(`small`,{children:`Admin Console`})]})]}),(0,G.jsx)(`div`,{className:`loader-bar`})]})}function Qt({actor:e,route:t,navigate:n,onLogout:r,children:i}){let a=Lt(jt),o=Lt(Mt),s=t.path.startsWith(`/messages`),[c,l]=(0,g.useState)(s);(0,g.useEffect)(()=>{s&&l(!0)},[s]);async function u(){await k.logout().catch(()=>void 0),r()}return(0,G.jsxs)(`div`,{className:`shell`,children:[(0,G.jsxs)(`aside`,{className:`sidebar`,children:[(0,G.jsxs)(Xt,{className:`brand`,href:`/`,navigate:n,children:[(0,G.jsx)(`span`,{className:`brand-mark`,children:(0,G.jsx)(`img`,{src:`/logo.png`,alt:`OwpenGram`})}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:`OwpenGram`}),(0,G.jsx)(`small`,{children:`Admin Console`})]})]}),(0,G.jsx)(`div`,{className:`sidebar-label`,children:`Navigation`}),(0,G.jsxs)(`nav`,{className:`nav-list`,"aria-label":`Primary navigation`,children:[(0,G.jsx)($t,{icon:(0,G.jsx)(Ee,{size:16}),href:`/`,route:t,navigate:n,children:`Overview`}),(0,G.jsx)($t,{icon:(0,G.jsx)(tt,{size:16}),href:`/accounts`,route:t,navigate:n,children:`Accounts`}),(0,G.jsx)($t,{icon:(0,G.jsx)(Ue,{size:16}),href:`/channels`,route:t,navigate:n,children:`Supergroups / Channels`}),(0,G.jsx)($t,{icon:(0,G.jsx)(se,{size:16}),href:`/bots`,route:t,navigate:n,children:`Bots`}),(0,G.jsx)($t,{icon:(0,G.jsx)(He,{size:16}),href:`/moderation`,route:t,navigate:n,children:`Reports / Moderation`}),a&&(0,G.jsx)($t,{icon:(0,G.jsx)(F,{size:16}),href:`/verification`,route:t,navigate:n,children:`Verification`}),o&&(0,G.jsx)($t,{icon:(0,G.jsx)(qe,{size:16}),href:`/bot-verification`,route:t,navigate:n,children:`Third-party marks`}),(0,G.jsx)($t,{icon:(0,G.jsx)(ae,{size:16}),href:`/collectible-usernames`,route:t,navigate:n,children:`NFT Usernames`}),(0,G.jsx)($t,{icon:(0,G.jsx)(Ze,{size:16}),href:`/account-ratings`,route:t,navigate:n,children:`Account Rating`}),(0,G.jsx)($t,{icon:(0,G.jsx)(he,{size:16}),href:`/storage`,route:t,navigate:n,children:`Storage`}),(0,G.jsx)($t,{icon:(0,G.jsx)(B,{size:16}),href:`/gifts`,route:t,navigate:n,children:`Star Gifts`}),(0,G.jsx)($t,{icon:(0,G.jsx)(ze,{size:16}),href:`/give-gifts`,route:t,navigate:n,children:`Give Gifts`}),(0,G.jsx)($t,{icon:(0,G.jsx)(Ye,{size:16}),href:`/stickers`,route:t,navigate:n,children:`Stickers`}),(0,G.jsx)($t,{icon:(0,G.jsx)(Ke,{size:16}),href:`/emoji`,route:t,navigate:n,children:`Emoji`}),(0,G.jsxs)(`div`,{className:`nav-section ${s?`active`:``} ${c?`open`:``}`,children:[(0,G.jsxs)(`button`,{className:`nav-section-toggle`,type:`button`,"aria-expanded":c,onClick:()=>l(e=>!e),children:[(0,G.jsx)(ke,{size:16}),(0,G.jsx)(`span`,{children:`Messages`}),(0,G.jsx)(de,{className:`nav-section-chevron`,size:15})]}),c&&(0,G.jsxs)(`div`,{className:`nav-children`,children:[(0,G.jsx)($t,{href:`/messages/private`,route:t,navigate:n,activeWhen:e=>e===`/messages`||e===`/messages/detail`||e.startsWith(`/messages/private`),children:`Private`}),(0,G.jsx)($t,{href:`/messages/groups`,route:t,navigate:n,activeWhen:e=>e.startsWith(`/messages/groups`),children:`Groups`})]})]})]}),(0,G.jsxs)(`div`,{className:`sidebar-status`,children:[(0,G.jsx)(`div`,{className:`sidebar-label`,children:`Runtime`}),(0,G.jsxs)(`div`,{className:`runtime-row`,children:[(0,G.jsx)(Be,{size:14}),(0,G.jsx)(`span`,{children:`Admin backend`}),(0,G.jsx)(`strong`,{children:`Ready`})]}),(0,G.jsxs)(`div`,{className:`runtime-row`,children:[(0,G.jsx)(he,{size:14}),(0,G.jsx)(`span`,{children:`PG read`}),(0,G.jsx)(`strong`,{children:`Read-only`})]}),(0,G.jsxs)(`div`,{className:`runtime-row`,children:[(0,G.jsx)(We,{size:14}),(0,G.jsx)(`span`,{children:`Write operations`}),(0,G.jsx)(`strong`,{children:`Dry-run`})]})]})]}),(0,G.jsxs)(`div`,{className:`workspace`,children:[(0,G.jsxs)(`header`,{className:`topbar`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:Ht(t.path)}),(0,G.jsx)(`h1`,{children:Vt(t.path)})]}),(0,G.jsxs)(`div`,{className:`topbar-actions`,children:[(0,G.jsx)(Jt,{}),(0,G.jsx)(`span`,{className:`actor-pill`,children:`Actor: ${e}`}),(0,G.jsxs)(`button`,{className:`btn ghost icon-text`,type:`button`,onClick:u,title:`Log out`,children:[(0,G.jsx)(Oe,{size:16}),` `,`Log out`]})]})]}),(0,G.jsx)(`main`,{className:`content`,children:i})]})]})}function $t({href:e,route:t,navigate:n,icon:r,children:i,activeWhen:a}){return(0,G.jsxs)(Xt,{className:`nav-item ${(a?a(t.path):e===`/`?t.path===`/`:t.path.startsWith(e))?`active`:``}`,href:e,navigate:n,children:[r??(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`nav-dot`}),(0,G.jsx)(`span`,{children:i})]})}function en({onLogin:e}){let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(!1);async function s(n){n.preventDefault(),o(!0),i(``);try{let n=await k.login(t);e({actor:n.actor,permissions:n.permissions??[]})}catch(e){i(O(e))}finally{o(!1)}}return(0,G.jsxs)(`main`,{className:`login-page`,children:[(0,G.jsxs)(`div`,{className:`bg-orbs`,"aria-hidden":`true`,children:[(0,G.jsx)(`div`,{className:`bg-orb bg-orb--1`}),(0,G.jsx)(`div`,{className:`bg-orb bg-orb--2`}),(0,G.jsx)(`div`,{className:`bg-orb bg-orb--3`})]}),(0,G.jsxs)(`section`,{className:`login-panel`,children:[(0,G.jsxs)(`div`,{className:`login-head`,children:[(0,G.jsxs)(`div`,{className:`brand brand-elevated`,children:[(0,G.jsx)(`span`,{className:`brand-mark`,children:(0,G.jsx)(`img`,{src:`/logo.png`,alt:`OwpenGram`})}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:`OwpenGram`}),(0,G.jsx)(`small`,{children:`Admin Console`})]})]}),(0,G.jsxs)(`div`,{className:`login-head-actions`,children:[(0,G.jsx)(Jt,{}),(0,G.jsx)(`span`,{className:`login-chip`,children:`Local access`})]})]}),(0,G.jsxs)(`div`,{className:`login-copy`,children:[(0,G.jsx)(`h1`,{children:`Operations Admin`}),(0,G.jsx)(`p`,{children:`Enter credentials to open the console.`})]}),r&&(0,G.jsx)(q,{children:r}),(0,G.jsxs)(`form`,{className:`form-stack`,onSubmit:s,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Admin password or token`}),(0,G.jsx)(`input`,{autoFocus:!0,type:`password`,value:t,autoComplete:`current-password`,onChange:e=>n(e.target.value)})]}),(0,G.jsx)(`button`,{className:`btn primary full`,type:`submit`,disabled:a,children:a?`Logging in`:`Log in`})]})]})]})}var tn=m();function Z({label:e,path:t,payload:n,icon:r,compact:i=!1,tone:a=`danger`,disabled:o=!1,onDone:s,onError:c}){let[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(null),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1);function b(){f(``),m(null),_(``)}async function x(e){if(!d.trim()){_(`Please enter an operation reason`);return}y(!0),_(``);try{let r={...n(),reason:d,confirm:e};m(await k.action(t,r)),e&&s?.()}catch(e){_(c?.(e)||O(e))}finally{y(!1)}}let S=p?.dry_run&&!p.error,C=`btn ${a===`danger`?`danger`:a===`warn`?`warn`:``} ${i?`compact-btn`:``}`,w=(0,g.useMemo)(()=>{try{return n()}catch(e){return{payload_error:O(e)}}},[l,n]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:C,type:`button`,disabled:o,onClick:()=>{b(),u(!0)},children:[r,e]}),l&&(0,tn.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":e,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`Action Flow`}),(0,G.jsx)(`h2`,{children:e})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:()=>u(!1),"aria-label":`Close`,children:(0,G.jsx)(rt,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body`,children:[(0,G.jsxs)(`div`,{className:`command-steps`,children:[(0,G.jsxs)(`div`,{className:`command-step ${d.trim()?`done`:`active`}`,children:[(0,G.jsx)(`span`,{children:`1`}),(0,G.jsx)(`strong`,{children:`Enter reason`})]}),(0,G.jsxs)(`div`,{className:`command-step ${p?.dry_run?`done`:d.trim()?`active`:``}`,children:[(0,G.jsx)(`span`,{children:`2`}),(0,G.jsx)(`strong`,{children:`Dry-run check`})]}),(0,G.jsxs)(`div`,{className:`command-step ${p&&!p.dry_run&&!p.error?`done`:S?`active`:``}`,children:[(0,G.jsx)(`span`,{children:`3`}),(0,G.jsx)(`strong`,{children:`Confirm execution`})]})]}),(0,G.jsxs)(`label`,{className:`form-field`,children:[(0,G.jsx)(`span`,{children:`Operation reason`}),(0,G.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:3,placeholder:`Describe why this operation is being performed`})]}),(0,G.jsxs)(`div`,{className:`command-preview`,children:[(0,G.jsxs)(`div`,{className:`preview-head`,children:[(0,G.jsx)(ye,{size:14}),` `,`Request preview`]}),(0,G.jsx)(kt,{value:JSON.stringify(w,null,2)})]}),h&&(0,G.jsx)(q,{children:h}),p&&(0,G.jsxs)(`div`,{className:`result-box`,children:[(0,G.jsxs)(`div`,{className:`result-title`,children:[p.error?(0,G.jsx)(I,{size:16}):(0,G.jsx)(L,{size:16}),(0,G.jsx)(`strong`,{children:p.message||p.error||`Action result`})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Command ID`}),(0,G.jsx)(`strong`,{children:p.command_id})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsx)(`strong`,{children:p.status})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Dry-run`}),(0,G.jsx)(`strong`,{children:p.dry_run?`Yes`:`No`})]}),(0,G.jsx)(`div`,{className:`result-message`,children:p.message||p.error}),p.details&&(0,G.jsx)(kt,{value:JSON.stringify(p.details,null,2)})]})]}),(0,G.jsxs)(`div`,{className:`modal-actions`,children:[(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>u(!1),children:`Close`}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>x(!1),disabled:v,children:[v?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Ne,{size:15}),p?`Run dry-run again`:`Run dry-run first`]}),(0,G.jsxs)(`button`,{className:`btn danger icon-text`,type:`button`,onClick:()=>x(!0),disabled:v||!S,children:[(0,G.jsx)(L,{size:15}),`Confirm execution`]})]})]})}),document.body)]})}function nn({rows:e,userID:t,onDone:n}){let[r,i]=(0,g.useState)(()=>new Set);(0,g.useEffect)(()=>{i(new Set)},[t]);let a=(0,g.useMemo)(()=>e.filter(e=>!r.has(e.Hash)),[e,r]);function o(e){i(t=>e(t)),n()}return(0,G.jsxs)(`div`,{className:`authorization-block`,children:[(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table authorization-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Device`}),(0,G.jsx)(`th`,{children:`Platform`}),(0,G.jsx)(`th`,{children:`IP`}),(0,G.jsx)(`th`,{children:`Last active`}),(0,G.jsx)(`th`,{className:`device-actions-head`,children:`Actions`})]})}),(0,G.jsxs)(`tbody`,{children:[a.map(n=>(0,G.jsxs)(`tr`,{children:[(0,G.jsxs)(`td`,{className:`device-text`,children:[n.DeviceModel,` `,n.SystemVersion]}),(0,G.jsxs)(`td`,{className:`device-text`,children:[n.Platform,` `,n.AppVersion]}),(0,G.jsx)(`td`,{children:n.IP}),(0,G.jsx)(`td`,{children:W(n.ActiveAt)}),(0,G.jsx)(`td`,{className:`device-actions-cell`,children:(0,G.jsxs)(`div`,{className:`device-actions`,children:[(0,G.jsx)(Z,{label:`Revoke current`,icon:(0,G.jsx)(Oe,{size:13}),compact:!0,path:`/api/actions/revoke-sessions`,payload:()=>({user_id:t,hash:n.Hash}),onDone:()=>o(e=>new Set([...e,n.Hash]))}),(0,G.jsx)(Z,{label:`Keep current`,icon:(0,G.jsx)(Ue,{size:13}),compact:!0,path:`/api/actions/revoke-sessions`,payload:()=>({user_id:t,keep_hash:n.Hash}),onDone:()=>o(()=>new Set(e.filter(e=>e.Hash!==n.Hash).map(e=>e.Hash)))})]})})]},n.Hash)),a.length===0&&(0,G.jsx)(Dt,{colSpan:5})]})]})}),(0,G.jsx)(`div`,{className:`danger-zone`,children:(0,G.jsx)(Z,{label:`Revoke all devices`,icon:(0,G.jsx)(le,{size:15}),path:`/api/actions/revoke-sessions`,payload:()=>({user_id:t,revoke_all:!0}),onDone:()=>o(()=>new Set(e.map(e=>e.Hash)))})})]})}function rn({scam:e,fake:t}){return!e&&!t?null:(0,G.jsxs)(G.Fragment,{children:[e&&(0,G.jsx)(J,{tone:`danger`,children:`SCAM`}),t&&(0,G.jsx)(J,{tone:`danger`,children:`FAKE`})]})}function an({idKey:e,id:t,path:n,scam:r,fake:i,onDone:a}){return(0,G.jsxs)(`div`,{className:`action-stack`,children:[(0,G.jsx)(Z,{label:r?`Clear SCAM`:`Mark as SCAM`,icon:(0,G.jsx)(He,{size:15}),tone:`danger`,path:n,payload:()=>({[e]:t,scam:!r,fake:r?i:!1}),onDone:a}),(0,G.jsx)(Z,{label:i?`Clear FAKE`:`Mark as FAKE`,icon:(0,G.jsx)(te,{size:15}),tone:`danger`,path:n,payload:()=>({[e]:t,fake:!i,scam:i?r:!1}),onDone:a})]})}function on({id:e,support:t,onDone:n}){return(0,G.jsx)(Z,{label:t?`Clear support`:`Mark as support`,icon:(0,G.jsx)(De,{size:15}),tone:`neutral`,path:`/api/actions/set-support`,payload:()=>({user_id:e,support:!t}),onDone:n})}function sn({idKey:e,id:t,path:n,current:r,onDone:i}){let[a,o]=(0,g.useState)(r.replace(/^@/,``));return(0,G.jsxs)(`div`,{className:`attr-block`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Username`}),(0,G.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`username`})]}),(0,G.jsx)(Z,{label:`Set username`,icon:(0,G.jsx)(ae,{size:15}),tone:`neutral`,path:n,payload:()=>({[e]:t,username:a.trim().replace(/^@/,``)}),onDone:i})]})}function cn({idKey:e,id:t,path:n,onDone:r}){let[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!0),[c,l]=(0,g.useState)(`0`),[u,d]=(0,g.useState)(``);return(0,G.jsxs)(`div`,{className:`attr-block`,children:[(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked)}),` `,`Profile color`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),` `,`Enable color`]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Color index`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,max:`20`,value:c,onChange:e=>l(e.target.value)})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Background emoji ID`}),(0,G.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`0`})]}),(0,G.jsx)(Z,{label:`Set color`,icon:(0,G.jsx)(je,{size:15}),tone:`neutral`,path:n,payload:()=>({[e]:t,for_profile:i,has_color:o,color:lt(c),background_emoji_id:u.trim()||`0`}),onDone:r})]})}function ln({idKey:e,id:t,path:n,onDone:r}){let[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(`0`);return(0,G.jsxs)(`div`,{className:`attr-block`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Emoji document ID`}),(0,G.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`0 = clear`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Until (unix, 0 = permanent)`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,value:o,onChange:e=>s(e.target.value)})]}),(0,G.jsx)(Z,{label:`Set emoji status`,icon:(0,G.jsx)(Ke,{size:15}),tone:`neutral`,path:n,payload:()=>({[e]:t,document_id:i.trim()||`0`,until:lt(o)}),onDone:r})]})}function un({channel:e,onDone:t}){let[n,r]=(0,g.useState)(e.Gigagroup),[i,a]=(0,g.useState)(e.AntiSpam),[o,s]=(0,g.useState)(e.ParticipantsHidden),[c,l]=(0,g.useState)(e.NoForwards),[u,d]=(0,g.useState)(e.JoinToSend),[f,p]=(0,g.useState)(e.JoinRequest),[m,h]=(0,g.useState)(String(e.SlowmodeSeconds));(0,g.useEffect)(()=>{r(e.Gigagroup),a(e.AntiSpam),s(e.ParticipantsHidden),l(e.NoForwards),d(e.JoinToSend),p(e.JoinRequest),h(String(e.SlowmodeSeconds))},[e]);function _(){let t={channel_id:e.ID};return n!==e.Gigagroup&&(t.gigagroup=n),i!==e.AntiSpam&&(t.antispam=i),o!==e.ParticipantsHidden&&(t.participants_hidden=o),c!==e.NoForwards&&(t.noforwards=c),u!==e.JoinToSend&&(t.join_to_send=u),f!==e.JoinRequest&&(t.join_request=f),lt(m)!==e.SlowmodeSeconds&&(t.slowmode_seconds=lt(m)),t}return(0,G.jsxs)(`div`,{className:`attr-block`,children:[(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked)}),` `,`Gigagroup`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked)}),` `,`Aggressive anti-spam`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),` `,`Hide members`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked)}),` `,`Restrict forwarding`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked)}),` `,`Join to send messages`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>p(e.target.checked)}),` `,`Join by request`]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Slowmode (seconds)`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,max:`86400`,value:m,onChange:e=>h(e.target.value)})]}),(0,G.jsx)(Z,{label:`Apply settings`,icon:(0,G.jsx)(Ve,{size:15}),tone:`warn`,path:`/api/actions/set-channel-settings`,payload:_,onDone:t})]})}function dn({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(`1`),[u,d]=(0,g.useState)(`1000`),[f,p]=(0,g.useState)(()=>fn(new Date(Date.now()+7*864e5))),[m,h]=(0,g.useState)(``);async function _(){s(!0),a(``);try{let t=await k.account(e);r(t),t.Restriction.Frozen&&(t.Restriction.Until&&p(fn(new Date(t.Restriction.Until))),h(t.Restriction.AppealURL||``))}catch(e){a(O(e))}finally{s(!1)}}if((0,g.useEffect)(()=>{_()},[e]),i)return(0,G.jsx)(q,{children:i});if(!n)return(0,G.jsx)(Ot,{label:o?`Loading account detail`:`Waiting for data`});let v=n.Account;return(0,G.jsx)(St,{title:`Account #${v.ID}`,eyebrow:`Account Profile`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>t(`/accounts`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),children:(0,G.jsx)(wt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:at(v)}),(0,G.jsxs)(`div`,{className:`entity-subtitle`,children:[U(v.Username)||`No username`,` · `,it(v.Phone)||`No phone`]}),v.Collectibles?.length>0&&(0,G.jsx)(`div`,{className:`entity-subtitle`,children:(0,G.jsx)(At,{username:``,collectibles:v.Collectibles})})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[v.PremiumUntil>0?(0,G.jsx)(J,{tone:`good`,children:`Premium`}):(0,G.jsx)(J,{children:`Not premium`}),n.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Not verified`}),(0,G.jsx)(rn,{scam:n.Scam,fake:n.Fake}),v.Frozen?(0,G.jsx)(J,{tone:`danger`,children:`Account frozen`}):(0,G.jsx)(J,{children:`Account active`})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`User ID`,value:String(v.ID),mono:!0}),(0,G.jsx)(X,{label:`Last active`,value:st(n.LastSeenAt)||`-`}),(0,G.jsx)(X,{label:`Premium expires`,value:v.PremiumUntil>0?st(v.PremiumUntil):`None`}),(0,G.jsx)(X,{label:`Stars balance`,value:`${n.StarsBalance} / ${n.StarsGranted?`initial grant applied`:`initial grant pending`}`}),(0,G.jsx)(X,{label:`Updated`,value:W(v.UpdatedAt)||`-`}),(0,G.jsx)(X,{label:`Authorized devices`,value:String(n.Authorizations.length)}),(0,G.jsx)(X,{label:`Account flags`,value:`support=${n.Support} bot=${n.Bot}`}),(0,G.jsx)(X,{label:`Restriction`,value:n.HasRestriction?n.Restriction.Reason||`Restricted`:`None`}),(0,G.jsx)(X,{label:`Frozen since`,value:n.Restriction.Since?W(n.Restriction.Since):`None`}),(0,G.jsx)(X,{label:`Appeal deadline`,value:n.Restriction.Until?W(n.Restriction.Until):`None`}),(0,G.jsx)(X,{label:`Appeal URL`,value:n.Restriction.AppealURL||`None`}),(0,G.jsx)(X,{label:`Created`,value:W(v.CreatedAt)||`-`})]}),n.About&&(0,G.jsx)(`p`,{className:`about-text`,children:n.About}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Authorized Devices`,text:`${n.Authorizations.length} authorizations`}),(0,G.jsx)(nn,{rows:n.Authorizations,userID:v.ID,onDone:_})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Recent Admin Actions`,text:`Last 30 audit rows`}),(0,G.jsx)(Et,{rows:n.AuditLogs})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Account Actions`}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Appeal deadline`}),(0,G.jsx)(`input`,{"aria-label":`Freeze appeal deadline`,value:f,onChange:e=>p(e.target.value),type:`datetime-local`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Appeal URL`}),(0,G.jsx)(`input`,{"aria-label":`Freeze appeal URL`,value:m,onChange:e=>h(e.target.value),type:`url`,placeholder:`https://...`})]}),(0,G.jsx)(Z,{label:v.Frozen?`Update freeze`:`Freeze account`,icon:(0,G.jsx)(I,{size:15}),path:`/api/actions/set-frozen`,payload:()=>({user_id:v.ID,frozen:!0,freeze_until:new Date(f).toISOString(),freeze_appeal_url:m.trim()}),onDone:_}),v.Frozen&&(0,G.jsx)(Z,{label:`Unfreeze account`,icon:(0,G.jsx)(I,{size:15}),path:`/api/actions/set-frozen`,payload:()=>({user_id:v.ID,frozen:!1}),onDone:_}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Premium duration (months)`}),(0,G.jsx)(`input`,{"aria-label":`Set premium duration in months`,value:c,onChange:e=>l(e.target.value),type:`number`,min:`1`,max:`120`})]}),(0,G.jsxs)(`div`,{className:`action-stack`,children:[(0,G.jsx)(Z,{label:`Set premium`,icon:(0,G.jsx)(ne,{size:15}),tone:`warn`,path:`/api/actions/grant-premium`,payload:()=>({user_id:v.ID,months:lt(c)}),onDone:_}),(0,G.jsx)(Z,{label:`Clear premium`,icon:(0,G.jsx)(ne,{size:15}),tone:`warn`,path:`/api/actions/grant-premium`,payload:()=>({user_id:v.ID,months:0}),onDone:_}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Stars to grant`}),(0,G.jsx)(`input`,{"aria-label":`Set Stars amount to grant`,value:u,onChange:e=>d(e.target.value),type:`number`,min:`1`,max:`1000000000`})]}),(0,G.jsx)(Z,{label:`Grant Stars`,icon:(0,G.jsx)(Je,{size:15}),tone:`warn`,path:`/api/actions/grant-stars`,payload:()=>({user_id:v.ID,amount:lt(u)}),onDone:_}),(0,G.jsx)(Z,{label:n.Verified?`Clear verified`:`Set verified`,icon:(0,G.jsx)(F,{size:15}),tone:`warn`,path:`/api/actions/set-verified`,payload:()=>({user_id:v.ID,verified:!n.Verified}),onDone:_})]}),(0,G.jsx)(an,{idKey:`user_id`,id:v.ID,path:`/api/actions/set-account-flags`,scam:n.Scam,fake:n.Fake,onDone:_}),(0,G.jsx)(`div`,{className:`dock-title`,children:`Attributes`}),(0,G.jsx)(on,{id:v.ID,support:n.Support,onDone:_}),(0,G.jsx)(sn,{idKey:`user_id`,id:v.ID,path:`/api/actions/set-account-username`,current:v.Username,onDone:_}),(0,G.jsx)(cn,{idKey:`user_id`,id:v.ID,path:`/api/actions/set-account-color`,onDone:_}),(0,G.jsx)(ln,{idKey:`user_id`,id:v.ID,path:`/api/actions/set-account-emoji-status`,onDone:_})]})})})}function fn(e){return new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function pn({navigate:e}){let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(`50`),[s,c]=(0,g.useState)([]),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(``);async function v(e=!1){let n=r.trim();m(!0),_(``);let i=new URLSearchParams({limit:a});t.trim()&&i.set(`min_level`,t.trim()),n&&i.set(`q`,n),e&&d&&i.set(`before_id`,d);try{let t=await k.accountRatings(i),n=t.rows??[];c(t=>e?[...t,...n]:n),f(t.next_before_id??``),u(!!t.has_more)}catch(e){_(O(e))}finally{m(!1)}}(0,g.useEffect)(()=>{v(!1)},[]);let y=s.reduce((e,t)=>Math.max(e,t.Level),0),b=s.filter(e=>ut(e.PendingStars)!==0).length,x=s.length>0?(s.reduce((e,t)=>e+t.Level,0)/s.length).toFixed(1):`0`;return(0,G.jsxs)(St,{title:`Account rating leaderboard`,eyebrow:`Rating / Leaderboard`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>v(!1),disabled:p,children:[(0,G.jsx)(Le,{size:15,className:p?`spin`:``}),` `,`Refresh`]}),children:[h&&(0,G.jsx)(q,{children:h}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Loaded rows`,value:String(s.length)}),(0,G.jsx)(Y,{label:`Top level`,value:String(y),tone:`good`}),(0,G.jsx)(Y,{label:`Average level`,value:x}),(0,G.jsx)(Y,{label:`With pending points`,value:String(b),tone:b?`warn`:`neutral`})]}),(0,G.jsx)(Ct,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),v(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Search by username, name or user ID`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Min level`}),(0,G.jsx)(`input`,{className:`small-input`,value:t,onChange:e=>n(e.target.value),type:`number`,min:`0`,placeholder:`0`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:a,onChange:e=>o(e.target.value),type:`number`,min:`1`,max:`200`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:p,children:[p?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Re,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`User ID`}),(0,G.jsx)(`th`,{children:`Username`}),(0,G.jsx)(`th`,{children:`Level`}),(0,G.jsx)(`th`,{children:`Points`}),(0,G.jsx)(`th`,{children:`Progress to next level`}),(0,G.jsx)(`th`,{children:`Pending`}),(0,G.jsx)(`th`,{children:`Computed`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[s.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:t.UserID}),(0,G.jsx)(`td`,{children:U(t.Username)||t.FirstName||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsx)(mn,{level:t.Level})}),(0,G.jsx)(`td`,{className:`mono`,children:dt(t.Stars)}),(0,G.jsx)(`td`,{children:(0,G.jsx)(gn,{row:t})}),(0,G.jsx)(`td`,{className:`mono`,children:ut(t.PendingStars)===0?`-`:dt(t.PendingStars)}),(0,G.jsx)(`td`,{children:W(t.ComputedAt)||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/account-ratings/${t.UserID}`),children:[(0,G.jsx)(Ze,{size:14}),` `,`Details`,` `,(0,G.jsx)(pe,{size:14})]})})]},t.UserID)),s.length===0&&(0,G.jsx)(Dt,{colSpan:8})]})]})}),l&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>v(!0),disabled:p,children:[p?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function mn({level:e}){return(0,G.jsx)(J,{tone:e>=10?`good`:e>=5?`warn`:`neutral`,children:`Level ${e}`})}function hn(e){let t=ut(e.Stars),n=ut(e.CurrentLevelStars),r=ut(e.NextLevelStars),i=r-n;return{percent:i>0?Math.min(100,Math.max(0,(t-n)/i*100)):0,remaining:Math.max(0,r-t),target:r,stars:t}}function gn({row:e}){if(!e.HasNextLevel)return(0,G.jsx)(`span`,{className:`progress-note`,children:`Max level reached`});let{percent:t,remaining:n,target:r}=hn(e);return(0,G.jsxs)(`div`,{className:`progress-cell`,children:[(0,G.jsx)(`div`,{className:`progress-bar`,role:`img`,"aria-label":`${Math.round(t)}%`,children:(0,G.jsx)(`span`,{style:{width:`${t}%`}})}),(0,G.jsx)(`small`,{children:`${dt(String(n))} left to reach ${dt(String(r))}`})]})}function _n({userID:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(``);async function u(){s(!0),a(``);try{r(await k.accountRating(e))}catch(e){a(O(e))}finally{s(!1)}}if((0,g.useEffect)(()=>{u()},[e]),i&&!n)return(0,G.jsx)(q,{children:i});if(!n)return(0,G.jsx)(Ot,{label:o?`Loading account rating…`:`Waiting for data`});let d=n.rating,f=n.events??[],p=ut(d.PendingStars),m=hn(d),h=d.UserID||e;return(0,G.jsxs)(St,{title:`Rating of ${U(d.Username)||d.FirstName||d.UserID}`,eyebrow:`Rating / Component breakdown`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/account-ratings`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:u,disabled:o,children:[(0,G.jsx)(Le,{size:15,className:o?`spin`:``}),` `,`Refresh`]})]}),children:[i&&(0,G.jsx)(q,{children:i}),(0,G.jsx)(wt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:U(d.Username)||d.FirstName||`Unnamed bot`}),(0,G.jsxs)(`div`,{className:`entity-subtitle`,children:[`User ID`,`: `,d.UserID]})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(mn,{level:d.Level}),p!==0&&(0,G.jsx)(J,{tone:`warn`,children:`Pending ${yt(d.PendingStars)}`})]})]}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Points`,value:dt(d.Stars),mono:!0}),(0,G.jsx)(Y,{label:`Level`,value:String(d.Level),tone:`good`}),(0,G.jsx)(Y,{label:`Next level threshold`,value:d.HasNextLevel?dt(d.NextLevelStars):`Max level reached`,mono:d.HasNextLevel}),(0,G.jsx)(Y,{label:`Points to next level`,value:d.HasNextLevel?dt(String(m.remaining)):`-`,mono:!0,tone:d.HasNextLevel&&m.percent>=80?`good`:`neutral`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`How the rating adds up`,text:`Contribution of every source: stars, activity, moderation penalties and manual corrections.`}),(0,G.jsx)(vn,{rating:d}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Current level threshold`,value:dt(d.CurrentLevelStars),mono:!0}),(0,G.jsx)(X,{label:`Next level threshold`,value:d.HasNextLevel?dt(d.NextLevelStars):`Max level reached`,mono:d.HasNextLevel}),(0,G.jsx)(X,{label:`Computed`,value:W(d.ComputedAt)||`-`}),(0,G.jsx)(X,{label:`Updated`,value:W(d.UpdatedAt)||`-`})]}),(0,G.jsx)(`div`,{className:`progress-wide`,children:(0,G.jsx)(gn,{row:d})})]}),p!==0&&(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Pending points`,text:`Already earned, but counted towards the rating only on the date below.`}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Pending`,value:yt(d.PendingStars),mono:!0}),(0,G.jsx)(X,{label:`Applied on`,value:W(d.PendingDate)||`-`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Rating events`,text:`Every rating change with its source, actor and reason.`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Source`}),(0,G.jsx)(`th`,{children:`Change`}),(0,G.jsx)(`th`,{children:`Reason`}),(0,G.jsx)(`th`,{children:`Actor`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[f.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:e.ID}),(0,G.jsx)(`td`,{children:(0,G.jsx)(bn,{kind:e.Kind})}),(0,G.jsx)(`td`,{className:`mono`,children:yt(e.Amount)}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Reason||`-`}),(0,G.jsx)(`td`,{children:e.Actor||`-`}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)||`-`})]},e.ID)),f.length===0&&(0,G.jsx)(Dt,{colSpan:6})]})]})})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Rating operations`}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/accounts/${d.UserID}`),children:[(0,G.jsx)(et,{size:15}),` `,`Open account`]}),(0,G.jsx)(`div`,{className:`action-stack`,children:(0,G.jsx)(Z,{label:`Recompute`,icon:(0,G.jsx)(ue,{size:15}),tone:`neutral`,path:`/api/actions/recompute-account-rating`,payload:()=>({user_id:h}),onDone:u})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Rebuilds the rating from stars, activity, penalties and manual corrections.`}),(0,G.jsx)(`div`,{className:`dock-title`,children:`Manual correction`}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Value (negative allowed)`}),(0,G.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),type:`number`,step:`1`,placeholder:`-500`})]}),(0,G.jsx)(`div`,{className:`action-stack`,children:(0,G.jsx)(Z,{label:`Apply correction`,icon:(0,G.jsx)(Ge,{size:15}),tone:`warn`,path:`/api/actions/adjust-account-rating`,payload:()=>({user_id:h,amount:String(Number.parseInt(c.trim()||`0`,10)||0)}),onDone:()=>{l(``),u()}})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The value is added to the manual component; a negative number lowers the rating.`})]})})]})}function vn({rating:e}){let t=[{key:`stars`,label:`Stars`,hint:`Purchased and received stars`,value:ut(e.StarsComponent)},{key:`activity`,label:`Activity`,hint:`Messages, sessions and long-term engagement`,value:ut(e.ActivityComponent)},{key:`penalty`,label:`Penalties`,hint:`Moderation decisions and restrictions`,value:-ut(e.PenaltyComponent)},{key:`manual`,label:`Manual corrections`,hint:`Adjustments made by admins`,value:ut(e.ManualComponent)}],n=Math.max(1,...t.map(e=>Math.abs(e.value))),r=Math.max(0,t.reduce((e,t)=>e+t.value,0)),i=ut(e.Stars),a=ut(e.PendingStars);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`breakdown-list`,children:[t.map(e=>{let t=Math.min(100,Math.abs(e.value)/n*100),r=e.value<0?`danger`:e.value>0?`good`:``;return(0,G.jsxs)(`div`,{className:`breakdown-row`,children:[(0,G.jsxs)(`div`,{className:`breakdown-label`,children:[(0,G.jsx)(`strong`,{children:e.label}),(0,G.jsx)(`small`,{children:e.hint})]}),(0,G.jsx)(`div`,{className:`progress-bar ${r}`,role:`img`,"aria-label":String(e.value),children:(0,G.jsx)(`span`,{style:{width:`${t}%`}})}),(0,G.jsx)(`div`,{className:`breakdown-value mono ${r}`,children:yt(String(e.value))})]},e.key)}),(0,G.jsxs)(`div`,{className:`breakdown-row total`,children:[(0,G.jsx)(`div`,{className:`breakdown-label`,children:(0,G.jsx)(`strong`,{children:`Total rating`})}),(0,G.jsx)(`div`,{className:`breakdown-value mono`,children:dt(e.Stars)})]})]}),a===0&&r!==i&&(0,G.jsx)(q,{children:`Components add up to ${dt(String(r))} while the stored rating is ${dt(e.Stars)}. Recompute to resolve the drift.`}),a!==0&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Components already include ${yt(e.PendingStars)} that reaches the score only on the date below.`})]})}var yn={stars:`Stars`,activity:`Activity`,moderation:`Moderation`,manual:`Manual`,recompute:`Recompute`};function bn({kind:e}){return(0,G.jsx)(J,{tone:e===`moderation`?`danger`:e===`manual`?`warn`:e===`recompute`?`neutral`:`good`,children:yn[e]})}var xn=[[`#FF885E`,`#FF516A`],[`#FFCD6A`,`#FFA85C`],[`#82B1FF`,`#665FFF`],[`#A0DE7E`,`#54CB68`],[`#53EDD6`,`#28C9B7`],[`#72D5FD`,`#2A9EF1`],[`#E0A2F3`,`#D669ED`]];function Sn(e){return xn[Math.abs(e)%xn.length]}function Cn(e){let t=Array.from(e);return t.length>0?t[0]:``}function wn(e,t,n){let r=`${e} ${t}`.trim().split(/\s+/).filter(Boolean),i=r.length>0?r:n?[n]:[];if(i.length===0)return`T`;let a=Cn(i[0]);return i.length>1&&(a+=Cn(i[i.length-1])),a.toUpperCase()}function Tn({userID:e,firstName:t,lastName:n,username:r=``,size:i=34}){let[a,o]=(0,g.useState)(!1);if((0,g.useEffect)(()=>{o(!1)},[e]),a){let[a,o]=Sn(e);return(0,G.jsx)(`div`,{className:`avatar-fallback`,style:{width:i,height:i,background:`linear-gradient(135deg, ${a}, ${o})`,fontSize:Math.round(i*.42)},children:wn(t,n,r)})}return(0,G.jsx)(`img`,{className:`avatar-photo-img`,src:`/api/accounts/${e}/avatar`,alt:``,loading:`lazy`,style:{width:i,height:i},onError:()=>o(!0)})}function En(e){return e.reduce((e,t)=>(e.devices+=t.DeviceCount,e),{devices:0})}function Dn(e){return e.reduce((e,t)=>(t.Megagroup&&(e.megagroups+=1),t.Broadcast&&(e.broadcasts+=1),t.Verified&&(e.verified+=1),e),{megagroups:0,broadcasts:0,verified:0})}var On={beforeID:0,beforeActiveUS:0};function kn({navigate:e}){let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(50),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)([]),[d,f]=(0,g.useState)(On),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(``);async function v(e,t){m(!0),_(``);let n=new URLSearchParams({limit:String(r)});e.trim()&&n.set(`q`,e.trim()),(t.beforeID||t.beforeActiveUS)&&(n.set(`before_id`,String(t.beforeID)),n.set(`before_active_us`,String(t.beforeActiveUS)));try{let e=await k.accounts(n);return o(e),e}catch(e){return _(O(e)),null}finally{m(!1)}}async function y(){u([]),f(On),await v(t,On)}async function b(){if(!a?.has_more)return;let e={beforeID:a.next_before_id,beforeActiveUS:a.next_before_active_us};await v(t,e)&&(u(e=>[...e,d]),f(e))}async function x(){if(l.length===0)return;let e=l[l.length-1];await v(t,e)&&(u(e=>e.slice(0,-1)),f(e))}async function S(){try{c(await k.accountStats())}catch{}}(0,g.useEffect)(()=>{y(),S()},[]);let C=En(a?.rows??[]),w=l.length>0&&!p,T=!!a?.has_more&&!p;return(0,G.jsxs)(St,{title:`Accounts`,eyebrow:a?.listing===!1?`Search results`:`Recently active accounts`,actions:(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>{y(),S()},disabled:p,children:[(0,G.jsx)(Le,{size:15}),` `,`Refresh`]}),children:[h&&(0,G.jsx)(q,{children:h}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Total users`,value:s?String(s.total):`…`}),(0,G.jsx)(Y,{label:`Online now`,value:s?String(s.online):`…`,tone:`good`}),(0,G.jsx)(Y,{label:`Online device records`,value:String(C.devices)})]}),(0,G.jsx)(Ct,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),placeholder:`User ID / phone / username`})]}),(0,G.jsxs)(`label`,{className:`gift-page-size`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsxs)(`select`,{value:String(r),onChange:e=>i(Number(e.target.value)),children:[(0,G.jsx)(`option`,{value:`10`,children:`10`}),(0,G.jsx)(`option`,{value:`20`,children:`20`}),(0,G.jsx)(`option`,{value:`50`,children:`50`}),(0,G.jsx)(`option`,{value:`100`,children:`100`})]})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:p,children:[p?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Re,{size:15}),` `,`Search`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>void x(),disabled:!w,children:[(0,G.jsx)(fe,{size:15}),` `,`Previous page`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>void b(),disabled:!T,children:[(0,G.jsx)(pe,{size:15}),` `,`Next page`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`avatar-col`}),(0,G.jsx)(`th`,{children:`User ID`}),(0,G.jsx)(`th`,{children:`Phone`}),(0,G.jsx)(`th`,{children:`Username`}),(0,G.jsx)(`th`,{children:`Name`}),(0,G.jsx)(`th`,{children:`Login email`}),(0,G.jsx)(`th`,{children:`Device`}),(0,G.jsx)(`th`,{children:`Last active`}),(0,G.jsx)(`th`,{children:`Premium`}),(0,G.jsx)(`th`,{children:`Verified`}),(0,G.jsx)(`th`,{children:`Frozen`}),(0,G.jsx)(`th`,{children:`Updated`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[a?.rows.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`avatar-col`,children:(0,G.jsx)(Tn,{userID:t.ID,firstName:t.FirstName,lastName:t.LastName,username:t.Username})}),(0,G.jsx)(`td`,{className:`mono`,children:t.ID}),(0,G.jsx)(`td`,{children:it(t.Phone)}),(0,G.jsx)(`td`,{children:(0,G.jsx)(At,{username:t.Username,collectibles:t.Collectibles})}),(0,G.jsx)(`td`,{children:at(t)}),(0,G.jsx)(`td`,{children:t.LoginEmail||(0,G.jsx)(`span`,{className:`muted-cell`,children:`None`})}),(0,G.jsx)(`td`,{children:t.DeviceCount}),(0,G.jsx)(`td`,{children:W(t.LastActiveAt)}),(0,G.jsx)(`td`,{children:t.PremiumUntil>0?(0,G.jsxs)(J,{tone:`good`,children:[`Premium`,` `,st(t.PremiumUntil)]}):(0,G.jsx)(J,{children:`None`})}),(0,G.jsxs)(`td`,{children:[t.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Not verified`}),` `,(0,G.jsx)(rn,{scam:t.Scam,fake:t.Fake})]}),(0,G.jsx)(`td`,{children:t.Frozen?(0,G.jsx)(J,{tone:`danger`,children:`Frozen`}):(0,G.jsx)(J,{children:`Normal`})}),(0,G.jsx)(`td`,{children:W(t.UpdatedAt)}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/accounts/${t.ID}`),children:[`Details`,` `,(0,G.jsx)(pe,{size:14})]})})]},t.ID)),(!a||a.rows.length===0)&&(0,G.jsx)(Dt,{colSpan:12})]})]})})]})}function An({label:e,value:t,onChange:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``);async function d(){c(!0),u(``);let e=new URLSearchParams({limit:`20`});r.trim()&&e.set(`q`,r.trim());try{o((await k.accounts(e)).rows)}catch(e){u(O(e))}finally{c(!1)}}return(0,g.useEffect)(()=>{d()},[]),(0,G.jsxs)(`div`,{className:`entity-picker`,children:[(0,G.jsxs)(`div`,{className:`picker-head`,children:[(0,G.jsx)(`span`,{children:e}),t?(0,G.jsxs)(`button`,{className:`link-button`,type:`button`,onClick:()=>n(null),children:[(0,G.jsx)(rt,{size:13}),` `,`Clear`]}):null]}),t?(0,G.jsxs)(`div`,{className:`selected-entity`,children:[(0,G.jsx)(z,{size:15}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:at(t)}),(0,G.jsx)(`span`,{className:`mono`,children:t.ID})]}),(0,G.jsx)(`span`,{children:U(t.Username)||it(t.Phone)||`-`})]}):null,(0,G.jsxs)(`div`,{className:`picker-search`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())},placeholder:`Search user_id / phone / username`}),(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:d,disabled:s,children:s?(0,G.jsx)(R,{size:14,className:`spin`}):`Search`})]}),l&&(0,G.jsx)(`div`,{className:`picker-error`,children:l}),(0,G.jsxs)(`div`,{className:`picker-results`,children:[a.map(e=>(0,G.jsxs)(`button`,{className:`picker-row ${t?.ID===e.ID?`selected`:``}`,type:`button`,onClick:()=>n(e),children:[(0,G.jsx)(`span`,{className:`mono`,children:e.ID}),(0,G.jsx)(`strong`,{children:at(e)}),(0,G.jsx)(`span`,{children:U(e.Username)||it(e.Phone)||`-`}),e.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Regular`})]},e.ID)),a.length===0&&!s?(0,G.jsx)(`div`,{className:`picker-empty`,children:`No results`}):null]})]})}function jn({label:e,value:t,onChange:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``);async function d(){c(!0),u(``);let e=new URLSearchParams({limit:`20`});r.trim()&&e.set(`q`,r.trim().replace(/^@/,``));try{o((await k.bots(e)).rows??[])}catch(e){u(O(e))}finally{c(!1)}}return(0,g.useEffect)(()=>{d()},[]),(0,G.jsxs)(`div`,{className:`entity-picker`,children:[(0,G.jsxs)(`div`,{className:`picker-head`,children:[(0,G.jsx)(`span`,{children:e}),t?(0,G.jsxs)(`button`,{className:`link-button`,type:`button`,onClick:()=>n(null),children:[(0,G.jsx)(rt,{size:13}),` `,`Clear`]}):null]}),t?(0,G.jsxs)(`div`,{className:`selected-entity`,children:[(0,G.jsx)(z,{size:15}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:t.FirstName||`-`}),(0,G.jsx)(`span`,{className:`mono`,children:t.ID})]}),(0,G.jsx)(`span`,{children:U(t.Username)||`-`})]}):null,(0,G.jsxs)(`div`,{className:`picker-search`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())},placeholder:`Bot username or id`}),(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:d,disabled:s,children:s?(0,G.jsx)(R,{size:14,className:`spin`}):`Search`})]}),l&&(0,G.jsx)(`div`,{className:`picker-error`,children:l}),(0,G.jsxs)(`div`,{className:`picker-results`,children:[a.map(e=>(0,G.jsxs)(`button`,{className:`picker-row ${t?.ID===e.ID?`selected`:``}`,type:`button`,onClick:()=>n(e),children:[(0,G.jsx)(`span`,{className:`mono`,children:e.ID}),(0,G.jsx)(`strong`,{children:e.FirstName||`-`}),(0,G.jsx)(`span`,{children:U(e.Username)||`-`}),e.System?(0,G.jsx)(J,{tone:`warn`,children:`System`}):(0,G.jsx)(J,{children:`Regular`})]},e.ID)),a.length===0&&!s?(0,G.jsx)(`div`,{className:`picker-empty`,children:`No results`}):null]})]})}function Mn({label:e,value:t,onChange:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``);async function d(){c(!0),u(``);let e=new URLSearchParams({limit:`20`});r.trim()&&e.set(`q`,r.trim());try{o((await k.channels(e)).rows)}catch(e){u(O(e))}finally{c(!1)}}return(0,g.useEffect)(()=>{d()},[]),(0,G.jsxs)(`div`,{className:`entity-picker`,children:[(0,G.jsxs)(`div`,{className:`picker-head`,children:[(0,G.jsx)(`span`,{children:e}),t?(0,G.jsxs)(`button`,{className:`link-button`,type:`button`,onClick:()=>n(null),children:[(0,G.jsx)(rt,{size:13}),` `,`Clear`]}):null]}),t?(0,G.jsxs)(`div`,{className:`selected-entity`,children:[(0,G.jsx)(z,{size:15}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:t.Title||`-`}),(0,G.jsx)(`span`,{className:`mono`,children:t.ID})]}),(0,G.jsx)(`span`,{children:U(t.Username)||ot(t)})]}):null,(0,G.jsxs)(`div`,{className:`picker-search`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())},placeholder:`Search channel_id / username / title`}),(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:d,disabled:s,children:s?(0,G.jsx)(R,{size:14,className:`spin`}):`Search`})]}),l&&(0,G.jsx)(`div`,{className:`picker-error`,children:l}),(0,G.jsxs)(`div`,{className:`picker-results`,children:[a.map(e=>(0,G.jsxs)(`button`,{className:`picker-row ${t?.ID===e.ID?`selected`:``}`,type:`button`,onClick:()=>n(e),children:[(0,G.jsx)(`span`,{className:`mono`,children:e.ID}),(0,G.jsx)(`strong`,{children:e.Title||`-`}),(0,G.jsx)(`span`,{children:U(e.Username)||ot(e)}),e.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:ot(e)})]},e.ID)),a.length===0&&!s?(0,G.jsx)(`div`,{className:`picker-empty`,children:`No results`}):null]})]})}function Nn({navigate:e}){let[t,n]=(0,g.useState)(`all`),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(`50`),[s,c]=(0,g.useState)([]),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(`vault`),[b,x]=(0,g.useState)(null),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(``),[E,D]=(0,g.useState)(`XTR`),[A,j]=(0,g.useState)(``),[M,N]=(0,g.useState)(``),[P,F]=(0,g.useState)(``),[I,L]=(0,g.useState)(``),[ee,te]=(0,g.useState)(``),[ne,re]=(0,g.useState)(``);async function ie(e=!1){m(!0),_(``);let n=new URLSearchParams({limit:a});t!==`all`&&n.set(`status`,t),r.trim()&&n.set(`q`,r.trim().replace(/^@/,``)),e&&d&&n.set(`before_id`,d);try{let t=await k.collectibleUsernames(n),r=t.rows??[];c(t=>e?[...t,...r]:r),f(t.next_before_id??``),u(!!t.has_more)}catch(e){_(O(e))}finally{m(!1)}}(0,g.useEffect)(()=>{ie(!1)},[]);let oe=s.filter(e=>e.Status===`vault`).length,se=s.filter(e=>e.Status===`owned`).length,ce=s.filter(e=>e.Status===`burned`).length,le=_t(A,E),ue=M?_t(P,M):`0`,z=le===null,fe=ue===null;function me(){let e={username:w.trim().replace(/^@/,``),currency:E,amount:le??`0`};if(v===`user`&&b&&(e.owner_user_id=String(b.ID)),v===`channel`&&S&&(e.owner_channel_id=String(S.ID)),M&&(e.crypto_currency=M,e.crypto_amount=ue??`0`),I.trim()&&(e.url=I.trim()),ee){let t=Date.parse(`${ee}T${ne||`00:00`}:00Z`);Number.isFinite(t)&&(e.purchase_date=Math.floor(t/1e3))}return e}return(0,G.jsxs)(St,{title:`Collectible usernames`,eyebrow:`NFT usernames / Registry`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>ie(!1),disabled:p,children:[(0,G.jsx)(Le,{size:15,className:p?`spin`:``}),` `,`Refresh`]}),children:[h&&(0,G.jsx)(q,{children:h}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Loaded rows`,value:String(s.length)}),(0,G.jsx)(Y,{label:`In vault`,value:String(oe)}),(0,G.jsx)(Y,{label:`Held by owners`,value:String(se),tone:`good`}),(0,G.jsx)(Y,{label:`Burned`,value:String(ce),tone:ce?`danger`:`neutral`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Mint a collectible username`,text:`Creates the asset together with its purchase record. Keep the owner as vault to mint it unassigned.`}),(0,G.jsxs)(`div`,{className:`toolbar`,role:`group`,"aria-label":`Owner type`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`btn ${v===`vault`?`primary`:``}`,onClick:()=>y(`vault`),children:[(0,G.jsx)(nt,{size:15}),` `,`Vault (no owner)`]}),(0,G.jsx)(`button`,{type:`button`,className:`btn ${v===`user`?`primary`:``}`,onClick:()=>y(`user`),children:`User owner`}),(0,G.jsx)(`button`,{type:`button`,className:`btn ${v===`channel`?`primary`:``}`,onClick:()=>y(`channel`),children:`Channel owner`})]}),v===`user`&&(0,G.jsx)(An,{label:`User owner`,value:b,onChange:x}),v===`channel`&&(0,G.jsx)(Mn,{label:`Channel owner`,value:S,onChange:C}),(0,G.jsxs)(`div`,{className:`bot-create-fields`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Username`}),(0,G.jsx)(`input`,{value:w,onChange:e=>T(e.target.value),placeholder:`durov`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Currency`}),(0,G.jsxs)(`select`,{value:E,onChange:e=>D(e.target.value),children:[(0,G.jsx)(`option`,{value:`XTR`,children:`XTR`}),(0,G.jsx)(`option`,{value:`TON`,children:`TON`}),(0,G.jsx)(`option`,{value:`USD`,children:`USD`})]})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Amount (${E})`}),(0,G.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),inputMode:`decimal`,placeholder:`1000`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Crypto currency`}),(0,G.jsxs)(`select`,{value:M,onChange:e=>N(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`None`}),(0,G.jsx)(`option`,{value:`TON`,children:`TON`})]})]}),M!==``&&(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Crypto amount (${M})`}),(0,G.jsx)(`input`,{value:P,onChange:e=>F(e.target.value),inputMode:`decimal`,placeholder:`12.5`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Marketplace URL`}),(0,G.jsx)(`input`,{value:I,onChange:e=>L(e.target.value),placeholder:`https://fragment.com/username/durov`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Purchase date (UTC)`}),(0,G.jsx)(`input`,{value:ee,onChange:e=>te(e.target.value),type:`date`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Purchase time (UTC)`}),(0,G.jsx)(`input`,{value:ne,onChange:e=>re(e.target.value),type:`time`,step:60,disabled:!ee})]})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Amounts are typed in whole ${E} and stored as the smallest units the API and fragment.collectibleInfo carry, so clients render the price you meant. Up to ${String(pt(E))} decimal places. Clients will show: ${gt(le??`0`,E)}.`}),z&&(0,G.jsx)(q,{children:`That is not a valid ${E} amount: digits only, with at most ${String(pt(E))} decimal places.`}),M!==``&&fe&&(0,G.jsx)(q,{children:`That is not a valid ${M} amount: digits only, with at most ${String(pt(M))} decimal places.`}),(0,G.jsxs)(`div`,{className:`bot-create-actions`,children:[(0,G.jsx)(`span`,{className:`bot-create-note`,children:`Username, currency and amount are required; the dry-run checks availability first.`}),(0,G.jsx)(Z,{disabled:z||fe,label:`Mint username`,icon:(0,G.jsx)(Pe,{size:15}),tone:`neutral`,path:`/api/actions/mint-collectible-username`,payload:me,onDone:()=>ie(!1)})]})]}),(0,G.jsx)(Ct,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),ie(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Search by username`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsxs)(`select`,{value:t,onChange:e=>n(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All statuses`}),(0,G.jsx)(`option`,{value:`vault`,children:`Vault`}),(0,G.jsx)(`option`,{value:`owned`,children:`Owned`}),(0,G.jsx)(`option`,{value:`burned`,children:`Burned`})]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:a,onChange:e=>o(e.target.value),type:`number`,min:`1`,max:`200`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:p,children:[p?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Re,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Username`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Owner`}),(0,G.jsx)(`th`,{children:`Price`}),(0,G.jsx)(`th`,{children:`Purchase date (UTC)`}),(0,G.jsx)(`th`,{children:`Transfers`}),(0,G.jsx)(`th`,{children:`Updated`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[s.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:(0,G.jsx)(`strong`,{children:U(t.Username)})}),(0,G.jsx)(`td`,{children:(0,G.jsx)(Pn,{status:t.Status})}),(0,G.jsx)(`td`,{children:Fn(t,`Vault`)}),(0,G.jsx)(`td`,{className:`mono`,children:In(t)}),(0,G.jsx)(`td`,{children:W(t.PurchaseDate)||`-`}),(0,G.jsx)(`td`,{className:`mono`,children:t.TransferCount}),(0,G.jsx)(`td`,{children:W(t.UpdatedAt)||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/collectible-usernames/${t.ID}`),children:[(0,G.jsx)(ae,{size:14}),` `,`Details`,` `,(0,G.jsx)(pe,{size:14})]})})]},t.ID)),s.length===0&&(0,G.jsx)(Dt,{colSpan:8})]})]})}),l&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>ie(!0),disabled:p,children:[p?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function Pn({status:e}){return e===`owned`?(0,G.jsx)(J,{tone:`good`,children:`Owned`}):e===`burned`?(0,G.jsxs)(J,{tone:`danger`,children:[(0,G.jsx)(be,{size:12}),` `,`Burned`]}):(0,G.jsxs)(J,{children:[(0,G.jsx)(nt,{size:12}),` `,`Vault`]})}function Fn(e,t){return!e.OwnerPeerType||e.OwnerPeerID===``||e.OwnerPeerID===`0`?t:`${U(e.OwnerUsername)||e.OwnerName||e.OwnerPeerID} · ${e.OwnerPeerType}:${e.OwnerPeerID}`}function In(e){let t=gt(e.Amount,e.Currency);return e.CryptoCurrency&&e.CryptoAmount&&e.CryptoAmount!==`0`?`${t} (${gt(e.CryptoAmount,e.CryptoCurrency)})`:t}function Ln({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(`user`),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(null);async function m(){s(!0),a(``);try{r(await k.collectibleUsername(e))}catch(e){a(O(e))}finally{s(!1)}}if((0,g.useEffect)(()=>{m()},[e]),i&&!n)return(0,G.jsx)(q,{children:i});if(!n)return(0,G.jsx)(Ot,{label:o?`Loading collectible username…`:`Waiting for data`});let h=n.asset,_=n.transfers??[],v=`Vault`,y=!!h.OwnerPeerType&&h.OwnerPeerID!==``&&h.OwnerPeerID!==`0`,b=h.Status===`burned`;function x(){y&&t(h.OwnerPeerType===`channel`?`/channels/${h.OwnerPeerID}`:`/accounts/${h.OwnerPeerID}`)}function S(){let e={username:h.Username};return c===`user`&&u&&(e.to_user_id=String(u.ID)),c===`channel`&&f&&(e.to_channel_id=String(f.ID)),e}return(0,G.jsxs)(St,{title:`Collectible ${U(h.Username)}`,eyebrow:`NFT usernames / Asset`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/collectible-usernames`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:m,disabled:o,children:[(0,G.jsx)(Le,{size:15,className:o?`spin`:``}),` `,`Refresh`]})]}),children:[i&&(0,G.jsx)(q,{children:i}),(0,G.jsx)(wt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:U(h.Username)}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:`Asset #${h.ID}`})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(Pn,{status:h.Status}),(0,G.jsx)(J,{tone:h.TransferCount>0?`warn`:`neutral`,children:`${h.TransferCount} transfers`}),h.Status===`owned`&&(0,G.jsx)(J,{tone:h.RegistryActive?`good`:`warn`,children:h.RegistryActive?`Active in profile`:`Hidden in profile`})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Owner`,value:Fn(h,v)}),(0,G.jsx)(X,{label:`Price`,value:In(h),mono:!0}),(0,G.jsx)(X,{label:`Purchase date (UTC)`,value:W(h.PurchaseDate)||`-`}),(0,G.jsx)(X,{label:`Original owner`,value:Bn(h.OriginalOwnerPeerType,h.OriginalOwnerPeerID,v,h.OriginalOwnerUsername)}),(0,G.jsx)(X,{label:`Transfers`,value:String(h.TransferCount),mono:!0}),(0,G.jsx)(X,{label:`Created`,value:W(h.CreatedAt)||`-`}),(0,G.jsx)(X,{label:`Updated`,value:W(h.UpdatedAt)||`-`})]}),(0,G.jsxs)(`div`,{className:`toolbar`,children:[y&&(0,G.jsx)(`button`,{className:`row-link`,type:`button`,onClick:x,children:h.OwnerPeerType===`channel`?`Open owner channel`:`Open owner account`}),h.URL&&(0,G.jsxs)(`a`,{className:`row-link`,href:h.URL,target:`_blank`,rel:`noreferrer noopener`,children:[(0,G.jsx)(ge,{size:14}),` `,`Open marketplace page`]})]}),!b&&(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Transfer ownership`,text:`Pick the recipient; the transfer is appended to the provenance history.`}),(0,G.jsxs)(`div`,{className:`toolbar`,role:`group`,"aria-label":`Recipient type`,children:[(0,G.jsx)(`button`,{type:`button`,className:`btn ${c===`user`?`primary`:``}`,onClick:()=>l(`user`),children:`To user`}),(0,G.jsx)(`button`,{type:`button`,className:`btn ${c===`channel`?`primary`:``}`,onClick:()=>l(`channel`),children:`To channel`})]}),c===`user`?(0,G.jsx)(An,{label:`To user`,value:u,onChange:d}):(0,G.jsx)(Mn,{label:`To channel`,value:f,onChange:p}),(0,G.jsxs)(`div`,{className:`bot-create-actions`,children:[(0,G.jsx)(`span`,{className:`bot-create-note`,children:`The current owner loses the username immediately after confirmation.`}),(0,G.jsx)(Z,{label:`Transfer`,icon:(0,G.jsx)(re,{size:15}),tone:`warn`,path:`/api/actions/transfer-collectible-username`,payload:S,onDone:m})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Provenance history`,text:`Mint, transfer, revoke and burn events in chronological order.`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Event`}),(0,G.jsx)(`th`,{children:`From`}),(0,G.jsx)(`th`,{children:`To`}),(0,G.jsx)(`th`,{children:`Price`}),(0,G.jsx)(`th`,{children:`Actor`}),(0,G.jsx)(`th`,{children:`Reason`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[_.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:e.ID}),(0,G.jsx)(`td`,{children:(0,G.jsx)(zn,{kind:e.Kind})}),(0,G.jsx)(`td`,{className:`mono`,children:Bn(e.FromPeerType,e.FromPeerID,v,e.FromUsername)}),(0,G.jsx)(`td`,{className:`mono`,children:Bn(e.ToPeerType,e.ToPeerID,v,e.ToUsername)}),(0,G.jsx)(`td`,{className:`mono`,children:e.Amount&&e.Amount!==`0`?gt(e.Amount,e.Currency):`-`}),(0,G.jsx)(`td`,{children:e.Actor||`-`}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Reason||`-`}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)||`-`})]},e.ID)),_.length===0&&(0,G.jsx)(Dt,{colSpan:8})]})]})})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Asset operations`}),b?(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This username is burned — no further operations are possible.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`action-stack`,children:(0,G.jsx)(Z,{label:`Revoke to vault`,icon:(0,G.jsx)(Qe,{size:15}),tone:`warn`,path:`/api/actions/revoke-collectible-username`,payload:()=>({username:h.Username,burn:!1}),onDone:m})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Takes the username away from its owner and returns it to the vault; it can be issued again later.`}),(0,G.jsxs)(`div`,{className:`danger-zone`,children:[(0,G.jsx)(Z,{label:`Burn permanently`,icon:(0,G.jsx)(be,{size:15}),tone:`danger`,path:`/api/actions/revoke-collectible-username`,payload:()=>({username:h.Username,burn:!0}),onDone:m}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Irreversible: the username is destroyed and can never be issued again.`}),(0,G.jsx)(Z,{label:`Delete record`,icon:(0,G.jsx)(H,{size:15}),tone:`danger`,path:`/api/actions/delete-collectible-username`,payload:()=>({username:h.Username}),onDone:()=>t(`/collectible-usernames`)}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Erases the asset and its ownership history, and frees the username for a fresh issue. Use this for a username issued by mistake; a burn keeps the history instead.`})]})]})]})})]})}var Rn={mint:`Mint`,transfer:`Transfer`,burn:`Burn`,revoke:`Revoke`};function zn({kind:e}){return(0,G.jsx)(J,{tone:e===`burn`?`danger`:e===`revoke`?`warn`:e===`mint`?`good`:`neutral`,children:Rn[e]})}function Bn(e,t,n,r=``){if(!e||t===``||t===`0`)return n;let i=U(r);return i?`${i} · ${e}:${t}`:`${e}:${t}`}function Vn({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``);async function o(){a(``);try{r(await k.channel(e))}catch(e){a(O(e))}}if((0,g.useEffect)(()=>{o()},[e]),i)return(0,G.jsx)(q,{children:i});if(!n)return(0,G.jsx)(Ot,{label:`Loading channel detail`});let s=n.Channel;return(0,G.jsx)(St,{title:`${ot(s)} #${s.ID}`,eyebrow:`Channel Profile`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>t(`/channels`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),children:(0,G.jsx)(wt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:s.Title||`-`}),(0,G.jsxs)(`div`,{className:`entity-subtitle`,children:[U(s.Username)||`No username`,` · `,`Creator ${s.CreatorUserID}`]})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(J,{children:ot(s)}),s.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Not verified`}),(0,G.jsx)(rn,{scam:s.Scam,fake:s.Fake}),s.Deleted?(0,G.jsx)(J,{tone:`danger`,children:`Deleted`}):(0,G.jsx)(J,{children:`Valid`})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Channel ID`,value:String(s.ID),mono:!0}),(0,G.jsx)(X,{label:`access_hash`,value:String(s.AccessHash),mono:!0}),(0,G.jsx)(X,{label:`Members`,value:`${s.ParticipantsCount} / Admins ${s.AdminsCount}`}),(0,G.jsx)(X,{label:`Moderation`,value:`Banned ${s.BannedCount} / Kicked ${s.KickedCount}`}),(0,G.jsx)(X,{label:`Channel flags`,value:`broadcast=${s.Broadcast} megagroup=${s.Megagroup} forum=${s.Forum}`}),(0,G.jsx)(X,{label:`top / pinned / PTS`,value:`${s.TopMessageID} / ${s.PinnedMessageID} / ${s.PTS}`}),(0,G.jsx)(X,{label:`Created`,value:st(s.Date)||`-`}),(0,G.jsx)(X,{label:`Updated`,value:W(s.UpdatedAt)||`-`})]}),s.About&&(0,G.jsx)(`p`,{className:`about-text`,children:s.About}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Recent Admin Actions`,text:`Last 30 audit rows`}),(0,G.jsx)(Et,{rows:n.AuditLogs})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Channel Raw Row`,text:`Database read-only snapshot`}),(0,G.jsx)(kt,{value:n.ChannelJSON})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Channel Actions`}),(0,G.jsx)(Z,{label:s.Verified?`Clear verified`:`Set verified`,icon:(0,G.jsx)(F,{size:15}),tone:`warn`,path:`/api/actions/set-channel-verified`,payload:()=>({channel_id:s.ID,verified:!s.Verified}),onDone:o}),(0,G.jsx)(an,{idKey:`channel_id`,id:s.ID,path:`/api/actions/set-channel-flags`,scam:s.Scam,fake:s.Fake,onDone:o}),(0,G.jsx)(`div`,{className:`dock-title`,children:`Settings`}),(0,G.jsx)(un,{channel:s,onDone:o}),(0,G.jsx)(`div`,{className:`dock-title`,children:`Attributes`}),(0,G.jsx)(sn,{idKey:`channel_id`,id:s.ID,path:`/api/actions/set-channel-username`,current:s.Username,onDone:o}),(0,G.jsx)(cn,{idKey:`channel_id`,id:s.ID,path:`/api/actions/set-channel-color`,onDone:o}),(0,G.jsx)(ln,{idKey:`channel_id`,id:s.ID,path:`/api/actions/set-channel-emoji-status`,onDone:o})]})})})}function Hn({navigate:e}){let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(`50`),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)({beforeID:0,beforeUpdatedUS:0}),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``);async function p(e=!1){u(!0),f(``);let n=new URLSearchParams({limit:r});t.trim()?n.set(`q`,t.trim()):e&&(n.set(`before_id`,String(s.beforeID)),n.set(`before_updated_us`,String(s.beforeUpdatedUS)));try{let e=await k.channels(n);o(e),c({beforeID:e.next_before_id,beforeUpdatedUS:e.next_before_updated_us})}catch(e){f(O(e))}finally{u(!1)}}(0,g.useEffect)(()=>{p(!1)},[]);let m=Dn(a?.rows??[]);return(0,G.jsxs)(St,{title:`Supergroups and Channels`,eyebrow:a?.listing===!1?`Search results`:`Recently updated`,actions:(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>p(!1),disabled:l,children:[(0,G.jsx)(Le,{size:15}),` `,`Refresh`]}),children:[d&&(0,G.jsx)(q,{children:d}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Entities on page`,value:String(a?.rows.length??0)}),(0,G.jsx)(Y,{label:`Supergroups`,value:String(m.megagroups)}),(0,G.jsx)(Y,{label:`Channels`,value:String(m.broadcasts)}),(0,G.jsx)(Y,{label:`Verified`,value:String(m.verified),tone:`good`})]}),(0,G.jsx)(Ct,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),p(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),placeholder:`Channel ID / username / title`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:r,onChange:e=>i(e.target.value),type:`number`,min:`1`,max:`100`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:l,children:[l?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Re,{size:15}),` `,`Search`]}),a?.listing&&a.has_more&&(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>p(!0),disabled:l,children:[(0,G.jsx)(pe,{size:15}),` `,`Next page`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Channel ID`}),(0,G.jsx)(`th`,{children:`Kind`}),(0,G.jsx)(`th`,{children:`Username`}),(0,G.jsx)(`th`,{children:`Title`}),(0,G.jsx)(`th`,{children:`Members`}),(0,G.jsx)(`th`,{children:`Admins`}),(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Verified`}),(0,G.jsx)(`th`,{children:`Updated`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[a?.rows.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:t.ID}),(0,G.jsx)(`td`,{children:ot(t)}),(0,G.jsx)(`td`,{children:U(t.Username)}),(0,G.jsx)(`td`,{children:t.Title}),(0,G.jsx)(`td`,{children:t.ParticipantsCount}),(0,G.jsx)(`td`,{children:t.AdminsCount}),(0,G.jsx)(`td`,{children:t.PTS}),(0,G.jsxs)(`td`,{children:[t.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Not verified`}),` `,(0,G.jsx)(rn,{scam:t.Scam,fake:t.Fake})]}),(0,G.jsx)(`td`,{children:W(t.UpdatedAt)}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/channels/${t.ID}`),children:[`Details`,` `,(0,G.jsx)(pe,{size:14})]})})]},t.ID)),(!a||a.rows.length===0)&&(0,G.jsx)(Dt,{colSpan:10})]})]})})]})}function Un({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1);async function c(){s(!0),a(``);try{r(await k.bot(e))}catch(e){a(O(e))}finally{s(!1)}}if((0,g.useEffect)(()=>{c()},[e]),i)return(0,G.jsx)(q,{children:i});if(!n)return(0,G.jsx)(Ot,{label:o?`Loading bot detail`:`Waiting for data`});let l=n.Bot;return(0,G.jsx)(St,{title:`Bot #${l.ID}`,eyebrow:`Bot Profile`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>t(`/bots`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),children:(0,G.jsx)(wt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:l.FirstName||`Unnamed bot`}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:U(l.Username)||`No username`})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(J,{tone:l.System?`warn`:`neutral`,children:l.System?`System`:`User`}),l.Verified?(0,G.jsx)(J,{tone:`good`,children:`Verified`}):(0,G.jsx)(J,{children:`Not verified`}),(0,G.jsx)(rn,{scam:l.Scam,fake:l.Fake})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Bot ID`,value:String(l.ID),mono:!0}),(0,G.jsx)(X,{label:`Owner`,value:l.OwnerUserID>0?`${l.OwnerUserID} ${U(n.OwnerUsername)}`.trim():`None`}),(0,G.jsx)(X,{label:`Type`,value:l.System?`System`:`User`}),(0,G.jsx)(X,{label:`Updated`,value:W(l.UpdatedAt)||`-`}),(0,G.jsx)(X,{label:`Created`,value:W(l.CreatedAt)||`-`})]}),n.About&&(0,G.jsx)(`p`,{className:`about-text`,children:n.About}),n.Description&&n.Description.trim()!==n.About.trim()&&(0,G.jsx)(`p`,{className:`about-text`,children:n.Description}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Recent Admin Actions`,text:`Last 30 audit rows`}),(0,G.jsx)(Et,{rows:n.AuditLogs})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Bot Actions`}),(0,G.jsx)(`div`,{className:`action-stack`,children:(0,G.jsx)(Z,{label:l.Verified?`Clear verified`:`Set verified`,icon:(0,G.jsx)(F,{size:15}),tone:`neutral`,path:`/api/actions/set-verified`,payload:()=>({user_id:l.ID,verified:!l.Verified}),onDone:c})}),(0,G.jsx)(an,{idKey:`user_id`,id:l.ID,path:`/api/actions/set-account-flags`,scam:l.Scam,fake:l.Fake,onDone:c}),(0,G.jsx)(`div`,{className:`dock-title`,children:`Attributes`}),(0,G.jsx)(sn,{idKey:`user_id`,id:l.ID,path:`/api/actions/set-account-username`,current:l.Username,onDone:c}),(0,G.jsx)(cn,{idKey:`user_id`,id:l.ID,path:`/api/actions/set-account-color`,onDone:c}),(0,G.jsx)(ln,{idKey:`user_id`,id:l.ID,path:`/api/actions/set-account-emoji-status`,onDone:c}),l.System?(0,G.jsx)(`p`,{className:`bot-create-note`,children:`System bots are built in and cannot be deleted.`}):(0,G.jsxs)(`div`,{className:`danger-zone`,children:[(0,G.jsx)(Z,{label:`Delete bot`,icon:(0,G.jsx)(H,{size:15}),tone:`danger`,path:`/api/actions/delete-bot`,payload:()=>({bot_user_id:l.ID}),onDone:()=>t(`/bots`)}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Permanently deletes this user-created bot and invalidates its token. This cannot be undone.`})]})]})})})}function Wn({navigate:e}){let[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(`50`),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(0),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(``),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(``);async function b(e=!1){u(!0),f(``);let n=new URLSearchParams({limit:r});t.trim()?n.set(`q`,t.trim()):e&&n.set(`before_id`,String(s));try{let e=await k.bots(n);o(e),c(e.next_before_id)}catch(e){f(O(e))}finally{u(!1)}}(0,g.useEffect)(()=>{b(!1)},[]);let x=a?.rows??[],S=x.filter(e=>e.Verified).length,C=x.filter(e=>e.System).length;return(0,G.jsxs)(St,{title:`Bots`,eyebrow:a?.listing===!1?`Search results`:`Recently created bots`,actions:(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>b(!1),disabled:l,children:[(0,G.jsx)(Le,{size:15}),` `,`Refresh`]}),children:[d&&(0,G.jsx)(q,{children:d}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Bots on page`,value:String(x.length)}),(0,G.jsx)(Y,{label:`Verified`,value:String(S),tone:`good`}),(0,G.jsx)(Y,{label:`System`,value:String(C)})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(`div`,{className:`section-head`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:`Create a system bot`}),(0,G.jsx)(`p`,{children:`Provision a bot account owned by the given user. The token is shown once after confirmation.`})]})}),(0,G.jsxs)(`div`,{className:`bot-create-fields`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Owner user ID`}),(0,G.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),type:`number`,min:`1`,placeholder:`123456789`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Display name`}),(0,G.jsx)(`input`,{value:h,onChange:e=>_(e.target.value),placeholder:`e.g. Service Bot`,maxLength:64})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Username`}),(0,G.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`my_service_bot`})]})]}),(0,G.jsxs)(`div`,{className:`bot-create-actions`,children:[(0,G.jsx)(`span`,{className:`bot-create-note`,children:`Username must be 5-32 characters and end with 'bot'.`}),(0,G.jsx)(Z,{label:`Create bot`,icon:(0,G.jsx)(Pe,{size:15}),tone:`neutral`,path:`/api/actions/create-bot`,payload:()=>({owner_user_id:lt(p),name:h.trim(),username:v.trim().replace(/^@/,``)}),onDone:()=>b(!1)})]})]}),(0,G.jsx)(Ct,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),b(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),placeholder:`Bot ID / username`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:r,onChange:e=>i(e.target.value),type:`number`,min:`1`,max:`100`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:l,children:[l?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Re,{size:15}),` `,`Search`]}),a?.listing&&a.has_more&&(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>b(!0),disabled:l,children:[(0,G.jsx)(pe,{size:15}),` `,`Next page`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Bot ID`}),(0,G.jsx)(`th`,{children:`Username`}),(0,G.jsx)(`th`,{children:`Name`}),(0,G.jsx)(`th`,{children:`Owner`}),(0,G.jsx)(`th`,{children:`Verified`}),(0,G.jsx)(`th`,{children:`Type`}),(0,G.jsx)(`th`,{children:`Created`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[x.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:t.ID}),(0,G.jsx)(`td`,{children:U(t.Username)||`-`}),(0,G.jsx)(`td`,{children:t.FirstName||`-`}),(0,G.jsx)(`td`,{className:`mono`,children:t.OwnerUserID>0?t.OwnerUserID:`-`}),(0,G.jsxs)(`td`,{children:[t.Verified?(0,G.jsxs)(J,{tone:`good`,children:[(0,G.jsx)(F,{size:12}),` `,`Verified`]}):(0,G.jsx)(J,{children:`Not verified`}),` `,(0,G.jsx)(rn,{scam:t.Scam,fake:t.Fake})]}),(0,G.jsx)(`td`,{children:t.System?(0,G.jsx)(J,{tone:`warn`,children:`System`}):(0,G.jsx)(J,{children:`User`})}),(0,G.jsx)(`td`,{children:W(t.CreatedAt)}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/bots/${t.ID}`),children:[(0,G.jsx)(se,{size:14}),` `,`Details`,` `,(0,G.jsx)(pe,{size:14})]})})]},t.ID)),x.length===0&&(0,G.jsx)(Dt,{colSpan:8})]})]})})]})}function Gn({navigate:e}){return(0,G.jsxs)(`div`,{className:`dashboard-layout`,children:[(0,G.jsxs)(`section`,{className:`overview-band`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`Runtime Overview`}),(0,G.jsx)(`h2`,{children:`Console Overview`})]}),(0,G.jsxs)(`div`,{className:`overview-metrics`,children:[(0,G.jsx)(Tt,{label:`Read path`,value:`PG read-only`,tone:`neutral`}),(0,G.jsx)(Tt,{label:`Write path`,value:`Admin API`,tone:`good`}),(0,G.jsx)(Tt,{label:`Execution policy`,value:`Dry-run first`,tone:`warn`})]})]}),(0,G.jsxs)(`div`,{className:`command-grid`,children:[(0,G.jsx)(Kn,{icon:(0,G.jsx)(tt,{}),title:`Accounts`,text:`Account status, premium, verification, sessions.`,href:`/accounts`,navigate:e}),(0,G.jsx)(Kn,{icon:(0,G.jsx)(Ue,{}),title:`Supergroups and Channels`,text:`Public entities, member counts, verification state.`,href:`/channels`,navigate:e}),(0,G.jsx)(Kn,{icon:(0,G.jsx)(ke,{}),title:`Message Audit`,text:`Message boxes, updates, outbox state.`,href:`/messages`,navigate:e})]}),(0,G.jsxs)(`section`,{className:`work-strip`,children:[(0,G.jsxs)(`div`,{className:`strip-item`,children:[(0,G.jsx)(L,{size:16}),(0,G.jsx)(`span`,{children:`All dangerous actions start with dry-run`})]}),(0,G.jsxs)(`div`,{className:`strip-item`,children:[(0,G.jsx)(Te,{size:16}),(0,G.jsx)(`span`,{children:`Browser never stores internal tokens`})]}),(0,G.jsxs)(`div`,{className:`strip-item`,children:[(0,G.jsx)(me,{size:16}),(0,G.jsx)(`span`,{children:`Lists use cursor pagination`})]}),(0,G.jsxs)(`div`,{className:`strip-item`,children:[(0,G.jsx)(ye,{size:16}),(0,G.jsx)(`span`,{children:`Detail pages retain raw state snapshots`})]})]})]})}function Kn({icon:e,title:t,text:n,href:r,navigate:i}){return(0,G.jsxs)(Xt,{className:`launcher`,href:r,navigate:i,children:[(0,G.jsx)(`span`,{className:`launcher-icon`,children:e}),(0,G.jsxs)(`span`,{className:`launcher-copy`,children:[(0,G.jsx)(`strong`,{children:t}),(0,G.jsx)(`span`,{children:n})]}),(0,G.jsx)(pe,{size:16})]})}function qn({channelID:e,msgID:t,navigate:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``);async function s(){o(``);try{i(await k.groupMessage(e,t))}catch(e){o(O(e))}}if((0,g.useEffect)(()=>{s()},[e,t]),a)return(0,G.jsx)(q,{children:a});if(!r)return(0,G.jsx)(Ot,{label:`Loading`});let c=r.Message;return(0,G.jsx)(St,{title:`Group Message #${c.ID}`,eyebrow:`Message Detail`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>n(`/messages/groups`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to group messages`]}),children:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:`Channel / Group ${c.ChannelID}`}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:`Sender ${c.SenderUserID} · ${st(c.Date)}`})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[c.Deleted?(0,G.jsx)(J,{tone:`danger`,children:`Deleted`}):(0,G.jsx)(J,{children:`Live`}),c.Pinned&&(0,G.jsx)(J,{tone:`warn`,children:`Pinned`}),c.Post&&(0,G.jsx)(J,{children:`Channel post`}),(0,G.jsxs)(J,{children:[`pts `,c.PTS]})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Message ID`,value:String(c.ID),mono:!0}),(0,G.jsx)(X,{label:`Channel / Group`,value:String(c.ChannelID),mono:!0}),(0,G.jsx)(X,{label:`From Peer`,value:`${c.FromPeerType}:${c.FromPeerID}`,mono:!0}),(0,G.jsx)(X,{label:`Views`,value:String(c.ViewsCount)})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Channel Message Row`,text:`channel_messages read-only snapshot`}),(0,G.jsx)(kt,{value:r.MessageJSON})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Channel Row`,text:`channels read-only snapshot`}),(0,G.jsx)(kt,{value:r.ChannelJSON})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Channel Update Events`,text:`durable channel_update_events`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Count`}),(0,G.jsx)(`th`,{children:`Type`}),(0,G.jsx)(`th`,{children:`Message ID`}),(0,G.jsx)(`th`,{children:`Sender`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[r.UpdateEvents.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:e.PTS}),(0,G.jsx)(`td`,{children:e.PTSCount}),(0,G.jsx)(`td`,{children:e.Type}),(0,G.jsx)(`td`,{children:e.MessageID}),(0,G.jsx)(`td`,{children:e.SenderUserID}),(0,G.jsx)(`td`,{children:st(e.Date)})]},`${e.PTS}-${e.Type}-${e.MessageID}`)),r.UpdateEvents.length===0&&(0,G.jsx)(Dt,{colSpan:6})]})]})})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Event JSON`}),(0,G.jsxs)(`div`,{className:`raw-grid`,children:[r.UpdateEvents.map(e=>(0,G.jsx)(kt,{value:e.JSON},`${e.PTS}-${e.Type}-json`)),r.UpdateEvents.length===0&&(0,G.jsx)(`div`,{className:`empty-panel`,children:`No results`})]})]})]})})}function Jn({navigate:e}){let[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(`100`),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(``);async function p(e=!1){if(f(``),!t){f(`Search and select a supergroup or channel first`);return}let n=new URLSearchParams({channel_id:String(t.ID),limit:s});if(e&&l?.rows.length){let e=l.rows[l.rows.length-1];n.set(`before_date`,String(e.Date)),n.set(`before_id`,String(e.ID)),i(String(e.Date)),o(String(e.ID))}else r&&n.set(`before_date`,r),a&&n.set(`before_id`,a);try{u(await k.groupMessages(n))}catch(e){f(O(e))}}function m(e){n(e),i(``),o(``),u(null)}let h=l?.rows??[];return(0,G.jsxs)(St,{title:`Group Messages`,eyebrow:`Supergroup / channel messages`,children:[d&&(0,G.jsx)(q,{children:d}),(0,G.jsxs)(Ct,{children:[(0,G.jsx)(`div`,{className:`message-selector-grid single`,children:(0,G.jsx)(Mn,{label:`Channel / Group`,value:t,onChange:m})}),(0,G.jsxs)(`form`,{className:`toolbar message-query`,onSubmit:e=>{e.preventDefault(),p(!1)},children:[(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`before_date cursor`}),(0,G.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`before_msg_id cursor`}),(0,G.jsx)(`input`,{className:`small-input`,value:s,onChange:e=>c(e.target.value),placeholder:`limit <= 100`}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,children:[(0,G.jsx)(Re,{size:15}),` `,`Search messages`]}),h.length?(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>p(!0),children:[(0,G.jsx)(pe,{size:15}),` `,`Next page`]}):null]})]}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Messages on page`,value:String(h.length)}),(0,G.jsx)(Y,{label:`With media`,value:String(h.filter(e=>e.Media&&e.Media!==`{}`).length)}),(0,G.jsx)(Y,{label:`Channel posts`,value:String(h.filter(e=>e.Post).length)}),(0,G.jsx)(Y,{label:`Channel / Group`,value:t?`${t.Title||ot(t)} (${t.ID})`:`-`})]}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Message ID`}),(0,G.jsx)(`th`,{children:`Time`}),(0,G.jsx)(`th`,{children:`Sender`}),(0,G.jsx)(`th`,{children:`From Peer`}),(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Views`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Body`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[h.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:t.ID}),(0,G.jsx)(`td`,{children:st(t.Date)}),(0,G.jsx)(`td`,{className:`mono`,children:t.SenderUserID}),(0,G.jsxs)(`td`,{className:`mono`,children:[t.FromPeerType,`:`,t.FromPeerID]}),(0,G.jsx)(`td`,{children:t.PTS}),(0,G.jsx)(`td`,{children:t.ViewsCount}),(0,G.jsx)(`td`,{children:t.Deleted?(0,G.jsx)(J,{tone:`danger`,children:`Deleted`}):t.Pinned?(0,G.jsx)(J,{tone:`warn`,children:`Pinned`}):(0,G.jsx)(J,{children:`Live`})}),(0,G.jsx)(`td`,{className:`truncate`,children:t.Body}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/messages/groups/detail?channel_id=${t.ChannelID}&msg_id=${t.ID}`),children:[`Details`,` `,(0,G.jsx)(pe,{size:14})]})})]},`${t.ChannelID}-${t.ID}`)),h.length===0&&(0,G.jsx)(Dt,{colSpan:9})]})]})})]})}function Yn({ownerUserID:e,msgID:t,navigate:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``);async function s(){o(``);try{i(await k.message(e,t))}catch(e){o(O(e))}}if((0,g.useEffect)(()=>{s()},[e,t]),a)return(0,G.jsx)(q,{children:a});if(!r)return(0,G.jsx)(Ot,{label:`Loading`});let c=r.Message;return(0,G.jsx)(St,{title:`Message #${c.BoxID}`,eyebrow:`Message Detail`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>n(`/messages/private`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to private messages`]}),children:(0,G.jsx)(wt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:`Owner ${c.OwnerUserID} · Peer ${c.PeerID}`}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:`Sender ${c.FromUserID} · ${st(c.Date)}`})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[c.Deleted?(0,G.jsx)(J,{tone:`danger`,children:`Deleted`}):(0,G.jsx)(J,{children:`Live`}),(0,G.jsxs)(J,{children:[`pts `,c.PTS]}),(0,G.jsx)(J,{children:c.Outgoing?`Outgoing`:`Incoming`})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Message box ID`,value:String(c.BoxID),mono:!0}),(0,G.jsx)(X,{label:`Private message ID`,value:String(c.PrivateMessageID),mono:!0}),(0,G.jsx)(X,{label:`Message sender`,value:String(c.MessageSenderID),mono:!0}),(0,G.jsx)(X,{label:`Time`,value:st(c.Date)})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Message Box`,text:`message_boxes read-only snapshot`}),(0,G.jsx)(kt,{value:r.MessageJSON})]}),(0,G.jsxs)(`div`,{className:`raw-grid`,children:[(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Dialog Row`,text:`dialogs read-only snapshot`}),(0,G.jsx)(kt,{value:r.DialogJSON})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Private Message Row`,text:`private_messages read-only snapshot`}),(0,G.jsx)(kt,{value:r.PrivateJSON})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Update Events`,text:`durable user_update_events`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Count`}),(0,G.jsx)(`th`,{children:`Type`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[r.UpdateEvents.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:e.PTS}),(0,G.jsx)(`td`,{children:e.PTSCount}),(0,G.jsx)(`td`,{children:e.Type}),(0,G.jsx)(`td`,{children:st(e.Date)})]},`${e.PTS}-${e.Type}`)),r.UpdateEvents.length===0&&(0,G.jsx)(Dt,{colSpan:4})]})]})})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Dispatch Queue`,text:`online/offline dispatch_outbox`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`User ID`}),(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Type`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Attempts`}),(0,G.jsx)(`th`,{children:`Updated`})]})}),(0,G.jsxs)(`tbody`,{children:[r.Outbox.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:e.ID}),(0,G.jsx)(`td`,{children:e.TargetUserID}),(0,G.jsx)(`td`,{children:e.PTS}),(0,G.jsx)(`td`,{children:e.EventType}),(0,G.jsx)(`td`,{children:e.Status}),(0,G.jsx)(`td`,{children:e.Attempts}),(0,G.jsx)(`td`,{children:W(e.UpdatedAt)})]},e.ID)),r.Outbox.length===0&&(0,G.jsx)(Dt,{colSpan:7})]})]})})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Operations`}),(0,G.jsx)(Z,{label:`Delete this message`,icon:(0,G.jsx)(H,{size:15}),path:`/api/actions/delete-messages`,payload:()=>({owner_user_id:c.OwnerUserID,peer_id:c.PeerID,ids:[c.BoxID],revoke:!0}),onDone:s})]})})})}function Xn({navigate:e}){let[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(`100`),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(!0),[h,_]=(0,g.useState)(!1),[v,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(`1`),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(``);async function E(e=!1){if(T(``),!t||!r){T(`Search and select the owner user and peer user first`);return}let n=new URLSearchParams({owner_user_id:String(t.ID),peer_id:String(r.ID),limit:l});if(e&&S?.rows.length){let e=S.rows[S.rows.length-1];n.set(`before_date`,String(e.Date)),n.set(`before_id`,String(e.BoxID)),o(String(e.Date)),c(String(e.BoxID))}else a&&n.set(`before_date`,a),s&&n.set(`before_id`,s);try{C(await k.messages(n))}catch(e){T(O(e))}}function D(e){n(e),o(``),c(``),C(null)}function A(e){i(e),o(``),c(``),C(null)}return(0,G.jsxs)(St,{title:`Private Messages`,eyebrow:`Private message boxes`,children:[w&&(0,G.jsx)(q,{children:w}),(0,G.jsxs)(Ct,{children:[(0,G.jsxs)(`div`,{className:`message-selector-grid`,children:[(0,G.jsx)(An,{label:`Owner user`,value:t,onChange:D}),(0,G.jsx)(An,{label:`Peer user`,value:r,onChange:A})]}),(0,G.jsxs)(`form`,{className:`toolbar message-query`,onSubmit:e=>{e.preventDefault(),E(!1)},children:[(0,G.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`before_date cursor`}),(0,G.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`before_msg_id cursor`}),(0,G.jsx)(`input`,{className:`small-input`,value:l,onChange:e=>u(e.target.value),placeholder:`limit <= 100`}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,children:[(0,G.jsx)(Re,{size:15}),` `,`Search messages`]}),S?.rows.length?(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>E(!0),children:[(0,G.jsx)(pe,{size:15}),` `,`Next page`]}):null]})]}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Messages on page`,value:String(S?.rows.length??0)}),(0,G.jsx)(Y,{label:`Deleted`,value:String((S?.rows??[]).filter(e=>e.Deleted).length),tone:`danger`}),(0,G.jsx)(Y,{label:`Outgoing`,value:String((S?.rows??[]).filter(e=>e.Outgoing).length)}),(0,G.jsx)(Y,{label:`Owner / Peer`,value:t&&r?`${at(t)} / ${at(r)}`:`-`})]}),(0,G.jsxs)(`div`,{className:`operation-row`,children:[(0,G.jsxs)(`div`,{className:`operation-box`,children:[(0,G.jsxs)(`div`,{className:`operation-title`,children:[(0,G.jsx)(H,{size:15}),` `,`Delete selected messages`]}),(0,G.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`Message IDs, comma separated`}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),` `,`Revoke for both sides`]}),(0,G.jsx)(Z,{path:`/api/actions/delete-messages`,label:`Dry-run delete`,payload:()=>({owner_user_id:t?.ID??0,peer_id:r?.ID??0,ids:bt(d,`Message IDs are invalid`),revoke:p})})]}),(0,G.jsxs)(`div`,{className:`operation-box`,children:[(0,G.jsxs)(`div`,{className:`operation-title`,children:[(0,G.jsx)(Ce,{size:15}),` `,`Clear private history`]}),(0,G.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`max_id cutoff`}),(0,G.jsx)(`input`,{value:b,onChange:e=>x(e.target.value),placeholder:`max_batches`}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),` `,`Revoke for both sides`]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>_(e.target.checked)}),` `,`Clear only this side`]}),(0,G.jsx)(Z,{path:`/api/actions/delete-history`,label:`Dry-run clear history`,payload:()=>({owner_user_id:t?.ID??0,peer_id:r?.ID??0,max_id:lt(v),max_batches:lt(b),just_clear:h,revoke:p})})]})]}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Message ID`}),(0,G.jsx)(`th`,{children:`Time`}),(0,G.jsx)(`th`,{children:`Sender`}),(0,G.jsx)(`th`,{children:`Direction`}),(0,G.jsx)(`th`,{children:`PTS`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Body`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[S?.rows.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:t.BoxID}),(0,G.jsx)(`td`,{children:st(t.Date)}),(0,G.jsx)(`td`,{className:`mono`,children:t.FromUserID}),(0,G.jsx)(`td`,{children:t.Outgoing?`Outgoing`:`Incoming`}),(0,G.jsx)(`td`,{children:t.PTS}),(0,G.jsx)(`td`,{children:t.Deleted?(0,G.jsx)(J,{tone:`danger`,children:`Deleted`}):(0,G.jsx)(J,{children:`Live`})}),(0,G.jsx)(`td`,{className:`truncate`,children:t.Body}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/messages/private/detail?owner_user_id=${t.OwnerUserID}&msg_id=${t.BoxID}`),children:[`Details`,` `,(0,G.jsx)(pe,{size:14})]})})]},`${t.OwnerUserID}-${t.BoxID}`)),(!S||S.rows.length===0)&&(0,G.jsx)(Dt,{colSpan:8})]})]})})]})}var Zn=c(o(((e,t)=>{typeof document<`u`&&typeof navigator<`u`&&(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.lottie=r())})(e,(function(){var n=``,r=!1,i=-999999,a=function(e){r=!!e},o=function(){return r},s=function(e){n=e},c=function(){return n};function l(e){return document.createElement(e)}function u(e,t){var n,r=e.length,i;for(n=0;n1?n[1]=1:n[1]<=0&&(n[1]=0),L(n[0],n[1],n[2])}function te(e,t){var n=ee(e[0]*255,e[1]*255,e[2]*255);return n[2]+=t,n[2]>1?n[2]=1:n[2]<0&&(n[2]=0),L(n[0],n[1],n[2])}function ne(e,t){var n=ee(e[0]*255,e[1]*255,e[2]*255);return n[0]+=t/360,n[0]>1?--n[0]:n[0]<0&&(n[0]+=1),L(n[0],n[1],n[2])}(function(){var e=[],t,n;for(t=0;t<256;t+=1)n=t.toString(16),e[t]=n.length===1?`0`+n:n;return function(t,n,r){return t<0&&(t=0),n<0&&(n=0),r<0&&(r=0),`#`+e[t]+e[n]+e[r]}})();var re=function(e){g=!!e},ie=function(){return g},ae=function(e){_=e},oe=function(){return _},se=function(){return v},ce=function(e){E=e},le=function(){return E},ue=function(e){y=e};function z(e){return document.createElementNS(`http://www.w3.org/2000/svg`,e)}function de(e){"@babel/helpers - typeof";return de=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},de(e)}var fe=function(){var e=1,t=[],n,r,i={onmessage:function(){},postMessage:function(e){n({data:e})}},a={postMessage:function(e){i.onmessage({data:e})}};function s(e){if(window.Worker&&window.Blob&&o()){var t=new Blob([`var _workerSelf = self; self.onmessage = `,e.toString()],{type:`text/javascript`}),r=URL.createObjectURL(t);return new Worker(r)}return n=e,i}function c(){r||(r=s(function(e){function t(){function e(t,n){var o,s,c=t.length,l,u,d,f;for(s=0;s=0;--t)if(e[t].ty===`sh`)if(e[t].ks.k.i)a(e[t].ks.k);else for(o=e[t].ks.k.length,r=0;rn[0]?!0:n[0]>e[0]?!1:e[1]>n[1]?!0:n[1]>e[1]?!1:e[2]>n[2]?!0:n[2]>e[2]?!1:null}var s=function(){var e=[4,4,14];function t(e){var t=e.t.d;e.t.d={k:[{s:t,t:0}]}}function n(e){var n,r=e.length;for(n=0;n=0;--n)if(e[n].ty===`sh`)if(e[n].ks.k.i)e[n].ks.k.c=e[n].closed;else for(a=e[n].ks.k.length,i=0;i500)&&(this._imageLoaded(),clearInterval(n)),t+=1}.bind(this),50)}function a(t){var n=r(t,this.assetsPath,this.path),i=z(`image`);b?this.testImageLoaded(i):i.addEventListener(`load`,this._imageLoaded,!1),i.addEventListener(`error`,function(){a.img=e,this._imageLoaded()}.bind(this),!1),i.setAttributeNS(`http://www.w3.org/1999/xlink`,`href`,n),this._elementHelper.append?this._elementHelper.append(i):this._elementHelper.appendChild(i);var a={img:i,assetData:t};return a}function o(t){var n=r(t,this.assetsPath,this.path),i=l(`img`);i.crossOrigin=`anonymous`,i.addEventListener(`load`,this._imageLoaded,!1),i.addEventListener(`error`,function(){a.img=e,this._imageLoaded()}.bind(this),!1),i.src=n;var a={img:i,assetData:t};return a}function s(e){var t={assetData:e},n=r(e,this.assetsPath,this.path);return fe.loadData(n,function(e){t.img=e,this._footageLoaded()}.bind(this),function(){t.img={},this._footageLoaded()}.bind(this)),t}function c(e,t){this.imagesLoadedCb=t;var n,r=e.length;for(n=0;nthis.animationData.op&&(this.animationData.op=e.op,this.totalFrames=Math.floor(e.op-this.animationData.ip));var t=this.animationData.layers,n,r=t.length,i=e.layers,a,o=i.length;for(a=0;athis.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger(`enterFrame`),this.renderFrame(),this.trigger(`drawnFrame`)},B.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(e){this.triggerRenderFrameError(e)}},B.prototype.play=function(e){e&&this.name!==e||this.isPaused===!0&&(this.isPaused=!1,this.trigger(`_play`),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger(`_active`)))},B.prototype.pause=function(e){e&&this.name!==e||this.isPaused===!1&&(this.isPaused=!0,this.trigger(`_pause`),this._idle=!0,this.trigger(`_idle`),this.audioController.pause())},B.prototype.togglePause=function(e){e&&this.name!==e||(this.isPaused===!0?this.play():this.pause())},B.prototype.stop=function(e){e&&this.name!==e||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},B.prototype.getMarkerData=function(e){for(var t,n=0;n=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(t>this.totalFrames?t%this.totalFrames:0)||(n=!0,t=this.totalFrames-1):t>=this.totalFrames?(this.playCount+=1,this.checkSegments(t%this.totalFrames)||(this.setCurrentRawFrameValue(t%this.totalFrames),this._completedLoop=!0,this.trigger(`loopComplete`))):this.setCurrentRawFrameValue(t):t<0?this.checkSegments(t%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+t%this.totalFrames),this._completedLoop?this.trigger(`loopComplete`):this._completedLoop=!0):(n=!0,t=0)):this.setCurrentRawFrameValue(t),n&&(this.setCurrentRawFrameValue(t),this.pause(),this.trigger(`complete`))}},B.prototype.adjustSegment=function(e,t){this.playCount=0,e[1]0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=e[0]-e[1],this.timeCompleted=this.totalFrames,this.firstFrame=e[1],this.setCurrentRawFrameValue(this.totalFrames-.001-t)):e[1]>e[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=e[1]-e[0],this.timeCompleted=this.totalFrames,this.firstFrame=e[0],this.setCurrentRawFrameValue(.001+t)),this.trigger(`segmentStart`)},B.prototype.setSegment=function(e,t){var n=-1;this.isPaused&&(this.currentRawFrame+this.firstFramet&&(n=t-e)),this.firstFrame=e,this.totalFrames=t-e,this.timeCompleted=this.totalFrames,n!==-1&&this.goToAndStop(n,!0)},B.prototype.playSegments=function(e,t){if(t&&(this.segments.length=0),xe(e[0])===`object`){var n,r=e.length;for(n=0;n=0;--n)t[n].animation.destroy(e)}function T(e,t,n){var r=[].concat([].slice.call(document.getElementsByClassName(`lottie`)),[].slice.call(document.getElementsByClassName(`bodymovin`))),i,a=r.length;for(i=0;i0?n=c:t=c;while(Math.abs(s)>a&&++l=i?g(e,d,t,n):f===0?d:h(e,a,a+c,t,n)}},e}(),we=function(){function e(e){return e.concat(m(e.length))}return{double:e}}(),Te=function(){return function(e,t,n){var r=0,i=e,a=m(i),o={newElement:s,release:c};function s(){var e;return r?(--r,e=a[r]):e=t(),e}function c(e){r===i&&(a=we.double(a),i*=2),n&&n(e),a[r]=e,r+=1}return o}}(),Ee=function(){function e(){return{addedLength:0,percents:p(`float32`,le()),lengths:p(`float32`,le())}}return Te(8,e)}(),De=function(){function e(){return{lengths:[],totalLength:0}}function t(e){var t,n=e.lengths.length;for(t=0;t-.001&&o<.001}function n(n,r,i,a,o,s,c,l,u){if(i===0&&s===0&&u===0)return t(n,r,a,o,c,l);var d=e.sqrt(e.pow(a-n,2)+e.pow(o-r,2)+e.pow(s-i,2)),f=e.sqrt(e.pow(c-n,2)+e.pow(l-r,2)+e.pow(u-i,2)),p=e.sqrt(e.pow(c-a,2)+e.pow(l-o,2)+e.pow(u-s,2)),m=d>f?d>p?d-f-p:p-f-d:p>f?p-f-d:f-d-p;return m>-1e-4&&m<1e-4}var r=function(){return function(e,t,n,r){var i=le(),a,o,s,c,l,u=0,d,f=[],p=[],m=Ee.newElement();for(s=n.length,a=0;ao?-1:1,l=!0;l;)if(r[a]<=o&&r[a+1]>o?(s=(o-r[a])/(r[a+1]-r[a]),l=!1):a+=c,a<0||a>=i-1){if(a===i-1)return n[a];l=!1}return n[a]+(n[a+1]-n[a])*s}function l(t,n,r,i,a,o){var s=c(a,o),l=1-s;return[e.round((l*l*l*t[0]+(s*l*l+l*s*l+l*l*s)*r[0]+(s*s*l+l*s*s+s*l*s)*i[0]+s*s*s*n[0])*1e3)/1e3,e.round((l*l*l*t[1]+(s*l*l+l*s*l+l*l*s)*r[1]+(s*s*l+l*s*s+s*l*s)*i[1]+s*s*s*n[1])*1e3)/1e3]}var u=p(`float32`,8);function d(t,n,r,i,a,o,s){a<0?a=0:a>1&&(a=1);var l=c(a,s);o=o>1?1:o;var d=c(o,s),f,p=t.length,m=1-l,h=1-d,g=m*m*m,_=l*m*m*3,v=l*l*m*3,y=l*l*l,b=m*m*h,x=l*m*h+m*l*h+m*m*d,S=l*l*h+m*l*d+l*m*d,C=l*l*d,w=m*h*h,T=l*h*h+m*d*h+m*h*d,E=l*d*h+m*d*d+l*h*d,D=l*d*d,O=h*h*h,k=d*h*h+h*d*h+h*h*d,A=d*d*h+h*d*d+d*h*d,j=d*d*d;for(f=0;f=l.t-n){c.h&&(c=l),i=0;break}if(l.t-n>e){i=a;break}a=v||e=v?x.points.length-1:0;for(f=x.points[S].point.length,d=0;d=T&&C=v)r[0]=b[0],r[1]=b[1],r[2]=b[2];else if(e<=y)r[0]=c.s[0],r[1]=c.s[1],r[2]=c.s[2];else{var j=Fe(c.s),M=Fe(b),N=(e-y)/(v-y);Pe(r,Ne(j,M,N))}else for(a=0;a=v?m=1:e1e-6?(f=Math.acos(p),m=Math.sin(f),h=Math.sin((1-n)*f)/m,g=Math.sin(n*f)/m):(h=1-n,g=n),r[0]=h*i+g*c,r[1]=h*a+g*l,r[2]=h*o+g*u,r[3]=h*s+g*d,r}function Pe(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=Math.atan2(2*r*a-2*n*i,1-2*r*r-2*i*i),s=Math.asin(2*n*r+2*i*a),c=Math.atan2(2*n*a-2*r*i,1-2*n*n-2*i*i);e[0]=o/D,e[1]=s/D,e[2]=c/D}function Fe(e){var t=e[0]*D,n=e[1]*D,r=e[2]*D,i=Math.cos(t/2),a=Math.cos(n/2),o=Math.cos(r/2),s=Math.sin(t/2),c=Math.sin(n/2),l=Math.sin(r/2),u=i*a*o-s*c*l;return[s*c*o+i*a*l,s*a*o+i*c*l,i*c*o-s*a*l,u]}function Ie(){var e=this.comp.renderedFrame-this.offsetTime,t=this.keyframes[0].t-this.offsetTime,n=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(e===this._caching.lastFrame||this._caching.lastFrame!==Ae&&(this._caching.lastFrame>=n&&e>=n||this._caching.lastFrame=e&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var r=this.interpolateValue(e,this._caching);this.pv=r}return this._caching.lastFrame=e,this.pv}function Le(e){var t;if(this.propType===`unidimensional`)t=e*this.mult,je(this.v-t)>1e-5&&(this.v=t,this._mdf=!0);else for(var n=0,r=this.v.length;n1e-5&&(this.v[n]=t,this._mdf=!0),n+=1}function Re(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var e,t=this.effectsSequence.length,n=this.kf?this.pv:this.data.k;for(e=0;e=this._maxLength&&this.doubleArrayLength(),n){case`v`:a=this.v;break;case`i`:a=this.i;break;case`o`:a=this.o;break;default:a=[];break}(!a[r]||a[r]&&!i)&&(a[r]=Ge.newElement()),a[r][0]=e,a[r][1]=t},Ke.prototype.setTripleAt=function(e,t,n,r,i,a,o,s){this.setXYAt(e,t,`v`,o,s),this.setXYAt(n,r,`o`,o,s),this.setXYAt(i,a,`i`,o,s)},Ke.prototype.reverse=function(){var e=new Ke;e.setPathData(this.c,this._length);var t=this.v,n=this.o,r=this.i,i=0;this.c&&(e.setTripleAt(t[0][0],t[0][1],r[0][0],r[0][1],n[0][0],n[0][1],0,!1),i=1);var a=this._length-1,o=this._length,s;for(s=i;s=p[p.length-1].t-this.offsetTime)i=p[p.length-1].s?p[p.length-1].s[0]:p[p.length-2].e[0],o=!0;else{for(var m=r,h=p.length-1,g=!0,_,v,y;g&&(_=p[m],v=p[m+1],!(v.t-this.offsetTime>e));)m=v.t-this.offsetTime)d=1;else if(e<_.t-this.offsetTime)d=0;else{var b;y.__fnct?b=y.__fnct:(b=Ce.getBezierEasing(_.o.x,_.o.y,_.i.x,_.i.y).get,y.__fnct=b),d=b((e-(_.t-this.offsetTime))/(v.t-this.offsetTime-(_.t-this.offsetTime)))}a=v.s?v.s[0]:_.e[0]}i=_.s[0]}for(l=t._length,u=i.i[0].length,n.lastIndex=r,s=0;sr&&t>r)||(this._caching.lastIndex=i0||e>-1e-6&&e<0?r(e*t)/t:e}function P(){var e=this.props,t=N(e[0]),n=N(e[1]),r=N(e[4]),i=N(e[5]),a=N(e[12]),o=N(e[13]);return`matrix(`+t+`,`+n+`,`+r+`,`+i+`,`+a+`,`+o+`)`}return function(){this.reset=i,this.rotate=a,this.rotateX=o,this.rotateY=s,this.rotateZ=c,this.skew=u,this.skewFromAxis=d,this.shear=l,this.scale=f,this.setTransform=m,this.translate=h,this.transform=g,this.multiply=_,this.applyToPoint=S,this.applyToX=C,this.applyToY=w,this.applyToZ=T,this.applyToPointArray=A,this.applyToTriplePoints=k,this.applyToPointStringified=j,this.toCSS=M,this.to2dCSS=P,this.clone=b,this.cloneFromProps=x,this.equals=y,this.inversePoints=O,this.inversePoint=D,this.getInverseMatrix=E,this._t=this.transform,this.isIdentity=v,this._identity=!0,this._identityCalculated=!1,this.props=p(`float32`,16),this.reset()}}();function Ze(e){"@babel/helpers - typeof";return Ze=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ze(e)}var Qe={},$e=`__[STANDALONE]__`,et=`__[ANIMATIONDATA]__`,tt=``;function nt(e){s(e)}function rt(){$e===!0?Se.searchAnimations(et,$e,tt):Se.searchAnimations()}function it(e){re(e)}function U(e){ue(e)}function at(e){return $e===!0&&(e.animationData=JSON.parse(et)),Se.loadAnimation(e)}function ot(e){if(typeof e==`string`)switch(e){case`high`:ce(200);break;default:case`medium`:ce(50);break;case`low`:ce(10);break}else!isNaN(e)&&e>1&&ce(e)}function W(){return typeof navigator<`u`}function st(e,t){e===`expressions`&&ae(t)}function ct(e){switch(e){case`propertyFactory`:return V;case`shapePropertyFactory`:return Xe;case`matrix`:return H;default:return null}}Qe.play=Se.play,Qe.pause=Se.pause,Qe.setLocationHref=nt,Qe.togglePause=Se.togglePause,Qe.setSpeed=Se.setSpeed,Qe.setDirection=Se.setDirection,Qe.stop=Se.stop,Qe.searchAnimations=rt,Qe.registerAnimation=Se.registerAnimation,Qe.loadAnimation=at,Qe.setSubframeRendering=it,Qe.resize=Se.resize,Qe.goToAndStop=Se.goToAndStop,Qe.destroy=Se.destroy,Qe.setQuality=ot,Qe.inBrowser=W,Qe.installPlugin=st,Qe.freeze=Se.freeze,Qe.unfreeze=Se.unfreeze,Qe.setVolume=Se.setVolume,Qe.mute=Se.mute,Qe.unmute=Se.unmute,Qe.getRegisteredAnimations=Se.getRegisteredAnimations,Qe.useWebWorker=a,Qe.setIDPrefix=U,Qe.__getFactory=ct,Qe.version=`5.13.0`;function lt(){document.readyState===`complete`&&(clearInterval(mt),rt())}function ut(e){for(var t=dt.split(`&`),n=0;n=1?a.push({s:e-1,e:t-1}):(a.push({s:e,e:1}),a.push({s:0,e:t-1}));var o=[],s,c=a.length,l;for(s=0;sr+n)){var u=l.s*i<=r?0:(l.s*i-r)/n,d=l.e*i>=r+n?1:(l.e*i-r)/n;o.push([u,d])}return o.length||o.push([0,0]),o},_t.prototype.releasePathsData=function(e){var t,n=e.length;for(t=0;t1?1+r:this.s.v<0?0+r:this.s.v+r,n=this.e.v>1?1+r:this.e.v<0?0+r:this.e.v+r,t>n){var i=t;t=n,n=i}t=Math.round(t*1e4)*1e-4,n=Math.round(n*1e4)*1e-4,this.sValue=t,this.eValue=n}else t=this.sValue,n=this.eValue;var a,o,s=this.shapes.length,c,l,u,d,f,p=0;if(n===t)for(o=0;o=0;--o)if(h=this.shapes[o],h.shape._mdf){for(g=h.localShapeCollection,g.releaseShapes(),this.m===2&&s>1?(b=this.calculateShapeEdges(t,n,h.totalShapeLength,y,p),y+=h.totalShapeLength):b=[[_,v]],l=b.length,c=0;c=1?m.push({s:h.totalShapeLength*(_-1),e:h.totalShapeLength*(v-1)}):(m.push({s:h.totalShapeLength*_,e:h.totalShapeLength}),m.push({s:0,e:h.totalShapeLength*(v-1)}));var x=this.addShapes(h,m[0]);if(m[0].s!==m[0].e){if(m.length>1)if(h.shape.paths.shapes[h.shape.paths._length-1].c){var S=x.pop();this.addPaths(x,g),x=this.addShapes(h,m[1],S)}else this.addPaths(x,g),x=this.addShapes(h,m[1]);this.addPaths(x,g)}}h.shape.paths=g}}else if(this._mdf)for(o=0;ot.e){n.c=!1;break}else t.s<=l&&t.e>=l+u.addedLength?(this.addSegment(i[a].v[s-1],i[a].o[s-1],i[a].i[s],i[a].v[s],n,d,g),g=!1):(p=ke.getNewSegment(i[a].v[s-1],i[a].v[s],i[a].o[s-1],i[a].i[s],(t.s-l)/u.addedLength,(t.e-l)/u.addedLength,f[s-1]),this.addSegmentFromArray(p,n,d,g),g=!1,n.c=!1),l+=u.addedLength,d+=1;if(i[a].c&&f.length){if(u=f[s-1],l<=t.e){var _=f[s-1].addedLength;t.s<=l&&t.e>=l+_?(this.addSegment(i[a].v[s-1],i[a].o[s-1],i[a].i[0],i[a].v[0],n,d,g),g=!1):(p=ke.getNewSegment(i[a].v[s-1],i[a].v[0],i[a].o[s-1],i[a].i[0],(t.s-l)/_,(t.e-l)/_,f[s-1]),this.addSegmentFromArray(p,n,d,g),g=!1,n.c=!1)}else n.c=!1;l+=u.addedLength,d+=1}if(n._length&&(n.setXYAt(n.v[h][0],n.v[h][1],`i`,h),n.setXYAt(n.v[n._length-1][0],n.v[n._length-1][1],`o`,n._length-1)),l>t.e)break;a=this.p.keyframes[this.p.keyframes.length-1].t?(r=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/n,0),i=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/n,0)):(r=this.p.pv,i=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/n,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){r=[],i=[];var a=this.px,o=this.py;a._caching.lastFrame+a.offsetTime<=a.keyframes[0].t?(r[0]=a.getValueAtTime((a.keyframes[0].t+.01)/n,0),r[1]=o.getValueAtTime((o.keyframes[0].t+.01)/n,0),i[0]=a.getValueAtTime(a.keyframes[0].t/n,0),i[1]=o.getValueAtTime(o.keyframes[0].t/n,0)):a._caching.lastFrame+a.offsetTime>=a.keyframes[a.keyframes.length-1].t?(r[0]=a.getValueAtTime(a.keyframes[a.keyframes.length-1].t/n,0),r[1]=o.getValueAtTime(o.keyframes[o.keyframes.length-1].t/n,0),i[0]=a.getValueAtTime((a.keyframes[a.keyframes.length-1].t-.01)/n,0),i[1]=o.getValueAtTime((o.keyframes[o.keyframes.length-1].t-.01)/n,0)):(r=[a.pv,o.pv],i[0]=a.getValueAtTime((a._caching.lastFrame+a.offsetTime-.01)/n,a.offsetTime),i[1]=o.getValueAtTime((o._caching.lastFrame+o.offsetTime-.01)/n,o.offsetTime))}else i=e,r=i;this.v.rotate(-Math.atan2(r[1]-i[1],r[0]-i[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function r(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function i(){}function a(e){this._addDynamicProperty(e),this.elem.addDynamicProperty(e),this._isDirty=!0}function o(e,t,n){if(this.elem=e,this.frameId=-1,this.propType=`transform`,this.data=t,this.v=new H,this.pre=new H,this.appliedTransformations=0,this.initDynamicPropertyContainer(n||e),t.p&&t.p.s?(this.px=V.getProp(e,t.p.x,0,0,this),this.py=V.getProp(e,t.p.y,0,0,this),t.p.z&&(this.pz=V.getProp(e,t.p.z,0,0,this))):this.p=V.getProp(e,t.p||{k:[0,0,0]},1,0,this),t.rx){if(this.rx=V.getProp(e,t.rx,0,D,this),this.ry=V.getProp(e,t.ry,0,D,this),this.rz=V.getProp(e,t.rz,0,D,this),t.or.k[0].ti){var r,i=t.or.k.length;for(r=0;r0;)--n,this._elements.unshift(t[n]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},bt.prototype.resetElements=function(e){var t,n=e.length;for(t=0;t0?Math.floor(f):Math.ceil(f),h=this.pMatrix.props,g=this.rMatrix.props,_=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var v=0;if(f>0){for(;vm;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),--v;p&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-p,!0),v-=p)}r=this.data.m===1?0:this._currentCopies-1,i=this.data.m===1?1:-1,a=this._currentCopies;for(var y,b;a;){if(t=this.elemsData[r].it,n=t[t.length-1].transform.mProps.v.props,b=n.length,t[t.length-1].transform.mProps._mdf=!0,t[t.length-1].transform.op._mdf=!0,t[t.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(r/(this._currentCopies-1)),v!==0){for((r!==0&&i===1||r!==this._currentCopies-1&&i===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]),this.matrix.transform(_[0],_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11],_[12],_[13],_[14],_[15]),this.matrix.transform(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]),y=0;y0&&r<1?[t]:[]:[t-r,t+r].filter(function(e){return e>0&&e<1})},Tt.prototype.split=function(e){if(e<=0)return[J(this.points[0]),this];if(e>=1)return[this,J(this.points[this.points.length-1])];var t=wt(this.points[0],this.points[1],e),n=wt(this.points[1],this.points[2],e),r=wt(this.points[2],this.points[3],e),i=wt(t,n,e),a=wt(n,r,e),o=wt(i,a,e);return[new Tt(this.points[0],t,i,o,!0),new Tt(o,a,r,this.points[3],!0)]};function Y(e,t){var n=e.points[0][t],r=e.points[e.points.length-1][t];if(n>r){var i=r;r=n,n=i}for(var a=K(3*e.a[t],2*e.b[t],e.c[t]),o=0;o0&&a[o]<1){var s=e.point(a[o])[t];sr&&(r=s)}return{min:n,max:r}}Tt.prototype.bounds=function(){return{x:Y(this,0),y:Y(this,1)}},Tt.prototype.boundingBox=function(){var e=this.bounds();return{left:e.x.min,right:e.x.max,top:e.y.min,bottom:e.y.max,width:e.x.max-e.x.min,height:e.y.max-e.y.min,cx:(e.x.max+e.x.min)/2,cy:(e.y.max+e.y.min)/2}};function X(e,t,n){var r=e.boundingBox();return{cx:r.cx,cy:r.cy,width:r.width,height:r.height,bez:e,t:(t+n)/2,t1:t,t2:n}}function Et(e){var t=e.bez.split(.5);return[X(t[0],e.t1,e.t),X(t[1],e.t,e.t2)]}function Dt(e,t){return Math.abs(e.cx-t.cx)*2=a||e.width<=r&&e.height<=r&&t.width<=r&&t.height<=r){i.push([e.t,t.t]);return}var o=Et(e),s=Et(t);Ot(o[0],s[0],n+1,r,i,a),Ot(o[0],s[1],n+1,r,i,a),Ot(o[1],s[0],n+1,r,i,a),Ot(o[1],s[1],n+1,r,i,a)}}Tt.prototype.intersections=function(e,t,n){t===void 0&&(t=2),n===void 0&&(n=7);var r=[];return Ot(X(this,0,1),X(e,0,1),0,t,r,n),r},Tt.shapeSegment=function(e,t){var n=(t+1)%e.length();return new Tt(e.v[t],e.o[t],e.i[n],e.v[n],!0)},Tt.shapeSegmentInverted=function(e,t){var n=(t+1)%e.length();return new Tt(e.v[n],e.i[n],e.o[t],e.v[t],!0)};function kt(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function At(e,t,n,r){var i=[e[0],e[1],1],a=[t[0],t[1],1],o=[n[0],n[1],1],s=[r[0],r[1],1],c=kt(kt(i,a),kt(o,s));return St(c[2])?null:[c[0]/c[2],c[1]/c[2]]}function jt(e,t,n){return[e[0]+Math.cos(t)*n,e[1]-Math.sin(t)*n]}function Mt(e,t){return Math.hypot(e[0]-t[0],e[1]-t[1])}function Nt(e,t){return G(e[0],t[0])&&G(e[1],t[1])}function Pt(){}u([gt],Pt),Pt.prototype.initModifierProperties=function(e,t){this.getValue=this.processKeys,this.amplitude=V.getProp(e,t.s,0,null,this),this.frequency=V.getProp(e,t.r,0,null,this),this.pointsType=V.getProp(e,t.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function Ft(e,t,n,r,i,a,o){var s=n-Math.PI/2,c=n+Math.PI/2,l=t[0]+Math.cos(n)*r*i,u=t[1]-Math.sin(n)*r*i;e.setTripleAt(l,u,l+Math.cos(s)*a,u-Math.sin(s)*a,l+Math.cos(c)*o,u-Math.sin(c)*o,e.length())}function It(e,t){var n=[t[0]-e[0],t[1]-e[1]],r=-Math.PI*.5;return[Math.cos(r)*n[0]-Math.sin(r)*n[1],Math.sin(r)*n[0]+Math.cos(r)*n[1]]}function Lt(e,t){var n=t===0?e.length()-1:t-1,r=(t+1)%e.length(),i=e.v[n],a=e.v[r],o=It(i,a);return Math.atan2(0,1)-Math.atan2(o[1],o[0])}function Rt(e,t,n,r,i,a,o){var s=Lt(t,n),c=t.v[n%t._length],l=t.v[n===0?t._length-1:n-1],u=t.v[(n+1)%t._length],d=a===2?Math.sqrt((c[0]-l[0])**2+(c[1]-l[1])**2):0,f=a===2?Math.sqrt((c[0]-u[0])**2+(c[1]-u[1])**2):0;Ft(e,t.v[n%t._length],s,o,r,f/((i+1)*2),d/((i+1)*2),a)}function zt(e,t,n,r,i,a){for(var o=0;o1&&t.length>1&&(i=Ut(e[0],t[t.length-1]),i)?[[e[0].split(i[0])[0]],[t[t.length-1].split(i[1])[1]]]:[n,r]}function Gt(e){for(var t,n=1;n1&&(t=Wt(e[e.length-1],e[0]),e[e.length-1]=t[0],e[0]=t[1]),e}function Kt(e,t){var n=e.inflectionPoints(),r,i,a,o;if(n.length===0)return[Vt(e,t)];if(n.length===1||G(n[1],1))return a=e.split(n[0]),r=a[0],i=a[1],[Vt(r,t),Vt(i,t)];a=e.split(n[0]),r=a[0];var s=(n[1]-n[0])/(1-n[0]);return a=a[1].split(s),o=a[0],i=a[1],[Vt(r,t),Vt(o,t),Vt(i,t)]}function qt(){}u([gt],qt),qt.prototype.initModifierProperties=function(e,t){this.getValue=this.processKeys,this.amount=V.getProp(e,t.a,0,null,this),this.miterLimit=V.getProp(e,t.ml,0,null,this),this.lineJoin=t.lj,this._isAnimated=this.amount.effectsSequence.length!==0},qt.prototype.processPath=function(e,t,n,r){var i=qe.newElement();i.c=e.c;var a=e.length();e.c||--a;var o,s,c,l=[];for(o=0;o=0;--o)c=Tt.shapeSegmentInverted(e,o),l.push(Kt(c,t));l=Gt(l);var u=null,d=null;for(o=0;o0&&(o=!1),o){var u=l(`style`);u.setAttribute(`f-forigin`,n[r].fOrigin),u.setAttribute(`f-origin`,n[r].origin),u.setAttribute(`f-family`,n[r].fFamily),u.type=`text/css`,u.innerText=`@font-face {font-family: `+n[r].fFamily+`; font-style: normal; src: url('`+n[r].fPath+`');}`,t.appendChild(u)}}else if(n[r].fOrigin===`g`||n[r].origin===1){for(s=document.querySelectorAll(`link[f-forigin="g"], link[f-origin="1"]`),c=0;c=55296&&n<=56319){var r=e.charCodeAt(1);r>=56320&&r<=57343&&(t=(n-55296)*1024+r-56320+65536)}return t}function S(e,t){var n=e.toString(16)+t.toString(16);return d.indexOf(n)!==-1}function C(e){return e===s}function w(e){return e===o}function T(e){var t=x(e);return t>=c&&t<=u}function E(e){return T(e.substr(0,2))&&T(e.substr(2,2))}function D(e){return t.indexOf(e)!==-1}function O(e,t){var o=x(e.substr(t,2));if(o!==n)return!1;var s=0;for(t+=2;s<5;){if(o=x(e.substr(t,2)),oa)return!1;s+=1,t+=2}return x(e.substr(t,2))===r}function k(){this.isLoaded=!0}var A=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};return A.isModifier=S,A.isZeroWidthJoiner=C,A.isFlagEmoji=E,A.isRegionalCode=T,A.isCombinedCharacter=D,A.isRegionalFlag=O,A.isVariationSelector=w,A.BLACK_FLAG_CODE_POINT=n,A.prototype={addChars:_,addFonts:g,getCharData:v,getFontByName:b,measureText:y,checkLoadedFonts:m,setIsLoaded:k},A}();function Xt(e){this.animationData=e}Xt.prototype.getProp=function(e){return this.animationData.slots&&this.animationData.slots[e.sid]?Object.assign(e,this.animationData.slots[e.sid].p):e};function Zt(e){return new Xt(e)}function Qt(){}Qt.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(e){this.renderableComponents.indexOf(e)===-1&&this.renderableComponents.push(e)},removeRenderableComponent:function(e){this.renderableComponents.indexOf(e)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(e),1)},prepareRenderableFrame:function(e){this.checkLayerLimits(e)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(e){this.data.ip-this.data.st<=e&&this.data.op-this.data.st>e?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var e,t=this.renderableComponents.length;for(e=0;e.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},pn.prototype.show=function(){},pn.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},pn.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},pn.prototype.resume=function(){this._canPlay=!0},pn.prototype.setRate=function(e){this.audio.rate(e)},pn.prototype.volume=function(e){this._volumeMultiplier=e,this._previousVolume=e*this._volume,this.audio.volume(this._previousVolume)},pn.prototype.getBaseElement=function(){return null},pn.prototype.destroy=function(){},pn.prototype.sourceRectAtTime=function(){},pn.prototype.initExpressions=function(){};function mn(){}mn.prototype.checkLayers=function(e){var t,n=this.layers.length,r;for(this.completeLayers=!0,t=n-1;t>=0;--t)this.elements[t]||(r=this.layers[t],r.ip-r.st<=e-this.layers[t].st&&r.op-r.st>e-this.layers[t].st&&this.buildItem(t)),this.completeLayers=this.elements[t]?this.completeLayers:!1;this.checkPendingElements()},mn.prototype.createItem=function(e){switch(e.ty){case 2:return this.createImage(e);case 0:return this.createComp(e);case 1:return this.createSolid(e);case 3:return this.createNull(e);case 4:return this.createShape(e);case 5:return this.createText(e);case 6:return this.createAudio(e);case 13:return this.createCamera(e);case 15:return this.createFootage(e);default:return this.createNull(e)}},mn.prototype.createCamera=function(){throw Error(`You're using a 3d camera. Try the html renderer.`)},mn.prototype.createAudio=function(e){return new pn(e,this.globalData,this)},mn.prototype.createFootage=function(e){return new fn(e,this.globalData,this)},mn.prototype.buildAllItems=function(){var e,t=this.layers.length;for(e=0;e0&&(this.maskElement.setAttribute(`id`,p),this.element.maskedElement.setAttribute(b,`url(`+c()+`#`+p+`)`),r.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}_n.prototype.getMaskProperty=function(e){return this.viewData[e].prop},_n.prototype.renderFrame=function(e){var t=this.element.finalTransform.mat,n,r=this.masksProperties.length;for(n=0;n1&&(r+=` C`+t.o[i-1][0]+`,`+t.o[i-1][1]+` `+t.i[0][0]+`,`+t.i[0][1]+` `+t.v[0][0]+`,`+t.v[0][1]),n.lastPath!==r){var o=``;n.elem&&(t.c&&(o=e.inv?this.solidPath+r:r),n.elem.setAttribute(`d`,o)),n.lastPath=r}},_n.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var vn=function(){var e={};e.createFilter=t,e.createAlphaToLuminanceFilter=n;function t(e,t){var n=z(`filter`);return n.setAttribute(`id`,e),t!==!0&&(n.setAttribute(`filterUnits`,`objectBoundingBox`),n.setAttribute(`x`,`0%`),n.setAttribute(`y`,`0%`),n.setAttribute(`width`,`100%`),n.setAttribute(`height`,`100%`)),n}function n(){var e=z(`feColorMatrix`);return e.setAttribute(`type`,`matrix`),e.setAttribute(`color-interpolation-filters`,`sRGB`),e.setAttribute(`values`,`0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1`),e}return e}(),yn=function(){var e={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<`u`};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(e.maskType=!1),/firefox/i.test(navigator.userAgent)&&(e.svgLumaHidden=!1),e}(),bn={},xn=`filter_result_`;function Sn(e){var t,n=`SourceGraphic`,r=e.data.ef?e.data.ef.length:0,i=I(),a=vn.createFilter(i,!0),o=0;this.filters=[];var s;for(t=0;t=0&&(n=this.shapeModifiers[e].processShapes(this._isFirstFrame),!n);--e);}},searchProcessedElement:function(e){for(var t=this.processedElements,n=0,r=t.length;n.01)return!1;n+=1}return!0},Ln.prototype.checkCollapsable=function(){if(this.o.length/2!=this.c.length/4)return!1;if(this.data.k.k[0].s)for(var e=0,t=this.data.k.k.length;e0;)c=r.transformers[g].mProps._mdf||c,--h,--g;if(c)for(h=f-r.styles[u].lvl,g=r.transformers.length-1;h>0;)m.multiply(r.transformers[g].mProps.v),--h,--g}else m=e;if(p=r.sh.paths,o=p._length,c){for(s=``,a=0;a=1?v=.99:v<=-1&&(v=-.99);var y=g*v,b=Math.cos(_+t.a.v)*y+a[0],x=Math.sin(_+t.a.v)*y+a[1];r.setAttribute(`fx`,b),r.setAttribute(`fy`,x),i&&!t.g._collapsable&&(t.of.setAttribute(`fx`,b),t.of.setAttribute(`fy`,x))}}}function u(e,t,n){var r=t.style,i=t.d;i&&(i._mdf||n)&&i.dashStr&&(r.pElem.setAttribute(`stroke-dasharray`,i.dashStr),r.pElem.setAttribute(`stroke-dashoffset`,i.dashoffset[0])),t.c&&(t.c._mdf||n)&&r.pElem.setAttribute(`stroke`,`rgb(`+C(t.c.v[0])+`,`+C(t.c.v[1])+`,`+C(t.c.v[2])+`)`),(t.o._mdf||n)&&r.pElem.setAttribute(`stroke-opacity`,t.o.v),(t.w._mdf||n)&&(r.pElem.setAttribute(`stroke-width`,t.w.v),r.msElem&&r.msElem.setAttribute(`stroke-width`,t.w.v))}return n}();function Wn(e,t,n){this.shapes=[],this.shapesData=e.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(e,t,n),this.prevViewData=[]}u([un,gn,Cn,On,wn,dn,Tn],Wn),Wn.prototype.initSecondaryElement=function(){},Wn.prototype.identityMatrix=new H,Wn.prototype.buildExpressionInterface=function(){},Wn.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},Wn.prototype.filterUniqueShapes=function(){var e,t=this.shapes.length,n,r,i=this.stylesList.length,a,o=[],s=!1;for(r=0;r1&&s&&this.setShapesAsAnimated(o)}},Wn.prototype.setShapesAsAnimated=function(e){var t,n=e.length;for(t=0;t=0;--c){if(g=this.searchProcessedElement(e[c]),g?t[c]=n[g-1]:e[c]._render=o,e[c].ty===`fl`||e[c].ty===`st`||e[c].ty===`gf`||e[c].ty===`gs`||e[c].ty===`no`)g?t[c].style.closed=e[c].hd:t[c]=this.createStyleElement(e[c],i),e[c]._render&&t[c].style.pElem.parentNode!==r&&r.appendChild(t[c].style.pElem),f.push(t[c].style);else if(e[c].ty===`gr`){if(!g)t[c]=this.createGroupElement(e[c]);else for(d=t[c].it.length,u=0;u1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},Kn.prototype.addEffect=function(e){this.effectsSequence.push(e),this.elem.addDynamicProperty(this)},Kn.prototype.getValue=function(e){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!e)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var t=this.currentData,n=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var r,i=this.effectsSequence.length,a=e||this.data.d.k[this.keysIndex].s;for(r=0;rt);)n+=1;return this.keysIndex!==n&&(this.keysIndex=n),this.data.d.k[this.keysIndex].s},Kn.prototype.buildFinalText=function(e){for(var t=[],n=0,r=e.length,i,a,o=!1,s=!1,c=``;n=55296&&i<=56319?Yt.isRegionalFlag(e,n)?c=e.substr(n,14):(a=e.charCodeAt(n+1),a>=56320&&a<=57343&&(Yt.isModifier(i,a)?(c=e.substr(n,2),o=!0):c=Yt.isFlagEmoji(e.substr(n,4))?e.substr(n,4):e.substr(n,2))):i>56319?(a=e.charCodeAt(n+1),Yt.isVariationSelector(i)&&(o=!0)):Yt.isZeroWidthJoiner(i)&&(o=!0,s=!0),o?(t[t.length-1]+=c,o=!1):t.push(c),n+=c.length;return t},Kn.prototype.completeTextData=function(e){e.__complete=!0;var t=this.elem.globalData.fontManager,n=this.data,r=[],i,a,o,s=0,c,l=n.m.g,u=0,d=0,f=0,p=[],m=0,h=0,g,_,v=t.getFontByName(e.f),y,b=0,x=Jt(v);e.fWeight=x.weight,e.fStyle=x.style,e.finalSize=e.s,e.finalText=this.buildFinalText(e.t),a=e.finalText.length,e.finalLineHeight=e.lh;var S=e.tr/1e3*e.finalSize,C;if(e.sz)for(var w=!0,T=e.sz[0],E=e.sz[1],D,O;w;){O=this.buildFinalText(e.t),D=0,m=0,a=O.length,S=e.tr/1e3*e.finalSize;var k=-1;for(i=0;iT&&O[i]!==` `?(k===-1?a+=1:i=k,D+=e.finalLineHeight||e.finalSize*1.2,O.splice(i,+(k===i),`\r`),k=-1,m=0):(m+=b,m+=S);D+=v.ascent*e.finalSize/100,this.canResize&&e.finalSize>this.minimumFontSize&&Eh?m:h,m=-2*S,c=``,o=!0,f+=1):c=j,t.chars?(y=t.getCharData(j,v.fStyle,t.getFontByName(e.f).fFamily),b=o?0:y.w*e.finalSize/100):b=t.measureText(c,e.f,e.finalSize),j===` `?A+=b+S:(m+=b+S+A,A=0),r.push({l:b,an:b,add:u,n:o,anIndexes:[],val:c,line:f,animatorJustifyOffset:0}),l==2){if(u+=b,c===``||c===` `||i===a-1){for((c===``||c===` `)&&(u-=b);d<=i;)r[d].an=u,r[d].ind=s,r[d].extra=b,d+=1;s+=1,u=0}}else if(l==3){if(u+=b,c===``||i===a-1){for(c===``&&(u-=b);d<=i;)r[d].an=u,r[d].ind=s,r[d].extra=b,d+=1;u=0,s+=1}}else r[s].ind=s,r[s].extra=0,s+=1;if(e.l=r,h=m>h?m:h,p.push(m),e.sz)e.boxWidth=e.sz[0],e.justifyOffset=0;else switch(e.boxWidth=h,e.j){case 1:e.justifyOffset=-e.boxWidth;break;case 2:e.justifyOffset=-e.boxWidth/2;break;default:e.justifyOffset=0}e.lineWidths=p;var M=n.a,N,P;_=M.length;var F,I,L=[];for(g=0;g<_;g+=1){for(N=M[g],N.a.sc&&(e.strokeColorAnim=!0),N.a.sw&&(e.strokeWidthAnim=!0),(N.a.fc||N.a.fh||N.a.fs||N.a.fb)&&(e.fillColorAnim=!0),I=0,F=N.s.b,i=0;i0?i=this.ne.v/100:a=-this.ne.v/100,this.xe.v>0?o=1-this.xe.v/100:s=1+this.xe.v/100;var c=Ce.getBezierEasing(i,a,o,s).get,l=0,u=this.finalS,d=this.finalE,f=this.data.sh;if(f===2)l=d===u?+(r>=d):e(0,t(.5/(d-u)+(r-u)/(d-u),1)),l=c(l);else if(f===3)l=d===u?r>=d?0:1:1-e(0,t(.5/(d-u)+(r-u)/(d-u),1)),l=c(l);else if(f===4)d===u?l=0:(l=e(0,t(.5/(d-u)+(r-u)/(d-u),1)),l<.5?l*=2:l=1-2*(l-.5)),l=c(l);else if(f===5){if(d===u)l=0;else{var p=d-u;r=t(e(0,r+.5-u),d-u);var m=-p/2+r,h=p/2;l=Math.sqrt(1-m*m/(h*h))}l=c(l)}else f===6?(d===u?l=0:(r=t(e(0,r+.5-u),d-u),l=(1+Math.cos(Math.PI+Math.PI*2*r/(d-u)))/2),l=c(l)):(r>=n(u)&&(l=r-u<0?e(0,t(t(d,1)-(u-r),1)):e(0,t(d-r,1))),l=c(l));if(this.sm.v!==100){var g=this.sm.v*.01;g===0&&(g=1e-8);var _=.5-g*.5;l<_?l=0:(l=(l-_)/g,l>1&&(l=1))}return l*this.a.v},getValue:function(e){this.iterateDynamicProperties(),this._mdf=e||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,e&&this.data.r===2&&(this.e.v=this._currentTextLength);var t=this.data.r===2?1:100/this.data.totalChars,n=this.o.v/t,r=this.s.v/t+n,i=this.e.v/t+n;if(r>i){var a=r;r=i,i=a}this.finalS=r,this.finalE=i}},u([We],r);function i(e,t,n){return new r(e,t,n)}return{getTextSelectorProp:i}}();function Jn(e,t,n){var r={propType:!1},i=V.getProp,a=t.a;this.a={r:a.r?i(e,a.r,0,D,n):r,rx:a.rx?i(e,a.rx,0,D,n):r,ry:a.ry?i(e,a.ry,0,D,n):r,sk:a.sk?i(e,a.sk,0,D,n):r,sa:a.sa?i(e,a.sa,0,D,n):r,s:a.s?i(e,a.s,1,.01,n):r,a:a.a?i(e,a.a,1,0,n):r,o:a.o?i(e,a.o,0,.01,n):r,p:a.p?i(e,a.p,1,0,n):r,sw:a.sw?i(e,a.sw,0,0,n):r,sc:a.sc?i(e,a.sc,1,0,n):r,fc:a.fc?i(e,a.fc,1,0,n):r,fh:a.fh?i(e,a.fh,0,0,n):r,fs:a.fs?i(e,a.fs,0,.01,n):r,fb:a.fb?i(e,a.fb,0,.01,n):r,t:a.t?i(e,a.t,0,0,n):r},this.s=qn.getTextSelectorProp(e,t.s,n),this.s.t=t.s.t}function Yn(e,t,n){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=e,this._renderType=t,this._elem=n,this._animatorsData=m(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(n)}Yn.prototype.searchProperties=function(){var e,t=this._textData.a.length,n,r=V.getProp;for(e=0;e=m+we||!x?(T=(m+we-g)/h.partialLength,ie=b.point[0]+(h.point[0]-b.point[0])*T,ae=b.point[1]+(h.point[1]-b.point[1])*T,a.translate(-n[0]*f[u].an*.005,-(n[1]*A)*.01),_=!1):x&&(g+=h.partialLength,v+=1,v>=x.length&&(v=0,y+=1,S[y]?x=S[y].points:D.v.c?(v=0,y=0,x=S[y].points):(g-=h.partialLength,x=null)),x&&(b=h,h=x[v],C=h.partialLength));re=f[u].an/2-f[u].add,a.translate(-re,0,0)}else re=f[u].an/2-f[u].add,a.translate(-re,0,0),a.translate(-n[0]*f[u].an*.005,-n[1]*A*.01,0);for(P=0;Pe?this.textSpans[e].span:z(s?`g`:`text`),b<=e){if(c.setAttribute(`stroke-linecap`,`butt`),c.setAttribute(`stroke-linejoin`,`round`),c.setAttribute(`stroke-miterlimit`,`4`),this.textSpans[e].span=c,s){var S=z(`g`);c.appendChild(S),this.textSpans[e].childSpan=S}this.textSpans[e].span=c,this.layerElement.appendChild(c)}c.style.display=`inherit`}if(l.reset(),d&&(o[e].n&&(f=-g,p+=n.yOffset,p+=+!!h,h=!1),this.applyTextPropertiesToMatrix(n,l,o[e].line,f,p),f+=o[e].l||0,f+=g),s){x=this.globalData.fontManager.getCharData(n.finalText[e],r.fStyle,this.globalData.fontManager.getFontByName(n.f).fFamily);var C;if(x.t===1)C=new rr(x.data,this.globalData,this);else{var w=Zn;x.data&&x.data.shapes&&(w=this.buildShapeData(x.data,n.finalSize)),C=new Wn(w,this.globalData,this)}if(this.textSpans[e].glyph){var T=this.textSpans[e].glyph;this.textSpans[e].childSpan.removeChild(T.layerElement),T.destroy()}this.textSpans[e].glyph=C,C._debug=!0,C.prepareFrame(0),C.renderFrame(),this.textSpans[e].childSpan.appendChild(C.layerElement),x.t===1&&this.textSpans[e].childSpan.setAttribute(`transform`,`scale(`+n.finalSize/100+`,`+n.finalSize/100+`)`)}else d&&c.setAttribute(`transform`,`translate(`+l.props[12]+`,`+l.props[13]+`)`),c.textContent=o[e].val,c.setAttributeNS(`http://www.w3.org/XML/1998/namespace`,`xml:space`,`preserve`)}d&&c&&c.setAttribute(`d`,u)}for(;e=0;--t)(this.completeLayers||this.elements[t])&&this.elements[t].prepareFrame(e-this.layers[t].st);if(this.globalData._mdf)for(t=0;t=0;--n)(this.completeLayers||this.elements[n])&&(this.elements[n].prepareFrame(this.renderedFrame-this.layers[n].st),this.elements[n]._mdf&&(this._mdf=!0))}},nr.prototype.renderInnerContent=function(){var e,t=this.layers.length;for(e=0;e=0;--n)e.finalTransform.multiply(e.transforms[n].transform.mProps.v);e._mdf=i},processSequences:function(e){var t,n=this.sequenceList.length;for(t=0;t=1){this.buffers=[];var e=this.globalData.canvasContext,t=cr.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(t);var n=cr.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(n),this.data.tt>=3&&!document._isProxy&&cr.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new ur(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var e=this.globalData;if(e.blendMode!==this.data.bm){e.blendMode=this.data.bm;var t=$t(this.data.bm);e.canvasContext.globalCompositeOperation=t}},createRenderableComponents:function(){this.maskManager=new dr(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(hn.TRANSFORM_EFFECT)},hideElement:function(){!this.hidden&&(!this.isInRange||this.isTransparent)&&(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(e){e.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var e=this.buffers[0].getContext(`2d`);this.clearCanvas(e),e.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var e=this.buffers[1],t=e.getContext(`2d`);if(this.clearCanvas(t),t.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform),this.comp.getElementById(`tp`in this.data?this.data.tp:this.data.ind-1).renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var n=cr.getLumaCanvas(this.canvasContext.canvas);n.getContext(`2d`).drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(n,0,0)}this.canvasContext.globalCompositeOperation=pr[this.data.tt],this.canvasContext.drawImage(e,0,0),this.canvasContext.globalCompositeOperation=`destination-over`,this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation=`source-over`}},renderFrame:function(e){if(!(this.hidden||this.data.hd)&&!(this.data.td===1&&!e)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var t=this.data.ty===0;this.prepareLayer(),this.globalData.renderer.save(t),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(t),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&=!1}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new H},fr.prototype.hide=fr.prototype.hideElement,fr.prototype.show=fr.prototype.showElement;function mr(e,t,n,r){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var i=4;t.ty===`rc`?i=5:t.ty===`el`?i=6:t.ty===`sr`&&(i=7),this.sh=Xe.getShapeProp(e,t,i,e);var a,o=n.length,s;for(a=0;a=0;--a){if(d=this.searchProcessedElement(e[a]),d?t[a]=n[d-1]:e[a]._shouldRender=r,e[a].ty===`fl`||e[a].ty===`st`||e[a].ty===`gf`||e[a].ty===`gs`)d?t[a].style.closed=!1:t[a]=this.createStyleElement(e[a],m),l.push(t[a].style);else if(e[a].ty===`gr`){if(!d)t[a]=this.createGroupElement(e[a]);else for(c=t[a].it.length,s=0;s=0;--i)t[i].ty===`tr`?(o=n[i].transform,this.renderShapeTransform(e,o)):t[i].ty===`sh`||t[i].ty===`el`||t[i].ty===`rc`||t[i].ty===`sr`?this.renderPath(t[i],n[i]):t[i].ty===`fl`?this.renderFill(t[i],n[i],o):t[i].ty===`st`?this.renderStroke(t[i],n[i],o):t[i].ty===`gf`||t[i].ty===`gs`?this.renderGradientFill(t[i],n[i],o):t[i].ty===`gr`?this.renderShape(o,t[i].it,n[i].it):t[i].ty;r&&this.drawLayer()},hr.prototype.renderStyledShape=function(e,t){if(this._isFirstFrame||t._mdf||e.transforms._mdf){var n=e.trNodes,r=t.paths,i,a,o,s=r._length;n.length=0;var c=e.transforms.finalTransform;for(o=0;o=1?u=.99:u<=-1&&(u=-.99);var d=c*u,f=Math.cos(l+t.a.v)*d+o[0],p=Math.sin(l+t.a.v)*d+o[1];i=a.createRadialGradient(f,p,0,o[0],o[1],c)}var m,h=e.g.p,g=t.g.c,_=1;for(m=0;ma&&c===`xMidYMid slice`||ii&&s===`meet`||ai&&s===`slice`)?this.transformCanvas.tx=(n-this.transformCanvas.w*(r/this.transformCanvas.h))/2*this.renderConfig.dpr:l===`xMax`&&(ai&&s===`slice`)?this.transformCanvas.tx=(n-this.transformCanvas.w*(r/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,u===`YMid`&&(a>i&&s===`meet`||ai&&s===`meet`||a=0;--e)this.elements[e]&&this.elements[e].destroy&&this.elements[e].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},Q.prototype.renderFrame=function(e,t){if(!(this.renderedFrame===e&&this.renderConfig.clearCanvas===!0&&!t||this.destroyed||e===-1)){this.renderedFrame=e,this.globalData.frameNum=e-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||t,this.globalData.projectInterface.currentFrame=e;var n,r=this.layers.length;for(this.completeLayers||this.checkLayers(e),n=r-1;n>=0;--n)(this.completeLayers||this.elements[n])&&this.elements[n].prepareFrame(e-this.layers[n].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),n=r-1;n>=0;--n)(this.completeLayers||this.elements[n])&&this.elements[n].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},Q.prototype.buildItem=function(e){var t=this.elements;if(!(t[e]||this.layers[e].ty===99)){var n=this.createItem(this.layers[e],this,this.globalData);t[e]=n,n.initExpressions()}},Q.prototype.checkPendingElements=function(){for(;this.pendingElements.length;)this.pendingElements.pop().checkParenting()},Q.prototype.hide=function(){this.animationItem.container.style.display=`none`},Q.prototype.show=function(){this.animationItem.container.style.display=`block`};function yr(){this.opacity=-1,this.transform=p(`float32`,16),this.fillStyle=``,this.strokeStyle=``,this.lineWidth=``,this.lineCap=``,this.lineJoin=``,this.miterLimit=``,this.id=Math.random()}function br(){this.stack=[],this.cArrPos=0,this.cTr=new H;var e,t=15;for(e=0;e=0;--t)(this.completeLayers||this.elements[t])&&this.elements[t].renderFrame()},xr.prototype.destroy=function(){var e;for(e=this.layers.length-1;e>=0;--e)this.elements[e]&&this.elements[e].destroy();this.layers=null,this.elements=null},xr.prototype.createComp=function(e){return new xr(e,this.globalData,this)};function Sr(e,t){this.animationItem=e,this.renderConfig={clearCanvas:t&&t.clearCanvas!==void 0?t.clearCanvas:!0,context:t&&t.context||null,progressiveLoad:t&&t.progressiveLoad||!1,preserveAspectRatio:t&&t.preserveAspectRatio||`xMidYMid meet`,imagePreserveAspectRatio:t&&t.imagePreserveAspectRatio||`xMidYMid slice`,contentVisibility:t&&t.contentVisibility||`visible`,className:t&&t.className||``,id:t&&t.id||``,runExpressions:!t||t.runExpressions===void 0||t.runExpressions},this.renderConfig.dpr=t&&t.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=t&&t.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new br,this.elements=[],this.pendingElements=[],this.transformMat=new H,this.completeLayers=!1,this.rendererType=`canvas`,this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}return u([Q],Sr),Sr.prototype.createComp=function(e){return new xr(e,this.globalData,this)},ve(`canvas`,Sr),ht.registerModifier(`tm`,_t),ht.registerModifier(`pb`,vt),ht.registerModifier(`rp`,bt),ht.registerModifier(`rd`,xt),ht.registerModifier(`zz`,Pt),ht.registerModifier(`op`,qt),Qe}))}))(),1),Qn=0,$n=e=>`${e}-${++Qn}`,er=[{center:`#6f5bea`,edge:`#34278f`,pattern:`#a89df5`,text:`#ffffff`},{center:`#32a86b`,edge:`#17613e`,pattern:`#8ee0b3`,text:`#ffffff`},{center:`#df8d2f`,edge:`#8c421e`,pattern:`#ffd08a`,text:`#ffffff`},{center:`#d95878`,edge:`#7b2944`,pattern:`#f5a1b6`,text:`#ffffff`}];function tr(e){if(!e.length)return e;let t=Math.floor(1e3/e.length),n=1e3%e.length;return e.map((e,r)=>({...e,rarity:String(t+ +(r({key:$n(e),name:``,rarity:`1`,sortOrder:String(t),file:null,animation:null,fileError:``});function rr(e){let t=e.reduce((e,t)=>{let n=Number(t.backdropID);return Number.isInteger(n)?Math.max(e,n):e},0)+1,n=er[e.length%er.length];return{key:$n(`backdrop`),name:``,backdropID:String(t),rarity:`1`,sortOrder:String(e.length),...n}}var ir=e=>tr([nr(e,0),nr(e,1)]),ar=()=>{let e=rr([]);return tr([e,rr([e])])};function or({data:e,compact:t=!1}){let n=(0,g.useRef)(null);return(0,g.useEffect)(()=>{if(!n.current)return;let t=Zn.default.loadAnimation({container:n.current,renderer:`canvas`,loop:!0,autoplay:!0,animationData:structuredClone(e)});return()=>t.destroy()},[e]),(0,G.jsx)(`div`,{className:`collectible-animation ${t?`compact`:``}`,ref:n})}function sr({giftID:e,attribute:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(!1);return(0,g.useEffect)(()=>{let n=!1;return a(!1),k.giftCollectibleAnimation(e,t.kind,t.id).then(e=>{n||r(e)}).catch(()=>{n||a(!0)}),()=>{n=!0}},[e,t.id,t.kind]),i?(0,G.jsx)(`div`,{className:`collectible-animation compact failed`,children:`!`}):n?(0,G.jsx)(or,{data:n,compact:!0}):(0,G.jsx)(`div`,{className:`collectible-animation compact loading`,children:(0,G.jsx)(R,{className:`spin`,size:15})})}async function cr(e){let t=new Uint8Array(await e.arrayBuffer()),n=t;if(t.length>=2&&t[0]===31&&t[1]===139){if(!(`DecompressionStream`in window))throw Error(`This browser cannot preview TGS files`);let e=new Blob([t]).stream().pipeThrough(new DecompressionStream(`gzip`));n=new Uint8Array(await new Response(e).arrayBuffer())}let r=JSON.parse(new TextDecoder().decode(n));if(!r||typeof r!=`object`||Array.isArray(r))throw Error(`Invalid Lottie JSON`);return r}var lr=e=>Number.parseInt(e.replace(`#`,``),16),ur=e=>e.rarity_kind===`permille`?`${e.rarity_permille}‰`:e.rarity_kind,dr={models:`Models`,patterns:`Patterns`},fr={model:`Model`,pattern:`Pattern`,backdrop:`Backdrop`},pr={center:`Center`,edge:`Edge`,pattern:`Pattern`,text:`Text`};function mr({gift:e,onClose:t,onPublished:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(!0),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(`100`),[h,_]=(0,g.useState)(`1000`),[v,y]=(0,g.useState)(`gift-${e.GiftID}`),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)(()=>ir(`model`)),[w,T]=(0,g.useState)(()=>ir(`pattern`)),[E,D]=(0,g.useState)(ar);(0,g.useEffect)(()=>{let t=!1;return k.giftCollectibles(e.GiftID).then(n=>{t||(i(n),n.found&&(m(String(n.upgrade_stars??100)),_(String(n.supply_total??1e3)),y(n.slug_prefix??`gift-${e.GiftID}`)))}).catch(e=>u(O(e))).finally(()=>{t||o(!1)}),()=>{t=!0}},[e.GiftID]);let A=(0,g.useMemo)(()=>({models:S.reduce((e,t)=>e+Number(t.rarity||0),0),patterns:w.reduce((e,t)=>e+Number(t.rarity||0),0),backdrops:E.reduce((e,t)=>e+Number(t.rarity||0),0)}),[S,w,E]),j=()=>f(null),M=(e,t,n)=>{(e===`models`?C:T)(e=>e.map(e=>e.key===t?{...e,...n}:e)),j()};async function N(e,t,n){if(M(e,t.key,{file:n,animation:null,fileError:``}),n)try{let r=await cr(n);M(e,t.key,{animation:r,fileError:``})}catch(n){M(e,t.key,{animation:null,fileError:O(n)})}}function P(e,t=``){if(!b.trim())throw Error(`Please enter an operation reason`);if(S.length<2||w.length<2||E.length<2)throw Error(`Models, patterns, and backdrops must each contain at least two attributes.`);let n=E.map(e=>Number(e.backdropID));if(new Set(n).size!==n.length)throw Error(`Backdrop IDs must be unique within the pool.`);for(let e of[...S,...w])if(!e.file)throw Error(`Every model and pattern needs a TGS or Lottie file.`);let r=new FormData,i=e=>e.map(e=>({name:e.name.trim(),rarity_permille:Number(e.rarity),sort_order:Number(e.sortOrder),file_key:e.key}));r.set(`metadata`,JSON.stringify({command_id:t,reason:b.trim(),confirm:e,upgrade_stars:p,supply_total:Number(h),slug_prefix:v.trim().toLowerCase(),models:i(S),patterns:i(w),backdrops:E.map(e=>({name:e.name.trim(),backdrop_id:Number(e.backdropID),rarity_permille:Number(e.rarity),sort_order:Number(e.sortOrder),center_color:lr(e.center),edge_color:lr(e.edge),pattern_color:lr(e.pattern),text_color:lr(e.text)}))}));for(let e of[...S,...w])r.set(e.key,e.file,e.file.name);return r}async function F(){c(!0),u(``),f(null);try{f(await k.publishGiftCollectibles(e.GiftID,P(!1)))}catch(e){u(O(e))}finally{c(!1)}}async function I(){if(d){c(!0),u(``);try{await k.publishGiftCollectibles(e.GiftID,P(!0,d.command_id)),n(),t()}catch(e){u(O(e))}finally{c(!1)}}}let ee=(e,t,n)=>(0,G.jsxs)(`section`,{className:`collectible-section`,children:[(0,G.jsxs)(`div`,{className:`collectible-section-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:dr[e]}),(0,G.jsx)(`span`,{children:`Permille values are relative regular-upgrade weights; their total does not need to equal 1000.`})]}),(0,G.jsxs)(`div`,{className:`collectible-section-tools`,children:[(0,G.jsxs)(J,{tone:A[e]>0?`good`:`neutral`,children:[A[e],`‰`]}),(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>{n(tr([...t,nr(e===`models`?`model`:`pattern`,t.length)])),j()},children:[(0,G.jsx)(Pe,{size:13}),`Add`]})]})]}),(0,G.jsx)(`div`,{className:`collectible-rows`,children:t.map((r,i)=>(0,G.jsxs)(`div`,{className:`collectible-row animated`,children:[(0,G.jsx)(`div`,{className:`collectible-row-index`,children:i+1}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Name`}),(0,G.jsx)(`input`,{value:r.name,maxLength:128,onChange:t=>M(e,r.key,{name:t.target.value})})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Rarity ‰`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,max:`1000`,value:r.rarity,onChange:t=>M(e,r.key,{rarity:t.target.value})})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Sort order`}),(0,G.jsx)(`input`,{type:`number`,value:r.sortOrder,onChange:t=>M(e,r.key,{sortOrder:t.target.value})})]}),(0,G.jsxs)(`label`,{className:`collectible-file`,children:[(0,G.jsx)(`span`,{children:`Animation file`}),(0,G.jsx)(`input`,{type:`file`,accept:`.tgs,.json,.lottie,application/json,application/x-tgsticker`,onChange:t=>void N(e,r,t.target.files?.[0]??null)}),(0,G.jsxs)(`em`,{children:[(0,G.jsx)(ve,{size:13}),r.file?.name??`Choose file`]})]}),(0,G.jsx)(`div`,{className:`collectible-inline-preview`,children:r.animation?(0,G.jsx)(or,{data:r.animation,compact:!0}):(0,G.jsx)(ne,{size:16})}),(0,G.jsx)(`button`,{className:`icon-btn danger`,type:`button`,disabled:t.length<=2,onClick:()=>{n(tr(t.filter(e=>e.key!==r.key))),j()},"aria-label":`Remove attribute`,children:(0,G.jsx)(H,{size:14})}),r.fileError&&(0,G.jsx)(`span`,{className:`collectible-file-error`,children:r.fileError})]},r.key))})]});return(0,tn.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal collectible-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`Collectible pool · Gift #${e.GiftID}`,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`Unique gift attributes`}),(0,G.jsx)(`h2`,{children:`Collectible pool · Gift #${e.GiftID}`}),(0,G.jsx)(`p`,{children:e.Title||`Gift #${e.GiftID}`})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:t,disabled:s,"aria-label":`Close`,children:(0,G.jsx)(rt,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body collectible-modal-body`,children:[a?(0,G.jsxs)(`div`,{className:`collectible-loading`,children:[(0,G.jsx)(R,{className:`spin`}),`Loading`]}):r?.found?(0,G.jsxs)(`section`,{className:`collectible-active`,children:[(0,G.jsxs)(`div`,{className:`collectible-active-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(xe,{size:18}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Published revision ${r.revision??0}`}),(0,G.jsxs)(`span`,{children:[r.slug_prefix,` · ⭐ `,r.upgrade_stars,` · `,r.issued,` / `,r.supply_total]})]})]}),(0,G.jsx)(J,{tone:`good`,children:`Published`})]}),(0,G.jsxs)(`div`,{className:`collectible-active-grid`,children:[[...r.models??[],...r.patterns??[]].map(t=>(0,G.jsxs)(`article`,{children:[(0,G.jsx)(sr,{giftID:e.GiftID,attribute:t}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[t.name,t.crafted&&(0,G.jsx)(J,{children:`crafted`})]}),(0,G.jsxs)(`span`,{children:[fr[t.kind],` · `,ur(t)]})]})]},`${t.kind}-${t.id}`)),(r.backdrops??[]).map(e=>(0,G.jsxs)(`article`,{children:[(0,G.jsx)(`div`,{className:`collectible-backdrop-preview`,style:{background:`radial-gradient(circle, #${(e.center_color??0).toString(16).padStart(6,`0`)}, #${(e.edge_color??0).toString(16).padStart(6,`0`)})`,color:`#${(e.text_color??16777215).toString(16).padStart(6,`0`)}`},children:`Aa`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:e.name}),(0,G.jsxs)(`span`,{children:[`Backdrop`,` · `,ur(e)]})]})]},`backdrop-${e.id}`))]})]}):(0,G.jsxs)(`div`,{className:`collectible-empty`,children:[(0,G.jsx)(xe,{size:22}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`No collectible pool published`}),(0,G.jsx)(`span`,{children:`Publish models, patterns and backdrops to enable upgrades.`})]})]}),(0,G.jsxs)(`section`,{className:`collectible-definition`,children:[(0,G.jsxs)(`div`,{className:`collectible-definition-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Publish a new immutable revision`}),(0,G.jsx)(`span`,{children:`Dry-run checks every file and rarity total before the revision becomes active.`})]}),(0,G.jsxs)(`div`,{className:`gift-format-chips`,children:[(0,G.jsx)(`span`,{children:`TGS`}),(0,G.jsx)(`span`,{children:`Lottie JSON`})]})]}),(0,G.jsxs)(`div`,{className:`gift-fields-grid collectible-main-fields`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Upgrade price in Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:p,onChange:e=>{m(e.target.value),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Unique supply`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:h,onChange:e=>{_(e.target.value),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Public slug prefix`}),(0,G.jsx)(`input`,{value:v,maxLength:48,onChange:e=>{y(e.target.value.toLowerCase()),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Audit reason`}),(0,G.jsx)(`input`,{value:b,maxLength:1e3,placeholder:`Briefly describe why this gift is being imported`,onChange:e=>x(e.target.value)})]})]}),ee(`models`,S,C),ee(`patterns`,w,T),(0,G.jsxs)(`section`,{className:`collectible-section`,children:[(0,G.jsxs)(`div`,{className:`collectible-section-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Backdrops`}),(0,G.jsx)(`span`,{children:`Colors are stored as 24-bit RGB values.`})]}),(0,G.jsxs)(`div`,{className:`collectible-section-tools`,children:[(0,G.jsxs)(J,{tone:A.backdrops>0?`good`:`neutral`,children:[A.backdrops,`‰`]}),(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>{D(tr([...E,rr(E)])),j()},children:[(0,G.jsx)(Pe,{size:13}),`Add`]})]})]}),(0,G.jsx)(`div`,{className:`collectible-rows`,children:E.map((e,t)=>(0,G.jsxs)(`div`,{className:`collectible-row backdrop`,children:[(0,G.jsx)(`div`,{className:`collectible-row-index`,children:t+1}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Name`}),(0,G.jsx)(`input`,{value:e.name,maxLength:128,onChange:t=>{D(E.map(n=>n.key===e.key?{...n,name:t.target.value}:n)),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Backdrop ID`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,value:e.backdropID,onChange:t=>{D(E.map(n=>n.key===e.key?{...n,backdropID:t.target.value}:n)),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Rarity ‰`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,max:`1000`,value:e.rarity,onChange:t=>{D(E.map(n=>n.key===e.key?{...n,rarity:t.target.value}:n)),j()}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Sort order`}),(0,G.jsx)(`input`,{type:`number`,value:e.sortOrder,onChange:t=>{D(E.map(n=>n.key===e.key?{...n,sortOrder:t.target.value}:n)),j()}})]}),[`center`,`edge`,`pattern`,`text`].map(t=>(0,G.jsxs)(`label`,{className:`collectible-color`,children:[(0,G.jsx)(`span`,{children:pr[t]}),(0,G.jsx)(`input`,{type:`color`,value:e[t],onChange:n=>{D(E.map(r=>r.key===e.key?{...r,[t]:n.target.value}:r)),j()}})]},t)),(0,G.jsx)(`div`,{className:`collectible-backdrop-preview`,style:{background:`radial-gradient(circle, ${e.center}, ${e.edge})`,color:e.text},children:`Aa`}),(0,G.jsx)(`button`,{className:`icon-btn danger`,type:`button`,disabled:E.length<=2,onClick:()=>{D(tr(E.filter(t=>t.key!==e.key))),j()},"aria-label":`Remove attribute`,children:(0,G.jsx)(H,{size:14})})]},e.key))})]})]}),l&&(0,G.jsx)(q,{children:l}),d&&(0,G.jsxs)(`div`,{className:`gift-validation`,children:[(0,G.jsxs)(`div`,{className:`gift-validation-head`,children:[(0,G.jsx)(L,{size:17}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Attribute pool is valid`}),(0,G.jsx)(`span`,{children:`Review the normalized assets, then publish this immutable revision.`})]})]}),(0,G.jsx)(`pre`,{children:JSON.stringify(d.details,null,2)})]})]}),(0,G.jsxs)(`div`,{className:`modal-actions`,children:[(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:t,disabled:s,children:`Close`}),(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:F,disabled:s,children:[s?(0,G.jsx)(R,{className:`spin`,size:15}):(0,G.jsx)(Ue,{size:15}),`Dry-run validation`]}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:I,disabled:s||!d,children:[(0,G.jsx)($e,{size:15}),`Publish revision`]})]})]})}),document.body)}var hr={all:`All`,upgrade:`Upgradable`,craft:`Craftable`,basic:`Not upgradable`},gr=!1;function _r(e){return e.model_count+e.pattern_count+e.backdrop_count}function vr(e){let t=Number(e);return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Q({giftID:e,revision:t,compact:n=!1}){let r=(0,g.useRef)(null),i=(0,g.useRef)(null),[a,o]=(0,g.useState)(!0),[s,c]=(0,g.useState)(``);(0,g.useEffect)(()=>{let t=!1;return k.giftAnimation(e).then(e=>{t||!r.current||(i.current?.destroy(),i.current=Zn.default.loadAnimation({container:r.current,renderer:`canvas`,loop:!0,autoplay:!0,animationData:structuredClone(e)}))}).catch(e=>c(O(e))),()=>{t=!0,i.current?.destroy(),i.current=null}},[e,t]);function l(){i.current&&(a?i.current.pause():i.current.play(),o(!a))}return(0,G.jsxs)(`div`,{className:`gift-animation-shell ${n?`compact`:``}`,children:[(0,G.jsx)(`div`,{className:`gift-animation`,ref:r,children:s&&(0,G.jsx)(`span`,{children:s})}),(0,G.jsx)(`button`,{className:`gift-play`,type:`button`,onClick:l,"aria-label":a?`Pause`:`Play`,children:a?(0,G.jsx)(Me,{size:14}):(0,G.jsx)(Ne,{size:14})})]})}function yr({sourceGiftID:e}){let t=(0,g.useRef)(null);return(0,g.useEffect)(()=>{let n=!1,r=null;return k.officialGiftAnimation(e).then(e=>{n||!t.current||(r=Zn.default.loadAnimation({container:t.current,renderer:`canvas`,loop:!0,autoplay:!0,animationData:structuredClone(e)}))}).catch(()=>void 0),()=>{n=!0,r?.destroy()}},[e]),(0,G.jsx)(`div`,{className:`gift-animation-shell`,children:(0,G.jsx)(`div`,{className:`gift-animation`,ref:t})})}function br(){let[e,t]=(0,g.useState)([]),[n,r]=(0,g.useState)(``),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(`official`),[f,p]=(0,g.useState)([]),[m,h]=(0,g.useState)(0),[_,y]=(0,g.useState)([]),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)(`all`),[w,T]=(0,g.useState)(``),[E,D]=(0,g.useState)(!0),[A,j]=(0,g.useState)(`0`),[M,N]=(0,g.useState)(`0`),[P,F]=(0,g.useState)(``),[I,ee]=(0,g.useState)(`0`),[te,ne]=(0,g.useState)(``),[re,ie]=(0,g.useState)(`50`),[ae,oe]=(0,g.useState)(`50`),[se,ce]=(0,g.useState)(`0`),[le,ue]=(0,g.useState)(!0),[z,de]=(0,g.useState)(``),[me,he]=(0,g.useState)(null),[ge,_e]=(0,g.useState)(!1),[ye,be]=(0,g.useState)(``),[B,Se]=(0,g.useState)(``),[Ce,we]=(0,g.useState)(null),[Te,Ee]=(0,g.useState)([]),[De,Oe]=(0,g.useState)(!0),[ke,Ae]=(0,g.useState)(``),[je,Ne]=(0,g.useState)(!1),[Fe,Ie]=(0,g.useState)({done:0,total:0}),[ze,Be]=(0,g.useState)(``),[Ve,He]=(0,g.useState)(null),[V,We]=(0,g.useState)(new Set),[Ge,Ke]=(0,g.useState)(``),[qe,Je]=(0,g.useState)(!1),[Ye,Xe]=(0,g.useState)(``),[H,Ze]=(0,g.useState)(10),[Qe,et]=(0,g.useState)(1);async function tt(){be(``);try{t((await k.gifts()).Gifts??[])}catch(e){be(O(e))}}(0,g.useEffect)(()=>{tt()},[]),(0,g.useEffect)(()=>{!i||u!=="default"||f.length>0||k.defaultGifts().then(e=>p(e.gifts??[])).catch(e=>Se(O(e)))},[i,u,f.length]),(0,g.useEffect)(()=>{!i||u!==`official`||_.length>0||k.officialGifts().then(e=>y(e.gifts??[])).catch(e=>Se(O(e)))},[i,u,_.length]),(0,g.useMemo)(()=>f.find(e=>e.id===m)??null,[f,m]);let nt=(0,g.useMemo)(()=>_.find(e=>e.source_gift_id===w)??null,[_,w]),it=(0,g.useMemo)(()=>({all:_.length,upgrade:_.filter(e=>e.can_upgrade).length,craft:_.filter(e=>e.can_craft).length,basic:_.filter(e=>!e.can_upgrade).length}),[_]),U=(0,g.useMemo)(()=>{let e=b.trim().toLowerCase();return _.filter(t=>(S===`all`||S===`upgrade`&&t.can_upgrade||S===`craft`&&t.can_craft||S===`basic`&&!t.can_upgrade)&&(!e||t.source_gift_id.includes(e)||t.title.toLowerCase().includes(e)))},[_,b,S]),at=(0,g.useMemo)(()=>{let t=n.trim().toLowerCase();return t?e.filter(e=>String(e.GiftID).includes(t)||e.Title.toLowerCase().includes(t)||e.SourceFormat.toLowerCase().includes(t)):e},[e,n]);(0,g.useEffect)(()=>{et(1)},[n,H]);let ot=H===`all`?1:Math.max(1,Math.ceil(at.length/H)),st=Math.min(Qe,ot),ct=(0,g.useMemo)(()=>{if(H===`all`)return at;let e=(st-1)*H;return at.slice(e,e+H)},[at,st,H]),lt=ct.length===0?0:H===`all`?1:(st-1)*H+1,ut=lt===0?0:lt+ct.length-1,dt=ct.length>0&&ct.every(e=>V.has(e.GiftID));function ft(e){We(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function pt(){We(e=>{if(dt){let t=new Set(e);for(let e of ct)t.delete(e.GiftID);return t}let t=new Set(e);for(let e of ct)t.add(e.GiftID);return t})}async function mt(e){if(!Ge.trim()){Xe(`Please enter an operation reason`);return}Je(!0),Xe(``);let t=Array.from(V),n=0;for(let r of t)try{await k.action(`/api/actions/set-gift-enabled`,{gift_id:r,enabled:e,reason:Ge.trim(),confirm:!0})}catch{n++}Je(!1),n>0?Xe(`${n} of ${t.length} failed`):(We(new Set),Ke(``)),await tt()}function ht(e,t=``){if(!c)throw Error(`Choose a TGS or Lottie file first`);if(!z.trim())throw Error(`Please enter an operation reason`);let n=new FormData;return n.set(`metadata`,JSON.stringify({command_id:t,reason:z.trim(),confirm:e,gift_id:I,title:te.trim(),stars:re,convert_stars:ae,enabled:le,sort_order:Number(se)})),n.set(`file`,c,c.name),n}function gt(e,t=``){if(!m)throw Error(`Choose a default gift first`);if(!z.trim())throw Error(`Please enter an operation reason`);return{command_id:t,reason:z.trim(),confirm:e,id:m}}function _t(e,t=``){if(!w)throw Error(`Choose an official gift first`);if(!z.trim())throw Error(`Please enter an operation reason`);return{command_id:t,reason:z.trim(),confirm:e,source_gift_id:w,gift_id:I,title:te.trim(),stars:re,convert_stars:ae,enabled:le,sort_order:Number(se),include_collectible:E,upgrade_stars:A,supply_total:Number(M),slug_prefix:P.trim().toLowerCase()}}function vt(e){T(e.source_gift_id),ne(e.title||`Unnamed official gift #${e.source_gift_id}`),ie(String(e.stars)),oe(String(e.convert_stars)),D(e.can_upgrade),j(e.upgrade_stars),N(String(e.availability_total||1)),F(`official-${e.source_gift_id}`),he(null)}async function yt(e){we(e),Ee([]),Oe(!0),Ae(``),Ne(!1),Ie({done:0,total:0}),Be(``),He(null);try{Ee(e==="default"?f.length>0?f:(await k.defaultGifts()).gifts??[]:_.length>0?_:(await k.officialGifts()).gifts??[])}catch(e){Be(O(e))}}function bt(){je||we(null)}async function xt(){if(!Ce)return;if(!ke.trim()){Be(`Please enter an operation reason`);return}let e=Ce;Ne(!0),Be(``),He(null),Ie({done:0,total:Te.length});let t=0,n=0,r=0,i=[];for(let a of Te){let o=e==="default"?a.title:a.title||`#${a.source_gift_id}`;try{let r=e==="default"?await k.importDefaultGift({command_id:`bulk-default-gift-${a.id}`,reason:ke.trim(),confirm:!0,id:a.id,enabled:De}):await k.importOfficialGift({command_id:`bulk-official-gift-${a.source_gift_id}`,reason:ke.trim(),confirm:!0,source_gift_id:a.source_gift_id,include_collectible:a.can_upgrade,enabled:De});r.already_executed||r.details?.skipped?n++:t++}catch(e){e instanceof v&&e.message===`COMMAND_ID_CONFLICT`?n++:(r++,i.push(`${o}: ${O(e)}`))}Ie(e=>({...e,done:e.done+1}))}Ne(!1),He({imported:t,skipped:n,failed:r,errors:i}),await tt()}async function wt(){_e(!0),Se(``),he(null);try{he(u==="default"?await k.importDefaultGift(gt(!1)):u===`official`?await k.importOfficialGift(_t(!1)):await k.importGift(ht(!1)))}catch(e){Se(O(e))}finally{_e(!1)}}async function K(){if(me){_e(!0),Se(``);try{u==="default"?await k.importDefaultGift(gt(!0,me.command_id)):u===`official`?await k.importOfficialGift(_t(!0,me.command_id)):await k.importGift(ht(!0,me.command_id)),he(null),l(null),ee(`0`),ne(``),h(0),T(``),await tt(),a(!1)}catch(e){Se(O(e))}finally{_e(!1)}}}function Tt(){ee(`0`),ne(``),ie(`50`),oe(`50`),ce(`0`),ue(!0),de(``),l(null),he(null),Se(``),d(`official`),h(0),T(``),x(``),C(`all`),Ne(!1),Ie({done:0,total:0}),Be(``),a(!0)}function X(e){ee(e.GiftID),ne(e.Title),ie(String(e.Stars)),oe(String(e.ConvertStars)),ce(String(e.SortOrder)),ue(e.Enabled),de(``),l(null),he(null),Se(``),d(`file`),h(0),T(``),a(!0)}let Et=u==="default"?m>0:u===`official`?!!w:!!c;return(0,G.jsxs)(St,{title:`Star Gift Catalog`,eyebrow:`Catalog, immutable revisions and animation assets`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>tt(),disabled:ge,children:[(0,G.jsx)(Le,{size:15}),` `,`Refresh`]}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:Tt,children:[(0,G.jsx)(Pe,{size:15}),` `,`Add gift`]})]}),children:[ye&&(0,G.jsx)(q,{children:ye}),(0,G.jsxs)(`div`,{className:`metric-row gift-metrics`,children:[(0,G.jsx)(Y,{label:`Catalog entries`,value:String(e.length)}),(0,G.jsx)(Y,{label:`Enabled`,value:String(e.filter(e=>e.Enabled).length),tone:`good`}),(0,G.jsx)(Y,{label:`Received gifts`,value:e.reduce((e,t)=>e+BigInt(t.ReceivedCount),0n).toString()}),(0,G.jsx)(Y,{label:`Accepted formats`,value:`TGS / Lottie`})]}),(0,G.jsx)(Ct,{children:(0,G.jsxs)(`div`,{className:`toolbar`,children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`Search gift ID, title or format`})]}),(0,G.jsxs)(`label`,{className:`gift-page-size`,children:[(0,G.jsx)(`span`,{children:`Per page`}),(0,G.jsxs)(`select`,{value:String(H),onChange:e=>Ze(e.target.value===`all`?`all`:Number(e.target.value)),children:[(0,G.jsx)(`option`,{value:`10`,children:`10`}),(0,G.jsx)(`option`,{value:`20`,children:`20`}),(0,G.jsx)(`option`,{value:`50`,children:`50`}),(0,G.jsx)(`option`,{value:`100`,children:`100`}),(0,G.jsx)(`option`,{value:`all`,children:`All`})]})]}),(0,G.jsx)(`span`,{className:`gift-list-summary`,children:`Showing ${at.length} of ${e.length}`})]})}),V.size>0&&(0,G.jsxs)(`div`,{className:`gift-bulk-toolbar`,children:[(0,G.jsx)(`span`,{className:`gift-bulk-count`,children:`${V.size} selected`}),(0,G.jsxs)(`label`,{className:`gift-reason-field gift-bulk-reason`,children:[(0,G.jsx)(`span`,{children:`Audit reason`}),(0,G.jsx)(`input`,{value:Ge,placeholder:`Briefly describe why this gift is being imported`,onChange:e=>Ke(e.target.value)})]}),(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>mt(!0),disabled:qe,children:[qe?(0,G.jsx)(R,{className:`spin`,size:14}):(0,G.jsx)(L,{size:14}),` `,`Enable selected`]}),(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>mt(!1),disabled:qe,children:[qe?(0,G.jsx)(R,{className:`spin`,size:14}):(0,G.jsx)(Me,{size:14}),` `,`Disable selected`]}),(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>{We(new Set),Xe(``)},disabled:qe,children:`Close`}),Ye&&(0,G.jsx)(`span`,{className:`gift-bulk-error`,children:Ye})]}),(0,G.jsx)(`div`,{className:`table-wrap gift-table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table gift-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`gift-select-col`,children:(0,G.jsx)(`input`,{type:`checkbox`,checked:dt,onChange:pt,"aria-label":`Select all visible gifts`})}),(0,G.jsx)(`th`,{children:`Animation file`}),(0,G.jsx)(`th`,{children:`ID / Revision`}),(0,G.jsx)(`th`,{children:`Display title`}),(0,G.jsx)(`th`,{children:`Price / Conversion`}),(0,G.jsx)(`th`,{children:`Source`}),(0,G.jsx)(`th`,{children:`Received gifts`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Updated`}),(0,G.jsx)(`th`,{children:`Actions`})]})}),(0,G.jsxs)(`tbody`,{children:[ct.map(e=>(0,G.jsxs)(`tr`,{className:e.Enabled?``:`gift-row-disabled`,children:[(0,G.jsx)(`td`,{className:`gift-select-col`,children:(0,G.jsx)(`input`,{type:`checkbox`,checked:V.has(e.GiftID),onChange:()=>ft(e.GiftID),"aria-label":`Select gift ${e.GiftID}`})}),(0,G.jsx)(`td`,{children:(0,G.jsx)(Q,{giftID:e.GiftID,revision:e.Revision,compact:!0})}),(0,G.jsxs)(`td`,{className:`mono`,children:[e.GiftID,` / `,e.Revision]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{className:`gift-table-title`,children:e.Title||`Gift #${e.GiftID}`}),(0,G.jsxs)(`span`,{className:`gift-sort-order`,children:[`Sort order`,`: `,e.SortOrder]})]}),(0,G.jsxs)(`td`,{children:[(0,G.jsxs)(`strong`,{className:`gift-table-price`,children:[`⭐ `,e.Stars]}),(0,G.jsxs)(`span`,{className:`gift-convert-price`,children:[`→ `,e.ConvertStars]})]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(J,{children:e.SourceFormat}),(0,G.jsx)(`span`,{className:`gift-source-size`,children:vr(e.AnimationSize)})]}),(0,G.jsx)(`td`,{children:e.ReceivedCount}),(0,G.jsx)(`td`,{children:(0,G.jsx)(J,{tone:e.Enabled?`good`:`neutral`,children:e.Enabled?`Enabled`:`Disabled`})}),(0,G.jsx)(`td`,{children:W(e.UpdatedAt)}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`div`,{className:`gift-table-actions`,children:[(0,G.jsxs)(`button`,{className:`btn compact-btn collectible-button`,type:`button`,onClick:()=>s(e),children:[(0,G.jsx)(xe,{size:13}),`Attribute pool`]}),(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>X(e),children:`New revision`}),(0,G.jsx)(Z,{compact:!0,tone:`neutral`,label:e.Enabled?`Disable`:`Enable`,path:`/api/actions/set-gift-enabled`,payload:()=>({gift_id:e.GiftID,enabled:!e.Enabled}),onDone:()=>void tt()})]})})]},e.GiftID)),ct.length===0&&(0,G.jsx)(Dt,{colSpan:10})]})]})}),H!==`all`&&at.length>0&&(0,G.jsxs)(`div`,{className:`gift-pager`,children:[(0,G.jsx)(`span`,{className:`gift-pager-range`,children:`Showing ${lt}-${ut} of ${at.length}`}),(0,G.jsxs)(`div`,{className:`gift-pager-controls`,children:[(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>et(e=>Math.max(1,e-1)),disabled:st<=1,children:[(0,G.jsx)(fe,{size:14}),` `,`Previous`]}),(0,G.jsx)(`span`,{className:`gift-pager-page`,children:`Page ${st} of ${ot}`}),(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>et(e=>Math.min(ot,e+1)),disabled:st>=ot,children:[`Next`,` `,(0,G.jsx)(pe,{size:14})]})]})]}),i&&(0,tn.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal gift-import-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":I===`0`?`Import a Star Gift`:`Create revision for gift #${I}`,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`Gift catalog operation`}),(0,G.jsx)(`h2`,{children:I===`0`?`Import a Star Gift`:`Create revision for gift #${I}`})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:()=>a(!1),disabled:ge,"aria-label":`Close`,children:(0,G.jsx)(rt,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body gift-import-modal-body`,children:[(0,G.jsxs)(`div`,{className:`command-steps`,children:[(0,G.jsxs)(`div`,{className:`command-step ${Et?`done`:`active`}`,children:[(0,G.jsx)(`span`,{children:`1`}),(0,G.jsx)(`strong`,{children:`File and details`})]}),(0,G.jsxs)(`div`,{className:`command-step ${me?`done`:Et?`active`:``}`,children:[(0,G.jsx)(`span`,{children:`2`}),(0,G.jsx)(`strong`,{children:`Dry-run validation`})]}),(0,G.jsxs)(`div`,{className:`command-step ${me?`active`:``}`,children:[(0,G.jsx)(`span`,{children:`3`}),(0,G.jsx)(`strong`,{children:`Confirm import`})]})]}),I===`0`&&(0,G.jsxs)(`div`,{className:`gift-source-tabs`,children:[gr,(0,G.jsx)(`button`,{className:`btn ${u===`official`?`primary`:``}`,type:`button`,onClick:()=>{d(`official`),he(null)},children:`Official snapshot`}),(0,G.jsx)(`button`,{className:`btn ${u===`file`?`primary`:``}`,type:`button`,onClick:()=>{d(`file`),he(null)},children:`Upload file`})]}),u===`official`&&I===`0`?(0,G.jsxs)(`section`,{className:`official-gift-picker`,children:[(0,G.jsxs)(`div`,{className:`gift-import-note`,children:[(0,G.jsx)(`span`,{children:`Choose a verified gift from data/official-gifts. Complete collectible pools are imported atomically.`}),(0,G.jsxs)(`div`,{className:`gift-format-chips`,children:[(0,G.jsx)(`span`,{children:_.length}),(0,G.jsx)(`span`,{children:`SHA-256`})]})]}),(0,G.jsx)(`div`,{className:`official-gift-bulk-import`,children:(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>yt(`official`),children:[(0,G.jsx)($e,{size:14}),` `,`Import all official gifts`]})}),(0,G.jsxs)(`div`,{className:`official-gift-tools`,children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:b,onChange:e=>x(e.target.value),placeholder:`Search official gift ID or title`})]}),(0,G.jsx)(`span`,{children:`Showing ${U.length} of ${_.length}`})]}),(0,G.jsx)(`div`,{className:`official-gift-categories`,role:`group`,"aria-label":`Official gift capability category`,children:[`all`,`upgrade`,`craft`,`basic`].map(e=>(0,G.jsxs)(`button`,{className:S===e?`active`:``,type:`button`,"aria-pressed":S===e,onClick:()=>C(e),children:[hr[e],(0,G.jsx)(`span`,{children:it[e]})]},e))}),(0,G.jsxs)(`div`,{className:`official-gift-list`,role:`listbox`,"aria-label":`Choose an official gift`,children:[U.map(e=>{let t=e.source_gift_id===w;return(0,G.jsxs)(`button`,{className:`official-gift-option ${t?`selected`:``}`,type:`button`,role:`option`,"aria-selected":t,onClick:()=>vt(e),children:[(0,G.jsxs)(`span`,{className:`official-gift-option-head`,children:[(0,G.jsx)(`strong`,{children:e.title||`Unnamed official gift #${e.source_gift_id}`}),(0,G.jsxs)(`span`,{className:`mono`,children:[`#`,e.source_gift_id]})]}),(0,G.jsxs)(`span`,{className:`official-gift-option-meta`,children:[(0,G.jsxs)(`span`,{children:[`⭐ `,e.stars]}),(0,G.jsx)(`span`,{children:`${_r(e)} attributes`})]}),(0,G.jsxs)(`span`,{className:`official-gift-capabilities`,children:[(0,G.jsx)(`span`,{className:e.can_upgrade?`yes`:`no`,children:e.can_upgrade?`Can upgrade`:`Cannot upgrade`}),(0,G.jsx)(`span`,{className:e.can_craft?`craft`:`no`,children:e.can_craft?`Can Craft`:`Cannot Craft`})]})]},e.source_gift_id)}),U.length===0&&(0,G.jsx)(`div`,{className:`official-gift-empty`,children:`No official gifts match this category and search.`})]}),nt&&(0,G.jsxs)(`div`,{className:`official-gift-selected`,children:[(0,G.jsx)(yr,{sourceGiftID:nt.source_gift_id}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:nt.title||`Unnamed official gift #${nt.source_gift_id}`}),(0,G.jsx)(`span`,{className:`mono`,children:nt.source_gift_id}),(0,G.jsxs)(`small`,{children:[nt.model_count,` `,`Models`,` · `,nt.pattern_count,` `,`Patterns`,` · `,nt.backdrop_count,` `,`Backdrops`]}),(0,G.jsxs)(`span`,{className:`official-gift-capabilities`,children:[(0,G.jsx)(`span`,{className:nt.can_upgrade?`yes`:`no`,children:nt.can_upgrade?`Can upgrade`:`Cannot upgrade`}),(0,G.jsx)(`span`,{className:nt.can_craft?`craft`:`no`,children:nt.can_craft?`Can Craft`:`Cannot Craft`})]})]})]}),nt?.can_upgrade&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>{D(e.target.checked),he(null)}}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Import the complete collectible pool, including crafted models`})]}),E&&(0,G.jsxs)(`div`,{className:`gift-fields-grid`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Upgrade price in Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:A,onChange:e=>{j(e.target.value),he(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Unique supply`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:M,onChange:e=>{N(e.target.value),he(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Public slug prefix`}),(0,G.jsx)(`input`,{value:P,maxLength:48,onChange:e=>{F(e.target.value.toLowerCase()),he(null)}})]})]})]}),(0,G.jsxs)(`div`,{className:`gift-fields-grid`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Display title`}),(0,G.jsx)(`input`,{value:te,maxLength:128,placeholder:`e.g. Celebration Star`,onChange:e=>{ne(e.target.value),he(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Price in Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:re,onChange:e=>{ie(e.target.value),he(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Conversion Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,value:ae,onChange:e=>{oe(e.target.value),he(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Sort order`}),(0,G.jsx)(`input`,{type:`number`,value:se,onChange:e=>{ce(e.target.value),he(null)}})]})]}),(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:le,onChange:e=>{ue(e.target.checked),he(null)}}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Enable after import`})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`gift-import-note`,children:[(0,G.jsx)(`span`,{children:`Upload TGS or plain Lottie JSON. Lottie is normalized and compressed to TGS.`}),(0,G.jsxs)(`div`,{className:`gift-format-chips`,"aria-label":`Accepted formats`,children:[(0,G.jsx)(`span`,{children:`TGS`}),(0,G.jsx)(`span`,{children:`Lottie JSON`})]})]}),(0,G.jsxs)(`label`,{className:`gift-file-picker ${c?`has-file`:``}`,children:[(0,G.jsx)(`input`,{type:`file`,accept:`.tgs,.json,.lottie,application/json,application/x-tgsticker`,onChange:e=>{l(e.target.files?.[0]??null),he(null)}}),(0,G.jsx)(`span`,{className:`gift-file-icon`,children:(0,G.jsx)(ve,{size:22})}),(0,G.jsxs)(`span`,{className:`gift-file-copy`,children:[(0,G.jsx)(`span`,{className:`gift-field-label`,children:`Animation file`}),(0,G.jsx)(`strong`,{children:c?c.name:`Drop or choose a TGS / Lottie file`}),(0,G.jsx)(`small`,{children:c?vr(c.size):`TGS, JSON or Lottie · validated before import`})]}),(0,G.jsx)(`span`,{className:`gift-file-action`,children:c?`Change file`:`Choose file`})]}),(0,G.jsxs)(`div`,{className:`gift-fields-grid`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Display title`}),(0,G.jsx)(`input`,{value:te,maxLength:128,placeholder:`e.g. Celebration Star`,onChange:e=>{ne(e.target.value),he(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Price in Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`1`,value:re,onChange:e=>{ie(e.target.value),he(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Conversion Stars`}),(0,G.jsx)(`input`,{type:`number`,min:`0`,value:ae,onChange:e=>{oe(e.target.value),he(null)}})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Sort order`}),(0,G.jsx)(`input`,{type:`number`,value:se,onChange:e=>{ce(e.target.value),he(null)}})]})]}),(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:le,onChange:e=>{ue(e.target.checked),he(null)}}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Enable after import`})]})]}),(0,G.jsxs)(`label`,{className:`gift-reason-field`,children:[(0,G.jsx)(`span`,{children:`Audit reason`}),(0,G.jsx)(`input`,{value:z,placeholder:`Briefly describe why this gift is being imported`,onChange:e=>de(e.target.value)})]}),B&&(0,G.jsx)(q,{children:B}),me&&(0,G.jsxs)(`div`,{className:`gift-validation`,children:[(0,G.jsxs)(`div`,{className:`gift-validation-head`,children:[(0,G.jsx)(L,{size:17}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Validation passed`}),(0,G.jsx)(`span`,{children:`Review the normalized metadata, then confirm the import.`})]})]}),(0,G.jsx)(`pre`,{children:JSON.stringify(me.details,null,2)})]})]}),(0,G.jsxs)(`div`,{className:`modal-actions`,children:[(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>a(!1),disabled:ge,children:`Close`}),(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:wt,disabled:ge,children:[ge?(0,G.jsx)(R,{className:`spin`,size:15}):(0,G.jsx)(Ue,{size:15}),`Dry-run validation`]}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:K,disabled:ge||!me,children:[(0,G.jsx)($e,{size:15}),`Confirm import`]})]})]})}),document.body),Ce&&(0,tn.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal gift-bulk-import-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":Ce==="default"?`Import all default gifts`:`Import all official gifts`,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`Gift catalog operation`}),(0,G.jsx)(`h2`,{children:Ce==="default"?`Import all default gifts`:`Import all official gifts`})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:bt,disabled:je,"aria-label":`Close`,children:(0,G.jsx)(rt,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body`,children:[(0,G.jsx)(`div`,{className:`gift-import-note`,children:(0,G.jsx)(`span`,{children:`${Te.length} gifts available to import`})}),(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:De,disabled:je,onChange:e=>Oe(e.target.checked)}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Enable after import`})]}),(0,G.jsxs)(`label`,{className:`gift-reason-field`,children:[(0,G.jsx)(`span`,{children:`Audit reason`}),(0,G.jsx)(`input`,{value:ke,placeholder:`Briefly describe why this gift is being imported`,disabled:je,onChange:e=>Ae(e.target.value)})]}),je&&(0,G.jsxs)(`div`,{className:`gift-bulk-import-progress`,children:[(0,G.jsx)(`div`,{className:`gift-bulk-import-progress-bar`,children:(0,G.jsx)(`div`,{style:{width:`${Fe.total?Math.round(Fe.done/Fe.total*100):0}%`}})}),(0,G.jsx)(`span`,{children:`Importing ${Fe.done} of ${Fe.total}`})]}),ze&&(0,G.jsx)(q,{children:ze}),Ve&&(0,G.jsxs)(`div`,{className:`gift-validation`,children:[(0,G.jsxs)(`div`,{className:`gift-validation-head`,children:[(0,G.jsx)(L,{size:17}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`Import complete`}),(0,G.jsx)(`span`,{children:`Imported ${Ve.imported}, skipped ${Ve.skipped}, failed ${Ve.failed}`})]})]}),Ve.errors.length>0&&(0,G.jsx)(`pre`,{children:Ve.errors.join(` -`)})]})]}),(0,G.jsxs)(`div`,{className:`modal-actions`,children:[(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:bt,disabled:je,children:`Close`}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:xt,disabled:je||Te.length===0,children:[je?(0,G.jsx)(R,{className:`spin`,size:15}):(0,G.jsx)($e,{size:15}),` `,`Start import`]})]})]})}),document.body),o&&(0,G.jsx)(mr,{gift:o,onClose:()=>s(null),onPublished:()=>void tt()})]})}function xr({documentID:e,className:t=``,showError:n=!0}){let r=(0,g.useRef)(null),i=(0,g.useRef)(null),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(null);return(0,g.useEffect)(()=>{let t=!1,n=null;return o(``),c(null),fetch(k.stickerDocumentAnimationURL(e),{credentials:`same-origin`}).then(async e=>{if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||e.statusText)}if((e.headers.get(`content-type`)??``).includes(`json`)){let n=await e.json();if(t||!r.current)return;i.current?.destroy(),i.current=Zn.default.loadAnimation({container:r.current,renderer:`canvas`,loop:!0,autoplay:!0,animationData:n});return}let a=await e.blob();t||(n=URL.createObjectURL(a),c(n))}).catch(e=>{t||o(O(e))}),()=>{t=!0,i.current?.destroy(),i.current=null,n&&URL.revokeObjectURL(n)}},[e]),(0,G.jsxs)(`div`,{className:`sticker-doc-cell ${t}`.trim(),children:[s?(0,G.jsx)(`img`,{className:`sticker-doc-image`,src:s,alt:``}):(0,G.jsx)(`div`,{className:`sticker-doc-canvas`,ref:r}),a&&n&&(0,G.jsx)(`span`,{className:`sticker-doc-error`,children:a})]})}function Sr({kind:e,onClose:t,onCreated:n}){let r=e===`emoji`?`emoji`:`sticker`,[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(``),[m,h]=(0,g.useState)(!1),[_,v]=(0,g.useState)(``);async function y(){if(!i.trim()||!o.trim()||!c.trim()||!u){v(`Title, short name, emoji and a first ${r} file are required.`);return}if(!f.trim()){v(`Please enter an operation reason`);return}h(!0),v(``);try{let r=new FormData;r.set(`metadata`,JSON.stringify({command_id:``,reason:f.trim(),confirm:!0,title:i.trim(),short_name:o.trim().toLowerCase(),kind:e,emoji:c.trim()})),r.set(`file`,u,u.name),await k.createStickerSet(r),n(),t()}catch(e){v(O(e))}finally{h(!1)}}return(0,tn.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`Create a new ${r} pack`,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`New set`}),(0,G.jsx)(`h2`,{children:`Create a new ${r} pack`})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:t,disabled:m,"aria-label":`Close`,children:(0,G.jsx)(rt,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body`,children:[(0,G.jsxs)(`div`,{className:`gift-fields-grid`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Title`}),(0,G.jsx)(`input`,{value:i,maxLength:64,onChange:e=>a(e.target.value)})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Short name`}),(0,G.jsx)(`input`,{value:o,maxLength:32,onChange:e=>s(e.target.value),placeholder:`lowercase_short_name`})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Emoji`}),(0,G.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),placeholder:`e.g. 😀`})]})]}),(0,G.jsxs)(`label`,{className:`gift-file-picker ${u?`has-file`:``}`,children:[(0,G.jsx)(`input`,{type:`file`,accept:`.tgs,.json,.webp,application/json,application/x-tgsticker,image/webp`,onChange:e=>d(e.target.files?.[0]??null)}),(0,G.jsxs)(`span`,{className:`gift-file-copy`,children:[(0,G.jsx)(`span`,{className:`gift-field-label`,children:`First ${r}`}),(0,G.jsx)(`strong`,{children:u?u.name:`Choose a TGS, Lottie JSON, or WebP file`})]}),(0,G.jsx)(`span`,{className:`gift-file-action`,children:u?`Change file`:`Choose file`})]}),(0,G.jsxs)(`label`,{className:`gift-reason-field`,children:[(0,G.jsx)(`span`,{children:`Audit reason`}),(0,G.jsx)(`input`,{value:f,placeholder:`Briefly describe why this gift is being imported`,onChange:e=>p(e.target.value)})]}),_&&(0,G.jsx)(q,{children:_})]}),(0,G.jsxs)(`div`,{className:`modal-actions`,children:[(0,G.jsx)(`button`,{className:`btn`,type:`button`,onClick:t,disabled:m,children:`Close`}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:y,disabled:m,children:[m?(0,G.jsx)(R,{className:`spin`,size:15}):(0,G.jsx)($e,{size:15}),`Create ${r} pack`]})]})]})}),document.body)}var Cr=24;function wr({set:e,onClose:t}){let n=e.Kind===`emoji`?`emoji`:`sticker`,[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(1),l=(0,g.useCallback)(()=>{let t=!1;return o(``),k.stickerSetDocuments(e.ID).then(e=>{t||i(e.document_ids??[])}).catch(e=>{t||o(O(e))}),()=>{t=!0}},[e.ID]);(0,g.useEffect)(()=>(i(null),c(1),l()),[l]);let u=r?.length??0,d=Math.max(1,Math.ceil(u/Cr)),f=Math.min(s,d),p=(f-1)*Cr,m=r?.slice(p,p+Cr)??[],h=m.length===0?0:p+1,_=h===0?0:h+m.length-1;return(0,tn.createPortal)((0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,children:(0,G.jsxs)(`section`,{className:`modal command-modal sticker-preview-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":e.Title||`#${e.ID}`,children:[(0,G.jsxs)(`div`,{className:`modal-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`eyebrow`,children:`Set contents`}),(0,G.jsx)(`h2`,{children:e.Title||`#${e.ID}`})]}),(0,G.jsx)(`button`,{className:`icon-btn`,type:`button`,onClick:t,"aria-label":`Close`,children:(0,G.jsx)(rt,{size:15})})]}),(0,G.jsxs)(`div`,{className:`command-body`,children:[(0,G.jsx)(Tr,{setID:e.ID,noun:n,onAdded:l}),a&&(0,G.jsx)(q,{children:a}),!a&&r===null&&(0,G.jsxs)(`div`,{className:`loading-line`,children:[(0,G.jsx)(R,{className:`spin`,size:18}),` `,`Loading`]}),r!==null&&u===0&&!a&&(0,G.jsx)(`div`,{className:`empty-panel`,children:`This set has no documents.`}),m.length>0&&(0,G.jsx)(`div`,{className:`sticker-doc-grid`,children:m.map(t=>(0,G.jsxs)(`div`,{className:`sticker-doc-grid-cell`,children:[(0,G.jsx)(xr,{documentID:t}),(0,G.jsx)(Z,{compact:!0,tone:`danger`,label:`Remove`,icon:(0,G.jsx)(H,{size:12}),path:`/api/actions/remove-sticker-from-set`,payload:()=>({set_id:e.ID,document_id:t}),onDone:l})]},t))},f),u>Cr&&(0,G.jsxs)(`div`,{className:`gift-pager`,children:[(0,G.jsx)(`span`,{className:`gift-pager-range`,children:`Showing ${h}-${_} of ${u}`}),(0,G.jsxs)(`div`,{className:`gift-pager-controls`,children:[(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>c(e=>Math.max(1,e-1)),disabled:f<=1,children:[(0,G.jsx)(fe,{size:14}),` `,`Previous`]}),(0,G.jsx)(`span`,{className:`gift-pager-page`,children:`Page ${f} of ${d}`}),(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>c(e=>Math.min(d,e+1)),disabled:f>=d,children:[`Next`,` `,(0,G.jsx)(pe,{size:14})]})]})]})]})]})}),document.body)}function Tr({setID:e,noun:t,onAdded:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``);async function p(){if(!r){f(`Choose a ${t} file first`);return}if(!a.trim()){f(`An emoji is required.`);return}if(!s.trim()){f(`Please enter an operation reason`);return}u(!0),f(``);try{let t=new FormData;t.set(`metadata`,JSON.stringify({command_id:``,reason:s.trim(),confirm:!0,set_id:e,emoji:a.trim()})),t.set(`file`,r,r.name),await k.addStickerToSet(t),i(null),o(``),c(``),n()}catch(e){f(O(e))}finally{u(!1)}}return(0,G.jsxs)(`div`,{className:`sticker-add-form`,children:[(0,G.jsxs)(`label`,{className:`gift-file-picker compact ${r?`has-file`:``}`,children:[(0,G.jsx)(`input`,{type:`file`,accept:`.tgs,.json,.webp,application/json,application/x-tgsticker,image/webp`,onChange:e=>i(e.target.files?.[0]??null)}),(0,G.jsx)(`span`,{className:`gift-file-copy`,children:(0,G.jsx)(`strong`,{children:r?r.name:`Choose a TGS, Lottie JSON, or WebP file`})})]}),(0,G.jsx)(`input`,{className:`small-input`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g. 😀`}),(0,G.jsx)(`input`,{className:`small-input`,value:s,onChange:e=>c(e.target.value),placeholder:`Describe why this operation is being performed`}),(0,G.jsxs)(`button`,{className:`btn primary compact-btn`,type:`button`,onClick:p,disabled:l,children:[l?(0,G.jsx)(R,{className:`spin`,size:14}):(0,G.jsx)(Pe,{size:14}),` `,`Add ${t}`]}),d&&(0,G.jsx)(`span`,{className:`sticker-add-form-error`,children:d})]})}function Er({kind:e}){let[t,n]=(0,g.useState)([]),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(10),[d,f]=(0,g.useState)(1),[p,m]=(0,g.useState)({}),[h,_]=(0,g.useState)({}),[v,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(!1),S=e===`emoji`?`Emoji`:`Stickers`,C=e===`emoji`?`Custom-emoji packs — system packs aren't shown here, they're not hand-edited`:`Sticker packs — system packs (dice, animated emoji, gifts) aren't shown here, they're not hand-edited`,w=e===`emoji`?`emoji`:`sticker`;async function T(){o(!0),c(``);try{n((await k.stickerSets(e)).rows??[])}catch(e){c(O(e))}finally{o(!1)}}(0,g.useEffect)(()=>{T()},[e]);let E=(0,g.useMemo)(()=>{let e=r.trim().toLowerCase();return e?t.filter(t=>String(t.ID).includes(e)||t.ShortName.toLowerCase().includes(e)||t.Title.toLowerCase().includes(e)):t},[t,r]);(0,g.useEffect)(()=>{f(1)},[r,l,e]);let D=l===`all`?1:Math.max(1,Math.ceil(E.length/l)),A=Math.min(d,D),j=(0,g.useMemo)(()=>{if(l===`all`)return E;let e=(A-1)*l;return E.slice(e,e+l)},[E,A,l]),M=j.length===0?0:l===`all`?1:(A-1)*l+1,N=M===0?0:M+j.length-1,P=(0,g.useMemo)(()=>({total:t.length,official:t.filter(e=>e.Official).length,archived:t.filter(e=>e.Archived).length}),[t]);return(0,G.jsxs)(St,{title:S,eyebrow:C,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>T(),disabled:a,children:[(0,G.jsx)(Le,{size:15}),` `,`Refresh`]}),(0,G.jsxs)(`button`,{className:`btn primary`,type:`button`,onClick:()=>x(!0),children:[(0,G.jsx)(Pe,{size:15}),` `,`Create ${w} pack`]})]}),children:[s&&(0,G.jsx)(q,{children:s}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Total sets`,value:String(P.total)}),(0,G.jsx)(Y,{label:`Official`,value:String(P.official),tone:`good`}),(0,G.jsx)(Y,{label:`Archived`,value:String(P.archived),tone:P.archived>0?`warn`:`neutral`})]}),(0,G.jsx)(Ct,{children:(0,G.jsxs)(`div`,{className:`toolbar`,children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Search set ID, short name or title`})]}),(0,G.jsxs)(`label`,{className:`gift-page-size`,children:[(0,G.jsx)(`span`,{children:`Per page`}),(0,G.jsxs)(`select`,{value:String(l),onChange:e=>u(e.target.value===`all`?`all`:Number(e.target.value)),children:[(0,G.jsx)(`option`,{value:`10`,children:`10`}),(0,G.jsx)(`option`,{value:`20`,children:`20`}),(0,G.jsx)(`option`,{value:`50`,children:`50`}),(0,G.jsx)(`option`,{value:`100`,children:`100`}),(0,G.jsx)(`option`,{value:`all`,children:`All`})]})]}),(0,G.jsx)(`span`,{className:`gift-list-summary`,children:`Showing ${E.length} of ${t.length}`})]})}),(0,G.jsx)(`div`,{className:`table-wrap gift-table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Logo`}),(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Short name`}),(0,G.jsx)(`th`,{children:`Title`}),(0,G.jsx)(`th`,{children:`Documents`}),(0,G.jsx)(`th`,{children:`Official`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Sort order`}),(0,G.jsx)(`th`,{children:`Actions`})]})}),(0,G.jsxs)(`tbody`,{children:[j.map(e=>(0,G.jsxs)(`tr`,{className:e.Archived?`gift-row-disabled`:``,children:[(0,G.jsx)(`td`,{children:e.CoverDocumentID?(0,G.jsx)(xr,{documentID:e.CoverDocumentID,className:`list-thumb`,showError:!1}):(0,G.jsx)(`div`,{className:`sticker-list-thumb-empty`,children:(0,G.jsx)(we,{size:14})})}),(0,G.jsx)(`td`,{className:`mono`,children:e.ID}),(0,G.jsx)(`td`,{className:`mono`,children:e.ShortName||(0,G.jsx)(`span`,{className:`muted-cell`,children:`None`})}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`div`,{className:`sort-order-editor`,children:[(0,G.jsx)(`input`,{className:`small-input title-input`,value:h[e.ID]??e.Title,onChange:t=>_(n=>({...n,[e.ID]:t.target.value}))}),(0,G.jsx)(Z,{compact:!0,tone:`neutral`,label:`Save`,path:`/api/actions/rename-sticker-set`,payload:()=>({set_id:e.ID,title:(h[e.ID]??e.Title).trim()}),onDone:()=>void T()})]})}),(0,G.jsx)(`td`,{children:e.Count}),(0,G.jsx)(`td`,{children:e.Official?(0,G.jsx)(J,{tone:`good`,children:`Yes`}):(0,G.jsx)(J,{children:`No`})}),(0,G.jsx)(`td`,{children:e.Archived?(0,G.jsx)(J,{tone:`danger`,children:`Archived`}):(0,G.jsx)(J,{tone:`good`,children:`Enabled`})}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`div`,{className:`sort-order-editor`,children:[(0,G.jsx)(`input`,{type:`number`,className:`small-input`,value:p[e.ID]??String(e.SortOrder),onChange:t=>m(n=>({...n,[e.ID]:t.target.value}))}),(0,G.jsx)(Z,{compact:!0,tone:`neutral`,label:`Save`,path:`/api/actions/set-sticker-set-sort-order`,payload:()=>({set_id:e.ID,sort_order:Number(p[e.ID]??e.SortOrder)}),onDone:()=>void T()})]})}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`div`,{className:`gift-table-actions`,children:[(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>y(e),children:[(0,G.jsx)(_e,{size:13}),` `,`View`]}),(0,G.jsx)(Z,{compact:!0,tone:`neutral`,label:e.Archived?`Unarchive`:`Archive`,path:`/api/actions/set-sticker-set-archived`,payload:()=>({set_id:e.ID,archived:!e.Archived}),onDone:()=>void T()}),(0,G.jsx)(Z,{compact:!0,tone:`danger`,label:`Delete`,path:`/api/actions/delete-sticker-set`,payload:()=>({set_id:e.ID}),onDone:()=>void T()})]})})]},e.ID)),j.length===0&&(0,G.jsx)(Dt,{colSpan:9})]})]})}),l!==`all`&&E.length>0&&(0,G.jsxs)(`div`,{className:`gift-pager`,children:[(0,G.jsx)(`span`,{className:`gift-pager-range`,children:`Showing ${M}-${N} of ${E.length}`}),(0,G.jsxs)(`div`,{className:`gift-pager-controls`,children:[(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>f(e=>Math.max(1,e-1)),disabled:A<=1,children:[(0,G.jsx)(fe,{size:14}),` `,`Previous`]}),(0,G.jsx)(`span`,{className:`gift-pager-page`,children:`Page ${A} of ${D}`}),(0,G.jsxs)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>f(e=>Math.min(D,e+1)),disabled:A>=D,children:[`Next`,` `,(0,G.jsx)(pe,{size:14})]})]})]}),v&&(0,G.jsx)(wr,{set:v,onClose:()=>y(null)}),b&&(0,G.jsx)(Sr,{kind:e,onClose:()=>x(!1),onCreated:()=>void T()})]})}function Dr({loader:e,cacheKey:t,className:n,playOnHover:r=!0,onError:i}){let a=(0,g.useRef)(null),o=(0,g.useRef)(null);(0,g.useEffect)(()=>{let t=!1;return e().then(e=>{t||!a.current||(o.current?.destroy(),o.current=Zn.default.loadAnimation({container:a.current,renderer:`canvas`,loop:!0,autoplay:!1,animationData:structuredClone(e)}),o.current.goToAndStop(0,!0))}).catch(()=>i?.()),()=>{t=!0,o.current?.destroy(),o.current=null}},[t]);function s(){r&&o.current?.play()}function c(){r&&o.current?.goToAndStop(0,!0)}return(0,G.jsx)(`div`,{className:n,ref:a,onMouseEnter:s,onMouseLeave:c})}var Or=`777000`;function kr(e){let t=e.rarity_permille>0?` · ${(e.rarity_permille/10).toFixed(1)}%`:``;return`${e.name||`#${e.id}`}${t}`}function Ar({gift:e,onDone:t}){let[n,r]=(0,g.useState)(`user`),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(!1),[m,h]=(0,g.useState)(null),[_,v]=(0,g.useState)(``),[y,b]=(0,g.useState)(`0`),[x,S]=(0,g.useState)(`0`),[C,w]=(0,g.useState)(`0`),[T,E]=(0,g.useState)(``),[D,A]=(0,g.useState)(null),[j,M]=(0,g.useState)(``),[N,P]=(0,g.useState)(!1),F=n===`user`?i?.ID??0:o?.ID??0,ee=n===`user`&&f;(0,g.useEffect)(()=>{p(!1),h(null),v(``),b(`0`),S(`0`),w(`0`),A(null),M(``)},[e.GiftID]),(0,g.useEffect)(()=>{if(!ee||m)return;let t=!1;return v(``),k.giftCollectibles(e.GiftID).then(e=>{t||h(e)}).catch(e=>{t||v(O(e))}),()=>{t=!0}},[ee,m,e.GiftID]);function te(t){return{gift_id:e.GiftID,sender_user_id:Number(Or),user_id:n===`user`?F:0,channel_id:n===`channel`?F:0,hide_name:u,message:c.trim(),upgrade:ee,model_attribute_id:ee?y:`0`,pattern_attribute_id:ee?x:`0`,backdrop_attribute_id:ee?C:`0`,reason:T.trim(),confirm:t}}let ne=(0,g.useMemo)(()=>te(!1),[e.GiftID,n,F,c,u,f,y,x,C,T]),re=D?.dry_run&&!D.error;async function ie(e){if(F<=0){M(`Select a recipient first`);return}if(!T.trim()){M(`Please enter an operation reason`);return}P(!0),M(``);try{let n=await k.action(`/api/actions/give-gift`,te(e));A(n),e&&!n.error&&t?.()}catch(e){M(O(e))}finally{P(!1)}}return(0,G.jsxs)(`div`,{className:`give-gift-form`,children:[(0,G.jsxs)(`div`,{className:`give-gift-summary`,children:[(0,G.jsx)(B,{size:16}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:e.Title||`Gift #${e.GiftID}`}),(0,G.jsxs)(`span`,{className:`mono`,children:[`#`,e.GiftID,` · ⭐ `,e.Stars]})]})]}),(0,G.jsxs)(`div`,{className:`give-gift-tabs`,role:`group`,"aria-label":`Recipient type`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`btn ${n===`user`?`primary`:``}`,onClick:()=>{r(`user`),A(null)},children:[(0,G.jsx)(et,{size:15}),` `,`User`]}),(0,G.jsxs)(`button`,{type:`button`,className:`btn ${n===`channel`?`primary`:``}`,onClick:()=>{r(`channel`),p(!1),A(null)},children:[(0,G.jsx)(tt,{size:15}),` `,`Channel`]})]}),n===`user`?(0,G.jsx)(An,{label:`Recipient user`,value:i,onChange:e=>{a(e),A(null)}}):(0,G.jsx)(Mn,{label:`Recipient channel`,value:o,onChange:e=>{s(e),A(null)}}),(0,G.jsxs)(`label`,{className:`form-field`,children:[(0,G.jsx)(`span`,{children:`Sender account ID`}),(0,G.jsx)(`input`,{value:Or,disabled:!0,readOnly:!0}),(0,G.jsx)(`small`,{className:`field-hint`,children:`Gifts are always sent from the system account 777000 (Telesrv).`})]}),(0,G.jsxs)(`label`,{className:`form-field`,children:[(0,G.jsx)(`span`,{children:`Attached message (optional)`}),(0,G.jsx)(`textarea`,{value:c,rows:2,maxLength:128,onChange:e=>{l(e.target.value),A(null)},placeholder:`Shown with the gift`})]}),(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>{d(e.target.checked),A(null)}}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Hide sender name from recipient`})]}),n===`user`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`gift-switch`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>{p(e.target.checked),e.target.checked||(b(`0`),S(`0`),w(`0`)),A(null)}}),(0,G.jsx)(`span`,{className:`gift-switch-track`,"aria-hidden":`true`,children:(0,G.jsx)(`span`,{})}),(0,G.jsx)(`span`,{children:`Deliver as upgraded collectible`})]}),f&&(0,G.jsx)(`p`,{className:`give-gift-upgrade-note`,children:`The gift is minted as a unique collectible. Pick specific attributes below, or leave them on Random to draw from the published pool. The collectible number is assigned automatically. Requires a published collectible upgrade with remaining supply.`}),f&&_&&(0,G.jsx)(q,{children:_}),f&&m&&(0,G.jsxs)(`div`,{className:`gift-fields-grid give-gift-attrs`,children:[(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Model`}),(0,G.jsxs)(`select`,{value:y,onChange:e=>{b(e.target.value),A(null)},children:[(0,G.jsx)(`option`,{value:`0`,children:`Random`}),(m.models??[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:kr(e)},e.id))]})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Pattern`}),(0,G.jsxs)(`select`,{value:x,onChange:e=>{S(e.target.value),A(null)},children:[(0,G.jsx)(`option`,{value:`0`,children:`Random`}),(m.patterns??[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:kr(e)},e.id))]})]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`span`,{children:`Backdrop`}),(0,G.jsxs)(`select`,{value:C,onChange:e=>{w(e.target.value),A(null)},children:[(0,G.jsx)(`option`,{value:`0`,children:`Random`}),(m.backdrops??[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:kr(e)},e.id))]})]})]})]}),(0,G.jsxs)(`label`,{className:`form-field`,children:[(0,G.jsx)(`span`,{children:`Operation reason`}),(0,G.jsx)(`textarea`,{value:T,rows:2,onChange:e=>E(e.target.value),placeholder:`Describe why this operation is being performed`})]}),(0,G.jsxs)(`div`,{className:`command-preview`,children:[(0,G.jsx)(`div`,{className:`preview-head`,children:`Request preview`}),(0,G.jsx)(kt,{value:JSON.stringify(ne,null,2)})]}),j&&(0,G.jsx)(q,{children:j}),D&&(0,G.jsxs)(`div`,{className:`result-box`,children:[(0,G.jsxs)(`div`,{className:`result-title`,children:[D.error?(0,G.jsx)(I,{size:16}):(0,G.jsx)(L,{size:16}),(0,G.jsx)(`strong`,{children:D.message||D.error||`Action result`})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Command ID`}),(0,G.jsx)(`strong`,{children:D.command_id})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsx)(`strong`,{children:D.status})]}),(0,G.jsxs)(`div`,{className:`result-line`,children:[(0,G.jsx)(`span`,{children:`Dry-run`}),(0,G.jsx)(`strong`,{children:D.dry_run?`Yes`:`No`})]}),D.details&&(0,G.jsx)(kt,{value:JSON.stringify(D.details,null,2)})]}),(0,G.jsxs)(`div`,{className:`give-gift-form-actions`,children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>ie(!1),disabled:N,children:[N?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Ne,{size:15}),D?`Run dry-run again`:`Run dry-run first`]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`button`,onClick:()=>ie(!0),disabled:N||!re,children:[(0,G.jsx)(B,{size:15}),`Give gift`]})]})]})}function jr(){let[e,t]=(0,g.useState)([]),[n,r]=(0,g.useState)(``),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(!1);async function u(){l(!0),s(``);try{let e=(await k.gifts()).Gifts??[];t(e),a(t=>t??e[0]??null)}catch(e){s(O(e))}finally{l(!1)}}(0,g.useEffect)(()=>{u()},[]);let d=(0,g.useMemo)(()=>{let t=n.trim().toLowerCase();return t?e.filter(e=>String(e.GiftID).includes(t)||e.Title.toLowerCase().includes(t)):e},[e,n]);return(0,G.jsxs)(St,{title:`Give Gifts`,eyebrow:`Grant catalog gifts to any user or channel`,actions:(0,G.jsxs)(`button`,{className:`btn`,type:`button`,onClick:()=>u(),disabled:c,children:[(0,G.jsx)(Le,{size:15}),` `,`Refresh`]}),children:[o&&(0,G.jsx)(q,{children:o}),(0,G.jsx)(`p`,{className:`give-gift-upgrade-note`,children:`Pick a gift to grant. Delivery is free of charge and sent from the system account 777000 (Telesrv) by default.`}),(0,G.jsxs)(`div`,{className:`give-gift-layout`,children:[(0,G.jsxs)(`section`,{className:`give-gift-picker`,children:[(0,G.jsxs)(`div`,{className:`give-gift-picker-head`,children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`Search by title or gift ID`})]}),(0,G.jsx)(`span`,{className:`gift-list-summary`,children:`Showing ${d.length} of ${e.length}`})]}),(0,G.jsxs)(`div`,{className:`give-gift-picker-list`,role:`listbox`,"aria-label":`Select a gift`,children:[d.map(e=>{let t=i?.GiftID===e.GiftID;return(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,className:`give-gift-option ${t?`selected`:``} ${e.Enabled?``:`gift-row-disabled`}`,onClick:()=>a(e),children:[(0,G.jsx)(Dr,{className:`give-gift-thumb`,cacheKey:`${e.GiftID}:${e.Revision}`,loader:()=>k.giftAnimation(e.GiftID)}),(0,G.jsxs)(`span`,{className:`give-gift-option-info`,children:[(0,G.jsx)(`strong`,{children:e.Title||`Gift #${e.GiftID}`}),(0,G.jsxs)(`span`,{className:`mono`,children:[`#`,e.GiftID]})]}),(0,G.jsx)(`span`,{className:`give-gift-option-price`,children:e.Enabled?(0,G.jsxs)(J,{children:[`⭐ `,e.Stars]}):(0,G.jsx)(J,{tone:`neutral`,children:`Disabled`})})]},e.GiftID)}),d.length===0&&!c&&(0,G.jsx)(`div`,{className:`official-gift-empty`,children:`No results`})]})]}),(0,G.jsx)(`section`,{className:`give-gift-panel`,children:i?(0,G.jsx)(Ar,{gift:i,onDone:()=>void u()},i.GiftID):(0,G.jsxs)(`div`,{className:`give-gift-empty-panel`,children:[(0,G.jsx)(B,{size:26}),(0,G.jsx)(`p`,{children:`Select a gift from the list to start.`})]})})]})]})}var Mr=`open,in_review,action_pending,action_failed,appeal_review`,Nr=[{value:Mr,label:`Active queue`},{value:`open,in_review,action_pending,action_failed,resolved,dismissed,appeal_review`,label:`All statuses`},{value:`open`,label:`Open`},{value:`in_review`,label:`In review`},{value:`action_pending`,label:`Action pending`},{value:`action_failed`,label:`Action failed`},{value:`appeal_review`,label:`Appeal review`},{value:`resolved`,label:`Resolved`},{value:`dismissed`,label:`Dismissed`}];function Pr({navigate:e}){let[t,n]=(0,g.useState)(Mr),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``);async function d(){c(!0),u(``);try{let e=new URLSearchParams({statuses:t,limit:`100`});r.trim()&&e.set(`assigned_to`,r.trim()),o((await k.moderationCases(e)).cases)}catch(e){u(O(e))}finally{c(!1)}}(0,g.useEffect)(()=>{d()},[]);let f=a.filter(e=>e.Status===`action_pending`||e.Status===`action_failed`).length,p=a.filter(e=>e.Severity===4).length;return(0,G.jsxs)(St,{title:`Reports and Moderation`,eyebrow:`Moderation / Cases`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:d,disabled:s,children:[(0,G.jsx)(Le,{size:15,className:s?`spin`:``}),` `,`Refresh`]}),children:[l&&(0,G.jsx)(q,{children:l}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Current queue`,value:String(a.length)}),(0,G.jsx)(Y,{label:`Critical cases`,value:String(p),tone:p?`danger`:`neutral`}),(0,G.jsx)(Y,{label:`Pending / failed actions`,value:String(f),tone:f?`warn`:`good`})]}),(0,G.jsx)(Ct,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),d()},children:[(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsx)(`select`,{"aria-label":`Case status filter`,value:t,onChange:e=>n(e.target.value),children:Nr.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Reviewer`}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Leave blank for all`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:s,children:[(0,G.jsx)(He,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Case`}),(0,G.jsx)(`th`,{children:`Target`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Severity`}),(0,G.jsx)(`th`,{children:`Reports / Reporters`}),(0,G.jsx)(`th`,{children:`Reviewer`}),(0,G.jsx)(`th`,{children:`Latest report`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[a.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsxs)(`td`,{className:`mono`,children:[`#`,t.ID]}),(0,G.jsx)(`td`,{className:`mono`,children:Br(t.Target.Type,t.Target.ID)}),(0,G.jsx)(`td`,{children:(0,G.jsx)(Fr,{status:t.Status})}),(0,G.jsx)(`td`,{children:(0,G.jsx)(Lr,{value:t.Severity})}),(0,G.jsxs)(`td`,{children:[t.ReportCount,` / `,t.DistinctReporterCount]}),(0,G.jsx)(`td`,{children:t.AssignedTo||`-`}),(0,G.jsx)(`td`,{children:W(t.LastReportAt)}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,onClick:()=>e(`/moderation/${t.ID}`),children:[`Review`,` `,(0,G.jsx)(pe,{size:14})]})})]},t.ID)),a.length===0&&(0,G.jsx)(Dt,{colSpan:8})]})]})})]})}function Fr({status:e}){return(0,G.jsx)(J,{tone:e===`resolved`||e===`dismissed`?`good`:e===`action_failed`?`danger`:e===`action_pending`?`warn`:`neutral`,children:zr(`status`,e)})}var Ir={low:`Low`,medium:`Medium`,high:`High`,critical:`Critical`};function Lr({value:e}){let t=[``,`low`,`medium`,`high`,`critical`][e];return(0,G.jsx)(J,{tone:e>=4?`danger`:e>=3?`warn`:`neutral`,children:t?Ir[t]:e})}var Rr={status:{open:`Open`,in_review:`In review`,action_pending:`Action pending`,action_failed:`Action failed`,appeal_review:`Appeal review`,resolved:`Resolved`,dismissed:`Dismissed`},targetType:{channel:`Channel`,chat:`Group`,user:`Account`},source:{account_peer:`Account / peer`,antispam_false_positive:`Anti-spam false positive`,channel_spam:`Channel spam`,encrypted_spam:`Encrypted-chat spam`,ephemeral:`Ephemeral media`,messages:`Messages`,messages_spam:`Message spam`,profile_photo:`Profile photo`,reaction:`Reaction`,sponsored:`Sponsored message`,story:`Story`},reason:{child_abuse:`Child abuse`,copyright:`Copyright`,fake:`Fake`,geo_irrelevant:`Location-irrelevant`,illegal_drugs:`Illegal drugs`,other:`Other`,personal_details:`Personal details`,pornography:`Pornography`,spam:`Spam`,violence:`Violence`}};function zr(e,t){return Rr[e]?.[t]??t}function Br(e,t){return`${zr(`targetType`,e)} #${t}`}function Vr({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(`no_violation`),[u,d]=(0,g.useState)(``),[f,p]=(0,g.useState)(``),[m,h]=(0,g.useState)(!0),[_,v]=(0,g.useState)(!1),[y,b]=(0,g.useState)(``);function x(e){a(e),e&&(d(e.Items.filter(e=>e.Kind===`message`).map(e=>Number(e.ItemID)).filter(e=>Number.isSafeInteger(e)&&e>0).join(`, `)),p(String(e.ReporterUserID)))}async function S(){b(``);try{let t=await k.moderationCase(e);r(t);let n=t.ReportIDs[0];x(n?await k.moderationReport(n):null)}catch(e){b(O(e))}}(0,g.useEffect)(()=>{S()},[e]);let C=(0,g.useMemo)(()=>Hr(c,n?.Case.Target.Type,Ur(u),Number(f),m),[c,n?.Case.Target.Type,u,f,m]),w=(0,g.useMemo)(()=>n?Wr(n):{actions:[],label:`None`,blocked:!1},[n]);async function T(){if(n){v(!0),b(``);try{await k.claimModerationCase(e,n.Case.Version),await S()}catch(e){b(O(e))}finally{v(!1)}}}async function E(){if(!n||!o.trim()){b(`A review reason is required.`);return}if(c===`delete_messages`&&C.length===0){b(n.Case.Target.Type===`user`?`Private-message deletion requires valid evidence message IDs and the reporter's owner_user_id.`:`Channel-message deletion requires at least one valid evidence message ID.`);return}if(window.confirm(`Submit the “${Gr(c)}” decision? The action will run through the durable action queue.`)){v(!0),b(``);try{r((await k.decideModerationCase(e,{expected_version:n.Case.Version,reason:o.trim(),kind:c===`no_violation`?`no_violation`:`violation`,actions:C})).case),s(``)}catch(e){b(O(e))}finally{v(!1)}}}async function D(t,i){if(!n||!o.trim()){b(`An appeal review reason is required.`);return}if(window.confirm(i?`Grant this appeal?`:`Deny this appeal?`)){v(!0);try{r((await k.reviewModerationAppeal(e,t,{expected_version:n.Case.Version,reason:o.trim(),granted:i,actions:i?w.actions:[]})).case),s(``)}catch(e){b(O(e))}finally{v(!1)}}}if(y&&!n)return(0,G.jsx)(q,{children:y});if(!n)return(0,G.jsx)(Ot,{label:`Loading moderation case…`});let A=n.Case,j=A.Status===`open`||A.Status===`in_review`||A.Status===`appeal_review`,M=(A.Status===`in_review`||A.Status===`action_failed`)&&!!A.AssignedTo,N=M&&(A.Status!==`action_failed`||c!==`no_violation`),P=n.Appeals.find(e=>e.Status===`pending`);return(0,G.jsxs)(St,{title:`Review case #${A.ID}`,eyebrow:`Moderation / Case detail`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:()=>t(`/moderation`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to queue`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,onClick:S,children:[(0,G.jsx)(Le,{size:15}),` `,`Refresh`]})]}),children:[y&&(0,G.jsx)(q,{children:y}),(0,G.jsx)(wt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:Br(A.Target.Type,A.Target.ID)}),(0,G.jsx)(`div`,{className:`entity-subtitle`,children:`Version ${A.Version} · Updated ${W(A.UpdatedAt)}`})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(Fr,{status:A.Status}),(0,G.jsx)(Lr,{value:A.Severity})]})]}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Target`,value:Br(A.Target.Type,A.Target.ID),mono:!0}),(0,G.jsx)(X,{label:`Reports`,value:`${A.ReportCount} reports from ${A.DistinctReporterCount} reporters`}),(0,G.jsx)(X,{label:`Reviewer`,value:A.AssignedTo||`-`}),(0,G.jsx)(X,{label:`First / latest report`,value:`${W(A.FirstReportAt)} / ${W(A.LastReportAt)}`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Report evidence`,text:`Shows up to the latest 100 reports; snapshots are frozen when reports are admitted.`}),(0,G.jsx)(`div`,{className:`toolbar`,children:n.ReportIDs.map(e=>(0,G.jsxs)(`button`,{className:`btn`,onClick:async()=>x(await k.moderationReport(e)),children:[`#`,e]},e))}),i&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Source / Reason`,value:`${zr(`source`,i.Source)} / ${zr(`reason`,i.Reason)}`}),(0,G.jsx)(X,{label:`Reporter`,value:String(i.ReporterUserID),mono:!0}),(0,G.jsx)(X,{label:`Option`,value:i.Option,mono:!0}),(0,G.jsx)(X,{label:`Time`,value:W(i.CreatedAt)})]}),i.Comment&&(0,G.jsx)(`p`,{className:`about-text`,children:i.Comment}),(0,G.jsx)(kt,{value:JSON.stringify(i,null,2)})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Decision and action audit`,text:`Actions run idempotently through a lease worker; failures retain their error and attempt count.`}),(0,G.jsx)(kt,{value:JSON.stringify({decisions:n.Decisions,actions:n.Actions},null,2)})]}),n.Appeals.length>0&&(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Appeals`}),(0,G.jsx)(kt,{value:JSON.stringify(n.Appeals,null,2)})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Case actions`}),j&&(0,G.jsxs)(`button`,{className:`btn primary icon-text`,disabled:_,onClick:T,children:[(0,G.jsx)(Ue,{size:15}),` `,A.AssignedTo?`Renew claim`:`Claim case`]}),(0,G.jsxs)(`label`,{className:`field`,children:[(0,G.jsx)(`span`,{children:`Review reason`}),(0,G.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),rows:5})]}),(0,G.jsxs)(`label`,{className:`field`,children:[(0,G.jsx)(`span`,{children:`Decision template`}),(0,G.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),children:[(0,G.jsx)(`option`,{value:`no_violation`,children:`No violation (dismiss report)`}),(0,G.jsx)(`option`,{value:`scam`,children:`Mark as SCAM`}),(0,G.jsx)(`option`,{value:`fake`,children:`Mark as FAKE`}),(0,G.jsx)(`option`,{value:`freeze`,children:`Freeze account`}),(0,G.jsx)(`option`,{value:`scam_freeze`,children:`SCAM + freeze`}),(0,G.jsx)(`option`,{value:`fake_freeze`,children:`FAKE + freeze`}),(0,G.jsx)(`option`,{value:`delete_messages`,children:`Delete messages covered by evidence`}),(0,G.jsx)(`option`,{value:`delete_account`,children:`Delete account`})]})]}),c===`delete_messages`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`field`,children:[(0,G.jsx)(`span`,{children:`Evidence message IDs (comma-separated)`}),(0,G.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`101, 102`})]}),A.Target.Type===`user`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`field`,children:[(0,G.jsx)(`span`,{children:`Private-chat owner_user_id`}),(0,G.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),inputMode:`numeric`})]}),(0,G.jsxs)(`label`,{className:`field checkbox-field`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked)}),(0,G.jsx)(`span`,{children:`Revoke for both sides`})]})]}),(0,G.jsx)(q,{children:`The server will verify again that every message ID exists in this case's immutable report evidence.`})]}),A.Status===`action_failed`&&c===`no_violation`&&(0,G.jsx)(q,{children:`The action was partially executed and cannot be changed directly to no violation. Select a new action to retry while retaining the previous failure audit.`}),M&&(0,G.jsxs)(`button`,{className:`btn danger icon-text`,disabled:_||!N,onClick:E,children:[(0,G.jsx)(L,{size:15}),` `,A.Status===`action_failed`?`Retry action`:`Submit decision`]}),P&&A.AssignedTo&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Appeal review #${P.ID}`}),(0,G.jsx)(X,{label:`Automatic remedy after approval`,value:w.label}),w.blocked&&(0,G.jsx)(q,{children:`The case contains a completed irreversible deletion. It cannot be marked as approved and restored; deny it or escalate for manual handling.`}),(0,G.jsx)(`button`,{className:`btn`,disabled:_,onClick:()=>D(P.ID,!1),children:`Deny appeal`}),(0,G.jsx)(`button`,{className:`btn primary`,disabled:_||w.blocked,onClick:()=>D(P.ID,!0),children:`Grant appeal`})]})]})})]})}function Hr(e,t,n,r,i){switch(e){case`scam`:return[{kind:`mark_scam`,payload:{}}];case`fake`:return[{kind:`mark_fake`,payload:{}}];case`freeze`:return[{kind:`freeze_account`,payload:{}}];case`scam_freeze`:return[{kind:`mark_scam`,payload:{}},{kind:`freeze_account`,payload:{}}];case`fake_freeze`:return[{kind:`mark_fake`,payload:{}},{kind:`freeze_account`,payload:{}}];case`delete_messages`:return n.length===0?[]:t===`channel`?[{kind:`delete_channel_message`,payload:{ids:n}}]:t===`user`&&Number.isSafeInteger(r)&&r>0?[{kind:`delete_private_message`,payload:{owner_user_id:r,ids:n,revoke:i}}]:[];case`delete_account`:return[{kind:`delete_account`,payload:{}}];default:return[]}}function Ur(e){let t=e.split(/[,\s]+/).filter(Boolean).map(Number);return t.length===0||t.some(e=>!Number.isSafeInteger(e)||e<=0)?[]:[...new Set(t)]}function Wr(e){let t=!1,n=!1,r=!1;for(let i of[...e.Actions].sort((e,t)=>e.ID-t.ID))if(i.Status===`succeeded`)switch(i.Kind){case`mark_scam`:case`mark_fake`:t=!0;break;case`clear_peer_flags`:t=!1;break;case`freeze_account`:n=!0;break;case`unfreeze_account`:n=!1;break;case`delete_private_message`:case`delete_channel_message`:case`delete_account`:r=!0;break}let i=[],a=[];return t&&(i.push({kind:`clear_peer_flags`,payload:{}}),a.push(`Clear SCAM / FAKE`)),n&&(i.push({kind:`unfreeze_account`,payload:{}}),a.push(`Unfreeze account`)),{actions:i,label:a.join(` + `)||`No recovery action needed`,blocked:r}}function Gr(e){return{no_violation:`No violation (dismiss report)`,scam:`Mark as SCAM`,fake:`Mark as FAKE`,freeze:`Freeze account`,scam_freeze:`SCAM + freeze`,fake_freeze:`FAKE + freeze`,delete_messages:`Delete messages covered by evidence`,delete_account:`Delete account`}[e]}function Kr({navigate:e}){let[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)([]),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(0),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``);async function p(){try{n(await k.storageStats())}catch{}}async function m(e=!1){u(!0),f(``);let t=new URLSearchParams({limit:`50`,offset:String(e?s:0)});try{let n=await k.storageAccounts(t),r=n.rows??[];i(t=>e?[...t,...r]:r),c(n.next_offset),o(!!n.has_more)}catch(e){f(O(e))}finally{u(!1)}}function h(){p(),m(!1)}(0,g.useEffect)(()=>{h()},[]);let _=t?Math.max(0,Number(t.LogicalBytes)-Number(t.PhysicalBytes)):0;return(0,G.jsxs)(St,{title:`Storage`,eyebrow:`Media / Storage usage`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:h,disabled:l,children:[(0,G.jsx)(Le,{size:15,className:l?`spin`:``}),` `,`Refresh`]}),children:[d&&(0,G.jsx)(q,{children:d}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Physical usage (on disk / S3)`,value:t?vt(t.PhysicalBytes):`-`}),(0,G.jsx)(Y,{label:`Logical usage (sum per account)`,value:t?vt(t.LogicalBytes):`-`}),(0,G.jsx)(Y,{label:`Saved by dedup`,value:vt(String(_)),tone:_>0?`good`:`neutral`}),(0,G.jsx)(Y,{label:`Backend`,value:t?.BackendKind??`-`})]}),(0,G.jsxs)(`div`,{className:`metric-row`,children:[(0,G.jsx)(Y,{label:`Documents`,value:t?dt(t.DocumentCount):`-`}),(0,G.jsx)(Y,{label:`Photos`,value:t?dt(t.PhotoCount):`-`}),(0,G.jsx)(Y,{label:`Accounts with media`,value:t?dt(t.AccountCount):`-`}),(0,G.jsx)(Y,{label:`Unattributed`,value:t?vt(t.UnattributedBytes):`-`,tone:t&&Number(t.UnattributedBytes)>0?`warn`:`neutral`})]}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`User ID`}),(0,G.jsx)(`th`,{children:`Account`}),(0,G.jsx)(`th`,{children:`Storage used`}),(0,G.jsx)(`th`,{children:`Files`})]})}),(0,G.jsxs)(`tbody`,{children:[r.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:e.UserID}),(0,G.jsx)(`td`,{children:U(e.Username)||e.FirstName||`-`}),(0,G.jsx)(`td`,{className:`mono`,children:vt(e.Bytes)}),(0,G.jsx)(`td`,{className:`mono`,children:dt(e.FileCount)})]},e.UserID)),r.length===0&&(0,G.jsx)(Dt,{colSpan:4})]})]})}),a&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>m(!0),disabled:l,children:[l?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function qr(e){let t=e.toLowerCase();return t.includes(`tgsticker`)||t.includes(`lottie`)||t.includes(`json`)}function Jr({row:e}){let[t,n]=(0,g.useState)(!qr(e.MimeType));return(0,g.useEffect)(()=>{n(!qr(e.MimeType))},[e.DocumentID,e.MimeType]),t?(0,G.jsx)(`div`,{className:`emoji-picker-glyph`,children:e.Alt||`🙂`}):(0,G.jsx)(Dr,{className:`emoji-picker-anim`,cacheKey:e.DocumentID,loader:()=>k.emojiAnimation(e.DocumentID),onError:()=>n(!0)})}function Yr({label:e,value:t,onChange:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(``),d=a.find(e=>e.DocumentID===t)??null;async function f(){c(!0),u(``);let e=new URLSearchParams({limit:`24`});r.trim()&&e.set(`q`,r.trim());try{o((await k.emoji(e)).rows??[])}catch(e){u(O(e))}finally{c(!1)}}return(0,g.useEffect)(()=>{f()},[]),(0,G.jsxs)(`div`,{className:`entity-picker`,children:[(0,G.jsxs)(`div`,{className:`picker-head`,children:[(0,G.jsx)(`span`,{children:e}),t?(0,G.jsxs)(`button`,{className:`link-button`,type:`button`,onClick:()=>n(``),children:[(0,G.jsx)(rt,{size:13}),` `,`Clear`]}):null]}),t?(0,G.jsxs)(`div`,{className:`selected-entity`,children:[(0,G.jsx)(z,{size:15}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:d?.Alt||`—`}),(0,G.jsx)(`span`,{className:`mono`,children:t})]}),(0,G.jsx)(`span`,{children:d?.SetTitle||`-`})]}):null,(0,G.jsxs)(`div`,{className:`picker-search`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),f())},placeholder:`Search document ID or emoji`}),(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:f,disabled:s,children:s?(0,G.jsx)(R,{size:14,className:`spin`}):`Search`})]}),l&&(0,G.jsx)(`div`,{className:`picker-error`,children:l}),(0,G.jsxs)(`div`,{className:`picker-results emoji-picker-results`,children:[a.map(e=>(0,G.jsxs)(`button`,{className:`picker-row emoji-picker-row ${t===e.DocumentID?`selected`:``}`,type:`button`,onClick:()=>n(e.DocumentID),children:[(0,G.jsx)(Jr,{row:e}),(0,G.jsx)(`span`,{className:`mono`,children:e.DocumentID}),(0,G.jsx)(`span`,{children:e.SetTitle||`—`})]},e.DocumentID)),a.length===0&&!s?(0,G.jsx)(`div`,{className:`picker-empty`,children:`No results`}):null]})]})}var Xr=[`pending`,`approved`,`rejected`,`revoked`],Zr=[`user`,`channel`],Qr={pending:`Pending`,approved:`Approved`,rejected:`Rejected`,revoked:`Mark revoked`},$r={user:`Account`,channel:`Channel`};function ei({navigate:e}){let{can:t}=It(),n=t(Nt),r=t(jt),[i,a]=(0,g.useState)(`requests`),[o,s]=(0,g.useState)([]),[c,l]=(0,g.useState)([]),[u,d]=(0,g.useState)(``),[f,p]=(0,g.useState)(!1);async function m(){d(``),p(!1);try{let[e,t]=await Promise.all([k.botVerifiers(new URLSearchParams({limit:`200`})),k.verificationIcons(new URLSearchParams({limit:`200`}))]);s(e.rows??[]),l(t.rows??[])}catch(e){if(e instanceof v&&e.status===403){s([]),l([]),p(!0);return}d(O(e))}}return(0,g.useEffect)(()=>{m()},[]),(0,G.jsxs)(St,{title:`Third-party verification`,eyebrow:`Third-party verification / Verifiers, icons, marks`,actions:r?(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>e(`/verification`),children:[(0,G.jsx)(ge,{size:15}),` `,`Official verification`]}):void 0,children:[u&&(0,G.jsx)(q,{children:u}),f&&(0,G.jsx)(q,{children:`The server refused the verifier roster and the icon catalogue for this session (403), so both lists are empty here — applications can still be reviewed.`}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`A verifier company's icon — not the official checkmark`,text:`A third-party mark is a verifier bot's own icon, drawn right BEFORE the name of an account, a bot or a channel, plus one line of description in the profile. It says “this verifier vouches for this peer”, and nothing more.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The icon is a custom emoji document. The client fetches it through messages.getCustomEmojiDocuments, so a document id that resolves to nothing renders as no badge at all — which is why marks are granted from the catalogue below rather than from a typed number.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The official checkmark is a different mechanism, granted by the platform in the Verification section. The two are stored, shown and taken away separately, and neither one implies the other.`}),!n&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This session can read the section and decide applications, but not change verifiers or the icon catalogue — that needs the botverification.manage permission.`})]}),(0,G.jsx)(`div`,{className:`toolbar`,role:`group`,"aria-label":`Third-party verification`,children:[{key:`requests`,label:`Applications`,icon:(0,G.jsx)(qe,{size:15})},{key:`verifiers`,label:`Verifiers`,icon:(0,G.jsx)(ce,{size:15})},{key:`icons`,label:`Icon catalogue`,icon:(0,G.jsx)(Ye,{size:15})},{key:`marks`,label:`Granted marks`,icon:(0,G.jsx)(F,{size:15})}].map(e=>(0,G.jsxs)(`button`,{className:`btn icon-text ${i===e.key?`primary`:``}`,type:`button`,"aria-pressed":i===e.key,onClick:()=>a(e.key),children:[e.icon,` `,e.label]},e.key))}),i===`requests`&&(0,G.jsx)(ti,{navigate:e,verifiers:o}),i===`verifiers`&&(0,G.jsx)(ni,{verifiers:o,icons:c,canManage:n,onChanged:m,navigate:e}),i===`icons`&&(0,G.jsx)(ri,{icons:c,verifiers:o,canManage:n,onChanged:m}),i===`marks`&&(0,G.jsx)(ii,{verifiers:o,canManage:n,navigate:e})]})}function ti({navigate:e,verifiers:t}){let[n,r]=(0,g.useState)(`pending`),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(`all`),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(`50`),[f,p]=(0,g.useState)([]),[m,h]=(0,g.useState)({}),[_,v]=(0,g.useState)(!1),[y,b]=(0,g.useState)(``),[x,S]=(0,g.useState)(!1),[C,w]=(0,g.useState)(``);async function T(e=!1){S(!0),w(``);let t=new URLSearchParams({limit:u});n!==`all`&&t.set(`status`,n),i&&t.set(`verifier_bot_id`,i),o!==`all`&&t.set(`peer_type`,o),c.trim()&&t.set(`q`,c.trim().replace(/^@/,``)),e&&y&&t.set(`before_id`,y);try{let n=await k.customVerificationRequests(t),r=n.rows??[];p(t=>e?[...t,...r]:r),b(n.next_before_id??``),v(!!n.has_more)}catch(e){w(O(e))}finally{S(!1)}}async function E(){try{h((await k.botVerificationCounts()).counts??{})}catch(e){w(O(e))}}(0,g.useEffect)(()=>{T(!1),E()},[]);function D(){T(!1),E()}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Application queue`,text:`Applications filed with a verifier bot by the owner of the peer. The counters cover the whole queue, not the page below.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:D,disabled:x,children:[(0,G.jsx)(Le,{size:15,className:x?`spin`:``}),` `,`Refresh`]})}),C&&(0,G.jsx)(q,{children:C}),(0,G.jsx)(`div`,{className:`metric-row`,children:Xr.map(e=>(0,G.jsx)(Y,{label:Qr[e],value:m[e]??`0`,mono:!0,tone:ci(e,m[e]??`0`)},e))})]}),(0,G.jsx)(Ct,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),T(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),placeholder:`Application id, peer id, username or title`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsxs)(`select`,{value:n,onChange:e=>r(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All statuses`}),Xr.map(e=>(0,G.jsx)(`option`,{value:e,children:Qr[e]},e))]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Verifier`}),(0,G.jsx)(ai,{value:i,verifiers:t,onChange:a})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Peer type`}),(0,G.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All types`}),Zr.map(e=>(0,G.jsx)(`option`,{value:e,children:$r[e]},e))]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:u,onChange:e=>d(e.target.value),type:`number`,min:`1`,max:`200`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:x,children:[x?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Re,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Verifier`}),(0,G.jsx)(`th`,{children:`Peer`}),(0,G.jsx)(`th`,{children:`Applicant`}),(0,G.jsx)(`th`,{children:`Stated reason`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Filed`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[f.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/bot-verification/${t.ID}`),children:[`#`,t.ID]})}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{children:U(t.VerifierBotUsername)||t.VerifierBotID}),(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:t.VerifierBotID})]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{children:li(t)}),(0,G.jsxs)(`div`,{className:`entity-subtitle mono`,children:[$r[t.PeerType],` · `,t.PeerID]})]}),(0,G.jsxs)(`td`,{children:[U(t.ApplicantUsername)||`-`,(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:t.ApplicantUserID})]}),(0,G.jsx)(`td`,{className:`truncate`,children:t.Reason||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsx)(oi,{status:t.Status})}),(0,G.jsx)(`td`,{children:W(t.CreatedAt)||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/bot-verification/${t.ID}`),children:[(0,G.jsx)(qe,{size:14}),` `,`Details`,` `,(0,G.jsx)(pe,{size:14})]})})]},t.ID)),f.length===0&&(0,G.jsx)(Dt,{colSpan:8})]})]})}),_&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>T(!0),disabled:x,children:[x?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function ni({verifiers:e,icons:t,canManage:n,onChanged:r,navigate:i}){let[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)(``),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(``),[h,_]=(0,g.useState)(!1),v=t.filter(e=>e.Active),y=v.map(e=>({value:e.DocumentID,label:`${e.Name} · ${e.DocumentID}`}));if(l&&!y.some(e=>e.value===l)){let e=t.find(e=>e.DocumentID===l);y.unshift({value:l,label:`${e?.Name??l} · ${l} (Retired)`})}function b(e){c(e),o(null),u(e.IconDocumentID),f(e.CompanyName),m(e.DefaultDescription),_(e.CanModifyCustomDescription)}function x(){c(null),o(null),u(``),f(``),m(``),_(!1)}function S(){return{bot_id:s?s.BotID:a?String(a.ID):`0`,icon_document_id:l||`0`,company_name:d.trim(),default_description:p.trim(),can_modify_custom_description:h,version:s?s.Version:`0`}}return(0,G.jsxs)(G.Fragment,{children:[n&&(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:s?`Update verifier`:`Grant verifier status`,text:`The bot gets an icon from the catalogue and a company name to vouch under. The same call updates an existing verifier, which is why it carries a version.`,action:s?(0,G.jsx)(`button`,{className:`btn icon-text`,type:`button`,onClick:x,children:`Cancel update`}):void 0}),s?(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Updating ${U(s.BotUsername)||s.BotID} — version ${s.Version} is sent as the optimistic lock, so a row somebody else changed meanwhile is refused instead of overwritten.`}):(0,G.jsx)(jn,{label:`Bot`,value:a,onChange:o}),(0,G.jsxs)(`div`,{className:`bot-create-fields`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Icon from the catalogue`}),(0,G.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`Pick an icon`}),y.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Company`}),(0,G.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`Acme Verification Ltd`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Default description`}),(0,G.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`Verified by Acme`})]})]}),(0,G.jsxs)(`label`,{className:`checkline`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>_(e.target.checked)}),`The verifier may replace the description per peer`]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This is botVerifierSettings.can_modify_custom_description: with it off, every mark this verifier grants carries the default description above, whatever the applicant asked for.`}),v.length===0&&(0,G.jsx)(q,{children:`The catalogue has no active icon, so there is nothing to grant. Add one in the icon catalogue first.`}),(0,G.jsxs)(`div`,{className:`bot-create-actions`,children:[(0,G.jsx)(`span`,{className:`bot-create-note`,children:`The bot can mark peers as soon as the row exists and is enabled.`}),(0,G.jsx)(Z,{label:s?`Update verifier`:`Grant verifier status`,icon:(0,G.jsx)(Pe,{size:15}),tone:`neutral`,path:`/api/actions/grant-bot-verifier`,payload:S,onDone:()=>{x(),r()}})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Verifier bots`,text:`Bots allowed to hand out their own mark. Verifier status is granted per deployment, so every row here is a badge printer an operator switched on by hand.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:r,children:[(0,G.jsx)(Le,{size:15}),` `,`Refresh`]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Bot`}),(0,G.jsx)(`th`,{children:`Company`}),(0,G.jsx)(`th`,{children:`Icon`}),(0,G.jsx)(`th`,{children:`Own description`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Marks`}),(0,G.jsx)(`th`,{children:`Granted by`}),(0,G.jsx)(`th`,{children:`Updated`}),n&&(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[e.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`button`,{className:`row-link`,type:`button`,onClick:()=>i(`/bots/${e.BotID}`),children:(0,G.jsx)(`strong`,{children:U(e.BotUsername)||e.BotName||e.BotID})}),(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:e.BotID})]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{children:e.CompanyName||`-`}),(0,G.jsx)(`div`,{className:`entity-subtitle truncate`,children:e.DefaultDescription||`Not set`})]}),(0,G.jsxs)(`td`,{children:[e.IconName||`-`,(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:e.IconDocumentID})]}),(0,G.jsx)(`td`,{children:e.CanModifyCustomDescription?`Yes`:`No`}),(0,G.jsx)(`td`,{children:e.Enabled?(0,G.jsx)(J,{tone:`good`,children:`Enabled`}):(0,G.jsx)(J,{tone:`warn`,children:`disabled`})}),(0,G.jsx)(`td`,{className:`mono`,children:String(e.MarkCount??`0`)}),(0,G.jsxs)(`td`,{children:[e.GrantedBy||`-`,(0,G.jsx)(`div`,{className:`entity-subtitle truncate`,children:e.GrantReason||`-`})]}),(0,G.jsx)(`td`,{children:W(e.UpdatedAt)||`-`}),n&&(0,G.jsx)(`td`,{children:(0,G.jsxs)(`div`,{className:`row-actions`,children:[(0,G.jsx)(`button`,{className:`btn compact-btn`,type:`button`,onClick:()=>b(e),children:`Edit`}),(0,G.jsx)(Z,{label:e.Enabled?`Disable`:`Enable`,icon:e.Enabled?(0,G.jsx)(Fe,{size:14}):(0,G.jsx)(Ie,{size:14}),tone:e.Enabled?`warn`:`neutral`,compact:!0,path:`/api/actions/set-bot-verifier-enabled`,payload:()=>({bot_id:e.BotID,enabled:!e.Enabled}),onDone:r}),(0,G.jsx)(Z,{label:`Revoke status`,icon:(0,G.jsx)(H,{size:14}),tone:`danger`,compact:!0,path:`/api/actions/revoke-bot-verifier`,payload:()=>({bot_id:e.BotID}),onDone:r})]})})]},e.BotID)),e.length===0&&(0,G.jsx)(Dt,{colSpan:n?9:8})]})]})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Disabling is the per-verifier kill switch: the marks already granted keep rendering, but the bot can no longer mark anything new and its settings stop being projected into botInfo.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Revoking verifier status removes the row and every mark this verifier granted — the icon disappears from all of its peers at once.`})]})]})}function ri({icons:e,verifiers:t,canManage:n,onChanged:r}){let[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(``);function u(){let e={document_id:i.trim()||`0`,name:o.trim()};return c&&(e.owner_bot_id=c),e}return(0,G.jsxs)(G.Fragment,{children:[n&&(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Add or rename an icon`,text:`Search and pick any custom-emoji document already on this deployment (including bundled/system ones). Adding an id that already exists renames it instead of duplicating it.`}),(0,G.jsx)(Yr,{label:`Document`,value:i,onChange:a}),(0,G.jsxs)(`div`,{className:`bot-create-fields`,children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Name`}),(0,G.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`Acme blue tick`})]}),(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Owner`}),(0,G.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`Shared`}),t.map(e=>(0,G.jsx)(`option`,{value:e.BotID,children:`${e.CompanyName||e.BotID} · ${U(e.BotUsername)||e.BotID}`},e.BotID))]})]})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`A document id that resolves to nothing produces an invisible badge: the peer is marked in the database and the client draws nothing.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`A shared icon may be granted to any verifier; picking an owner reserves it for that one bot.`}),(0,G.jsxs)(`div`,{className:`bot-create-actions`,children:[(0,G.jsx)(`span`,{className:`bot-create-note`,children:`Adding an icon grants nothing by itself — it only makes the document available to grant.`}),(0,G.jsx)(Z,{label:`Save icon`,icon:(0,G.jsx)(Pe,{size:15}),tone:`neutral`,path:`/api/actions/upsert-verification-icon`,payload:u,onDone:()=>{a(``),s(``),l(``),r()}})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Icon catalogue`,text:`The custom emoji documents a verifier may mark with. Nothing else can be used as an icon, so the catalogue is where a wrong badge is prevented rather than fixed.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:r,children:[(0,G.jsx)(Le,{size:15}),` `,`Refresh`]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Document ID`}),(0,G.jsx)(`th`,{children:`Name`}),(0,G.jsx)(`th`,{children:`Owner`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Verifiers using it`}),(0,G.jsx)(`th`,{children:`Filed`}),n&&(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[e.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:e.DocumentID}),(0,G.jsx)(`td`,{children:(0,G.jsx)(`strong`,{children:e.Name||`-`})}),(0,G.jsx)(`td`,{children:e.OwnerBotID&&e.OwnerBotID!==`0`?(0,G.jsxs)(G.Fragment,{children:[U(e.OwnerBotUsername)||e.OwnerBotID,(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:e.OwnerBotID})]}):(0,G.jsx)(J,{children:`Shared`})}),(0,G.jsx)(`td`,{children:e.Active?(0,G.jsx)(J,{tone:`good`,children:`Active`}):(0,G.jsx)(J,{tone:`warn`,children:`Retired`})}),(0,G.jsx)(`td`,{className:`mono`,children:String(e.UsedByVerifiers??`0`)}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)||`-`}),n&&(0,G.jsx)(`td`,{children:(0,G.jsx)(`div`,{className:`row-actions`,children:(0,G.jsx)(Z,{label:e.Active?`Retire`:`Activate`,icon:e.Active?(0,G.jsx)(Fe,{size:14}):(0,G.jsx)(Ie,{size:14}),tone:e.Active?`warn`:`neutral`,compact:!0,path:`/api/actions/set-verification-icon-active`,payload:()=>({icon_id:e.ID,active:!e.Active}),onDone:r})})})]},e.ID)),e.length===0&&(0,G.jsx)(Dt,{colSpan:n?7:6})]})]})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Retiring an icon stops it from being granted to anybody new. Marks already carrying it keep it: the icon is copied onto the mark when it is granted.`})]})]})}function ii({verifiers:e,canManage:t,navigate:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(`all`),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(`50`),[d,f]=(0,g.useState)([]),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(``);async function S(e=!1){y(!0),x(``);let t=new URLSearchParams({limit:l});r&&t.set(`verifier_bot_id`,r),a!==`all`&&t.set(`peer_type`,a),s.trim()&&t.set(`q`,s.trim().replace(/^@/,``)),e&&h&&t.set(`before_id`,h);try{let n=await k.customVerifications(t),r=n.rows??[];f(t=>e?[...t,...r]:r),_(n.next_before_id??``),m(!!n.has_more)}catch(e){x(O(e))}finally{y(!1)}}return(0,g.useEffect)(()=>{S(!1)},[]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Granted marks`,text:`Every peer currently carrying a third-party mark, whoever granted it — an operator decision, the verifier bot itself, or the peer's owner through bots.setCustomVerification.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>S(!1),disabled:v,children:[(0,G.jsx)(Le,{size:15,className:v?`spin`:``}),` `,`Refresh`]})}),b&&(0,G.jsx)(q,{children:b})]}),(0,G.jsx)(Ct,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),S(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Peer id, username or title`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Verifier`}),(0,G.jsx)(ai,{value:r,verifiers:e,onChange:i})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Peer type`}),(0,G.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All types`}),Zr.map(e=>(0,G.jsx)(`option`,{value:e,children:$r[e]},e))]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:l,onChange:e=>u(e.target.value),type:`number`,min:`1`,max:`200`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:v,children:[v?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Re,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Verifier`}),(0,G.jsx)(`th`,{children:`Peer`}),(0,G.jsx)(`th`,{children:`Description`}),(0,G.jsx)(`th`,{children:`Icon`}),(0,G.jsx)(`th`,{children:`Filed`}),t&&(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[d.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsxs)(`td`,{className:`mono`,children:[`#`,e.ID]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{children:e.CompanyName||U(e.VerifierBotUsername)||e.VerifierBotID}),(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:U(e.VerifierBotUsername)||e.VerifierBotID})]}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`button`,{className:`row-link`,type:`button`,onClick:()=>n(ui(e.PeerType,e.PeerID)),children:(0,G.jsx)(`strong`,{children:li(e)})}),(0,G.jsxs)(`div`,{className:`entity-subtitle mono`,children:[$r[e.PeerType],` · `,e.PeerID]})]}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Description||`Not set`}),(0,G.jsx)(`td`,{className:`mono`,children:e.IconDocumentID}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)||`-`}),t&&(0,G.jsx)(`td`,{children:(0,G.jsx)(`div`,{className:`row-actions`,children:(0,G.jsx)(Z,{label:`Remove mark`,icon:(0,G.jsx)(oe,{size:14}),tone:`danger`,compact:!0,path:`/api/actions/revoke-custom-verification`,payload:()=>({verifier_bot_id:e.VerifierBotID,peer_type:e.PeerType,peer_id:e.PeerID}),onDone:()=>S(!1)})})})]},e.ID)),d.length===0&&(0,G.jsx)(Dt,{colSpan:t?7:6})]})]})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Removing a mark clears the icon and the description from the peer. The application it came from keeps its history.`}),p&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>S(!0),disabled:v,children:[v?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function ai({value:e,verifiers:t,onChange:n}){return(0,G.jsxs)(`select`,{value:e,onChange:e=>n(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`All verifiers`}),t.map(e=>(0,G.jsx)(`option`,{value:e.BotID,children:`${e.CompanyName||e.BotID} · ${U(e.BotUsername)||e.BotID}`+(e.Enabled?``:` (disabled)`)},e.BotID))]})}function oi({status:e}){return(0,G.jsx)(J,{tone:si(e),children:Qr[e]})}function si(e){return e===`approved`?`good`:e===`pending`?`warn`:e===`rejected`?`danger`:`neutral`}function ci(e,t){return e===`pending`?t!==`0`&&t!==``?`warn`:`neutral`:e===`approved`?`good`:`neutral`}function li(e){return U(e.PeerUsername)||e.PeerTitle||`#${e.PeerID}`}function ui(e,t){return e===`channel`?`/channels/${t}`:`/accounts/${t}`}function di({id:e,navigate:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(``);async function f(){l(!0),d(``);try{r(await k.customVerificationRequest(e))}catch(e){d(O(e))}finally{l(!1)}}function p(){s(!1),f()}(0,g.useEffect)(()=>{f()},[e]);function m(e){if(e instanceof v&&e.status===409)return s(!0),f(),`Another admin has already changed this application. The data has been reloaded — check the status before deciding again.`}if(u&&!n)return(0,G.jsx)(q,{children:u});if(!n)return(0,G.jsx)(Ot,{label:`Loading the application…`});let h=n.request,_=pi(n.verifier),y=n.mark_active,b=h.Status===`pending`,x=h.Status===`approved`,S=i.trim(),C=h.RequestedDescription.trim(),w=!!_?.CanModifyCustomDescription&&C!==``,T=w?C:(_?.DefaultDescription??``).trim();function E(){let e={version:h.Version};return S&&(e.internal_note=S),e}function D(){a(``),s(!1),f()}return(0,G.jsxs)(St,{title:`Application #${h.ID}`,eyebrow:`Third-party verification / Review`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/bot-verification`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:p,disabled:c,children:[(0,G.jsx)(Le,{size:15,className:c?`spin`:``}),` `,`Refresh`]})]}),children:[u&&(0,G.jsx)(q,{children:u}),o&&(0,G.jsx)(q,{children:`Another admin has already changed this application. The data has been reloaded — check the status before deciding again.`}),(0,G.jsx)(wt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:li(h)}),(0,G.jsxs)(`div`,{className:`entity-subtitle mono`,children:[`#`,h.ID,` · `,$r[h.PeerType],`:`,h.PeerID,` · v`,h.Version]})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(oi,{status:h.Status}),y?(0,G.jsxs)(J,{tone:`good`,children:[(0,G.jsx)(F,{size:12}),` `,`Mark is live`]}):(0,G.jsx)(J,{tone:`neutral`,children:`No mark on the peer`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`A verifier company's icon — not the official checkmark`,text:`A third-party mark is a verifier bot's own icon, drawn right BEFORE the name of an account, a bot or a channel, plus one line of description in the profile. It says “this verifier vouches for this peer”, and nothing more.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The icon is a custom emoji document. The client fetches it through messages.getCustomEmojiDocuments, so a document id that resolves to nothing renders as no badge at all — which is why marks are granted from the catalogue below rather than from a typed number.`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Verifier`,text:`The company whose icon the peer would carry, as its row stands right now.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/bots/${h.VerifierBotID}`),children:[(0,G.jsx)(ce,{size:15}),` `,`Open verifier bot`]})}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Company`,value:_?.CompanyName||`-`}),(0,G.jsx)(X,{label:`Bot`,value:U(h.VerifierBotUsername)||`-`}),(0,G.jsx)(X,{label:`Verifier bot ID`,value:h.VerifierBotID,mono:!0}),(0,G.jsx)(X,{label:`Document ID`,value:_?.IconDocumentID||`-`,mono:!0}),(0,G.jsx)(X,{label:`Name`,value:_?.IconName||`-`}),(0,G.jsx)(X,{label:`Own description`,value:_?.CanModifyCustomDescription?`Yes`:`No`})]}),(0,G.jsx)(fi,{label:`Default description`,children:_?.DefaultDescription?(0,G.jsx)(`p`,{className:`about-text`,children:_.DefaultDescription}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not set`})}),!_&&(0,G.jsx)(q,{children:`The verifier row is gone: its status was revoked after this application was filed. There is no icon to grant, so the application can only be rejected.`}),_&&!_.Enabled&&(0,G.jsx)(q,{children:`This verifier is disabled. It cannot mark anything new until an operator enables it again.`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Peer`,text:`The account, bot or channel the icon would be attached to.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(ui(h.PeerType,h.PeerID)),children:[(0,G.jsx)(ge,{size:15}),` `,`Open peer`]})}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Type`,value:$r[h.PeerType]}),(0,G.jsx)(X,{label:`Username`,value:U(h.PeerUsername)||`-`}),(0,G.jsx)(X,{label:`Title`,value:h.PeerTitle||`-`}),(0,G.jsx)(X,{label:`Peer ID`,value:h.PeerID,mono:!0})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Applicant`,text:`Who filed the application with the verifier bot.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/accounts/${h.ApplicantUserID}`),children:[(0,G.jsx)(et,{size:15}),` `,`Open account`]})}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Username`,value:U(h.ApplicantUsername)||`-`}),(0,G.jsx)(X,{label:`User ID`,value:h.ApplicantUserID,mono:!0}),(0,G.jsx)(X,{label:`Filed`,value:W(h.CreatedAt)||`-`}),(0,G.jsx)(X,{label:`Updated`,value:W(h.UpdatedAt)||`-`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Application`,text:`What the applicant wrote, rendered as plain text.`}),(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Correlation ID`,value:h.CorrelationID||`-`,mono:!0}),(0,G.jsx)(X,{label:`Status`,value:Qr[h.Status]})]}),(0,G.jsx)(fi,{label:`Stated reason`,children:h.Reason?(0,G.jsx)(`p`,{className:`about-text`,children:h.Reason}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not set`})}),(0,G.jsx)(fi,{label:`Requested description`,children:C?(0,G.jsx)(`p`,{className:`about-text`,children:C}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not set`})}),(0,G.jsx)(fi,{label:`Description the mark would carry`,children:T?(0,G.jsx)(`p`,{className:`about-text`,children:T}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not set`})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Resolved the same way the backend resolves it: the applicant's wording only when this verifier may set its own description, otherwise the verifier's default.`}),C!==``&&!w&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This verifier may not set a per-peer description, so the requested wording is ignored and the default is applied.`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Decision`,text:`What was decided, by whom, and with which wording.`}),(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Decided by`,value:h.DecidedBy||`-`}),(0,G.jsx)(X,{label:`Approved`,value:W(h.ApprovedAt)||`-`}),(0,G.jsx)(X,{label:`Rejected`,value:W(h.RejectedAt)||`-`}),(0,G.jsx)(X,{label:`Version (optimistic lock)`,value:h.Version,mono:!0})]}),(0,G.jsx)(fi,{label:`Decision reason`,children:h.DecisionReason?(0,G.jsx)(`p`,{className:`about-text`,children:h.DecisionReason}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`No decision yet`})}),(0,G.jsx)(fi,{label:`Internal note · admins only`,children:h.InternalNote?(0,G.jsx)(`p`,{className:`about-text`,children:h.InternalNote}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not set`})})]})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsxs)(`div`,{className:`dock-title`,children:[(0,G.jsx)(qe,{size:14}),` `,`Decision`]}),!b&&!x&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This status has no available actions.`}),(b||x)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Internal note`}),(0,G.jsx)(`textarea`,{value:i,onChange:e=>a(e.target.value),rows:3,placeholder:`Handover note for other admins`})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Optional. Stored with the decision and visible to admins only — never sent to the applicant.`})]}),b&&(0,G.jsxs)(G.Fragment,{children:[!_&&(0,G.jsx)(q,{children:`The verifier row is gone: its status was revoked after this application was filed. There is no icon to grant, so the application can only be rejected.`}),_&&!_.Enabled&&(0,G.jsx)(q,{children:`This verifier is disabled. It cannot mark anything new until an operator enables it again.`}),y&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This peer already carries this verifier's mark; approving refreshes the description and records the decision.`}),(0,G.jsxs)(`div`,{className:`action-stack`,children:[(0,G.jsx)(Z,{label:`Approve`,icon:(0,G.jsx)(L,{size:15}),tone:`neutral`,path:`/api/botverification/requests/${h.ID}/approve`,payload:E,onDone:D,onError:m}),(0,G.jsx)(Z,{label:`Reject`,icon:(0,G.jsx)(ee,{size:15}),tone:`warn`,path:`/api/botverification/requests/${h.ID}/reject`,payload:E,onDone:D,onError:m})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Puts the verifier's icon before the peer's name and its description in the profile, and messages the applicant.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The reason is mandatory: it is the wording the applicant is told, so write what exactly was missing.`})]}),x&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`dock-title`,children:[(0,G.jsx)(V,{size:14}),` `,`Danger zone`]}),(0,G.jsxs)(`div`,{className:`danger-zone`,children:[(0,G.jsx)(Z,{label:`Revoke mark`,icon:(0,G.jsx)(oe,{size:15}),tone:`danger`,path:`/api/botverification/requests/${h.ID}/revoke`,payload:E,onDone:D,onError:m}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Takes the icon and the description off the peer and closes the application as revoked. The official checkmark, if the peer has one, is untouched.`}),!y&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The peer carries no mark right now — revoking only closes the application.`})]})]})]})})]})}function fi({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:e}),t]})}function pi(e){return!e||!e.BotID||e.BotID===`0`?null:e}var mi=[`draft`,`submitted`,`in_review`,`approved`,`rejected`,`cancelled`],hi=[`bot`,`channel`,`supergroup`,`user`],gi={draft:`Draft`,submitted:`Submitted`,in_review:`In review`,approved:`Approved`,rejected:`Rejected`,cancelled:`Cancelled`},_i={bot:`Bot`,channel:`Channel`,supergroup:`Supergroup`,user:`User`};function vi({navigate:e}){let[t,n]=(0,g.useState)(`all`),[r,i]=(0,g.useState)(`all`),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(`50`),[d,f]=(0,g.useState)([]),[p,m]=(0,g.useState)({}),[h,_]=(0,g.useState)(!1),[v,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(``);async function w(e=!1){x(!0),C(``);let n=new URLSearchParams({limit:l});t!==`all`&&n.set(`status`,t),r!==`all`&&n.set(`target_type`,r),a.trim()&&n.set(`reviewer`,a.trim()),s.trim()&&n.set(`q`,s.trim().replace(/^@/,``)),e&&v&&n.set(`before_id`,v);try{let t=await k.verificationApplications(n),r=t.rows??[];f(t=>e?[...t,...r]:r),y(t.next_before_id??``),_(!!t.has_more)}catch(e){C(O(e))}finally{x(!1)}}async function T(){try{m((await k.verificationCounts()).counts??{})}catch(e){C(O(e))}}(0,g.useEffect)(()=>{w(!1),T()},[]);function E(){w(!1),T()}return(0,G.jsxs)(St,{title:`Verification queue`,eyebrow:`Verification / Queue`,actions:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:E,disabled:b,children:[(0,G.jsx)(Le,{size:15,className:b?`spin`:``}),` `,`Refresh`]}),children:[S&&(0,G.jsx)(q,{children:S}),(0,G.jsx)(`div`,{className:`metric-row`,children:mi.map(e=>(0,G.jsx)(Y,{label:gi[e],value:p[e]??`0`,mono:!0,tone:xi(e,p[e]??`0`)},e))}),(0,G.jsx)(Ct,{children:(0,G.jsxs)(`form`,{className:`toolbar`,onSubmit:e=>{e.preventDefault(),w(!1)},children:[(0,G.jsxs)(`label`,{className:`searchbox`,children:[(0,G.jsx)(Re,{size:15}),(0,G.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Application id, peer id, username or title`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Status`}),(0,G.jsxs)(`select`,{value:t,onChange:e=>n(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All statuses`}),mi.map(e=>(0,G.jsx)(`option`,{value:e,children:gi[e]},e))]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Target type`}),(0,G.jsxs)(`select`,{value:r,onChange:e=>i(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All types`}),hi.map(e=>(0,G.jsx)(`option`,{value:e,children:_i[e]},e))]})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Reviewer`}),(0,G.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`Any reviewer`})]}),(0,G.jsxs)(`label`,{className:`field-inline`,children:[(0,G.jsx)(`span`,{children:`Limit`}),(0,G.jsx)(`input`,{className:`small-input`,value:l,onChange:e=>u(e.target.value),type:`number`,min:`1`,max:`200`})]}),(0,G.jsxs)(`button`,{className:`btn primary icon-text`,type:`submit`,disabled:b,children:[b?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(Re,{size:15}),` `,`Search`]})]})}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`ID`}),(0,G.jsx)(`th`,{children:`Target`}),(0,G.jsx)(`th`,{children:`Applicant`}),(0,G.jsx)(`th`,{children:`Category`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Submitted`}),(0,G.jsx)(`th`,{children:`Reviewer`}),(0,G.jsx)(`th`,{})]})}),(0,G.jsxs)(`tbody`,{children:[d.map(t=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`mono`,children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/verification/${t.ID}`),children:[`#`,t.ID]})}),(0,G.jsxs)(`td`,{children:[(0,G.jsx)(`strong`,{children:Si(t)}),(0,G.jsxs)(`div`,{className:`entity-subtitle mono`,children:[_i[t.TargetType],` · `,t.TargetID]}),t.TargetVerified&&(0,G.jsxs)(J,{tone:`good`,children:[(0,G.jsx)(F,{size:12}),` `,`Badge already on`]})]}),(0,G.jsxs)(`td`,{children:[U(t.ApplicantUsername)||t.ApplicantName||`-`,(0,G.jsx)(`div`,{className:`entity-subtitle mono`,children:t.ApplicantUserID})]}),(0,G.jsx)(`td`,{children:t.Category||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsx)(yi,{status:t.Status})}),(0,G.jsx)(`td`,{children:W(t.SubmittedAt)||`-`}),(0,G.jsx)(`td`,{children:t.ReviewerAdminID||`-`}),(0,G.jsx)(`td`,{children:(0,G.jsxs)(`button`,{className:`row-link`,type:`button`,onClick:()=>e(`/verification/${t.ID}`),children:[(0,G.jsx)(Ue,{size:14}),` `,`Details`,` `,(0,G.jsx)(pe,{size:14})]})})]},t.ID)),d.length===0&&(0,G.jsx)(Dt,{colSpan:8})]})]})}),h&&(0,G.jsx)(`div`,{className:`toolbar`,children:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>w(!0),disabled:b,children:[b?(0,G.jsx)(R,{size:15,className:`spin`}):(0,G.jsx)(de,{size:15}),` `,`Load more`]})})]})}function yi({status:e}){return(0,G.jsx)(J,{tone:bi(e),children:gi[e]})}function bi(e){return e===`approved`?`good`:e===`submitted`||e===`in_review`?`warn`:e===`rejected`?`danger`:`neutral`}function xi(e,t){return e===`submitted`||e===`in_review`?t!==`0`&&t!==``?`warn`:`neutral`:e===`approved`?`good`:`neutral`}function Si(e){return U(e.TargetUsername)||e.TargetTitle||`#${e.TargetID}`}function Ci(e){return e.TargetType===`bot`?`/bots/${e.TargetID}`:e.TargetType===`user`?`/accounts/${e.TargetID}`:`/channels/${e.TargetID}`}var wi={created:`Created`,updated:`Updated`,submitted:`Submitted`,claimed:`Claimed`,approved:`Approved`,rejected:`Rejected`,cancelled:`Cancelled`,revoked:`Badge revoked`,notified:`Applicant notified`};function Ti({id:e,navigate:t}){let{can:n}=It(),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``);async function p(){u(!0),f(``);try{i(await k.verificationApplication(e))}catch(e){f(O(e))}finally{u(!1)}}function m(){c(!1),p()}(0,g.useEffect)(()=>{p()},[e]);function h(e){if(e instanceof v&&e.status===409)return c(!0),p(),`Another admin has already changed this application. The data has been reloaded — check the status before deciding again.`}if(d&&!r)return(0,G.jsx)(q,{children:d});if(!r)return(0,G.jsx)(Ot,{label:`Loading the application…`});let _=r.application,y=r.events??[],b=r.applicant_controls_target,x=r.target_verified,S=_.Status===`submitted`,C=_.Status===`submitted`||_.Status===`in_review`,w=_.Status===`approved`&&n(`verification.revoke`),T=a.trim();function E(){let e={version:_.Version};return T&&(e.internal_note=T),e}function D(){o(``),c(!1),p()}return(0,G.jsxs)(St,{title:`Application #${_.ID}`,eyebrow:`Verification / Review`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/verification`),children:[(0,G.jsx)(ie,{size:15}),` `,`Back to list`]}),(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:m,disabled:l,children:[(0,G.jsx)(Le,{size:15,className:l?`spin`:``}),` `,`Refresh`]})]}),children:[d&&(0,G.jsx)(q,{children:d}),s&&(0,G.jsx)(q,{children:`Another admin has already changed this application. The data has been reloaded — check the status before deciding again.`}),(0,G.jsx)(wt,{main:(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`section`,{className:`entity-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`entity-title`,children:Si(_)}),(0,G.jsxs)(`div`,{className:`entity-subtitle mono`,children:[`#`,_.ID,` · `,_i[_.TargetType],`:`,_.TargetID,` · v`,_.Version]})]}),(0,G.jsxs)(`div`,{className:`entity-badges`,children:[(0,G.jsx)(yi,{status:_.Status}),x&&(0,G.jsxs)(J,{tone:`good`,children:[(0,G.jsx)(F,{size:12}),` `,`Badge already on`]}),(0,G.jsx)(J,{tone:b?`good`:`danger`,children:b?`Control confirmed`:`No control over the target`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Target`,text:`The peer the badge would be attached to, as it exists right now.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(Ci(_)),children:[(0,G.jsx)(ge,{size:15}),` `,`Open target`]})}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Type`,value:_i[_.TargetType]}),(0,G.jsx)(X,{label:`Username`,value:U(_.TargetUsername)||`-`}),(0,G.jsx)(X,{label:`Title`,value:_.TargetTitle||`-`}),(0,G.jsx)(X,{label:`Peer ID`,value:_.TargetID,mono:!0})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Applicant`,text:`Who filed the application and whether they still hold rights on the target.`,action:(0,G.jsxs)(`button`,{className:`btn icon-text`,type:`button`,onClick:()=>t(`/accounts/${_.ApplicantUserID}`),children:[(0,G.jsx)(et,{size:15}),` `,`Open account`]})}),(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Username`,value:U(_.ApplicantUsername)||`-`}),(0,G.jsx)(X,{label:`Name`,value:_.ApplicantName||`-`}),(0,G.jsx)(X,{label:`User ID`,value:_.ApplicantUserID,mono:!0}),(0,G.jsx)(X,{label:`Submitted`,value:W(_.SubmittedAt)||`-`})]}),b?(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The applicant controls the target right now — checked against the live records, not against the submission snapshot.`}):(0,G.jsx)(q,{children:`The applicant no longer controls the target. Approving would hand the badge to someone who does not hold the peer — normally a reason to reject.`})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Application`,text:`Everything the applicant submitted, rendered as plain text.`}),(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Category`,value:_.Category||`-`}),(0,G.jsx)(X,{label:`Correlation ID`,value:_.CorrelationID||`-`,mono:!0}),(0,G.jsx)(X,{label:`Created`,value:W(_.CreatedAt)||`-`}),(0,G.jsx)(X,{label:`Updated`,value:W(_.UpdatedAt)||`-`})]}),(0,G.jsx)(Ei,{label:`Description`,children:_.Description?(0,G.jsx)(`p`,{className:`about-text`,children:_.Description}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not provided`})}),(0,G.jsx)(Ei,{label:`Official website`,children:_.OfficialWebsite?(0,G.jsx)(`div`,{className:`about-text`,children:(0,G.jsx)(Di,{value:_.OfficialWebsite})}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not provided`})}),(0,G.jsx)(Ei,{label:`Social links`,children:(0,G.jsx)(Oi,{values:_.SocialLinks})}),(0,G.jsx)(Ei,{label:`Press coverage`,children:(0,G.jsx)(Oi,{values:_.PressLinks})}),(0,G.jsx)(Ei,{label:`Applicant comment`,children:_.AdditionalNote?(0,G.jsx)(`p`,{className:`about-text`,children:_.AdditionalNote}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not provided`})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Only http:// and https:// links are clickable and open in a new tab; anything else is shown as text.`})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`Decision`,text:`What was decided, by whom, and with which wording.`}),(0,G.jsxs)(`div`,{className:`stacked-sections`,children:[(0,G.jsxs)(`div`,{className:`summary-grid`,children:[(0,G.jsx)(X,{label:`Reviewer`,value:_.ReviewerAdminID||`-`}),(0,G.jsx)(X,{label:`Decided`,value:W(_.ReviewedAt)||`-`}),(0,G.jsx)(X,{label:`Status`,value:gi[_.Status]}),(0,G.jsx)(X,{label:`Version (optimistic lock)`,value:_.Version,mono:!0})]}),(0,G.jsx)(Ei,{label:`Decision reason`,children:_.DecisionReason?(0,G.jsx)(`p`,{className:`about-text`,children:_.DecisionReason}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`No decision yet`})}),(0,G.jsx)(Ei,{label:`Internal note · admins only`,children:_.InternalNote?(0,G.jsx)(`p`,{className:`about-text`,children:_.InternalNote}):(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not provided`})})]})]}),(0,G.jsxs)(`section`,{className:`section-block`,children:[(0,G.jsx)(K,{title:`History`,text:`Immutable trail of every status transition, with actor and reason.`}),(0,G.jsx)(`div`,{className:`table-wrap`,children:(0,G.jsxs)(`table`,{className:`data-table`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Event`}),(0,G.jsx)(`th`,{children:`From → to`}),(0,G.jsx)(`th`,{children:`Actor`}),(0,G.jsx)(`th`,{children:`Reason`}),(0,G.jsx)(`th`,{children:`Internal note`}),(0,G.jsx)(`th`,{children:`Time`})]})}),(0,G.jsxs)(`tbody`,{children:[y.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{children:(0,G.jsx)(ki,{kind:e.Kind})}),(0,G.jsxs)(`td`,{className:`mono`,children:[e.FromStatus||`-`,` → `,e.ToStatus||`-`]}),(0,G.jsx)(`td`,{children:e.Actor||`-`}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Reason||`-`}),(0,G.jsx)(`td`,{className:`truncate`,children:e.Note||`-`}),(0,G.jsx)(`td`,{children:W(e.CreatedAt)||`-`})]},e.ID)),y.length===0&&(0,G.jsx)(Dt,{colSpan:6})]})]})})]})]}),side:(0,G.jsxs)(`section`,{className:`action-dock`,children:[(0,G.jsx)(`div`,{className:`dock-title`,children:`Review actions`}),!S&&!C&&!w&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`This status has no available actions.`}),S&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`action-stack`,children:(0,G.jsx)(Z,{label:`Take into review`,icon:(0,G.jsx)(Se,{size:15}),tone:`neutral`,path:`/api/verification/applications/${_.ID}/claim`,payload:()=>({version:_.Version}),onDone:D,onError:h})}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Assigns the application to you and moves it to in review, so two reviewers never work on the same one.`})]}),(C||w)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:`Internal note`}),(0,G.jsx)(`textarea`,{value:a,onChange:e=>o(e.target.value),rows:3,placeholder:`Handover note for other reviewers`})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Optional. Stored with the decision and visible to admins only — never sent to the applicant.`})]}),C&&(0,G.jsxs)(G.Fragment,{children:[!b&&(0,G.jsx)(q,{children:`The applicant no longer controls the target. Approving would hand the badge to someone who does not hold the peer — normally a reason to reject.`}),x&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The target already carries the badge; approving only records the decision.`}),(0,G.jsxs)(`div`,{className:`action-stack`,children:[(0,G.jsx)(Z,{label:`Approve`,icon:(0,G.jsx)(L,{size:15}),tone:`neutral`,path:`/api/verification/applications/${_.ID}/approve`,payload:E,onDone:D,onError:h}),(0,G.jsx)(Z,{label:`Reject`,icon:(0,G.jsx)(ee,{size:15}),tone:`warn`,path:`/api/verification/applications/${_.ID}/reject`,payload:E,onDone:D,onError:h})]}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Grants the official badge to the target and closes the application.`}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The reason is mandatory: it is the wording the applicant is told, so write what exactly was missing.`})]}),w&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`dock-title`,children:[(0,G.jsx)(V,{size:14}),` `,`Danger zone`]}),(0,G.jsxs)(`div`,{className:`danger-zone`,children:[(0,G.jsx)(Z,{label:`Revoke verification`,icon:(0,G.jsx)(oe,{size:15}),tone:`danger`,path:`/api/actions/revoke-verification`,payload:()=>{let e={target_type:_.TargetType,target_id:_.TargetID};return T&&(e.internal_note=T),e},onDone:D,onError:h}),(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Clears the badge from the target. The approved application stays in history.`}),!x&&(0,G.jsx)(`p`,{className:`bot-create-note`,children:`The target carries no badge right now — there is nothing to revoke.`})]})]})]})})]})}function Ei({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`duration-field`,children:[(0,G.jsx)(`span`,{children:e}),t]})}function Di({value:e}){let t=ct(e);return t?(0,G.jsxs)(`a`,{className:`row-link`,href:t,target:`_blank`,rel:`noopener noreferrer`,children:[e,` `,(0,G.jsx)(ge,{size:13})]}):(0,G.jsx)(`span`,{className:`mono`,children:e})}function Oi({values:e}){let t=(e??[]).filter(e=>e.trim()!==``);return t.length===0?(0,G.jsx)(`p`,{className:`bot-create-note`,children:`Not provided`}):(0,G.jsx)(`div`,{className:`about-text`,children:t.map((e,t)=>(0,G.jsx)(`div`,{children:(0,G.jsx)(Di,{value:e})},`${t}-${e}`))})}function ki({kind:e}){return(0,G.jsx)(J,{tone:e===`approved`?`good`:e===`rejected`||e===`revoked`||e===`cancelled`?`danger`:e===`submitted`||e===`claimed`?`warn`:`neutral`,children:wi[e]})}function Ai({route:e,navigate:t}){let n=e.path.match(/^\/accounts\/(\d+)$/)?.[1],r=e.path.match(/^\/channels\/(\d+)$/)?.[1],i=e.path.match(/^\/bots\/(\d+)$/)?.[1],a=e.path.match(/^\/moderation\/(\d+)$/)?.[1],o=e.path.match(/^\/collectible-usernames\/(\d+)$/)?.[1],s=e.path.match(/^\/account-ratings\/(\d+)$/)?.[1],c=e.path.match(/^\/verification\/(\d+)$/)?.[1],l=e.path.match(/^\/bot-verification\/(\d+)$/)?.[1];return l?(0,G.jsx)(Rt,{permission:Mt,children:(0,G.jsx)(di,{id:l,navigate:t})}):e.path===`/bot-verification`?(0,G.jsx)(Rt,{permission:Mt,children:(0,G.jsx)(ei,{navigate:t})}):c?(0,G.jsx)(Rt,{permission:jt,children:(0,G.jsx)(Ti,{id:c,navigate:t})}):e.path===`/verification`?(0,G.jsx)(Rt,{permission:jt,children:(0,G.jsx)(vi,{navigate:t})}):o?(0,G.jsx)(Ln,{id:o,navigate:t}):s?(0,G.jsx)(_n,{userID:s,navigate:t}):e.path===`/collectible-usernames`?(0,G.jsx)(Nn,{navigate:t}):e.path===`/account-ratings`?(0,G.jsx)(pn,{navigate:t}):e.path===`/storage`?(0,G.jsx)(Kr,{navigate:t}):n?(0,G.jsx)(dn,{id:Number(n),navigate:t}):r?(0,G.jsx)(Vn,{id:Number(r),navigate:t}):i?(0,G.jsx)(Un,{id:Number(i),navigate:t}):a?(0,G.jsx)(Vr,{id:Number(a),navigate:t}):e.path===`/accounts`?(0,G.jsx)(kn,{navigate:t}):e.path===`/channels`?(0,G.jsx)(Hn,{navigate:t}):e.path===`/bots`?(0,G.jsx)(Wn,{navigate:t}):e.path===`/moderation`?(0,G.jsx)(Pr,{navigate:t}):e.path===`/emoji`?(0,G.jsx)(Er,{kind:`emoji`}):e.path===`/gifts`?(0,G.jsx)(br,{}):e.path===`/stickers`?(0,G.jsx)(Er,{kind:`stickers`}):e.path===`/give-gifts`?(0,G.jsx)(jr,{}):e.path===`/messages/detail`||e.path===`/messages/private/detail`?(0,G.jsx)(Yn,{ownerUserID:Number(e.search.get(`owner_user_id`)||`0`),msgID:Number(e.search.get(`msg_id`)||`0`),navigate:t}):e.path===`/messages/groups/detail`?(0,G.jsx)(qn,{channelID:Number(e.search.get(`channel_id`)||`0`),msgID:Number(e.search.get(`msg_id`)||`0`),navigate:t}):e.path===`/messages/groups`?(0,G.jsx)(Jn,{navigate:t}):e.path===`/messages`||e.path===`/messages/private`?(0,G.jsx)(Xn,{navigate:t}):(0,G.jsx)(Gn,{navigate:t})}function ji(){let[e,t]=(0,g.useState)(void 0),[n,r]=(0,g.useState)(()=>Bt());(0,g.useEffect)(()=>{let e=()=>r(Bt());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,g.useEffect)(()=>{k.session().then(e=>t(e)).catch(()=>t(null))},[]);let i=e=>{window.history.pushState(null,``,e),r(Bt())};return e===void 0?(0,G.jsx)(Zt,{}):e===null?(0,G.jsx)(en,{onLogin:t}):(0,G.jsx)(Ft,{permissions:e.permissions??[],children:(0,G.jsx)(Qt,{actor:e.actor,route:n,navigate:i,onLogout:()=>t(null),children:(0,G.jsx)(Ai,{route:n,navigate:i})})})}_.createRoot(document.getElementById(`root`)).render((0,G.jsx)(g.StrictMode,{children:(0,G.jsx)(Kt,{children:(0,G.jsx)(ji,{})})})); \ No newline at end of file diff --git a/cmd/telesrv-admin/web/dist/index.html b/cmd/telesrv-admin/web/dist/index.html index 51fff711..be18cc45 100644 --- a/cmd/telesrv-admin/web/dist/index.html +++ b/cmd/telesrv-admin/web/dist/index.html @@ -23,7 +23,7 @@ })(); - + diff --git a/cmd/telesrv-admin/web/src/components/Layout.tsx b/cmd/telesrv-admin/web/src/components/Layout.tsx index a756fd9f..3c6889f4 100644 --- a/cmd/telesrv-admin/web/src/components/Layout.tsx +++ b/cmd/telesrv-admin/web/src/components/Layout.tsx @@ -7,8 +7,6 @@ import { LayoutDashboard, LogOut, MessageSquareText, - Server, - Shield, ShieldAlert, ShieldCheck, Smile, @@ -22,7 +20,7 @@ import { import { useEffect, useState, type ReactNode } from "react"; import { api } from "../api"; import { permissionBotVerificationReview, permissionVerificationReview, useCan } from "../permissions"; -import { type Navigate, type RouteState, routeSubtitle, routeTitle } from "../routing"; +import { type Navigate, type RouteState, routeTitle } from "../routing"; import { ThemeSwitch } from "../theme"; import { AppLink } from "./AppLink"; @@ -137,17 +135,10 @@ export function Shell({ )} -
-
{"Runtime"}
-
{"Admin backend"}{"Ready"}
-
{"PG read"}{"Read-only"}
-
{"Write operations"}{"Dry-run"}
-
-
{routeSubtitle(route.path)}

{routeTitle(route.path)}

diff --git a/cmd/telesrv-admin/web/src/pages/AccountsPage.tsx b/cmd/telesrv-admin/web/src/pages/AccountsPage.tsx index c27f10b9..89a8b99c 100644 --- a/cmd/telesrv-admin/web/src/pages/AccountsPage.tsx +++ b/cmd/telesrv-admin/web/src/pages/AccountsPage.tsx @@ -122,7 +122,7 @@ export function AccountsPage({ navigate }: { navigate: Navigate }) {
{ event.preventDefault(); void loadFresh(); }}>